@zcomponent/core 1.29.0 → 2.0.0-alpha.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/README.md +1 -0
- package/css/zcomponent.css +121 -122
- package/index.js +0 -3
- package/lib/actionbehavior.d.ts +3 -3
- package/lib/actionbehavior.js +20 -19
- package/lib/animation/animation.d.ts +13 -6
- package/lib/animation/animation.js +56 -43
- package/lib/animation/bezier.d.ts +6 -0
- package/lib/animation/bezier.js +8 -2
- package/lib/animation/clips/clip.d.ts +13 -1
- package/lib/animation/clips/clip.js +34 -14
- package/lib/animation/index.d.ts +4 -4
- package/lib/animation/index.js +4 -4
- package/lib/animation/layer.d.ts +9 -0
- package/lib/animation/layer.js +28 -12
- package/lib/animation/layerclip.d.ts +21 -0
- package/lib/animation/layerclip.js +82 -45
- package/lib/animation/tracks/cliptrack.d.ts +18 -0
- package/lib/animation/tracks/cliptrack.js +27 -6
- package/lib/animation/tracks/functiontrack.d.ts +9 -0
- package/lib/animation/tracks/functiontrack.js +16 -3
- package/lib/animation/tracks/propertytrack.d.ts +20 -1
- package/lib/animation/tracks/propertytrack.js +48 -11
- package/lib/animation/tracks/streamtrack.d.ts +18 -0
- package/lib/animation/tracks/streamtrack.js +32 -6
- package/lib/animation/tracks/track.d.ts +8 -2
- package/lib/animation/tracks/track.js +3 -2
- package/lib/behavior.js +13 -10
- package/lib/behaviors/ActivateState.d.ts +22 -24
- package/lib/behaviors/ActivateState.js +145 -35
- package/lib/behaviors/CallFunction.d.ts +2 -4
- package/lib/behaviors/CallFunction.js +69 -11
- package/lib/behaviors/ChangeRootScene.d.ts +35 -0
- package/lib/behaviors/ChangeRootScene.js +123 -0
- package/lib/behaviors/ConsoleLog.d.ts +6 -5
- package/lib/behaviors/ConsoleLog.js +95 -12
- package/lib/behaviors/DownloadSnapshot.d.ts +7 -12
- package/lib/behaviors/DownloadSnapshot.js +70 -19
- package/lib/behaviors/EmitComponentPropEvent.d.ts +1 -3
- package/lib/behaviors/EmitComponentPropEvent.js +80 -12
- package/lib/behaviors/LaunchURL.d.ts +5 -5
- package/lib/behaviors/LaunchURL.js +92 -10
- package/lib/behaviors/LogAnalyticsEvent.d.ts +10 -4
- package/lib/behaviors/LogAnalyticsEvent.js +88 -7
- package/lib/behaviors/PauseLayerClip.d.ts +7 -9
- package/lib/behaviors/PauseLayerClip.js +89 -21
- package/lib/behaviors/PlayLayerClip.d.ts +35 -32
- package/lib/behaviors/PlayLayerClip.js +202 -48
- package/lib/behaviors/PlaySound.d.ts +19 -25
- package/lib/behaviors/PlaySound.js +122 -28
- package/lib/behaviors/SetLayerOff.d.ts +7 -9
- package/lib/behaviors/SetLayerOff.js +88 -21
- package/lib/behaviors/ShareSnapshot.d.ts +5 -9
- package/lib/behaviors/ShareSnapshot.js +70 -17
- package/lib/behaviors/ShowTextAlert.d.ts +16 -29
- package/lib/behaviors/ShowTextAlert.js +116 -48
- package/lib/behaviors/TakeSnapshot.d.ts +22 -26
- package/lib/behaviors/TakeSnapshot.js +131 -56
- package/lib/behaviors/ToggleLayerClips.d.ts +45 -62
- package/lib/behaviors/ToggleLayerClips.js +233 -64
- package/lib/behaviors/stream/PauseStream.d.ts +5 -16
- package/lib/behaviors/stream/PauseStream.js +94 -34
- package/lib/behaviors/stream/PlayStream.d.ts +14 -27
- package/lib/behaviors/stream/PlayStream.js +123 -34
- package/lib/behaviors/stream/SeekStream.d.ts +8 -18
- package/lib/behaviors/stream/SeekStream.js +97 -31
- package/lib/behaviors/stream/StopStream.d.ts +6 -15
- package/lib/behaviors/stream/StopStream.js +89 -27
- package/lib/component.d.ts +36 -13
- package/lib/component.js +237 -151
- package/lib/components/AnimatedLoader.d.ts +51 -0
- package/lib/components/AnimatedLoader.js +159 -0
- package/lib/components/Audio.d.ts +35 -37
- package/lib/components/Audio.js +264 -151
- package/lib/components/AudioLayerSettings.d.ts +13 -11
- package/lib/components/AudioLayerSettings.js +76 -18
- package/lib/components/Children.d.ts +2 -1
- package/lib/components/Children.js +66 -13
- package/lib/components/ConditionalConstruct.d.ts +44 -0
- package/lib/components/ConditionalConstruct.js +142 -0
- package/lib/components/DefaultCookieConsent.d.ts +53 -73
- package/lib/components/DefaultCookieConsent.js +382 -264
- package/lib/components/DefaultLoader.d.ts +40 -28
- package/lib/components/DefaultLoader.js +198 -46
- package/lib/components/Gamepad.d.ts +5 -26
- package/lib/components/Gamepad.js +201 -65
- package/lib/components/LoaderScope.d.ts +15 -0
- package/lib/components/LoaderScope.js +71 -0
- package/lib/components/LongLoad.d.ts +11 -15
- package/lib/components/LongLoad.js +89 -34
- package/lib/components/SnapshotUI.d.ts +19 -24
- package/lib/components/SnapshotUI.js +202 -105
- package/lib/context.d.ts +23 -5
- package/lib/context.js +12 -6
- package/lib/contexts/analyticscontext.d.ts +12 -2
- package/lib/contexts/analyticscontext.js +68 -10
- package/lib/contexts/audiocontextcontext.d.ts +1 -1
- package/lib/contexts/audiocontextcontext.js +9 -8
- package/lib/contexts/canvascontext.d.ts +32 -18
- package/lib/contexts/canvascontext.js +195 -120
- package/lib/contexts/cookieconsentcontext.d.ts +38 -28
- package/lib/contexts/cookieconsentcontext.js +35 -32
- package/lib/contexts/documentflagmanager.js +15 -11
- package/lib/contexts/environmentcontext.d.ts +22 -6
- package/lib/contexts/environmentcontext.js +135 -21
- package/lib/contexts/gamepadcontext.d.ts +29 -26
- package/lib/contexts/gamepadcontext.js +46 -46
- package/lib/contexts/gesturecontext.d.ts +31 -6
- package/lib/contexts/gesturecontext.js +110 -85
- package/lib/contexts/globaltagcontext.d.ts +1 -1
- package/lib/contexts/globaltagcontext.js +8 -11
- package/lib/contexts/loadcontext.d.ts +45 -8
- package/lib/contexts/loadcontext.js +232 -82
- package/lib/contexts/orientationcontext.d.ts +13 -15
- package/lib/contexts/orientationcontext.js +150 -67
- package/lib/contexts/rootcomponentscontext.d.ts +16 -0
- package/lib/contexts/rootcomponentscontext.js +65 -0
- package/lib/contexts/snapshotContext.d.ts +0 -3
- package/lib/contexts/snapshotContext.js +78 -23
- package/lib/contexts/tagcontext.d.ts +5 -5
- package/lib/contexts/tagcontext.js +16 -16
- package/lib/contexts/textalertcontext.d.ts +1 -5
- package/lib/contexts/textalertcontext.js +1 -5
- package/lib/contexts/usereventcontext.d.ts +1 -1
- package/lib/contexts/usereventcontext.js +12 -12
- package/lib/data/animation.d.ts +10 -2
- package/lib/data/change.d.ts +1 -1
- package/lib/data/change.js +7 -0
- package/lib/data/core.d.ts +9 -1
- package/lib/data/index.d.ts +1 -1
- package/lib/data/index.js +1 -1
- package/lib/decorators.d.ts +348 -0
- package/lib/decorators.js +239 -0
- package/lib/decoratorutils.d.ts +3 -0
- package/lib/decoratorutils.js +8 -0
- package/lib/emitter.d.ts +15 -2
- package/lib/emitter.js +15 -6
- package/lib/entity.d.ts +43 -25
- package/lib/entity.js +104 -71
- package/lib/event.d.ts +2 -1
- package/lib/event.js +1 -4
- package/lib/groups.d.ts +18 -0
- package/lib/groups.js +19 -0
- package/lib/icons.d.ts +3372 -0
- package/lib/icons.js +1 -0
- package/lib/index.d.ts +18 -13
- package/lib/index.js +17 -13
- package/lib/inflate.d.ts +7 -7
- package/lib/inflate.js +5 -5
- package/lib/observable.d.ts +9 -2
- package/lib/observable.js +5 -4
- package/lib/observe.d.ts +18 -0
- package/lib/observe.js +177 -0
- package/lib/profile.d.ts +9 -5
- package/lib/profile.js +27 -17
- package/lib/selectors.d.ts +1 -1
- package/lib/selectors.js +5 -4
- package/lib/types.d.ts +161 -19
- package/lib/types.js +22 -1
- package/lib/values/values.d.ts +7 -8
- package/lib/values/values.js +1 -2
- package/lib/values/valuesmutator.d.ts +4 -1
- package/lib/values/valuesmutator.js +10 -8
- package/lib/zcomponent.d.ts +21 -10
- package/lib/zcomponent.js +717 -540
- package/package.json +22 -5
- package/lib/behaviors/ChangeCursor.d.ts +0 -39
- package/lib/behaviors/ChangeCursor.js +0 -44
|
@@ -1,8 +1,42 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
1
35
|
import { Component } from '../component';
|
|
2
36
|
import { ConsentStatus, CookieConsentContext, CookieType, Status, useCookieConsentFunctional, useCookieConsentMarketing, useCookieConsentPerformance, useMarketingVendors, usePerformanceVendors, } from '../contexts/cookieconsentcontext';
|
|
3
37
|
import { isDesignTime } from '../contexts/environmentcontext';
|
|
4
38
|
import { constructed, started } from '../contexts/loadcontext';
|
|
5
|
-
import {
|
|
39
|
+
import { zComponent, zUI } from '../decorators';
|
|
6
40
|
const html = `
|
|
7
41
|
<div id='zcomponent-cookieconsent-panel'>
|
|
8
42
|
<h1 id='zcomponent-cookieconsent-title'></h1>
|
|
@@ -17,326 +51,410 @@ const html = `
|
|
|
17
51
|
* The component handles the logic for displaying the banner, receiving the user's consent, and storing this consent.
|
|
18
52
|
* It also provides methods to check if the user has already given their consent.
|
|
19
53
|
* @zcomponent
|
|
20
|
-
* @zgroup Cookie Consent
|
|
21
54
|
* @zicon cookie
|
|
55
|
+
* @zgroup Cookie Consent
|
|
22
56
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
57
|
+
let DefaultCookieConsent = (() => {
|
|
58
|
+
let _classDecorators = [zComponent({ icon: 'cookie', group: 'Cookie Consent' })];
|
|
59
|
+
let _classDescriptor;
|
|
60
|
+
let _classExtraInitializers = [];
|
|
61
|
+
let _classThis;
|
|
62
|
+
let _classSuper = Component;
|
|
63
|
+
let _title_decorators;
|
|
64
|
+
let _title_initializers = [];
|
|
65
|
+
let _title_extraInitializers = [];
|
|
66
|
+
let _description_decorators;
|
|
67
|
+
let _description_initializers = [];
|
|
68
|
+
let _description_extraInitializers = [];
|
|
69
|
+
let _privacyPolicyText_decorators;
|
|
70
|
+
let _privacyPolicyText_initializers = [];
|
|
71
|
+
let _privacyPolicyText_extraInitializers = [];
|
|
72
|
+
let _privacyPolicyURL_decorators;
|
|
73
|
+
let _privacyPolicyURL_initializers = [];
|
|
74
|
+
let _privacyPolicyURL_extraInitializers = [];
|
|
75
|
+
let _acceptButton_decorators;
|
|
76
|
+
let _acceptButton_initializers = [];
|
|
77
|
+
let _acceptButton_extraInitializers = [];
|
|
78
|
+
let _settingsButton_decorators;
|
|
79
|
+
let _settingsButton_initializers = [];
|
|
80
|
+
let _settingsButton_extraInitializers = [];
|
|
81
|
+
let _saveButton_decorators;
|
|
82
|
+
let _saveButton_initializers = [];
|
|
83
|
+
let _saveButton_extraInitializers = [];
|
|
84
|
+
let _essentialTitle_decorators;
|
|
85
|
+
let _essentialTitle_initializers = [];
|
|
86
|
+
let _essentialTitle_extraInitializers = [];
|
|
87
|
+
let _essentialDescription_decorators;
|
|
88
|
+
let _essentialDescription_initializers = [];
|
|
89
|
+
let _essentialDescription_extraInitializers = [];
|
|
90
|
+
let _functionalTitle_decorators;
|
|
91
|
+
let _functionalTitle_initializers = [];
|
|
92
|
+
let _functionalTitle_extraInitializers = [];
|
|
93
|
+
let _functionalDescription_decorators;
|
|
94
|
+
let _functionalDescription_initializers = [];
|
|
95
|
+
let _functionalDescription_extraInitializers = [];
|
|
96
|
+
let _performanceTitle_decorators;
|
|
97
|
+
let _performanceTitle_initializers = [];
|
|
98
|
+
let _performanceTitle_extraInitializers = [];
|
|
99
|
+
let _performanceDescription_decorators;
|
|
100
|
+
let _performanceDescription_initializers = [];
|
|
101
|
+
let _performanceDescription_extraInitializers = [];
|
|
102
|
+
let _marketingTitle_decorators;
|
|
103
|
+
let _marketingTitle_initializers = [];
|
|
104
|
+
let _marketingTitle_extraInitializers = [];
|
|
105
|
+
let _marketingDescription_decorators;
|
|
106
|
+
let _marketingDescription_initializers = [];
|
|
107
|
+
let _marketingDescription_extraInitializers = [];
|
|
108
|
+
let _required_decorators;
|
|
109
|
+
let _required_initializers = [];
|
|
110
|
+
let _required_extraInitializers = [];
|
|
111
|
+
var DefaultCookieConsent = class extends _classSuper {
|
|
112
|
+
static { _classThis = this; }
|
|
113
|
+
static {
|
|
114
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
115
|
+
_title_decorators = [zUI({ group: 'Consent Screen', priority: 20 })];
|
|
116
|
+
_description_decorators = [zUI({ group: 'Consent Screen', priority: 20 })];
|
|
117
|
+
_privacyPolicyText_decorators = [zUI({ group: 'Settings', priority: 10 })];
|
|
118
|
+
_privacyPolicyURL_decorators = [zUI({ group: 'Settings', priority: 10 })];
|
|
119
|
+
_acceptButton_decorators = [zUI({ group: 'Consent Screen', priority: 20 })];
|
|
120
|
+
_settingsButton_decorators = [zUI({ group: 'Consent Screen', priority: 20 })];
|
|
121
|
+
_saveButton_decorators = [zUI({ group: 'Settings', priority: 10 })];
|
|
122
|
+
_essentialTitle_decorators = [zUI({ group: 'Settings', priority: 10 })];
|
|
123
|
+
_essentialDescription_decorators = [zUI({ group: 'Settings', priority: 10 })];
|
|
124
|
+
_functionalTitle_decorators = [zUI({ group: 'Settings', priority: 10 })];
|
|
125
|
+
_functionalDescription_decorators = [zUI({ group: 'Settings', priority: 10 })];
|
|
126
|
+
_performanceTitle_decorators = [zUI({ group: 'Settings', priority: 10 })];
|
|
127
|
+
_performanceDescription_decorators = [zUI({ group: 'Settings', priority: 10 })];
|
|
128
|
+
_marketingTitle_decorators = [zUI({ group: 'Settings', priority: 10 })];
|
|
129
|
+
_marketingDescription_decorators = [zUI({ group: 'Settings', priority: 10 })];
|
|
130
|
+
_required_decorators = [zUI({ group: 'Settings', priority: 10 })];
|
|
131
|
+
__esDecorate(null, null, _title_decorators, { kind: "field", name: "title", static: false, private: false, access: { has: obj => "title" in obj, get: obj => obj.title, set: (obj, value) => { obj.title = value; } }, metadata: _metadata }, _title_initializers, _title_extraInitializers);
|
|
132
|
+
__esDecorate(null, null, _description_decorators, { kind: "field", name: "description", static: false, private: false, access: { has: obj => "description" in obj, get: obj => obj.description, set: (obj, value) => { obj.description = value; } }, metadata: _metadata }, _description_initializers, _description_extraInitializers);
|
|
133
|
+
__esDecorate(null, null, _privacyPolicyText_decorators, { kind: "field", name: "privacyPolicyText", static: false, private: false, access: { has: obj => "privacyPolicyText" in obj, get: obj => obj.privacyPolicyText, set: (obj, value) => { obj.privacyPolicyText = value; } }, metadata: _metadata }, _privacyPolicyText_initializers, _privacyPolicyText_extraInitializers);
|
|
134
|
+
__esDecorate(null, null, _privacyPolicyURL_decorators, { kind: "field", name: "privacyPolicyURL", static: false, private: false, access: { has: obj => "privacyPolicyURL" in obj, get: obj => obj.privacyPolicyURL, set: (obj, value) => { obj.privacyPolicyURL = value; } }, metadata: _metadata }, _privacyPolicyURL_initializers, _privacyPolicyURL_extraInitializers);
|
|
135
|
+
__esDecorate(null, null, _acceptButton_decorators, { kind: "field", name: "acceptButton", static: false, private: false, access: { has: obj => "acceptButton" in obj, get: obj => obj.acceptButton, set: (obj, value) => { obj.acceptButton = value; } }, metadata: _metadata }, _acceptButton_initializers, _acceptButton_extraInitializers);
|
|
136
|
+
__esDecorate(null, null, _settingsButton_decorators, { kind: "field", name: "settingsButton", static: false, private: false, access: { has: obj => "settingsButton" in obj, get: obj => obj.settingsButton, set: (obj, value) => { obj.settingsButton = value; } }, metadata: _metadata }, _settingsButton_initializers, _settingsButton_extraInitializers);
|
|
137
|
+
__esDecorate(null, null, _saveButton_decorators, { kind: "field", name: "saveButton", static: false, private: false, access: { has: obj => "saveButton" in obj, get: obj => obj.saveButton, set: (obj, value) => { obj.saveButton = value; } }, metadata: _metadata }, _saveButton_initializers, _saveButton_extraInitializers);
|
|
138
|
+
__esDecorate(null, null, _essentialTitle_decorators, { kind: "field", name: "essentialTitle", static: false, private: false, access: { has: obj => "essentialTitle" in obj, get: obj => obj.essentialTitle, set: (obj, value) => { obj.essentialTitle = value; } }, metadata: _metadata }, _essentialTitle_initializers, _essentialTitle_extraInitializers);
|
|
139
|
+
__esDecorate(null, null, _essentialDescription_decorators, { kind: "field", name: "essentialDescription", static: false, private: false, access: { has: obj => "essentialDescription" in obj, get: obj => obj.essentialDescription, set: (obj, value) => { obj.essentialDescription = value; } }, metadata: _metadata }, _essentialDescription_initializers, _essentialDescription_extraInitializers);
|
|
140
|
+
__esDecorate(null, null, _functionalTitle_decorators, { kind: "field", name: "functionalTitle", static: false, private: false, access: { has: obj => "functionalTitle" in obj, get: obj => obj.functionalTitle, set: (obj, value) => { obj.functionalTitle = value; } }, metadata: _metadata }, _functionalTitle_initializers, _functionalTitle_extraInitializers);
|
|
141
|
+
__esDecorate(null, null, _functionalDescription_decorators, { kind: "field", name: "functionalDescription", static: false, private: false, access: { has: obj => "functionalDescription" in obj, get: obj => obj.functionalDescription, set: (obj, value) => { obj.functionalDescription = value; } }, metadata: _metadata }, _functionalDescription_initializers, _functionalDescription_extraInitializers);
|
|
142
|
+
__esDecorate(null, null, _performanceTitle_decorators, { kind: "field", name: "performanceTitle", static: false, private: false, access: { has: obj => "performanceTitle" in obj, get: obj => obj.performanceTitle, set: (obj, value) => { obj.performanceTitle = value; } }, metadata: _metadata }, _performanceTitle_initializers, _performanceTitle_extraInitializers);
|
|
143
|
+
__esDecorate(null, null, _performanceDescription_decorators, { kind: "field", name: "performanceDescription", static: false, private: false, access: { has: obj => "performanceDescription" in obj, get: obj => obj.performanceDescription, set: (obj, value) => { obj.performanceDescription = value; } }, metadata: _metadata }, _performanceDescription_initializers, _performanceDescription_extraInitializers);
|
|
144
|
+
__esDecorate(null, null, _marketingTitle_decorators, { kind: "field", name: "marketingTitle", static: false, private: false, access: { has: obj => "marketingTitle" in obj, get: obj => obj.marketingTitle, set: (obj, value) => { obj.marketingTitle = value; } }, metadata: _metadata }, _marketingTitle_initializers, _marketingTitle_extraInitializers);
|
|
145
|
+
__esDecorate(null, null, _marketingDescription_decorators, { kind: "field", name: "marketingDescription", static: false, private: false, access: { has: obj => "marketingDescription" in obj, get: obj => obj.marketingDescription, set: (obj, value) => { obj.marketingDescription = value; } }, metadata: _metadata }, _marketingDescription_initializers, _marketingDescription_extraInitializers);
|
|
146
|
+
__esDecorate(null, null, _required_decorators, { kind: "field", name: "required", static: false, private: false, access: { has: obj => "required" in obj, get: obj => obj.required, set: (obj, value) => { obj.required = value; } }, metadata: _metadata }, _required_initializers, _required_extraInitializers);
|
|
147
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
148
|
+
DefaultCookieConsent = _classThis = _classDescriptor.value;
|
|
149
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
150
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
151
|
+
}
|
|
152
|
+
constructorProps;
|
|
32
153
|
/**
|
|
33
|
-
* @
|
|
154
|
+
* @default "This website uses cookies to store information on your computer."
|
|
155
|
+
* @zui
|
|
34
156
|
* @zgroup Consent Screen
|
|
35
|
-
* @zgrouppriority 20
|
|
36
|
-
* @zdefault "This website uses cookies to store information on your computer."
|
|
37
157
|
*/
|
|
38
|
-
|
|
158
|
+
title = __runInitializers(this, _title_initializers, 'This website uses cookies to store information on your computer.');
|
|
39
159
|
/**
|
|
40
|
-
* @
|
|
160
|
+
* @default "Some of these cookies are essential, while others help us to improve your experience by providing insights into how the site is being used."
|
|
161
|
+
* @zui
|
|
41
162
|
* @zgroup Consent Screen
|
|
42
|
-
* @zgrouppriority 20
|
|
43
|
-
* @zdefault "Some of these cookies are essential, while others help us to improve your experience by providing insights into how the site is being used."
|
|
44
163
|
*/
|
|
45
|
-
|
|
164
|
+
description = (__runInitializers(this, _title_extraInitializers), __runInitializers(this, _description_initializers, 'Some of these cookies are essential, while others help us to improve your experience by providing insights into how the site is being used.'));
|
|
46
165
|
/**
|
|
47
|
-
* @
|
|
166
|
+
* @default "Privacy Policy"
|
|
167
|
+
* @zui
|
|
48
168
|
* @zgroup Settings
|
|
49
|
-
* @zgrouppriority 10
|
|
50
|
-
* @zdefault "Privacy Policy"
|
|
51
169
|
*/
|
|
52
|
-
|
|
170
|
+
privacyPolicyText = (__runInitializers(this, _description_extraInitializers), __runInitializers(this, _privacyPolicyText_initializers, 'Privacy Policy'));
|
|
53
171
|
/**
|
|
54
|
-
* @
|
|
172
|
+
* @default ""
|
|
173
|
+
* @zui
|
|
55
174
|
* @zgroup Settings
|
|
56
|
-
* @zgrouppriority 10
|
|
57
|
-
* @zdefault ""
|
|
58
175
|
*/
|
|
59
|
-
|
|
176
|
+
privacyPolicyURL = (__runInitializers(this, _privacyPolicyText_extraInitializers), __runInitializers(this, _privacyPolicyURL_initializers, ''));
|
|
60
177
|
/**
|
|
61
|
-
* @
|
|
178
|
+
* @default "I Accept Cookies"
|
|
179
|
+
* @zui
|
|
62
180
|
* @zgroup Consent Screen
|
|
63
|
-
* @zgrouppriority 20
|
|
64
|
-
* @zdefault "I Accept Cookies"
|
|
65
181
|
*/
|
|
66
|
-
|
|
182
|
+
acceptButton = (__runInitializers(this, _privacyPolicyURL_extraInitializers), __runInitializers(this, _acceptButton_initializers, 'I Accept Cookies'));
|
|
67
183
|
/**
|
|
68
|
-
* @
|
|
184
|
+
* @default "Settings"
|
|
185
|
+
* @zui
|
|
69
186
|
* @zgroup Consent Screen
|
|
70
|
-
* @zgrouppriority 20
|
|
71
|
-
* @zdefault "Settings"
|
|
72
187
|
*/
|
|
73
|
-
|
|
188
|
+
settingsButton = (__runInitializers(this, _acceptButton_extraInitializers), __runInitializers(this, _settingsButton_initializers, 'Settings'));
|
|
74
189
|
/**
|
|
75
|
-
* @
|
|
76
|
-
* @
|
|
77
|
-
* @
|
|
78
|
-
* @zdefault "Save"
|
|
190
|
+
* @default "Save"
|
|
191
|
+
* @zui
|
|
192
|
+
* @zgroup Settings
|
|
79
193
|
*/
|
|
80
|
-
|
|
194
|
+
saveButton = (__runInitializers(this, _settingsButton_extraInitializers), __runInitializers(this, _saveButton_initializers, 'Save'));
|
|
81
195
|
/**
|
|
82
|
-
* @
|
|
196
|
+
* @default "Essential"
|
|
197
|
+
* @zui
|
|
83
198
|
* @zgroup Settings
|
|
84
|
-
* @zgrouppriority 10
|
|
85
|
-
* @zdefault "Essential"
|
|
86
199
|
*/
|
|
87
|
-
|
|
200
|
+
essentialTitle = (__runInitializers(this, _saveButton_extraInitializers), __runInitializers(this, _essentialTitle_initializers, 'Essential'));
|
|
88
201
|
/**
|
|
89
|
-
* @
|
|
202
|
+
* @default "Cookies that are necessary to provide the service."
|
|
203
|
+
* @zui
|
|
90
204
|
* @zgroup Settings
|
|
91
|
-
* @zgrouppriority 10
|
|
92
|
-
* @zdefault "Cookies that are necessary to provide the service."
|
|
93
205
|
*/
|
|
94
|
-
|
|
206
|
+
essentialDescription = (__runInitializers(this, _essentialTitle_extraInitializers), __runInitializers(this, _essentialDescription_initializers, 'Cookies that are necessary to provide the service.'));
|
|
95
207
|
/**
|
|
96
|
-
* @
|
|
208
|
+
* @default "Functional"
|
|
209
|
+
* @zui
|
|
97
210
|
* @zgroup Settings
|
|
98
|
-
* @zgrouppriority 10
|
|
99
|
-
* @zdefault "Functional"
|
|
100
211
|
*/
|
|
101
|
-
|
|
212
|
+
functionalTitle = (__runInitializers(this, _essentialDescription_extraInitializers), __runInitializers(this, _functionalTitle_initializers, 'Functional'));
|
|
102
213
|
/**
|
|
103
|
-
* @
|
|
214
|
+
* @default "Cookies that provide you with useful functionality, such as saving your preferences."
|
|
215
|
+
* @zui
|
|
104
216
|
* @zgroup Settings
|
|
105
|
-
* @zgrouppriority 10
|
|
106
|
-
* @zdefault "Cookies that provide you with useful functionality, such as saving your preferences."
|
|
107
217
|
*/
|
|
108
|
-
|
|
218
|
+
functionalDescription = (__runInitializers(this, _functionalTitle_extraInitializers), __runInitializers(this, _functionalDescription_initializers, 'Cookies that provide you with useful functionality, such as saving your preferences.'));
|
|
109
219
|
/**
|
|
110
|
-
* @
|
|
220
|
+
* @default "Performance"
|
|
221
|
+
* @zui
|
|
111
222
|
* @zgroup Settings
|
|
112
|
-
* @zgrouppriority 10
|
|
113
|
-
* @zdefault "Performance"
|
|
114
223
|
*/
|
|
115
|
-
|
|
224
|
+
performanceTitle = (__runInitializers(this, _functionalDescription_extraInitializers), __runInitializers(this, _performanceTitle_initializers, 'Performance'));
|
|
116
225
|
/**
|
|
117
|
-
* @
|
|
226
|
+
* @default "Cookies that help us measure and understand how the site is being used."
|
|
227
|
+
* @zui
|
|
118
228
|
* @zgroup Settings
|
|
119
|
-
* @zgrouppriority 10
|
|
120
|
-
* @zdefault "Cookies that help us measure and understand how the site is being used."
|
|
121
229
|
*/
|
|
122
|
-
|
|
230
|
+
performanceDescription = (__runInitializers(this, _performanceTitle_extraInitializers), __runInitializers(this, _performanceDescription_initializers, 'Cookies that help us measure and understand how the site is being used.'));
|
|
123
231
|
/**
|
|
124
|
-
* @
|
|
232
|
+
* @default "Marketing"
|
|
233
|
+
* @zui
|
|
125
234
|
* @zgroup Settings
|
|
126
|
-
* @zgrouppriority 10
|
|
127
|
-
* @zdefault "Marketing"
|
|
128
235
|
*/
|
|
129
|
-
|
|
236
|
+
marketingTitle = (__runInitializers(this, _performanceDescription_extraInitializers), __runInitializers(this, _marketingTitle_initializers, 'Marketing'));
|
|
130
237
|
/**
|
|
131
|
-
* @
|
|
238
|
+
* @default "Cookies that help us market our site and services."
|
|
239
|
+
* @zui
|
|
132
240
|
* @zgroup Settings
|
|
133
|
-
* @zgrouppriority 10
|
|
134
|
-
* @zdefault "Cookies that help us market our site and services."
|
|
135
241
|
*/
|
|
136
|
-
|
|
242
|
+
marketingDescription = (__runInitializers(this, _marketingTitle_extraInitializers), __runInitializers(this, _marketingDescription_initializers, 'Cookies that help us market our site and services.'));
|
|
137
243
|
/**
|
|
138
|
-
* @
|
|
244
|
+
* @default "Required"
|
|
245
|
+
* @zui
|
|
139
246
|
* @zgroup Settings
|
|
140
|
-
* @zgrouppriority 10
|
|
141
|
-
* @zdefault "Required"
|
|
142
247
|
*/
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
if (description)
|
|
176
|
-
description.textContent = v;
|
|
177
|
-
}, undefined, true);
|
|
178
|
-
const privacyPolicy = this._dom.querySelector('#zcomponent-cookieconsent-privacypolicy');
|
|
179
|
-
this.privacyPolicyText.addListener(val => {
|
|
180
|
-
if (privacyPolicy && privacyPolicy instanceof HTMLAnchorElement)
|
|
181
|
-
privacyPolicy.innerText = val;
|
|
182
|
-
}, undefined, true);
|
|
183
|
-
this.privacyPolicyURL.addListener(val => {
|
|
184
|
-
if (!privacyPolicy || !(privacyPolicy instanceof HTMLAnchorElement))
|
|
248
|
+
required = (__runInitializers(this, _marketingDescription_extraInitializers), __runInitializers(this, _required_initializers, 'Required'));
|
|
249
|
+
_dom = (__runInitializers(this, _required_extraInitializers), document.createElement('div'));
|
|
250
|
+
_functional = document.createElement('input');
|
|
251
|
+
_performance = document.createElement('input');
|
|
252
|
+
_marketing = document.createElement('input');
|
|
253
|
+
/**
|
|
254
|
+
* Creates an instance of DefaultCookieConsent.
|
|
255
|
+
* @param contextManager - The current ContextManager
|
|
256
|
+
* @param constructorProps - The properties of the component
|
|
257
|
+
*/
|
|
258
|
+
constructor(contextManager, constructorProps) {
|
|
259
|
+
super(contextManager, constructorProps);
|
|
260
|
+
this.constructorProps = constructorProps;
|
|
261
|
+
const context = contextManager.get(CookieConsentContext);
|
|
262
|
+
context.functionalCookies.value = this._getConsentStatus(CookieType.functional);
|
|
263
|
+
context.performanceCookies.value = this._getConsentStatus(CookieType.performance);
|
|
264
|
+
context.marketingCookies.value = this._getConsentStatus(CookieType.marketing);
|
|
265
|
+
context.status.value = Status.initialized;
|
|
266
|
+
context.showSettings.value = () => this.show(true);
|
|
267
|
+
this._dom.classList.add('zcomponent-cookieconsent');
|
|
268
|
+
if (constructorProps.waitForStart)
|
|
269
|
+
started(contextManager).then(() => this.show(false));
|
|
270
|
+
else
|
|
271
|
+
constructed(contextManager).then(() => this.show(false));
|
|
272
|
+
}
|
|
273
|
+
_loadDOM(isSettings) {
|
|
274
|
+
this._dom.innerHTML = html;
|
|
275
|
+
this._functional.type = 'checkbox';
|
|
276
|
+
this._performance.type = 'checkbox';
|
|
277
|
+
this._marketing.type = 'checkbox';
|
|
278
|
+
const panel = this._dom.querySelector('#zcomponent-cookieconsent-panel');
|
|
279
|
+
if (!panel)
|
|
185
280
|
return;
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
this.
|
|
193
|
-
if (
|
|
194
|
-
|
|
195
|
-
},
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
this.
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
281
|
+
const title = this._dom.querySelector('#zcomponent-cookieconsent-title');
|
|
282
|
+
this.observe(this, 'title', v => {
|
|
283
|
+
if (title)
|
|
284
|
+
title.textContent = v;
|
|
285
|
+
}, { callImmediately: true });
|
|
286
|
+
const description = this._dom.querySelector('#zcomponent-cookieconsent-description');
|
|
287
|
+
this.observe(this, 'description', v => {
|
|
288
|
+
if (description)
|
|
289
|
+
description.textContent = v;
|
|
290
|
+
}, { callImmediately: true });
|
|
291
|
+
const privacyPolicy = this._dom.querySelector('#zcomponent-cookieconsent-privacypolicy');
|
|
292
|
+
this.observe(this, 'privacyPolicyText', val => {
|
|
293
|
+
if (privacyPolicy && privacyPolicy instanceof HTMLAnchorElement)
|
|
294
|
+
privacyPolicy.innerText = val;
|
|
295
|
+
}, { callImmediately: true });
|
|
296
|
+
this.observe(this, 'privacyPolicyURL', val => {
|
|
297
|
+
if (!privacyPolicy || !(privacyPolicy instanceof HTMLAnchorElement))
|
|
298
|
+
return;
|
|
299
|
+
privacyPolicy.style.display = val.length === 0 ? 'none' : 'block';
|
|
300
|
+
privacyPolicy.href = val;
|
|
301
|
+
}, { callImmediately: true });
|
|
302
|
+
if (isSettings) {
|
|
303
|
+
const requiredDOM = document.createElement('span');
|
|
304
|
+
requiredDOM.innerText = 'Required';
|
|
305
|
+
this.observe(this, 'required', v => {
|
|
306
|
+
if (requiredDOM)
|
|
307
|
+
requiredDOM.textContent = v;
|
|
308
|
+
}, { callImmediately: true });
|
|
309
|
+
requiredDOM.style.float = 'right';
|
|
310
|
+
panel.appendChild(this._createEntry(this.essentialTitle, this.essentialDescription, [], requiredDOM));
|
|
311
|
+
panel.appendChild(this._createEntry(this.functionalTitle, this.functionalDescription, [], this._functional));
|
|
312
|
+
panel.appendChild(this._createEntry(this.performanceTitle, this.performanceDescription, usePerformanceVendors(this.contextManager), this._performance));
|
|
313
|
+
panel.appendChild(this._createEntry(this.marketingTitle, this.marketingDescription, useMarketingVendors(this.contextManager), this._marketing));
|
|
314
|
+
this._functional.checked = useCookieConsentFunctional(this.contextManager).value === ConsentStatus.granted;
|
|
315
|
+
this._performance.checked = useCookieConsentPerformance(this.contextManager).value === ConsentStatus.granted;
|
|
316
|
+
this._marketing.checked = useCookieConsentMarketing(this.contextManager).value === ConsentStatus.granted;
|
|
317
|
+
const saveButton = document.createElement('button');
|
|
318
|
+
saveButton.id = 'zcomponent-cookieconsent-save';
|
|
319
|
+
this.observe(this, 'saveButton', v => {
|
|
320
|
+
if (saveButton)
|
|
321
|
+
saveButton.textContent = v;
|
|
322
|
+
}, { callImmediately: true });
|
|
323
|
+
panel.appendChild(saveButton);
|
|
324
|
+
if (!isDesignTime(this.contextManager)) {
|
|
325
|
+
saveButton.addEventListener('click', () => this._save());
|
|
326
|
+
}
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
const acceptButton = document.createElement('button');
|
|
330
|
+
acceptButton.id = 'zcomponent-cookieconsent-accept';
|
|
331
|
+
this.observe(this, 'acceptButton', v => {
|
|
332
|
+
if (acceptButton)
|
|
333
|
+
acceptButton.textContent = v;
|
|
334
|
+
}, { callImmediately: true });
|
|
335
|
+
panel.appendChild(acceptButton);
|
|
336
|
+
const settingsButton = document.createElement('button');
|
|
337
|
+
settingsButton.id = 'zcomponent-cookieconsent-settings';
|
|
338
|
+
this.observe(this, 'settingsButton', v => {
|
|
339
|
+
if (settingsButton)
|
|
340
|
+
settingsButton.textContent = v;
|
|
341
|
+
}, { callImmediately: true });
|
|
342
|
+
settingsButton.addEventListener('click', () => {
|
|
343
|
+
console.log('Settings click');
|
|
344
|
+
this._loadDOM(true);
|
|
345
|
+
});
|
|
346
|
+
panel.appendChild(settingsButton);
|
|
211
347
|
if (!isDesignTime(this.contextManager)) {
|
|
212
|
-
|
|
348
|
+
acceptButton.addEventListener('click', () => this.acceptAll());
|
|
213
349
|
}
|
|
214
|
-
|
|
350
|
+
this._dom.addEventListener('click', () => { });
|
|
215
351
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
panel.appendChild(acceptButton);
|
|
223
|
-
const settingsButton = document.createElement('button');
|
|
224
|
-
settingsButton.id = 'zcomponent-cookieconsent-settings';
|
|
225
|
-
this.settingsButton.addListener(v => {
|
|
226
|
-
if (settingsButton)
|
|
227
|
-
settingsButton.textContent = v;
|
|
228
|
-
}, undefined, true);
|
|
229
|
-
settingsButton.addEventListener('click', () => {
|
|
230
|
-
console.log('Settings click');
|
|
231
|
-
this._loadDOM(true);
|
|
232
|
-
});
|
|
233
|
-
panel.appendChild(settingsButton);
|
|
234
|
-
if (!isDesignTime(this.contextManager)) {
|
|
235
|
-
acceptButton.addEventListener('click', () => this.acceptAll());
|
|
352
|
+
_save() {
|
|
353
|
+
this._setConsentStatus(CookieType.essential, ConsentStatus.granted);
|
|
354
|
+
this._setConsentStatus(CookieType.functional, this._functional.checked ? ConsentStatus.granted : ConsentStatus.rejected);
|
|
355
|
+
this._setConsentStatus(CookieType.performance, this._performance.checked ? ConsentStatus.granted : ConsentStatus.rejected);
|
|
356
|
+
this._setConsentStatus(CookieType.marketing, this._marketing.checked ? ConsentStatus.granted : ConsentStatus.rejected);
|
|
357
|
+
this.hide();
|
|
236
358
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
const privacy = document.createElement('a');
|
|
269
|
-
this.privacyPolicyText.addListener(val => (privacy.innerText = val), undefined, true);
|
|
270
|
-
privacy.href = vendor.privacyPolicyUrl;
|
|
271
|
-
privacy.rel = 'noreferrer noopener';
|
|
272
|
-
privacy.target = '_blank';
|
|
273
|
-
li.appendChild(privacy);
|
|
359
|
+
_createEntry(title, description, vendors, elm) {
|
|
360
|
+
const container = document.createElement('div');
|
|
361
|
+
container.classList.add('zcomponent-cookieconsent-type');
|
|
362
|
+
container.appendChild(elm);
|
|
363
|
+
const header = document.createElement('h3');
|
|
364
|
+
header.innerText = title;
|
|
365
|
+
container.appendChild(header);
|
|
366
|
+
const descriptionDom = document.createElement('div');
|
|
367
|
+
descriptionDom.innerText = description;
|
|
368
|
+
container.appendChild(descriptionDom);
|
|
369
|
+
if (vendors.length === 0)
|
|
370
|
+
return container;
|
|
371
|
+
const ul = document.createElement('ul');
|
|
372
|
+
for (const vendor of vendors) {
|
|
373
|
+
const li = document.createElement('li');
|
|
374
|
+
ul.appendChild(li);
|
|
375
|
+
const header = document.createElement('h5');
|
|
376
|
+
header.innerText = vendor.name;
|
|
377
|
+
li.appendChild(header);
|
|
378
|
+
li.append(vendor.description);
|
|
379
|
+
li.append(document.createElement('br'));
|
|
380
|
+
if (vendor.privacyPolicyUrl?.length > 0) {
|
|
381
|
+
const privacy = document.createElement('a');
|
|
382
|
+
this.observe(this, 'privacyPolicyText', val => {
|
|
383
|
+
privacy.innerText = val;
|
|
384
|
+
}, { callImmediately: true });
|
|
385
|
+
privacy.href = vendor.privacyPolicyUrl;
|
|
386
|
+
privacy.rel = 'noreferrer noopener';
|
|
387
|
+
privacy.target = '_blank';
|
|
388
|
+
li.appendChild(privacy);
|
|
389
|
+
}
|
|
274
390
|
}
|
|
391
|
+
container.appendChild(ul);
|
|
392
|
+
return container;
|
|
275
393
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
return ConsentStatus.
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
394
|
+
_getConsentStatus(type) {
|
|
395
|
+
const val = window.localStorage.getItem('zcomponent-cookieconsent-' + type);
|
|
396
|
+
if (val === null)
|
|
397
|
+
return ConsentStatus.unknown;
|
|
398
|
+
if (val === '1')
|
|
399
|
+
return ConsentStatus.granted;
|
|
400
|
+
return ConsentStatus.rejected;
|
|
401
|
+
}
|
|
402
|
+
_setConsentStatus(type, status) {
|
|
403
|
+
if (status === ConsentStatus.unknown)
|
|
404
|
+
window.localStorage.removeItem('zcomponent-cookieconsent-' + type);
|
|
405
|
+
else
|
|
406
|
+
window.localStorage.setItem('zcomponent-cookieconsent-' + type, status === ConsentStatus.granted ? '1' : '0');
|
|
407
|
+
if (type === CookieType.functional)
|
|
408
|
+
useCookieConsentFunctional(this.contextManager).value = status;
|
|
409
|
+
if (type === CookieType.performance)
|
|
410
|
+
useCookieConsentPerformance(this.contextManager).value = status;
|
|
411
|
+
if (type === CookieType.marketing)
|
|
412
|
+
useCookieConsentMarketing(this.contextManager).value = status;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Shows the cookie consent dialog.
|
|
416
|
+
* @param isSettings - Determines if the settings screen should be shown
|
|
417
|
+
* @param force - Forces the dialog to be shown, regardless of the current consent status. Defaults to false.
|
|
418
|
+
*/
|
|
419
|
+
show(isSettings, force = false) {
|
|
420
|
+
if (force) {
|
|
421
|
+
this._loadDOM(isSettings);
|
|
422
|
+
document.body.appendChild(this._dom);
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
const designTimeOverride = isDesignTime(this.contextManager) && (this.constructorProps.preview ?? false);
|
|
426
|
+
if (isDesignTime(this.contextManager) && !designTimeOverride)
|
|
427
|
+
return;
|
|
428
|
+
const context = this.contextManager.get(CookieConsentContext);
|
|
429
|
+
if (context.functionalCookies.value !== ConsentStatus.unknown && context.marketingCookies.value !== ConsentStatus.unknown && context.performanceCookies.value !== ConsentStatus.unknown && !designTimeOverride)
|
|
430
|
+
return;
|
|
306
431
|
this._loadDOM(isSettings);
|
|
432
|
+
const acceptedEssential = window.localStorage.getItem('zcomponent-cookieconsent-essential');
|
|
433
|
+
if (acceptedEssential !== null && !designTimeOverride)
|
|
434
|
+
return;
|
|
435
|
+
if ((this.constructorProps.onlyShowIfVendors ?? true) && !designTimeOverride) {
|
|
436
|
+
const performanceVendors = usePerformanceVendors(this.contextManager);
|
|
437
|
+
const marketingVendors = useMarketingVendors(this.contextManager);
|
|
438
|
+
if (performanceVendors.length === 0 && marketingVendors.length === 0)
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
307
441
|
document.body.appendChild(this._dom);
|
|
308
|
-
return;
|
|
309
442
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
return;
|
|
313
|
-
const context = this.contextManager.get(CookieConsentContext);
|
|
314
|
-
if (context.functionalCookies.value !== ConsentStatus.unknown && context.marketingCookies.value !== ConsentStatus.unknown && context.performanceCookies.value !== ConsentStatus.unknown && !designTimeOverride)
|
|
315
|
-
return;
|
|
316
|
-
this._loadDOM(isSettings);
|
|
317
|
-
const acceptedEssential = window.localStorage.getItem('zcomponent-cookieconsent-essential');
|
|
318
|
-
if (acceptedEssential !== null && !designTimeOverride)
|
|
319
|
-
return;
|
|
320
|
-
if ((this.constructorProps.onlyShowIfVendors ?? true) && !designTimeOverride) {
|
|
321
|
-
const performanceVendors = usePerformanceVendors(this.contextManager);
|
|
322
|
-
const marketingVendors = useMarketingVendors(this.contextManager);
|
|
323
|
-
if (performanceVendors.length === 0 && marketingVendors.length === 0)
|
|
324
|
-
return;
|
|
443
|
+
hide() {
|
|
444
|
+
this._dom.remove();
|
|
325
445
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
}
|
|
342
|
-
}
|
|
446
|
+
acceptAll() {
|
|
447
|
+
this._setConsentStatus(CookieType.essential, ConsentStatus.granted);
|
|
448
|
+
this._setConsentStatus(CookieType.functional, ConsentStatus.granted);
|
|
449
|
+
this._setConsentStatus(CookieType.performance, ConsentStatus.granted);
|
|
450
|
+
this._setConsentStatus(CookieType.marketing, ConsentStatus.granted);
|
|
451
|
+
this.hide();
|
|
452
|
+
}
|
|
453
|
+
dispose() {
|
|
454
|
+
this._dom.remove();
|
|
455
|
+
return super.dispose();
|
|
456
|
+
}
|
|
457
|
+
};
|
|
458
|
+
return DefaultCookieConsent = _classThis;
|
|
459
|
+
})();
|
|
460
|
+
export { DefaultCookieConsent };
|