@everymatrix/user-action-controller 0.0.1 → 1.0.69
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/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/index-c5061e5a.js +1315 -0
- package/dist/cjs/loader.cjs.js +7 -13
- package/dist/cjs/player-user-consents_2.cjs.entry.js +504 -0
- package/dist/cjs/user-action-controller.cjs.js +17 -11
- package/dist/collection/collection-manifest.json +5 -11
- package/dist/collection/components/user-action-controller/index.js +1 -0
- package/dist/collection/components/user-action-controller/user-action-controller.css +43 -0
- package/dist/collection/components/user-action-controller/user-action-controller.js +423 -235
- package/dist/collection/utils/locale.utils.js +66 -0
- package/dist/collection/utils/utils.js +1 -1
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/index-02b86e76.js +1288 -0
- package/dist/esm/loader.js +7 -13
- package/dist/esm/player-user-consents_2.entry.js +499 -0
- package/dist/esm/user-action-controller.js +14 -11
- package/dist/stencil.config.dev.js +17 -0
- package/dist/stencil.config.js +14 -19
- package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/user-action-controller/.stencil/packages/stencil/user-action-controller/stencil.config.d.ts +2 -0
- package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/user-action-controller/.stencil/packages/stencil/user-action-controller/stencil.config.dev.d.ts +2 -0
- package/dist/types/components/user-action-controller/index.d.ts +1 -0
- package/dist/types/components/user-action-controller/user-action-controller.d.ts +68 -50
- package/dist/types/components.d.ts +34 -18
- package/dist/types/stencil-public-runtime.d.ts +142 -33
- package/dist/types/utils/locale.utils.d.ts +2 -0
- package/dist/user-action-controller/p-4bd71dba.entry.js +1 -0
- package/dist/user-action-controller/p-b996e8b8.js +2 -0
- package/dist/user-action-controller/p-e1255160.js +1 -0
- package/dist/user-action-controller/user-action-controller.esm.js +1 -1
- package/loader/cdn.js +1 -3
- package/loader/index.cjs.js +1 -3
- package/loader/index.d.ts +13 -1
- package/loader/index.es2017.js +1 -3
- package/loader/index.js +1 -3
- package/loader/package.json +1 -0
- package/package.json +12 -2
- package/dist/cjs/generic-user-consent_3.cjs.entry.js +0 -182
- package/dist/cjs/index-4a3038bd.js +0 -1255
- package/dist/components/generic-user-consent.js +0 -6
- package/dist/components/generic-user-consent2.js +0 -93
- package/dist/components/index.d.ts +0 -26
- package/dist/components/index.js +0 -1
- package/dist/components/legislation-wrapper.js +0 -6
- package/dist/components/legislation-wrapper2.js +0 -33
- package/dist/components/user-action-controller.d.ts +0 -11
- package/dist/components/user-action-controller.js +0 -137
- package/dist/esm/generic-user-consent_3.entry.js +0 -176
- package/dist/esm/index-9eef5ef8.js +0 -1229
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/types/Users/user/workspace/everymatrix/widgets-stencil/packages/user-action-controller/.stencil/packages/user-action-controller/stencil.config.d.ts +0 -2
- package/dist/user-action-controller/p-013051ff.entry.js +0 -1
- package/dist/user-action-controller/p-54386d36.js +0 -1
package/dist/esm/loader.js
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as bootstrapLazy } from './index-02b86e76.js';
|
|
2
|
+
export { s as setNonce } from './index-02b86e76.js';
|
|
3
|
+
import { g as globalScripts } from './app-globals-0f993ce5.js';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return promiseResolve();
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const defineCustomElements = (win, options) => {
|
|
11
|
-
if (typeof window === 'undefined') return Promise.resolve();
|
|
12
|
-
return patchEsm().then(() => {
|
|
13
|
-
return bootstrapLazy([["generic-user-consent_3",[[1,"user-action-controller",{"endpoint":[1],"userSession":[1,"user-session"],"userId":[1,"user-id"],"includeSubmitButton":[4,"include-submit-button"],"submitButtonText":[1,"submit-button-text"],"userNoticeText":[1,"user-notice-text"],"activeUserActions":[1,"active-user-actions"],"queryFired":[32],"readyActionsCount":[32],"receivedQueryResponses":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]]],[1,"generic-user-consent",{"queried":[4],"consentType":[1,"consent-type"],"mandatory":[4],"consentTitle":[1,"consent-title"],"tcLink":[1,"tc-link"],"privacyLink":[1,"privacy-link"],"textContent":[32]}],[1,"legislation-wrapper",{"activeUserActions":[1,"active-user-actions"]}]]]], options);
|
|
14
|
-
});
|
|
5
|
+
const defineCustomElements = async (win, options) => {
|
|
6
|
+
if (typeof window === 'undefined') return undefined;
|
|
7
|
+
await globalScripts();
|
|
8
|
+
return bootstrapLazy([["player-user-consents_2",[[1,"user-action-controller",{"endpoint":[513],"userSession":[513,"user-session"],"userId":[513,"user-id"],"lang":[1537],"includeSubmitButton":[516,"include-submit-button"],"gmVersion":[1,"gm-version"],"translationUrl":[513,"translation-url"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"queryFired":[32],"readyActionsCount":[32],"activeUserActions":[32],"userActionsValidated":[32],"receivedQueryResponses":[32],"limitStylingAppends":[32],"isLoading":[32],"mandatoryActionsChecked":[32],"mandatoryItems":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]],{"translationUrl":["handleNewTranslations"],"receivedQueryResponses":["handleQueryResponse"]}],[1,"player-user-consents",{"lang":[1537],"queried":[516],"consentType":[513,"consent-type"],"mandatory":[516],"gmVersion":[1,"gm-version"],"consentTitle":[513,"consent-title"],"clientStyling":[1,"client-styling"],"translationUrl":[513,"translation-url"],"textContent":[32],"limitStylingAppends":[32]},null,{"translationUrl":["handleNewTranslations"]}]]]], options);
|
|
15
9
|
};
|
|
16
10
|
|
|
17
11
|
export { defineCustomElements };
|
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h } from './index-02b86e76.js';
|
|
2
|
+
|
|
3
|
+
const DEFAULT_LANGUAGE$1 = 'en';
|
|
4
|
+
const TRANSLATIONS$1 = {
|
|
5
|
+
en: {
|
|
6
|
+
termsAndConditions: {
|
|
7
|
+
acceptPart1: "I accept the ",
|
|
8
|
+
acceptPart2: ", I have read and understood the ",
|
|
9
|
+
acceptPart3: " as published on this site and confirm that I am over 18 years old.",
|
|
10
|
+
tc: "Terms and Conditions"
|
|
11
|
+
},
|
|
12
|
+
privacyPolicy: {
|
|
13
|
+
readUnderstandPart1: "I have read and understood the ",
|
|
14
|
+
readUnderstandPart2: ", as published on this site and confirm that I am over 18 years old.",
|
|
15
|
+
privacy: "Privacy Policy"
|
|
16
|
+
},
|
|
17
|
+
sms: "I consent to receive marketing communication via SMS.",
|
|
18
|
+
emailmarketing: "I consent to receive marketing communication via Email."
|
|
19
|
+
},
|
|
20
|
+
ro: {
|
|
21
|
+
termsAndConditions: {
|
|
22
|
+
acceptPart1: "Accept ",
|
|
23
|
+
acceptPart2: " platformei. Am citit şi înţeles ",
|
|
24
|
+
acceptPart3: " publicată pe acest site şi confirm că am vârstă peste 18 ani.",
|
|
25
|
+
tc: "Termenii şi condiţiile"
|
|
26
|
+
},
|
|
27
|
+
privacyPolicy: {
|
|
28
|
+
readUnderstandPart1: "Am citit şi înţeles ",
|
|
29
|
+
readUnderstandPart2: " publicată pe acest site şi confirm că am vârstă peste 18 ani.",
|
|
30
|
+
privacy: "Politica de confidenţialitate"
|
|
31
|
+
},
|
|
32
|
+
sms: "Sunt de acord să primesc promoţii de marketing prin SMS.",
|
|
33
|
+
emailmarketing: "Sunt de acord să primesc promoţii de marketing pe e-mail."
|
|
34
|
+
},
|
|
35
|
+
hr: {
|
|
36
|
+
termsAndConditions: {
|
|
37
|
+
acceptPart1: "I accept the ",
|
|
38
|
+
acceptPart2: ", I have read and understood the ",
|
|
39
|
+
acceptPart3: " as published on this site and confirm that I am over 18 years old.",
|
|
40
|
+
tc: "Terms and Conditions"
|
|
41
|
+
},
|
|
42
|
+
privacyPolicy: {
|
|
43
|
+
readUnderstandPart1: "I have read and understood the ",
|
|
44
|
+
readUnderstandPart2: ", as published on this site and confirm that I am over 18 years old.",
|
|
45
|
+
privacy: "Privacy Policy"
|
|
46
|
+
},
|
|
47
|
+
sms: "I consent to receive marketing communication via SMS.",
|
|
48
|
+
emailmarketing: "I consent to receive marketing communication via Email."
|
|
49
|
+
},
|
|
50
|
+
fr: {
|
|
51
|
+
termsAndConditions: {
|
|
52
|
+
acceptPart1: "I accept the ",
|
|
53
|
+
acceptPart2: ", I have read and understood the ",
|
|
54
|
+
acceptPart3: " as published on this site and confirm that I am over 18 years old.",
|
|
55
|
+
tc: "Terms and Conditions"
|
|
56
|
+
},
|
|
57
|
+
privacyPolicy: {
|
|
58
|
+
readUnderstandPart1: "I have read and understood the ",
|
|
59
|
+
readUnderstandPart2: ", as published on this site and confirm that I am over 18 years old.",
|
|
60
|
+
privacy: "Privacy Policy"
|
|
61
|
+
},
|
|
62
|
+
sms: "I consent to receive marketing communication via SMS.",
|
|
63
|
+
emailmarketing: "I consent to receive marketing communication via Email."
|
|
64
|
+
},
|
|
65
|
+
cs: {
|
|
66
|
+
termsAndConditions: {
|
|
67
|
+
acceptPart1: "I accept the ",
|
|
68
|
+
acceptPart2: ", I have read and understood the ",
|
|
69
|
+
acceptPart3: " as published on this site and confirm that I am over 18 years old.",
|
|
70
|
+
tc: "Terms and Conditions"
|
|
71
|
+
},
|
|
72
|
+
privacyPolicy: {
|
|
73
|
+
readUnderstandPart1: "I have read and understood the ",
|
|
74
|
+
readUnderstandPart2: ", as published on this site and confirm that I am over 18 years old.",
|
|
75
|
+
privacy: "Privacy Policy"
|
|
76
|
+
},
|
|
77
|
+
sms: "I consent to receive marketing communication via SMS.",
|
|
78
|
+
emailmarketing: "I consent to receive marketing communication via Email."
|
|
79
|
+
},
|
|
80
|
+
de: {
|
|
81
|
+
termsAndConditions: {
|
|
82
|
+
acceptPart1: "I accept the ",
|
|
83
|
+
acceptPart2: ", I have read and understood the ",
|
|
84
|
+
acceptPart3: " as published on this site and confirm that I am over 18 years old.",
|
|
85
|
+
tc: "Terms and Conditions"
|
|
86
|
+
},
|
|
87
|
+
privacyPolicy: {
|
|
88
|
+
readUnderstandPart1: "I have read and understood the ",
|
|
89
|
+
readUnderstandPart2: ", as published on this site and confirm that I am over 18 years old.",
|
|
90
|
+
privacy: "Privacy Policy"
|
|
91
|
+
},
|
|
92
|
+
sms: "I consent to receive marketing communication via SMS.",
|
|
93
|
+
emailmarketing: "I consent to receive marketing communication via Email."
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
const getTranslations$1 = (url) => {
|
|
97
|
+
// fetch url, get the data, replace the TRANSLATIONS content
|
|
98
|
+
return new Promise((resolve) => {
|
|
99
|
+
fetch(url)
|
|
100
|
+
.then((res) => res.json())
|
|
101
|
+
.then((data) => {
|
|
102
|
+
Object.keys(data).forEach((item) => {
|
|
103
|
+
for (let key in data[item]) {
|
|
104
|
+
TRANSLATIONS$1[item][key] = data[item][key];
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
resolve(true);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
const translate$1 = (key, customLang, values) => {
|
|
112
|
+
const lang = customLang || DEFAULT_LANGUAGE$1;
|
|
113
|
+
const getNestedTranslation = (obj, path) => {
|
|
114
|
+
return path.split('.').reduce((o, k) => (o && o[k] !== undefined ? o[k] : null), obj);
|
|
115
|
+
};
|
|
116
|
+
let translation = getNestedTranslation(TRANSLATIONS$1[lang], key);
|
|
117
|
+
if (translation === null) {
|
|
118
|
+
return key;
|
|
119
|
+
}
|
|
120
|
+
if (values !== undefined) {
|
|
121
|
+
for (const [k, v] of Object.entries(values)) {
|
|
122
|
+
const regex = new RegExp(`{${k}}`, 'g');
|
|
123
|
+
translation = translation.replace(regex, v);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return translation;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const playerUserConsentsCss = ":host{display:block}.ConsentTitle{margin-bottom:0.2rem;font-weight:600}.UserConsent:hover{cursor:pointer}.UserConsent{display:flex;align-items:baseline}.MandatoryItem{color:#f00;font-size:1.2rem}.ConsentLink{text-decoration:underline;color:var(--emfe-w-color-primary);font-weight:bold}";
|
|
130
|
+
const PlayerUserConsentsStyle0 = playerUserConsentsCss;
|
|
131
|
+
|
|
132
|
+
const PlayerUserConsents = class {
|
|
133
|
+
constructor(hostRef) {
|
|
134
|
+
registerInstance(this, hostRef);
|
|
135
|
+
this.userLegislationConsent = createEvent(this, "userLegislationConsent", 7);
|
|
136
|
+
this.goToTermsAndConditions = () => window.postMessage({ type: 'GoToTermsAndConditions' });
|
|
137
|
+
this.goToPrivacyPolicy = () => window.postMessage({ type: 'GoToPrivacyPolicy' });
|
|
138
|
+
this.setClientStyling = () => {
|
|
139
|
+
let sheet = document.createElement('style');
|
|
140
|
+
sheet.innerHTML = this.clientStyling;
|
|
141
|
+
this.stylingContainer.prepend(sheet);
|
|
142
|
+
};
|
|
143
|
+
this.lang = 'en';
|
|
144
|
+
this.queried = false;
|
|
145
|
+
this.consentType = '';
|
|
146
|
+
this.mandatory = false;
|
|
147
|
+
this.gmVersion = '';
|
|
148
|
+
this.consentTitle = '';
|
|
149
|
+
this.clientStyling = '';
|
|
150
|
+
this.translationUrl = '';
|
|
151
|
+
this.textContent = '';
|
|
152
|
+
this.limitStylingAppends = false;
|
|
153
|
+
}
|
|
154
|
+
handleNewTranslations() {
|
|
155
|
+
getTranslations$1(this.translationUrl);
|
|
156
|
+
}
|
|
157
|
+
async componentWillLoad() {
|
|
158
|
+
if (this.translationUrl.length > 2) {
|
|
159
|
+
await getTranslations$1(this.translationUrl);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
userLegislationConsentHandler() {
|
|
163
|
+
this.userLegislationConsent.emit({
|
|
164
|
+
type: this.consentType,
|
|
165
|
+
value: this.checkboxInput.checked
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
componentDidRender() {
|
|
169
|
+
// start custom styling area
|
|
170
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
171
|
+
if (this.clientStyling)
|
|
172
|
+
this.setClientStyling();
|
|
173
|
+
this.limitStylingAppends = true;
|
|
174
|
+
}
|
|
175
|
+
// end custom styling area
|
|
176
|
+
}
|
|
177
|
+
determineTextContent() {
|
|
178
|
+
if (this.gmVersion === 'gmcore') {
|
|
179
|
+
if (this.consentType === 'termsandconditions') {
|
|
180
|
+
return h("p", null, translate$1('termsAndConditions.acceptPart1', this.lang), h("span", { class: "ConsentLink", onClick: this.goToTermsAndConditions }, translate$1('termsAndConditions.tcLink', this.lang)), translate$1('termsAndConditions.acceptPart2', this.lang), h("span", { class: "ConsentLink", onClick: this.goToPrivacyPolicy }, translate$1('privacyPolicy.privacyLink', this.lang)), translate$1('termsAndConditions.acceptPart3', this.lang));
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (this.gmVersion === 'gm16') {
|
|
184
|
+
if (this.consentType === 'termsandconditions') {
|
|
185
|
+
return h("p", null, translate$1('termsAndConditions.acceptPart1', this.lang), h("span", { class: "ConsentLink", onClick: this.goToTermsAndConditions }, translate$1('termsAndConditions.tcLink', this.lang)));
|
|
186
|
+
}
|
|
187
|
+
if (this.consentType === 'privacypolicy') {
|
|
188
|
+
return h("p", null, translate$1('privacyPolicy.readUnderstandPart1', this.lang), h("span", { class: "ConsentLink", onClick: this.goToPrivacyPolicy }, translate$1('privacyPolicy.privacyLink', this.lang)), translate$1('privacyPolicy.readUnderstandPart2', this.lang));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return h("p", null, translate$1(this.consentType, this.lang));
|
|
192
|
+
}
|
|
193
|
+
render() {
|
|
194
|
+
if (this.queried) {
|
|
195
|
+
this.userLegislationConsentHandler();
|
|
196
|
+
}
|
|
197
|
+
return (h("div", { key: 'e3c5e7d280de637fd8297dd59c170479d6142372', ref: el => this.stylingContainer = el }, h("p", { key: '8d103ef2eda5fd078a46a7d818eadd07dade5277', class: "ConsentTitle" }, this.consentTitle), h("label", { key: '6a333af5b8585e609285f9f172bf8ddb3b0d4b4b', class: "UserConsent", htmlFor: "userConsent" }, h("input", { key: 'c003a2ef7219e4c5442730432dffcaef4a16b947', ref: el => this.checkboxInput = el, id: "userConsent", type: "checkbox", onInput: () => this.userLegislationConsentHandler() }), this.determineTextContent(), this.mandatory && h("span", { key: '0bc4b24a85b76763af5e691f126e8ee8ae90e447', class: "MandatoryItem" }, "*"))));
|
|
198
|
+
}
|
|
199
|
+
static get watchers() { return {
|
|
200
|
+
"translationUrl": ["handleNewTranslations"]
|
|
201
|
+
}; }
|
|
202
|
+
};
|
|
203
|
+
PlayerUserConsents.style = PlayerUserConsentsStyle0;
|
|
204
|
+
|
|
205
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
206
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en', 'cz', 'de', 'hr'];
|
|
207
|
+
const TRANSLATIONS = {
|
|
208
|
+
en: {
|
|
209
|
+
termsandconditions: 'Terms and Conditions',
|
|
210
|
+
sms: 'SMS marketing',
|
|
211
|
+
emailmarketing: 'Email marketing',
|
|
212
|
+
privacypolicy: 'Privacy Policy'
|
|
213
|
+
},
|
|
214
|
+
ro: {
|
|
215
|
+
termsandconditions: 'Termeni şi condiţii',
|
|
216
|
+
sms: 'SMS marketing',
|
|
217
|
+
emailmarketing: 'Email marketing',
|
|
218
|
+
privacypolicy: 'Privacy Policy'
|
|
219
|
+
},
|
|
220
|
+
hr: {
|
|
221
|
+
termsandconditions: 'Terms and Conditions',
|
|
222
|
+
sms: 'SMS marketing',
|
|
223
|
+
emailmarketing: 'Email marketing',
|
|
224
|
+
privacypolicy: 'Privacy Policy'
|
|
225
|
+
},
|
|
226
|
+
fr: {
|
|
227
|
+
termsandconditions: 'Terms and Conditions',
|
|
228
|
+
sms: 'SMS marketing',
|
|
229
|
+
emailmarketing: 'Email marketing',
|
|
230
|
+
privacypolicy: 'Privacy Policy'
|
|
231
|
+
},
|
|
232
|
+
cs: {
|
|
233
|
+
termsandconditions: 'Terms and Conditions',
|
|
234
|
+
sms: 'SMS marketing',
|
|
235
|
+
emailmarketing: 'Email marketing',
|
|
236
|
+
privacypolicy: 'Privacy Policy'
|
|
237
|
+
},
|
|
238
|
+
de: {
|
|
239
|
+
termsandconditions: 'Terms and Conditions',
|
|
240
|
+
sms: 'SMS marketing',
|
|
241
|
+
emailmarketing: 'Email marketing',
|
|
242
|
+
privacypolicy: 'Privacy Policy'
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
const getTranslations = (url) => {
|
|
246
|
+
// fetch url, get the data, replace the TRANSLATIONS content
|
|
247
|
+
return new Promise((resolve) => {
|
|
248
|
+
fetch(url)
|
|
249
|
+
.then((res) => res.json())
|
|
250
|
+
.then((data) => {
|
|
251
|
+
Object.keys(data).forEach((item) => {
|
|
252
|
+
for (let key in data[item]) {
|
|
253
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
resolve(true);
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
};
|
|
260
|
+
const translate = (key, customLang, values) => {
|
|
261
|
+
const lang = customLang;
|
|
262
|
+
let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
263
|
+
if (values !== undefined) {
|
|
264
|
+
for (const [key, value] of Object.entries(values.values)) {
|
|
265
|
+
const regex = new RegExp(`{${key}}`, 'g');
|
|
266
|
+
translation = translation.replace(regex, value);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return translation;
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
const userActionControllerCss = ":host{display:block}.QueryReferenceContainer{height:100%;width:100%}.UserConsentNotice{font-size:1.2rem;font-weight:200;text-align:center}.CloseButton{width:25px;height:25px;align-self:flex-end}.UserActionController{font-family:Arial, Helvetica, sans-serif;font-weight:100;height:100%;width:100%;padding:1rem 1.5rem 2rem;background-color:#fff;display:flex;flex-direction:column;justify-content:space-between;border-radius:5%}.ConsentSubmitButton{font-size:1rem;padding:0.4rem 1.4rem;background:#fff;border:2px solid #000;color:#000;border-radius:5px;align-self:flex-end;cursor:pointer}.ConsentSubmitButton:disabled{border:2px solid #ccc;color:#ccc;cursor:unset}@media screen and (max-width: 320px){.QueryReferenceContainer{font-size:0.8rem;color:blue}}.spinner{animation:rotate 2s linear infinite;z-index:2;position:absolute;top:50%;left:50%;margin:-25px 0 0 -25px;width:50px;height:50px}.spinner .path{stroke:var(--emfe-w-login-color-primary, var(--emfe-w-color-primary, #D0046C));stroke-linecap:round;animation:dash 1.5s ease-in-out infinite}@keyframes rotate{100%{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1, 150;stroke-dashoffset:0}50%{stroke-dasharray:90, 150;stroke-dashoffset:-35}100%{stroke-dasharray:90, 150;stroke-dashoffset:-124}}";
|
|
273
|
+
const UserActionControllerStyle0 = userActionControllerCss;
|
|
274
|
+
|
|
275
|
+
const UserActionController = class {
|
|
276
|
+
constructor(hostRef) {
|
|
277
|
+
registerInstance(this, hostRef);
|
|
278
|
+
//for now this variable is hardcoded bcs we have terms and conditions and privacy policy mandatory and we dont receive with these new functionality the mandatory actions
|
|
279
|
+
this.mandatoryActions = ['termsandconditions', 'privacypolicy'];
|
|
280
|
+
this.userActions = [];
|
|
281
|
+
this.consentTitles = {
|
|
282
|
+
termsandconditions: translate('termsAndConditionsTitle', this.lang),
|
|
283
|
+
sms: translate('smsTitle', this.lang),
|
|
284
|
+
emailmarketing: translate('emailMarketingTitle', this.lang),
|
|
285
|
+
privacypolicy: translate('privacyPolicyTitle', this.lang)
|
|
286
|
+
};
|
|
287
|
+
this.setClientStyling = () => {
|
|
288
|
+
let sheet = document.createElement('style');
|
|
289
|
+
sheet.innerHTML = this.clientStyling;
|
|
290
|
+
this.stylingContainer.prepend(sheet);
|
|
291
|
+
};
|
|
292
|
+
this.setClientStylingURL = () => {
|
|
293
|
+
let url = new URL(this.clientStylingUrl);
|
|
294
|
+
let cssFile = document.createElement('style');
|
|
295
|
+
fetch(url.href)
|
|
296
|
+
.then((res) => res.text())
|
|
297
|
+
.then((data) => {
|
|
298
|
+
this.clientStyling = data;
|
|
299
|
+
cssFile.innerHTML = data;
|
|
300
|
+
setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
|
|
301
|
+
})
|
|
302
|
+
.catch((err) => {
|
|
303
|
+
console.log('error ', err);
|
|
304
|
+
});
|
|
305
|
+
};
|
|
306
|
+
this.endpoint = undefined;
|
|
307
|
+
this.userSession = undefined;
|
|
308
|
+
this.userId = undefined;
|
|
309
|
+
this.lang = 'en';
|
|
310
|
+
this.includeSubmitButton = undefined;
|
|
311
|
+
this.gmVersion = '';
|
|
312
|
+
this.translationUrl = '';
|
|
313
|
+
this.clientStyling = '';
|
|
314
|
+
this.clientStylingUrl = '';
|
|
315
|
+
this.queryFired = false;
|
|
316
|
+
this.readyActionsCount = 0;
|
|
317
|
+
this.activeUserActions = [];
|
|
318
|
+
this.userActionsValidated = true;
|
|
319
|
+
this.receivedQueryResponses = 0;
|
|
320
|
+
this.limitStylingAppends = false;
|
|
321
|
+
this.isLoading = true;
|
|
322
|
+
this.mandatoryActionsChecked = 0;
|
|
323
|
+
this.mandatoryItems = undefined;
|
|
324
|
+
}
|
|
325
|
+
handleNewTranslations() {
|
|
326
|
+
getTranslations(this.translationUrl);
|
|
327
|
+
}
|
|
328
|
+
handleQueryResponse() {
|
|
329
|
+
if (this.receivedQueryResponses === this.activeUserActions.length) {
|
|
330
|
+
this.updateUserConsents();
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
userLegislationConsentHandler(event) {
|
|
334
|
+
const actionType = event.detail.type;
|
|
335
|
+
const actionTypeChecked = event.detail.value;
|
|
336
|
+
if (this.mandatoryActions.includes(actionType) && this.queryFired === false) {
|
|
337
|
+
actionTypeChecked === true ? this.mandatoryActionsChecked++ : this.mandatoryActionsChecked--;
|
|
338
|
+
}
|
|
339
|
+
// Register final user choices only if we're ready to update
|
|
340
|
+
if (this.queryFired) {
|
|
341
|
+
const determineStatus = (checked, version) => {
|
|
342
|
+
if (version === 'gm16') {
|
|
343
|
+
return checked ? 1 : 0;
|
|
344
|
+
}
|
|
345
|
+
return checked ? 'Accepted' : 'Denied';
|
|
346
|
+
};
|
|
347
|
+
this.userActions.push(Object.assign({ tagCode: actionType, status: determineStatus(actionTypeChecked, this.gmVersion) }, (this.gmVersion === 'gm16' && { note: '' })));
|
|
348
|
+
this.receivedQueryResponses++;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
determineUserActionsCore() {
|
|
352
|
+
const url = new URL(`${this.endpoint}/v1/player/${this.userId}/consent`);
|
|
353
|
+
const headers = new Headers();
|
|
354
|
+
headers.append('X-SessionId', this.userSession);
|
|
355
|
+
let requestOptions = {
|
|
356
|
+
method: 'GET',
|
|
357
|
+
headers
|
|
358
|
+
};
|
|
359
|
+
return fetch(url.href, requestOptions)
|
|
360
|
+
.then(res => res.json())
|
|
361
|
+
.then(data => {
|
|
362
|
+
const actionItems = data.items;
|
|
363
|
+
actionItems.forEach(element => {
|
|
364
|
+
if (element.status === 'Expired') {
|
|
365
|
+
this.activeUserActions.push(element.tagCode);
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
this.isLoading = false;
|
|
369
|
+
})
|
|
370
|
+
.catch(error => {
|
|
371
|
+
console.error('Error fetching data:', error);
|
|
372
|
+
this.isLoading = false;
|
|
373
|
+
}).finally(() => {
|
|
374
|
+
this.calcMandatoryActions();
|
|
375
|
+
window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 ? true : false }, window.location.href);
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
determineUserActions16() {
|
|
379
|
+
const url = new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
|
|
380
|
+
const headers = new Headers();
|
|
381
|
+
headers.append('X-SessionId', this.userSession);
|
|
382
|
+
let requestOptions = {
|
|
383
|
+
method: 'GET',
|
|
384
|
+
headers
|
|
385
|
+
};
|
|
386
|
+
return fetch(url.href, requestOptions)
|
|
387
|
+
.then(res => res.json())
|
|
388
|
+
.then(data => {
|
|
389
|
+
const actionItems = data.consents;
|
|
390
|
+
actionItems.forEach(element => {
|
|
391
|
+
if (element.status === 2 && element.tagCode !== 'pepconsent') {
|
|
392
|
+
this.activeUserActions.push(element.tagCode);
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
this.isLoading = false;
|
|
396
|
+
})
|
|
397
|
+
.catch(error => {
|
|
398
|
+
console.error('Error fetching data:', error);
|
|
399
|
+
this.isLoading = false;
|
|
400
|
+
}).finally(() => {
|
|
401
|
+
this.calcMandatoryActions();
|
|
402
|
+
window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 ? true : false }, window.location.href);
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
updateUserConsents() {
|
|
406
|
+
const url = (this.gmVersion === 'gmcore')
|
|
407
|
+
? new URL(`${this.endpoint}/v1/player/${this.userId}/consent`)
|
|
408
|
+
: new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
|
|
409
|
+
const body = {
|
|
410
|
+
consents: this.userActions
|
|
411
|
+
};
|
|
412
|
+
let requestOptions = {
|
|
413
|
+
method: 'POST',
|
|
414
|
+
headers: {
|
|
415
|
+
'Content-Type': 'application/json',
|
|
416
|
+
'Accept': 'application/json',
|
|
417
|
+
'X-SessionId': `${this.userSession}`,
|
|
418
|
+
},
|
|
419
|
+
body: JSON.stringify(body)
|
|
420
|
+
};
|
|
421
|
+
fetch(url.href, requestOptions)
|
|
422
|
+
.then(res => res.json())
|
|
423
|
+
.then(() => {
|
|
424
|
+
window.postMessage({
|
|
425
|
+
type: 'WidgetNotification',
|
|
426
|
+
data: {
|
|
427
|
+
type: 'success',
|
|
428
|
+
message: 'Consent update successful!'
|
|
429
|
+
}
|
|
430
|
+
}, window.location.href);
|
|
431
|
+
})
|
|
432
|
+
.catch((err) => {
|
|
433
|
+
window.postMessage({
|
|
434
|
+
type: 'WidgetNotification',
|
|
435
|
+
data: {
|
|
436
|
+
type: 'error',
|
|
437
|
+
message: 'Server might not be responding',
|
|
438
|
+
err
|
|
439
|
+
}
|
|
440
|
+
}, window.location.href);
|
|
441
|
+
})
|
|
442
|
+
.finally(() => {
|
|
443
|
+
window.postMessage({ type: 'UserActionsCompleted' }, window.location.href);
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
handleApplyClick() {
|
|
447
|
+
this.queryFired = true;
|
|
448
|
+
}
|
|
449
|
+
async componentWillLoad() {
|
|
450
|
+
if (this.gmVersion === 'gmcore') {
|
|
451
|
+
this.determineUserActionsCore();
|
|
452
|
+
}
|
|
453
|
+
if (this.gmVersion === 'gm16') {
|
|
454
|
+
this.determineUserActions16();
|
|
455
|
+
}
|
|
456
|
+
if (this.translationUrl.length > 2) {
|
|
457
|
+
await getTranslations(this.translationUrl);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
componentDidRender() {
|
|
461
|
+
// start custom styling area
|
|
462
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
463
|
+
if (this.clientStyling)
|
|
464
|
+
this.setClientStyling();
|
|
465
|
+
if (this.clientStylingUrl)
|
|
466
|
+
this.setClientStylingURL();
|
|
467
|
+
this.limitStylingAppends = true;
|
|
468
|
+
}
|
|
469
|
+
// end custom styling area
|
|
470
|
+
}
|
|
471
|
+
calcMandatoryActions() {
|
|
472
|
+
this.mandatoryItems = 0;
|
|
473
|
+
this.mandatoryActions.map(action => {
|
|
474
|
+
const isPresent = this.activeUserActions.includes(action);
|
|
475
|
+
if (isPresent) {
|
|
476
|
+
this.mandatoryItems++;
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
render() {
|
|
481
|
+
if (this.mandatoryItems > 0) {
|
|
482
|
+
this.userActionsValidated = this.mandatoryActionsChecked === this.mandatoryItems;
|
|
483
|
+
return (h("div", { class: "QueryReferenceContainer", ref: el => this.stylingContainer = el }, this.isLoading ? (h("slot", { name: 'spinner' })
|
|
484
|
+
&&
|
|
485
|
+
h("svg", { class: "spinner", viewBox: "0 0 50 50" }, h("circle", { class: "path", cx: "25", cy: "25", r: "20", fill: "none", "stroke-width": "5" }))) : (h("div", { class: "UserActionController" }, h("h2", { class: "UserConsentNotice" }, translate('userNoticeText', this.lang)), h("div", { class: "PlayerLegislationWrapper" }, this.activeUserActions.map(action => (h("slot", { name: action }, h("player-user-consents", { lang: this.lang, "gm-version": this.gmVersion, "translation-url": this.translationUrl, consentType: action, consentTitle: this.consentTitles[action], queried: this.queryFired, mandatory: this.mandatoryActions.includes(action), "client-styling": this.clientStyling }))))), this.includeSubmitButton &&
|
|
486
|
+
h("button", { class: "ConsentSubmitButton", disabled: !this.userActionsValidated, onClick: () => this.handleApplyClick() }, translate('submitButtonText', this.lang))))));
|
|
487
|
+
}
|
|
488
|
+
else {
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
static get watchers() { return {
|
|
493
|
+
"translationUrl": ["handleNewTranslations"],
|
|
494
|
+
"receivedQueryResponses": ["handleQueryResponse"]
|
|
495
|
+
}; }
|
|
496
|
+
};
|
|
497
|
+
UserActionController.style = UserActionControllerStyle0;
|
|
498
|
+
|
|
499
|
+
export { PlayerUserConsents as player_user_consents, UserActionController as user_action_controller };
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-02b86e76.js';
|
|
2
|
+
export { s as setNonce } from './index-02b86e76.js';
|
|
3
|
+
import { g as globalScripts } from './app-globals-0f993ce5.js';
|
|
2
4
|
|
|
3
5
|
/*
|
|
4
|
-
Stencil Client Patch Browser
|
|
6
|
+
Stencil Client Patch Browser v4.20.0 | MIT Licensed | https://stenciljs.com
|
|
5
7
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
var patchBrowser = () => {
|
|
9
|
+
const importMeta = import.meta.url;
|
|
10
|
+
const opts = {};
|
|
11
|
+
if (importMeta !== "") {
|
|
12
|
+
opts.resourcesUrl = new URL(".", importMeta).href;
|
|
13
|
+
}
|
|
14
|
+
return promiseResolve(opts);
|
|
13
15
|
};
|
|
14
16
|
|
|
15
|
-
patchBrowser().then(options => {
|
|
16
|
-
|
|
17
|
+
patchBrowser().then(async (options) => {
|
|
18
|
+
await globalScripts();
|
|
19
|
+
return bootstrapLazy([["player-user-consents_2",[[1,"user-action-controller",{"endpoint":[513],"userSession":[513,"user-session"],"userId":[513,"user-id"],"lang":[1537],"includeSubmitButton":[516,"include-submit-button"],"gmVersion":[1,"gm-version"],"translationUrl":[513,"translation-url"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"queryFired":[32],"readyActionsCount":[32],"activeUserActions":[32],"userActionsValidated":[32],"receivedQueryResponses":[32],"limitStylingAppends":[32],"isLoading":[32],"mandatoryActionsChecked":[32],"mandatoryItems":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]],{"translationUrl":["handleNewTranslations"],"receivedQueryResponses":["handleQueryResponse"]}],[1,"player-user-consents",{"lang":[1537],"queried":[516],"consentType":[513,"consent-type"],"mandatory":[516],"gmVersion":[1,"gm-version"],"consentTitle":[513,"consent-title"],"clientStyling":[1,"client-styling"],"translationUrl":[513,"translation-url"],"textContent":[32],"limitStylingAppends":[32]},null,{"translationUrl":["handleNewTranslations"]}]]]], options);
|
|
17
20
|
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { sass } from "@stencil/sass";
|
|
2
|
+
export const config = {
|
|
3
|
+
namespace: 'user-action-controller',
|
|
4
|
+
taskQueue: 'async',
|
|
5
|
+
sourceMap: true,
|
|
6
|
+
minifyJs: false,
|
|
7
|
+
extras: {
|
|
8
|
+
experimentalImportInjection: true
|
|
9
|
+
},
|
|
10
|
+
plugins: [sass()],
|
|
11
|
+
outputTargets: [
|
|
12
|
+
{
|
|
13
|
+
type: 'www',
|
|
14
|
+
serviceWorker: null // disable service workers
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
};
|
package/dist/stencil.config.js
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
import { sass } from
|
|
1
|
+
import { sass } from "@stencil/sass";
|
|
2
2
|
export const config = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
{
|
|
8
|
-
|
|
9
|
-
esmLoaderPath: '../loader',
|
|
3
|
+
namespace: 'user-action-controller',
|
|
4
|
+
taskQueue: 'async',
|
|
5
|
+
sourceMap: false,
|
|
6
|
+
minifyJs: true,
|
|
7
|
+
extras: {
|
|
8
|
+
experimentalImportInjection: true
|
|
10
9
|
},
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
type: 'www',
|
|
19
|
-
serviceWorker: null, // disable service workers
|
|
20
|
-
},
|
|
21
|
-
],
|
|
10
|
+
plugins: [sass()],
|
|
11
|
+
outputTargets: [
|
|
12
|
+
{
|
|
13
|
+
type: 'dist',
|
|
14
|
+
esmLoaderPath: '../loader'
|
|
15
|
+
}
|
|
16
|
+
]
|
|
22
17
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UserActionController } from './user-action-controller';
|