@everymatrix/pam-consent-modal 0.1.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-9dbdce4a.js +1303 -0
- package/dist/cjs/index.cjs.js +10 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/cjs/pam-consent-item_2.cjs.entry.js +481 -0
- package/dist/cjs/pam-consent-modal-bc9246fa.js +401 -0
- package/dist/cjs/pam-consent-modal.cjs.js +25 -0
- package/dist/collection/collection-manifest.json +19 -0
- package/dist/collection/components/pam-consent-modal/index.js +1 -0
- package/dist/collection/components/pam-consent-modal/pam-consent-modal.css +102 -0
- package/dist/collection/components/pam-consent-modal/pam-consent-modal.js +454 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +97 -0
- package/dist/collection/utils/types.js +1 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/index-f4cffab8.js +1276 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/pam-consent-item_2.entry.js +477 -0
- package/dist/esm/pam-consent-modal-be38f983.js +396 -0
- package/dist/esm/pam-consent-modal.js +20 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/pam-consent-modal/index.esm.js +1 -0
- package/dist/pam-consent-modal/p-2af7b124.js +1 -0
- package/dist/pam-consent-modal/p-46389116.js +2 -0
- package/dist/pam-consent-modal/p-da3e62e4.entry.js +1 -0
- package/dist/pam-consent-modal/p-e1255160.js +1 -0
- package/dist/pam-consent-modal/pam-consent-modal.esm.js +1 -0
- package/dist/stencil.config.dev.js +19 -0
- package/dist/stencil.config.js +18 -0
- package/dist/storybook/main.js +43 -0
- package/dist/storybook/preview.js +9 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-consent-modal/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-consent-modal/.stencil/packages/stencil/pam-consent-modal/stencil.config.d.ts +2 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-consent-modal/.stencil/packages/stencil/pam-consent-modal/stencil.config.dev.d.ts +2 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-consent-modal/.stencil/packages/stencil/pam-consent-modal/storybook/main.d.ts +3 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-consent-modal/.stencil/packages/stencil/pam-consent-modal/storybook/preview.d.ts +70 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-consent-modal/.stencil/tools/plugins/index.d.ts +3 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-consent-modal/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-consent-modal/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-consent-modal/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
- package/dist/types/components/pam-consent-modal/index.d.ts +1 -0
- package/dist/types/components/pam-consent-modal/pam-consent-modal.d.ts +69 -0
- package/dist/types/components.d.ts +125 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1674 -0
- package/dist/types/utils/locale.utils.d.ts +2 -0
- package/dist/types/utils/types.d.ts +12 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +27 -0
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-9dbdce4a.js');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @name setClientStyling
|
|
7
|
+
* @description Method used to create and append to the passed element of the widget a style element with the content received
|
|
8
|
+
* @param {HTMLElement} stylingContainer The reference element of the widget
|
|
9
|
+
* @param {string} clientStyling The style content
|
|
10
|
+
*/
|
|
11
|
+
function setClientStyling(stylingContainer, clientStyling) {
|
|
12
|
+
if (stylingContainer) {
|
|
13
|
+
const sheet = document.createElement('style');
|
|
14
|
+
sheet.innerHTML = clientStyling;
|
|
15
|
+
stylingContainer.appendChild(sheet);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @name setClientStylingURL
|
|
21
|
+
* @description Method used to create and append to the passed element of the widget a style element with the content fetched from a given URL
|
|
22
|
+
* @param {HTMLElement} stylingContainer The reference element of the widget
|
|
23
|
+
* @param {string} clientStylingUrl The URL of the style content
|
|
24
|
+
*/
|
|
25
|
+
function setClientStylingURL(stylingContainer, clientStylingUrl) {
|
|
26
|
+
const url = new URL(clientStylingUrl);
|
|
27
|
+
|
|
28
|
+
fetch(url.href)
|
|
29
|
+
.then((res) => res.text())
|
|
30
|
+
.then((data) => {
|
|
31
|
+
const cssFile = document.createElement('style');
|
|
32
|
+
cssFile.innerHTML = data;
|
|
33
|
+
if (stylingContainer) {
|
|
34
|
+
stylingContainer.appendChild(cssFile);
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
.catch((err) => {
|
|
38
|
+
console.error('There was an error while trying to load client styling from URL', err);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @name setStreamLibrary
|
|
44
|
+
* @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
|
|
45
|
+
* @param {HTMLElement} stylingContainer The highest element of the widget
|
|
46
|
+
* @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
|
|
47
|
+
* @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
|
|
48
|
+
*/
|
|
49
|
+
function setStreamStyling(stylingContainer, domain, subscription) {
|
|
50
|
+
if (window.emMessageBus) {
|
|
51
|
+
const sheet = document.createElement('style');
|
|
52
|
+
|
|
53
|
+
window.emMessageBus.subscribe(domain, (data) => {
|
|
54
|
+
sheet.innerHTML = data;
|
|
55
|
+
if (stylingContainer) {
|
|
56
|
+
stylingContainer.appendChild(sheet);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @name dispatchCustomEvent
|
|
64
|
+
* @description dispatches the custom event CustomEventProcessor is listening for
|
|
65
|
+
* @param {string} type of the custom event
|
|
66
|
+
* @param {Object} data may contain additional information about the event, e.g. userId
|
|
67
|
+
*/
|
|
68
|
+
const dispatchCustomEvent = (type, data = {}) => {
|
|
69
|
+
const event = new CustomEvent('track-custom-event', {
|
|
70
|
+
detail: {
|
|
71
|
+
type,
|
|
72
|
+
data
|
|
73
|
+
},
|
|
74
|
+
bubbles: true,
|
|
75
|
+
composed: true
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
document.dispatchEvent(event);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
82
|
+
const TRANSLATIONS = {
|
|
83
|
+
en: {
|
|
84
|
+
userNoticeText: 'Before you can proceed you must consent to the following',
|
|
85
|
+
submitButtonText: 'Submit',
|
|
86
|
+
rejectButtonText: 'Reject',
|
|
87
|
+
rejectText: 'Rejecting new consents will result in the inability to continue the login process and you will be logged out.'
|
|
88
|
+
},
|
|
89
|
+
'en-us': {
|
|
90
|
+
userNoticeText: 'Before you can proceed you must consent to the following',
|
|
91
|
+
submitButtonText: 'Submit',
|
|
92
|
+
rejectButtonText: 'Reject',
|
|
93
|
+
rejectText: 'Rejecting new consents will result in the inability to continue the login process and you will be logged out.'
|
|
94
|
+
},
|
|
95
|
+
ro: {
|
|
96
|
+
userNoticeText: 'Înainte de a continua, trebuie să vă dați consimțământul pentru următoarele',
|
|
97
|
+
submitButtonText: 'Trimite',
|
|
98
|
+
rejectButtonText: 'Respinge',
|
|
99
|
+
rejectText: 'Respingerea noilor consimțăminte va duce la imposibilitatea de a continua procesul de autentificare și veți fi deconectat.'
|
|
100
|
+
},
|
|
101
|
+
hr: {
|
|
102
|
+
userNoticeText: 'Prije nego što možete nastaviti, morate pristati na sljedeće',
|
|
103
|
+
submitButtonText: 'Pošalji',
|
|
104
|
+
rejectButtonText: 'Odbij',
|
|
105
|
+
rejectText: 'Odbijanje novih pristanka rezultirat će nemogućnošću nastavka procesa prijave i bit ćete odjavljeni.'
|
|
106
|
+
},
|
|
107
|
+
fr: {
|
|
108
|
+
userNoticeText: 'Avant de continuer, vous devez consentir aux éléments suivants',
|
|
109
|
+
submitButtonText: 'Soumettre',
|
|
110
|
+
rejectButtonText: 'Rejeter',
|
|
111
|
+
rejectText: 'Le rejet des nouveaux consentements entraînera l\'impossibilité de continuer le processus de connexion et vous serez déconnecté.'
|
|
112
|
+
},
|
|
113
|
+
cs: {
|
|
114
|
+
userNoticeText: 'Než budete moci pokračovat, musíte souhlasit s následujícím',
|
|
115
|
+
submitButtonText: 'Odeslat',
|
|
116
|
+
rejectButtonText: 'Odmítnout',
|
|
117
|
+
rejectText: 'Odmítnutí nových souhlasů povede k nemožnosti pokračovat v procesu přihlášení a budete odhlášeni.'
|
|
118
|
+
},
|
|
119
|
+
de: {
|
|
120
|
+
userNoticeText: 'Bevor Sie fortfahren können, müssen Sie den folgenden Punkten zustimmen',
|
|
121
|
+
submitButtonText: 'Absenden',
|
|
122
|
+
rejectButtonText: 'Ablehnen',
|
|
123
|
+
rejectText: 'Das Ablehnen neuer Zustimmungen führt dazu, dass der Anmeldevorgang nicht fortgesetzt werden kann und Sie abgemeldet werden.'
|
|
124
|
+
},
|
|
125
|
+
es: {
|
|
126
|
+
userNoticeText: 'Antes de continuar, debe dar su consentimiento a lo siguiente',
|
|
127
|
+
submitButtonText: 'Enviar',
|
|
128
|
+
rejectButtonText: 'Rechazar',
|
|
129
|
+
rejectText: 'Rechazar nuevos consentimientos resultará en la imposibilidad de continuar el proceso de inicio de sesión y se cerrará la sesión.'
|
|
130
|
+
},
|
|
131
|
+
pt: {
|
|
132
|
+
userNoticeText: 'Antes de continuar, você deve consentir com o seguinte',
|
|
133
|
+
submitButtonText: 'Enviar',
|
|
134
|
+
rejectButtonText: 'Rejeitar',
|
|
135
|
+
rejectText: 'Rejeitar novos consentimentos resultará na impossibilidade de continuar o processo de login e você será desconectado.'
|
|
136
|
+
},
|
|
137
|
+
'es-mx': {
|
|
138
|
+
userNoticeText: 'Antes de continuar, debe dar su consentimiento a lo siguiente',
|
|
139
|
+
submitButtonText: 'Enviar',
|
|
140
|
+
rejectButtonText: 'Rechazar',
|
|
141
|
+
rejectText: 'Rechazar nuevos consentimientos resultará en la imposibilidad de continuar el proceso de inicio de sesión y se cerrará la sesión.'
|
|
142
|
+
},
|
|
143
|
+
'pt-br': {
|
|
144
|
+
userNoticeText: 'Antes de continuar, você deve consentir com o seguinte',
|
|
145
|
+
submitButtonText: 'Enviar',
|
|
146
|
+
rejectButtonText: 'Rejeitar',
|
|
147
|
+
rejectText: 'Rejeitar novos consentimentos resultará na impossibilidade de continuar o processo de login e você será desconectado.'
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const getTranslations = (url) => {
|
|
151
|
+
return new Promise((resolve) => {
|
|
152
|
+
fetch(url)
|
|
153
|
+
.then((res) => res.json())
|
|
154
|
+
.then((data) => {
|
|
155
|
+
Object.keys(data).forEach((lang) => {
|
|
156
|
+
if (!TRANSLATIONS[lang]) {
|
|
157
|
+
TRANSLATIONS[lang] = {};
|
|
158
|
+
}
|
|
159
|
+
for (let key in data[lang]) {
|
|
160
|
+
TRANSLATIONS[lang][key] = data[lang][key];
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
resolve(true);
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
const translate = (key, customLang, values) => {
|
|
168
|
+
const lang = customLang;
|
|
169
|
+
let translation = TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
|
|
170
|
+
if (values !== undefined) {
|
|
171
|
+
for (const [key, value] of Object.entries(values.values)) {
|
|
172
|
+
const regex = new RegExp(`{${key}}`, 'g');
|
|
173
|
+
translation = translation.replace(regex, value);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return translation;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const pamConsentModalCss = ":host{display:block}.QueryReferenceContainer{height:100%;width:100%}.ConsentNotice{font-size:1.2rem;font-weight:200;text-align:center}.CloseButton{width:25px;height:25px;align-self:flex-end}.PamConsentModal{font-family:inherit;font-weight:100;height:100%;padding:1rem 1.5rem 2rem;background-color:var(--emw--color-white, #FFFFFF);display:flex;flex-direction:column;justify-content:space-between;border-radius:var(--emw--border-radius-large, 20px);max-width:fit-content}.ConsentSubmitButton,.ConsentRejectButton{font-size:1rem;font-family:var(--emw--button-typography);padding:0.4rem 1.4rem;background:var(--emw--button-background-color, #FFFFFF);border:var(--emw--button-border, 2px solid #000000);color:var(--emw--button-text-color, #000000);border-radius:var(--emw--button-border-radius, 10px);align-self:flex-end;cursor:pointer}.ConsentSubmitButton:disabled,.ConsentRejectButton:disabled{border:2px solid #ccc;color:#ccc;cursor:unset}.ButtonsWrapper{display:flex;flex-direction:row;justify-content:space-between;margin-top:10px}.ButtonsWrapper button:only-child{margin-left:auto}@media screen and (max-width: 320px){.QueryReferenceContainer{font-size:0.8rem;color:var(--emw--button-text-color, #000000)}}.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(--emw--login-color-primary, var(--emw--color-primary, #22B04E));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}}";
|
|
180
|
+
const PamConsentModalStyle0 = pamConsentModalCss;
|
|
181
|
+
|
|
182
|
+
const PamConsentModal = class {
|
|
183
|
+
constructor(hostRef) {
|
|
184
|
+
index.registerInstance(this, hostRef);
|
|
185
|
+
/** This obj is passed to the api on consent update */
|
|
186
|
+
this.userConsents = [];
|
|
187
|
+
/** Constant. All possible mandatory consent tag codes */
|
|
188
|
+
this.mandatoryConsentTagCodes = ['termsandconditions', 'privacypolicy'];
|
|
189
|
+
/** Categories that are allowed to form groups */
|
|
190
|
+
this.allowedCategoryGroups = ['Sports', 'Casino', 'VirtualSports'];
|
|
191
|
+
/** Used to render consents */
|
|
192
|
+
this.consentConfig = [];
|
|
193
|
+
this.handleApplyClick = () => {
|
|
194
|
+
this.isQueryFired = true;
|
|
195
|
+
};
|
|
196
|
+
this.handleReject = () => {
|
|
197
|
+
const url = new URL('v1/player/session/player/', this.endpoint);
|
|
198
|
+
const headers = new Headers();
|
|
199
|
+
headers.append('Content-type', 'application/json');
|
|
200
|
+
headers.append('X-SessionID', this.session);
|
|
201
|
+
const options = {
|
|
202
|
+
method: 'DELETE',
|
|
203
|
+
headers: headers
|
|
204
|
+
};
|
|
205
|
+
fetch(url.href, options)
|
|
206
|
+
.then(() => {
|
|
207
|
+
window.postMessage({ type: 'LogoutSuccessfull' }, window.location.href);
|
|
208
|
+
dispatchCustomEvent('logged_out', {});
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
this.endpoint = undefined;
|
|
212
|
+
this.session = undefined;
|
|
213
|
+
this.userId = undefined;
|
|
214
|
+
this.language = 'en';
|
|
215
|
+
this.includeSubmitButton = undefined;
|
|
216
|
+
this.includeRejectButton = undefined;
|
|
217
|
+
this.includeRejectText = undefined;
|
|
218
|
+
this.translationUrl = '';
|
|
219
|
+
this.clientStyling = '';
|
|
220
|
+
this.clientStylingUrl = '';
|
|
221
|
+
this.mbSource = undefined;
|
|
222
|
+
this.isLoading = true;
|
|
223
|
+
this.isValid = true;
|
|
224
|
+
this.isQueryFired = false;
|
|
225
|
+
this.receivedQueryResponses = 0;
|
|
226
|
+
this.mandatoryConsentsChecked = 0;
|
|
227
|
+
this.mandatoryConsentsCount = 0;
|
|
228
|
+
this.userConsentTagCodes = [];
|
|
229
|
+
}
|
|
230
|
+
handleClientStylingChange(newValue, oldValue) {
|
|
231
|
+
if (newValue != oldValue) {
|
|
232
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
handleClientStylingUrlChange(newValue, oldValue) {
|
|
236
|
+
if (newValue != oldValue) {
|
|
237
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
handleMbSourceChange(newValue, oldValue) {
|
|
241
|
+
if (newValue != oldValue) {
|
|
242
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
handleQueryResponse() {
|
|
246
|
+
if (this.receivedQueryResponses === this.consentConfig.length) {
|
|
247
|
+
this.updateConsents();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
userLegislationConsentHandler(event) {
|
|
251
|
+
for (const consent of event.detail) {
|
|
252
|
+
if (this.mandatoryConsentTagCodes.includes(consent.type) && this.isQueryFired === false) {
|
|
253
|
+
consent.value === true ? this.mandatoryConsentsChecked++ : this.mandatoryConsentsChecked--;
|
|
254
|
+
}
|
|
255
|
+
// Register final user choices only if we're ready to update
|
|
256
|
+
if (this.isQueryFired) {
|
|
257
|
+
this.userConsents.push({
|
|
258
|
+
tagCode: consent.type,
|
|
259
|
+
status: Number(consent.value),
|
|
260
|
+
note: ''
|
|
261
|
+
});
|
|
262
|
+
this.receivedQueryResponses++;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
async componentWillLoad() {
|
|
267
|
+
this.getConsents().then(consents => this.setConsentConfig(consents));
|
|
268
|
+
if (this.translationUrl.length > 2) {
|
|
269
|
+
await getTranslations(this.translationUrl);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
componentDidLoad() {
|
|
273
|
+
if (this.stylingContainer) {
|
|
274
|
+
if (this.mbSource)
|
|
275
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
|
|
276
|
+
if (this.clientStyling)
|
|
277
|
+
setClientStyling(this.stylingContainer, this.clientStyling);
|
|
278
|
+
if (this.clientStylingUrl)
|
|
279
|
+
setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
disconnectedCallback() {
|
|
283
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
284
|
+
}
|
|
285
|
+
getConsents() {
|
|
286
|
+
const url = new URL(`/v1/player/${this.userId}/legislation/consents/`, this.endpoint);
|
|
287
|
+
const headers = new Headers({ 'X-SessionId': this.session });
|
|
288
|
+
const options = { method: 'GET', headers };
|
|
289
|
+
return fetch(url.href, options)
|
|
290
|
+
.then(res => {
|
|
291
|
+
if (res.status === 200) {
|
|
292
|
+
return res.json();
|
|
293
|
+
}
|
|
294
|
+
throw new Error(String(res.status));
|
|
295
|
+
})
|
|
296
|
+
.then((data) => {
|
|
297
|
+
return data.consents;
|
|
298
|
+
})
|
|
299
|
+
.catch(error => {
|
|
300
|
+
console.error('Error fetching data:', error);
|
|
301
|
+
return null;
|
|
302
|
+
})
|
|
303
|
+
.finally(() => {
|
|
304
|
+
window.postMessage({
|
|
305
|
+
type: 'UserActionsExists',
|
|
306
|
+
displayUserActions: this.mandatoryConsentsCount > 0
|
|
307
|
+
}, window.location.href);
|
|
308
|
+
this.isLoading = false;
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
setConsentConfig(consents) {
|
|
312
|
+
for (const consent of consents) {
|
|
313
|
+
if (consent.status !== 2 || consent.tagCode === 'pepconsent') {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
const mandatory = this.mandatoryConsentTagCodes.includes(consent.tagCode);
|
|
317
|
+
if (mandatory) {
|
|
318
|
+
++this.mandatoryConsentsCount;
|
|
319
|
+
}
|
|
320
|
+
if (this.allowedCategoryGroups.includes(consent.category)) {
|
|
321
|
+
const target = this.consentConfig.find(c => c.group === consent.category.toLowerCase());
|
|
322
|
+
if (target) {
|
|
323
|
+
target.consentTypes += (',' + consent.tagCode);
|
|
324
|
+
target.mandatory += (',' + String(mandatory));
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
this.consentConfig.push({
|
|
328
|
+
consentTypes: consent.tagCode,
|
|
329
|
+
group: consent.category.toLowerCase(),
|
|
330
|
+
mandatory: String(mandatory)
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
this.consentConfig.push({
|
|
336
|
+
consentTypes: consent.tagCode,
|
|
337
|
+
group: '',
|
|
338
|
+
mandatory: String(mandatory)
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
updateConsents() {
|
|
344
|
+
const url = new URL(`/v1/player/${this.userId}/legislation/consents/`, this.endpoint);
|
|
345
|
+
const headers = new Headers();
|
|
346
|
+
headers.append('Content-Type', 'application/json');
|
|
347
|
+
headers.append('Accept', 'application/json');
|
|
348
|
+
headers.append('X-SessionId', this.session);
|
|
349
|
+
const body = JSON.stringify({ consents: this.userConsents });
|
|
350
|
+
const options = {
|
|
351
|
+
method: 'POST',
|
|
352
|
+
headers,
|
|
353
|
+
body
|
|
354
|
+
};
|
|
355
|
+
fetch(url.href, options)
|
|
356
|
+
.then(res => res.json())
|
|
357
|
+
.then(() => {
|
|
358
|
+
window.postMessage({
|
|
359
|
+
type: 'WidgetNotification',
|
|
360
|
+
data: {
|
|
361
|
+
type: 'success',
|
|
362
|
+
message: 'Consent update successful!'
|
|
363
|
+
}
|
|
364
|
+
}, window.location.href);
|
|
365
|
+
})
|
|
366
|
+
.catch((err) => {
|
|
367
|
+
window.postMessage({
|
|
368
|
+
type: 'WidgetNotification',
|
|
369
|
+
data: {
|
|
370
|
+
type: 'error',
|
|
371
|
+
message: 'Server might not be responding',
|
|
372
|
+
err
|
|
373
|
+
}
|
|
374
|
+
}, window.location.href);
|
|
375
|
+
})
|
|
376
|
+
.finally(() => {
|
|
377
|
+
window.postMessage({ type: 'UserActionsCompleted' }, window.location.href);
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
render() {
|
|
381
|
+
if (this.mandatoryConsentsCount === 0) {
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
this.isValid = this.mandatoryConsentsChecked === this.mandatoryConsentsCount;
|
|
385
|
+
return (index.h("div", { class: "QueryReferenceContainer", ref: el => this.stylingContainer = el }, this.isLoading ? (index.h("div", null, index.h("slot", { name: 'spinner' }), 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: "PamConsentModal" }, index.h("h2", { class: "ConsentNotice" }, translate('userNoticeText', this.language)), index.h("div", { class: "ConsentsWrapper" }, this.consentConfig.map(consent => (index.h("slot", { name: consent.group || consent.consentTypes }, index.h("pam-consent-item", { language: this.language, "translation-url": this.translationUrl, group: consent.group, consentTypes: consent.consentTypes, queried: this.isQueryFired, mandatory: consent.mandatory, "client-styling-url": this.clientStylingUrl, "mb-source": this.mbSource, "client-styling": this.clientStyling }))))), index.h("div", { class: "ButtonsWrapper" }, this.includeRejectButton &&
|
|
386
|
+
index.h("button", { class: "ConsentRejectButton", onClick: this.handleReject }, translate('rejectButtonText', this.language)), this.includeSubmitButton &&
|
|
387
|
+
index.h("button", { class: "ConsentSubmitButton", disabled: !this.isValid, onClick: this.handleApplyClick }, translate('submitButtonText', this.language))), this.includeRejectText && index.h("p", { class: "RejectText" }, translate('rejectText', this.language))))));
|
|
388
|
+
}
|
|
389
|
+
static get watchers() { return {
|
|
390
|
+
"clientStyling": ["handleClientStylingChange"],
|
|
391
|
+
"clientStylingUrl": ["handleClientStylingUrlChange"],
|
|
392
|
+
"mbSource": ["handleMbSourceChange"],
|
|
393
|
+
"receivedQueryResponses": ["handleQueryResponse"]
|
|
394
|
+
}; }
|
|
395
|
+
};
|
|
396
|
+
PamConsentModal.style = PamConsentModalStyle0;
|
|
397
|
+
|
|
398
|
+
exports.PamConsentModal = PamConsentModal;
|
|
399
|
+
exports.setClientStyling = setClientStyling;
|
|
400
|
+
exports.setClientStylingURL = setClientStylingURL;
|
|
401
|
+
exports.setStreamStyling = setStreamStyling;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-9dbdce4a.js');
|
|
6
|
+
const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
Stencil Client Patch Browser v4.19.2 | MIT Licensed | https://stenciljs.com
|
|
10
|
+
*/
|
|
11
|
+
var patchBrowser = () => {
|
|
12
|
+
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('pam-consent-modal.cjs.js', document.baseURI).href));
|
|
13
|
+
const opts = {};
|
|
14
|
+
if (importMeta !== "") {
|
|
15
|
+
opts.resourcesUrl = new URL(".", importMeta).href;
|
|
16
|
+
}
|
|
17
|
+
return index.promiseResolve(opts);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
patchBrowser().then(async (options) => {
|
|
21
|
+
await appGlobals.globalScripts();
|
|
22
|
+
return index.bootstrapLazy([["pam-consent-item_2.cjs",[[1,"pam-consent-modal",{"endpoint":[513],"session":[513],"userId":[513,"user-id"],"language":[1537],"includeSubmitButton":[516,"include-submit-button"],"includeRejectButton":[516,"include-reject-button"],"includeRejectText":[516,"include-reject-text"],"translationUrl":[513,"translation-url"],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"mbSource":[513,"mb-source"],"isLoading":[32],"isValid":[32],"isQueryFired":[32],"receivedQueryResponses":[32],"mandatoryConsentsChecked":[32],"mandatoryConsentsCount":[32],"userConsentTagCodes":[32]},[[0,"userLegislationConsent","userLegislationConsentHandler"]],{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"],"receivedQueryResponses":["handleQueryResponse"]}],[1,"pam-consent-item",{"language":[1537],"queried":[516],"group":[513],"consentTypes":[513,"consent-types"],"mandatory":[513],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"mbSource":[513,"mb-source"]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
exports.setNonce = index.setNonce;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"entries": [
|
|
3
|
+
"components/pam-consent-modal/pam-consent-modal.js"
|
|
4
|
+
],
|
|
5
|
+
"compiler": {
|
|
6
|
+
"name": "@stencil/core",
|
|
7
|
+
"version": "4.19.2",
|
|
8
|
+
"typescriptVersion": "5.4.5"
|
|
9
|
+
},
|
|
10
|
+
"collections": [
|
|
11
|
+
{
|
|
12
|
+
"name": "@everymatrix/pam-consent-item",
|
|
13
|
+
"tags": [
|
|
14
|
+
"pam-consent-item"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"bundles": []
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PamConsentModal } from './pam-consent-modal';
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.QueryReferenceContainer {
|
|
6
|
+
height: 100%;
|
|
7
|
+
width: 100%;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.ConsentNotice {
|
|
11
|
+
font-size: 1.2rem;
|
|
12
|
+
font-weight: 200;
|
|
13
|
+
text-align: center;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.CloseButton {
|
|
17
|
+
width: 25px;
|
|
18
|
+
height: 25px;
|
|
19
|
+
align-self: flex-end;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.PamConsentModal {
|
|
23
|
+
font-family: inherit;
|
|
24
|
+
font-weight: 100;
|
|
25
|
+
height: 100%;
|
|
26
|
+
padding: 1rem 1.5rem 2rem;
|
|
27
|
+
background-color: var(--emw--color-white, #FFFFFF);
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
justify-content: space-between;
|
|
31
|
+
border-radius: var(--emw--border-radius-large, 20px);
|
|
32
|
+
max-width: fit-content;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.ConsentSubmitButton, .ConsentRejectButton {
|
|
36
|
+
font-size: 1rem;
|
|
37
|
+
font-family: var(--emw--button-typography);
|
|
38
|
+
padding: 0.4rem 1.4rem;
|
|
39
|
+
background: var(--emw--button-background-color, #FFFFFF);
|
|
40
|
+
border: var(--emw--button-border, 2px solid #000000);
|
|
41
|
+
color: var(--emw--button-text-color, #000000);
|
|
42
|
+
border-radius: var(--emw--button-border-radius, 10px);
|
|
43
|
+
align-self: flex-end;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
}
|
|
46
|
+
.ConsentSubmitButton:disabled, .ConsentRejectButton:disabled {
|
|
47
|
+
border: 2px solid #ccc;
|
|
48
|
+
color: #ccc;
|
|
49
|
+
cursor: unset;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.ButtonsWrapper {
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-direction: row;
|
|
55
|
+
justify-content: space-between;
|
|
56
|
+
margin-top: 10px;
|
|
57
|
+
}
|
|
58
|
+
.ButtonsWrapper button:only-child {
|
|
59
|
+
margin-left: auto;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@media screen and (max-width: 320px) {
|
|
63
|
+
.QueryReferenceContainer {
|
|
64
|
+
font-size: 0.8rem;
|
|
65
|
+
color: var(--emw--button-text-color, #000000);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
.spinner {
|
|
69
|
+
animation: rotate 2s linear infinite;
|
|
70
|
+
z-index: 2;
|
|
71
|
+
position: absolute;
|
|
72
|
+
top: 50%;
|
|
73
|
+
left: 50%;
|
|
74
|
+
margin: -25px 0 0 -25px;
|
|
75
|
+
width: 50px;
|
|
76
|
+
height: 50px;
|
|
77
|
+
}
|
|
78
|
+
.spinner .path {
|
|
79
|
+
stroke: var(--emw--login-color-primary, var(--emw--color-primary, #22B04E));
|
|
80
|
+
stroke-linecap: round;
|
|
81
|
+
animation: dash 1.5s ease-in-out infinite;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@keyframes rotate {
|
|
85
|
+
100% {
|
|
86
|
+
transform: rotate(360deg);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
@keyframes dash {
|
|
90
|
+
0% {
|
|
91
|
+
stroke-dasharray: 1, 150;
|
|
92
|
+
stroke-dashoffset: 0;
|
|
93
|
+
}
|
|
94
|
+
50% {
|
|
95
|
+
stroke-dasharray: 90, 150;
|
|
96
|
+
stroke-dashoffset: -35;
|
|
97
|
+
}
|
|
98
|
+
100% {
|
|
99
|
+
stroke-dasharray: 90, 150;
|
|
100
|
+
stroke-dashoffset: -124;
|
|
101
|
+
}
|
|
102
|
+
}
|