Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmp changes to test #251

Open
wants to merge 4 commits into
base: dreamlab
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"start": "serve build -s -c 1",
"prestart": "npm run build",
"build": "cross-env NODE_ENV=production webpack --progress",
"dev-build": "cross-env NODE_ENV=development webpack --progress",
"prebuild": "npm run clean && mkdirp build",
"test": "npm run -s lint && jest --coverage",
"test:watch": "npm run -s test -- --watch",
Expand Down
15 changes: 15 additions & 0 deletions src/components/popup/details/details.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,19 @@ export default class Details extends Component {
};
};

handleSaveAndGo = () => {
const { store } = this.props;
store.selectAllVendors(true);
store.selectAllVendorLegitimateInterests(true);
store.selectAllPurposes(true);
store.selectAllPurposesLegitimateInterests(true);
store.selectAllSpecialFeatureOptins(true);
store.selectAllPublisherPurposes(true);
store.selectAllPublisherLegitimateInterests(true);
store.setAllContractPurposes(false);
this.props.onSaveOrClose();
};

render(props, state) {
const {
onSaveOrClose,
Expand Down Expand Up @@ -194,6 +207,8 @@ export default class Details extends Component {
localizeKey='back'>Back</LocalLabel></a>
<Button ariaLabel='save settings and close' class={style.save} onClick={onSaveOrClose}><LocalLabel
prefix={'tabs.tab' + (selectedTab + 1)} localizeKey='save'>Save and Exit</LocalLabel></Button>
{ window.__tcfConfig.showAgreeAndGoButton && <Button ariaLabel='accept all and go' class={style.saveAndGo} onClick={this.handleSaveAndGo}><LocalLabel
prefix={'tabs.tab' + (selectedTab + 1)} localizeKey='okngo'>Wyraź zgodę i przejdź do serwisu</LocalLabel></Button> }
</div>
</div>
);
Expand Down
6 changes: 6 additions & 0 deletions src/components/popup/details/details.less
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@
margin-right: 20px;
width: 205px;
}

.saveAndGo {
margin-right: 20px;
width: 270px;
}

.cancel {
margin-right: 25px;
background: none;
Expand Down
8 changes: 8 additions & 0 deletions src/components/popup/intro/intro.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default class Intro extends Component {

const {
onAcceptAll,
onDontAgree,
onShowPurposes
} = props;

Expand Down Expand Up @@ -64,6 +65,13 @@ export default class Intro extends Component {
>
<LocalLabel localizeKey='acceptAll'>Got it, thanks!</LocalLabel>
</Button>
{ window.__tcfConfig.showDontAgreeButton && <Button
ariaLabel='dont agree'
class={style.dontAgree}
onClick={onDontAgree}
>
<LocalLabel localizeKey='dontAgree'>Nie wyrażam zgody</LocalLabel>
</Button>}
</div>
</div>
);
Expand Down
5 changes: 5 additions & 0 deletions src/components/popup/intro/intro.less
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ div.intro {
.acceptAll {
flex: 1;
}

.dontAgree {
flex: 1;
margin-left: 10px;
}
}

.intro {
Expand Down
7 changes: 7 additions & 0 deletions src/components/popup/popup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ export default class Popup extends Component {
this.onCancel()
};

handleDontAgree = () => {
const { store, onSave } = this.props;
store.initialVendorsRejection();
onSave();
};

render(props) {
const { store } = props;
const { isConsentToolShowing, section } = store;
Expand All @@ -50,6 +56,7 @@ export default class Popup extends Component {
<Intro
onAcceptAll={this.onAcceptAll}
onShowPurposes={this.handleShowDetails}
onDontAgree={this.handleDontAgree}
/>
<Details
onSaveOrClose={this.handleCloseOrSave}
Expand Down
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ function start() {

const configUpdates = {
globalConsentLocation: 'https://rasp.mgr.consensu.org/portal.html',
showDontAgreeButton: false,
showAgreeAndGoButton: false,
...tcfConfig
};

Expand Down
5 changes: 5 additions & 0 deletions src/lib/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,11 @@ export default class Store {
}
};

initialRejection = () => {
this.setCustomVendorsConsent(false);
this.selectAllVendors(false);
};

selectPurpose = (purposeId, isSelected) => {
const {contractPurposeIds} = config;
const {purposeConsents} = this.tcModel;
Expand Down