@everymatrix/pam-player-documents 1.85.16 → 1.85.18
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.
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/{pam-player-documents-79925553.js → pam-player-documents-a0d00b8f.js} +2 -0
- package/dist/cjs/pam-player-documents_2.cjs.entry.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/{pam-player-documents-6c00caa8.js → pam-player-documents-7c981fc5.js} +2 -0
- package/dist/esm/pam-player-documents_2.entry.js +1 -1
- package/dist/pam-player-documents/index.esm.js +1 -1
- package/dist/pam-player-documents/pam-player-documents-7c981fc5.js +1 -0
- package/dist/pam-player-documents/pam-player-documents_2.entry.js +1 -1
- package/package.json +1 -1
- package/dist/pam-player-documents/pam-player-documents-6c00caa8.js +0 -1
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -23,6 +23,8 @@ function setClientStyling(stylingContainer, clientStyling) {
|
|
|
23
23
|
* @param {string} clientStylingUrl The URL of the style content
|
|
24
24
|
*/
|
|
25
25
|
function setClientStylingURL(stylingContainer, clientStylingUrl) {
|
|
26
|
+
if (!stylingContainer || !clientStylingUrl) return;
|
|
27
|
+
|
|
26
28
|
const url = new URL(clientStylingUrl);
|
|
27
29
|
|
|
28
30
|
fetch(url.href)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const pamPlayerDocuments = require('./pam-player-documents-
|
|
5
|
+
const pamPlayerDocuments = require('./pam-player-documents-a0d00b8f.js');
|
|
6
6
|
const index = require('./index-84b76e65.js');
|
|
7
7
|
|
|
8
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)}}";
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { P as PamPlayerDocuments } from './pam-player-documents-
|
|
1
|
+
export { P as PamPlayerDocuments } from './pam-player-documents-7c981fc5.js';
|
|
2
2
|
import './index-3f96eae4.js';
|
|
@@ -21,6 +21,8 @@ function setClientStyling(stylingContainer, clientStyling) {
|
|
|
21
21
|
* @param {string} clientStylingUrl The URL of the style content
|
|
22
22
|
*/
|
|
23
23
|
function setClientStylingURL(stylingContainer, clientStylingUrl) {
|
|
24
|
+
if (!stylingContainer || !clientStylingUrl) return;
|
|
25
|
+
|
|
24
26
|
const url = new URL(clientStylingUrl);
|
|
25
27
|
|
|
26
28
|
fetch(url.href)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { P as pam_player_documents } from './pam-player-documents-
|
|
1
|
+
export { P as pam_player_documents } from './pam-player-documents-7c981fc5.js';
|
|
2
2
|
import { r as registerInstance, h, H as Host } from './index-3f96eae4.js';
|
|
3
3
|
|
|
4
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)}}";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{P as PamPlayerDocuments}from"./pam-player-documents-
|
|
1
|
+
export{P as PamPlayerDocuments}from"./pam-player-documents-7c981fc5.js";import"./index-3f96eae4.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,h as t}from"./index-3f96eae4.js";function n(e,t){if(e){const n=document.createElement("style");n.innerHTML=t,e.appendChild(n)}}function o(e,t){if(!e||!t)return;const n=new URL(t);fetch(n.href).then((e=>e.text())).then((t=>{const n=document.createElement("style");n.innerHTML=t,e&&e.appendChild(n)})).catch((e=>{console.error("There was an error while trying to load client styling from URL",e)}))}const r={en:{title:"Documents",documentType:"Document Type",documentNumber:"Document Number",documentNumberError:"Document number is invalid",saveButton:"Save Changes",successMessage:"Your changes have been saved!",errorMessageUpdate:"An error has occured when attempting to update the documents information",errorMessageFetch:"An error has occured when attempting to fetch the documents information"},"zh-hk":{title:"文件",documentType:"文件類型",documentNumber:"文件號碼",documentNumberError:"文件號碼無效",saveButton:"保存更改",successMessage:"您的更改已保存!",errorMessageUpdate:"嘗試更新文件信息時發生錯誤",errorMessageFetch:"在嘗試獲取文件信息時發生錯誤"},fr:{title:"Documents",documentType:"Type de document",documentNumber:"Numéro de document",documentNumberError:"Le numéro de document est invalide",saveButton:"Enregistrer les modifications",successMessage:"Vos modifications ont été enregistrées !",errorMessageUpdate:"Une erreur s'est produite lors de la tentative de mise à jour des informations des documents",errorMessageFetch:"Une erreur est survenue lors de la tentative de récupération des informations sur les documents"},ro:{title:"Documente",documentType:"Tip document",documentNumber:"Număr document",documentNumberError:"Numărul documentului este invalid",saveButton:"Salvează modificările",successMessage:"Modificările dvs. au fost salvate!",errorMessageUpdate:"A apărut o eroare la încercarea de a actualiza informațiile documentelor",errorMessageFetch:"A apărut o eroare la încercarea de a obține informațiile documentelor"},tr:{title:"Belgeler",documentType:"Belge Türü",documentNumber:"Belge Numarası",documentNumberError:"Belge numarası geçersiz",saveButton:"Değişiklikleri Kaydet",successMessage:"Değişiklikleriniz kaydedildi!",errorMessageUpdate:"Belgelerin bilgilerini güncellemeye çalışırken bir hata oluştu",errorMessageFetch:"Belgelerin bilgilerini almak için yapılan işlemde bir hata oluştu"},es:{title:"Documentos",documentType:"Tipo de documento",documentNumber:"Número de documento",documentNumberError:"El número de documento no es válido",saveButton:"Guardar cambios",successMessage:"¡Tus cambios han sido guardados!",errorMessageUpdate:"Se ha producido un error al intentar actualizar la información de los documentos",errorMessageFetch:"Se ha producido un error al intentar obtener la información de los documentos"},pt:{title:"Documentos",documentType:"Tipo de documento",documentNumber:"Número do documento",documentNumberError:"O número do documento é inválido",saveButton:"Salvar alterações",successMessage:"Suas alterações foram salvas!",errorMessageUpdate:"Ocorreu um erro ao tentar atualizar as informações dos documentos",errorMessageFetch:"Ocorreu um erro ao tentar buscar as informações dos documentos"},hr:{title:"Dokumenti",documentType:"Vrsta dokumenta",documentNumber:"Broj dokumenta",documentNumberError:"Broj dokumenta je nevažeći",saveButton:"Spremi promjene",successMessage:"Vaše promjene su spremljene!",errorMessageUpdate:"Došlo je do pogreške prilikom pokušaja ažuriranja informacija o dokumentima",errorMessageFetch:"Došlo je do greške prilikom pokušaja dobijanja informacija o dokumentima"},"pt-br":{title:"Documentos",documentType:"Tipo de documento",documentNumber:"Número do documento",documentNumberError:"O número do documento é inválido",saveButton:"Salvar alterações",successMessage:"Suas alterações foram salvas!",errorMessageUpdate:"Ocorreu um erro ao tentar atualizar as informações dos documentos",errorMessageFetch:"Ocorreu um erro ao tentar buscar as informações dos documentos"},"es-mx":{title:"Documentos",documentType:"Tipo de documento",documentNumber:"Número de documento",documentNumberError:"El número de documento no es válido",saveButton:"Guardar cambios",successMessage:"¡Tus cambios han sido guardados!",errorMessageUpdate:"Se ha producido un error al intentar actualizar la información de los documentos",errorMessageFetch:"Se ha producido un error al intentar obtener la información de los documentos"}},i=(e,t,n)=>{let o=r[r[t]?t:"en"][e];if(void 0!==n)for(const[e,t]of Object.entries(n.values)){const n=new RegExp(`{${e}}`,"g");o=o.replace(n,t)}return o},a=class{constructor(n){var o;e(this,n),this.dataRef={},this.fieldsState={},this.sendLoadedMessage=()=>{window.postMessage({type:"DOCUMENTS_LOADED"})},this.sendValidMessage=()=>{window.postMessage({type:"DOCUMENTS_VALIDITY",data:this.isSubmitButtonAvailable})},this.sendSuccessNotification=()=>{window.postMessage({type:"WidgetNotification",data:{type:"success",message:i("successMessage",this.lang)}},window.location.href)},this.sendErrorNotification=e=>{window.postMessage({type:"WidgetNotification",data:{type:"error",message:i(e,this.lang)}},window.location.href)},this.sendData=()=>{window.postMessage({type:"DOCUMENTS_UPDATE_DATA",data:this.data},window.location.href)},this.messageHandler=e=>{var t;switch(null===(t=e.data)||void 0===t?void 0:t.type){case"DOCUMENTS_DATA":this.data=e.data.data,this.resetState(),this.isSkeletonLoading=!1;break;case"DOCUMENTS_SEND_DATA":this.sendData()}},this.handleFetchResponse=async e=>{var t;if(e.status>=300){this.isError=!0;let n=await e.json();return this.errorCode=null===(t=n.thirdPartyResponse)||void 0===t?void 0:t.errorCode,this.errorMessage=i(this.errorCode?this.errorCode:"errorMessageFetch",this.lang),window.postMessage({type:"WidgetNotification",data:{type:"error",message:this.errorMessage}},window.location.href),Promise.reject(this.errorMessage)}if(this.isError=!1,e.headers.get("content-type")){let t=await e.json();return Promise.resolve(t)}return Promise.resolve()},this.getData=()=>{const e=new URL(`/api/v1/players/${this.userId}/player-identifiable-information/documents/`,this.endpoint),t=new Headers;t.append("X-SessionID",this.session);const n={method:"GET",headers:t};return new Promise(((t,o)=>{fetch(e.href,n).then((e=>this.handleFetchResponse(e))).then((e=>{this.data=e,t()})).catch((e=>{console.error(e),o(e)}))}))},this.buildFieldState=(e,t,n)=>Object.assign({isValid:e,initialValue:t,rule:n}),this.resetState=()=>{this.initData(),this.initEditableFieldsState(),this.invalidFields=0,this.isSubmitButtonAvailable=!1},this.updateState=e=>t=>{this.dataRef[e].documentNumber=t.target.value;const n=this.fieldsState[e].data.documentNumber,o=t.target.value,r=n.rule(o);r&&!n.isValid?(n.isValid=!0,this.invalidFields-=1):!r&&n.isValid&&(n.isValid=!1,this.invalidFields+=1),this.fieldsState[e].hasChanged=o!==n.initialValue;const i=this.isSubmitButtonAvailable;this.updateSubmitButtonStatus(),"true"!==this.isStandAlone&&this.isSubmitButtonAvailable!==i&&this.sendValidMessage()},this.updateData=e=>{e&&e.preventDefault();const t=[];for(const e of Object.keys(this.fieldsState)){if(!this.fieldsState[e].hasChanged)continue;const n=this.dataRef[e],o=new URL(`/api/v1/players/${this.userId}/player-identifiable-information/documents/${n.documentId}/`,this.endpoint),r=new Headers;r.append("X-SessionId",this.session),r.append("Content-Type","application/json-patch+json");const i={method:"PUT",headers:r,body:JSON.stringify(n)};t.push(fetch(o,i))}Promise.all(t).then((e=>{if(e.some((e=>!e.ok)))return this.sendErrorNotification("errorMessageUpdate");this.sendSuccessNotification(),this.getData().then((()=>this.resetState()))}))},this.updateSubmitButtonStatus=()=>{this.isSubmitButtonAvailable=0===this.invalidFields&&Object.values(this.fieldsState).some((e=>e.hasChanged))},this.editableField=(e,n,o,r)=>{const a=this.fieldsState[e].data[n],s=this.dataRef[e];return a?t("div",{class:"Field "+(a.isValid?"":"Invalid")},t("label",null,i(o,this.lang)),t("input",{type:"text",value:s[n],onKeyUp:this.updateState(e)}),!a.isValid&&t("p",{class:"Error"},i(r,this.lang))):null},this.staticField=(e,n,o)=>{const r=this.dataRef[e];return r&&r[n]?t("div",{class:"Field Disabled"},t("label",null,i(o,this.lang)),t("input",{type:"text",value:r[n],readonly:!0})):null},this.toggleScreen=()=>{window.postMessage({type:"PlayerAccountMenuActive",isMobile:this.isMobile},window.location.href)},this.userId=void 0,this.session=void 0,this.endpoint=void 0,this.lang="en",this.mbSource=void 0,this.clientStyling=void 0,this.clientStylingUrl=void 0,this.translationUrl=void 0,this.isEditable="false",this.isStandAlone="true",this.limitStylingAppends=!1,this.isSkeletonLoading=!0,this.isSubmitButtonAvailable=!1,this.invalidFields=0,this.isMobile=!!((o=window.navigator.userAgent).toLowerCase().match(/android/i)||o.toLowerCase().match(/blackberry|bb/i)||o.toLowerCase().match(/iphone|ipad|ipod/i)||o.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i)),this.isError=!1,this.errorMessage="",this.errorCode=""}handleStylingChange(e,t){e!==t&&n(this.stylingContainer,this.clientStyling)}handleStylingUrlChange(e,t){e!==t&&o(this.stylingContainer,this.clientStylingUrl)}async componentWillLoad(){"true"===this.isStandAlone&&await this.getData().then((()=>{this.initData(),this.initEditableFieldsState()})).finally((()=>this.isSkeletonLoading=!1))}componentDidLoad(){this.stylingContainer&&(null!=window.emMessageBuss?function(e,t){if(window.emMessageBus){const n=document.createElement("style");window.emMessageBus.subscribe(t,(t=>{n.innerHTML=t,e&&e.appendChild(n)}))}}(this.stylingContainer,`${this.mbSource}.Style`):(this.clientStyling&&n(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&o(this.stylingContainer,this.clientStylingUrl))),"true"!==this.isStandAlone&&(window.addEventListener("message",this.messageHandler,!1),this.sendLoadedMessage())}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe(),"true"!==this.isStandAlone&&window.removeEventListener("message",this.messageHandler,!1)}initData(){for(const e of this.data.documents)this.dataRef[e.documentType]=e}initEditableFieldsState(){for(const[e,t]of Object.entries(this.dataRef))this.fieldsState[e]={},this.fieldsState[e].data={},this.fieldsState[e].data.documentNumber=this.buildFieldState(!0,t.documentNumber,(e=>e&&/^(?=.*[a-zA-Z0-9])[a-zA-Z0-9\s]+$/.test(e)&&e.length<=50)),this.fieldsState[e].hasChanged=!1}render(){return!this.isSkeletonLoading&&this.isError?t("div",{class:"errorContainer"},t("p",{class:"errorMessage",innerHTML:this.errorMessage})):t("div",{ref:e=>this.stylingContainer=e},this.isSkeletonLoading?t("form",{class:"PlayerDocumentsWrapper skeleton"},t("div",{class:"ReturnButton"},t("ui-skeleton",{structure:"title",width:"auto",height:"30px"})),t("div",{class:"Section"},t("section",{class:"SectionContent"},t("div",{class:"Field"},t("ui-skeleton",{structure:"text",width:"auto","margin-bottom":"10px",height:"10px"}),t("ui-skeleton",{structure:"title",width:"100%",height:"40px"})),t("div",{class:"Field"},t("ui-skeleton",{structure:"text",width:"auto","margin-bottom":"10px",height:"10px"}),t("ui-skeleton",{structure:"title",width:"100%",height:"40px"})))),t("section",{class:"ButtonsArea"},t("div",{class:"SaveButton"},t("ui-skeleton",{structure:"rectangle",width:"auto",height:"40px"})))):t("form",{class:"PlayerDocumentsWrapper "+(this.isMobile?"Mobile":"")},t("div",{class:"ReturnButton",onClick:this.toggleScreen},t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"15",height:"15",viewBox:"0 0 15 15"},t("g",{transform:"translate(-20 -158)"},t("g",{transform:"translate(20 158)"},t("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)"})))),t("h2",null,i("title",this.lang))),t("h2",{class:"HeaderText"},i("title",this.lang)),t("div",{class:"Section"},t("section",{class:"SectionContent"},Object.keys(this.dataRef).map((e=>t("div",{class:"CompoundField"},this.staticField(e,"documentType","documentType"),"true"===this.isEditable?this.editableField(e,"documentNumber","documentNumber","documentNumberError"):this.staticField(e,"documentNumber","documentNumber")))))),"true"===this.isStandAlone&&t("section",{class:"ButtonsArea"},t("button",{class:"SaveButton "+(this.isSubmitButtonAvailable?"":"Disabled"),onClick:this.updateData},i("saveButton")))))}static get watchers(){return{clientStyling:["handleStylingChange"],clientStylingUrl:["handleStylingUrlChange"]}}};a.style=':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.errorContainer {\n font-family: "Roboto";\n font-style: normal;\n font-family: sans-serif;\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.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}';export{a as P}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{P as pam_player_documents}from"./pam-player-documents-
|
|
1
|
+
export{P as pam_player_documents}from"./pam-player-documents-7c981fc5.js";import{r as e,h as t,H as n}from"./index-3f96eae4.js";const i=class{constructor(t){e(this,t),this.stylingValue={width:this.handleStylingProps(this.width),height:this.handleStylingProps(this.height),borderRadius:this.handleStylingProps(this.borderRadius),marginBottom:this.handleStylingProps(this.marginBottom),marginTop:this.handleStylingProps(this.marginTop),marginLeft:this.handleStylingProps(this.marginLeft),marginRight:this.handleStylingProps(this.marginRight),size:this.handleStylingProps(this.size)},this.structure=void 0,this.width="unset",this.height="unset",this.borderRadius="unset",this.marginBottom="unset",this.marginTop="unset",this.marginLeft="unset",this.marginRight="unset",this.animation=!0,this.rows=0,this.size="100%"}handleStructureChange(e,t){t!==e&&this.handleStructure(e)}handleStylingProps(e){switch(typeof e){case"number":return 0===e?0:`${e}px`;case"undefined":default:return"unset";case"string":return["auto","unset","none","inherit","initial"].includes(e)||e.endsWith("px")||e.endsWith("%")?e:"unset"}}handleStructure(e){switch(e){case"logo":return this.renderLogo();case"image":return this.renderImage();case"title":return this.renderTitle();case"text":return this.renderText();case"rectangle":return this.renderRectangle();case"circle":return this.renderCircle();default:return null}}renderLogo(){return t("div",{class:"SkeletonContainer"},t("div",{class:"SkeletonLogo "+(this.animation?"Skeleton":"")}))}renderImage(){return t("div",{class:"SkeletonImage "+(this.animation?"Skeleton":"")})}renderTitle(){return t("div",{class:"SkeletonContainer"},t("div",{class:"SkeletonTitle "+(this.animation?"Skeleton":"")}))}renderText(){return t("div",{class:"SkeletonContainer"},Array.from({length:this.rows>0?this.rows:1}).map(((e,n)=>t("div",{key:n,class:"SkeletonText "+(this.animation?"Skeleton":"")}))))}renderRectangle(){return t("div",{class:"SkeletonContainer"},t("div",{class:"SkeletonRectangle "+(this.animation?"Skeleton":"")}))}renderCircle(){return t("div",{class:"SkeletonContainer"},t("div",{class:"SkeletonCircle "+(this.animation?"Skeleton":"")}))}render(){let e="";switch(this.structure){case"logo":e=`\n :host {\n --emw-skeleton-logo-width: ${this.stylingValue.width};\n --emw-skeleton-logo-height: ${this.stylingValue.height};\n --emw-skeleton-logo-border-radius: ${this.stylingValue.borderRadius};\n --emw-skeleton-logo-margin-bottom: ${this.stylingValue.marginBottom};\n --emw-skeleton-logo-margin-top: ${this.stylingValue.marginTop};\n --emw-skeleton-logo-margin-left: ${this.stylingValue.marginLeft};\n --emw-skeleton-logo-margin-right: ${this.stylingValue.marginRight};\n }\n `;break;case"image":e=`\n :host {\n --emw-skeleton-image-width: ${this.stylingValue.width};\n --emw-skeleton-image-height: ${this.stylingValue.height};\n --emw-skeleton-image-border-radius: ${this.stylingValue.borderRadius};\n --emw-skeleton-image-margin-bottom: ${this.stylingValue.marginBottom};\n --emw-skeleton-image-margin-top: ${this.stylingValue.marginTop};\n --emw-skeleton-image-margin-left: ${this.stylingValue.marginLeft};\n --emw-skeleton-image-margin-right: ${this.stylingValue.marginRight};\n }\n `;break;case"title":e=`\n :host {\n --emw-skeleton-title-width: ${this.stylingValue.width};\n --emw-skeleton-title-height: ${this.stylingValue.height};\n --emw-skeleton-title-border-radius: ${this.stylingValue.borderRadius};\n --emw-skeleton-title-margin-bottom: ${this.stylingValue.marginBottom};\n --emw-skeleton-title-margin-top: ${this.stylingValue.marginTop};\n --emw-skeleton-title-margin-left: ${this.stylingValue.marginLeft};\n --emw-skeleton-title-margin-right: ${this.stylingValue.marginRight};\n }\n `;break;case"text":e=`\n :host {\n --emw-skeleton-text-width: ${this.stylingValue.width};\n --emw-skeleton-text-height: ${this.stylingValue.height};\n --emw-skeleton-text-border-radius: ${this.stylingValue.borderRadius};\n --emw-skeleton-text-margin-bottom: ${this.stylingValue.marginBottom};\n --emw-skeleton-text-margin-top: ${this.stylingValue.marginTop};\n --emw-skeleton-text-margin-left: ${this.stylingValue.marginLeft};\n --emw-skeleton-text-margin-right: ${this.stylingValue.marginRight};\n }\n `;break;case"rectangle":e=`\n :host {\n --emw-skeleton-rectangle-width: ${this.stylingValue.width};\n --emw-skeleton-rectangle-height: ${this.stylingValue.height};\n --emw-skeleton-rectangle-border-radius: ${this.stylingValue.borderRadius};\n --emw-skeleton-rectangle-margin-bottom: ${this.stylingValue.marginBottom};\n --emw-skeleton-rectangle-margin-top: ${this.stylingValue.marginTop};\n --emw-skeleton-rectangle-margin-left: ${this.stylingValue.marginLeft};\n --emw-skeleton-rectangle-margin-right: ${this.stylingValue.marginRight};\n }\n `;break;case"circle":e=`\n :host {\n --emw-skeleton-circle-size: ${this.stylingValue.size};\n }\n `;break;default:e=""}return t(n,{key:"c2a2650acd416962a2bc4e1a7ee18bc6d8e2def8"},t("style",{key:"9bd7fc1f9e9ed9f17735a7b72fce6f09696f5e19"},e),this.handleStructure(this.structure))}static get watchers(){return{structure:["handleStructureChange"]}}};i.style=":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)}}";export{i as ui_skeleton}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,h as t}from"./index-3f96eae4.js";function n(e,t){if(e){const n=document.createElement("style");n.innerHTML=t,e.appendChild(n)}}function o(e,t){const n=new URL(t);fetch(n.href).then((e=>e.text())).then((t=>{const n=document.createElement("style");n.innerHTML=t,e&&e.appendChild(n)})).catch((e=>{console.error("There was an error while trying to load client styling from URL",e)}))}const r={en:{title:"Documents",documentType:"Document Type",documentNumber:"Document Number",documentNumberError:"Document number is invalid",saveButton:"Save Changes",successMessage:"Your changes have been saved!",errorMessageUpdate:"An error has occured when attempting to update the documents information",errorMessageFetch:"An error has occured when attempting to fetch the documents information"},"zh-hk":{title:"文件",documentType:"文件類型",documentNumber:"文件號碼",documentNumberError:"文件號碼無效",saveButton:"保存更改",successMessage:"您的更改已保存!",errorMessageUpdate:"嘗試更新文件信息時發生錯誤",errorMessageFetch:"在嘗試獲取文件信息時發生錯誤"},fr:{title:"Documents",documentType:"Type de document",documentNumber:"Numéro de document",documentNumberError:"Le numéro de document est invalide",saveButton:"Enregistrer les modifications",successMessage:"Vos modifications ont été enregistrées !",errorMessageUpdate:"Une erreur s'est produite lors de la tentative de mise à jour des informations des documents",errorMessageFetch:"Une erreur est survenue lors de la tentative de récupération des informations sur les documents"},ro:{title:"Documente",documentType:"Tip document",documentNumber:"Număr document",documentNumberError:"Numărul documentului este invalid",saveButton:"Salvează modificările",successMessage:"Modificările dvs. au fost salvate!",errorMessageUpdate:"A apărut o eroare la încercarea de a actualiza informațiile documentelor",errorMessageFetch:"A apărut o eroare la încercarea de a obține informațiile documentelor"},tr:{title:"Belgeler",documentType:"Belge Türü",documentNumber:"Belge Numarası",documentNumberError:"Belge numarası geçersiz",saveButton:"Değişiklikleri Kaydet",successMessage:"Değişiklikleriniz kaydedildi!",errorMessageUpdate:"Belgelerin bilgilerini güncellemeye çalışırken bir hata oluştu",errorMessageFetch:"Belgelerin bilgilerini almak için yapılan işlemde bir hata oluştu"},es:{title:"Documentos",documentType:"Tipo de documento",documentNumber:"Número de documento",documentNumberError:"El número de documento no es válido",saveButton:"Guardar cambios",successMessage:"¡Tus cambios han sido guardados!",errorMessageUpdate:"Se ha producido un error al intentar actualizar la información de los documentos",errorMessageFetch:"Se ha producido un error al intentar obtener la información de los documentos"},pt:{title:"Documentos",documentType:"Tipo de documento",documentNumber:"Número do documento",documentNumberError:"O número do documento é inválido",saveButton:"Salvar alterações",successMessage:"Suas alterações foram salvas!",errorMessageUpdate:"Ocorreu um erro ao tentar atualizar as informações dos documentos",errorMessageFetch:"Ocorreu um erro ao tentar buscar as informações dos documentos"},hr:{title:"Dokumenti",documentType:"Vrsta dokumenta",documentNumber:"Broj dokumenta",documentNumberError:"Broj dokumenta je nevažeći",saveButton:"Spremi promjene",successMessage:"Vaše promjene su spremljene!",errorMessageUpdate:"Došlo je do pogreške prilikom pokušaja ažuriranja informacija o dokumentima",errorMessageFetch:"Došlo je do greške prilikom pokušaja dobijanja informacija o dokumentima"},"pt-br":{title:"Documentos",documentType:"Tipo de documento",documentNumber:"Número do documento",documentNumberError:"O número do documento é inválido",saveButton:"Salvar alterações",successMessage:"Suas alterações foram salvas!",errorMessageUpdate:"Ocorreu um erro ao tentar atualizar as informações dos documentos",errorMessageFetch:"Ocorreu um erro ao tentar buscar as informações dos documentos"},"es-mx":{title:"Documentos",documentType:"Tipo de documento",documentNumber:"Número de documento",documentNumberError:"El número de documento no es válido",saveButton:"Guardar cambios",successMessage:"¡Tus cambios han sido guardados!",errorMessageUpdate:"Se ha producido un error al intentar actualizar la información de los documentos",errorMessageFetch:"Se ha producido un error al intentar obtener la información de los documentos"}},i=(e,t,n)=>{let o=r[r[t]?t:"en"][e];if(void 0!==n)for(const[e,t]of Object.entries(n.values)){const n=new RegExp(`{${e}}`,"g");o=o.replace(n,t)}return o},a=class{constructor(n){var o;e(this,n),this.dataRef={},this.fieldsState={},this.sendLoadedMessage=()=>{window.postMessage({type:"DOCUMENTS_LOADED"})},this.sendValidMessage=()=>{window.postMessage({type:"DOCUMENTS_VALIDITY",data:this.isSubmitButtonAvailable})},this.sendSuccessNotification=()=>{window.postMessage({type:"WidgetNotification",data:{type:"success",message:i("successMessage",this.lang)}},window.location.href)},this.sendErrorNotification=e=>{window.postMessage({type:"WidgetNotification",data:{type:"error",message:i(e,this.lang)}},window.location.href)},this.sendData=()=>{window.postMessage({type:"DOCUMENTS_UPDATE_DATA",data:this.data},window.location.href)},this.messageHandler=e=>{var t;switch(null===(t=e.data)||void 0===t?void 0:t.type){case"DOCUMENTS_DATA":this.data=e.data.data,this.resetState(),this.isSkeletonLoading=!1;break;case"DOCUMENTS_SEND_DATA":this.sendData()}},this.handleFetchResponse=async e=>{var t;if(e.status>=300){this.isError=!0;let n=await e.json();return this.errorCode=null===(t=n.thirdPartyResponse)||void 0===t?void 0:t.errorCode,this.errorMessage=i(this.errorCode?this.errorCode:"errorMessageFetch",this.lang),window.postMessage({type:"WidgetNotification",data:{type:"error",message:this.errorMessage}},window.location.href),Promise.reject(this.errorMessage)}if(this.isError=!1,e.headers.get("content-type")){let t=await e.json();return Promise.resolve(t)}return Promise.resolve()},this.getData=()=>{const e=new URL(`/api/v1/players/${this.userId}/player-identifiable-information/documents/`,this.endpoint),t=new Headers;t.append("X-SessionID",this.session);const n={method:"GET",headers:t};return new Promise(((t,o)=>{fetch(e.href,n).then((e=>this.handleFetchResponse(e))).then((e=>{this.data=e,t()})).catch((e=>{console.error(e),o(e)}))}))},this.buildFieldState=(e,t,n)=>Object.assign({isValid:e,initialValue:t,rule:n}),this.resetState=()=>{this.initData(),this.initEditableFieldsState(),this.invalidFields=0,this.isSubmitButtonAvailable=!1},this.updateState=e=>t=>{this.dataRef[e].documentNumber=t.target.value;const n=this.fieldsState[e].data.documentNumber,o=t.target.value,r=n.rule(o);r&&!n.isValid?(n.isValid=!0,this.invalidFields-=1):!r&&n.isValid&&(n.isValid=!1,this.invalidFields+=1),this.fieldsState[e].hasChanged=o!==n.initialValue;const i=this.isSubmitButtonAvailable;this.updateSubmitButtonStatus(),"true"!==this.isStandAlone&&this.isSubmitButtonAvailable!==i&&this.sendValidMessage()},this.updateData=e=>{e&&e.preventDefault();const t=[];for(const e of Object.keys(this.fieldsState)){if(!this.fieldsState[e].hasChanged)continue;const n=this.dataRef[e],o=new URL(`/api/v1/players/${this.userId}/player-identifiable-information/documents/${n.documentId}/`,this.endpoint),r=new Headers;r.append("X-SessionId",this.session),r.append("Content-Type","application/json-patch+json");const i={method:"PUT",headers:r,body:JSON.stringify(n)};t.push(fetch(o,i))}Promise.all(t).then((e=>{if(e.some((e=>!e.ok)))return this.sendErrorNotification("errorMessageUpdate");this.sendSuccessNotification(),this.getData().then((()=>this.resetState()))}))},this.updateSubmitButtonStatus=()=>{this.isSubmitButtonAvailable=0===this.invalidFields&&Object.values(this.fieldsState).some((e=>e.hasChanged))},this.editableField=(e,n,o,r)=>{const a=this.fieldsState[e].data[n],s=this.dataRef[e];return a?t("div",{class:"Field "+(a.isValid?"":"Invalid")},t("label",null,i(o,this.lang)),t("input",{type:"text",value:s[n],onKeyUp:this.updateState(e)}),!a.isValid&&t("p",{class:"Error"},i(r,this.lang))):null},this.staticField=(e,n,o)=>{const r=this.dataRef[e];return r&&r[n]?t("div",{class:"Field Disabled"},t("label",null,i(o,this.lang)),t("input",{type:"text",value:r[n],readonly:!0})):null},this.toggleScreen=()=>{window.postMessage({type:"PlayerAccountMenuActive",isMobile:this.isMobile},window.location.href)},this.userId=void 0,this.session=void 0,this.endpoint=void 0,this.lang="en",this.mbSource=void 0,this.clientStyling=void 0,this.clientStylingUrl=void 0,this.translationUrl=void 0,this.isEditable="false",this.isStandAlone="true",this.limitStylingAppends=!1,this.isSkeletonLoading=!0,this.isSubmitButtonAvailable=!1,this.invalidFields=0,this.isMobile=!!((o=window.navigator.userAgent).toLowerCase().match(/android/i)||o.toLowerCase().match(/blackberry|bb/i)||o.toLowerCase().match(/iphone|ipad|ipod/i)||o.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i)),this.isError=!1,this.errorMessage="",this.errorCode=""}handleStylingChange(e,t){e!==t&&n(this.stylingContainer,this.clientStyling)}handleStylingUrlChange(e,t){e!==t&&o(this.stylingContainer,this.clientStylingUrl)}async componentWillLoad(){"true"===this.isStandAlone&&await this.getData().then((()=>{this.initData(),this.initEditableFieldsState()})).finally((()=>this.isSkeletonLoading=!1))}componentDidLoad(){this.stylingContainer&&(null!=window.emMessageBuss?function(e,t){if(window.emMessageBus){const n=document.createElement("style");window.emMessageBus.subscribe(t,(t=>{n.innerHTML=t,e&&e.appendChild(n)}))}}(this.stylingContainer,`${this.mbSource}.Style`):(this.clientStyling&&n(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&o(this.stylingContainer,this.clientStylingUrl))),"true"!==this.isStandAlone&&(window.addEventListener("message",this.messageHandler,!1),this.sendLoadedMessage())}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe(),"true"!==this.isStandAlone&&window.removeEventListener("message",this.messageHandler,!1)}initData(){for(const e of this.data.documents)this.dataRef[e.documentType]=e}initEditableFieldsState(){for(const[e,t]of Object.entries(this.dataRef))this.fieldsState[e]={},this.fieldsState[e].data={},this.fieldsState[e].data.documentNumber=this.buildFieldState(!0,t.documentNumber,(e=>e&&/^(?=.*[a-zA-Z0-9])[a-zA-Z0-9\s]+$/.test(e)&&e.length<=50)),this.fieldsState[e].hasChanged=!1}render(){return!this.isSkeletonLoading&&this.isError?t("div",{class:"errorContainer"},t("p",{class:"errorMessage",innerHTML:this.errorMessage})):t("div",{ref:e=>this.stylingContainer=e},this.isSkeletonLoading?t("form",{class:"PlayerDocumentsWrapper skeleton"},t("div",{class:"ReturnButton"},t("ui-skeleton",{structure:"title",width:"auto",height:"30px"})),t("div",{class:"Section"},t("section",{class:"SectionContent"},t("div",{class:"Field"},t("ui-skeleton",{structure:"text",width:"auto","margin-bottom":"10px",height:"10px"}),t("ui-skeleton",{structure:"title",width:"100%",height:"40px"})),t("div",{class:"Field"},t("ui-skeleton",{structure:"text",width:"auto","margin-bottom":"10px",height:"10px"}),t("ui-skeleton",{structure:"title",width:"100%",height:"40px"})))),t("section",{class:"ButtonsArea"},t("div",{class:"SaveButton"},t("ui-skeleton",{structure:"rectangle",width:"auto",height:"40px"})))):t("form",{class:"PlayerDocumentsWrapper "+(this.isMobile?"Mobile":"")},t("div",{class:"ReturnButton",onClick:this.toggleScreen},t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"15",height:"15",viewBox:"0 0 15 15"},t("g",{transform:"translate(-20 -158)"},t("g",{transform:"translate(20 158)"},t("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)"})))),t("h2",null,i("title",this.lang))),t("h2",{class:"HeaderText"},i("title",this.lang)),t("div",{class:"Section"},t("section",{class:"SectionContent"},Object.keys(this.dataRef).map((e=>t("div",{class:"CompoundField"},this.staticField(e,"documentType","documentType"),"true"===this.isEditable?this.editableField(e,"documentNumber","documentNumber","documentNumberError"):this.staticField(e,"documentNumber","documentNumber")))))),"true"===this.isStandAlone&&t("section",{class:"ButtonsArea"},t("button",{class:"SaveButton "+(this.isSubmitButtonAvailable?"":"Disabled"),onClick:this.updateData},i("saveButton")))))}static get watchers(){return{clientStyling:["handleStylingChange"],clientStylingUrl:["handleStylingUrlChange"]}}};a.style=':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.errorContainer {\n font-family: "Roboto";\n font-style: normal;\n font-family: sans-serif;\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.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}';export{a as P}
|