@everymatrix/pam-player-documents 0.11.2

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 (56) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/index-84b76e65.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-player-documents-bc881ad5.js +416 -0
  6. package/dist/cjs/pam-player-documents.cjs.js +25 -0
  7. package/dist/cjs/pam-player-documents_2.cjs.entry.js +203 -0
  8. package/dist/collection/collection-manifest.json +19 -0
  9. package/dist/collection/components/pam-player-documents/index.js +1 -0
  10. package/dist/collection/components/pam-player-documents/pam-player-documents.css +249 -0
  11. package/dist/collection/components/pam-player-documents/pam-player-documents.js +428 -0
  12. package/dist/collection/index.js +1 -0
  13. package/dist/collection/utils/locale.utils.js +129 -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-3f96eae4.js +1200 -0
  17. package/dist/esm/index.js +2 -0
  18. package/dist/esm/loader.js +11 -0
  19. package/dist/esm/pam-player-documents-7540c613.js +414 -0
  20. package/dist/esm/pam-player-documents.js +20 -0
  21. package/dist/esm/pam-player-documents_2.entry.js +198 -0
  22. package/dist/index.cjs.js +1 -0
  23. package/dist/index.js +1 -0
  24. package/dist/pam-player-documents/app-globals-0f993ce5.js +1 -0
  25. package/dist/pam-player-documents/index-3f96eae4.js +2 -0
  26. package/dist/pam-player-documents/index.esm.js +1 -0
  27. package/dist/pam-player-documents/pam-player-documents-7540c613.js +1 -0
  28. package/dist/pam-player-documents/pam-player-documents.esm.js +1 -0
  29. package/dist/pam-player-documents/pam-player-documents_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 +47 -0
  33. package/dist/storybook/preview.js +9 -0
  34. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-documents/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
  35. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-documents/.stencil/packages/stencil/pam-player-documents/stencil.config.d.ts +2 -0
  36. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-documents/.stencil/packages/stencil/pam-player-documents/stencil.config.dev.d.ts +2 -0
  37. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-documents/.stencil/packages/stencil/pam-player-documents/storybook/main.d.ts +3 -0
  38. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-documents/.stencil/packages/stencil/pam-player-documents/storybook/preview.d.ts +70 -0
  39. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-documents/.stencil/tools/plugins/index.d.ts +3 -0
  40. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-documents/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
  41. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-documents/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
  42. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/pam-player-documents/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
  43. package/dist/types/components/pam-player-documents/index.d.ts +1 -0
  44. package/dist/types/components/pam-player-documents/pam-player-documents.d.ts +46 -0
  45. package/dist/types/components.d.ts +57 -0
  46. package/dist/types/index.d.ts +1 -0
  47. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  48. package/dist/types/utils/locale.utils.d.ts +23 -0
  49. package/dist/types/utils/utils.d.ts +7 -0
  50. package/loader/cdn.js +1 -0
  51. package/loader/index.cjs.js +1 -0
  52. package/loader/index.d.ts +24 -0
  53. package/loader/index.es2017.js +1 -0
  54. package/loader/index.js +2 -0
  55. package/loader/package.json +11 -0
  56. package/package.json +26 -0
