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