Skip to content

Commit 9232b09

Browse files
committed
Feat: Provide cookieConsent instance to callbacks #CCM-24
1 parent 3f1367e commit 9232b09

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/LmcCookieConsentManager.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ import { config as configSk } from './languages/sk';
88
const defaultOptions = {
99
currentLang: 'cs',
1010
themeCss: '',
11-
onFirstAccept: (cookie) => {},
12-
onFirstAcceptOnlyNecessary: (cookie) => {},
13-
onFirstAcceptAll: (cookie) => {},
14-
onAccept: (cookie) => {},
15-
onAcceptOnlyNecessary: (cookie) => {},
16-
onAcceptAll: (cookie) => {},
11+
onFirstAccept: (cookie, cookieConsent) => {},
12+
onFirstAcceptOnlyNecessary: (cookie, cookieConsent) => {},
13+
onFirstAcceptAll: (cookie, cookieConsent) => {},
14+
onAccept: (cookie, cookieConsent) => {},
15+
onAcceptOnlyNecessary: (cookie, cookieConsent) => {},
16+
onAcceptAll: (cookie, cookieConsent) => {},
1717
config: {},
1818
};
1919

@@ -81,16 +81,18 @@ const LmcCookieConsentManager = (args) => {
8181
'CookieConsent.revision': cookie.revision,
8282
});
8383

84-
onAccept(cookie);
84+
onAccept(cookie, cookieConsent);
8585

8686
if (isFirstTimeAccept) {
87-
onFirstAccept(cookie);
87+
onFirstAccept(cookie, cookieConsent);
8888
acceptedOnlyNecessary
89-
? onFirstAcceptOnlyNecessary(cookie)
90-
: onFirstAcceptAll(cookie);
89+
? onFirstAcceptOnlyNecessary(cookie, cookieConsent)
90+
: onFirstAcceptAll(cookie, cookieConsent);
9191
}
9292

93-
acceptedOnlyNecessary ? onAcceptOnlyNecessary(cookie) : onAcceptAll(cookie);
93+
acceptedOnlyNecessary
94+
? onAcceptOnlyNecessary(cookie, cookieConsent)
95+
: onAcceptAll(cookie, cookieConsent);
9496
},
9597
languages: {
9698
cs: configCs,

0 commit comments

Comments
 (0)