@everymatrix/pam-profile-consents 1.90.6

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-80e34705.js +1227 -0
  3. package/dist/cjs/index.cjs.js +10 -0
  4. package/dist/cjs/loader.cjs.js +15 -0
  5. package/dist/cjs/pam-profile-consents-e63c25d8.js +399 -0
  6. package/dist/cjs/pam-profile-consents.cjs.js +25 -0
  7. package/dist/cjs/pam-profile-consents_2.cjs.entry.js +183 -0
  8. package/dist/collection/collection-manifest.json +19 -0
  9. package/dist/collection/components/pam-profile-consents/index.js +1 -0
  10. package/dist/collection/components/pam-profile-consents/pam-profile-consents.css +202 -0
  11. package/dist/collection/components/pam-profile-consents/pam-profile-consents.js +328 -0
  12. package/dist/collection/index.js +1 -0
  13. package/dist/collection/utils/locale.utils.js +98 -0
  14. package/dist/collection/utils/utils.js +12 -0
  15. package/dist/esm/app-globals-0f993ce5.js +3 -0
  16. package/dist/esm/index-76d86c0b.js +1200 -0
  17. package/dist/esm/index.js +2 -0
  18. package/dist/esm/loader.js +11 -0
  19. package/dist/esm/pam-profile-consents-363e3230.js +397 -0
  20. package/dist/esm/pam-profile-consents.js +20 -0
  21. package/dist/esm/pam-profile-consents_2.entry.js +178 -0
  22. package/dist/index.cjs.js +1 -0
  23. package/dist/index.js +1 -0
  24. package/dist/pam-profile-consents/app-globals-0f993ce5.js +1 -0
  25. package/dist/pam-profile-consents/index-76d86c0b.js +2 -0
  26. package/dist/pam-profile-consents/index.esm.js +1 -0
  27. package/dist/pam-profile-consents/pam-profile-consents-363e3230.js +1 -0
  28. package/dist/pam-profile-consents/pam-profile-consents.esm.js +1 -0
  29. package/dist/pam-profile-consents/pam-profile-consents_2.entry.js +1 -0
  30. package/dist/stencil.config.dev.js +17 -0
  31. package/dist/stencil.config.js +19 -0
  32. package/dist/storybook/main.js +46 -0
  33. package/dist/storybook/preview.js +9 -0
  34. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-profile-consents/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
  35. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-profile-consents/.stencil/packages/stencil/pam-profile-consents/stencil.config.d.ts +2 -0
  36. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-profile-consents/.stencil/packages/stencil/pam-profile-consents/stencil.config.dev.d.ts +2 -0
  37. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-profile-consents/.stencil/packages/stencil/pam-profile-consents/storybook/main.d.ts +3 -0
  38. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-profile-consents/.stencil/packages/stencil/pam-profile-consents/storybook/preview.d.ts +70 -0
  39. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-profile-consents/.stencil/tools/plugins/index.d.ts +4 -0
  40. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-profile-consents/.stencil/tools/plugins/lazy-load-chunk-plugin.d.ts +12 -0
  41. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-profile-consents/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
  42. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-profile-consents/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  43. package/dist/types/builds/emfe-widgets/widgets-monorepo/packages/stencil/pam-profile-consents/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  44. package/dist/types/components/pam-profile-consents/index.d.ts +1 -0
  45. package/dist/types/components/pam-profile-consents/pam-profile-consents.d.ts +54 -0
  46. package/dist/types/components.d.ts +93 -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 +23 -0
  50. package/dist/types/utils/utils.d.ts +7 -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 +26 -0
