@everymatrix/pam-consent-modal-gm2 1.87.44

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.
Files changed (57) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/index-7739e965.js +1303 -0
  3. package/dist/cjs/index.cjs.js +10 -0
  4. package/dist/cjs/loader.cjs.js +15 -0
  5. package/dist/cjs/pam-consent-item_2.cjs.entry.js +616 -0
  6. package/dist/cjs/pam-consent-modal-gm2-0517b0e8.js +474 -0
  7. package/dist/cjs/pam-consent-modal-gm2.cjs.js +25 -0
  8. package/dist/collection/collection-manifest.json +19 -0
  9. package/dist/collection/components/pam-consent-modal-gm2/index.js +1 -0
  10. package/dist/collection/components/pam-consent-modal-gm2/pam-consent-modal-gm2.css +102 -0
  11. package/dist/collection/components/pam-consent-modal-gm2/pam-consent-modal-gm2.js +444 -0
  12. package/dist/collection/index.js +1 -0
  13. package/dist/collection/utils/locale.utils.js +119 -0
  14. package/dist/collection/utils/types.js +1 -0
  15. package/dist/esm/app-globals-0f993ce5.js +3 -0
  16. package/dist/esm/index-bc7b46e6.js +1276 -0
  17. package/dist/esm/index.js +2 -0
  18. package/dist/esm/loader.js +11 -0
  19. package/dist/esm/pam-consent-item_2.entry.js +612 -0
  20. package/dist/esm/pam-consent-modal-gm2-c30b5b89.js +469 -0
  21. package/dist/esm/pam-consent-modal-gm2.js +20 -0
  22. package/dist/index.cjs.js +1 -0
  23. package/dist/index.js +1 -0
  24. package/dist/pam-consent-modal-gm2/index.esm.js +1 -0
  25. package/dist/pam-consent-modal-gm2/p-0acedac1.js +2 -0
  26. package/dist/pam-consent-modal-gm2/p-7138ec54.js +1 -0
  27. package/dist/pam-consent-modal-gm2/p-e1255160.js +1 -0
  28. package/dist/pam-consent-modal-gm2/p-e25bc764.entry.js +1 -0
  29. package/dist/pam-consent-modal-gm2/pam-consent-modal-gm2.esm.js +1 -0
  30. package/dist/stencil.config.dev.js +19 -0
  31. package/dist/stencil.config.js +18 -0
  32. package/dist/storybook/main.js +43 -0
  33. package/dist/storybook/preview.js +9 -0
  34. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-consent-modal-gm2/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
  35. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-consent-modal-gm2/.stencil/packages/stencil/pam-consent-modal-gm2/stencil.config.d.ts +2 -0
  36. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-consent-modal-gm2/.stencil/packages/stencil/pam-consent-modal-gm2/stencil.config.dev.d.ts +2 -0
  37. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-consent-modal-gm2/.stencil/packages/stencil/pam-consent-modal-gm2/storybook/main.d.ts +3 -0
  38. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-consent-modal-gm2/.stencil/packages/stencil/pam-consent-modal-gm2/storybook/preview.d.ts +70 -0
  39. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-consent-modal-gm2/.stencil/tools/plugins/index.d.ts +4 -0
  40. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-consent-modal-gm2/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
  41. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-consent-modal-gm2/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
  42. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-consent-modal-gm2/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  43. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-consent-modal-gm2/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  44. package/dist/types/components/pam-consent-modal-gm2/index.d.ts +1 -0
  45. package/dist/types/components/pam-consent-modal-gm2/pam-consent-modal-gm2.d.ts +65 -0
  46. package/dist/types/components.d.ts +125 -0
  47. package/dist/types/index.d.ts +1 -0
  48. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  49. package/dist/types/utils/locale.utils.d.ts +2 -0
  50. package/dist/types/utils/types.d.ts +13 -0
  51. package/loader/cdn.js +1 -0
  52. package/loader/index.cjs.js +1 -0
  53. package/loader/index.d.ts +24 -0
  54. package/loader/index.es2017.js +1 -0
  55. package/loader/index.js +2 -0
  56. package/loader/package.json +11 -0
  57. package/package.json +27 -0