@@ -0,0 +1,2 @@
1
+ export { P as PamPlayerDocuments } from './pam-player-documents-7540c613.js';
2
+ import './index-3f96eae4.js';
@@ -0,0 +1,11 @@
1
+ import { b as bootstrapLazy } from './index-3f96eae4.js';
2
+ export { s as setNonce } from './index-3f96eae4.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-player-documents_2",[[1,"pam-player-documents",{"userId":[513,"user-id"],"session":[513],"endpoint":[513],"lang":[513],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"isEditable":[513,"is-editable"],"isStandAlone":[513,"is-stand-alone"],"limitStylingAppends":[32],"isSkeletonLoading":[32],"isSubmitButtonAvailable":[32],"invalidFields":[32],"isMobile":[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],"color":[1],"primaryColor":[1,"primary-color"],"secondaryColor":[1,"secondary-color"]},null,{"structure":["handleStructureChange"]}]]]], options);
9
+ };
10
+
11
+ export { defineCustomElements };
@@ -0,0 +1,414 @@
1
+ import { r as registerInstance, h } from './index-3f96eae4.js';
2
+
3
+ /**
4
+ * @name setClientStyling
5
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
6
+ * @param {HTMLElement} stylingContainer The reference element of the widget
7
+ * @param {string} clientStyling The style content
8
+ */
9
+ function setClientStyling(stylingContainer, clientStyling) {
10
+ if (stylingContainer) {
11
+ const sheet = document.createElement('style');
12
+ sheet.innerHTML = clientStyling;
13
+ stylingContainer.appendChild(sheet);
14
+ }
15
+ }
16
+
17
+ /**
18
+ * @name setClientStylingURL
19
+ * @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
20
+ * @param {HTMLElement} stylingContainer The reference element of the widget
21
+ * @param {string} clientStylingUrl The URL of the style content
22
+ */
23
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
24
+ const url = new URL(clientStylingUrl);
25
+
26
+ fetch(url.href)
27
+ .then((res) => res.text())
28
+ .then((data) => {
29
+ const cssFile = document.createElement('style');
30
+ cssFile.innerHTML = data;
31
+ if (stylingContainer) {
32
+ stylingContainer.appendChild(cssFile);
33
+ }
34
+ })
35
+ .catch((err) => {
36
+ console.error('There was an error while trying to load client styling from URL', err);
37
+ });
38
+ }
39
+
40
+ /**
41
+ * @name setStreamLibrary
42
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
43
+ * @param {HTMLElement} stylingContainer The highest element of the widget
44
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
45
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
46
+ */
47
+ function setStreamStyling(stylingContainer, domain, subscription) {
48
+ if (window.emMessageBus) {
49
+ const sheet = document.createElement('style');
50
+
51
+ window.emMessageBus.subscribe(domain, (data) => {
52
+ sheet.innerHTML = data;
53
+ if (stylingContainer) {
54
+ stylingContainer.appendChild(sheet);
55
+ }
56
+ });
57
+ }
58
+ }
59
+
60
+ const DEFAULT_LANGUAGE = 'en';
61
+ const TRANSLATIONS = {
62
+ "en": {
63
+ "title": "Documents",
64
+ "documentType": "Document Type",
65
+ "documentNumber": "Document Number",
66
+ "documentNumberError": "Document number is invalid",
67
+ "saveButton": "Save Changes",
68
+ "successMessage": "Your changes have been saved!",
69
+ "errorMessageUpdate": "An error has occured when attempting to update the documents information",
70
+ "errorMessageFetch": "An error has occured when attempting to fetch the documents information"
71
+ },
72
+ "zh-hk": {
73
+ "title": "文件",
74
+ "documentType": "文件類型",
75
+ "documentNumber": "文件號碼",
76
+ "documentNumberError": "文件號碼無效",
77
+ "saveButton": "保存更改",
78
+ "successMessage": "您的更改已保存!",
79
+ "errorMessageUpdate": "嘗試更新文件信息時發生錯誤",
80
+ "errorMessageFetch": "在嘗試獲取文件信息時發生錯誤"
81
+ },
82
+ "fr": {
83
+ "title": "Documents",
84
+ "documentType": "Type de document",
85
+ "documentNumber": "Numéro de document",
86
+ "documentNumberError": "Le numéro de document est invalide",
87
+ "saveButton": "Enregistrer les modifications",
88
+ "successMessage": "Vos modifications ont été enregistrées !",
89
+ "errorMessageUpdate": "Une erreur s'est produite lors de la tentative de mise à jour des informations des documents",
90
+ "errorMessageFetch": "Une erreur est survenue lors de la tentative de récupération des informations sur les documents"
91
+ },
92
+ "ro": {
93
+ "title": "Documente",
94
+ "documentType": "Tip document",
95
+ "documentNumber": "Număr document",
96
+ "documentNumberError": "Numărul documentului este invalid",
97
+ "saveButton": "Salvează modificările",
98
+ "successMessage": "Modificările dvs. au fost salvate!",
99
+ "errorMessageUpdate": "A apărut o eroare la încercarea de a actualiza informațiile documentelor",
100
+ "errorMessageFetch": "A apărut o eroare la încercarea de a obține informațiile documentelor"
101
+ },
102
+ "tr": {
103
+ "title": "Belgeler",
104
+ "documentType": "Belge Türü",
105
+ "documentNumber": "Belge Numarası",
106
+ "documentNumberError": "Belge numarası geçersiz",
107
+ "saveButton": "Değişiklikleri Kaydet",
108
+ "successMessage": "Değişiklikleriniz kaydedildi!",
109
+ "errorMessageUpdate": "Belgelerin bilgilerini güncellemeye çalışırken bir hata oluştu",
110
+ "errorMessageFetch": "Belgelerin bilgilerini almak için yapılan işlemde bir hata oluştu"
111
+ },
112
+ "es": {
113
+ "title": "Documentos",
114
+ "documentType": "Tipo de documento",
115
+ "documentNumber": "Número de documento",
116
+ "documentNumberError": "El número de documento no es válido",
117
+ "saveButton": "Guardar cambios",
118
+ "successMessage": "¡Tus cambios han sido guardados!",
119
+ "errorMessageUpdate": "Se ha producido un error al intentar actualizar la información de los documentos",
120
+ "errorMessageFetch": "Se ha producido un error al intentar obtener la información de los documentos"
121
+ },
122
+ "pt": {
123
+ "title": "Documentos",
124
+ "documentType": "Tipo de documento",
125
+ "documentNumber": "Número do documento",
126
+ "documentNumberError": "O número do documento é inválido",
127
+ "saveButton": "Salvar alterações",
128
+ "successMessage": "Suas alterações foram salvas!",
129
+ "errorMessageUpdate": "Ocorreu um erro ao tentar atualizar as informações dos documentos",
130
+ "errorMessageFetch": "Ocorreu um erro ao tentar buscar as informações dos documentos"
131
+ },
132
+ "hr": {
133
+ "title": "Dokumenti",
134
+ "documentType": "Vrsta dokumenta",
135
+ "documentNumber": "Broj dokumenta",
136
+ "documentNumberError": "Broj dokumenta je nevažeći",
137
+ "saveButton": "Spremi promjene",
138
+ "successMessage": "Vaše promjene su spremljene!",
139
+ "errorMessageUpdate": "Došlo je do pogreške prilikom pokušaja ažuriranja informacija o dokumentima",
140
+ "errorMessageFetch": "Došlo je do greške prilikom pokušaja dobijanja informacija o dokumentima"
141
+ },
142
+ "pt-br": {
143
+ "title": "Documentos",
144
+ "documentType": "Tipo de documento",
145
+ "documentNumber": "Número do documento",
146
+ "documentNumberError": "O número do documento é inválido",
147
+ "saveButton": "Salvar alterações",
148
+ "successMessage": "Suas alterações foram salvas!",
149
+ "errorMessageUpdate": "Ocorreu um erro ao tentar atualizar as informações dos documentos",
150
+ "errorMessageFetch": "Ocorreu um erro ao tentar buscar as informações dos documentos"
151
+ },
152
+ "es-mx": {
153
+ "title": "Documentos",
154
+ "documentType": "Tipo de documento",
155
+ "documentNumber": "Número de documento",
156
+ "documentNumberError": "El número de documento no es válido",
157
+ "saveButton": "Guardar cambios",
158
+ "successMessage": "¡Tus cambios han sido guardados!",
159
+ "errorMessageUpdate": "Se ha producido un error al intentar actualizar la información de los documentos",
160
+ "errorMessageFetch": "Se ha producido un error al intentar obtener la información de los documentos"
161
+ }
162
+ };
163
+ const translate = (key, customLang, values) => {
164
+ let lang = TRANSLATIONS[customLang] ? customLang : DEFAULT_LANGUAGE;
165
+ let translation = TRANSLATIONS[lang][key];
166
+ if (values !== undefined) {
167
+ for (const [key, value] of Object.entries(values.values)) {
168
+ const regex = new RegExp(`{${key}}`, 'g');
169
+ translation = translation.replace(regex, value);
170
+ }
171
+ }
172
+ return translation;
173
+ };
174
+
175
+ /**
176
+ * @name isMobile
177
+ * @description A method that returns if the browser used to access the app is from a mobile device or not
178
+ * @param {String} userAgent window.navigator.userAgent
179
+ * @returns {Boolean} true or false
180
+ */
181
+ const isMobile = (userAgent) => {
182
+ return !!(userAgent.toLowerCase().match(/android/i) ||
183
+ userAgent.toLowerCase().match(/blackberry|bb/i) ||
184
+ userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
185
+ userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
186
+ };
187
+
188
+ const pamPlayerDocumentsCss = ":host {\n display: block;\n}\n\nbutton {\n font-family: var(--emw--button-typography);\n}\n\ninput, select, option {\n font-family: inherit;\n}\n\n.PlayerDocumentsWrapper {\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.PlayerDocumentsWrapper .ReturnButton {\n display: none;\n}\n.PlayerDocumentsWrapper h2 {\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}\n.PlayerDocumentsWrapper .Section {\n background: var(--emw-color-pale, var(--emw--color-gray-100, #E6E6E6));\n border-radius: var(--emw--border-radius-large, 10px);\n padding: 10px;\n margin-bottom: 10px;\n}\n.PlayerDocumentsWrapper .Section .SectionTitle {\n font-size: var(--emw--font-size-large, 20px);\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 padding: 0;\n border: 0;\n margin-top: 10px;\n margin-bottom: 10px;\n background: transparent;\n cursor: pointer;\n}\n.PlayerDocumentsWrapper .Section .SectionContent {\n display: grid;\n column-gap: 50px;\n row-gap: 25px;\n grid-template-rows: auto;\n grid-template-columns: 1fr;\n padding-bottom: 30px;\n margin-top: 10px;\n}\n.PlayerDocumentsWrapper .Section .SectionContent .Field {\n width: 100%;\n display: flex;\n flex-direction: column;\n /* Chrome, Safari, Edge, Opera */\n /* Firefox */\n}\n.PlayerDocumentsWrapper .Section .SectionContent .Field label {\n font-size: var(--emw--size-small, 14px);\n font-weight: var(--emw--font-weight-semibold, 500);\n margin-bottom: 5px;\n}\n.PlayerDocumentsWrapper .Section .SectionContent .Field input {\n font-size: var(--emw--size-small, 14px);\n font-weight: var(--emw--font-weight-light, 300);\n color: var(--emw--pam-contrast, var(--emw-color-contrast, #07072A));\n padding: 10px;\n line-height: 16px;\n background: var(--emw-color-white, #FFFFFF);\n outline: none;\n transition-duration: var(--emw--transition-medium, 250ms);\n border: 1px solid var(--emw--color-gray-100, #353535);\n border-radius: var(--emw--border-radius-medium, 10px);\n width: 100%;\n box-sizing: border-box;\n}\n.PlayerDocumentsWrapper .Section .SectionContent .Field input:focus, .PlayerDocumentsWrapper .Section .SectionContent .Field input :focus-within, .PlayerDocumentsWrapper .Section .SectionContent .Field input :focus-visible, .PlayerDocumentsWrapper .Section .SectionContent .Field input :visited {\n border: 1px solid var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n box-shadow: 0 0 0 1pt var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n}\n.PlayerDocumentsWrapper .Section .SectionContent .Field input::-webkit-outer-spin-button,\n.PlayerDocumentsWrapper .Section .SectionContent .Field input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n.PlayerDocumentsWrapper .Section .SectionContent .Field input[type=number] {\n -moz-appearance: textfield;\n appearance: textfield;\n}\n.PlayerDocumentsWrapper .Section .SectionContent .Field.Invalid input {\n border: 1px solid var(--emw-color-error, var(--emw-color-red, #FD2839));\n background: var(--emw-color-pale, #FBECF4);\n color: var(--emw-color-error, var(--emw-color-red, #FD2839));\n}\n.PlayerDocumentsWrapper .Section .SectionContent .Field .Error {\n color: var(--emw-color-error, var(--emw-color-red, #FD2839));\n font-size: var(--emw--font-size-x-small, 12px);\n line-height: 10px;\n}\n.PlayerDocumentsWrapper .Section .SectionContent .Field.Disabled input {\n opacity: 0.5;\n}\n.PlayerDocumentsWrapper .Section .SectionContent .CompoundField {\n width: 100%;\n display: flex;\n gap: 10px;\n flex-direction: row;\n}\n.PlayerDocumentsWrapper .ButtonsArea {\n grid-column-gap: 10px;\n grid-template-rows: auto;\n grid-template-columns: 1fr;\n margin-top: 20px;\n width: 50%;\n}\n.PlayerDocumentsWrapper .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.PlayerDocumentsWrapper .ButtonsArea .SaveButton:active {\n background: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n}\n.PlayerDocumentsWrapper .ButtonsArea .SaveButton.Disabled {\n opacity: 0.3;\n cursor: not-allowed;\n}\n.PlayerDocumentsWrapper.skeleton .ReturnButton {\n display: block;\n width: 200px;\n margin-top: 15px;\n margin-bottom: 20px;\n}\n.PlayerDocumentsWrapper.skeleton .Section .SectionContent {\n grid-template-columns: 1fr 1fr;\n max-height: 100%;\n overflow: hidden;\n}\n.PlayerDocumentsWrapper.skeleton .Section .SectionContent .Field {\n height: 60px;\n overflow: hidden;\n}\n.PlayerDocumentsWrapper.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 .PlayerDocumentsWrapper {\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 .PlayerDocumentsWrapper .ReturnButton {\n color: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n display: inline-flex;\n align-items: center;\n column-gap: 10px;\n margin-bottom: 10px;\n }\n .PlayerDocumentsWrapper .ReturnButton svg {\n fill: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n }\n .PlayerDocumentsWrapper .HeaderText {\n display: none;\n }\n .PlayerDocumentsWrapper h2 {\n color: var(--emw--pam-color-primary, var(--emw--color-primary, #22B04E));\n font-size: var(--emw--font-size-large, 20px);\n font-weight: var(--emw--font-weight-semibold, 500);\n }\n .PlayerDocumentsWrapper .Section .SectionContent {\n row-gap: 15px;\n grid-template-columns: 1fr;\n }\n .PlayerDocumentsWrapper .Section .SectionContent .CompoundField {\n width: 100%;\n display: flex;\n gap: 10px;\n flex-direction: column;\n }\n .PlayerDocumentsWrapper .Section .SectionTitle {\n margin-top: 5px;\n margin-bottom: 5px;\n font-size: var(--emw--font-size-medium, 16px);\n }\n .PlayerDocumentsWrapper .Section .Field label {\n color: var(--emw-color-gray-300, #58586B);\n font-size: var(--emw--size-x-small, 12px);\n font-weight: var(-emw--font-weight-normal, 400);\n }\n .PlayerDocumentsWrapper .Section .Field input {\n color: var(--emw-color-gray-300, #58586B);\n font-size: var(--emw--size-x-small, 12px);\n font-weight: var(--emw--font-weight-light, 300);\n }\n .PlayerDocumentsWrapper .ButtonsArea {\n grid-column-gap: 10px;\n width: 100%;\n grid-template-columns: 1fr 1fr;\n }\n .PlayerDocumentsWrapper .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 .PlayerDocumentsWrapper .ButtonsArea .SaveButton.Disabled {\n color: var(--emw-color-gray-300, #58586B);\n }\n .PlayerDocumentsWrapper.skeleton .Section .SectionContent {\n display: block;\n }\n .PlayerDocumentsWrapper.skeleton .Section .SectionContent .Field {\n margin-bottom: 15px;\n }\n .PlayerDocumentsWrapper.skeleton .ButtonsArea .SaveButton {\n width: 100%;\n height: 100%;\n border-radius: 20px;\n }\n}";
189
+ const PamPlayerDocumentsStyle0 = pamPlayerDocumentsCss;
190
+
191
+ const PamPlayerDocuments = class {
192
+ constructor(hostRef) {
193
+ registerInstance(this, hostRef);
194
+ this.dataRef = {};
195
+ this.fieldsState = {};
196
+ this.sendLoadedMessage = () => {
197
+ window.postMessage({ type: 'DOCUMENTS_LOADED' });
198
+ };
199
+ this.sendValidMessage = () => {
200
+ window.postMessage({ type: 'DOCUMENTS_VALIDITY', data: this.isSubmitButtonAvailable });
201
+ };
202
+ this.sendSuccessNotification = () => {
203
+ window.postMessage({ type: 'WidgetNotification', data: { type: 'success', message: translate('successMessage', this.lang) } }, window.location.href);
204
+ };
205
+ this.sendErrorNotification = (errorKey) => {
206
+ window.postMessage({ type: 'WidgetNotification', data: { type: 'error', message: translate(errorKey, this.lang) } }, window.location.href);
207
+ };
208
+ this.sendData = () => {
209
+ window.postMessage({ type: 'DOCUMENTS_UPDATE_DATA', data: this.data }, window.location.href);
210
+ };
211
+ this.messageHandler = (message) => {
212
+ var _a;
213
+ switch ((_a = message.data) === null || _a === void 0 ? void 0 : _a.type) {
214
+ case 'DOCUMENTS_DATA':
215
+ this.data = message.data.data;
216
+ this.resetState();
217
+ this.isSkeletonLoading = false;
218
+ break;
219
+ case 'DOCUMENTS_SEND_DATA':
220
+ this.sendData();
221
+ break;
222
+ }
223
+ };
224
+ this.getData = () => {
225
+ const url = new URL(`/api/v1/players/${this.userId}/player-identifiable-information/documents/`, this.endpoint);
226
+ const headers = new Headers();
227
+ headers.append('X-SessionID', this.session);
228
+ const options = {
229
+ method: 'GET',
230
+ headers: headers
231
+ };
232
+ return new Promise((resolve) => {
233
+ fetch(url.href, options)
234
+ .then(res => {
235
+ if (res.ok) {
236
+ return res.json();
237
+ }
238
+ this.sendErrorNotification('errorMessageFetch');
239
+ })
240
+ .then(res => {
241
+ this.data = res;
242
+ resolve();
243
+ });
244
+ });
245
+ };
246
+ this.buildFieldState = (isValid, initialValue, rule) => Object.assign({ 'isValid': isValid, 'initialValue': initialValue, 'rule': rule });
247
+ this.resetState = () => {
248
+ this.initData();
249
+ this.initEditableFieldsState();
250
+ this.invalidFields = 0;
251
+ this.isSubmitButtonAvailable = false;
252
+ };
253
+ this.updateState = (sectionKey) => (e) => {
254
+ this.dataRef[sectionKey].documentNumber = e.target.value;
255
+ const fieldState = this.fieldsState[sectionKey]['data'].documentNumber;
256
+ const value = e.target.value;
257
+ const passedRuleCheck = fieldState.rule(value);
258
+ if (passedRuleCheck && !fieldState.isValid) {
259
+ fieldState.isValid = true;
260
+ this.invalidFields -= 1;
261
+ }
262
+ else if (!passedRuleCheck && fieldState.isValid) {
263
+ fieldState.isValid = false;
264
+ this.invalidFields += 1;
265
+ }
266
+ this.fieldsState[sectionKey]['hasChanged'] = value !== fieldState.initialValue;
267
+ const previous = this.isSubmitButtonAvailable;
268
+ this.updateSubmitButtonStatus();
269
+ if (this.isStandAlone !== 'true' && this.isSubmitButtonAvailable !== previous) {
270
+ this.sendValidMessage();
271
+ }
272
+ };
273
+ this.updateData = (e) => {
274
+ if (e)
275
+ e.preventDefault();
276
+ const promises = [];
277
+ for (const documentType of Object.keys(this.fieldsState)) {
278
+ if (!this.fieldsState[documentType]['hasChanged'])
279
+ continue;
280
+ const document = this.dataRef[documentType];
281
+ const url = new URL(`/api/v1/players/${this.userId}/player-identifiable-information/documents/${document['documentId']}/`, this.endpoint);
282
+ const headers = new Headers();
283
+ headers.append('X-SessionId', this.session);
284
+ headers.append('Content-Type', 'application/json-patch+json');
285
+ const reqParams = {
286
+ method: 'PUT',
287
+ headers,
288
+ body: JSON.stringify(document)
289
+ };
290
+ promises.push(fetch(url, reqParams));
291
+ }
292
+ Promise.all(promises)
293
+ .then(resArr => {
294
+ if (resArr.some(res => !res.ok)) {
295
+ return this.sendErrorNotification('errorMessageUpdate');
296
+ }
297
+ this.sendSuccessNotification();
298
+ this.getData().then(() => this.resetState());
299
+ });
300
+ };
301
+ this.updateSubmitButtonStatus = () => {
302
+ this.isSubmitButtonAvailable = this.invalidFields === 0 && Object.values(this.fieldsState).some(v => v.hasChanged);
303
+ };
304
+ this.editableField = (sectionKey, fieldKey, labelTranslationKey, errorTranslationKey) => {
305
+ const fieldState = this.fieldsState[sectionKey]['data'][fieldKey];
306
+ const value = this.dataRef[sectionKey];
307
+ if (fieldState) {
308
+ return (h("div", { class: `Field ${fieldState.isValid ? '' : 'Invalid'}` }, h("label", null, translate(labelTranslationKey, this.lang)), h("input", { type: "text", value: value[fieldKey], onKeyUp: this.updateState(sectionKey) }), !fieldState.isValid &&
309
+ h("p", { class: "Error" }, translate(errorTranslationKey, this.lang))));
310
+ }
311
+ else {
312
+ return null;
313
+ }
314
+ };
315
+ this.staticField = (sectionKey, fieldKey, labelTranslationKey) => {
316
+ const value = this.dataRef[sectionKey];
317
+ if (value && value[fieldKey]) {
318
+ return (h("div", { class: "Field Disabled" }, h("label", null, translate(labelTranslationKey, this.lang)), h("input", { type: "text", value: value[fieldKey], readonly: true })));
319
+ }
320
+ else {
321
+ return null;
322
+ }
323
+ };
324
+ this.toggleScreen = () => {
325
+ window.postMessage({ type: 'PlayerAccountMenuActive', isMobile: this.isMobile }, window.location.href);
326
+ };
327
+ this.userId = undefined;
328
+ this.session = undefined;
329
+ this.endpoint = undefined;
330
+ this.lang = 'en';
331
+ this.mbSource = undefined;
332
+ this.clientStyling = undefined;
333
+ this.clientStylingUrl = undefined;
334
+ this.translationUrl = undefined;
335
+ this.isEditable = 'false';
336
+ this.isStandAlone = 'true';
337
+ this.limitStylingAppends = false;
338
+ this.isSkeletonLoading = true;
339
+ this.isSubmitButtonAvailable = false;
340
+ this.invalidFields = 0;
341
+ this.isMobile = isMobile(window.navigator.userAgent);
342
+ }
343
+ handleStylingChange(newValue, oldValue) {
344
+ if (newValue !== oldValue)
345
+ setClientStyling(this.stylingContainer, this.clientStyling);
346
+ }
347
+ handleStylingUrlChange(newValue, oldValue) {
348
+ if (newValue !== oldValue)
349
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
350
+ }
351
+ async componentWillLoad() {
352
+ if (this.isStandAlone !== 'true') {
353
+ return;
354
+ }
355
+ await this.getData()
356
+ .then(() => {
357
+ this.initData();
358
+ this.initEditableFieldsState();
359
+ })
360
+ .finally(() => this.isSkeletonLoading = false);
361
+ }
362
+ componentDidLoad() {
363
+ if (this.stylingContainer) {
364
+ if (window.emMessageBuss != undefined) {
365
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
366
+ }
367
+ else {
368
+ if (this.clientStyling)
369
+ setClientStyling(this.stylingContainer, this.clientStyling);
370
+ if (this.clientStylingUrl)
371
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
372
+ }
373
+ }
374
+ if (this.isStandAlone !== 'true') {
375
+ window.addEventListener('message', this.messageHandler, false);
376
+ this.sendLoadedMessage();
377
+ }
378
+ }
379
+ disconnectedCallback() {
380
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
381
+ if (this.isStandAlone !== 'true')
382
+ window.removeEventListener('message', this.messageHandler, false);
383
+ }
384
+ initData() {
385
+ for (const document of this.data.documents) {
386
+ this.dataRef[document.documentType] = document;
387
+ }
388
+ }
389
+ initEditableFieldsState() {
390
+ for (const [documentType, document] of Object.entries(this.dataRef)) {
391
+ this.fieldsState[documentType] = {};
392
+ this.fieldsState[documentType]['data'] = {};
393
+ this.fieldsState[documentType]['data']['documentNumber'] = this.buildFieldState(true, document.documentNumber, (val) => val && /^(?=.*[a-zA-Z0-9])[a-zA-Z0-9\s]+$/.test(val) && val.length <= 50);
394
+ this.fieldsState[documentType]['hasChanged'] = false;
395
+ }
396
+ }
397
+ render() {
398
+ return (h("div", { key: '7abe1ef66b345689e5b12f56c8c563f21bf31862', ref: el => this.stylingContainer = el }, this.isSkeletonLoading
399
+ ? h("form", { class: "PlayerDocumentsWrapper skeleton" }, h("div", { class: "ReturnButton" }, h("ui-skeleton", { structure: "title", width: "auto", height: "30px" })), h("div", { class: "Section" }, h("section", { class: "SectionContent" }, h("div", { class: "Field" }, h("ui-skeleton", { structure: "text", width: "auto", "margin-bottom": "10px", height: "10px" }), h("ui-skeleton", { structure: "title", width: "100%", height: "40px" })), h("div", { class: "Field" }, h("ui-skeleton", { structure: "text", width: "auto", "margin-bottom": "10px", height: "10px" }), h("ui-skeleton", { structure: "title", width: "100%", height: "40px" })))), h("section", { class: "ButtonsArea" }, h("div", { class: "SaveButton" }, h("ui-skeleton", { structure: "rectangle", width: "auto", height: "40px" }))))
400
+ : h("form", { class: `PlayerDocumentsWrapper ${this.isMobile ? 'Mobile' : ''}` }, h("div", { class: "ReturnButton", onClick: this.toggleScreen }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "15", height: "15", viewBox: "0 0 15 15" }, h("g", { transform: "translate(-20 -158)" }, h("g", { transform: "translate(20 158)" }, h("path", { class: "aaa", d: "M7.5,0,6.136,1.364,11.3,6.526H0V8.474H11.3L6.136,13.636,7.5,15,15,7.5Z", transform: "translate(15 15) rotate(180)" })))), h("h2", null, translate('title', this.lang))), h("h2", { class: "HeaderText" }, translate('title', this.lang)), h("div", { class: "Section" }, h("section", { class: "SectionContent" }, Object.keys(this.dataRef).map(documentType => {
401
+ return (h("div", { class: "CompoundField" }, this.staticField(documentType, 'documentType', 'documentType'), this.isEditable === 'true'
402
+ ? this.editableField(documentType, 'documentNumber', 'documentNumber', 'documentNumberError')
403
+ : this.staticField(documentType, 'documentNumber', 'documentNumber')));
404
+ }))), this.isStandAlone === 'true' &&
405
+ h("section", { class: "ButtonsArea" }, h("button", { class: `SaveButton ${this.isSubmitButtonAvailable ? '' : 'Disabled'}`, onClick: this.updateData }, translate('saveButton'))))));
406
+ }
407
+ static get watchers() { return {
408
+ "clientStyling": ["handleStylingChange"],
409
+ "clientStylingUrl": ["handleStylingUrlChange"]
410
+ }; }
411
+ };
412
+ PamPlayerDocuments.style = PamPlayerDocumentsStyle0;
413
+
414
+ export { PamPlayerDocuments as P };
@@ -0,0 +1,20 @@
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-3f96eae4.js';
2
+ export { s as setNonce } from './index-3f96eae4.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-player-documents_2",[[1,"pam-player-documents",{"userId":[513,"user-id"],"session":[513],"endpoint":[513],"lang":[513],"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"isEditable":[513,"is-editable"],"isStandAlone":[513,"is-stand-alone"],"limitStylingAppends":[32],"isSkeletonLoading":[32],"isSubmitButtonAvailable":[32],"invalidFields":[32],"isMobile":[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],"color":[1],"primaryColor":[1,"primary-color"],"secondaryColor":[1,"secondary-color"]},null,{"structure":["handleStructureChange"]}]]]], options);
20
+ });