@plasmicpkgs/vanilla-cookieconsent 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,934 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __getProtoOf = Object.getPrototypeOf;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {}))
15
+ if (__hasOwnProp.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(b)) {
19
+ if (__propIsEnum.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
24
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
+ var __export = (target, all) => {
26
+ for (var name in all)
27
+ __defProp(target, name, { get: all[name], enumerable: true });
28
+ };
29
+ var __copyProps = (to, from, except, desc) => {
30
+ if (from && typeof from === "object" || typeof from === "function") {
31
+ for (let key of __getOwnPropNames(from))
32
+ if (!__hasOwnProp.call(to, key) && key !== except)
33
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
34
+ }
35
+ return to;
36
+ };
37
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
38
+ // If the importer is in node compatibility mode or this is not an ESM
39
+ // file that has been converted to a CommonJS file using a Babel-
40
+ // compatible transform (i.e. "__esModule" has not been set), then set
41
+ // "default" to the CommonJS "module.exports" for node compatibility.
42
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
43
+ mod
44
+ ));
45
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
46
+
47
+ // src/index.ts
48
+ var src_exports = {};
49
+ __export(src_exports, {
50
+ CookieConsent: () => CookieConsent,
51
+ registerAll: () => registerAll
52
+ });
53
+ module.exports = __toCommonJS(src_exports);
54
+ var import_registerComponent = __toESM(require("@plasmicapp/host/registerComponent"));
55
+
56
+ // src/cookie-consent.tsx
57
+ var import_host = require("@plasmicapp/host");
58
+ var import_react = __toESM(require("react"));
59
+ var ConsentApi = __toESM(require("vanilla-cookieconsent"));
60
+ function CookieConsent(props) {
61
+ var _a, _b, _c;
62
+ const {
63
+ mode,
64
+ revision,
65
+ autoShow,
66
+ disablePageInteraction,
67
+ hideFromBots,
68
+ cookieName,
69
+ cookieDomain,
70
+ cookiePath,
71
+ cookieSecure,
72
+ cookieExpiresAfterDays,
73
+ cookieSameSite,
74
+ cookieUseLocalStorage,
75
+ consentModal,
76
+ preferencesModal,
77
+ necessaryEnabled,
78
+ necessaryReadOnly,
79
+ analyticsEnabled,
80
+ analyticsAutoClearCookies,
81
+ adsEnabled,
82
+ languageDefault,
83
+ languageAutoDetect,
84
+ languageRtl,
85
+ onFirstConsent,
86
+ onConsent,
87
+ onChange,
88
+ onModalReady,
89
+ onModalShow,
90
+ onModalHide,
91
+ sections,
92
+ services,
93
+ plasmicNotifyAutoOpenedContent
94
+ } = props;
95
+ const inPlasmicCanvas = (0, import_host.usePlasmicCanvasContext)();
96
+ const isSelected = (_c = (_b = (_a = import_host.usePlasmicCanvasComponentInfo) == null ? void 0 : _a(props)) == null ? void 0 : _b.isSelected) != null ? _c : false;
97
+ import_react.default.useEffect(() => {
98
+ var _a2, _b2, _c2, _d;
99
+ if (!isSelected && inPlasmicCanvas) {
100
+ ConsentApi.reset(true);
101
+ return;
102
+ }
103
+ plasmicNotifyAutoOpenedContent == null ? void 0 : plasmicNotifyAutoOpenedContent();
104
+ const analyticsAutoClearCookiesArray = ((_c2 = (_b2 = (_a2 = analyticsAutoClearCookies == null ? void 0 : analyticsAutoClearCookies.split(",")) == null ? void 0 : _a2.map((cookie) => cookie.trim())) == null ? void 0 : _b2.filter((cookie) => cookie.length > 0)) == null ? void 0 : _c2.map((cookie) => ({
105
+ name: cookie.startsWith("/") && cookie.endsWith("/") ? new RegExp(cookie.slice(1, -1)) : cookie
106
+ }))) || [];
107
+ const config = {
108
+ root: "#plasmic-cookie-consent",
109
+ mode,
110
+ revision,
111
+ autoShow,
112
+ disablePageInteraction,
113
+ hideFromBots,
114
+ cookie: {
115
+ name: cookieName,
116
+ domain: cookieDomain || ((_d = window == null ? void 0 : window.location) == null ? void 0 : _d.hostname),
117
+ path: cookiePath,
118
+ secure: cookieSecure,
119
+ expiresAfterDays: cookieExpiresAfterDays,
120
+ sameSite: cookieSameSite,
121
+ useLocalStorage: cookieUseLocalStorage
122
+ },
123
+ guiOptions: {
124
+ consentModal: {
125
+ layout: consentModal == null ? void 0 : consentModal.layout,
126
+ position: consentModal == null ? void 0 : consentModal.position,
127
+ equalWeightButtons: consentModal == null ? void 0 : consentModal.equalWeightButtons,
128
+ flipButtons: consentModal == null ? void 0 : consentModal.flipButtons
129
+ },
130
+ preferencesModal: {
131
+ layout: preferencesModal == null ? void 0 : preferencesModal.layout,
132
+ equalWeightButtons: preferencesModal == null ? void 0 : preferencesModal.equalWeightButtons,
133
+ flipButtons: preferencesModal == null ? void 0 : preferencesModal.flipButtons
134
+ }
135
+ },
136
+ onFirstConsent: ({ cookie }) => {
137
+ onFirstConsent == null ? void 0 : onFirstConsent(cookie);
138
+ },
139
+ onConsent: ({ cookie }) => {
140
+ onConsent == null ? void 0 : onConsent(cookie);
141
+ },
142
+ onChange: ({ changedCategories, changedServices, cookie }) => {
143
+ onChange == null ? void 0 : onChange(changedCategories, changedServices, cookie);
144
+ },
145
+ onModalReady: ({ modalName }) => {
146
+ onModalReady == null ? void 0 : onModalReady(modalName);
147
+ },
148
+ onModalShow: ({ modalName }) => {
149
+ onModalShow == null ? void 0 : onModalShow(modalName);
150
+ },
151
+ onModalHide: ({ modalName }) => {
152
+ onModalHide == null ? void 0 : onModalHide(modalName);
153
+ },
154
+ categories: {
155
+ necessary: {
156
+ enabled: necessaryEnabled,
157
+ readOnly: necessaryReadOnly
158
+ },
159
+ analytics: {
160
+ enabled: analyticsEnabled,
161
+ autoClear: {
162
+ cookies: analyticsAutoClearCookiesArray
163
+ },
164
+ services: services == null ? void 0 : services.reduce((acc, service) => {
165
+ acc[service.key] = {
166
+ label: service.label || service.key,
167
+ onAccept: service.onAccept || (() => {
168
+ }),
169
+ onReject: service.onReject || (() => {
170
+ })
171
+ };
172
+ return acc;
173
+ }, {})
174
+ },
175
+ ads: {
176
+ enabled: adsEnabled
177
+ }
178
+ },
179
+ language: {
180
+ default: languageDefault,
181
+ autoDetect: languageAutoDetect,
182
+ rtl: languageRtl,
183
+ translations: {
184
+ [languageDefault || "en"]: {
185
+ consentModal,
186
+ preferencesModal: __spreadProps(__spreadValues({}, preferencesModal), {
187
+ sections
188
+ })
189
+ }
190
+ }
191
+ }
192
+ };
193
+ ConsentApi.run(config);
194
+ return () => {
195
+ ConsentApi.reset();
196
+ };
197
+ }, [
198
+ mode,
199
+ revision,
200
+ autoShow,
201
+ disablePageInteraction,
202
+ hideFromBots,
203
+ cookieName,
204
+ cookieDomain,
205
+ cookiePath,
206
+ cookieSecure,
207
+ cookieExpiresAfterDays,
208
+ cookieSameSite,
209
+ cookieUseLocalStorage,
210
+ consentModal,
211
+ preferencesModal,
212
+ necessaryEnabled,
213
+ necessaryReadOnly,
214
+ analyticsEnabled,
215
+ analyticsAutoClearCookies,
216
+ adsEnabled,
217
+ languageDefault,
218
+ languageAutoDetect,
219
+ languageRtl,
220
+ onFirstConsent,
221
+ onConsent,
222
+ onChange,
223
+ onModalReady,
224
+ onModalShow,
225
+ onModalHide,
226
+ sections,
227
+ services,
228
+ inPlasmicCanvas,
229
+ isSelected,
230
+ plasmicNotifyAutoOpenedContent
231
+ ]);
232
+ return /* @__PURE__ */ import_react.default.createElement("div", { id: "plasmic-cookie-consent" });
233
+ }
234
+
235
+ // src/cookie-consent-meta.ts
236
+ var import_registerToken = __toESM(require("@plasmicapp/host/registerToken"));
237
+ var modulePath = "@plasmicpkgs/plasmic-vanilla-cookieconsent";
238
+ function registerTokens(loader) {
239
+ const tokenRegistrations = [
240
+ // Basic colors
241
+ {
242
+ name: "--cc-font-family",
243
+ type: "font-family",
244
+ value: "Inter"
245
+ },
246
+ {
247
+ name: "--cc-bg",
248
+ type: "color",
249
+ value: "#ffffff"
250
+ },
251
+ {
252
+ name: "--cc-primary-color",
253
+ type: "color",
254
+ value: "#2c2f31"
255
+ },
256
+ {
257
+ name: "--cc-secondary-color",
258
+ type: "color",
259
+ value: "#5e6266"
260
+ },
261
+ // Primary button styling
262
+ {
263
+ name: "--cc-btn-primary-bg",
264
+ type: "color",
265
+ value: "#30363c"
266
+ },
267
+ {
268
+ name: "--cc-btn-primary-color",
269
+ type: "color",
270
+ value: "#ffffff"
271
+ },
272
+ {
273
+ name: "--cc-btn-primary-hover-bg",
274
+ type: "color",
275
+ value: "#000000"
276
+ },
277
+ {
278
+ name: "--cc-btn-primary-hover-color",
279
+ type: "color",
280
+ value: "#ffffff"
281
+ },
282
+ // Secondary button styling
283
+ {
284
+ name: "--cc-btn-secondary-bg",
285
+ type: "color",
286
+ value: "#eaeff2"
287
+ },
288
+ {
289
+ name: "--cc-btn-secondary-hover-bg",
290
+ type: "color",
291
+ value: "#d4dae0"
292
+ },
293
+ {
294
+ name: "--cc-btn-secondary-hover-color",
295
+ type: "color",
296
+ value: "#000000"
297
+ },
298
+ {
299
+ name: "--cc-btn-secondary-hover-border-color",
300
+ type: "color",
301
+ value: "#d4dae0"
302
+ },
303
+ // Button border radius
304
+ {
305
+ name: "--cc-btn-border-radius",
306
+ type: "spacing",
307
+ value: "10px"
308
+ },
309
+ // Separator
310
+ {
311
+ name: "--cc-separator-border-color",
312
+ type: "color",
313
+ value: "#f0f4f7"
314
+ },
315
+ // Toggle styling
316
+ {
317
+ name: "--cc-toggle-off-bg",
318
+ type: "color",
319
+ value: "#667481"
320
+ },
321
+ {
322
+ name: "--cc-toggle-on-knob-bg",
323
+ type: "color",
324
+ value: "#ffffff"
325
+ },
326
+ // Toggle readonly
327
+ {
328
+ name: "--cc-toggle-readonly-bg",
329
+ type: "color",
330
+ value: "#d5dee2"
331
+ },
332
+ {
333
+ name: "--cc-toggle-readonly-knob-bg",
334
+ type: "color",
335
+ value: "#ffffff"
336
+ },
337
+ // Cookie category sections
338
+ {
339
+ name: "--cc-cookie-category-block-bg",
340
+ type: "color",
341
+ value: "#f0f4f7"
342
+ },
343
+ {
344
+ name: "--cc-cookie-category-block-border",
345
+ type: "color",
346
+ value: "#f0f4f7"
347
+ },
348
+ {
349
+ name: "--cc-cookie-category-block-hover-bg",
350
+ type: "color",
351
+ value: "#e9eff4"
352
+ },
353
+ {
354
+ name: "--cc-cookie-category-block-hover-border",
355
+ type: "color",
356
+ value: "#e9eff4"
357
+ },
358
+ {
359
+ name: "--cc-cookie-category-expanded-block-bg",
360
+ type: "color",
361
+ value: "transparent"
362
+ },
363
+ {
364
+ name: "--cc-cookie-category-expanded-block-hover-bg",
365
+ type: "color",
366
+ value: "#dee4e9"
367
+ },
368
+ // Overlay and scrollbar
369
+ {
370
+ name: "--cc-overlay-bg",
371
+ type: "color",
372
+ value: "rgba(0, 0, 0, 0.65)"
373
+ },
374
+ // Footer
375
+ {
376
+ name: "--cc-footer-border-color",
377
+ type: "color",
378
+ value: "#e4eaed"
379
+ }
380
+ ].map((token) => __spreadProps(__spreadValues({}, token), {
381
+ displayName: token.name,
382
+ type: token.type
383
+ }));
384
+ if (loader) {
385
+ tokenRegistrations.forEach((token) => loader.registerToken(token));
386
+ } else {
387
+ tokenRegistrations.forEach((token) => (0, import_registerToken.default)(token));
388
+ }
389
+ }
390
+ var CookieConsentMeta = {
391
+ name: "hostless-vanilla-cookieconsent",
392
+ displayName: "Cookie Consent",
393
+ importName: "CookieConsent",
394
+ importPath: modulePath,
395
+ description: "Shows Cookie Consent Banner",
396
+ defaultStyles: {
397
+ maxWidth: "100%"
398
+ },
399
+ props: {
400
+ mode: {
401
+ type: "choice",
402
+ options: ["opt-in", "opt-out"],
403
+ displayName: "Consent Mode",
404
+ description: "Changes the scripts' activation logic when consent is not valid. opt-in: scripts will run only if the user accepts that category (GDPR compliant). opt-out: scripts will run automatically (not GDPR compliant).",
405
+ defaultValue: "opt-in"
406
+ },
407
+ revision: {
408
+ type: "number",
409
+ displayName: "Revision",
410
+ description: "Manages consent revisions; useful if you'd like to ask your users again for consent after a change in your cookie/privacy policy",
411
+ defaultValue: 0
412
+ },
413
+ autoShow: {
414
+ type: "boolean",
415
+ displayName: "Auto Show",
416
+ description: "Automatically show the consent modal if consent is not valid",
417
+ defaultValue: true
418
+ },
419
+ disablePageInteraction: {
420
+ type: "boolean",
421
+ displayName: "Disable Page Interaction",
422
+ description: "Creates a dark overlay and blocks the page scroll until consent is expressed",
423
+ defaultValue: false
424
+ },
425
+ hideFromBots: {
426
+ type: "boolean",
427
+ displayName: "Hide From Bots",
428
+ description: "Stops the plugin's execution when a bot/crawler is detected, to prevent them from indexing the modal's content",
429
+ defaultValue: true
430
+ },
431
+ cookieName: {
432
+ type: "string",
433
+ displayName: "Cookie Name",
434
+ description: "Name of the consent cookie",
435
+ defaultValue: "cc_cookie"
436
+ },
437
+ cookieDomain: {
438
+ type: "string",
439
+ displayName: "Cookie Domain",
440
+ description: "Current domain/subdomain's name, retrieved automatically if left empty"
441
+ },
442
+ cookiePath: {
443
+ type: "string",
444
+ displayName: "Cookie Path",
445
+ description: "Path for the consent cookie",
446
+ defaultValue: "/"
447
+ },
448
+ cookieSecure: {
449
+ type: "boolean",
450
+ displayName: "Cookie Secure",
451
+ description: "Toggle the secure flag (won't be set if there is no https connection)",
452
+ defaultValue: true
453
+ },
454
+ cookieExpiresAfterDays: {
455
+ type: "number",
456
+ displayName: "Cookie Expires After Days",
457
+ description: "Number of days before the cookie expires",
458
+ defaultValue: 182
459
+ },
460
+ cookieSameSite: {
461
+ type: "choice",
462
+ options: ["Lax", "Strict", "None"],
463
+ displayName: "Cookie SameSite",
464
+ description: "SameSite attribute for the consent cookie",
465
+ defaultValue: "Lax"
466
+ },
467
+ cookieUseLocalStorage: {
468
+ type: "boolean",
469
+ displayName: "Use Local Storage",
470
+ description: "Store the value of the cookie in localStorage (ignores domain, path, sameSite when enabled)",
471
+ defaultValue: false
472
+ },
473
+ consentModal: {
474
+ type: "object",
475
+ displayName: "Consent Modal",
476
+ description: "Configuration for the consent modal",
477
+ defaultValue: {
478
+ layout: "cloud inline",
479
+ position: "bottom center",
480
+ equalWeightButtons: true,
481
+ title: "We use cookies",
482
+ description: "Description text for the consent modal",
483
+ acceptAllBtn: "Accept all",
484
+ acceptNecessaryBtn: "Reject all",
485
+ showPreferencesBtn: "Manage Individual Preferences",
486
+ closeIconLabel: "Close",
487
+ revisionMessage: "",
488
+ footer: '<a href="#path-to-impressum.html" target="_blank">Impressum</a><a href="#path-to-privacy-policy.html" target="_blank">Privacy Policy</a>'
489
+ },
490
+ fields: {
491
+ layout: {
492
+ type: "choice",
493
+ options: ["cloud", "cloud inline", "box", "bar"],
494
+ displayName: "Layout",
495
+ description: "Layout style for the consent modal"
496
+ },
497
+ position: {
498
+ type: "choice",
499
+ options: [
500
+ "top",
501
+ "bottom",
502
+ "top left",
503
+ "top center",
504
+ "top right",
505
+ "bottom left",
506
+ "bottom center",
507
+ "bottom right"
508
+ ],
509
+ displayName: "Position",
510
+ description: "Position of the consent modal"
511
+ },
512
+ equalWeightButtons: {
513
+ type: "boolean",
514
+ displayName: "Equal Weight Buttons",
515
+ description: "Make buttons in consent modal equal weight"
516
+ },
517
+ flipButtons: {
518
+ type: "boolean",
519
+ displayName: "Flip Buttons",
520
+ description: "Flip button order in consent modal"
521
+ },
522
+ title: {
523
+ type: "string",
524
+ displayName: "Title",
525
+ description: "Title text for the consent modal"
526
+ },
527
+ description: {
528
+ type: "string",
529
+ displayName: "Description",
530
+ description: "Description text for the consent modal"
531
+ },
532
+ acceptAllBtn: {
533
+ type: "string",
534
+ displayName: "Accept All Button Text",
535
+ description: "Text for the accept all button"
536
+ },
537
+ acceptNecessaryBtn: {
538
+ type: "string",
539
+ displayName: "Accept Necessary Button Text",
540
+ description: "Text for the accept necessary button"
541
+ },
542
+ showPreferencesBtn: {
543
+ type: "string",
544
+ displayName: "Show Preferences Button Text",
545
+ description: "Text for the show preferences button"
546
+ },
547
+ closeIconLabel: {
548
+ type: "string",
549
+ displayName: "Close Icon Label",
550
+ description: "If specified, a big X button will be generated (visible only in box layout). Acts the same as acceptNecessaryBtn"
551
+ },
552
+ revisionMessage: {
553
+ type: "string",
554
+ displayName: "Revision Message",
555
+ description: "Message shown when there's a revision change"
556
+ },
557
+ footer: {
558
+ type: "string",
559
+ displayName: "Footer",
560
+ description: "A small area where you can place your links (impressum, privacy policy, etc.) - allows HTML markup"
561
+ }
562
+ }
563
+ },
564
+ preferencesModal: {
565
+ type: "object",
566
+ displayName: "Preferences Modal",
567
+ description: "Configuration for the preferences modal",
568
+ defaultValue: {
569
+ layout: "box",
570
+ equalWeightButtons: true,
571
+ flipButtons: false,
572
+ title: "Manage cookie preferences",
573
+ acceptAllBtn: "Accept all",
574
+ acceptNecessaryBtn: "Reject all",
575
+ savePreferencesBtn: "Accept current selection",
576
+ closeIconLabel: "Close modal",
577
+ serviceCounterLabel: "Service|Services"
578
+ },
579
+ fields: {
580
+ layout: {
581
+ type: "choice",
582
+ options: ["box", "bar"],
583
+ displayName: "Layout",
584
+ description: "Layout style for the preferences modal"
585
+ },
586
+ equalWeightButtons: {
587
+ type: "boolean",
588
+ displayName: "Equal Weight Buttons",
589
+ description: "Make buttons in preferences modal equal weight"
590
+ },
591
+ flipButtons: {
592
+ type: "boolean",
593
+ displayName: "Flip Buttons",
594
+ description: "Flip button order in preferences modal"
595
+ },
596
+ title: {
597
+ type: "string",
598
+ displayName: "Title",
599
+ description: "Title text for the preferences modal"
600
+ },
601
+ acceptAllBtn: {
602
+ type: "string",
603
+ displayName: "Accept All Button Text",
604
+ description: "Text for the accept all button in preferences modal"
605
+ },
606
+ acceptNecessaryBtn: {
607
+ type: "string",
608
+ displayName: "Accept Necessary Button Text",
609
+ description: "Text for the accept necessary button in preferences modal"
610
+ },
611
+ savePreferencesBtn: {
612
+ type: "string",
613
+ displayName: "Save Preferences Button Text",
614
+ description: "Text for the save preferences button"
615
+ },
616
+ closeIconLabel: {
617
+ type: "string",
618
+ displayName: "Close Icon Label",
619
+ description: "Label for the close icon"
620
+ },
621
+ serviceCounterLabel: {
622
+ type: "string",
623
+ displayName: "Service Counter Label",
624
+ description: "Label for service counter (singular|plural)"
625
+ }
626
+ }
627
+ },
628
+ necessaryEnabled: {
629
+ type: "boolean",
630
+ displayName: "Necessary Category Enabled",
631
+ description: "Enable the necessary category by default",
632
+ defaultValue: true
633
+ },
634
+ necessaryReadOnly: {
635
+ type: "boolean",
636
+ displayName: "Necessary Category Read Only",
637
+ description: "Make the necessary category read-only (cannot be disabled)",
638
+ defaultValue: true
639
+ },
640
+ analyticsEnabled: {
641
+ type: "boolean",
642
+ displayName: "Analytics Category Enabled",
643
+ description: "Enable the analytics category by default",
644
+ defaultValue: false
645
+ },
646
+ analyticsAutoClearCookies: {
647
+ type: "string",
648
+ displayName: "Analytics Auto Clear Cookies",
649
+ description: "Comma-separated list of cookie names to auto-clear (supports regex patterns)",
650
+ defaultValue: "_ga,_gid"
651
+ },
652
+ adsEnabled: {
653
+ type: "boolean",
654
+ displayName: "Ads Category Enabled",
655
+ description: "Enable the ads category by default",
656
+ defaultValue: false
657
+ },
658
+ languageDefault: {
659
+ type: "string",
660
+ displayName: "Default Language",
661
+ description: "The desired default language",
662
+ defaultValue: "en"
663
+ },
664
+ languageAutoDetect: {
665
+ type: "choice",
666
+ options: ["document", "browser"],
667
+ displayName: "Language Auto Detect",
668
+ description: "Set the current language dynamically. 'document': retrieve language from the lang attribute. 'browser': retrieve the user's browser language"
669
+ },
670
+ languageRtl: {
671
+ type: "string",
672
+ displayName: "RTL Languages",
673
+ description: "List of languages that should use the RTL layout (comma-separated)"
674
+ },
675
+ onFirstConsent: {
676
+ type: "eventHandler",
677
+ displayName: "On First Consent",
678
+ description: "Event handler called when user gives first consent",
679
+ argTypes: [
680
+ {
681
+ name: "cookie",
682
+ type: "object"
683
+ }
684
+ ]
685
+ },
686
+ onConsent: {
687
+ type: "eventHandler",
688
+ displayName: "On Consent",
689
+ description: "Event handler called when user gives consent",
690
+ argTypes: [
691
+ {
692
+ name: "cookie",
693
+ type: "object"
694
+ }
695
+ ]
696
+ },
697
+ onChange: {
698
+ type: "eventHandler",
699
+ displayName: "On Change",
700
+ description: "Event handler called when consent categories change",
701
+ argTypes: [
702
+ {
703
+ name: "changedCategories",
704
+ type: "object"
705
+ },
706
+ {
707
+ name: "changedServices",
708
+ type: "object"
709
+ }
710
+ ]
711
+ },
712
+ onModalReady: {
713
+ type: "eventHandler",
714
+ displayName: "On Modal Ready",
715
+ description: "Event handler called when modal is ready",
716
+ argTypes: [
717
+ {
718
+ name: "modalName",
719
+ type: "string"
720
+ }
721
+ ]
722
+ },
723
+ onModalShow: {
724
+ type: "eventHandler",
725
+ displayName: "On Modal Show",
726
+ description: "Event handler called when modal is shown",
727
+ argTypes: [
728
+ {
729
+ name: "modalName",
730
+ type: "string"
731
+ }
732
+ ]
733
+ },
734
+ onModalHide: {
735
+ type: "eventHandler",
736
+ displayName: "On Modal Hide",
737
+ description: "Event handler called when modal is hidden",
738
+ argTypes: [
739
+ {
740
+ name: "modalName",
741
+ type: "string"
742
+ }
743
+ ]
744
+ },
745
+ sections: {
746
+ type: "array",
747
+ displayName: "Preferences Modal Sections",
748
+ description: "Sections to display in the preferences modal",
749
+ itemType: {
750
+ nameFunc: (item) => item == null ? void 0 : item.title,
751
+ type: "object",
752
+ fields: {
753
+ title: {
754
+ type: "string",
755
+ displayName: "Section Title",
756
+ description: "Title of the section"
757
+ },
758
+ description: {
759
+ type: "string",
760
+ displayName: "Section Description",
761
+ description: "Description text for the section"
762
+ },
763
+ linkedCategory: {
764
+ type: "string",
765
+ displayName: "Linked Category",
766
+ description: "Category name to link this section to (e.g., 'necessary', 'analytics', 'ads')"
767
+ },
768
+ cookieTable: {
769
+ type: "object",
770
+ displayName: "Cookie Table",
771
+ description: "Cookie table configuration for this section",
772
+ fields: {
773
+ caption: {
774
+ type: "string",
775
+ displayName: "Table Caption",
776
+ description: "Caption for the cookie table"
777
+ },
778
+ headers: {
779
+ type: "object",
780
+ displayName: "Table Headers",
781
+ description: "Headers for the cookie table",
782
+ fields: {
783
+ name: {
784
+ type: "string",
785
+ displayName: "Name Header",
786
+ description: "Header for cookie name column"
787
+ },
788
+ domain: {
789
+ type: "string",
790
+ displayName: "Domain Header",
791
+ description: "Header for domain column"
792
+ },
793
+ desc: {
794
+ type: "string",
795
+ displayName: "Description Header",
796
+ description: "Header for description column"
797
+ }
798
+ }
799
+ },
800
+ body: {
801
+ type: "array",
802
+ displayName: "Table Body",
803
+ description: "Rows in the cookie table",
804
+ itemType: {
805
+ type: "object",
806
+ nameFunc: (item) => (item == null ? void 0 : item.name) || (item == null ? void 0 : item.domain),
807
+ fields: {
808
+ name: {
809
+ type: "string",
810
+ displayName: "Cookie Name",
811
+ description: "Name of the cookie"
812
+ },
813
+ domain: {
814
+ type: "string",
815
+ displayName: "Domain",
816
+ description: "Domain where the cookie is set"
817
+ },
818
+ desc: {
819
+ type: "string",
820
+ displayName: "Description",
821
+ description: "Description of what the cookie does"
822
+ }
823
+ }
824
+ }
825
+ }
826
+ }
827
+ }
828
+ }
829
+ },
830
+ defaultValue: [
831
+ {
832
+ title: "Your Privacy Choices",
833
+ description: 'In this panel you can express some preferences related to the processing of your personal information. You may review and change expressed choices at any time by resurfacing this panel via the provided link. To deny your consent to the specific processing activities described below, switch the toggles to off or use the "Reject all" button and confirm you want to save your choices.'
834
+ },
835
+ {
836
+ title: "Strictly Necessary",
837
+ description: "These cookies are essential for the proper functioning of the website and cannot be disabled.",
838
+ linkedCategory: "necessary"
839
+ },
840
+ {
841
+ title: "Performance and Analytics",
842
+ description: "These cookies collect information about how you use our website. All of the data is anonymized and cannot be used to identify you.",
843
+ linkedCategory: "analytics",
844
+ cookieTable: {
845
+ caption: "Cookie table",
846
+ headers: {
847
+ name: "Cookie",
848
+ domain: "Domain",
849
+ desc: "Description"
850
+ },
851
+ body: [
852
+ {
853
+ name: "_ga",
854
+ domain: "example.com",
855
+ desc: "Description 1"
856
+ },
857
+ {
858
+ name: "_gid",
859
+ domain: "example.com",
860
+ desc: "Description 2"
861
+ }
862
+ ]
863
+ }
864
+ },
865
+ {
866
+ title: "Targeting and Advertising",
867
+ description: "These cookies are used to make advertising messages more relevant to you and your interests. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.",
868
+ linkedCategory: "ads"
869
+ },
870
+ {
871
+ title: "More information",
872
+ description: 'For any queries in relation to my policy on cookies and your choices, please <a href="#contact-page">contact us</a>'
873
+ }
874
+ ]
875
+ },
876
+ services: {
877
+ type: "array",
878
+ displayName: "Analytics Services",
879
+ description: "Services to display in the analytics category",
880
+ itemType: {
881
+ type: "object",
882
+ nameFunc: (item) => (item == null ? void 0 : item.label) || (item == null ? void 0 : item.key),
883
+ fields: {
884
+ key: {
885
+ type: "string",
886
+ displayName: "Service Key",
887
+ description: "Unique identifier for the service (e.g., 'ga', 'youtube')"
888
+ },
889
+ label: {
890
+ type: "string",
891
+ displayName: "Service Label",
892
+ description: "Display name for the service"
893
+ },
894
+ onAccept: {
895
+ type: "eventHandler",
896
+ displayName: "On Accept",
897
+ description: "Event handler called when user accepts this service",
898
+ argTypes: []
899
+ },
900
+ onReject: {
901
+ type: "eventHandler",
902
+ displayName: "On Reject",
903
+ description: "Event handler called when user rejects this service",
904
+ argTypes: []
905
+ }
906
+ }
907
+ },
908
+ defaultValue: [
909
+ {
910
+ key: "ga",
911
+ label: "Google Analytics"
912
+ },
913
+ {
914
+ key: "youtube",
915
+ label: "Youtube Embed"
916
+ }
917
+ ]
918
+ }
919
+ }
920
+ };
921
+
922
+ // src/index.ts
923
+ function registerAll(loader) {
924
+ const _registerComponent = (Component, defaultMeta) => {
925
+ if (loader) {
926
+ loader.registerComponent(Component, defaultMeta);
927
+ } else {
928
+ (0, import_registerComponent.default)(Component, defaultMeta);
929
+ }
930
+ };
931
+ registerTokens(loader);
932
+ _registerComponent(CookieConsent, CookieConsentMeta);
933
+ }
934
+ //# sourceMappingURL=index.js.map