@@ -0,0 +1,469 @@
1
+ import { r as registerInstance, h } from './index-bc7b46e6.js';
2
+
3
+ const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
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
+ if (!stylingContainer || !clientStylingUrl) return;
27
+
28
+ const url = new URL(clientStylingUrl);
29
+
30
+ fetch(url.href)
31
+ .then((res) => res.text())
32
+ .then((data) => {
33
+ const cssFile = document.createElement('style');
34
+ cssFile.innerHTML = data;
35
+ if (stylingContainer) {
36
+ stylingContainer.appendChild(cssFile);
37
+ }
38
+ })
39
+ .catch((err) => {
40
+ console.error('There was an error while trying to load client styling from URL', err);
41
+ });
42
+ }
43
+
44
+ /**
45
+ * @name setStreamLibrary
46
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
47
+ * @param {HTMLElement} stylingContainer The highest element of the widget
48
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
49
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
50
+ * @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
51
+ */
52
+ function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
53
+ if (!window.emMessageBus) return;
54
+
55
+ const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
56
+
57
+ if (!supportAdoptStyle || !useAdoptedStyleSheets) {
58
+ subscription = getStyleTagSubscription(stylingContainer, domain);
59
+
60
+ return subscription;
61
+ }
62
+
63
+ if (!window[StyleCacheKey]) {
64
+ window[StyleCacheKey] = {};
65
+ }
66
+ subscription = getAdoptStyleSubscription(stylingContainer, domain);
67
+
68
+ const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
69
+ const wrappedUnsubscribe = () => {
70
+ if (window[StyleCacheKey][domain]) {
71
+ const cachedObject = window[StyleCacheKey][domain];
72
+ cachedObject.refCount > 1
73
+ ? (cachedObject.refCount = cachedObject.refCount - 1)
74
+ : delete window[StyleCacheKey][domain];
75
+ }
76
+
77
+ originalUnsubscribe();
78
+ };
79
+ subscription.unsubscribe = wrappedUnsubscribe;
80
+
81
+ return subscription;
82
+ }
83
+
84
+ function getStyleTagSubscription(stylingContainer, domain) {
85
+ const sheet = document.createElement('style');
86
+
87
+ return window.emMessageBus.subscribe(domain, (data) => {
88
+ if (stylingContainer) {
89
+ sheet.innerHTML = data;
90
+ stylingContainer.appendChild(sheet);
91
+ }
92
+ });
93
+ }
94
+
95
+ function getAdoptStyleSubscription(stylingContainer, domain) {
96
+ return window.emMessageBus.subscribe(domain, (data) => {
97
+ if (!stylingContainer) return;
98
+
99
+ const shadowRoot = stylingContainer.getRootNode();
100
+ const cacheStyleObject = window[StyleCacheKey];
101
+ let cachedStyle = cacheStyleObject[domain] && cacheStyleObject[domain].sheet;
102
+
103
+ if (!cachedStyle) {
104
+ cachedStyle = new CSSStyleSheet();
105
+ cachedStyle.replaceSync(data);
106
+ cacheStyleObject[domain] = {
107
+ sheet: cachedStyle,
108
+ refCount: 1
109
+ };
110
+ } else {
111
+ cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
112
+ }
113
+
114
+ const currentSheets = shadowRoot.adoptedStyleSheets || [];
115
+ if (!currentSheets.includes(cachedStyle)) {
116
+ shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
117
+ }
118
+ });
119
+ }
120
+
121
+ /**
122
+ * @name dispatchCustomEvent
123
+ * @description dispatches the custom event CustomEventProcessor is listening for
124
+ * @param {string} type of the custom event
125
+ * @param {Object} data may contain additional information about the event, e.g. userId
126
+ */
127
+ const dispatchCustomEvent = (type, data = {}) => {
128
+ const event = new CustomEvent('track-custom-event', {
129
+ detail: {
130
+ type,
131
+ data
132
+ },
133
+ bubbles: true,
134
+ composed: true
135
+ });
136
+
137
+ document.dispatchEvent(event);
138
+ };
139
+
140
+ const DEFAULT_LANGUAGE = 'en';
141
+ const TRANSLATIONS = {
142
+ en: {
143
+ userNoticeText: 'Before you can proceed you must consent to the following',
144
+ submitButtonText: 'Submit',
145
+ rejectButtonText: 'Reject',
146
+ rejectText: 'Rejecting new consents will result in the inability to continue the login process and you will be logged out.',
147
+ consentUpdateSuccess: 'Consent update successful!',
148
+ serverNotResponding: 'Server might not be responding'
149
+ },
150
+ 'en-us': {
151
+ userNoticeText: 'Before you can proceed you must consent to the following',
152
+ submitButtonText: 'Submit',
153
+ rejectButtonText: 'Reject',
154
+ rejectText: 'Rejecting new consents will result in the inability to continue the login process and you will be logged out.',
155
+ consentUpdateSuccess: 'Consent update successful!',
156
+ serverNotResponding: 'Server might not be responding'
157
+ },
158
+ ro: {
159
+ userNoticeText: 'Înainte de a continua, trebuie să vă dați consimțământul pentru următoarele',
160
+ submitButtonText: 'Trimite',
161
+ rejectButtonText: 'Respinge',
162
+ rejectText: 'Respingerea noilor consimțăminte va duce la imposibilitatea de a continua procesul de autentificare și veți fi deconectat.',
163
+ consentUpdateSuccess: 'Actualizare consimțământ reușită!',
164
+ serverNotResponding: 'Serverul s-ar putea să nu răspundă'
165
+ },
166
+ hr: {
167
+ userNoticeText: 'Prije nego što možete nastaviti, morate pristati na sljedeće',
168
+ submitButtonText: 'Pošalji',
169
+ rejectButtonText: 'Odbij',
170
+ rejectText: 'Odbijanje novih pristanka rezultirat će nemogućnošću nastavka procesa prijave i bit ćete odjavljeni.',
171
+ consentUpdateSuccess: 'Ažuriranje pristanka uspješno!',
172
+ serverNotResponding: 'Poslužitelj možda ne odgovara'
173
+ },
174
+ fr: {
175
+ userNoticeText: 'Avant de continuer, vous devez consentir aux éléments suivants',
176
+ submitButtonText: 'Soumettre',
177
+ rejectButtonText: 'Rejeter',
178
+ rejectText: 'Le rejet des nouveaux consentements entraînera l\'impossibilité de continuer le processus de connexion et vous serez déconnecté.',
179
+ consentUpdateSuccess: 'Mise à jour du consentement réussie!',
180
+ serverNotResponding: 'Le serveur ne répond peut-être pas'
181
+ },
182
+ cs: {
183
+ userNoticeText: 'Než budete moci pokračovat, musíte souhlasit s následujícím',
184
+ submitButtonText: 'Odeslat',
185
+ rejectButtonText: 'Odmítnout',
186
+ rejectText: 'Odmítnutí nových souhlasů povede k nemožnosti pokračovat v procesu přihlášení a budete odhlášeni.',
187
+ consentUpdateSuccess: 'Aktualizace souhlasu proběhla úspěšně!',
188
+ serverNotResponding: 'Server možná neodpovídá'
189
+ },
190
+ de: {
191
+ userNoticeText: 'Bevor Sie fortfahren können, müssen Sie den folgenden Punkten zustimmen',
192
+ submitButtonText: 'Absenden',
193
+ rejectButtonText: 'Ablehnen',
194
+ rejectText: 'Das Ablehnen neuer Zustimmungen führt dazu, dass der Anmeldevorgang nicht fortgesetzt werden kann und Sie abgemeldet werden.',
195
+ consentUpdateSuccess: 'Zustimmung erfolgreich aktualisiert!',
196
+ serverNotResponding: 'Der Server antwortet möglicherweise nicht'
197
+ },
198
+ es: {
199
+ userNoticeText: 'Antes de continuar, debe dar su consentimiento a lo siguiente',
200
+ submitButtonText: 'Enviar',
201
+ rejectButtonText: 'Rechazar',
202
+ rejectText: 'Rechazar nuevos consentimientos resultará en la imposibilidad de continuar el proceso de inicio de sesión y se cerrará la sesión.',
203
+ consentUpdateSuccess: '¡Actualización del consentimiento exitosa!',
204
+ serverNotResponding: 'El servidor podría no estar respondiendo'
205
+ },
206
+ pt: {
207
+ userNoticeText: 'Antes de continuar, você deve consentir com o seguinte',
208
+ submitButtonText: 'Enviar',
209
+ rejectButtonText: 'Rejeitar',
210
+ rejectText: 'Rejeitar novos consentimentos resultará na impossibilidade de continuar o processo de login e você será desconectado.',
211
+ consentUpdateSuccess: 'Atualização de consentimento bem-sucedida!',
212
+ serverNotResponding: 'O servidor pode não estar respondendo'
213
+ },
214
+ 'es-mx': {
215
+ userNoticeText: 'Antes de continuar, debe dar su consentimiento a lo siguiente',
216
+ submitButtonText: 'Enviar',
217
+ rejectButtonText: 'Rechazar',
218
+ rejectText: 'Rechazar nuevos consentimientos resultará en la imposibilidad de continuar el proceso de inicio de sesión y se cerrará la sesión.',
219
+ consentUpdateSuccess: '¡Actualización del consentimiento exitosa!',
220
+ serverNotResponding: 'El servidor podría no estar respondiendo'
221
+ },
222
+ 'pt-br': {
223
+ userNoticeText: 'Antes de continuar, você deve consentir com o seguinte',
224
+ submitButtonText: 'Enviar',
225
+ rejectButtonText: 'Rejeitar',
226
+ rejectText: 'Rejeitar novos consentimentos resultará na impossibilidade de continuar o processo de login e você será desconectado.',
227
+ consentUpdateSuccess: 'Atualização de consentimento bem-sucedida!',
228
+ serverNotResponding: 'O servidor pode não estar respondendo'
229
+ }
230
+ };
231
+ const getTranslations = (url) => {
232
+ return new Promise((resolve) => {
233
+ fetch(url)
234
+ .then((res) => res.json())
235
+ .then((data) => {
236
+ Object.keys(data).forEach((lang) => {
237
+ if (!TRANSLATIONS[lang]) {
238
+ TRANSLATIONS[lang] = {};
239
+ }
240
+ for (let key in data[lang]) {
241
+ TRANSLATIONS[lang][key] = data[lang][key];
242
+ }
243
+ });
244
+ resolve(true);
245
+ });
246
+ });
247
+ };
248
+ const translate = (key, customLang, values) => {
249
+ const lang = customLang;
250
+ let translation = TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
251
+ if (values !== undefined) {
252
+ for (const [key, value] of Object.entries(values.values)) {
253
+ const regex = new RegExp(`{${key}}`, 'g');
254
+ translation = translation.replace(regex, value);
255
+ }
256
+ }
257
+ return translation;
258
+ };
259
+
260
+ const pamConsentModalGm2Css = ":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}}";
261
+ const PamConsentModalGm2Style0 = pamConsentModalGm2Css;
262
+
263
+ const PamConsentModalGm2 = class {
264
+ constructor(hostRef) {
265
+ registerInstance(this, hostRef);
266
+ this.consentStatuses = { ACCEPTED: 'Accepted', DENIED: 'Denied' };
267
+ /** This obj is passed to the api on consent update */
268
+ this.userConsents = [];
269
+ /** Used to render consents */
270
+ this.consentConfig = [];
271
+ this.allowedCategoryGroupsArray = [];
272
+ this.mandatoryTagCodes = new Set();
273
+ this.handleApplyClick = () => {
274
+ this.isQueryFired = true;
275
+ };
276
+ this.handleReject = () => {
277
+ const url = new URL('/v2/player/session/player/', this.endpoint);
278
+ const headers = new Headers();
279
+ headers.append('Content-type', 'application/json');
280
+ headers.append('X-SessionID', this.session);
281
+ const options = {
282
+ method: 'DELETE',
283
+ headers: headers
284
+ };
285
+ fetch(url.href, options)
286
+ .then(() => {
287
+ window.postMessage({ type: 'LogoutSuccessfull' }, window.location.href);
288
+ dispatchCustomEvent('logged_out', {});
289
+ });
290
+ };
291
+ this.endpoint = undefined;
292
+ this.session = undefined;
293
+ this.language = 'en';
294
+ this.includeSubmitButton = undefined;
295
+ this.includeRejectButton = undefined;
296
+ this.includeRejectText = undefined;
297
+ this.allowedCategoryGroups = 'Sports, Casino, VirtualSports, Bingo';
298
+ this.translationUrl = '';
299
+ this.clientStyling = '';
300
+ this.clientStylingUrl = '';
301
+ this.mbSource = undefined;
302
+ this.isLoading = true;
303
+ this.isValid = true;
304
+ this.isQueryFired = false;
305
+ this.receivedQueryResponses = 0;
306
+ this.mandatoryConsentsChecked = 0;
307
+ this.mandatoryConsentsCount = 0;
308
+ }
309
+ handleClientStylingChange(newValue, oldValue) {
310
+ if (newValue != oldValue) {
311
+ setClientStyling(this.stylingContainer, this.clientStyling);
312
+ }
313
+ }
314
+ handleClientStylingUrlChange(newValue, oldValue) {
315
+ if (newValue != oldValue) {
316
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
317
+ }
318
+ }
319
+ handleMbSourceChange(newValue, oldValue) {
320
+ if (newValue != oldValue) {
321
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
322
+ }
323
+ }
324
+ handleQueryResponse() {
325
+ if (this.receivedQueryResponses === this.consentConfig.length) {
326
+ this.updateConsents();
327
+ }
328
+ }
329
+ userLegislationConsentHandler(event) {
330
+ for (const consent of event.detail) {
331
+ if (this.mandatoryTagCodes.has(consent.type) && this.isQueryFired === false) {
332
+ consent.value === true ? this.mandatoryConsentsChecked++ : this.mandatoryConsentsChecked--;
333
+ }
334
+ // Register final user choices only if we're ready to update
335
+ if (this.isQueryFired) {
336
+ this.userConsents.push({
337
+ tagCode: consent.type,
338
+ status: consent.value ? this.consentStatuses.ACCEPTED : this.consentStatuses.DENIED,
339
+ });
340
+ }
341
+ }
342
+ if (this.isQueryFired) {
343
+ this.receivedQueryResponses++;
344
+ }
345
+ }
346
+ async componentWillLoad() {
347
+ this.allowedCategoryGroupsArray = this.allowedCategoryGroups.split(',').map(item => item.trim());
348
+ this.getConsents().then(consents => {
349
+ this.setConsentConfig(consents);
350
+ window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryConsentsCount > 0 }, window.location.href);
351
+ });
352
+ if (this.translationUrl.length > 2) {
353
+ await getTranslations(this.translationUrl);
354
+ }
355
+ }
356
+ componentDidLoad() {
357
+ if (this.stylingContainer) {
358
+ if (this.mbSource)
359
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
360
+ if (this.clientStyling)
361
+ setClientStyling(this.stylingContainer, this.clientStyling);
362
+ if (this.clientStylingUrl)
363
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
364
+ }
365
+ }
366
+ disconnectedCallback() {
367
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
368
+ }
369
+ getConsents() {
370
+ const url = new URL('/api/v2/gm/legislation/consents/requirements', this.endpoint);
371
+ url.searchParams.set('loginSessionId', this.session);
372
+ const options = { method: 'GET' };
373
+ return fetch(url.href, options)
374
+ .then(res => {
375
+ if (res.status === 200) {
376
+ return res.json();
377
+ }
378
+ throw new Error(String(res.status));
379
+ })
380
+ .catch(error => {
381
+ console.error('Error fetching data:', error);
382
+ return null;
383
+ })
384
+ .finally(() => { this.isLoading = false; });
385
+ }
386
+ setConsentConfig(consents) {
387
+ for (const consent of consents) {
388
+ const mandatory = consent.mustAccept;
389
+ if (mandatory) {
390
+ ++this.mandatoryConsentsCount;
391
+ this.mandatoryTagCodes.add(consent.tagCode);
392
+ }
393
+ const categoryCode = consent.category.categoryTagCode;
394
+ if (this.allowedCategoryGroupsArray.includes(categoryCode)) {
395
+ const target = this.consentConfig.find(c => c.group === categoryCode.toLowerCase());
396
+ if (target) {
397
+ target.consentTypes += (',' + consent.tagCode);
398
+ target.mandatory += (',' + String(mandatory));
399
+ }
400
+ else {
401
+ this.consentConfig.push({
402
+ consentTypes: consent.tagCode,
403
+ group: categoryCode.toLowerCase(),
404
+ mandatory: String(mandatory)
405
+ });
406
+ }
407
+ }
408
+ else {
409
+ this.consentConfig.push({
410
+ consentTypes: consent.tagCode,
411
+ group: '',
412
+ mandatory: String(mandatory)
413
+ });
414
+ }
415
+ }
416
+ }
417
+ updateConsents() {
418
+ const url = new URL('/api/v2/gm/legislation/consents/login', this.endpoint);
419
+ url.searchParams.set('loginSessionId', this.session);
420
+ const headers = new Headers();
421
+ headers.append('Content-Type', 'application/json');
422
+ headers.append('Accept', 'application/json');
423
+ const body = JSON.stringify({ note: '', userConsents: this.userConsents });
424
+ const options = {
425
+ method: 'PATCH',
426
+ headers,
427
+ body
428
+ };
429
+ fetch(url.href, options)
430
+ .then(res => res.json())
431
+ .then(() => {
432
+ window.postMessage({
433
+ type: 'WidgetNotification',
434
+ data: {
435
+ type: 'success',
436
+ message: translate('consentUpdateSuccess', this.language)
437
+ }
438
+ }, window.location.href);
439
+ })
440
+ .catch((err) => {
441
+ window.postMessage({
442
+ type: 'WidgetNotification',
443
+ data: {
444
+ type: 'error',
445
+ message: translate('serverNotResponding', this.language),
446
+ err
447
+ }
448
+ }, window.location.href);
449
+ })
450
+ .finally(() => {
451
+ window.postMessage({ type: 'UserActionsCompleted' }, window.location.href);
452
+ });
453
+ }
454
+ render() {
455
+ this.isValid = this.mandatoryConsentsChecked === this.mandatoryConsentsCount;
456
+ return (h("div", { key: '90e9076be34bb3556ee584768cf255bc07ef453b', class: "QueryReferenceContainer", ref: el => this.stylingContainer = el }, this.isLoading ? (h("div", null, h("slot", { name: 'spinner' }), 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: "PamConsentModal" }, h("h2", { class: "ConsentNotice" }, translate('userNoticeText', this.language)), h("div", { class: "ConsentsWrapper" }, this.consentConfig.map(consent => (h("slot", { name: consent.group || consent.consentTypes }, 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 }))))), h("div", { class: "ButtonsWrapper" }, this.includeRejectButton &&
457
+ h("button", { class: "ConsentRejectButton", onClick: this.handleReject }, translate('rejectButtonText', this.language)), this.includeSubmitButton &&
458
+ h("button", { class: "ConsentSubmitButton", disabled: !this.isValid, onClick: this.handleApplyClick }, translate('submitButtonText', this.language))), this.includeRejectText && h("p", { class: "RejectText" }, translate('rejectText', this.language))))));
459
+ }
460
+ static get watchers() { return {
461
+ "clientStyling": ["handleClientStylingChange"],
462
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
463
+ "mbSource": ["handleMbSourceChange"],
464
+ "receivedQueryResponses": ["handleQueryResponse"]
465
+ }; }
466
+ };
467
+ PamConsentModalGm2.style = PamConsentModalGm2Style0;
468
+
469
+ export { PamConsentModalGm2 as P, setClientStylingURL as a, setStreamStyling as b, setClientStyling as s };
@@ -0,0 +1,20 @@
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-bc7b46e6.js';
2
+ export { s as setNonce } from './index-bc7b46e6.js';
3
+ import { g as globalScripts } from './app-globals-0f993ce5.js';
4
+
5
+ /*
6
+ Stencil Client Patch Browser v4.19.2 | MIT Licensed | https://stenciljs.com
7
+ */
8
+ var patchBrowser = () => {
9
+ const importMeta = import.meta.url;
10
+ const opts = {};
11
+ if (importMeta !== "") {
12
+ opts.resourcesUrl = new URL(".", importMeta).href;
13
+ }
14
+ return promiseResolve(opts);
15
+ };
16
+
17
+ patchBrowser().then(async (options) => {
18
+ await globalScripts();
19
+ return bootstrapLazy([["pam-consent-item_2",[[1,"pam-consent-modal-gm2",{"endpoint":[513],"session":[513],"language":[1537],"includeSubmitButton":[516,"include-submit-button"],"includeRejectButton":[516,"include-reject-button"],"includeRejectText":[516,"include-reject-text"],"allowedCategoryGroups":[513,"allowed-category-groups"],"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]},[[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"],"queried":["handleQueriedChange"]}]]]], options);
20
+ });
@@ -0,0 +1 @@
1
+ module.exports = require('./cjs/index.cjs.js');
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from './esm/index.js';
@@ -0,0 +1 @@
1
+ export{P as PamConsentModalGm2}from"./p-7138ec54.js";import"./p-0acedac1.js";
@@ -0,0 +1,2 @@
1
+ var e=Object.defineProperty,t=new WeakMap,n=e=>t.get(e),l=(e,n)=>t.set(n.t=e,n),o=(e,t)=>t in e,s=(e,t)=>(0,console.error)(e,t),r=new Map,i=new Map,c="slot-fb{display:contents}slot-fb[hidden]{display:none}",u="undefined"!=typeof window?window:{},a=u.document||{head:{}},f={l:0,o:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},h=e=>Promise.resolve(e),p=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),d=!1,m=[],y=[],w=(e,t)=>n=>{e.push(n),d||(d=!0,t&&4&f.l?$(b):f.raf(b))},v=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){s(e)}e.length=0},b=()=>{v(m),v(y),(d=m.length>0)&&f.raf(b)},$=e=>h().then(e),g=w(y,!0),S={},j=e=>"object"==(e=typeof e)||"function"===e;function k(e){var t,n,l;return null!=(l=null==(n=null==(t=e.head)?void 0:t.querySelector('meta[name="csp-nonce"]'))?void 0:n.getAttribute("content"))?l:void 0}((t,n)=>{for(var l in n)e(t,l,{get:n[l],enumerable:!0})})({},{err:()=>E,map:()=>C,ok:()=>O,unwrap:()=>P,unwrapErr:()=>L});var O=e=>({isOk:!0,isErr:!1,value:e}),E=e=>({isOk:!1,isErr:!0,value:e});function C(e,t){if(e.isOk){const n=t(e.value);return n instanceof Promise?n.then((e=>O(e))):O(n)}if(e.isErr)return E(e.value);throw"should never get here"}var M,x,P=e=>{if(e.isOk)return e.value;throw e.value},L=e=>{if(e.isErr)return e.value;throw e.value},R=(e,t,...n)=>{let l=null,o=null,s=!1,r=!1;const i=[],c=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?c(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!j(l))&&(l+=""),s&&r?i[i.length-1].i+=l:i.push(s?T(null,l):l),r=s)};if(c(n),t){t.key&&(o=t.key);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}}const u=T(e,null);return u.u=t,i.length>0&&(u.h=i),u.p=o,u},T=(e,t)=>({l:0,m:e,i:t,v:null,h:null,u:null,p:null}),A={},N=(e,t,l)=>{const o=(e=>n(e).$hostElement$)(e);return{emit:e=>U(o,t,{bubbles:!!(4&l),composed:!!(2&l),cancelable:!!(1&l),detail:e})}},U=(e,t,n)=>{const l=f.ce(t,n);return e.dispatchEvent(l),l},W=new WeakMap,D=e=>"sc-"+e.$,F=(e,t,n,l,s,r)=>{if(n!==l){let i=o(e,t),c=t.toLowerCase();if("class"===t){const t=e.classList,o=q(n),s=q(l);t.remove(...o.filter((e=>e&&!s.includes(e)))),t.add(...s.filter((e=>e&&!o.includes(e))))}else if("key"===t);else if("ref"===t)l&&l(e);else if(i||"o"!==t[0]||"n"!==t[1]){const o=j(l);if((i||o&&null!==l)&&!s)try{if(e.tagName.includes("-"))e[t]=l;else{const o=null==l?"":l;"list"===t?i=!1:null!=n&&e[t]==o||(e[t]=o)}}catch(e){}null==l||!1===l?!1===l&&""!==e.getAttribute(t)||e.removeAttribute(t):(!i||4&r||s)&&!o&&e.setAttribute(t,l=!0===l?"":l)}else if(t="-"===t[2]?t.slice(3):o(u,c)?c.slice(2):c[2]+t.slice(3),n||l){const o=t.endsWith(G);t=t.replace(V,""),n&&f.rel(e,t,n,o),l&&f.ael(e,t,l,o)}}},H=/\s/,q=e=>e?e.split(H):[],G="Capture",V=RegExp(G+"$"),_=(e,t,n)=>{const l=11===t.v.nodeType&&t.v.host?t.v.host:t.v,o=e&&e.u||S,s=t.u||S;for(const e of z(Object.keys(o)))e in s||F(l,e,o[e],void 0,n,t.l);for(const e of z(Object.keys(s)))F(l,e,o[e],s[e],n,t.l)};function z(e){return e.includes("ref")?[...e.filter((e=>"ref"!==e)),"ref"]:e}var B=!1,I=!1,J=(e,t,n)=>{const l=t.h[n];let o,s,r=0;if(null!==l.i)o=l.v=a.createTextNode(l.i);else{if(I||(I="svg"===l.m),o=l.v=a.createElementNS(I?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",l.m),I&&"foreignObject"===l.m&&(I=!1),_(null,l,I),null!=M&&o["s-si"]!==M&&o.classList.add(o["s-si"]=M),l.h)for(r=0;r<l.h.length;++r)s=J(e,l,r),s&&o.appendChild(s);"svg"===l.m?I=!1:"foreignObject"===o.tagName&&(I=!0)}return o["s-hn"]=x,o},K=(e,t,n,l,o,s)=>{let r,i=e;for(i.shadowRoot&&i.tagName===x&&(i=i.shadowRoot);o<=s;++o)l[o]&&(r=J(null,n,o),r&&(l[o].v=r,ee(i,r,t)))},Q=(e,t,n)=>{for(let l=t;l<=n;++l){const t=e[l];if(t){const e=t.v;Z(t),e&&e.remove()}}},X=(e,t,n=!1)=>e.m===t.m&&(!!n||e.p===t.p),Y=(e,t,n=!1)=>{const l=t.v=e.v,o=e.h,s=t.h,r=t.m,i=t.i;null===i?(I="svg"===r||"foreignObject"!==r&&I,("slot"!==r||B)&&_(e,t,I),null!==o&&null!==s?((e,t,n,l,o=!1)=>{let s,r,i=0,c=0,u=0,a=0,f=t.length-1,h=t[0],p=t[f],d=l.length-1,m=l[0],y=l[d];for(;i<=f&&c<=d;)if(null==h)h=t[++i];else if(null==p)p=t[--f];else if(null==m)m=l[++c];else if(null==y)y=l[--d];else if(X(h,m,o))Y(h,m,o),h=t[++i],m=l[++c];else if(X(p,y,o))Y(p,y,o),p=t[--f],y=l[--d];else if(X(h,y,o))Y(h,y,o),ee(e,h.v,p.v.nextSibling),h=t[++i],y=l[--d];else if(X(p,m,o))Y(p,m,o),ee(e,p.v,h.v),p=t[--f],m=l[++c];else{for(u=-1,a=i;a<=f;++a)if(t[a]&&null!==t[a].p&&t[a].p===m.p){u=a;break}u>=0?(r=t[u],r.m!==m.m?s=J(t&&t[c],n,u):(Y(r,m,o),t[u]=void 0,s=r.v),m=l[++c]):(s=J(t&&t[c],n,c),m=l[++c]),s&&ee(h.v.parentNode,s,h.v)}i>f?K(e,null==l[d+1]?null:l[d+1].v,n,l,c,d):c>d&&Q(t,i,f)})(l,o,t,s,n):null!==s?(null!==e.i&&(l.textContent=""),K(l,null,t,s,0,s.length-1)):null!==o&&Q(o,0,o.length-1),I&&"svg"===r&&(I=!1)):e.i!==i&&(l.data=i)},Z=e=>{e.u&&e.u.ref&&e.u.ref(null),e.h&&e.h.map(Z)},ee=(e,t,n)=>null==e?void 0:e.insertBefore(t,n),te=(e,t)=>{t&&!e.S&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.S=t)))},ne=(e,t)=>{if(e.l|=16,!(4&e.l))return te(e,e.j),g((()=>le(e,t)));e.l|=512},le=(e,t)=>{const n=e.t;if(!n)throw Error(`Can't render component <${e.$hostElement$.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let l;return t&&(e.l|=256,e.k&&(e.k.map((([e,t])=>ae(n,e,t))),e.k=void 0),l=ae(n,"componentWillLoad")),oe(l,(()=>re(e,n,t)))},oe=(e,t)=>se(e)?e.then(t).catch((e=>{console.error(e),t()})):t(),se=e=>e instanceof Promise||e&&e.then&&"function"==typeof e.then,re=async(e,t,n)=>{var l;const o=e.$hostElement$,s=o["s-rc"];n&&(e=>{const t=e.O,n=e.$hostElement$,l=t.l,o=((e,t)=>{var n;const l=D(t),o=i.get(l);if(e=11===e.nodeType?e:a,o)if("string"==typeof o){let s,r=W.get(e=e.head||e);if(r||W.set(e,r=new Set),!r.has(l)){{s=a.createElement("style"),s.innerHTML=o;const t=null!=(n=f.C)?n:k(a);null!=t&&s.setAttribute("nonce",t),e.insertBefore(s,e.querySelector("link"))}4&t.l&&(s.innerHTML+=c),r&&r.add(l)}}else e.adoptedStyleSheets.includes(o)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,o]);return l})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(e);ie(e,t,o,n),s&&(s.map((e=>e())),o["s-rc"]=void 0);{const t=null!=(l=o["s-p"])?l:[],n=()=>ce(e);0===t.length?n():(Promise.all(t).then(n),e.l|=4,t.length=0)}},ie=(e,t,n,l)=>{try{t=t.render(),e.l&=-17,e.l|=2,((e,t,n=!1)=>{const l=e.$hostElement$,o=e.O,s=e.M||T(null,null),r=(e=>e&&e.m===A)(t)?t:R(null,null,t);if(x=l.tagName,o.P&&(r.u=r.u||{},o.P.map((([e,t])=>r.u[t]=l[e]))),n&&r.u)for(const e of Object.keys(r.u))l.hasAttribute(e)&&!["key","ref","style","class"].includes(e)&&(r.u[e]=l[e]);r.m=null,r.l|=4,e.M=r,r.v=s.v=l.shadowRoot||l,M=l["s-sc"],B=!!(1&o.l),Y(s,r,n)})(e,t,l)}catch(t){s(t,e.$hostElement$)}return null},ce=e=>{const t=e.$hostElement$,n=e.t,l=e.j;64&e.l||(e.l|=64,fe(t),ae(n,"componentDidLoad"),e.L(t),l||ue()),e.S&&(e.S(),e.S=void 0),512&e.l&&$((()=>ne(e,!1))),e.l&=-517},ue=()=>{fe(a.documentElement),$((()=>U(u,"appload",{detail:{namespace:"pam-consent-modal-gm2"}})))},ae=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){s(e)}},fe=e=>e.classList.add("hydrated"),he=(e,t,l)=>{var o,r;const i=e.prototype;if(t.R||t.T||e.watchers){e.watchers&&!t.T&&(t.T=e.watchers);const c=Object.entries(null!=(o=t.R)?o:{});if(c.map((([e,[o]])=>{(31&o||2&l&&32&o)&&Object.defineProperty(i,e,{get(){return((e,t)=>n(this).A.get(t))(0,e)},set(l){((e,t,l,o)=>{const r=n(e);if(!r)throw Error(`Couldn't find host element for "${o.$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`);const i=r.$hostElement$,c=r.A.get(t),u=r.l,a=r.t;if(l=((e,t)=>null==e||j(e)?e:4&t?"false"!==e&&(""===e||!!e):1&t?e+"":e)(l,o.R[t][0]),(!(8&u)||void 0===c)&&l!==c&&(!Number.isNaN(c)||!Number.isNaN(l))&&(r.A.set(t,l),a)){if(o.T&&128&u){const e=o.T[t];e&&e.map((e=>{try{a[e](l,c,t)}catch(e){s(e,i)}}))}2==(18&u)&&ne(r,!1)}})(this,e,l,t)},configurable:!0,enumerable:!0})})),1&l){const l=new Map;i.attributeChangedCallback=function(e,o,s){f.jmp((()=>{var r;const c=l.get(e);if(this.hasOwnProperty(c))s=this[c],delete this[c];else{if(i.hasOwnProperty(c)&&"number"==typeof this[c]&&this[c]==s)return;if(null==c){const l=n(this),i=null==l?void 0:l.l;if(i&&!(8&i)&&128&i&&s!==o){const n=l.t,i=null==(r=t.T)?void 0:r[e];null==i||i.forEach((t=>{null!=n[t]&&n[t].call(n,s,o,e)}))}return}}this[c]=(null!==s||"boolean"!=typeof this[c])&&s}))},e.observedAttributes=Array.from(new Set([...Object.keys(null!=(r=t.T)?r:{}),...c.filter((([e,t])=>15&t[0])).map((([e,n])=>{var o;const s=n[1]||e;return l.set(s,e),512&n[0]&&(null==(o=t.P)||o.push([e,s])),s}))]))}}return e},pe=e=>{ae(e,"disconnectedCallback")},de=(e,l={})=>{var o;const h=[],d=l.exclude||[],m=u.customElements,y=a.head,w=y.querySelector("meta[charset]"),v=a.createElement("style"),b=[];let $,g=!0;Object.assign(f,l),f.o=new URL(l.resourcesUrl||"./",a.baseURI).href;let S=!1;if(e.map((e=>{e[1].map((l=>{var o;const c={l:l[0],$:l[1],R:l[2],N:l[3]};4&c.l&&(S=!0),c.R=l[2],c.N=l[3],c.P=[],c.T=null!=(o=l[4])?o:{};const u=c.$,a=class extends HTMLElement{constructor(e){if(super(e),this.hasRegisteredEventListeners=!1,((e,n)=>{const l={l:0,$hostElement$:e,O:n,A:new Map};l.U=new Promise((e=>l.L=e)),e["s-p"]=[],e["s-rc"]=[],t.set(e,l)})(e=this,c),1&c.l)if(e.shadowRoot){if("open"!==e.shadowRoot.mode)throw Error(`Unable to re-use existing shadow root for ${c.$}! Mode is set to ${e.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else e.attachShadow({mode:"open"})}connectedCallback(){const e=n(this);this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0,me(this,e,c.N)),$&&(clearTimeout($),$=null),g?b.push(this):f.jmp((()=>(e=>{if(!(1&f.l)){const t=n(e),l=t.O,o=()=>{};if(1&t.l)me(e,t,l.N),(null==t?void 0:t.t)||(null==t?void 0:t.U)&&t.U.then((()=>{}));else{t.l|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){te(t,t.j=n);break}}l.R&&Object.entries(l.R).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n)=>{let l;if(!(32&t.l)){if(t.l|=32,n.W){const e=(e=>{const t=e.$.replace(/-/g,"_"),n=e.W;if(!n)return;const l=r.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(r.set(n,e),e[t])),s)
2
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/})(n);if(e&&"then"in e){const t=()=>{};l=await e,t()}else l=e;if(!l)throw Error(`Constructor for "${n.$}#${t.D}" was not found`);l.isProxied||(n.T=l.watchers,he(l,n,2),l.isProxied=!0);const o=()=>{};t.l|=8;try{new l(t)}catch(e){s(e)}t.l&=-9,t.l|=128,o()}else l=e.constructor,customElements.whenDefined(e.localName).then((()=>t.l|=128));if(l&&l.style){let e;"string"==typeof l.style&&(e=l.style);const t=D(n);if(!i.has(t)){const l=()=>{};((e,t,n)=>{let l=i.get(e);p&&n?(l=l||new CSSStyleSheet,"string"==typeof l?l=t:l.replaceSync(t)):l=t,i.set(e,l)})(t,e,!!(1&n.l)),l()}}}const o=t.j,c=()=>ne(t,!0);o&&o["s-rc"]?o["s-rc"].push(c):c()})(e,t,l)}o()}})(this)))}disconnectedCallback(){f.jmp((()=>(async()=>{if(!(1&f.l)){const e=n(this);e.F&&(e.F.map((e=>e())),e.F=void 0),(null==e?void 0:e.t)?pe(e.t):(null==e?void 0:e.U)&&e.U.then((()=>pe(e.t)))}})()))}componentOnReady(){return n(this).U}};c.W=e[0],d.includes(u)||m.get(u)||(h.push(u),m.define(u,he(a,c,1)))}))})),h.length>0&&(S&&(v.textContent+=c),v.textContent+=h.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",v.innerHTML.length)){v.setAttribute("data-styles","");const e=null!=(o=f.C)?o:k(a);null!=e&&v.setAttribute("nonce",e),y.insertBefore(v,w?w.nextSibling:y.firstChild)}g=!1,b.length?b.map((e=>e.connectedCallback())):f.jmp((()=>$=setTimeout(ue,30)))},me=(e,t,n)=>{n&&n.map((([n,l,o])=>{const s=e,r=ye(t,o),i=we(n);f.ael(s,l,r,i),(t.F=t.F||[]).push((()=>f.rel(s,l,r,i)))}))},ye=(e,t)=>n=>{var l;try{256&e.l?null==(l=e.t)||l[t](n):(e.k=e.k||[]).push([t,n])}catch(e){s(e)}},we=e=>({passive:!!(1&e),capture:!!(2&e)}),ve=e=>f.C=e;export{de as b,N as c,R as h,h as p,l as r,ve as s}
@@ -0,0 +1 @@
1
+ import{r as e,h as t}from"./p-0acedac1.js";const n="__WIDGET_GLOBAL_STYLE_CACHE__";function s(e,t){if(e){const n=document.createElement("style");n.innerHTML=t,e.appendChild(n)}}function o(e,t){if(!e||!t)return;const n=new URL(t);fetch(n.href).then((e=>e.text())).then((t=>{const n=document.createElement("style");n.innerHTML=t,e&&e.appendChild(n)})).catch((e=>{console.error("There was an error while trying to load client styling from URL",e)}))}function i(e,t,s,o=!1){if(!window.emMessageBus)return;if(!("adoptedStyleSheets"in Document.prototype)||!o)return s=function(e,t){const n=document.createElement("style");return window.emMessageBus.subscribe(t,(t=>{e&&(n.innerHTML=t,e.appendChild(n))}))}(e,t),s;window[n]||(window[n]={}),s=function(e,t){return window.emMessageBus.subscribe(t,(s=>{if(!e)return;const o=e.getRootNode(),i=window[n];let r=i[t]&&i[t].sheet;r?i[t].refCount=i[t].refCount+1:(r=new CSSStyleSheet,r.replaceSync(s),i[t]={sheet:r,refCount:1});const a=o.adoptedStyleSheets||[];a.includes(r)||(o.adoptedStyleSheets=[...a,r])}))}(e,t);const i=s.unsubscribe.bind(s);return s.unsubscribe=()=>{if(window[n][t]){const e=window[n][t];e.refCount>1?e.refCount=e.refCount-1:delete window[n][t]}i()},s}const r={en:{userNoticeText:"Before you can proceed you must consent to the following",submitButtonText:"Submit",rejectButtonText:"Reject",rejectText:"Rejecting new consents will result in the inability to continue the login process and you will be logged out.",consentUpdateSuccess:"Consent update successful!",serverNotResponding:"Server might not be responding"},"en-us":{userNoticeText:"Before you can proceed you must consent to the following",submitButtonText:"Submit",rejectButtonText:"Reject",rejectText:"Rejecting new consents will result in the inability to continue the login process and you will be logged out.",consentUpdateSuccess:"Consent update successful!",serverNotResponding:"Server might not be responding"},ro:{userNoticeText:"Înainte de a continua, trebuie să vă dați consimțământul pentru următoarele",submitButtonText:"Trimite",rejectButtonText:"Respinge",rejectText:"Respingerea noilor consimțăminte va duce la imposibilitatea de a continua procesul de autentificare și veți fi deconectat.",consentUpdateSuccess:"Actualizare consimțământ reușită!",serverNotResponding:"Serverul s-ar putea să nu răspundă"},hr:{userNoticeText:"Prije nego što možete nastaviti, morate pristati na sljedeće",submitButtonText:"Pošalji",rejectButtonText:"Odbij",rejectText:"Odbijanje novih pristanka rezultirat će nemogućnošću nastavka procesa prijave i bit ćete odjavljeni.",consentUpdateSuccess:"Ažuriranje pristanka uspješno!",serverNotResponding:"Poslužitelj možda ne odgovara"},fr:{userNoticeText:"Avant de continuer, vous devez consentir aux éléments suivants",submitButtonText:"Soumettre",rejectButtonText:"Rejeter",rejectText:"Le rejet des nouveaux consentements entraînera l'impossibilité de continuer le processus de connexion et vous serez déconnecté.",consentUpdateSuccess:"Mise à jour du consentement réussie!",serverNotResponding:"Le serveur ne répond peut-être pas"},cs:{userNoticeText:"Než budete moci pokračovat, musíte souhlasit s následujícím",submitButtonText:"Odeslat",rejectButtonText:"Odmítnout",rejectText:"Odmítnutí nových souhlasů povede k nemožnosti pokračovat v procesu přihlášení a budete odhlášeni.",consentUpdateSuccess:"Aktualizace souhlasu proběhla úspěšně!",serverNotResponding:"Server možná neodpovídá"},de:{userNoticeText:"Bevor Sie fortfahren können, müssen Sie den folgenden Punkten zustimmen",submitButtonText:"Absenden",rejectButtonText:"Ablehnen",rejectText:"Das Ablehnen neuer Zustimmungen führt dazu, dass der Anmeldevorgang nicht fortgesetzt werden kann und Sie abgemeldet werden.",consentUpdateSuccess:"Zustimmung erfolgreich aktualisiert!",serverNotResponding:"Der Server antwortet möglicherweise nicht"},es:{userNoticeText:"Antes de continuar, debe dar su consentimiento a lo siguiente",submitButtonText:"Enviar",rejectButtonText:"Rechazar",rejectText:"Rechazar nuevos consentimientos resultará en la imposibilidad de continuar el proceso de inicio de sesión y se cerrará la sesión.",consentUpdateSuccess:"¡Actualización del consentimiento exitosa!",serverNotResponding:"El servidor podría no estar respondiendo"},pt:{userNoticeText:"Antes de continuar, você deve consentir com o seguinte",submitButtonText:"Enviar",rejectButtonText:"Rejeitar",rejectText:"Rejeitar novos consentimentos resultará na impossibilidade de continuar o processo de login e você será desconectado.",consentUpdateSuccess:"Atualização de consentimento bem-sucedida!",serverNotResponding:"O servidor pode não estar respondendo"},"es-mx":{userNoticeText:"Antes de continuar, debe dar su consentimiento a lo siguiente",submitButtonText:"Enviar",rejectButtonText:"Rechazar",rejectText:"Rechazar nuevos consentimientos resultará en la imposibilidad de continuar el proceso de inicio de sesión y se cerrará la sesión.",consentUpdateSuccess:"¡Actualización del consentimiento exitosa!",serverNotResponding:"El servidor podría no estar respondiendo"},"pt-br":{userNoticeText:"Antes de continuar, você deve consentir com o seguinte",submitButtonText:"Enviar",rejectButtonText:"Rejeitar",rejectText:"Rejeitar novos consentimentos resultará na impossibilidade de continuar o processo de login e você será desconectado.",consentUpdateSuccess:"Atualização de consentimento bem-sucedida!",serverNotResponding:"O servidor pode não estar respondendo"}},a=(e,t,n)=>{let s=r[void 0!==t&&t in r?t:"en"][e];if(void 0!==n)for(const[e,t]of Object.entries(n.values)){const n=new RegExp(`{${e}}`,"g");s=s.replace(n,t)}return s},c=class{constructor(t){e(this,t),this.consentStatuses={ACCEPTED:"Accepted",DENIED:"Denied"},this.userConsents=[],this.consentConfig=[],this.allowedCategoryGroupsArray=[],this.mandatoryTagCodes=new Set,this.handleApplyClick=()=>{this.isQueryFired=!0},this.handleReject=()=>{const e=new URL("/v2/player/session/player/",this.endpoint),t=new Headers;t.append("Content-type","application/json"),t.append("X-SessionID",this.session),fetch(e.href,{method:"DELETE",headers:t}).then((()=>{window.postMessage({type:"LogoutSuccessfull"},window.location.href),((e,t={})=>{const n=new CustomEvent("track-custom-event",{detail:{type:"logged_out",data:t},bubbles:!0,composed:!0});document.dispatchEvent(n)})(0,{})}))},this.endpoint=void 0,this.session=void 0,this.language="en",this.includeSubmitButton=void 0,this.includeRejectButton=void 0,this.includeRejectText=void 0,this.allowedCategoryGroups="Sports, Casino, VirtualSports, Bingo",this.translationUrl="",this.clientStyling="",this.clientStylingUrl="",this.mbSource=void 0,this.isLoading=!0,this.isValid=!0,this.isQueryFired=!1,this.receivedQueryResponses=0,this.mandatoryConsentsChecked=0,this.mandatoryConsentsCount=0}handleClientStylingChange(e,t){e!=t&&s(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(e,t){e!=t&&o(this.stylingContainer,this.clientStylingUrl)}handleMbSourceChange(e,t){e!=t&&i(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription)}handleQueryResponse(){this.receivedQueryResponses===this.consentConfig.length&&this.updateConsents()}userLegislationConsentHandler(e){for(const t of e.detail)this.mandatoryTagCodes.has(t.type)&&!1===this.isQueryFired&&(!0===t.value?this.mandatoryConsentsChecked++:this.mandatoryConsentsChecked--),this.isQueryFired&&this.userConsents.push({tagCode:t.type,status:t.value?this.consentStatuses.ACCEPTED:this.consentStatuses.DENIED});this.isQueryFired&&this.receivedQueryResponses++}async componentWillLoad(){var e;this.allowedCategoryGroupsArray=this.allowedCategoryGroups.split(",").map((e=>e.trim())),this.getConsents().then((e=>{this.setConsentConfig(e),window.postMessage({type:"UserActionsExists",displayUserActions:this.mandatoryConsentsCount>0},window.location.href)})),this.translationUrl.length>2&&await(e=this.translationUrl,new Promise((t=>{fetch(e).then((e=>e.json())).then((e=>{Object.keys(e).forEach((t=>{r[t]||(r[t]={});for(let n in e[t])r[t][n]=e[t][n]})),t(!0)}))})))}componentDidLoad(){this.stylingContainer&&(this.mbSource&&i(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription),this.clientStyling&&s(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&o(this.stylingContainer,this.clientStylingUrl))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}getConsents(){const e=new URL("/api/v2/gm/legislation/consents/requirements",this.endpoint);return e.searchParams.set("loginSessionId",this.session),fetch(e.href,{method:"GET"}).then((e=>{if(200===e.status)return e.json();throw new Error(String(e.status))})).catch((e=>(console.error("Error fetching data:",e),null))).finally((()=>{this.isLoading=!1}))}setConsentConfig(e){for(const t of e){const e=t.mustAccept;e&&(++this.mandatoryConsentsCount,this.mandatoryTagCodes.add(t.tagCode));const n=t.category.categoryTagCode;if(this.allowedCategoryGroupsArray.includes(n)){const s=this.consentConfig.find((e=>e.group===n.toLowerCase()));s?(s.consentTypes+=","+t.tagCode,s.mandatory+=","+String(e)):this.consentConfig.push({consentTypes:t.tagCode,group:n.toLowerCase(),mandatory:String(e)})}else this.consentConfig.push({consentTypes:t.tagCode,group:"",mandatory:String(e)})}}updateConsents(){const e=new URL("/api/v2/gm/legislation/consents/login",this.endpoint);e.searchParams.set("loginSessionId",this.session);const t=new Headers;t.append("Content-Type","application/json"),t.append("Accept","application/json");const n=JSON.stringify({note:"",userConsents:this.userConsents});fetch(e.href,{method:"PATCH",headers:t,body:n}).then((e=>e.json())).then((()=>{window.postMessage({type:"WidgetNotification",data:{type:"success",message:a("consentUpdateSuccess",this.language)}},window.location.href)})).catch((e=>{window.postMessage({type:"WidgetNotification",data:{type:"error",message:a("serverNotResponding",this.language),err:e}},window.location.href)})).finally((()=>{window.postMessage({type:"UserActionsCompleted"},window.location.href)}))}render(){return this.isValid=this.mandatoryConsentsChecked===this.mandatoryConsentsCount,t("div",{key:"90e9076be34bb3556ee584768cf255bc07ef453b",class:"QueryReferenceContainer",ref:e=>this.stylingContainer=e},this.isLoading?t("div",null,t("slot",{name:"spinner"}),t("svg",{class:"spinner",viewBox:"0 0 50 50"},t("circle",{class:"path",cx:"25",cy:"25",r:"20",fill:"none","stroke-width":"5"}))):t("div",{class:"PamConsentModal"},t("h2",{class:"ConsentNotice"},a("userNoticeText",this.language)),t("div",{class:"ConsentsWrapper"},this.consentConfig.map((e=>t("slot",{name:e.group||e.consentTypes},t("pam-consent-item",{language:this.language,"translation-url":this.translationUrl,group:e.group,consentTypes:e.consentTypes,queried:this.isQueryFired,mandatory:e.mandatory,"client-styling-url":this.clientStylingUrl,"mb-source":this.mbSource,"client-styling":this.clientStyling}))))),t("div",{class:"ButtonsWrapper"},this.includeRejectButton&&t("button",{class:"ConsentRejectButton",onClick:this.handleReject},a("rejectButtonText",this.language)),this.includeSubmitButton&&t("button",{class:"ConsentSubmitButton",disabled:!this.isValid,onClick:this.handleApplyClick},a("submitButtonText",this.language))),this.includeRejectText&&t("p",{class:"RejectText"},a("rejectText",this.language))))}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"],receivedQueryResponses:["handleQueryResponse"]}}};c.style=":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}}";export{c as P,o as a,i as b,s}
@@ -0,0 +1 @@
1
+ const o=()=>{};export{o as g}