@everymatrix/player-sms-verification 1.33.3 → 1.33.5
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/player-sms-verification.cjs.entry.js +5 -7
- package/dist/collection/components/player-sms-verification/player-sms-verification.js +5 -7
- package/dist/components/player-sms-verification.js +5 -7
- package/dist/esm/player-sms-verification.entry.js +5 -7
- package/dist/player-sms-verification/{p-bc36820b.entry.js → p-b9cfaa13.entry.js} +1 -1
- package/dist/player-sms-verification/player-sms-verification.esm.js +1 -1
- package/dist/types/Users/dragos.bodea/Documents/everymatrix-prjs/emfe-widgets/widgets-stencil/packages/player-sms-verification/.stencil/packages/player-sms-verification/stencil.config.d.ts +2 -0
- package/package.json +1 -1
- package/dist/types/Users/sebastian.strulea/Documents/work/widgets-stencil/packages/player-sms-verification/.stencil/packages/player-sms-verification/stencil.config.d.ts +0 -2
|
@@ -268,14 +268,12 @@ const PlayerSmsVerification = class {
|
|
|
268
268
|
})
|
|
269
269
|
};
|
|
270
270
|
fetch(url.href, options)
|
|
271
|
-
.then((
|
|
272
|
-
.
|
|
273
|
-
if (
|
|
274
|
-
this.
|
|
275
|
-
if (this.errMsg === 'errExceededAttempts') {
|
|
276
|
-
window.postMessage({ type: 'SmsVerificationErrExceededAttempts', data: translate(this.errMsg) }, window.location.href);
|
|
277
|
-
}
|
|
271
|
+
.then(() => {
|
|
272
|
+
this.msgEnterCode = 'msgEnterCode';
|
|
273
|
+
if (this.isCodeSentOnce) {
|
|
274
|
+
this.startTimerBtnResendCode();
|
|
278
275
|
}
|
|
276
|
+
this.isCodeSentOnce = true;
|
|
279
277
|
})
|
|
280
278
|
.catch((err) => {
|
|
281
279
|
this.setErrMsg('errGenerateCode');
|
|
@@ -113,14 +113,12 @@ export class PlayerSmsVerification {
|
|
|
113
113
|
})
|
|
114
114
|
};
|
|
115
115
|
fetch(url.href, options)
|
|
116
|
-
.then((
|
|
117
|
-
.
|
|
118
|
-
if (
|
|
119
|
-
this.
|
|
120
|
-
if (this.errMsg === 'errExceededAttempts') {
|
|
121
|
-
window.postMessage({ type: 'SmsVerificationErrExceededAttempts', data: translate(this.errMsg) }, window.location.href);
|
|
122
|
-
}
|
|
116
|
+
.then(() => {
|
|
117
|
+
this.msgEnterCode = 'msgEnterCode';
|
|
118
|
+
if (this.isCodeSentOnce) {
|
|
119
|
+
this.startTimerBtnResendCode();
|
|
123
120
|
}
|
|
121
|
+
this.isCodeSentOnce = true;
|
|
124
122
|
})
|
|
125
123
|
.catch((err) => {
|
|
126
124
|
this.setErrMsg('errGenerateCode');
|
|
@@ -266,14 +266,12 @@ const PlayerSmsVerification$1 = /*@__PURE__*/ proxyCustomElement(class extends H
|
|
|
266
266
|
})
|
|
267
267
|
};
|
|
268
268
|
fetch(url.href, options)
|
|
269
|
-
.then((
|
|
270
|
-
.
|
|
271
|
-
if (
|
|
272
|
-
this.
|
|
273
|
-
if (this.errMsg === 'errExceededAttempts') {
|
|
274
|
-
window.postMessage({ type: 'SmsVerificationErrExceededAttempts', data: translate(this.errMsg) }, window.location.href);
|
|
275
|
-
}
|
|
269
|
+
.then(() => {
|
|
270
|
+
this.msgEnterCode = 'msgEnterCode';
|
|
271
|
+
if (this.isCodeSentOnce) {
|
|
272
|
+
this.startTimerBtnResendCode();
|
|
276
273
|
}
|
|
274
|
+
this.isCodeSentOnce = true;
|
|
277
275
|
})
|
|
278
276
|
.catch((err) => {
|
|
279
277
|
this.setErrMsg('errGenerateCode');
|
|
@@ -264,14 +264,12 @@ const PlayerSmsVerification = class {
|
|
|
264
264
|
})
|
|
265
265
|
};
|
|
266
266
|
fetch(url.href, options)
|
|
267
|
-
.then((
|
|
268
|
-
.
|
|
269
|
-
if (
|
|
270
|
-
this.
|
|
271
|
-
if (this.errMsg === 'errExceededAttempts') {
|
|
272
|
-
window.postMessage({ type: 'SmsVerificationErrExceededAttempts', data: translate(this.errMsg) }, window.location.href);
|
|
273
|
-
}
|
|
267
|
+
.then(() => {
|
|
268
|
+
this.msgEnterCode = 'msgEnterCode';
|
|
269
|
+
if (this.isCodeSentOnce) {
|
|
270
|
+
this.startTimerBtnResendCode();
|
|
274
271
|
}
|
|
272
|
+
this.isCodeSentOnce = true;
|
|
275
273
|
})
|
|
276
274
|
.catch((err) => {
|
|
277
275
|
this.setErrMsg('errGenerateCode');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,h as t}from"./p-02347cab.js";const i={en:{title:"SMS Verification required",subtitle:"You need to verify your phone number",btnSend:"Send Code",btnResend:"Resend Code",btnActivate:"Activate",msgEnterCode:"Please enter the verification code you received on your number",msgResendNotice:"A new verification code has been sent to your phone number",errGenerateCode:"An error occurred while generating your code. Please click the resend button to generate a new code",errInvalidCode:"The code is incorrect",errExceededAttempts:"Too many attempts. Try again later",errExpiredToken:"The code expired, resend code",errInvalidPhone:"The provided phone number is invalid"},ro:{title:"SMS Verification required",subtitle:"You need to verify your phone number",btnSend:"Send Code",btnResend:"Resend Code",btnActivate:"Activate",msgEnterCode:"Please enter the verification code you received on your number",msgResendNotice:"A new verification code has been sent to your phone number",errGenerateCode:"An error occurred while generating your code. Please click the resend button to generate a new code",errInvalidCode:"The code is incorrect",errExceededAttempts:"Too many attempts. Try again later",errExpiredToken:"The code expired, resend code",errInvalidPhone:"The provided phone number is invalid"},fr:{title:"SMS Verification required",subtitle:"You need to verify your phone number",btnSend:"Send Code",btnResend:"Resend Code",btnActivate:"Activate",msgEnterCode:"Please enter the verification code you received on your number",msgResendNotice:"A new verification code has been sent to your phone number",errGenerateCode:"An error occurred while generating your code. Please click the resend button to generate a new code",errInvalidCode:"The code is incorrect",errExceededAttempts:"Too many attempts. Try again later",errExpiredToken:"The code expired, resend code",errInvalidPhone:"The provided phone number is invalid"},hu:{title:"SMS Verification required",subtitle:"You need to verify your phone number",btnSend:"Send Code",btnResend:"Resend Code",btnActivate:"Activate",msgEnterCode:"Please enter the verification code you received on your number",msgResendNotice:"A new verification code has been sent to your phone number",errGenerateCode:"An error occurred while generating your code. Please click the resend button to generate a new code",errInvalidCode:"The code is incorrect",errExceededAttempts:"Too many attempts. Try again later",errExpiredToken:"The code expired, resend code",errInvalidPhone:"The provided phone number is invalid"},tr:{title:"SMS Verification required",subtitle:"You need to verify your phone number",btnSend:"Send Code",btnResend:"Resend Code",btnActivate:"Activate",msgEnterCode:"Please enter the verification code you received on your number",msgResendNotice:"A new verification code has been sent to your phone number",errGenerateCode:"An error occurred while generating your code. Please click the resend button to generate a new code",errInvalidCode:"The code is incorrect",errExceededAttempts:"Too many attempts. Try again later",errExpiredToken:"The code expired, resend code",errInvalidPhone:"The provided phone number is invalid"},el:{title:"SMS Verification required",subtitle:"You need to verify your phone number",btnSend:"Send Code",btnResend:"Resend Code",btnActivate:"Activate",msgEnterCode:"Please enter the verification code you received on your number",msgResendNotice:"A new verification code has been sent to your phone number",errGenerateCode:"An error occurred while generating your code. Please click the resend button to generate a new code",errInvalidCode:"The code is incorrect",errExceededAttempts:"Too many attempts. Try again later",errExpiredToken:"The code expired, resend code",errInvalidPhone:"The provided phone number is invalid"},es:{title:"SMS Verification required",subtitle:"You need to verify your phone number",btnSend:"Send Code",btnResend:"Resend Code",btnActivate:"Activate",msgEnterCode:"Please enter the verification code you received on your number",msgResendNotice:"A new verification code has been sent to your phone number",errGenerateCode:"An error occurred while generating your code. Please click the resend button to generate a new code",errInvalidCode:"The code is incorrect",errExceededAttempts:"Too many attempts. Try again later",errExpiredToken:"The code expired, resend code",errInvalidPhone:"The provided phone number is invalid"},pt:{title:"SMS Verification required",subtitle:"You need to verify your phone number",btnSend:"Send Code",btnResend:"Resend Code",btnActivate:"Activate",msgEnterCode:"Please enter the verification code you received on your number",msgResendNotice:"A new verification code has been sent to your phone number",errGenerateCode:"An error occurred while generating your code. Please click the resend button to generate a new code",errInvalidCode:"The code is incorrect",errExceededAttempts:"Too many attempts. Try again later",errExpiredToken:"The code expired, resend code",errInvalidPhone:"The provided phone number is invalid"},hr:{title:"SMS verifikacija je potrebna",subtitle:"Potrebno je verificirati broj mobitela. Verifikacijski kod je poslan",btnSend:"Pošalji kod",btnResend:"Ponovno pošalji",btnActivate:"Aktiviraj",msgEnterCode:"Molimo unesite verifikacijski kod koji je poslan na broj mobitela",msgResendNotice:"Novi verifikacijski kod je poslan na broj mobitela",errGenerateCode:"Došlo je do pogreške prilikom generiranja Vašeg verifikacijskog koda. Molimo da odaberete Ponovno pošalji kako bismo poslali novi kod",errInvalidCode:"SMS kod nije ispravan",errExceededAttempts:"Previše pokušaja. Pokušajte ponovno kasnije",errExpiredToken:"Verifikacijski kod je istekao, ponovno zatražite kod",errInvalidPhone:"Navedeni telefonski broj je nevažeći"}},r=(e,t)=>i[void 0!==t?t:"en"][e],o=class{constructor(t){e(this,t),this.lang="en",this.clientStyling="",this.clientStylingUrl="",this.translationUrl="",this.code="",this.errMsg="",this.msgEnterCode="",this.btnResendCount=60,this.isCodeSentOnce=!1,this.isBtnSendAvailable=!0,this.setClientStyling=()=>{let e=document.createElement("style");e.innerHTML=this.clientStyling,this.stylingContainer.prepend(e)},this.setClientStylingURL=()=>{let e=new URL(this.clientStylingUrl),t=document.createElement("style");fetch(e.href).then((e=>e.text())).then((e=>{t.innerHTML=e,setTimeout((()=>{this.stylingContainer.prepend(t)}),1)})).catch((e=>{console.log("error ",e)}))}}updateClientStyling(){this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL()}componentWillLoad(){if(this.translationUrl)return e=this.translationUrl,new Promise((t=>{fetch(e).then((e=>e.json())).then((e=>{Object.keys(e).forEach((t=>{for(let r in e[t])i[t][r]=e[t][r]})),t(!0)}))}));var e}componentDidLoad(){this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL()}startTimerBtnResendCode(){this.isBtnSendAvailable=!1,this.tempBtnResendCount=this.btnResendCount,this.btnResendTimer=setInterval((()=>{this.tempBtnResendCount--,this.tempBtnResendCount<0&&(clearInterval(this.btnResendTimer),this.isBtnSendAvailable=!0)}),1e3)}setErrMsg(e){"INVALID_CODE"===e?this.errMsg="errInvalidCode":"BLOCK_USER_INCORRECT_CODE"===e?this.errMsg="errExceededAttempts":"ExpiredToken"===e?this.errMsg="errExpiredToken":"errGenerateCode"===e?this.errMsg="errGenerateCode":"INVALID_PHONE_NUMBER"===e&&(this.errMsg="errInvalidPhone")}debounce(e,t){return function(...i){clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout((()=>{e.apply(this,i)}),t)}}handleSendCode(){this.errMsg="";let e=new URL(`${this.endpoint}/v1/player/legislation/generate2FACode`);const t={method:"POST",headers:{accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({userId:`${this.userId}`})};fetch(e.href,t).then((e=>e.json())).then((e=>{200!==e.httpStatusCode&&e.thirdPartyResponse&&(this.setErrMsg(e.thirdPartyResponse.message),"errExceededAttempts"===this.errMsg&&window.postMessage({type:"SmsVerificationErrExceededAttempts",data:r(this.errMsg)},window.location.href))})).catch((e=>{this.setErrMsg("errGenerateCode"),window.postMessage({type:"WidgetNotification",data:{type:"error",message:e}},window.location.href)}))}handleCheckCode(){let e=new URL(`${this.endpoint}/v1/player/legislation/generate2FACode`);e.searchParams.append("userId",this.userId),e.searchParams.append("code",this.code),fetch(e.href,{method:"GET",headers:{accept:"application/json"}}).then((e=>e.json())).then((e=>{200===e.httpStatusCode?(this.errMsg="",window.postMessage({type:"SmsVerificationSuccess"},window.location.href)):e.thirdPartyResponse&&(this.setErrMsg(e.thirdPartyResponse.message),"errExceededAttempts"===this.errMsg&&window.postMessage({type:"SmsVerificationErrExceededAttempts",data:r(this.errMsg)},window.location.href))})).catch((e=>{window.postMessage({type:"WidgetNotification",data:{type:"error",message:e}},window.location.href)})).finally((()=>{this.code=""}))}handleInput(e){this.code=e.target.value}render(){return t("div",{class:"PlayerSmsVerification",ref:e=>this.stylingContainer=e},t("div",{class:"PlayerSmsVerificationTitleContainer"},t("h4",{class:"PlayerSmsVerificationTitle"},r("title",this.lang)),t("p",{class:"PlayerSmsVerificationSubtitle"},r("subtitle",this.lang))),t("div",{class:"PlayerSmsVerificationContainer"},t("p",{class:"PlayerSmsVerificationMsg"+(this.msgEnterCode?"":" Hidden")},r(this.msgEnterCode,this.lang)),t("div",{class:"PlayerSmsVerificationInput"},t("input",{type:"text",onInput:e=>this.handleInput(e),value:this.code})),this.errMsg?t("p",{class:"PlayerSmsVerificationErrMsg"},r(this.errMsg,this.lang)):t("p",{class:"PlayerSmsVerificationMsg"+(!this.isBtnSendAvailable&&this.isCodeSentOnce?"":" Hidden")},r("msgResendNotice",this.lang)),!this.errMsg&&t("p",{class:"PlayerSMSErrorTextPlaceholder"})),t("div",{class:"PlayerSmsVerificationButtonContainer"},t("button",{class:"PlayerSmsVerificationButton",onClick:this.debounce(this.handleSendCode.bind(this),850),disabled:!this.isBtnSendAvailable},this.isCodeSentOnce?this.isBtnSendAvailable?r("btnResend",this.lang):this.tempBtnResendCount:r("btnSend",this.lang)),t("button",{class:"PlayerSmsVerificationButton",onClick:this.debounce(this.handleCheckCode.bind(this),850),disabled:!this.isCodeSentOnce||""===this.code||void 0===this.code},r("btnActivate",this.lang))))}static get watchers(){return{clientStyling:["updateClientStyling"],clientStylingUrl:["updateClientStyling"]}}};o.style=":host{display:block}.PlayerSmsVerification{padding:30px;display:flex;align-items:center;flex-direction:column;background:var(--emfe-w-registration-color-bg, var(--emfe-w-color-gray-50, #F9F8F8))}.PlayerSmsVerificationTitleContainer{color:var(--emfe-w-registration-contrast, var(--emfe-w-color-gray-300, #58586B));position:relative;display:flex;flex-direction:column;width:100%;margin-bottom:60px}.PlayerSmsVerificationTitle{font-size:20px;font-weight:300;text-transform:uppercase;padding:0;margin:0}.PlayerSmsVerificationSubtitle{font-size:14px}.PlayerSmsVerificationContainer{position:relative;width:100%;display:flex;flex-direction:column;margin-bottom:75px}.PlayerSmsVerificationButtonContainer{position:relative;width:100%;display:flex;flex-direction:column;gap:25px}.PlayerSmsVerificationButton{color:var(--emfe-w-button-typography, var(--emfe-w-color-white, #FFFFFF));background:var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #D0046C));border:1px solid var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #D0046C));border-radius:5px;width:100%;height:60px;padding:0;text-transform:uppercase;font-size:18px;cursor:pointer;font-family:inherit}.PlayerSmsVerificationButton:disabled{background:var(--emfe-w-color-gray-100, #E6E6E6);border:1px solid var(--emfe-w-color-gray-150, #828282);cursor:not-allowed}.PlayerSmsVerificationInput{color:var(--emfe-w-registration-contrast, var(--emfe-w-color-gray-300, #58586B));display:flex;flex-direction:column;position:relative;width:100%}.PlayerSmsVerificationInput input{width:100%;height:44px;border:1px solid var(--emfe-w-color-gray-100, #E6E6E6);border-radius:5px;box-sizing:border-box;padding:5px 15px;font-size:16px;text-align:center;line-height:18px;font-family:inherit}.PlayerSmsVerificationInput.Hidden{display:none}.PlayerSmsVerificationMsg{font-size:12px;color:var(--emfe-w-registration-contrast, var(--emfe-w-color-gray-300, #58586B))}.PlayerSmsVerificationMsg.Hidden{display:none}.PlayerSmsVerificationErrMsg{font-size:12px;color:var(--emfe-w-color-error, var(--emfe-w-color-red, #ed0909))}.PlayerSMSErrorTextPlaceholder{padding:3px}";export{o as player_sms_verification}
|
|
1
|
+
import{r as e,h as t}from"./p-02347cab.js";const i={en:{title:"SMS Verification required",subtitle:"You need to verify your phone number",btnSend:"Send Code",btnResend:"Resend Code",btnActivate:"Activate",msgEnterCode:"Please enter the verification code you received on your number",msgResendNotice:"A new verification code has been sent to your phone number",errGenerateCode:"An error occurred while generating your code. Please click the resend button to generate a new code",errInvalidCode:"The code is incorrect",errExceededAttempts:"Too many attempts. Try again later",errExpiredToken:"The code expired, resend code",errInvalidPhone:"The provided phone number is invalid"},ro:{title:"SMS Verification required",subtitle:"You need to verify your phone number",btnSend:"Send Code",btnResend:"Resend Code",btnActivate:"Activate",msgEnterCode:"Please enter the verification code you received on your number",msgResendNotice:"A new verification code has been sent to your phone number",errGenerateCode:"An error occurred while generating your code. Please click the resend button to generate a new code",errInvalidCode:"The code is incorrect",errExceededAttempts:"Too many attempts. Try again later",errExpiredToken:"The code expired, resend code",errInvalidPhone:"The provided phone number is invalid"},fr:{title:"SMS Verification required",subtitle:"You need to verify your phone number",btnSend:"Send Code",btnResend:"Resend Code",btnActivate:"Activate",msgEnterCode:"Please enter the verification code you received on your number",msgResendNotice:"A new verification code has been sent to your phone number",errGenerateCode:"An error occurred while generating your code. Please click the resend button to generate a new code",errInvalidCode:"The code is incorrect",errExceededAttempts:"Too many attempts. Try again later",errExpiredToken:"The code expired, resend code",errInvalidPhone:"The provided phone number is invalid"},hu:{title:"SMS Verification required",subtitle:"You need to verify your phone number",btnSend:"Send Code",btnResend:"Resend Code",btnActivate:"Activate",msgEnterCode:"Please enter the verification code you received on your number",msgResendNotice:"A new verification code has been sent to your phone number",errGenerateCode:"An error occurred while generating your code. Please click the resend button to generate a new code",errInvalidCode:"The code is incorrect",errExceededAttempts:"Too many attempts. Try again later",errExpiredToken:"The code expired, resend code",errInvalidPhone:"The provided phone number is invalid"},tr:{title:"SMS Verification required",subtitle:"You need to verify your phone number",btnSend:"Send Code",btnResend:"Resend Code",btnActivate:"Activate",msgEnterCode:"Please enter the verification code you received on your number",msgResendNotice:"A new verification code has been sent to your phone number",errGenerateCode:"An error occurred while generating your code. Please click the resend button to generate a new code",errInvalidCode:"The code is incorrect",errExceededAttempts:"Too many attempts. Try again later",errExpiredToken:"The code expired, resend code",errInvalidPhone:"The provided phone number is invalid"},el:{title:"SMS Verification required",subtitle:"You need to verify your phone number",btnSend:"Send Code",btnResend:"Resend Code",btnActivate:"Activate",msgEnterCode:"Please enter the verification code you received on your number",msgResendNotice:"A new verification code has been sent to your phone number",errGenerateCode:"An error occurred while generating your code. Please click the resend button to generate a new code",errInvalidCode:"The code is incorrect",errExceededAttempts:"Too many attempts. Try again later",errExpiredToken:"The code expired, resend code",errInvalidPhone:"The provided phone number is invalid"},es:{title:"SMS Verification required",subtitle:"You need to verify your phone number",btnSend:"Send Code",btnResend:"Resend Code",btnActivate:"Activate",msgEnterCode:"Please enter the verification code you received on your number",msgResendNotice:"A new verification code has been sent to your phone number",errGenerateCode:"An error occurred while generating your code. Please click the resend button to generate a new code",errInvalidCode:"The code is incorrect",errExceededAttempts:"Too many attempts. Try again later",errExpiredToken:"The code expired, resend code",errInvalidPhone:"The provided phone number is invalid"},pt:{title:"SMS Verification required",subtitle:"You need to verify your phone number",btnSend:"Send Code",btnResend:"Resend Code",btnActivate:"Activate",msgEnterCode:"Please enter the verification code you received on your number",msgResendNotice:"A new verification code has been sent to your phone number",errGenerateCode:"An error occurred while generating your code. Please click the resend button to generate a new code",errInvalidCode:"The code is incorrect",errExceededAttempts:"Too many attempts. Try again later",errExpiredToken:"The code expired, resend code",errInvalidPhone:"The provided phone number is invalid"},hr:{title:"SMS verifikacija je potrebna",subtitle:"Potrebno je verificirati broj mobitela. Verifikacijski kod je poslan",btnSend:"Pošalji kod",btnResend:"Ponovno pošalji",btnActivate:"Aktiviraj",msgEnterCode:"Molimo unesite verifikacijski kod koji je poslan na broj mobitela",msgResendNotice:"Novi verifikacijski kod je poslan na broj mobitela",errGenerateCode:"Došlo je do pogreške prilikom generiranja Vašeg verifikacijskog koda. Molimo da odaberete Ponovno pošalji kako bismo poslali novi kod",errInvalidCode:"SMS kod nije ispravan",errExceededAttempts:"Previše pokušaja. Pokušajte ponovno kasnije",errExpiredToken:"Verifikacijski kod je istekao, ponovno zatražite kod",errInvalidPhone:"Navedeni telefonski broj je nevažeći"}},r=(e,t)=>i[void 0!==t?t:"en"][e],o=class{constructor(t){e(this,t),this.lang="en",this.clientStyling="",this.clientStylingUrl="",this.translationUrl="",this.code="",this.errMsg="",this.msgEnterCode="",this.btnResendCount=60,this.isCodeSentOnce=!1,this.isBtnSendAvailable=!0,this.setClientStyling=()=>{let e=document.createElement("style");e.innerHTML=this.clientStyling,this.stylingContainer.prepend(e)},this.setClientStylingURL=()=>{let e=new URL(this.clientStylingUrl),t=document.createElement("style");fetch(e.href).then((e=>e.text())).then((e=>{t.innerHTML=e,setTimeout((()=>{this.stylingContainer.prepend(t)}),1)})).catch((e=>{console.log("error ",e)}))}}updateClientStyling(){this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL()}componentWillLoad(){if(this.translationUrl)return e=this.translationUrl,new Promise((t=>{fetch(e).then((e=>e.json())).then((e=>{Object.keys(e).forEach((t=>{for(let r in e[t])i[t][r]=e[t][r]})),t(!0)}))}));var e}componentDidLoad(){this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL()}startTimerBtnResendCode(){this.isBtnSendAvailable=!1,this.tempBtnResendCount=this.btnResendCount,this.btnResendTimer=setInterval((()=>{this.tempBtnResendCount--,this.tempBtnResendCount<0&&(clearInterval(this.btnResendTimer),this.isBtnSendAvailable=!0)}),1e3)}setErrMsg(e){"INVALID_CODE"===e?this.errMsg="errInvalidCode":"BLOCK_USER_INCORRECT_CODE"===e?this.errMsg="errExceededAttempts":"ExpiredToken"===e?this.errMsg="errExpiredToken":"errGenerateCode"===e?this.errMsg="errGenerateCode":"INVALID_PHONE_NUMBER"===e&&(this.errMsg="errInvalidPhone")}debounce(e,t){return function(...i){clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout((()=>{e.apply(this,i)}),t)}}handleSendCode(){this.errMsg="";let e=new URL(`${this.endpoint}/v1/player/legislation/generate2FACode`);const t={method:"POST",headers:{accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({userId:`${this.userId}`})};fetch(e.href,t).then((()=>{this.msgEnterCode="msgEnterCode",this.isCodeSentOnce&&this.startTimerBtnResendCode(),this.isCodeSentOnce=!0})).catch((e=>{this.setErrMsg("errGenerateCode"),window.postMessage({type:"WidgetNotification",data:{type:"error",message:e}},window.location.href)}))}handleCheckCode(){let e=new URL(`${this.endpoint}/v1/player/legislation/generate2FACode`);e.searchParams.append("userId",this.userId),e.searchParams.append("code",this.code),fetch(e.href,{method:"GET",headers:{accept:"application/json"}}).then((e=>e.json())).then((e=>{200===e.httpStatusCode?(this.errMsg="",window.postMessage({type:"SmsVerificationSuccess"},window.location.href)):e.thirdPartyResponse&&(this.setErrMsg(e.thirdPartyResponse.message),"errExceededAttempts"===this.errMsg&&window.postMessage({type:"SmsVerificationErrExceededAttempts",data:r(this.errMsg)},window.location.href))})).catch((e=>{window.postMessage({type:"WidgetNotification",data:{type:"error",message:e}},window.location.href)})).finally((()=>{this.code=""}))}handleInput(e){this.code=e.target.value}render(){return t("div",{class:"PlayerSmsVerification",ref:e=>this.stylingContainer=e},t("div",{class:"PlayerSmsVerificationTitleContainer"},t("h4",{class:"PlayerSmsVerificationTitle"},r("title",this.lang)),t("p",{class:"PlayerSmsVerificationSubtitle"},r("subtitle",this.lang))),t("div",{class:"PlayerSmsVerificationContainer"},t("p",{class:"PlayerSmsVerificationMsg"+(this.msgEnterCode?"":" Hidden")},r(this.msgEnterCode,this.lang)),t("div",{class:"PlayerSmsVerificationInput"},t("input",{type:"text",onInput:e=>this.handleInput(e),value:this.code})),this.errMsg?t("p",{class:"PlayerSmsVerificationErrMsg"},r(this.errMsg,this.lang)):t("p",{class:"PlayerSmsVerificationMsg"+(!this.isBtnSendAvailable&&this.isCodeSentOnce?"":" Hidden")},r("msgResendNotice",this.lang)),!this.errMsg&&t("p",{class:"PlayerSMSErrorTextPlaceholder"})),t("div",{class:"PlayerSmsVerificationButtonContainer"},t("button",{class:"PlayerSmsVerificationButton",onClick:this.debounce(this.handleSendCode.bind(this),850),disabled:!this.isBtnSendAvailable},this.isCodeSentOnce?this.isBtnSendAvailable?r("btnResend",this.lang):this.tempBtnResendCount:r("btnSend",this.lang)),t("button",{class:"PlayerSmsVerificationButton",onClick:this.debounce(this.handleCheckCode.bind(this),850),disabled:!this.isCodeSentOnce||""===this.code||void 0===this.code},r("btnActivate",this.lang))))}static get watchers(){return{clientStyling:["updateClientStyling"],clientStylingUrl:["updateClientStyling"]}}};o.style=":host{display:block}.PlayerSmsVerification{padding:30px;display:flex;align-items:center;flex-direction:column;background:var(--emfe-w-registration-color-bg, var(--emfe-w-color-gray-50, #F9F8F8))}.PlayerSmsVerificationTitleContainer{color:var(--emfe-w-registration-contrast, var(--emfe-w-color-gray-300, #58586B));position:relative;display:flex;flex-direction:column;width:100%;margin-bottom:60px}.PlayerSmsVerificationTitle{font-size:20px;font-weight:300;text-transform:uppercase;padding:0;margin:0}.PlayerSmsVerificationSubtitle{font-size:14px}.PlayerSmsVerificationContainer{position:relative;width:100%;display:flex;flex-direction:column;margin-bottom:75px}.PlayerSmsVerificationButtonContainer{position:relative;width:100%;display:flex;flex-direction:column;gap:25px}.PlayerSmsVerificationButton{color:var(--emfe-w-button-typography, var(--emfe-w-color-white, #FFFFFF));background:var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #D0046C));border:1px solid var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #D0046C));border-radius:5px;width:100%;height:60px;padding:0;text-transform:uppercase;font-size:18px;cursor:pointer;font-family:inherit}.PlayerSmsVerificationButton:disabled{background:var(--emfe-w-color-gray-100, #E6E6E6);border:1px solid var(--emfe-w-color-gray-150, #828282);cursor:not-allowed}.PlayerSmsVerificationInput{color:var(--emfe-w-registration-contrast, var(--emfe-w-color-gray-300, #58586B));display:flex;flex-direction:column;position:relative;width:100%}.PlayerSmsVerificationInput input{width:100%;height:44px;border:1px solid var(--emfe-w-color-gray-100, #E6E6E6);border-radius:5px;box-sizing:border-box;padding:5px 15px;font-size:16px;text-align:center;line-height:18px;font-family:inherit}.PlayerSmsVerificationInput.Hidden{display:none}.PlayerSmsVerificationMsg{font-size:12px;color:var(--emfe-w-registration-contrast, var(--emfe-w-color-gray-300, #58586B))}.PlayerSmsVerificationMsg.Hidden{display:none}.PlayerSmsVerificationErrMsg{font-size:12px;color:var(--emfe-w-color-error, var(--emfe-w-color-red, #ed0909))}.PlayerSMSErrorTextPlaceholder{padding:3px}";export{o as player_sms_verification}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as n,b as t}from"./p-02347cab.js";(()=>{const t=import.meta.url,e={};return""!==t&&(e.resourcesUrl=new URL(".",t).href),n(e)})().then((n=>t([["p-
|
|
1
|
+
import{p as n,b as t}from"./p-02347cab.js";(()=>{const t=import.meta.url,e={};return""!==t&&(e.resourcesUrl=new URL(".",t).href),n(e)})().then((n=>t([["p-b9cfaa13",[[1,"player-sms-verification",{endpoint:[513],userId:[513,"user-id"],lang:[513],clientStyling:[1537,"client-styling"],clientStylingUrl:[513,"client-styling-url"],translationUrl:[513,"translation-url"],tempBtnResendCount:[32],code:[32],errMsg:[32],msgEnterCode:[32]}]]]],n)));
|
package/package.json
CHANGED