@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,474 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-7739e965.js');
4
+
5
+ const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
6
+
7
+ /**
8
+ * @name setClientStyling
9
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
10
+ * @param {HTMLElement} stylingContainer The reference element of the widget
11
+ * @param {string} clientStyling The style content
12
+ */
13
+ function setClientStyling(stylingContainer, clientStyling) {
14
+ if (stylingContainer) {
15
+ const sheet = document.createElement('style');
16
+ sheet.innerHTML = clientStyling;
17
+ stylingContainer.appendChild(sheet);
18
+ }
19
+ }
20
+
21
+ /**
22
+ * @name setClientStylingURL
23
+ * @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
24
+ * @param {HTMLElement} stylingContainer The reference element of the widget
25
+ * @param {string} clientStylingUrl The URL of the style content
26
+ */
27
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
28
+ if (!stylingContainer || !clientStylingUrl) return;
29
+
30
+ const url = new URL(clientStylingUrl);
31
+
32
+ fetch(url.href)
33
+ .then((res) => res.text())
34
+ .then((data) => {
35
+ const cssFile = document.createElement('style');
36
+ cssFile.innerHTML = data;
37
+ if (stylingContainer) {
38
+ stylingContainer.appendChild(cssFile);
39
+ }
40
+ })
41
+ .catch((err) => {
42
+ console.error('There was an error while trying to load client styling from URL', err);
43
+ });
44
+ }
45
+
46
+ /**
47
+ * @name setStreamLibrary
48
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
49
+ * @param {HTMLElement} stylingContainer The highest element of the widget
50
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
51
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
52
+ * @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
53
+ */
54
+ function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
55
+ if (!window.emMessageBus) return;
56
+
57
+ const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
58
+
59
+ if (!supportAdoptStyle || !useAdoptedStyleSheets) {
60
+ subscription = getStyleTagSubscription(stylingContainer, domain);
61
+
62
+ return subscription;
63
+ }
64
+
65
+ if (!window[StyleCacheKey]) {
66
+ window[StyleCacheKey] = {};
67
+ }
68
+ subscription = getAdoptStyleSubscription(stylingContainer, domain);
69
+
70
+ const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
71
+ const wrappedUnsubscribe = () => {
72
+ if (window[StyleCacheKey][domain]) {
73
+ const cachedObject = window[StyleCacheKey][domain];
74
+ cachedObject.refCount > 1
75
+ ? (cachedObject.refCount = cachedObject.refCount - 1)
76
+ : delete window[StyleCacheKey][domain];
77
+ }
78
+
79
+ originalUnsubscribe();
80
+ };
81
+ subscription.unsubscribe = wrappedUnsubscribe;
82
+
83
+ return subscription;
84
+ }
85
+
86
+ function getStyleTagSubscription(stylingContainer, domain) {
87
+ const sheet = document.createElement('style');
88
+
89
+ return window.emMessageBus.subscribe(domain, (data) => {
90
+ if (stylingContainer) {
91
+ sheet.innerHTML = data;
92
+ stylingContainer.appendChild(sheet);
93
+ }
94
+ });
95
+ }
96
+
97
+ function getAdoptStyleSubscription(stylingContainer, domain) {
98
+ return window.emMessageBus.subscribe(domain, (data) => {
99
+ if (!stylingContainer) return;
100
+
101
+ const shadowRoot = stylingContainer.getRootNode();
102
+ const cacheStyleObject = window[StyleCacheKey];
103
+ let cachedStyle = cacheStyleObject[domain] && cacheStyleObject[domain].sheet;
104
+
105
+ if (!cachedStyle) {
106
+ cachedStyle = new CSSStyleSheet();
107
+ cachedStyle.replaceSync(data);
108
+ cacheStyleObject[domain] = {
109
+ sheet: cachedStyle,
110
+ refCount: 1
111
+ };
112
+ } else {
113
+ cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
114
+ }
115
+
116
+ const currentSheets = shadowRoot.adoptedStyleSheets || [];
117
+ if (!currentSheets.includes(cachedStyle)) {
118
+ shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
119
+ }
120
+ });
121
+ }
122
+
123
+ /**
124
+ * @name dispatchCustomEvent
125
+ * @description dispatches the custom event CustomEventProcessor is listening for
126
+ * @param {string} type of the custom event
127
+ * @param {Object} data may contain additional information about the event, e.g. userId
128
+ */
129
+ const dispatchCustomEvent = (type, data = {}) => {
130
+ const event = new CustomEvent('track-custom-event', {
131
+ detail: {
132
+ type,
133
+ data
134
+ },
135
+ bubbles: true,
136
+ composed: true
137
+ });
138
+
139
+ document.dispatchEvent(event);
140
+ };
141
+
142
+ const DEFAULT_LANGUAGE = 'en';
143
+ const TRANSLATIONS = {
144
+ en: {
145
+ userNoticeText: 'Before you can proceed you must consent to the following',
146
+ submitButtonText: 'Submit',
147
+ rejectButtonText: 'Reject',
148
+ rejectText: 'Rejecting new consents will result in the inability to continue the login process and you will be logged out.',
149
+ consentUpdateSuccess: 'Consent update successful!',
150
+ serverNotResponding: 'Server might not be responding'
151
+ },
152
+ 'en-us': {
153
+ userNoticeText: 'Before you can proceed you must consent to the following',
154
+ submitButtonText: 'Submit',
155
+ rejectButtonText: 'Reject',
156
+ rejectText: 'Rejecting new consents will result in the inability to continue the login process and you will be logged out.',
157
+ consentUpdateSuccess: 'Consent update successful!',
158
+ serverNotResponding: 'Server might not be responding'
159
+ },
160
+ ro: {
161
+ userNoticeText: 'Înainte de a continua, trebuie să vă dați consimțământul pentru următoarele',
162
+ submitButtonText: 'Trimite',
163
+ rejectButtonText: 'Respinge',
164
+ rejectText: 'Respingerea noilor consimțăminte va duce la imposibilitatea de a continua procesul de autentificare și veți fi deconectat.',
165
+ consentUpdateSuccess: 'Actualizare consimțământ reușită!',
166
+ serverNotResponding: 'Serverul s-ar putea să nu răspundă'
167
+ },
168
+ hr: {
169
+ userNoticeText: 'Prije nego što možete nastaviti, morate pristati na sljedeće',
170
+ submitButtonText: 'Pošalji',
171
+ rejectButtonText: 'Odbij',
172
+ rejectText: 'Odbijanje novih pristanka rezultirat će nemogućnošću nastavka procesa prijave i bit ćete odjavljeni.',
173
+ consentUpdateSuccess: 'Ažuriranje pristanka uspješno!',
174
+ serverNotResponding: 'Poslužitelj možda ne odgovara'
175
+ },
176
+ fr: {
177
+ userNoticeText: 'Avant de continuer, vous devez consentir aux éléments suivants',
178
+ submitButtonText: 'Soumettre',
179
+ rejectButtonText: 'Rejeter',
180
+ rejectText: 'Le rejet des nouveaux consentements entraînera l\'impossibilité de continuer le processus de connexion et vous serez déconnecté.',
181
+ consentUpdateSuccess: 'Mise à jour du consentement réussie!',
182
+ serverNotResponding: 'Le serveur ne répond peut-être pas'
183
+ },
184
+ cs: {
185
+ userNoticeText: 'Než budete moci pokračovat, musíte souhlasit s následujícím',
186
+ submitButtonText: 'Odeslat',
187
+ rejectButtonText: 'Odmítnout',
188
+ rejectText: 'Odmítnutí nových souhlasů povede k nemožnosti pokračovat v procesu přihlášení a budete odhlášeni.',
189
+ consentUpdateSuccess: 'Aktualizace souhlasu proběhla úspěšně!',
190
+ serverNotResponding: 'Server možná neodpovídá'
191
+ },
192
+ de: {
193
+ userNoticeText: 'Bevor Sie fortfahren können, müssen Sie den folgenden Punkten zustimmen',
194
+ submitButtonText: 'Absenden',
195
+ rejectButtonText: 'Ablehnen',
196
+ rejectText: 'Das Ablehnen neuer Zustimmungen führt dazu, dass der Anmeldevorgang nicht fortgesetzt werden kann und Sie abgemeldet werden.',
197
+ consentUpdateSuccess: 'Zustimmung erfolgreich aktualisiert!',
198
+ serverNotResponding: 'Der Server antwortet möglicherweise nicht'
199
+ },
200
+ es: {
201
+ userNoticeText: 'Antes de continuar, debe dar su consentimiento a lo siguiente',
202
+ submitButtonText: 'Enviar',
203
+ rejectButtonText: 'Rechazar',
204
+ rejectText: 'Rechazar nuevos consentimientos resultará en la imposibilidad de continuar el proceso de inicio de sesión y se cerrará la sesión.',
205
+ consentUpdateSuccess: '¡Actualización del consentimiento exitosa!',
206
+ serverNotResponding: 'El servidor podría no estar respondiendo'
207
+ },
208
+ pt: {
209
+ userNoticeText: 'Antes de continuar, você deve consentir com o seguinte',
210
+ submitButtonText: 'Enviar',
211
+ rejectButtonText: 'Rejeitar',
212
+ rejectText: 'Rejeitar novos consentimentos resultará na impossibilidade de continuar o processo de login e você será desconectado.',
213
+ consentUpdateSuccess: 'Atualização de consentimento bem-sucedida!',
214
+ serverNotResponding: 'O servidor pode não estar respondendo'
215
+ },
216
+ 'es-mx': {
217
+ userNoticeText: 'Antes de continuar, debe dar su consentimiento a lo siguiente',
218
+ submitButtonText: 'Enviar',
219
+ rejectButtonText: 'Rechazar',
220
+ rejectText: 'Rechazar nuevos consentimientos resultará en la imposibilidad de continuar el proceso de inicio de sesión y se cerrará la sesión.',
221
+ consentUpdateSuccess: '¡Actualización del consentimiento exitosa!',
222
+ serverNotResponding: 'El servidor podría no estar respondiendo'
223
+ },
224
+ 'pt-br': {
225
+ userNoticeText: 'Antes de continuar, você deve consentir com o seguinte',
226
+ submitButtonText: 'Enviar',
227
+ rejectButtonText: 'Rejeitar',
228
+ rejectText: 'Rejeitar novos consentimentos resultará na impossibilidade de continuar o processo de login e você será desconectado.',
229
+ consentUpdateSuccess: 'Atualização de consentimento bem-sucedida!',
230
+ serverNotResponding: 'O servidor pode não estar respondendo'
231
+ }
232
+ };
233
+ const getTranslations = (url) => {
234
+ return new Promise((resolve) => {
235
+ fetch(url)
236
+ .then((res) => res.json())
237
+ .then((data) => {
238
+ Object.keys(data).forEach((lang) => {
239
+ if (!TRANSLATIONS[lang]) {
240
+ TRANSLATIONS[lang] = {};
241
+ }
242
+ for (let key in data[lang]) {
243
+ TRANSLATIONS[lang][key] = data[lang][key];
244
+ }
245
+ });
246
+ resolve(true);
247
+ });
248
+ });
249
+ };
250
+ const translate = (key, customLang, values) => {
251
+ const lang = customLang;
252
+ let translation = TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
253
+ if (values !== undefined) {
254
+ for (const [key, value] of Object.entries(values.values)) {
255
+ const regex = new RegExp(`{${key}}`, 'g');
256
+ translation = translation.replace(regex, value);
257
+ }
258
+ }
259
+ return translation;
260
+ };
261
+
262
+ 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}}";
263
+ const PamConsentModalGm2Style0 = pamConsentModalGm2Css;
264
+
265
+ const PamConsentModalGm2 = class {
266
+ constructor(hostRef) {
267
+ index.registerInstance(this, hostRef);
268
+ this.consentStatuses = { ACCEPTED: 'Accepted', DENIED: 'Denied' };
269
+ /** This obj is passed to the api on consent update */
270
+ this.userConsents = [];
271
+ /** Used to render consents */
272
+ this.consentConfig = [];
273
+ this.allowedCategoryGroupsArray = [];
274
+ this.mandatoryTagCodes = new Set();
275
+ this.handleApplyClick = () => {
276
+ this.isQueryFired = true;
277
+ };
278
+ this.handleReject = () => {
279
+ const url = new URL('/v2/player/session/player/', this.endpoint);
280
+ const headers = new Headers();
281
+ headers.append('Content-type', 'application/json');
282
+ headers.append('X-SessionID', this.session);
283
+ const options = {
284
+ method: 'DELETE',
285
+ headers: headers
286
+ };
287
+ fetch(url.href, options)
288
+ .then(() => {
289
+ window.postMessage({ type: 'LogoutSuccessfull' }, window.location.href);
290
+ dispatchCustomEvent('logged_out', {});
291
+ });
292
+ };
293
+ this.endpoint = undefined;
294
+ this.session = undefined;
295
+ this.language = 'en';
296
+ this.includeSubmitButton = undefined;
297
+ this.includeRejectButton = undefined;
298
+ this.includeRejectText = undefined;
299
+ this.allowedCategoryGroups = 'Sports, Casino, VirtualSports, Bingo';
300
+ this.translationUrl = '';
301
+ this.clientStyling = '';
302
+ this.clientStylingUrl = '';
303
+ this.mbSource = undefined;
304
+ this.isLoading = true;
305
+ this.isValid = true;
306
+ this.isQueryFired = false;
307
+ this.receivedQueryResponses = 0;
308
+ this.mandatoryConsentsChecked = 0;
309
+ this.mandatoryConsentsCount = 0;
310
+ }
311
+ handleClientStylingChange(newValue, oldValue) {
312
+ if (newValue != oldValue) {
313
+ setClientStyling(this.stylingContainer, this.clientStyling);
314
+ }
315
+ }
316
+ handleClientStylingUrlChange(newValue, oldValue) {
317
+ if (newValue != oldValue) {
318
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
319
+ }
320
+ }
321
+ handleMbSourceChange(newValue, oldValue) {
322
+ if (newValue != oldValue) {
323
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
324
+ }
325
+ }
326
+ handleQueryResponse() {
327
+ if (this.receivedQueryResponses === this.consentConfig.length) {
328
+ this.updateConsents();
329
+ }
330
+ }
331
+ userLegislationConsentHandler(event) {
332
+ for (const consent of event.detail) {
333
+ if (this.mandatoryTagCodes.has(consent.type) && this.isQueryFired === false) {
334
+ consent.value === true ? this.mandatoryConsentsChecked++ : this.mandatoryConsentsChecked--;
335
+ }
336
+ // Register final user choices only if we're ready to update
337
+ if (this.isQueryFired) {
338
+ this.userConsents.push({
339
+ tagCode: consent.type,
340
+ status: consent.value ? this.consentStatuses.ACCEPTED : this.consentStatuses.DENIED,
341
+ });
342
+ }
343
+ }
344
+ if (this.isQueryFired) {
345
+ this.receivedQueryResponses++;
346
+ }
347
+ }
348
+ async componentWillLoad() {
349
+ this.allowedCategoryGroupsArray = this.allowedCategoryGroups.split(',').map(item => item.trim());
350
+ this.getConsents().then(consents => {
351
+ this.setConsentConfig(consents);
352
+ window.postMessage({ type: 'UserActionsExists', displayUserActions: this.mandatoryConsentsCount > 0 }, window.location.href);
353
+ });
354
+ if (this.translationUrl.length > 2) {
355
+ await getTranslations(this.translationUrl);
356
+ }
357
+ }
358
+ componentDidLoad() {
359
+ if (this.stylingContainer) {
360
+ if (this.mbSource)
361
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
362
+ if (this.clientStyling)
363
+ setClientStyling(this.stylingContainer, this.clientStyling);
364
+ if (this.clientStylingUrl)
365
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
366
+ }
367
+ }
368
+ disconnectedCallback() {
369
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
370
+ }
371
+ getConsents() {
372
+ const url = new URL('/api/v2/gm/legislation/consents/requirements', this.endpoint);
373
+ url.searchParams.set('loginSessionId', this.session);
374
+ const options = { method: 'GET' };
375
+ return fetch(url.href, options)
376
+ .then(res => {
377
+ if (res.status === 200) {
378
+ return res.json();
379
+ }
380
+ throw new Error(String(res.status));
381
+ })
382
+ .catch(error => {
383
+ console.error('Error fetching data:', error);
384
+ return null;
385
+ })
386
+ .finally(() => { this.isLoading = false; });
387
+ }
388
+ setConsentConfig(consents) {
389
+ for (const consent of consents) {
390
+ const mandatory = consent.mustAccept;
391
+ if (mandatory) {
392
+ ++this.mandatoryConsentsCount;
393
+ this.mandatoryTagCodes.add(consent.tagCode);
394
+ }
395
+ const categoryCode = consent.category.categoryTagCode;
396
+ if (this.allowedCategoryGroupsArray.includes(categoryCode)) {
397
+ const target = this.consentConfig.find(c => c.group === categoryCode.toLowerCase());
398
+ if (target) {
399
+ target.consentTypes += (',' + consent.tagCode);
400
+ target.mandatory += (',' + String(mandatory));
401
+ }
402
+ else {
403
+ this.consentConfig.push({
404
+ consentTypes: consent.tagCode,
405
+ group: categoryCode.toLowerCase(),
406
+ mandatory: String(mandatory)
407
+ });
408
+ }
409
+ }
410
+ else {
411
+ this.consentConfig.push({
412
+ consentTypes: consent.tagCode,
413
+ group: '',
414
+ mandatory: String(mandatory)
415
+ });
416
+ }
417
+ }
418
+ }
419
+ updateConsents() {
420
+ const url = new URL('/api/v2/gm/legislation/consents/login', this.endpoint);
421
+ url.searchParams.set('loginSessionId', this.session);
422
+ const headers = new Headers();
423
+ headers.append('Content-Type', 'application/json');
424
+ headers.append('Accept', 'application/json');
425
+ const body = JSON.stringify({ note: '', userConsents: this.userConsents });
426
+ const options = {
427
+ method: 'PATCH',
428
+ headers,
429
+ body
430
+ };
431
+ fetch(url.href, options)
432
+ .then(res => res.json())
433
+ .then(() => {
434
+ window.postMessage({
435
+ type: 'WidgetNotification',
436
+ data: {
437
+ type: 'success',
438
+ message: translate('consentUpdateSuccess', this.language)
439
+ }
440
+ }, window.location.href);
441
+ })
442
+ .catch((err) => {
443
+ window.postMessage({
444
+ type: 'WidgetNotification',
445
+ data: {
446
+ type: 'error',
447
+ message: translate('serverNotResponding', this.language),
448
+ err
449
+ }
450
+ }, window.location.href);
451
+ })
452
+ .finally(() => {
453
+ window.postMessage({ type: 'UserActionsCompleted' }, window.location.href);
454
+ });
455
+ }
456
+ render() {
457
+ this.isValid = this.mandatoryConsentsChecked === this.mandatoryConsentsCount;
458
+ return (index.h("div", { key: '90e9076be34bb3556ee584768cf255bc07ef453b', 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 &&
459
+ index.h("button", { class: "ConsentRejectButton", onClick: this.handleReject }, translate('rejectButtonText', this.language)), this.includeSubmitButton &&
460
+ 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))))));
461
+ }
462
+ static get watchers() { return {
463
+ "clientStyling": ["handleClientStylingChange"],
464
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
465
+ "mbSource": ["handleMbSourceChange"],
466
+ "receivedQueryResponses": ["handleQueryResponse"]
467
+ }; }
468
+ };
469
+ PamConsentModalGm2.style = PamConsentModalGm2Style0;
470
+
471
+ exports.PamConsentModalGm2 = PamConsentModalGm2;
472
+ exports.setClientStyling = setClientStyling;
473
+ exports.setClientStylingURL = setClientStylingURL;
474
+ exports.setStreamStyling = setStreamStyling;
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-7739e965.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-gm2.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-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);
23
+ });
24
+
25
+ exports.setNonce = index.setNonce;
@@ -0,0 +1,19 @@
1
+ {
2
+ "entries": [
3
+ "components/pam-consent-modal-gm2/pam-consent-modal-gm2.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 { PamConsentModalGm2 } from './pam-consent-modal-gm2';
@@ -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
+ }