@@ -0,0 +1,2 @@
1
+ export { P as PamProfileConsents } from './pam-profile-consents-363e3230.js';
2
+ import './index-76d86c0b.js';
@@ -0,0 +1,11 @@
1
+ import { b as bootstrapLazy } from './index-76d86c0b.js';
2
+ export { s as setNonce } from './index-76d86c0b.js';
3
+ import { g as globalScripts } from './app-globals-0f993ce5.js';
4
+
5
+ const defineCustomElements = async (win, options) => {
6
+ if (typeof window === 'undefined') return undefined;
7
+ await globalScripts();
8
+ return bootstrapLazy([["pam-profile-consents_2",[[1,"pam-profile-consents",{"session":[513],"endpoint":[513],"lang":[513],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"skeletonLoading":[32],"isError":[32],"errorMessage":[32],"hasChanges":[32],"isSaving":[32],"consentsState":[32]},null,{"clientStyling":["handleStylingChange"],"clientStylingUrl":["handleStylingUrlChange"]}],[0,"ui-skeleton",{"structure":[1],"width":[1],"height":[1],"borderRadius":[8,"border-radius"],"marginBottom":[8,"margin-bottom"],"marginTop":[8,"margin-top"],"marginLeft":[8,"margin-left"],"marginRight":[8,"margin-right"],"animation":[4],"rows":[2],"size":[1]},null,{"structure":["handleStructureChange"]}]]]], options);
9
+ };
10
+
11
+ export { defineCustomElements };
@@ -0,0 +1,397 @@
1
+ import { r as registerInstance, h } from './index-76d86c0b.js';
2
+
3
+ const DEFAULT_LANGUAGE = 'en';
4
+ const TRANSLATIONS = {
5
+ "en": {
6
+ "title": "Notifications",
7
+ "saveButton": "Save Changes",
8
+ "successMessage": "Your consent preferences have been saved!",
9
+ "errorMessageFetch": "An error has occurred when attempting to fetch consent preferences",
10
+ "errorMessageSave": "An error has occurred when attempting to save consent preferences"
11
+ },
12
+ "zh-hk": {
13
+ "title": "通知",
14
+ "saveButton": "保存更改",
15
+ "successMessage": "您的同意偏好已保存!",
16
+ "errorMessageFetch": "嘗試獲取同意偏好時發生錯誤",
17
+ "errorMessageSave": "嘗試保存同意偏好時發生錯誤"
18
+ },
19
+ "fr": {
20
+ "title": "Notifications",
21
+ "saveButton": "Enregistrer les modifications",
22
+ "successMessage": "Vos préférences de consentement ont été enregistrées !",
23
+ "errorMessageFetch": "Une erreur est survenue lors de la récupération des préférences de consentement",
24
+ "errorMessageSave": "Une erreur est survenue lors de l'enregistrement des préférences de consentement"
25
+ },
26
+ "ro": {
27
+ "title": "Notificări",
28
+ "saveButton": "Salvează modificările",
29
+ "successMessage": "Preferințele dvs. de consimțământ au fost salvate!",
30
+ "errorMessageFetch": "A apărut o eroare la încercarea de a obține preferințele de consimțământ",
31
+ "errorMessageSave": "A apărut o eroare la încercarea de a salva preferințele de consimțământ"
32
+ },
33
+ "tr": {
34
+ "title": "Bildirimler",
35
+ "saveButton": "Değişiklikleri Kaydet",
36
+ "successMessage": "Onay tercihleriniz kaydedildi!",
37
+ "errorMessageFetch": "Onay tercihlerini almaya çalışırken bir hata oluştu",
38
+ "errorMessageSave": "Onay tercihlerini kaydetmeye çalışırken bir hata oluştu"
39
+ },
40
+ "es": {
41
+ "title": "Notificaciones",
42
+ "saveButton": "Guardar cambios",
43
+ "successMessage": "¡Tus preferencias de consentimiento han sido guardadas!",
44
+ "errorMessageFetch": "Se ha producido un error al intentar obtener las preferencias de consentimiento",
45
+ "errorMessageSave": "Se ha producido un error al intentar guardar las preferencias de consentimiento"
46
+ },
47
+ "pt": {
48
+ "title": "Notificações",
49
+ "saveButton": "Salvar alterações",
50
+ "successMessage": "Suas preferências de consentimento foram salvas!",
51
+ "errorMessageFetch": "Ocorreu um erro ao tentar buscar as preferências de consentimento",
52
+ "errorMessageSave": "Ocorreu um erro ao tentar salvar as preferências de consentimento"
53
+ },
54
+ "hr": {
55
+ "title": "Obavijesti",
56
+ "saveButton": "Spremi promjene",
57
+ "successMessage": "Vaše postavke privola su spremljene!",
58
+ "errorMessageFetch": "Došlo je do greške prilikom pokušaja dobivanja postavki privola",
59
+ "errorMessageSave": "Došlo je do greške prilikom pokušaja spremanja postavki privola"
60
+ },
61
+ "pt-br": {
62
+ "title": "Notificações",
63
+ "saveButton": "Salvar alterações",
64
+ "successMessage": "Suas preferências de consentimento foram salvas!",
65
+ "errorMessageFetch": "Ocorreu um erro ao tentar buscar as preferências de consentimento",
66
+ "errorMessageSave": "Ocorreu um erro ao tentar salvar as preferências de consentimento"
67
+ },
68
+ "es-mx": {
69
+ "title": "Notificaciones",
70
+ "saveButton": "Guardar cambios",
71
+ "successMessage": "¡Tus preferencias de consentimiento han sido guardadas!",
72
+ "errorMessageFetch": "Se ha producido un error al intentar obtener las preferencias de consentimiento",
73
+ "errorMessageSave": "Se ha producido un error al intentar guardar las preferencias de consentimiento"
74
+ }
75
+ };
76
+ const translate = (key, customLang, values) => {
77
+ let lang = TRANSLATIONS[customLang] ? customLang : DEFAULT_LANGUAGE;
78
+ let translation = TRANSLATIONS[lang][key];
79
+ if (values !== undefined) {
80
+ for (const [key, value] of Object.entries(values.values)) {
81
+ const regex = new RegExp(`{${key}}`, 'g');
82
+ translation = translation.replace(regex, value);
83
+ }
84
+ }
85
+ return translation;
86
+ };
87
+
88
+ const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
89
+
90
+ /**
91
+ * @name setClientStyling
92
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
93
+ * @param {HTMLElement} stylingContainer The reference element of the widget
94
+ * @param {string} clientStyling The style content
95
+ */
96
+ function setClientStyling(stylingContainer, clientStyling) {
97
+ if (stylingContainer) {
98
+ const sheet = document.createElement('style');
99
+ sheet.innerHTML = clientStyling;
100
+ stylingContainer.appendChild(sheet);
101
+ }
102
+ }
103
+
104
+ /**
105
+ * @name setClientStylingURL
106
+ * @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
107
+ * @param {HTMLElement} stylingContainer The reference element of the widget
108
+ * @param {string} clientStylingUrl The URL of the style content
109
+ */
110
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
111
+ if (!stylingContainer || !clientStylingUrl) return;
112
+
113
+ const url = new URL(clientStylingUrl);
114
+
115
+ fetch(url.href)
116
+ .then((res) => res.text())
117
+ .then((data) => {
118
+ const cssFile = document.createElement('style');
119
+ cssFile.innerHTML = data;
120
+ if (stylingContainer) {
121
+ stylingContainer.appendChild(cssFile);
122
+ }
123
+ })
124
+ .catch((err) => {
125
+ console.error('There was an error while trying to load client styling from URL', err);
126
+ });
127
+ }
128
+
129
+ /**
130
+ * @name setStreamLibrary
131
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
132
+ * @param {HTMLElement} stylingContainer The highest element of the widget
133
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
134
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
135
+ * @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
136
+ */
137
+ function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
138
+ if (!window.emMessageBus) return;
139
+
140
+ const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
141
+
142
+ if (!supportAdoptStyle || !useAdoptedStyleSheets) {
143
+ subscription = getStyleTagSubscription(stylingContainer, domain);
144
+
145
+ return subscription;
146
+ }
147
+
148
+ if (!window[StyleCacheKey]) {
149
+ window[StyleCacheKey] = {};
150
+ }
151
+ subscription = getAdoptStyleSubscription(stylingContainer, domain);
152
+
153
+ const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
154
+ const wrappedUnsubscribe = () => {
155
+ if (window[StyleCacheKey][domain]) {
156
+ const cachedObject = window[StyleCacheKey][domain];
157
+ cachedObject.refCount > 1
158
+ ? (cachedObject.refCount = cachedObject.refCount - 1)
159
+ : delete window[StyleCacheKey][domain];
160
+ }
161
+
162
+ originalUnsubscribe();
163
+ };
164
+ subscription.unsubscribe = wrappedUnsubscribe;
165
+
166
+ return subscription;
167
+ }
168
+
169
+ function getStyleTagSubscription(stylingContainer, domain) {
170
+ const sheet = document.createElement('style');
171
+
172
+ return window.emMessageBus.subscribe(domain, (data) => {
173
+ if (stylingContainer) {
174
+ sheet.innerHTML = data;
175
+ stylingContainer.appendChild(sheet);
176
+ }
177
+ });
178
+ }
179
+
180
+ function getAdoptStyleSubscription(stylingContainer, domain) {
181
+ return window.emMessageBus.subscribe(domain, (data) => {
182
+ if (!stylingContainer) return;
183
+
184
+ const shadowRoot = stylingContainer.getRootNode();
185
+ const cacheStyleObject = window[StyleCacheKey];
186
+ let cachedStyle = cacheStyleObject[domain] && cacheStyleObject[domain].sheet;
187
+
188
+ if (!cachedStyle) {
189
+ cachedStyle = new CSSStyleSheet();
190
+ cachedStyle.replaceSync(data);
191
+ cacheStyleObject[domain] = {
192
+ sheet: cachedStyle,
193
+ refCount: 1
194
+ };
195
+ } else {
196
+ cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
197
+ }
198
+
199
+ const currentSheets = shadowRoot.adoptedStyleSheets || [];
200
+ if (!currentSheets.includes(cachedStyle)) {
201
+ shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
202
+ }
203
+ });
204
+ }
205
+
206
+ /**
207
+ * @name isMobile
208
+ * @description A method that returns if the browser used to access the app is from a mobile device or not
209
+ * @param {String} userAgent window.navigator.userAgent
210
+ * @returns {Boolean} true or false
211
+ */
212
+ const isMobile = (userAgent) => {
213
+ return !!(userAgent.toLowerCase().match(/android/i) ||
214
+ userAgent.toLowerCase().match(/blackberry|bb/i) ||
215
+ userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
216
+ userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
217
+ };
218
+
219
+ const pamProfileConsentsCss = ":host {\n display: block;\n}\n\nbutton {\n font-family: var(--emw--button-typography);\n}\n\n.errorContainer {\n font-family: \"Roboto\", sans-serif;\n font-style: normal;\n display: flex;\n flex-direction: column;\n gap: 24px;\n width: 100%;\n height: 100%;\n}\n.errorContainer .errorMessage {\n color: var(--emw--color-error, var(--emw--color-red, #ed0909));\n font-size: var(--emw-font-size-small, 13px);\n display: block;\n justify-content: center;\n text-align: center;\n}\n\n.PamProfileConsentsWrapper {\n color: var(--emw--pam-typography, var(--emw-color-contrast, #07072A));\n background: var(--emw-color-pale, var(--emw--color-gray-50, #F1F1F1));\n padding: 50px;\n height: 100%;\n border-radius: var(--emw--border-radius-large, 10px);\n container-type: inline-size;\n opacity: 1;\n animation-name: fadeIn;\n animation-iteration-count: 1;\n animation-timing-function: ease-in;\n animation-duration: 0.3s;\n}\n.PamProfileConsentsWrapper .HeaderArea {\n margin-bottom: 20px;\n}\n.PamProfileConsentsWrapper .HeaderText {\n font-size: var(--emw--font-size-x-large, 24px);\n color: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n text-transform: capitalize;\n font-weight: var(--emw--font-weight-semibold, 500);\n margin: 0;\n}\n.PamProfileConsentsWrapper .CategoriesGrid {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 20px;\n margin-bottom: 20px;\n}\n.PamProfileConsentsWrapper .CategoryCard {\n background: var(--emw-color-pale, var(--emw--color-gray-100, #E6E6E6));\n border-radius: var(--emw--border-radius-large, 10px);\n padding: 15px;\n}\n.PamProfileConsentsWrapper .CategoryTitle {\n font-size: var(--emw--font-size-large, 20px);\n color: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n font-weight: var(--emw--font-weight-semibold, 500);\n margin: 0 0 15px 0;\n}\n.PamProfileConsentsWrapper .UngroupedSection {\n background: var(--emw-color-pale, var(--emw--color-gray-100, #E6E6E6));\n border-radius: var(--emw--border-radius-large, 10px);\n padding: 15px;\n margin-bottom: 20px;\n}\n.PamProfileConsentsWrapper .ConsentItem {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 8px 0;\n cursor: pointer;\n user-select: none;\n}\n.PamProfileConsentsWrapper .Checkbox {\n width: 22px;\n height: 22px;\n min-width: 22px;\n border: 2px solid var(--emw--color-gray-300, #58586B);\n border-radius: var(--emw--border-radius-small, 4px);\n display: flex;\n align-items: center;\n justify-content: center;\n transition: all var(--emw--transition-medium, 250ms);\n background: transparent;\n}\n.PamProfileConsentsWrapper .Checkbox svg {\n width: 14px;\n height: 14px;\n color: #FFFFFF;\n}\n.PamProfileConsentsWrapper .Checkbox.Checked {\n background: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n border-color: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n}\n.PamProfileConsentsWrapper .ConsentLabel {\n font-size: var(--emw--size-small, 14px);\n font-weight: var(--emw--font-weight-normal, 400);\n color: var(--emw--pam-typography, var(--emw-color-contrast, #07072A));\n}\n.PamProfileConsentsWrapper .ButtonsArea {\n margin-top: 20px;\n width: 50%;\n}\n.PamProfileConsentsWrapper .ButtonsArea .SaveButton {\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n cursor: pointer;\n background-image: linear-gradient(to bottom, color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, black 20%), var(--emw--color-primary, #22B04E), color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, white 30%));\n border: 2px solid var(--emw--button-border-color, #0E5924);\n color: var(--emw--button-text-color, #FFFFFF);\n border-radius: var(--emw--button-border-radius, 10px);\n font-size: var(--emw--size-standard, 16px);\n text-transform: uppercase;\n transition-duration: var(--emw--transition-medium, 250ms);\n max-width: 400px;\n min-width: 200px;\n padding: 13px 0;\n width: 100%;\n}\n.PamProfileConsentsWrapper .ButtonsArea .SaveButton:active {\n background: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n}\n.PamProfileConsentsWrapper .ButtonsArea .SaveButton.Disabled {\n opacity: 0.3;\n cursor: not-allowed;\n}\n.PamProfileConsentsWrapper.skeleton .HeaderArea {\n margin-bottom: 20px;\n}\n.PamProfileConsentsWrapper.skeleton .CategoriesGrid {\n overflow: hidden;\n}\n.PamProfileConsentsWrapper.skeleton .CategoryCard {\n overflow: hidden;\n}\n.PamProfileConsentsWrapper.skeleton .ButtonsArea .SaveButton {\n width: 500px;\n border-radius: 30px;\n overflow: hidden;\n display: block;\n background-image: none;\n border: none;\n}\n@container (max-width: 425px) {\n .PamProfileConsentsWrapper {\n padding: 20px 15px;\n background: var(--emw-color-gray-50, #F9F8F8);\n max-width: unset;\n border-radius: var(--emw--border-radius-small, 5px);\n }\n .PamProfileConsentsWrapper .HeaderText {\n font-size: var(--emw--font-size-large, 20px);\n }\n .PamProfileConsentsWrapper .CategoriesGrid {\n grid-template-columns: 1fr;\n }\n .PamProfileConsentsWrapper .CategoryTitle {\n font-size: var(--emw--font-size-medium, 16px);\n }\n .PamProfileConsentsWrapper .ConsentLabel {\n font-size: var(--emw--size-x-small, 12px);\n }\n .PamProfileConsentsWrapper .ButtonsArea {\n width: 100%;\n }\n .PamProfileConsentsWrapper .ButtonsArea .SaveButton {\n font-size: var(--emw--size-x-small, 12px);\n height: 40px;\n color: var(--emw-button-typography, var(--emw-color-white, #FFFFFF));\n }\n .PamProfileConsentsWrapper .ButtonsArea .SaveButton.Disabled {\n color: var(--emw-color-gray-300, #58586B);\n }\n .PamProfileConsentsWrapper.skeleton .ButtonsArea .SaveButton {\n width: 100%;\n height: 100%;\n border-radius: 20px;\n }\n}\n\n@keyframes fadeIn {\n 0% {\n opacity: 0.01;\n }\n 1% {\n opacity: 0;\n }\n 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}";
220
+ const PamProfileConsentsStyle0 = pamProfileConsentsCss;
221
+
222
+ const PamProfileConsents = class {
223
+ constructor(hostRef) {
224
+ registerInstance(this, hostRef);
225
+ this.isMobileDevice = false;
226
+ this.allConsents = [];
227
+ this.categories = [];
228
+ this.ungroupedConsents = [];
229
+ this.handleFetchResponse = async (res) => {
230
+ var _a;
231
+ if (res.status >= 300) {
232
+ this.isError = true;
233
+ let response = await res.json();
234
+ const errorCode = (_a = response.thirdPartyResponse) === null || _a === void 0 ? void 0 : _a.errorCode;
235
+ this.errorMessage = errorCode ? translate(errorCode, this.lang) : translate('errorMessageFetch', this.lang);
236
+ return Promise.reject(this.errorMessage);
237
+ }
238
+ else {
239
+ this.isError = false;
240
+ if (res.headers.get('content-type')) {
241
+ let response = await res.json();
242
+ return Promise.resolve(response);
243
+ }
244
+ return Promise.resolve();
245
+ }
246
+ };
247
+ this.getConsentsData = () => {
248
+ const url = new URL(`/api/pam/v1/player-consents?IncludeUnset=true`, this.endpoint);
249
+ const headers = new Headers();
250
+ headers.append('X-SessionID', this.session);
251
+ const options = {
252
+ method: 'GET',
253
+ headers: headers
254
+ };
255
+ return new Promise((resolve, reject) => {
256
+ fetch(url.href, options)
257
+ .then((res) => this.handleFetchResponse(res))
258
+ .then(res => {
259
+ this.allConsents = res;
260
+ resolve();
261
+ })
262
+ .catch((error) => {
263
+ console.error(error);
264
+ reject(error);
265
+ });
266
+ });
267
+ };
268
+ this.processConsents = () => {
269
+ const optionalConsents = this.allConsents.filter(c => !c.mustAccept);
270
+ const categoryMap = {};
271
+ const ungrouped = [];
272
+ optionalConsents.forEach(consent => {
273
+ if (consent.category) {
274
+ const code = consent.category.categoryTagCode;
275
+ if (!categoryMap[code]) {
276
+ categoryMap[code] = {
277
+ categoryTagCode: code,
278
+ friendlyName: consent.category.friendlyName,
279
+ consents: []
280
+ };
281
+ }
282
+ categoryMap[code].consents.push(consent);
283
+ }
284
+ else {
285
+ ungrouped.push(consent);
286
+ }
287
+ });
288
+ this.categories = Object.values(categoryMap);
289
+ this.ungroupedConsents = ungrouped;
290
+ const newState = {};
291
+ optionalConsents.forEach(consent => {
292
+ newState[consent.tagCode] = consent.status === 'Accepted';
293
+ });
294
+ this.consentsState = newState;
295
+ this.hasChanges = false;
296
+ };
297
+ this.toggleConsent = (tagCode) => {
298
+ this.consentsState = Object.assign(Object.assign({}, this.consentsState), { [tagCode]: !this.consentsState[tagCode] });
299
+ this.hasChanges = true;
300
+ };
301
+ this.saveConsents = () => {
302
+ if (!this.hasChanges || this.isSaving)
303
+ return;
304
+ this.isSaving = true;
305
+ const userConsents = Object.entries(this.consentsState).map(([tagCode, accepted]) => ({
306
+ tagCode,
307
+ status: accepted ? 'Accepted' : 'Denied'
308
+ }));
309
+ const url = new URL(`/api/pam/v1/player-consents`, this.endpoint);
310
+ const headers = new Headers();
311
+ headers.append('X-SessionID', this.session);
312
+ headers.append('Content-Type', 'application/json');
313
+ fetch(url.href, {
314
+ method: 'PATCH',
315
+ headers,
316
+ body: JSON.stringify({ note: '', userConsents })
317
+ })
318
+ .then(res => this.handleFetchResponse(res))
319
+ .then(() => {
320
+ return this.getConsentsData()
321
+ .then(() => this.processConsents());
322
+ })
323
+ .catch((error) => {
324
+ console.error(error);
325
+ })
326
+ .finally(() => {
327
+ this.isSaving = false;
328
+ });
329
+ };
330
+ this.renderCheckbox = (consent) => {
331
+ const checked = this.consentsState[consent.tagCode];
332
+ return (h("div", { class: "ConsentItem", onClick: () => this.toggleConsent(consent.tagCode) }, h("div", { class: `Checkbox ${checked ? 'Checked' : ''}` }, checked &&
333
+ h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "3", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("polyline", { points: "20 6 9 17 4 12" }))), h("span", { class: "ConsentLabel" }, consent.friendlyName)));
334
+ };
335
+ this.session = undefined;
336
+ this.endpoint = undefined;
337
+ this.lang = 'en';
338
+ this.mbSource = undefined;
339
+ this.clientStyling = undefined;
340
+ this.clientStylingUrl = undefined;
341
+ this.translationUrl = undefined;
342
+ this.skeletonLoading = true;
343
+ this.isError = false;
344
+ this.errorMessage = '';
345
+ this.hasChanges = false;
346
+ this.isSaving = false;
347
+ this.consentsState = {};
348
+ }
349
+ handleStylingChange(newValue, oldValue) {
350
+ if (newValue !== oldValue)
351
+ setClientStyling(this.stylingContainer, this.clientStyling);
352
+ }
353
+ handleStylingUrlChange(newValue, oldValue) {
354
+ if (newValue !== oldValue)
355
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
356
+ }
357
+ async componentWillLoad() {
358
+ this.isMobileDevice = isMobile(window.navigator.userAgent);
359
+ await this.getConsentsData()
360
+ .then(() => {
361
+ this.processConsents();
362
+ })
363
+ .finally(() => this.skeletonLoading = false);
364
+ }
365
+ componentDidLoad() {
366
+ if (this.stylingContainer) {
367
+ if (window.emMessageBuss != undefined) {
368
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
369
+ }
370
+ else {
371
+ if (this.clientStyling)
372
+ setClientStyling(this.stylingContainer, this.clientStyling);
373
+ if (this.clientStylingUrl)
374
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
375
+ }
376
+ }
377
+ }
378
+ disconnectedCallback() {
379
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
380
+ }
381
+ render() {
382
+ if (!this.skeletonLoading && this.isError) {
383
+ return (h("div", { class: "errorContainer" }, h("p", { class: "errorMessage", innerHTML: this.errorMessage })));
384
+ }
385
+ return (h("div", { ref: el => this.stylingContainer = el }, this.skeletonLoading
386
+ ? h("div", { class: "PamProfileConsentsWrapper skeleton" }, h("div", { class: "HeaderArea" }, h("ui-skeleton", { structure: "title", width: "200px", height: "30px" })), h("div", { class: "CategoriesGrid" }, [...Array(4).keys()].map(() => h("div", { class: "CategoryCard" }, h("ui-skeleton", { structure: "text", width: "150px", height: "16px", "margin-bottom": "10px" }), h("ui-skeleton", { structure: "rectangle", width: "100%", height: "20px", "margin-bottom": "8px" }), h("ui-skeleton", { structure: "rectangle", width: "100%", height: "20px", "margin-bottom": "8px" })))), h("div", { class: "ButtonsArea" }, h("div", { class: "SaveButton" }, h("ui-skeleton", { structure: "rectangle", width: "auto", height: "50px" }))))
387
+ : h("div", { class: `PamProfileConsentsWrapper ${this.isMobileDevice ? 'Mobile' : ''}` }, h("div", { class: "HeaderArea" }, h("h2", { class: "HeaderText" }, translate('title', this.lang))), h("div", { class: "CategoriesGrid" }, this.categories.map(category => h("div", { class: "CategoryCard" }, h("h3", { class: "CategoryTitle" }, category.friendlyName), category.consents.map(consent => this.renderCheckbox(consent))))), this.ungroupedConsents.length > 0 &&
388
+ h("div", { class: "UngroupedSection" }, this.ungroupedConsents.map(consent => this.renderCheckbox(consent))), h("section", { class: "ButtonsArea" }, h("button", { class: `SaveButton ${!this.hasChanges || this.isSaving ? 'Disabled' : ''}`, onClick: this.saveConsents }, translate('saveButton', this.lang))))));
389
+ }
390
+ static get watchers() { return {
391
+ "clientStyling": ["handleStylingChange"],
392
+ "clientStylingUrl": ["handleStylingUrlChange"]
393
+ }; }
394
+ };
395
+ PamProfileConsents.style = PamProfileConsentsStyle0;
396
+
397
+ export { PamProfileConsents as P };
@@ -0,0 +1,20 @@
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-76d86c0b.js';
2
+ export { s as setNonce } from './index-76d86c0b.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-profile-consents_2",[[1,"pam-profile-consents",{"session":[513],"endpoint":[513],"lang":[513],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"skeletonLoading":[32],"isError":[32],"errorMessage":[32],"hasChanges":[32],"isSaving":[32],"consentsState":[32]},null,{"clientStyling":["handleStylingChange"],"clientStylingUrl":["handleStylingUrlChange"]}],[0,"ui-skeleton",{"structure":[1],"width":[1],"height":[1],"borderRadius":[8,"border-radius"],"marginBottom":[8,"margin-bottom"],"marginTop":[8,"margin-top"],"marginLeft":[8,"margin-left"],"marginRight":[8,"margin-right"],"animation":[4],"rows":[2],"size":[1]},null,{"structure":["handleStructureChange"]}]]]], options);
20
+ });
@@ -0,0 +1,178 @@
1
+ export { P as pam_profile_consents } from './pam-profile-consents-363e3230.js';
2
+ import { r as registerInstance, h, H as Host } from './index-76d86c0b.js';
3
+
4
+ const uiSkeletonCss = ":host{display:block}.Skeleton{animation:skeleton-loading 1s linear infinite alternate}.SkeletonRectangle{background-color:var(--emw-skeleton-rectangle-background, #c2c2c2);width:var(--emw-skeleton-rectangle-width, 400px);height:var(--emw-skeleton-rectangle-height, 200px);border-radius:var(--emw-skeleton-rectangle-border-radius, 10px)}.SkeletonCircle{background-color:var(--emw-skeleton-circle-background, #c2c2c2);width:var(--emw-skeleton-circle-size, 400px);height:var(--emw-skeleton-circle-size, 400px);border-radius:50%}.SkeletonText{background-color:var(--emw-skeleton-text-background, #c2c2c2);width:var(--emw-skeleton-text-width, 500px);height:var(--emw-skeleton-text-height, 20px);border-radius:var(--emw-skeleton-text-border-radius, 10px);margin-bottom:var(--emw-skeleton-text-margin-bottom, 5px)}.SkeletonText:last-child{width:calc(var(--emw-skeleton-text-width, 400px) - 100px)}.SkeletonTitle{background-color:var(--emw-skeleton-title-background, #c2c2c2);width:var(--emw-skeleton-title-width, 300px);height:var(--emw-skeleton-title-height, 30px);border-radius:var(--emw-skeleton-title-border-radius, 10px);margin-bottom:var(--emw-skeleton-title-margin-bottom, 5px)}.SkeletonImage{background-color:var(--emw-skeleton-image-background, #c2c2c2);width:var(--emw-skeleton-image-width, 100%);height:var(--emw-skeleton-image-height, 100%);border-radius:var(--emw-skeleton-image-border-radius, unset)}.SkeletonLogo{background-color:var(--emw-skeleton-logo-background, #c2c2c2);width:var(--emw-skeleton-logo-width, 120px);height:var(--emw-skeleton-logo-height, 75px);border-radius:var(--emw-skeleton-logo-border-radius, 10px)}@keyframes skeleton-loading{0%{background-color:var(--emw-skeleton-primary-color, #e0e0e0)}100%{background-color:var(--emw-skeleton-secondary-color, #f0f0f0)}}";
5
+ const UiSkeletonStyle0 = uiSkeletonCss;
6
+
7
+ const UiSkeleton = class {
8
+ constructor(hostRef) {
9
+ registerInstance(this, hostRef);
10
+ this.stylingValue = {
11
+ width: this.handleStylingProps(this.width),
12
+ height: this.handleStylingProps(this.height),
13
+ borderRadius: this.handleStylingProps(this.borderRadius),
14
+ marginBottom: this.handleStylingProps(this.marginBottom),
15
+ marginTop: this.handleStylingProps(this.marginTop),
16
+ marginLeft: this.handleStylingProps(this.marginLeft),
17
+ marginRight: this.handleStylingProps(this.marginRight),
18
+ size: this.handleStylingProps(this.size),
19
+ };
20
+ this.structure = undefined;
21
+ this.width = 'unset';
22
+ this.height = 'unset';
23
+ this.borderRadius = 'unset';
24
+ this.marginBottom = 'unset';
25
+ this.marginTop = 'unset';
26
+ this.marginLeft = 'unset';
27
+ this.marginRight = 'unset';
28
+ this.animation = true;
29
+ this.rows = 0;
30
+ this.size = '100%';
31
+ }
32
+ handleStructureChange(newValue, oldValue) {
33
+ if (oldValue !== newValue) {
34
+ this.handleStructure(newValue);
35
+ }
36
+ }
37
+ handleStylingProps(value) {
38
+ switch (typeof value) {
39
+ case 'number':
40
+ return value === 0 ? 0 : `${value}px`;
41
+ case 'undefined':
42
+ return 'unset';
43
+ case 'string':
44
+ if (['auto', 'unset', 'none', 'inherit', 'initial'].includes(value) ||
45
+ value.endsWith('px') ||
46
+ value.endsWith('%')) {
47
+ return value;
48
+ }
49
+ else {
50
+ return 'unset';
51
+ }
52
+ default:
53
+ return 'unset';
54
+ }
55
+ }
56
+ handleStructure(structure) {
57
+ switch (structure) {
58
+ case 'logo':
59
+ return this.renderLogo();
60
+ case 'image':
61
+ return this.renderImage();
62
+ case 'title':
63
+ return this.renderTitle();
64
+ case 'text':
65
+ return this.renderText();
66
+ case 'rectangle':
67
+ return this.renderRectangle();
68
+ case 'circle':
69
+ return this.renderCircle();
70
+ default:
71
+ return null;
72
+ }
73
+ }
74
+ renderLogo() {
75
+ return (h("div", { class: "SkeletonContainer" }, h("div", { class: 'SkeletonLogo ' + (this.animation ? 'Skeleton' : '') })));
76
+ }
77
+ renderImage() {
78
+ return h("div", { class: 'SkeletonImage ' + (this.animation ? 'Skeleton' : '') });
79
+ }
80
+ renderTitle() {
81
+ return (h("div", { class: "SkeletonContainer" }, h("div", { class: 'SkeletonTitle ' + (this.animation ? 'Skeleton' : '') })));
82
+ }
83
+ renderText() {
84
+ return (h("div", { class: "SkeletonContainer" }, Array.from({ length: this.rows > 0 ? this.rows : 1 }).map((_, index) => (h("div", { key: index, class: 'SkeletonText ' + (this.animation ? 'Skeleton' : '') })))));
85
+ }
86
+ renderRectangle() {
87
+ return (h("div", { class: "SkeletonContainer" }, h("div", { class: 'SkeletonRectangle ' + (this.animation ? 'Skeleton' : '') })));
88
+ }
89
+ renderCircle() {
90
+ return (h("div", { class: "SkeletonContainer" }, h("div", { class: 'SkeletonCircle ' + (this.animation ? 'Skeleton' : '') })));
91
+ }
92
+ render() {
93
+ let styleBlock = '';
94
+ switch (this.structure) {
95
+ case 'logo':
96
+ styleBlock = `
97
+ :host {
98
+ --emw-skeleton-logo-width: ${this.stylingValue.width};
99
+ --emw-skeleton-logo-height: ${this.stylingValue.height};
100
+ --emw-skeleton-logo-border-radius: ${this.stylingValue.borderRadius};
101
+ --emw-skeleton-logo-margin-bottom: ${this.stylingValue.marginBottom};
102
+ --emw-skeleton-logo-margin-top: ${this.stylingValue.marginTop};
103
+ --emw-skeleton-logo-margin-left: ${this.stylingValue.marginLeft};
104
+ --emw-skeleton-logo-margin-right: ${this.stylingValue.marginRight};
105
+ }
106
+ `;
107
+ break;
108
+ case 'image':
109
+ styleBlock = `
110
+ :host {
111
+ --emw-skeleton-image-width: ${this.stylingValue.width};
112
+ --emw-skeleton-image-height: ${this.stylingValue.height};
113
+ --emw-skeleton-image-border-radius: ${this.stylingValue.borderRadius};
114
+ --emw-skeleton-image-margin-bottom: ${this.stylingValue.marginBottom};
115
+ --emw-skeleton-image-margin-top: ${this.stylingValue.marginTop};
116
+ --emw-skeleton-image-margin-left: ${this.stylingValue.marginLeft};
117
+ --emw-skeleton-image-margin-right: ${this.stylingValue.marginRight};
118
+ }
119
+ `;
120
+ break;
121
+ case 'title':
122
+ styleBlock = `
123
+ :host {
124
+ --emw-skeleton-title-width: ${this.stylingValue.width};
125
+ --emw-skeleton-title-height: ${this.stylingValue.height};
126
+ --emw-skeleton-title-border-radius: ${this.stylingValue.borderRadius};
127
+ --emw-skeleton-title-margin-bottom: ${this.stylingValue.marginBottom};
128
+ --emw-skeleton-title-margin-top: ${this.stylingValue.marginTop};
129
+ --emw-skeleton-title-margin-left: ${this.stylingValue.marginLeft};
130
+ --emw-skeleton-title-margin-right: ${this.stylingValue.marginRight};
131
+ }
132
+ `;
133
+ break;
134
+ case 'text':
135
+ styleBlock = `
136
+ :host {
137
+ --emw-skeleton-text-width: ${this.stylingValue.width};
138
+ --emw-skeleton-text-height: ${this.stylingValue.height};
139
+ --emw-skeleton-text-border-radius: ${this.stylingValue.borderRadius};
140
+ --emw-skeleton-text-margin-bottom: ${this.stylingValue.marginBottom};
141
+ --emw-skeleton-text-margin-top: ${this.stylingValue.marginTop};
142
+ --emw-skeleton-text-margin-left: ${this.stylingValue.marginLeft};
143
+ --emw-skeleton-text-margin-right: ${this.stylingValue.marginRight};
144
+ }
145
+ `;
146
+ break;
147
+ case 'rectangle':
148
+ styleBlock = `
149
+ :host {
150
+ --emw-skeleton-rectangle-width: ${this.stylingValue.width};
151
+ --emw-skeleton-rectangle-height: ${this.stylingValue.height};
152
+ --emw-skeleton-rectangle-border-radius: ${this.stylingValue.borderRadius};
153
+ --emw-skeleton-rectangle-margin-bottom: ${this.stylingValue.marginBottom};
154
+ --emw-skeleton-rectangle-margin-top: ${this.stylingValue.marginTop};
155
+ --emw-skeleton-rectangle-margin-left: ${this.stylingValue.marginLeft};
156
+ --emw-skeleton-rectangle-margin-right: ${this.stylingValue.marginRight};
157
+ }
158
+ `;
159
+ break;
160
+ case 'circle':
161
+ styleBlock = `
162
+ :host {
163
+ --emw-skeleton-circle-size: ${this.stylingValue.size};
164
+ }
165
+ `;
166
+ break;
167
+ default:
168
+ styleBlock = '';
169
+ }
170
+ return (h(Host, { key: 'c2a2650acd416962a2bc4e1a7ee18bc6d8e2def8' }, h("style", { key: '9bd7fc1f9e9ed9f17735a7b72fce6f09696f5e19' }, styleBlock), this.handleStructure(this.structure)));
171
+ }
172
+ static get watchers() { return {
173
+ "structure": ["handleStructureChange"]
174
+ }; }
175
+ };
176
+ UiSkeleton.style = UiSkeletonStyle0;
177
+
178
+ export { UiSkeleton as ui_skeleton };
@@ -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
+ const o=()=>{};export{o as g}