@everymatrix/user-action-controller 1.44.0 → 1.45.0
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 +457 -495
- package/dist/cjs/user-action-controller.cjs.js +17 -11
- package/dist/collection/collection-manifest.json +3 -3
- package/dist/collection/components/user-action-controller/index.js +1 -0
- package/dist/collection/components/user-action-controller/user-action-controller.js +408 -414
- package/dist/collection/utils/locale.utils.js +70 -70
- 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 +457 -495
- 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/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/user-action-controller/.stencil/packages/stencil/user-action-controller/stencil.config.d.ts +2 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/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 -68
- package/dist/types/stencil-public-runtime.d.ts +142 -33
- package/dist/user-action-controller/p-b996e8b8.js +2 -0
- package/dist/user-action-controller/p-d7fbd383.entry.js +1 -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 +9 -2
- package/dist/cjs/index-87049e21.js +0 -1300
- package/dist/components/index.d.ts +0 -26
- package/dist/components/index.js +0 -1
- package/dist/components/player-user-consents.js +0 -6
- package/dist/components/player-user-consents2.js +0 -257
- package/dist/components/user-action-controller.d.ts +0 -11
- package/dist/components/user-action-controller.js +0 -365
- package/dist/esm/index-71f14530.js +0 -1274
- 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/adrian.pripon/Documents/Work/widgets-stencil/packages/user-action-controller/.stencil/packages/user-action-controller/stencil.config.d.ts +0 -2
- package/dist/user-action-controller/p-2dc9103a.entry.js +0 -1
- package/dist/user-action-controller/p-ba444709.js +0 -1
|
@@ -1,550 +1,512 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h } from './index-02b86e76.js';
|
|
2
2
|
|
|
3
3
|
const DEFAULT_LANGUAGE$1 = 'en';
|
|
4
4
|
const TRANSLATIONS$1 = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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."
|
|
11
19
|
},
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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."
|
|
16
34
|
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
35
|
+
hr: {
|
|
36
|
+
termsAndConditions: {
|
|
37
|
+
acceptPart1: "Prihvaćam Opće uvjete i odredbe ",
|
|
38
|
+
acceptPart2: "",
|
|
39
|
+
acceptPart3: "",
|
|
40
|
+
tcLink: "Opći uvjeti i odredbe"
|
|
41
|
+
},
|
|
42
|
+
privacyPolicy: {
|
|
43
|
+
readUnderstandPart1: "Pročitao sam i razumijem Politiku Privatnosti ",
|
|
44
|
+
readUnderstandPart2: ", i potvrđujem da imam više od 18 godina",
|
|
45
|
+
privacyLink: "Politika Privatnosti"
|
|
46
|
+
},
|
|
47
|
+
sms: "Želim dobivati marketinški sadržaj putem sms",
|
|
48
|
+
emailmarketing: "Želim dobivati marketinški sadržaj putem e-maila"
|
|
26
49
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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."
|
|
31
64
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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."
|
|
41
79
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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."
|
|
46
94
|
},
|
|
47
|
-
sms: "Želim dobivati marketinški sadržaj putem sms",
|
|
48
|
-
emailmarketing: "Želim dobivati marketinški sadržaj putem e-maila"
|
|
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
95
|
};
|
|
96
96
|
const getTranslations$1 = (url) => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
+
});
|
|
108
109
|
});
|
|
109
|
-
});
|
|
110
110
|
};
|
|
111
111
|
const translate$1 = (key, customLang, values) => {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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
|
+
}
|
|
124
125
|
}
|
|
125
|
-
|
|
126
|
-
return translation;
|
|
126
|
+
return translation;
|
|
127
127
|
};
|
|
128
128
|
|
|
129
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;
|
|
130
131
|
|
|
131
132
|
const PlayerUserConsents = class {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
* Select GM version
|
|
153
|
-
*/
|
|
154
|
-
this.gmVersion = '';
|
|
155
|
-
/**
|
|
156
|
-
* the title of the consent to be displayed
|
|
157
|
-
*/
|
|
158
|
-
this.consentTitle = '';
|
|
159
|
-
/**
|
|
160
|
-
* Client custom styling via inline style
|
|
161
|
-
*/
|
|
162
|
-
this.clientStyling = '';
|
|
163
|
-
/**
|
|
164
|
-
* Translation url
|
|
165
|
-
*/
|
|
166
|
-
this.translationUrl = '';
|
|
167
|
-
/**
|
|
168
|
-
* the text content to be rendered by the component. Determined at runtime
|
|
169
|
-
*/
|
|
170
|
-
this.textContent = '';
|
|
171
|
-
this.limitStylingAppends = false;
|
|
172
|
-
this.goToTermsAndConditions = () => window.postMessage({ type: 'GoToTermsAndConditions' });
|
|
173
|
-
this.goToPrivacyPolicy = () => window.postMessage({ type: 'GoToPrivacyPolicy' });
|
|
174
|
-
this.setClientStyling = () => {
|
|
175
|
-
let sheet = document.createElement('style');
|
|
176
|
-
sheet.innerHTML = this.clientStyling;
|
|
177
|
-
this.stylingContainer.prepend(sheet);
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
handleNewTranslations() {
|
|
181
|
-
getTranslations$1(this.translationUrl);
|
|
182
|
-
}
|
|
183
|
-
async componentWillLoad() {
|
|
184
|
-
if (this.translationUrl.length > 2) {
|
|
185
|
-
await getTranslations$1(this.translationUrl);
|
|
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;
|
|
186
153
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
this.userLegislationConsent.emit({
|
|
190
|
-
type: this.consentType,
|
|
191
|
-
value: this.checkboxInput.checked
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
componentDidRender() {
|
|
195
|
-
// start custom styling area
|
|
196
|
-
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
197
|
-
if (this.clientStyling)
|
|
198
|
-
this.setClientStyling();
|
|
199
|
-
this.limitStylingAppends = true;
|
|
154
|
+
handleNewTranslations() {
|
|
155
|
+
getTranslations$1(this.translationUrl);
|
|
200
156
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
if (this.consentType === 'termsandconditions') {
|
|
206
|
-
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));
|
|
207
|
-
}
|
|
157
|
+
async componentWillLoad() {
|
|
158
|
+
if (this.translationUrl.length > 2) {
|
|
159
|
+
await getTranslations$1(this.translationUrl);
|
|
160
|
+
}
|
|
208
161
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
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));
|
|
215
|
-
}
|
|
162
|
+
userLegislationConsentHandler() {
|
|
163
|
+
this.userLegislationConsent.emit({
|
|
164
|
+
type: this.consentType,
|
|
165
|
+
value: this.checkboxInput.checked
|
|
166
|
+
});
|
|
216
167
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
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" }, "*"))));
|
|
222
198
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
"translationUrl": ["handleNewTranslations"]
|
|
227
|
-
}; }
|
|
199
|
+
static get watchers() { return {
|
|
200
|
+
"translationUrl": ["handleNewTranslations"]
|
|
201
|
+
}; }
|
|
228
202
|
};
|
|
229
|
-
PlayerUserConsents.style =
|
|
203
|
+
PlayerUserConsents.style = PlayerUserConsentsStyle0;
|
|
230
204
|
|
|
231
205
|
const DEFAULT_LANGUAGE = 'en';
|
|
232
206
|
const TRANSLATIONS = {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
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
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
207
|
+
en: {
|
|
208
|
+
termsAndConditionsTitle: 'Terms and Conditions',
|
|
209
|
+
smsTitle: 'SMS marketing',
|
|
210
|
+
emailMarketingTitle: 'Email marketing',
|
|
211
|
+
privacyPolicyTitle: 'Privacy Policy',
|
|
212
|
+
userNoticeText: 'Before you can proceed you must consent to the following',
|
|
213
|
+
submitButtonText: 'Submit'
|
|
214
|
+
},
|
|
215
|
+
ro: {
|
|
216
|
+
termsAndConditionsTitle: 'Termeni şi condiţii',
|
|
217
|
+
smsTitle: 'SMS marketing',
|
|
218
|
+
emailMarketingTitle: 'Email marketing',
|
|
219
|
+
privacyPolicyTitle: 'Privacy Policy',
|
|
220
|
+
userNoticeText: 'Before you can proceed you must consent to the following',
|
|
221
|
+
submitButtonText: 'Submit'
|
|
222
|
+
},
|
|
223
|
+
hr: {
|
|
224
|
+
termsAndConditionsTitle: 'Opći uvjeti i odredbe',
|
|
225
|
+
smsTitle: 'SMS makretinški sadržaj',
|
|
226
|
+
emailMarketingTitle: 'E-mail makretinški sadržaj',
|
|
227
|
+
privacyPolicyTitle: 'Politika Privatnosti',
|
|
228
|
+
userNoticeText: 'Prije nego što možete nastaviti, morate pristati na sljedeće',
|
|
229
|
+
submitButtonText: 'Pošalji'
|
|
230
|
+
},
|
|
231
|
+
fr: {
|
|
232
|
+
termsAndConditionsTitle: 'Terms and Conditions',
|
|
233
|
+
smsTitle: 'SMS marketing',
|
|
234
|
+
emailMarketingTitle: 'Email marketing',
|
|
235
|
+
privacyPolicyTitle: 'Privacy Policy',
|
|
236
|
+
userNoticeText: 'Before you can proceed you must consent to the following',
|
|
237
|
+
submitButtonText: 'Submit'
|
|
238
|
+
},
|
|
239
|
+
cs: {
|
|
240
|
+
termsAndConditionsTitle: 'Terms and Conditions',
|
|
241
|
+
smsTitle: 'SMS marketing',
|
|
242
|
+
emailMarketingTitle: 'Email marketing',
|
|
243
|
+
privacyPolicyTitle: 'Privacy Policy',
|
|
244
|
+
userNoticeText: 'Before you can proceed you must consent to the following',
|
|
245
|
+
submitButtonText: 'Submit'
|
|
246
|
+
},
|
|
247
|
+
de: {
|
|
248
|
+
termsAndConditionsTitle: 'Terms and Conditions',
|
|
249
|
+
smsTitle: 'SMS marketing',
|
|
250
|
+
emailMarketingTitle: 'Email marketing',
|
|
251
|
+
privacyPolicyTitle: 'Privacy Policy',
|
|
252
|
+
userNoticeText: 'Before you can proceed you must consent to the following',
|
|
253
|
+
submitButtonText: 'Submit'
|
|
254
|
+
},
|
|
281
255
|
};
|
|
282
256
|
const getTranslations = (url) => {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
257
|
+
return new Promise((resolve) => {
|
|
258
|
+
fetch(url)
|
|
259
|
+
.then((res) => res.json())
|
|
260
|
+
.then((data) => {
|
|
261
|
+
Object.keys(data).forEach((lang) => {
|
|
262
|
+
if (!TRANSLATIONS[lang]) {
|
|
263
|
+
TRANSLATIONS[lang] = {};
|
|
264
|
+
}
|
|
265
|
+
for (let key in data[lang]) {
|
|
266
|
+
TRANSLATIONS[lang][key] = data[lang][key];
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
resolve(true);
|
|
270
|
+
});
|
|
296
271
|
});
|
|
297
|
-
});
|
|
298
272
|
};
|
|
299
273
|
const translate = (key, customLang, values) => {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
274
|
+
const lang = customLang;
|
|
275
|
+
let translation = TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
|
|
276
|
+
if (values !== undefined) {
|
|
277
|
+
for (const [key, value] of Object.entries(values.values)) {
|
|
278
|
+
const regex = new RegExp(`{${key}}`, 'g');
|
|
279
|
+
translation = translation.replace(regex, value);
|
|
280
|
+
}
|
|
306
281
|
}
|
|
307
|
-
|
|
308
|
-
return translation;
|
|
282
|
+
return translation;
|
|
309
283
|
};
|
|
310
284
|
|
|
311
285
|
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}}";
|
|
286
|
+
const UserActionControllerStyle0 = userActionControllerCss;
|
|
312
287
|
|
|
313
288
|
const UserActionController = class {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
let url = new URL(this.clientStylingUrl);
|
|
363
|
-
let cssFile = document.createElement('style');
|
|
364
|
-
fetch(url.href)
|
|
365
|
-
.then((res) => res.text())
|
|
366
|
-
.then((data) => {
|
|
367
|
-
this.clientStyling = data;
|
|
368
|
-
cssFile.innerHTML = data;
|
|
369
|
-
setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
|
|
370
|
-
})
|
|
371
|
-
.catch((err) => {
|
|
372
|
-
console.log('error ', err);
|
|
373
|
-
});
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
handleNewTranslations() {
|
|
377
|
-
getTranslations(this.translationUrl);
|
|
378
|
-
}
|
|
379
|
-
handleQueryResponse() {
|
|
380
|
-
if (this.receivedQueryResponses === this.activeUserActions.length) {
|
|
381
|
-
this.updateUserConsents();
|
|
289
|
+
constructor(hostRef) {
|
|
290
|
+
registerInstance(this, hostRef);
|
|
291
|
+
//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
|
|
292
|
+
this.mandatoryActions = ['termsandconditions', 'privacypolicy'];
|
|
293
|
+
this.userActions = [];
|
|
294
|
+
this.consentTitles = {
|
|
295
|
+
termsandconditions: translate('termsAndConditionsTitle', this.lang),
|
|
296
|
+
sms: translate('smsTitle', this.lang),
|
|
297
|
+
emailmarketing: translate('emailMarketingTitle', this.lang),
|
|
298
|
+
privacypolicy: translate('privacyPolicyTitle', this.lang)
|
|
299
|
+
};
|
|
300
|
+
this.setClientStyling = () => {
|
|
301
|
+
let sheet = document.createElement('style');
|
|
302
|
+
sheet.innerHTML = this.clientStyling;
|
|
303
|
+
this.stylingContainer.prepend(sheet);
|
|
304
|
+
};
|
|
305
|
+
this.setClientStylingURL = () => {
|
|
306
|
+
let url = new URL(this.clientStylingUrl);
|
|
307
|
+
let cssFile = document.createElement('style');
|
|
308
|
+
fetch(url.href)
|
|
309
|
+
.then((res) => res.text())
|
|
310
|
+
.then((data) => {
|
|
311
|
+
this.clientStyling = data;
|
|
312
|
+
cssFile.innerHTML = data;
|
|
313
|
+
setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
|
|
314
|
+
})
|
|
315
|
+
.catch((err) => {
|
|
316
|
+
console.log('error ', err);
|
|
317
|
+
});
|
|
318
|
+
};
|
|
319
|
+
this.endpoint = undefined;
|
|
320
|
+
this.userSession = undefined;
|
|
321
|
+
this.userId = undefined;
|
|
322
|
+
this.lang = 'en';
|
|
323
|
+
this.includeSubmitButton = undefined;
|
|
324
|
+
this.gmVersion = '';
|
|
325
|
+
this.translationUrl = '';
|
|
326
|
+
this.clientStyling = '';
|
|
327
|
+
this.clientStylingUrl = '';
|
|
328
|
+
this.queryFired = false;
|
|
329
|
+
this.readyActionsCount = 0;
|
|
330
|
+
this.activeUserActions = [];
|
|
331
|
+
this.userActionsValidated = true;
|
|
332
|
+
this.receivedQueryResponses = 0;
|
|
333
|
+
this.limitStylingAppends = false;
|
|
334
|
+
this.isLoading = true;
|
|
335
|
+
this.mandatoryActionsChecked = 0;
|
|
336
|
+
this.mandatoryItems = undefined;
|
|
382
337
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
const actionType = event.detail.type;
|
|
386
|
-
const actionTypeChecked = event.detail.value;
|
|
387
|
-
if (this.mandatoryActions.includes(actionType) && this.queryFired === false) {
|
|
388
|
-
actionTypeChecked === true ? this.mandatoryActionsChecked++ : this.mandatoryActionsChecked--;
|
|
338
|
+
handleNewTranslations() {
|
|
339
|
+
getTranslations(this.translationUrl);
|
|
389
340
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
if (version === 'gm16') {
|
|
394
|
-
return checked ? 1 : 0;
|
|
341
|
+
handleQueryResponse() {
|
|
342
|
+
if (this.receivedQueryResponses === this.activeUserActions.length) {
|
|
343
|
+
this.updateUserConsents();
|
|
395
344
|
}
|
|
396
|
-
return checked ? 'Accepted' : 'Denied';
|
|
397
|
-
};
|
|
398
|
-
this.userActions.push(Object.assign({ tagCode: actionType, status: determineStatus(actionTypeChecked, this.gmVersion) }, (this.gmVersion === 'gm16' && { note: '' })));
|
|
399
|
-
this.receivedQueryResponses++;
|
|
400
345
|
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
let requestOptions = {
|
|
407
|
-
method: 'GET',
|
|
408
|
-
headers
|
|
409
|
-
};
|
|
410
|
-
return fetch(url.href, requestOptions)
|
|
411
|
-
.then(res => res.json())
|
|
412
|
-
.then(data => {
|
|
413
|
-
const actionItems = data.items;
|
|
414
|
-
actionItems.forEach(element => {
|
|
415
|
-
if (element.status === 'Expired') {
|
|
416
|
-
this.activeUserActions.push(element.tagCode);
|
|
346
|
+
userLegislationConsentHandler(event) {
|
|
347
|
+
const actionType = event.detail.type;
|
|
348
|
+
const actionTypeChecked = event.detail.value;
|
|
349
|
+
if (this.mandatoryActions.includes(actionType) && this.queryFired === false) {
|
|
350
|
+
actionTypeChecked === true ? this.mandatoryActionsChecked++ : this.mandatoryActionsChecked--;
|
|
417
351
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
}
|
|
429
|
-
determineUserActions16() {
|
|
430
|
-
const url = new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
|
|
431
|
-
const headers = new Headers();
|
|
432
|
-
headers.append('X-SessionId', this.userSession);
|
|
433
|
-
let requestOptions = {
|
|
434
|
-
method: 'GET',
|
|
435
|
-
headers
|
|
436
|
-
};
|
|
437
|
-
return fetch(url.href, requestOptions)
|
|
438
|
-
.then(res => res.json())
|
|
439
|
-
.then(data => {
|
|
440
|
-
const actionItems = data.consents;
|
|
441
|
-
actionItems.forEach(element => {
|
|
442
|
-
if (element.status === 2 && element.tagCode !== 'pepconsent') {
|
|
443
|
-
this.activeUserActions.push(element.tagCode);
|
|
444
|
-
}
|
|
445
|
-
});
|
|
446
|
-
this.isLoading = false;
|
|
447
|
-
})
|
|
448
|
-
.catch(error => {
|
|
449
|
-
console.error('Error fetching data:', error);
|
|
450
|
-
this.isLoading = false;
|
|
451
|
-
}).finally(() => {
|
|
452
|
-
this.calcMandatoryActions();
|
|
453
|
-
window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 ? true : false }, window.location.href);
|
|
454
|
-
});
|
|
455
|
-
}
|
|
456
|
-
updateUserConsents() {
|
|
457
|
-
const url = (this.gmVersion === 'gmcore')
|
|
458
|
-
? new URL(`${this.endpoint}/v1/player/${this.userId}/consent`)
|
|
459
|
-
: new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
|
|
460
|
-
const body = {
|
|
461
|
-
consents: this.userActions
|
|
462
|
-
};
|
|
463
|
-
let requestOptions = {
|
|
464
|
-
method: 'POST',
|
|
465
|
-
headers: {
|
|
466
|
-
'Content-Type': 'application/json',
|
|
467
|
-
'Accept': 'application/json',
|
|
468
|
-
'X-SessionId': `${this.userSession}`,
|
|
469
|
-
},
|
|
470
|
-
body: JSON.stringify(body)
|
|
471
|
-
};
|
|
472
|
-
fetch(url.href, requestOptions)
|
|
473
|
-
.then(res => res.json())
|
|
474
|
-
.then(() => {
|
|
475
|
-
window.postMessage({
|
|
476
|
-
type: 'WidgetNotification',
|
|
477
|
-
data: {
|
|
478
|
-
type: 'success',
|
|
479
|
-
message: 'Consent update successful!'
|
|
352
|
+
// Register final user choices only if we're ready to update
|
|
353
|
+
if (this.queryFired) {
|
|
354
|
+
const determineStatus = (checked, version) => {
|
|
355
|
+
if (version === 'gm16') {
|
|
356
|
+
return checked ? 1 : 0;
|
|
357
|
+
}
|
|
358
|
+
return checked ? 'Accepted' : 'Denied';
|
|
359
|
+
};
|
|
360
|
+
this.userActions.push(Object.assign({ tagCode: actionType, status: determineStatus(actionTypeChecked, this.gmVersion) }, (this.gmVersion === 'gm16' && { note: '' })));
|
|
361
|
+
this.receivedQueryResponses++;
|
|
480
362
|
}
|
|
481
|
-
}, window.location.href);
|
|
482
|
-
})
|
|
483
|
-
.catch((err) => {
|
|
484
|
-
window.postMessage({
|
|
485
|
-
type: 'WidgetNotification',
|
|
486
|
-
data: {
|
|
487
|
-
type: 'error',
|
|
488
|
-
message: 'Server might not be responding',
|
|
489
|
-
err
|
|
490
|
-
}
|
|
491
|
-
}, window.location.href);
|
|
492
|
-
})
|
|
493
|
-
.finally(() => {
|
|
494
|
-
window.postMessage({ type: 'UserActionsCompleted' }, window.location.href);
|
|
495
|
-
});
|
|
496
|
-
}
|
|
497
|
-
handleApplyClick() {
|
|
498
|
-
this.queryFired = true;
|
|
499
|
-
}
|
|
500
|
-
async componentWillLoad() {
|
|
501
|
-
if (this.gmVersion === 'gmcore') {
|
|
502
|
-
this.determineUserActionsCore();
|
|
503
363
|
}
|
|
504
|
-
|
|
505
|
-
|
|
364
|
+
determineUserActionsCore() {
|
|
365
|
+
const url = new URL(`${this.endpoint}/v1/player/${this.userId}/consent`);
|
|
366
|
+
const headers = new Headers();
|
|
367
|
+
headers.append('X-SessionId', this.userSession);
|
|
368
|
+
let requestOptions = {
|
|
369
|
+
method: 'GET',
|
|
370
|
+
headers
|
|
371
|
+
};
|
|
372
|
+
return fetch(url.href, requestOptions)
|
|
373
|
+
.then(res => res.json())
|
|
374
|
+
.then(data => {
|
|
375
|
+
const actionItems = data.items;
|
|
376
|
+
actionItems.forEach(element => {
|
|
377
|
+
if (element.status === 'Expired') {
|
|
378
|
+
this.activeUserActions.push(element.tagCode);
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
this.isLoading = false;
|
|
382
|
+
})
|
|
383
|
+
.catch(error => {
|
|
384
|
+
console.error('Error fetching data:', error);
|
|
385
|
+
this.isLoading = false;
|
|
386
|
+
}).finally(() => {
|
|
387
|
+
this.calcMandatoryActions();
|
|
388
|
+
window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 ? true : false }, window.location.href);
|
|
389
|
+
});
|
|
506
390
|
}
|
|
507
|
-
|
|
508
|
-
|
|
391
|
+
determineUserActions16() {
|
|
392
|
+
const url = new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
|
|
393
|
+
const headers = new Headers();
|
|
394
|
+
headers.append('X-SessionId', this.userSession);
|
|
395
|
+
let requestOptions = {
|
|
396
|
+
method: 'GET',
|
|
397
|
+
headers
|
|
398
|
+
};
|
|
399
|
+
return fetch(url.href, requestOptions)
|
|
400
|
+
.then(res => res.json())
|
|
401
|
+
.then(data => {
|
|
402
|
+
const actionItems = data.consents;
|
|
403
|
+
actionItems.forEach(element => {
|
|
404
|
+
if (element.status === 2 && element.tagCode !== 'pepconsent') {
|
|
405
|
+
this.activeUserActions.push(element.tagCode);
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
this.isLoading = false;
|
|
409
|
+
})
|
|
410
|
+
.catch(error => {
|
|
411
|
+
console.error('Error fetching data:', error);
|
|
412
|
+
this.isLoading = false;
|
|
413
|
+
}).finally(() => {
|
|
414
|
+
this.calcMandatoryActions();
|
|
415
|
+
window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryItems > 0 ? true : false }, window.location.href);
|
|
416
|
+
});
|
|
509
417
|
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
418
|
+
updateUserConsents() {
|
|
419
|
+
const url = (this.gmVersion === 'gmcore')
|
|
420
|
+
? new URL(`${this.endpoint}/v1/player/${this.userId}/consent`)
|
|
421
|
+
: new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`);
|
|
422
|
+
const body = {
|
|
423
|
+
consents: this.userActions
|
|
424
|
+
};
|
|
425
|
+
let requestOptions = {
|
|
426
|
+
method: 'POST',
|
|
427
|
+
headers: {
|
|
428
|
+
'Content-Type': 'application/json',
|
|
429
|
+
'Accept': 'application/json',
|
|
430
|
+
'X-SessionId': `${this.userSession}`,
|
|
431
|
+
},
|
|
432
|
+
body: JSON.stringify(body)
|
|
433
|
+
};
|
|
434
|
+
fetch(url.href, requestOptions)
|
|
435
|
+
.then(res => res.json())
|
|
436
|
+
.then(() => {
|
|
437
|
+
window.postMessage({
|
|
438
|
+
type: 'WidgetNotification',
|
|
439
|
+
data: {
|
|
440
|
+
type: 'success',
|
|
441
|
+
message: 'Consent update successful!'
|
|
442
|
+
}
|
|
443
|
+
}, window.location.href);
|
|
444
|
+
})
|
|
445
|
+
.catch((err) => {
|
|
446
|
+
window.postMessage({
|
|
447
|
+
type: 'WidgetNotification',
|
|
448
|
+
data: {
|
|
449
|
+
type: 'error',
|
|
450
|
+
message: 'Server might not be responding',
|
|
451
|
+
err
|
|
452
|
+
}
|
|
453
|
+
}, window.location.href);
|
|
454
|
+
})
|
|
455
|
+
.finally(() => {
|
|
456
|
+
window.postMessage({ type: 'UserActionsCompleted' }, window.location.href);
|
|
457
|
+
});
|
|
519
458
|
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
this.
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
459
|
+
handleApplyClick() {
|
|
460
|
+
this.queryFired = true;
|
|
461
|
+
}
|
|
462
|
+
async componentWillLoad() {
|
|
463
|
+
if (this.gmVersion === 'gmcore') {
|
|
464
|
+
this.determineUserActionsCore();
|
|
465
|
+
}
|
|
466
|
+
if (this.gmVersion === 'gm16') {
|
|
467
|
+
this.determineUserActions16();
|
|
468
|
+
}
|
|
469
|
+
if (this.translationUrl.length > 2) {
|
|
470
|
+
await getTranslations(this.translationUrl);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
componentDidRender() {
|
|
474
|
+
// start custom styling area
|
|
475
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
476
|
+
if (this.clientStyling)
|
|
477
|
+
this.setClientStyling();
|
|
478
|
+
if (this.clientStylingUrl)
|
|
479
|
+
this.setClientStylingURL();
|
|
480
|
+
this.limitStylingAppends = true;
|
|
481
|
+
}
|
|
482
|
+
// end custom styling area
|
|
538
483
|
}
|
|
539
|
-
|
|
540
|
-
|
|
484
|
+
calcMandatoryActions() {
|
|
485
|
+
this.mandatoryItems = 0;
|
|
486
|
+
this.mandatoryActions.map(action => {
|
|
487
|
+
const isPresent = this.activeUserActions.includes(action);
|
|
488
|
+
if (isPresent) {
|
|
489
|
+
this.mandatoryItems++;
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
render() {
|
|
494
|
+
if (this.mandatoryItems > 0) {
|
|
495
|
+
this.userActionsValidated = this.mandatoryActionsChecked === this.mandatoryItems;
|
|
496
|
+
return (h("div", { class: "QueryReferenceContainer", ref: el => this.stylingContainer = el }, this.isLoading ? (h("slot", { name: 'spinner' })
|
|
497
|
+
&&
|
|
498
|
+
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 &&
|
|
499
|
+
h("button", { class: "ConsentSubmitButton", disabled: !this.userActionsValidated, onClick: () => this.handleApplyClick() }, translate('submitButtonText', this.lang))))));
|
|
500
|
+
}
|
|
501
|
+
else {
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
541
504
|
}
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
}; }
|
|
505
|
+
static get watchers() { return {
|
|
506
|
+
"translationUrl": ["handleNewTranslations"],
|
|
507
|
+
"receivedQueryResponses": ["handleQueryResponse"]
|
|
508
|
+
}; }
|
|
547
509
|
};
|
|
548
|
-
UserActionController.style =
|
|
510
|
+
UserActionController.style = UserActionControllerStyle0;
|
|
549
511
|
|
|
550
512
|
export { PlayerUserConsents as player_user_consents, UserActionController as user_action_controller };
|