@everymatrix/player-kyc-verification 1.20.5 → 1.20.8

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.
@@ -272,7 +272,7 @@ const PlayerKycVerificationWidget = class {
272
272
  },
273
273
  body: JSON.stringify({ DocumentCode: documentType }),
274
274
  };
275
- fetch(`${this.endpoint}/v1/player/${this.userId}/verification/GetPlayerKycVerificationDocumentUploadUrl`, uploadOptions)
275
+ fetch(`${this.endpoint}/v1/player/${this.userId}/verification/GetKYCVerificationDocumentUploadUrl`, uploadOptions)
276
276
  .then(response => {
277
277
  if (response.ok) {
278
278
  this.uploadingStatus = translate('uploading', this.language);
@@ -174,7 +174,7 @@ export class PlayerKycVerificationWidget {
174
174
  },
175
175
  body: JSON.stringify({ DocumentCode: documentType }),
176
176
  };
177
- fetch(`${this.endpoint}/v1/player/${this.userId}/verification/GetPlayerKycVerificationDocumentUploadUrl`, uploadOptions)
177
+ fetch(`${this.endpoint}/v1/player/${this.userId}/verification/GetKYCVerificationDocumentUploadUrl`, uploadOptions)
178
178
  .then(response => {
179
179
  if (response.ok) {
180
180
  this.uploadingStatus = translate('uploading', this.language);
@@ -270,7 +270,7 @@ const PlayerKycVerificationWidget = /*@__PURE__*/ proxyCustomElement(class exten
270
270
  },
271
271
  body: JSON.stringify({ DocumentCode: documentType }),
272
272
  };
273
- fetch(`${this.endpoint}/v1/player/${this.userId}/verification/GetPlayerKycVerificationDocumentUploadUrl`, uploadOptions)
273
+ fetch(`${this.endpoint}/v1/player/${this.userId}/verification/GetKYCVerificationDocumentUploadUrl`, uploadOptions)
274
274
  .then(response => {
275
275
  if (response.ok) {
276
276
  this.uploadingStatus = translate('uploading', this.language);
@@ -268,7 +268,7 @@ const PlayerKycVerificationWidget = class {
268
268
  },
269
269
  body: JSON.stringify({ DocumentCode: documentType }),
270
270
  };
271
- fetch(`${this.endpoint}/v1/player/${this.userId}/verification/GetPlayerKycVerificationDocumentUploadUrl`, uploadOptions)
271
+ fetch(`${this.endpoint}/v1/player/${this.userId}/verification/GetKYCVerificationDocumentUploadUrl`, uploadOptions)
272
272
  .then(response => {
273
273
  if (response.ok) {
274
274
  this.uploadingStatus = translate('uploading', this.language);
@@ -0,0 +1 @@
1
+ import{r as i,h as e,F as t}from"./p-1f2596d0.js";const n=["de","en"];let o={en:{loading:"Loading, please wait ...",noVerificationRequired:"There is no verification required for your account at this moment.",verificationComplete:"Verification complete",verificationFailed:"Verification failed",verificationExpired:"Verification expired",fileSizeExceeded:"Maximum file size exceeded. Max file size is: 50mb",uploading:"Uploading ... ",successUpload:"Your document has been uploaded and it will be reviewed shortly",failedUpload:"Upload failed please try again",chooseDocument:"Choose Document"},de:{loading:"Loading, please wait ...",noVerificationRequired:"There is no verification required for your account at this moment.",verificationComplete:"Verification complete",verificationFailed:"Verification failed",verificationExpired:"Verification expired",fileSizeExceeded:"Maximum file size exceeded. Max file size is: 50mb",uploading:"Uploading ... ",successUpload:"Your document has been uploaded and it will be reviewed shortly",failedUpload:"Upload failed please try again",chooseDocument:"Choose Document"},ro:{loading:"Loading, please wait ...",noVerificationRequired:"There is no verification required for your account at this moment.",verificationComplete:"Verification complete",verificationFailed:"Verification failed",verificationExpired:"Verification expired",fileSizeExceeded:"Maximum file size exceeded. Max file size is: 50mb",uploading:"Uploading ... ",successUpload:"Your document has been uploaded and it will be reviewed shortly",failedUpload:"Upload failed please try again",chooseDocument:"Choose Document"},fr:{loading:"Loading, please wait ...",noVerificationRequired:"There is no verification required for your account at this moment.",verificationComplete:"Verification complete",verificationFailed:"Verification failed",verificationExpired:"Verification expired",fileSizeExceeded:"Maximum file size exceeded. Max file size is: 50mb",uploading:"Uploading ... ",successUpload:"Your document has been uploaded and it will be reviewed shortly",failedUpload:"Upload failed please try again",chooseDocument:"Choose Document"},ar:{loading:"Loading, please wait ...",noVerificationRequired:"There is no verification required for your account at this moment.",verificationComplete:"Verification complete",verificationFailed:"Verification failed",verificationExpired:"Verification expired",fileSizeExceeded:"Maximum file size exceeded. Max file size is: 50mb",uploading:"Uploading ... ",successUpload:"Your document has been uploaded and it will be reviewed shortly",failedUpload:"Upload failed please try again",chooseDocument:"Choose Document"}};const r=i=>new Promise((e=>{fetch(i).then((i=>i.json())).then((i=>{Object.keys(i).forEach((e=>{for(let t in i[e])o[e][t]=i[e][t]})),e(!0)}))})),a=(i,e,t)=>{const r=e;let a=o[void 0!==r&&n.includes(r)?r:"en"][i];if(void 0!==t)for(const[i,e]of Object.entries(t.values)){const t=new RegExp(`{${i}}`,"g");a=a.replace(t,e)}return a},s=class{constructor(e){i(this,e),this.kycTitle="",this.description="",this.userId="",this.session="",this.endpoint="",this.translationUrl="",this.clientStyling="",this.clientStylingUrl="",this.verificationType=[],this.isLoading=!1,this.stylingAppends=!1,this.selectedFiles=null,this.uploadSizeExceeded=!1,this.expandedOnDesktop=!1,this.scriptInjected=!1,this.MAX_UPLOAD_SIZE=5e7,this.setClientStyling=()=>{let i=document.createElement("style");i.innerHTML=this.clientStyling,this.stylingContainer.prepend(i)},this.setClientStylingURL=()=>{let i=new URL(this.clientStylingUrl),e=document.createElement("style");fetch(i.href).then((i=>i.text())).then((i=>{e.innerHTML=i,setTimeout((()=>{this.stylingContainer.prepend(e)}),1)})).catch((i=>{console.log("error ",i)}))}}handleNewTranslations(){this.isLoading=!0,r(this.translationUrl).then((()=>{this.isLoading=!1}))}async componentWillLoad(){this.translationUrl.length>2&&await r(this.translationUrl)}componentDidRender(){!this.stylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.stylingAppends=!0)}async componentDidLoad(){window.innerWidth>700&&(this.expandedOnDesktop=!0);try{let i=new URL(`${this.endpoint}/v2/player/${this.userId}/verification/GetKYCCustomerStatus`);const e={method:"POST",headers:{"X-SessionId":this.session,"Content-Type":"application/json"},body:JSON.stringify({})};fetch(i.href,e).then((i=>{if(200===i.status)return i.json();throw new Error("HTTP status "+i.status)})).then((i=>{this.verificationType=i.verifications})).catch((i=>{console.error(i)}))}catch(i){console.error("Error fetching verification types:",i)}}handleOptionChange(i,e){const t=i.target;this.selectedOption=t.value,this.verificationType=this.verificationType.map((i=>(i.type===e&&(i.optionChosen=t.value),i)))}handleDocumentsStatus(i,e,t){this.verificationType=this.verificationType.map((n=>{if(n.type===i){const i=n.documents.find((i=>i.code===t));i&&(i.statusUploaded=e)}return n}))}toggleVerificationType(i,e){this.expandedOnDesktop=!1,this.verificationType=this.verificationType.map((t=>{var n;return t.type===i&&(null===(n=t.flowInfo)||void 0===n?void 0:n.type)==e&&(t.expanded=!t.expanded),t}))}checkFileSize(i){let e=0;return Object.keys(i).forEach((t=>{e+=i[t].size})),e<=this.MAX_UPLOAD_SIZE}handleFileSelection(i,e,t){if(this.selectedFiles=i,this.selectedFiles)if(this.checkFileSize(this.selectedFiles)){const i={method:"POST",headers:{"Content-Type":"application/json","X-SessionId":this.session},body:JSON.stringify({DocumentCode:e})};fetch(`${this.endpoint}/v1/player/${this.userId}/verification/GetKYCVerificationDocumentUploadUrl`,i).then((i=>{if(i.ok)return this.uploadingStatus=a("uploading",this.language),this.handleDocumentsStatus(t,this.uploadingStatus,e),i.json()})).then((i=>{const n=new FormData,o=this.selectedFiles;for(let i=0;i<o.length;i++)n.append("files",o[i]);fetch(i.Url,{method:"POST",body:n}).then((i=>{i.ok?(this.uploadingStatus=a("successUpload",this.language),this.handleDocumentsStatus(t,this.uploadingStatus,e)):(this.uploadingStatus=a("failedUpload",this.language),this.handleDocumentsStatus(t,this.uploadingStatus,e),console.error("File upload error:",i.status))})).catch((i=>{console.error("File upload error:",i)}))})).catch((i=>{console.error("File upload error:",i)}))}else console.error(a("fileSizeExceeded",this.language)),this.uploadingStatus=a("fileSizeExceeded",this.language),this.handleDocumentsStatus(t,this.uploadingStatus,e),this.uploadSizeExceeded=!0}importScript(i){return new Promise(((e,t)=>{fetch(i).then((i=>i.text())).then((i=>{if(new Function(i)(),this.scriptInjected)e(!0);else{const i=document.createElement("script");i.src="https://test.insic.de/frontend3/static/js/avs-loader.min.js",document.head.appendChild(i),this.scriptInjected=!0,e(!0)}})).catch((i=>{t(i)}))}))}renderVerificationTypeBox(i){var n,o;this.expandedOnDesktop&&(i.expanded=!0);let r=i.expanded,s=i.type.replace(/([A-Z])/g," $1"),c=i.optionChosen,d=i.status,l=i.documents,p=i.flowInfo;"Widget"===(null==p?void 0:p.type)&&this.importScript(p.url).then((()=>{console.log("Script imported correctly")})).catch((i=>{console.error("Error importing script:",i)}));const f="Verified"===d,h="Failed"===d||"Expired"===d;return e("div",{class:`verification-box ${r?"expanded":""} ${h?"failed":""} ${f?"success":""}`},e("div",{class:"box box-header "+(r?"expanded":""),onClick:()=>{var e;return this.toggleVerificationType(i.type,null===(e=i.flowInfo)||void 0===e?void 0:e.type)}},e("div",{class:"box-icon"},f?e("svg",{width:"100",height:"100",viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg"},e("circle",{cx:"50",cy:"50",r:"40",fill:"#388D79"}),e("circle",{cx:"50",cy:"50",r:"34",fill:"none",stroke:"#fff","stroke-width":"12px"}),e("polyline",{points:"30,50 45,63 70,35",fill:"none",stroke:"#fff","stroke-width":"8px"})):h?e("svg",{width:"100",height:"100",viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg"},e("circle",{cx:"50",cy:"50",r:"40",fill:"red"}),e("line",{x1:"30",y1:"30",x2:"70",y2:"70",stroke:"#fff","stroke-width":"10px"}),e("line",{x1:"30",y1:"70",x2:"70",y2:"30",stroke:"#fff","stroke-width":"10px"})):e("svg",{width:"800px",height:"800px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e("path",{d:"M4 4V20C4 21.1046 4.89543 22 6 22L18 22C19.1046 22 20 21.1046 20 20V8.34162C20 7.8034 19.7831 7.28789 19.3982 6.91161L14.9579 2.56999C14.5842 2.20459 14.0824 2 13.5597 2L6 2C4.89543 2 4 2.89543 4 4Z",stroke:"#000000","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M9 13H15",stroke:"#000000","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M9 17H12",stroke:"#000000","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M14 2V6C14 7.10457 14.8954 8 16 8H20",stroke:"#000000","stroke-width":"2","stroke-linejoin":"round"}))),e("div",{class:"box-title"},s),e("div",{class:"chevron-icon"},e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},e("path",{d:r?"M6 15l6-6 6 6":"M6 9l6 6 6-6"})))),e("div",{class:"box box-content"},r&&"Widget"!=(null==p?void 0:p.type)?e(t,null,f?e("div",{class:"verification-status"},a("verificationComplete",this.language)):h?e("div",{class:"verification-status"},a("Failed"===d?"verificationFailed":"verificationExpired",this.language)):e("div",{class:"documents-dropdown"},e("select",{class:"nice-select",onChange:e=>this.handleOptionChange(e,i.type)},e("option",{value:"",selected:!0,disabled:!0,hidden:!0},a("chooseDocument",this.language)),l.map((i=>e("option",{selected:c==i.code,value:i.code},i.type.replace(/([A-Z])/g," $1"))))),(null===(n=l.find((i=>i.code==c)))||void 0===n?void 0:n.statusUploaded)?e("div",{class:"upload-status"},null===(o=l.find((i=>i.code==c)))||void 0===o?void 0:o.statusUploaded):e("div",{class:"upload-button"},c?e("label",null,e("input",{type:"file",accept:"*",multiple:!0,onChange:e=>this.handleFileSelection(e.target.files,this.selectedOption,i.type),style:{display:"none"}}),e("svg",{width:"100",height:"100",xmlns:"http://www.w3.org/2000/svg"},e("circle",{cx:"50",cy:"50",r:"40",fill:"#388D79"}),e("line",{x1:"30",y1:"50",x2:"70",y2:"50",stroke:"white","stroke-width":"6"}),e("line",{x1:"50",y1:"30",x2:"50",y2:"70",stroke:"white","stroke-width":"6"}))):null))):e("div",{id:"__avs-wrapper"})))}render(){return this.isLoading?e("div",null,e("p",null,a("loading",this.language))):0===this.verificationType.length?e("div",{style:{padding:"24px",fontSize:"18px"}},a("noVerificationRequired",this.language)):e("div",{class:"ModalContainer",ref:i=>this.stylingContainer=i},e("div",{class:"player-kyc-verification-widget"},e("h2",null,this.kycTitle),e("div",{class:"widget-description"},this.description),e("div",{class:"verification-types"},this.verificationType.map((i=>"Manual"===i.vendorName||"Insic"===i.vendorName?this.renderVerificationTypeBox(i):null)))))}static get watchers(){return{translationUrl:["handleNewTranslations"]}}};s.style='@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap");\n:host {\n font-family: "Roboto", sans-serif;\n}\n\n.ModalContainer {\n container-type: inline-size;\n}\n\n.player-kyc-verification-widget {\n padding: 20px;\n align-items: center;\n}\n.player-kyc-verification-widget h2 {\n margin: 4px;\n}\n.player-kyc-verification-widget .widget-description {\n margin: 24px 0px;\n}\n.player-kyc-verification-widget .verification-types {\n width: 100%;\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n grid-gap: 34px;\n}\n.player-kyc-verification-widget .verification-types .verification-box {\n transition: height 0.3s, border-color 0.3s;\n border: solid 1.4px #b5b5b5;\n border-radius: 2px;\n display: flex;\n flex-direction: column;\n padding: 0px 14px;\n border-width: 2px 2px 8px 2px;\n align-self: start;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box {\n flex-shrink: 0;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-header {\n display: flex;\n padding: 14px 0px;\n justify-content: space-between;\n cursor: pointer;\n align-items: center;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-header .box-icon {\n flex-grow: 1;\n display: flex;\n justify-content: center;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-header .box-icon svg {\n height: 24px;\n width: 24px;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-header .box-title {\n flex-grow: 1;\n font-size: 18px;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-header .chevron-icon {\n flex-grow: 10;\n width: 14px;\n height: 14px;\n display: flex;\n justify-content: flex-end;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-header .chevron-icon svg {\n width: 20px;\n height: 22px;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-content {\n display: none;\n flex-grow: 1;\n border-top: 0.4px solid #bcbcbc;\n padding: 10px 0px;\n flex-grow: 1;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-content .upload-status {\n text-align: center;\n padding: 20px;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-content .documents-dropdown {\n display: flex;\n flex-direction: column;\n width: 100%;\n align-items: center;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-content .documents-dropdown svg {\n margin: 16px;\n cursor: pointer;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-content .documents-dropdown .nice-select {\n cursor: pointer;\n width: 100%;\n height: 30px;\n padding: 4px 14px;\n font-size: 14px;\n border: 1px solid #ccc;\n border-radius: 2px;\n background-color: #fff;\n color: #333;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n padding-right: 30px;\n background-repeat: no-repeat;\n background-position: right 10px center;\n background-image: url(\'data:image/svg+xml;charset=utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path fill="%23333" d="M10 18.4l-6.5-6.5h13z"/><path fill="%23333" d="M10 1.6l6.5 6.5H3.5z"/></svg>\');\n}\n.player-kyc-verification-widget .verification-types .verification-box.expanded {\n border-color: green;\n}\n.player-kyc-verification-widget .verification-types .verification-box.failed {\n border-color: #d42323;\n}\n.player-kyc-verification-widget .verification-types .verification-box.success {\n border-color: green;\n}\n.player-kyc-verification-widget .verification-types .verification-box.expanded .box-content {\n display: flex;\n justify-content: center;\n flex-direction: column;\n}\n.player-kyc-verification-widget .verification-types .verification-box.expanded .box-content .verification-status {\n margin: 12px 0px 16px;\n font-size: 18px;\n text-align: center;\n color: #9b9b9b;\n}\n\n@container (min-width: 700px) {\n .player-kyc-verification-widget {\n padding: 100px 60px;\n }\n}\n@container (max-width: 700px) {\n .player-kyc-verification-widget h2 {\n margin: 4px;\n text-align: center;\n }\n .player-kyc-verification-widget .verification-types {\n grid-template-columns: 1fr;\n grid-gap: 16px;\n }\n}\n@container (max-width: 1249px) {\n .verification-types {\n grid-template-columns: repeat(2, 1fr);\n }\n}';export{s as player_kyc_verification}
@@ -1 +1 @@
1
- import{p as e,b as i}from"./p-1f2596d0.js";(()=>{const i=import.meta.url,t={};return""!==i&&(t.resourcesUrl=new URL(".",i).href),e(t)})().then((e=>i([["p-f97a48ad",[[1,"player-kyc-verification",{kycTitle:[1,"kyc-title"],description:[1],userId:[1,"user-id"],session:[1],language:[1],endpoint:[1],translationUrl:[1,"translation-url"],clientStyling:[1,"client-styling"],clientStylingUrl:[1,"client-styling-url"],verificationType:[32],isLoading:[32],stylingAppends:[32],selectedFiles:[32],uploadingStatus:[32],uploadSizeExceeded:[32],selectedOption:[32],expandedOnDesktop:[32]}]]]],e)));
1
+ import{p as e,b as i}from"./p-1f2596d0.js";(()=>{const i=import.meta.url,t={};return""!==i&&(t.resourcesUrl=new URL(".",i).href),e(t)})().then((e=>i([["p-dbf281f4",[[1,"player-kyc-verification",{kycTitle:[1,"kyc-title"],description:[1],userId:[1,"user-id"],session:[1],language:[1],endpoint:[1],translationUrl:[1,"translation-url"],clientStyling:[1,"client-styling"],clientStylingUrl:[1,"client-styling-url"],verificationType:[32],isLoading:[32],stylingAppends:[32],selectedFiles:[32],uploadingStatus:[32],uploadSizeExceeded:[32],selectedOption:[32],expandedOnDesktop:[32]}]]]],e)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/player-kyc-verification",
3
- "version": "1.20.5",
3
+ "version": "1.20.8",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",
@@ -1 +0,0 @@
1
- import{r as i,h as e,F as t}from"./p-1f2596d0.js";const n=["de","en"];let o={en:{loading:"Loading, please wait ...",noVerificationRequired:"There is no verification required for your account at this moment.",verificationComplete:"Verification complete",verificationFailed:"Verification failed",verificationExpired:"Verification expired",fileSizeExceeded:"Maximum file size exceeded. Max file size is: 50mb",uploading:"Uploading ... ",successUpload:"Your document has been uploaded and it will be reviewed shortly",failedUpload:"Upload failed please try again",chooseDocument:"Choose Document"},de:{loading:"Loading, please wait ...",noVerificationRequired:"There is no verification required for your account at this moment.",verificationComplete:"Verification complete",verificationFailed:"Verification failed",verificationExpired:"Verification expired",fileSizeExceeded:"Maximum file size exceeded. Max file size is: 50mb",uploading:"Uploading ... ",successUpload:"Your document has been uploaded and it will be reviewed shortly",failedUpload:"Upload failed please try again",chooseDocument:"Choose Document"},ro:{loading:"Loading, please wait ...",noVerificationRequired:"There is no verification required for your account at this moment.",verificationComplete:"Verification complete",verificationFailed:"Verification failed",verificationExpired:"Verification expired",fileSizeExceeded:"Maximum file size exceeded. Max file size is: 50mb",uploading:"Uploading ... ",successUpload:"Your document has been uploaded and it will be reviewed shortly",failedUpload:"Upload failed please try again",chooseDocument:"Choose Document"},fr:{loading:"Loading, please wait ...",noVerificationRequired:"There is no verification required for your account at this moment.",verificationComplete:"Verification complete",verificationFailed:"Verification failed",verificationExpired:"Verification expired",fileSizeExceeded:"Maximum file size exceeded. Max file size is: 50mb",uploading:"Uploading ... ",successUpload:"Your document has been uploaded and it will be reviewed shortly",failedUpload:"Upload failed please try again",chooseDocument:"Choose Document"},ar:{loading:"Loading, please wait ...",noVerificationRequired:"There is no verification required for your account at this moment.",verificationComplete:"Verification complete",verificationFailed:"Verification failed",verificationExpired:"Verification expired",fileSizeExceeded:"Maximum file size exceeded. Max file size is: 50mb",uploading:"Uploading ... ",successUpload:"Your document has been uploaded and it will be reviewed shortly",failedUpload:"Upload failed please try again",chooseDocument:"Choose Document"}};const r=i=>new Promise((e=>{fetch(i).then((i=>i.json())).then((i=>{Object.keys(i).forEach((e=>{for(let t in i[e])o[e][t]=i[e][t]})),e(!0)}))})),a=(i,e,t)=>{const r=e;let a=o[void 0!==r&&n.includes(r)?r:"en"][i];if(void 0!==t)for(const[i,e]of Object.entries(t.values)){const t=new RegExp(`{${i}}`,"g");a=a.replace(t,e)}return a},s=class{constructor(e){i(this,e),this.kycTitle="",this.description="",this.userId="",this.session="",this.endpoint="",this.translationUrl="",this.clientStyling="",this.clientStylingUrl="",this.verificationType=[],this.isLoading=!1,this.stylingAppends=!1,this.selectedFiles=null,this.uploadSizeExceeded=!1,this.expandedOnDesktop=!1,this.scriptInjected=!1,this.MAX_UPLOAD_SIZE=5e7,this.setClientStyling=()=>{let i=document.createElement("style");i.innerHTML=this.clientStyling,this.stylingContainer.prepend(i)},this.setClientStylingURL=()=>{let i=new URL(this.clientStylingUrl),e=document.createElement("style");fetch(i.href).then((i=>i.text())).then((i=>{e.innerHTML=i,setTimeout((()=>{this.stylingContainer.prepend(e)}),1)})).catch((i=>{console.log("error ",i)}))}}handleNewTranslations(){this.isLoading=!0,r(this.translationUrl).then((()=>{this.isLoading=!1}))}async componentWillLoad(){this.translationUrl.length>2&&await r(this.translationUrl)}componentDidRender(){!this.stylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.stylingAppends=!0)}async componentDidLoad(){window.innerWidth>700&&(this.expandedOnDesktop=!0);try{let i=new URL(`${this.endpoint}/v2/player/${this.userId}/verification/GetKYCCustomerStatus`);const e={method:"POST",headers:{"X-SessionId":this.session,"Content-Type":"application/json"},body:JSON.stringify({})};fetch(i.href,e).then((i=>{if(200===i.status)return i.json();throw new Error("HTTP status "+i.status)})).then((i=>{this.verificationType=i.verifications})).catch((i=>{console.error(i)}))}catch(i){console.error("Error fetching verification types:",i)}}handleOptionChange(i,e){const t=i.target;this.selectedOption=t.value,this.verificationType=this.verificationType.map((i=>(i.type===e&&(i.optionChosen=t.value),i)))}handleDocumentsStatus(i,e,t){this.verificationType=this.verificationType.map((n=>{if(n.type===i){const i=n.documents.find((i=>i.code===t));i&&(i.statusUploaded=e)}return n}))}toggleVerificationType(i,e){this.expandedOnDesktop=!1,this.verificationType=this.verificationType.map((t=>{var n;return t.type===i&&(null===(n=t.flowInfo)||void 0===n?void 0:n.type)==e&&(t.expanded=!t.expanded),t}))}checkFileSize(i){let e=0;return Object.keys(i).forEach((t=>{e+=i[t].size})),e<=this.MAX_UPLOAD_SIZE}handleFileSelection(i,e,t){if(this.selectedFiles=i,this.selectedFiles)if(this.checkFileSize(this.selectedFiles)){const i={method:"POST",headers:{"Content-Type":"application/json","X-SessionId":this.session},body:JSON.stringify({DocumentCode:e})};fetch(`${this.endpoint}/v1/player/${this.userId}/verification/GetPlayerKycVerificationDocumentUploadUrl`,i).then((i=>{if(i.ok)return this.uploadingStatus=a("uploading",this.language),this.handleDocumentsStatus(t,this.uploadingStatus,e),i.json()})).then((i=>{const n=new FormData,o=this.selectedFiles;for(let i=0;i<o.length;i++)n.append("files",o[i]);fetch(i.Url,{method:"POST",body:n}).then((i=>{i.ok?(this.uploadingStatus=a("successUpload",this.language),this.handleDocumentsStatus(t,this.uploadingStatus,e)):(this.uploadingStatus=a("failedUpload",this.language),this.handleDocumentsStatus(t,this.uploadingStatus,e),console.error("File upload error:",i.status))})).catch((i=>{console.error("File upload error:",i)}))})).catch((i=>{console.error("File upload error:",i)}))}else console.error(a("fileSizeExceeded",this.language)),this.uploadingStatus=a("fileSizeExceeded",this.language),this.handleDocumentsStatus(t,this.uploadingStatus,e),this.uploadSizeExceeded=!0}importScript(i){return new Promise(((e,t)=>{fetch(i).then((i=>i.text())).then((i=>{if(new Function(i)(),this.scriptInjected)e(!0);else{const i=document.createElement("script");i.src="https://test.insic.de/frontend3/static/js/avs-loader.min.js",document.head.appendChild(i),this.scriptInjected=!0,e(!0)}})).catch((i=>{t(i)}))}))}renderVerificationTypeBox(i){var n,o;this.expandedOnDesktop&&(i.expanded=!0);let r=i.expanded,s=i.type.replace(/([A-Z])/g," $1"),c=i.optionChosen,d=i.status,l=i.documents,p=i.flowInfo;"Widget"===(null==p?void 0:p.type)&&this.importScript(p.url).then((()=>{console.log("Script imported correctly")})).catch((i=>{console.error("Error importing script:",i)}));const f="Verified"===d,h="Failed"===d||"Expired"===d;return e("div",{class:`verification-box ${r?"expanded":""} ${h?"failed":""} ${f?"success":""}`},e("div",{class:"box box-header "+(r?"expanded":""),onClick:()=>{var e;return this.toggleVerificationType(i.type,null===(e=i.flowInfo)||void 0===e?void 0:e.type)}},e("div",{class:"box-icon"},f?e("svg",{width:"100",height:"100",viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg"},e("circle",{cx:"50",cy:"50",r:"40",fill:"#388D79"}),e("circle",{cx:"50",cy:"50",r:"34",fill:"none",stroke:"#fff","stroke-width":"12px"}),e("polyline",{points:"30,50 45,63 70,35",fill:"none",stroke:"#fff","stroke-width":"8px"})):h?e("svg",{width:"100",height:"100",viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg"},e("circle",{cx:"50",cy:"50",r:"40",fill:"red"}),e("line",{x1:"30",y1:"30",x2:"70",y2:"70",stroke:"#fff","stroke-width":"10px"}),e("line",{x1:"30",y1:"70",x2:"70",y2:"30",stroke:"#fff","stroke-width":"10px"})):e("svg",{width:"800px",height:"800px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e("path",{d:"M4 4V20C4 21.1046 4.89543 22 6 22L18 22C19.1046 22 20 21.1046 20 20V8.34162C20 7.8034 19.7831 7.28789 19.3982 6.91161L14.9579 2.56999C14.5842 2.20459 14.0824 2 13.5597 2L6 2C4.89543 2 4 2.89543 4 4Z",stroke:"#000000","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M9 13H15",stroke:"#000000","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M9 17H12",stroke:"#000000","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),e("path",{d:"M14 2V6C14 7.10457 14.8954 8 16 8H20",stroke:"#000000","stroke-width":"2","stroke-linejoin":"round"}))),e("div",{class:"box-title"},s),e("div",{class:"chevron-icon"},e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},e("path",{d:r?"M6 15l6-6 6 6":"M6 9l6 6 6-6"})))),e("div",{class:"box box-content"},r&&"Widget"!=(null==p?void 0:p.type)?e(t,null,f?e("div",{class:"verification-status"},a("verificationComplete",this.language)):h?e("div",{class:"verification-status"},a("Failed"===d?"verificationFailed":"verificationExpired",this.language)):e("div",{class:"documents-dropdown"},e("select",{class:"nice-select",onChange:e=>this.handleOptionChange(e,i.type)},e("option",{value:"",selected:!0,disabled:!0,hidden:!0},a("chooseDocument",this.language)),l.map((i=>e("option",{selected:c==i.code,value:i.code},i.type.replace(/([A-Z])/g," $1"))))),(null===(n=l.find((i=>i.code==c)))||void 0===n?void 0:n.statusUploaded)?e("div",{class:"upload-status"},null===(o=l.find((i=>i.code==c)))||void 0===o?void 0:o.statusUploaded):e("div",{class:"upload-button"},c?e("label",null,e("input",{type:"file",accept:"*",multiple:!0,onChange:e=>this.handleFileSelection(e.target.files,this.selectedOption,i.type),style:{display:"none"}}),e("svg",{width:"100",height:"100",xmlns:"http://www.w3.org/2000/svg"},e("circle",{cx:"50",cy:"50",r:"40",fill:"#388D79"}),e("line",{x1:"30",y1:"50",x2:"70",y2:"50",stroke:"white","stroke-width":"6"}),e("line",{x1:"50",y1:"30",x2:"50",y2:"70",stroke:"white","stroke-width":"6"}))):null))):e("div",{id:"__avs-wrapper"})))}render(){return this.isLoading?e("div",null,e("p",null,a("loading",this.language))):0===this.verificationType.length?e("div",{style:{padding:"24px",fontSize:"18px"}},a("noVerificationRequired",this.language)):e("div",{class:"ModalContainer",ref:i=>this.stylingContainer=i},e("div",{class:"player-kyc-verification-widget"},e("h2",null,this.kycTitle),e("div",{class:"widget-description"},this.description),e("div",{class:"verification-types"},this.verificationType.map((i=>"Manual"===i.vendorName||"Insic"===i.vendorName?this.renderVerificationTypeBox(i):null)))))}static get watchers(){return{translationUrl:["handleNewTranslations"]}}};s.style='@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap");\n:host {\n font-family: "Roboto", sans-serif;\n}\n\n.ModalContainer {\n container-type: inline-size;\n}\n\n.player-kyc-verification-widget {\n padding: 20px;\n align-items: center;\n}\n.player-kyc-verification-widget h2 {\n margin: 4px;\n}\n.player-kyc-verification-widget .widget-description {\n margin: 24px 0px;\n}\n.player-kyc-verification-widget .verification-types {\n width: 100%;\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n grid-gap: 34px;\n}\n.player-kyc-verification-widget .verification-types .verification-box {\n transition: height 0.3s, border-color 0.3s;\n border: solid 1.4px #b5b5b5;\n border-radius: 2px;\n display: flex;\n flex-direction: column;\n padding: 0px 14px;\n border-width: 2px 2px 8px 2px;\n align-self: start;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box {\n flex-shrink: 0;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-header {\n display: flex;\n padding: 14px 0px;\n justify-content: space-between;\n cursor: pointer;\n align-items: center;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-header .box-icon {\n flex-grow: 1;\n display: flex;\n justify-content: center;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-header .box-icon svg {\n height: 24px;\n width: 24px;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-header .box-title {\n flex-grow: 1;\n font-size: 18px;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-header .chevron-icon {\n flex-grow: 10;\n width: 14px;\n height: 14px;\n display: flex;\n justify-content: flex-end;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-header .chevron-icon svg {\n width: 20px;\n height: 22px;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-content {\n display: none;\n flex-grow: 1;\n border-top: 0.4px solid #bcbcbc;\n padding: 10px 0px;\n flex-grow: 1;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-content .upload-status {\n text-align: center;\n padding: 20px;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-content .documents-dropdown {\n display: flex;\n flex-direction: column;\n width: 100%;\n align-items: center;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-content .documents-dropdown svg {\n margin: 16px;\n cursor: pointer;\n}\n.player-kyc-verification-widget .verification-types .verification-box .box-content .documents-dropdown .nice-select {\n cursor: pointer;\n width: 100%;\n height: 30px;\n padding: 4px 14px;\n font-size: 14px;\n border: 1px solid #ccc;\n border-radius: 2px;\n background-color: #fff;\n color: #333;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n padding-right: 30px;\n background-repeat: no-repeat;\n background-position: right 10px center;\n background-image: url(\'data:image/svg+xml;charset=utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path fill="%23333" d="M10 18.4l-6.5-6.5h13z"/><path fill="%23333" d="M10 1.6l6.5 6.5H3.5z"/></svg>\');\n}\n.player-kyc-verification-widget .verification-types .verification-box.expanded {\n border-color: green;\n}\n.player-kyc-verification-widget .verification-types .verification-box.failed {\n border-color: #d42323;\n}\n.player-kyc-verification-widget .verification-types .verification-box.success {\n border-color: green;\n}\n.player-kyc-verification-widget .verification-types .verification-box.expanded .box-content {\n display: flex;\n justify-content: center;\n flex-direction: column;\n}\n.player-kyc-verification-widget .verification-types .verification-box.expanded .box-content .verification-status {\n margin: 12px 0px 16px;\n font-size: 18px;\n text-align: center;\n color: #9b9b9b;\n}\n\n@container (min-width: 700px) {\n .player-kyc-verification-widget {\n padding: 100px 60px;\n }\n}\n@container (max-width: 700px) {\n .player-kyc-verification-widget h2 {\n margin: 4px;\n text-align: center;\n }\n .player-kyc-verification-widget .verification-types {\n grid-template-columns: 1fr;\n grid-gap: 16px;\n }\n}\n@container (max-width: 1249px) {\n .verification-types {\n grid-template-columns: repeat(2, 1fr);\n }\n}';export{s as player_kyc_verification}