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