Skip to content

Commit 5149b74

Browse files
committed
v0.3.0
1 parent 7672f5e commit 5149b74

File tree

4 files changed

+419
-69
lines changed

4 files changed

+419
-69
lines changed

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,32 @@
11

2+
<a name="0.3.0"></a>
3+
# [0.3.0](https://github.com/projects/lmc-eu/repos/cookie-consent-manager/compare/diff?targetBranch=refs%2Ftags%2F0.2.0&sourceBranch=refs%2Ftags%2F0.3.0) (2021-11-02)
4+
5+
6+
### Chores
7+
8+
9+
* Create release on local machine and publish by ci pipeline [#CCM-8](https://github.com/lmc-eu/cookie-consent-manager/issues/CCM-8) ([4ed90f9](https://github.com/projects/lmc-eu/repos/cookie-consent-manager/commits/4ed90f9))
10+
* Introduce publish package pipeline [#CCM-8](https://github.com/lmc-eu/cookie-consent-manager/issues/CCM-8) ([ac0a5aa](https://github.com/projects/lmc-eu/repos/cookie-consent-manager/commits/ac0a5aa))
11+
### Code Refactoring
12+
13+
14+
* Rearrange and document internal defaults ([5b6c8e6](https://github.com/projects/lmc-eu/repos/cookie-consent-manager/commits/5b6c8e6))
15+
### Dependencies
16+
17+
18+
* Bump all dependencies ([9b1b90c](https://github.com/projects/lmc-eu/repos/cookie-consent-manager/commits/9b1b90c))
19+
### Documentation
20+
21+
22+
* Extend description of necessary consent ([a0ec0de](https://github.com/projects/lmc-eu/repos/cookie-consent-manager/commits/a0ec0de))
23+
* How to publish this package [#CCM-8](https://github.com/lmc-eu/cookie-consent-manager/issues/CCM-8) ([7672f5e](https://github.com/projects/lmc-eu/repos/cookie-consent-manager/commits/7672f5e))
24+
### Features
25+
26+
27+
* Add 'ad' consent category [#CCM-12](https://github.com/lmc-eu/cookie-consent-manager/issues/CCM-12) ([5777638](https://github.com/projects/lmc-eu/repos/cookie-consent-manager/commits/5777638))
28+
* Enable management of third-party scripts ([0020661](https://github.com/projects/lmc-eu/repos/cookie-consent-manager/commits/0020661))
29+
230
<a name="0.2.0"></a>
331
# [0.2.0](https://github.com/projects/lmc-eu/repos/cookie-consent-manager/compare/diff?targetBranch=refs%2Ftags%2F0.1.0&sourceBranch=refs%2Ftags%2F0.2.0) (2021-11-01)
432

dist/LmcCookieConsentManager.js

Lines changed: 195 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -619,26 +619,22 @@
619619
typeof window.initCookieConsent !== "function" && (window.initCookieConsent = Wa);
620620
})();
621621

622-
// src/languages/en.js
622+
// src/languages/cs.js
623623
var config = {
624624
consent_modal: {
625-
title: "I use cookies",
626-
description: "Your cookie consent message here",
625+
title: "Tyto str\xE1nky vyu\u017E\xEDvaj\xED cookies",
626+
description: `Kliknut\xEDm na \u201EP\u0159ijmout v\u0161e\u201C d\xE1v\xE1te souhlas spole\u010Dnosti LMC s.r.o. k\xA0vyu\u017E\xEDv\xE1n\xED soubor\u016F Cookies a\xA0dal\u0161\xEDch identifik\xE1tor\u016F ve\xA0va\u0161em za\u0159\xEDzen\xED. Pou\u017Eit\xED t\u011Bchto Cookies a\xA0dal\u0161\xEDch identifik\xE1tor\u016F usnadn\xED navigaci na str\xE1nk\xE1ch, zobrazen\xED personalizovan\xE9ho obsahu, c\xEDlen\xFD marketing, anal\xFDzu vyu\u017E\xEDv\xE1n\xED na\u0161ich produkt\u016F a\xA0slu\u017Eeb.
627+
V\xEDce informac\xED naleznete na\xA0str\xE1nce\xA0<a href="https://www.lmc.eu/cs/cookies" target="_blank">Pou\u017E\xEDv\xE1n\xED\xA0cookies</a>.`,
627628
primary_btn: {
628-
text: "Accept",
629+
text: "P\u0159ijmout v\u0161e",
629630
role: "accept_all"
630631
},
631632
secondary_btn: {
632-
text: "Reject",
633+
text: "P\u0159ijmout nezbytn\xE9",
633634
role: "accept_necessary"
634635
}
635636
},
636637
settings_modal: {
637-
title: "Cookie settings",
638-
save_settings_btn: "Save settings",
639-
accept_all_btn: "Accept all",
640-
reject_all_btn: "Reject all",
641-
close_btn_label: "Close",
642638
blocks: [
643639
{
644640
toggle: {
@@ -647,6 +643,13 @@
647643
readonly: true
648644
}
649645
},
646+
{
647+
toggle: {
648+
value: "ad",
649+
enabled: false,
650+
readonly: false
651+
}
652+
},
650653
{
651654
toggle: {
652655
value: "analytics",
@@ -672,26 +675,134 @@
672675
}
673676
};
674677

675-
// src/languages/cs.js
678+
// src/languages/en.js
676679
var config2 = {
677680
consent_modal: {
678-
title: "Tyto str\xE1nky pou\u017E\xEDvaj\xED cookies",
679-
description: 'Cookies pou\u017E\xEDv\xE1me, abychom zajistili spr\xE1vn\xE9 fungov\xE1n\xED a bezpe\u010Dnost na\u0161ich str\xE1nek, t\xEDm p\xE1dem co nejlep\u0161\xED zku\u0161enost p\u0159i n\xE1v\u0161t\u011Bv\u011B. Kliknut\xEDm na \u201EP\u0159ijmout v\u0161echny\u201C d\xE1v\xE1te sv\u016Fj souhlas s pou\u017Eit\xEDm cookies pro \xFA\u010Dely reklamy a analytik. Sv\xE1 nastaven\xED cookies m\u016F\u017Eete pozd\u011Bji kdykoliv zm\u011Bnit. V\xEDce informac\xED naleznete v <a href="#">Prohl\xE1\u0161en\xED o cookies.</a>',
681+
title: "This website uses cookies",
682+
description: `By clicking on "Accept all", you give your consent to LMC s.r.o. to use cookies and other identifiers on your device. The use of these cookies and other identifiers will simplify navigation on the site, enable personalized content, targeted marketing, analysis of the usage of our products and services.
683+
For more information read page <a href="https://www.lmc.eu/en/cookies/" target="_blank">Use\xA0of\xA0cookies</a>.`,
680684
primary_btn: {
681-
text: "P\u0159ijmout",
685+
text: "Accept all",
682686
role: "accept_all"
683687
},
684688
secondary_btn: {
685-
text: "P\u0159ijmout nezbytn\xE9",
689+
text: "Accept necessary",
690+
role: "accept_necessary"
691+
}
692+
},
693+
settings_modal: {
694+
blocks: [
695+
{
696+
toggle: {
697+
value: "necessary",
698+
enabled: true,
699+
readonly: true
700+
}
701+
},
702+
{
703+
toggle: {
704+
value: "ad",
705+
enabled: false,
706+
readonly: false
707+
}
708+
},
709+
{
710+
toggle: {
711+
value: "analytics",
712+
enabled: false,
713+
readonly: false
714+
}
715+
},
716+
{
717+
toggle: {
718+
value: "functionality",
719+
enabled: false,
720+
readonly: false
721+
}
722+
},
723+
{
724+
toggle: {
725+
value: "personalization",
726+
enabled: false,
727+
readonly: false
728+
}
729+
}
730+
]
731+
}
732+
};
733+
734+
// src/languages/pl.js
735+
var config3 = {
736+
consent_modal: {
737+
title: "Ta strona u\u017Cywa cookies",
738+
description: `Klikaj\u0105c \u201EAkceptuj\u0119 wszystkie\u201D, wyra\u017Casz zgod\u0119 aby LMC s.r.o. wykorzystywa\u0142o pliki cookie i\xA0inne identyfikatory na Twoim urz\u0105dzeniu. Korzystanie z\xA0tych plik\xF3w cookie i\xA0innych identyfikator\xF3w u\u0142atwi nawigacj\u0119 w\xA0serwisie, wy\u015Bwietlanie spersonalizowanych tre\u015Bci, marketing ukierunkowany, analiz\u0119 korzystania z\xA0naszych produkt\xF3w i\xA0us\u0142ug.
739+
Wi\u0119cej informacji znajdziesz na stronie\xA0<a href="https://www.lmc.eu/pl/cookies" target="_blank">Korzystanie z\xA0plik\xF3w Cookies</a>.`,
740+
primary_btn: {
741+
text: "Akceptuj wszystkie",
742+
role: "accept_all"
743+
},
744+
secondary_btn: {
745+
text: "Akceptuj niezb\u0119dne",
746+
role: "accept_necessary"
747+
}
748+
},
749+
settings_modal: {
750+
blocks: [
751+
{
752+
toggle: {
753+
value: "necessary",
754+
enabled: true,
755+
readonly: true
756+
}
757+
},
758+
{
759+
toggle: {
760+
value: "ad",
761+
enabled: false,
762+
readonly: false
763+
}
764+
},
765+
{
766+
toggle: {
767+
value: "analytics",
768+
enabled: false,
769+
readonly: false
770+
}
771+
},
772+
{
773+
toggle: {
774+
value: "functionality",
775+
enabled: false,
776+
readonly: false
777+
}
778+
},
779+
{
780+
toggle: {
781+
value: "personalization",
782+
enabled: false,
783+
readonly: false
784+
}
785+
}
786+
]
787+
}
788+
};
789+
790+
// src/languages/sk.js
791+
var config4 = {
792+
consent_modal: {
793+
title: "Tieto str\xE1nky pou\u017E\xEDvaj\xFA cookies",
794+
description: `Kliknut\xEDm na \u201EPrija\u0165 v\u0161etky\u201C d\xE1vate s\xFAhlas spolo\u010Dnosti LMC s.r.o. k\xA0vyu\u017E\xEDvaniu s\xFAborov Cookies a\xA0\u010Fal\u0161\xEDch identifik\xE1torov vo\xA0va\u0161om zariaden\xED. Pou\u017Eitie t\xFDchto cookies a\xA0\u010Fal\u0161\xEDch identifik\xE1torov u\u013Eah\u010D\xED navig\xE1ciu na\xA0str\xE1nkach, zobrazenie personalizovan\xE9ho obsahu, cielen\xFD marketing, anal\xFDzu vyu\u017E\xEDvania na\u0161ich produktov a\xA0slu\u017Eieb.
795+
Viac inform\xE1ci\xED n\xE1jdete na\xA0str\xE1nke\xA0<a href="https://www.lmc.eu/sk/cookies" target="_blank">Pou\u017E\xEDvanie\xA0cookies</a>.`,
796+
primary_btn: {
797+
text: "Prija\u0165 v\u0161etky",
798+
role: "accept_all"
799+
},
800+
secondary_btn: {
801+
text: "Prija\u0165 nevyhnutn\xE9",
686802
role: "accept_necessary"
687803
}
688804
},
689805
settings_modal: {
690-
title: "Nastaven\xED cookies",
691-
save_settings_btn: "Ulo\u017Eit nastaven\xE9",
692-
accept_all_btn: "P\u0159ijmout v\u0161e",
693-
reject_all_btn: "Odm\xEDtnout v\u0161e",
694-
close_btn_label: "Zav\u0159\xEDt",
695806
blocks: [
696807
{
697808
toggle: {
@@ -700,6 +811,13 @@
700811
readonly: true
701812
}
702813
},
814+
{
815+
toggle: {
816+
value: "ad",
817+
enabled: false,
818+
readonly: false
819+
}
820+
},
703821
{
704822
toggle: {
705823
value: "analytics",
@@ -726,21 +844,53 @@
726844
};
727845

728846
// src/LmcCookieConsentManager.js
729-
var defaultOptions = { currentLang: "cs", themeCss: "", config: {} };
730-
var LmcCookieConsentManager = (options = defaultOptions) => {
731-
const { currentLang, themeCss, config: config3 } = options;
732-
const cookieconsent = window.initCookieConsent();
733-
cookieconsent.run(__spreadValues({
734-
current_lang: currentLang,
735-
auto_language: true,
736-
theme_css: themeCss,
737-
cookie_name: "lmc_ccm",
738-
cookie_expiration: 365,
739-
use_rfc_cookie: true,
847+
var defaultOptions = {
848+
defaultLang: "cs",
849+
autodetectLang: true,
850+
themeCss: "",
851+
onFirstAccept: (cookie, cookieConsent) => {
852+
},
853+
onFirstAcceptOnlyNecessary: (cookie, cookieConsent) => {
854+
},
855+
onFirstAcceptAll: (cookie, cookieConsent) => {
856+
},
857+
onAccept: (cookie, cookieConsent) => {
858+
},
859+
onAcceptOnlyNecessary: (cookie, cookieConsent) => {
860+
},
861+
onAcceptAll: (cookie, cookieConsent) => {
862+
},
863+
config: {}
864+
};
865+
var LmcCookieConsentManager = (args) => {
866+
const options = __spreadValues(__spreadValues({}, defaultOptions), args);
867+
const {
868+
defaultLang,
869+
autodetectLang,
870+
themeCss,
871+
onFirstAccept,
872+
onFirstAcceptOnlyNecessary,
873+
onFirstAcceptAll,
874+
onAccept,
875+
onAcceptOnlyNecessary,
876+
onAcceptAll,
877+
config: config5
878+
} = options;
879+
const cookieName = "lmc_ccm";
880+
const cookieConsent = window.initCookieConsent();
881+
const isFirstTimeAccept = !cookieConsent.validCookie(cookieName);
882+
cookieConsent.run(__spreadValues({
883+
auto_language: autodetectLang,
740884
autorun: true,
885+
cookie_expiration: 365,
886+
cookie_name: cookieName,
887+
current_lang: defaultLang,
741888
delay: 0,
742889
force_consent: false,
743890
hide_from_bots: true,
891+
page_scripts: true,
892+
theme_css: themeCss,
893+
use_rfc_cookie: true,
744894
gui_options: {
745895
consent_modal: {
746896
layout: "bar",
@@ -749,6 +899,8 @@
749899
}
750900
},
751901
onAccept: (cookie) => {
902+
const givenLevels = cookieConsent.get("level");
903+
const acceptedOnlyNecessary = givenLevels.length === 1 && givenLevels[0] === "necessary";
752904
window.dataLayer = window.dataLayer || [];
753905
window.dataLayer.push({
754906
event: "CookieConsent-update",
@@ -758,12 +910,21 @@
758910
"CookieConsent.personalization": cookie.level.includes("personalization"),
759911
"CookieConsent.revision": cookie.revision
760912
});
913+
onAccept(cookie, cookieConsent);
914+
if (isFirstTimeAccept) {
915+
onFirstAccept(cookie, cookieConsent);
916+
acceptedOnlyNecessary ? onFirstAcceptOnlyNecessary(cookie, cookieConsent) : onFirstAcceptAll(cookie, cookieConsent);
917+
}
918+
acceptedOnlyNecessary ? onAcceptOnlyNecessary(cookie, cookieConsent) : onAcceptAll(cookie, cookieConsent);
761919
},
762920
languages: {
763-
en: config,
764-
cs: config2
921+
cs: config,
922+
en: config2,
923+
pl: config3,
924+
sk: config4
765925
}
766-
}, config3));
926+
}, config5));
927+
return cookieConsent;
767928
};
768929
var LmcCookieConsentManager_default = LmcCookieConsentManager;
769930
})();

0 commit comments

Comments
 (0)