Skip to content

Commit

Permalink
Feat: Provide cookieConsent instance to callbacks #CCM-24
Browse files Browse the repository at this point in the history
  • Loading branch information
OndraM committed Nov 1, 2021
1 parent 3f1367e commit 9232b09
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/LmcCookieConsentManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import { config as configSk } from './languages/sk';
const defaultOptions = {
currentLang: 'cs',
themeCss: '',
onFirstAccept: (cookie) => {},
onFirstAcceptOnlyNecessary: (cookie) => {},
onFirstAcceptAll: (cookie) => {},
onAccept: (cookie) => {},
onAcceptOnlyNecessary: (cookie) => {},
onAcceptAll: (cookie) => {},
onFirstAccept: (cookie, cookieConsent) => {},
onFirstAcceptOnlyNecessary: (cookie, cookieConsent) => {},
onFirstAcceptAll: (cookie, cookieConsent) => {},
onAccept: (cookie, cookieConsent) => {},
onAcceptOnlyNecessary: (cookie, cookieConsent) => {},
onAcceptAll: (cookie, cookieConsent) => {},
config: {},
};

Expand Down Expand Up @@ -81,16 +81,18 @@ const LmcCookieConsentManager = (args) => {
'CookieConsent.revision': cookie.revision,
});

onAccept(cookie);
onAccept(cookie, cookieConsent);

if (isFirstTimeAccept) {
onFirstAccept(cookie);
onFirstAccept(cookie, cookieConsent);
acceptedOnlyNecessary
? onFirstAcceptOnlyNecessary(cookie)
: onFirstAcceptAll(cookie);
? onFirstAcceptOnlyNecessary(cookie, cookieConsent)
: onFirstAcceptAll(cookie, cookieConsent);
}

acceptedOnlyNecessary ? onAcceptOnlyNecessary(cookie) : onAcceptAll(cookie);
acceptedOnlyNecessary
? onAcceptOnlyNecessary(cookie, cookieConsent)
: onAcceptAll(cookie, cookieConsent);
},
languages: {
cs: configCs,
Expand Down

0 comments on commit 9232b09

Please sign in to comment.