@everymatrix/player-sms-verification 1.87.26 → 1.87.27
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.
|
@@ -194,6 +194,8 @@ const translate = (key, customLang) => {
|
|
|
194
194
|
return TRANSLATIONS[lang !== undefined ? lang : DEFAULT_LANGUAGE][key];
|
|
195
195
|
};
|
|
196
196
|
|
|
197
|
+
const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
|
|
198
|
+
|
|
197
199
|
/**
|
|
198
200
|
* @name setClientStyling
|
|
199
201
|
* @description Method used to create and append to the passed element of the widget a style element with the content received
|
|
@@ -239,18 +241,75 @@ function setClientStylingURL(stylingContainer, clientStylingUrl) {
|
|
|
239
241
|
* @param {HTMLElement} stylingContainer The highest element of the widget
|
|
240
242
|
* @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
|
|
241
243
|
* @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
|
|
244
|
+
* @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
|
|
242
245
|
*/
|
|
243
|
-
function setStreamStyling(stylingContainer, domain, subscription) {
|
|
244
|
-
if (window.emMessageBus)
|
|
245
|
-
const sheet = document.createElement('style');
|
|
246
|
+
function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
|
|
247
|
+
if (!window.emMessageBus) return;
|
|
246
248
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
249
|
+
const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
|
|
250
|
+
|
|
251
|
+
if (!supportAdoptStyle || !useAdoptedStyleSheets) {
|
|
252
|
+
subscription = getStyleTagSubscription(stylingContainer, domain);
|
|
253
|
+
|
|
254
|
+
return subscription;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (!window[StyleCacheKey]) {
|
|
258
|
+
window[StyleCacheKey] = {};
|
|
253
259
|
}
|
|
260
|
+
subscription = getAdoptStyleSubscription(stylingContainer, domain);
|
|
261
|
+
|
|
262
|
+
const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
|
|
263
|
+
const wrappedUnsubscribe = () => {
|
|
264
|
+
if (window[StyleCacheKey][domain]) {
|
|
265
|
+
const cachedObject = window[StyleCacheKey][domain];
|
|
266
|
+
cachedObject.refCount > 1
|
|
267
|
+
? (cachedObject.refCount = cachedObject.refCount - 1)
|
|
268
|
+
: delete window[StyleCacheKey][domain];
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
originalUnsubscribe();
|
|
272
|
+
};
|
|
273
|
+
subscription.unsubscribe = wrappedUnsubscribe;
|
|
274
|
+
|
|
275
|
+
return subscription;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function getStyleTagSubscription(stylingContainer, domain) {
|
|
279
|
+
const sheet = document.createElement('style');
|
|
280
|
+
|
|
281
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
282
|
+
if (stylingContainer) {
|
|
283
|
+
sheet.innerHTML = data;
|
|
284
|
+
stylingContainer.appendChild(sheet);
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function getAdoptStyleSubscription(stylingContainer, domain) {
|
|
290
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
291
|
+
if (!stylingContainer) return;
|
|
292
|
+
|
|
293
|
+
const shadowRoot = stylingContainer.getRootNode();
|
|
294
|
+
const cacheStyleObject = window[StyleCacheKey];
|
|
295
|
+
let cachedStyle = cacheStyleObject[domain]?.sheet;
|
|
296
|
+
|
|
297
|
+
if (!cachedStyle) {
|
|
298
|
+
cachedStyle = new CSSStyleSheet();
|
|
299
|
+
cachedStyle.replaceSync(data);
|
|
300
|
+
cacheStyleObject[domain] = {
|
|
301
|
+
sheet: cachedStyle,
|
|
302
|
+
refCount: 1
|
|
303
|
+
};
|
|
304
|
+
} else {
|
|
305
|
+
cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
const currentSheets = shadowRoot.adoptedStyleSheets || [];
|
|
309
|
+
if (!currentSheets.includes(cachedStyle)) {
|
|
310
|
+
shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
|
|
311
|
+
}
|
|
312
|
+
});
|
|
254
313
|
}
|
|
255
314
|
|
|
256
315
|
/**
|
|
@@ -314,7 +373,7 @@ const PlayerSmsVerification = class {
|
|
|
314
373
|
componentDidLoad() {
|
|
315
374
|
if (this.stylingContainer) {
|
|
316
375
|
if (window.emMessageBus != undefined) {
|
|
317
|
-
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style
|
|
376
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
318
377
|
}
|
|
319
378
|
else {
|
|
320
379
|
if (this.clientStyling)
|
|
@@ -190,6 +190,8 @@ const translate = (key, customLang) => {
|
|
|
190
190
|
return TRANSLATIONS[lang !== undefined ? lang : DEFAULT_LANGUAGE][key];
|
|
191
191
|
};
|
|
192
192
|
|
|
193
|
+
const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
|
|
194
|
+
|
|
193
195
|
/**
|
|
194
196
|
* @name setClientStyling
|
|
195
197
|
* @description Method used to create and append to the passed element of the widget a style element with the content received
|
|
@@ -235,18 +237,75 @@ function setClientStylingURL(stylingContainer, clientStylingUrl) {
|
|
|
235
237
|
* @param {HTMLElement} stylingContainer The highest element of the widget
|
|
236
238
|
* @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
|
|
237
239
|
* @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
|
|
240
|
+
* @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
|
|
238
241
|
*/
|
|
239
|
-
function setStreamStyling(stylingContainer, domain, subscription) {
|
|
240
|
-
if (window.emMessageBus)
|
|
241
|
-
const sheet = document.createElement('style');
|
|
242
|
+
function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
|
|
243
|
+
if (!window.emMessageBus) return;
|
|
242
244
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
245
|
+
const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
|
|
246
|
+
|
|
247
|
+
if (!supportAdoptStyle || !useAdoptedStyleSheets) {
|
|
248
|
+
subscription = getStyleTagSubscription(stylingContainer, domain);
|
|
249
|
+
|
|
250
|
+
return subscription;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (!window[StyleCacheKey]) {
|
|
254
|
+
window[StyleCacheKey] = {};
|
|
249
255
|
}
|
|
256
|
+
subscription = getAdoptStyleSubscription(stylingContainer, domain);
|
|
257
|
+
|
|
258
|
+
const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
|
|
259
|
+
const wrappedUnsubscribe = () => {
|
|
260
|
+
if (window[StyleCacheKey][domain]) {
|
|
261
|
+
const cachedObject = window[StyleCacheKey][domain];
|
|
262
|
+
cachedObject.refCount > 1
|
|
263
|
+
? (cachedObject.refCount = cachedObject.refCount - 1)
|
|
264
|
+
: delete window[StyleCacheKey][domain];
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
originalUnsubscribe();
|
|
268
|
+
};
|
|
269
|
+
subscription.unsubscribe = wrappedUnsubscribe;
|
|
270
|
+
|
|
271
|
+
return subscription;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function getStyleTagSubscription(stylingContainer, domain) {
|
|
275
|
+
const sheet = document.createElement('style');
|
|
276
|
+
|
|
277
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
278
|
+
if (stylingContainer) {
|
|
279
|
+
sheet.innerHTML = data;
|
|
280
|
+
stylingContainer.appendChild(sheet);
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
function getAdoptStyleSubscription(stylingContainer, domain) {
|
|
286
|
+
return window.emMessageBus.subscribe(domain, (data) => {
|
|
287
|
+
if (!stylingContainer) return;
|
|
288
|
+
|
|
289
|
+
const shadowRoot = stylingContainer.getRootNode();
|
|
290
|
+
const cacheStyleObject = window[StyleCacheKey];
|
|
291
|
+
let cachedStyle = cacheStyleObject[domain]?.sheet;
|
|
292
|
+
|
|
293
|
+
if (!cachedStyle) {
|
|
294
|
+
cachedStyle = new CSSStyleSheet();
|
|
295
|
+
cachedStyle.replaceSync(data);
|
|
296
|
+
cacheStyleObject[domain] = {
|
|
297
|
+
sheet: cachedStyle,
|
|
298
|
+
refCount: 1
|
|
299
|
+
};
|
|
300
|
+
} else {
|
|
301
|
+
cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const currentSheets = shadowRoot.adoptedStyleSheets || [];
|
|
305
|
+
if (!currentSheets.includes(cachedStyle)) {
|
|
306
|
+
shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
|
|
307
|
+
}
|
|
308
|
+
});
|
|
250
309
|
}
|
|
251
310
|
|
|
252
311
|
/**
|
|
@@ -310,7 +369,7 @@ const PlayerSmsVerification = class {
|
|
|
310
369
|
componentDidLoad() {
|
|
311
370
|
if (this.stylingContainer) {
|
|
312
371
|
if (window.emMessageBus != undefined) {
|
|
313
|
-
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style
|
|
372
|
+
setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
|
|
314
373
|
}
|
|
315
374
|
else {
|
|
316
375
|
if (this.clientStyling)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,h as i}from"./index-99e378bb.js";const r={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:"Verificare SMS necesară",subtitle:"Trebuie să vă verificați numărul de telefon",btnSend:"Trimite cod",btnResend:"Retrimite cod",btnActivate:"Activează",msgEnterCode:"Introduceți codul de verificare primit pe numărul dvs.",msgResendNotice:"Un nou cod de verificare a fost trimis pe numărul dvs. de telefon",errGenerateCode:"A apărut o eroare la generarea codului. Apăsați butonul de retrimitere pentru a genera un nou cod",errInvalidCode:"Codul este incorect",errExceededAttempts:"Prea multe încercări. Încercați din nou mai târziu",errExpiredToken:"Codul a expirat, retrimiteți codul",errInvalidPhone:"Numărul de telefon furnizat este invalid"},fr:{title:"Vérification SMS requise",subtitle:"Vous devez vérifier votre numéro de téléphone",btnSend:"Envoyer le code",btnResend:"Renvoyer le code",btnActivate:"Activer",msgEnterCode:"Veuillez entrer le code de vérification reçu sur votre numéro",msgResendNotice:"Un nouveau code de vérification a été envoyé à votre numéro de téléphone",errGenerateCode:"Une erreur est survenue lors de la génération de votre code. Cliquez sur le bouton renvoyer pour générer un nouveau code",errInvalidCode:"Le code est incorrect",errExceededAttempts:"Trop de tentatives. Réessayez plus tard",errExpiredToken:"Le code a expiré, renvoyez le code",errInvalidPhone:"Le numéro de téléphone fourni est invalide"},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:"Verificación por SMS requerida",subtitle:"Debe verificar su número de teléfono",btnSend:"Enviar código",btnResend:"Reenviar código",btnActivate:"Activar",msgEnterCode:"Por favor, introduzca el código de verificación recibido en su número",msgResendNotice:"Se ha enviado un nuevo código de verificación a su número de teléfono",errGenerateCode:"Ocurrió un error al generar su código. Haga clic en el botón de reenviar para generar un nuevo código",errInvalidCode:"El código es incorrecto",errExceededAttempts:"Demasiados intentos. Inténtelo más tarde",errExpiredToken:"El código ha expirado, reenviar código",errInvalidPhone:"El número de teléfono proporcionado no es válido"},pt:{title:"Verificação SMS necessária",subtitle:"Você precisa verificar seu número de telefone",btnSend:"Enviar código",btnResend:"Reenviar código",btnActivate:"Ativar",msgEnterCode:"Por favor, insira o código de verificação recebido no seu número",msgResendNotice:"Um novo código de verificação foi enviado para o seu número de telefone",errGenerateCode:"Ocorreu um erro ao gerar seu código. Clique no botão reenviar para gerar um novo código",errInvalidCode:"O código está incorreto",errExceededAttempts:"Muitas tentativas. Tente novamente mais tarde",errExpiredToken:"O código expirou, reenviar código",errInvalidPhone:"O número de telefone fornecido é inválido"},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"},de:{title:"SMS-Verifizierung erforderlich",subtitle:"Sie müssen Ihre Telefonnummer verifizieren",btnSend:"Code senden",btnResend:"Code erneut senden",btnActivate:"Aktivieren",msgEnterCode:"Bitte geben Sie den Verifizierungscode ein, den Sie auf Ihrer Nummer erhalten haben",msgResendNotice:"Ein neuer Verifizierungscode wurde an Ihre Telefonnummer gesendet",errGenerateCode:"Es ist ein Fehler bei der Generierung Ihres Codes aufgetreten. Klicken Sie auf die Schaltfläche zum erneuten Senden, um einen neuen Code zu generieren",errInvalidCode:"Der Code ist falsch",errExceededAttempts:"Zu viele Versuche. Bitte versuchen Sie es später erneut",errExpiredToken:"Der Code ist abgelaufen, bitte erneut senden",errInvalidPhone:"Die angegebene Telefonnummer ist ungültig"},"es-mx":{title:"Verificación por SMS requerida",subtitle:"Debe verificar su número de teléfono",btnSend:"Enviar código",btnResend:"Reenviar código",btnActivate:"Activar",msgEnterCode:"Por favor, introduzca el código de verificación recibido en su número",msgResendNotice:"Se ha enviado un nuevo código de verificación a su número de teléfono",errGenerateCode:"Ocurrió un error al generar su código. Haga clic en el botón de reenviar para generar un nuevo código",errInvalidCode:"El código es incorrecto",errExceededAttempts:"Demasiados intentos. Inténtelo más tarde",errExpiredToken:"El código ha expirado, reenviar código",errInvalidPhone:"El número de teléfono proporcionado no es válido"},"pt-br":{title:"Verificação SMS necessária",subtitle:"Você precisa verificar seu número de telefone",btnSend:"Enviar código",btnResend:"Reenviar código",btnActivate:"Ativar",msgEnterCode:"Por favor, insira o código de verificação recebido no seu número",msgResendNotice:"Um novo código de verificação foi enviado para o seu número de telefone",errGenerateCode:"Ocorreu um erro ao gerar seu código. Clique no botão reenviar para gerar um novo código",errInvalidCode:"O código está incorreto",errExceededAttempts:"Muitas tentativas. Tente novamente mais tarde",errExpiredToken:"O código expirou, reenviar código",errInvalidPhone:"O número de telefone fornecido é inválido"}},t=(e,i)=>r[void 0!==i?i:"en"][e];function o(e,i){if(e){const r=document.createElement("style");r.innerHTML=i,e.appendChild(r)}}function n(e,i){if(!e||!i)return;const r=new URL(i);fetch(r.href).then((e=>e.text())).then((i=>{const r=document.createElement("style");r.innerHTML=i,e&&e.appendChild(r)})).catch((e=>{console.error("There was an error while trying to load client styling from URL",e)}))}const a=class{constructor(i){e(this,i),this.btnResendCount=60,this.isCodeSentOnce=!1,this.isBtnSendAvailable=!0,this.endpoint=void 0,this.userId=void 0,this.lang="en",this.clientStyling="",this.clientStylingUrl="",this.mbSource=void 0,this.translationUrl="",this.tempBtnResendCount=void 0,this.code="",this.errMsg="",this.msgEnterCode=""}handleClientStylingChange(e,i){e!=i&&o(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(e,i){e!=i&&this.clientStylingUrl&&n(this.stylingContainer,this.clientStylingUrl)}componentWillLoad(){if(this.translationUrl)return e=this.translationUrl,new Promise((i=>{fetch(e).then((e=>e.json())).then((e=>{Object.keys(e).forEach((i=>{for(let t in e[i])r[i][t]=e[i][t]})),i(!0)}))}));var e}componentDidLoad(){this.stylingContainer&&(null!=window.emMessageBus?function(e,i){if(window.emMessageBus){const r=document.createElement("style");window.emMessageBus.subscribe(i,(i=>{r.innerHTML=i,e&&e.appendChild(r)}))}}(this.stylingContainer,`${this.mbSource}.Style`):(this.clientStyling&&o(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&n(this.stylingContainer,this.clientStylingUrl)))}startTimerBtnResendCode(){this.isBtnSendAvailable=!1,this.tempBtnResendCount=this.btnResendCount,this.btnResendTimer=setInterval((()=>{this.tempBtnResendCount--,this.tempBtnResendCount<0&&(clearInterval(this.btnResendTimer),this.isBtnSendAvailable=!0,((e,i={})=>{const r=new CustomEvent("track-custom-event",{detail:{type:"sms_code_resend",data:i},bubbles:!0,composed:!0});document.dispatchEvent(r)})(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,i){return function(...r){clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout((()=>{e.apply(this,r)}),i)}}handleSendCode(){this.errMsg="";let e=new URL(`${this.endpoint}/v1/player/legislation/generate2FACode`);const i={method:"POST",headers:{accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({userId:`${this.userId}`})};fetch(e.href,i).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:t(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}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}render(){return i("div",{key:"449bdf96de92603f0882bd37fff03fa6edbbb905",class:"PlayerSmsVerification",ref:e=>this.stylingContainer=e},i("div",{key:"af4bc93419d2a2fb169d719a0a2245dfe73952bf",class:"PlayerSmsVerificationTitleContainer"},i("h4",{key:"05bc166a71aaad15e135e33c26375848d5fa7896",class:"PlayerSmsVerificationTitle"},t("title",this.lang)),i("p",{key:"69e71af868c18a8c7658c447cd4faad8474404d8",class:"PlayerSmsVerificationSubtitle"},t("subtitle",this.lang))),i("div",{key:"379d4223df2bb70d077fe0a61ce625988d94a4db",class:"PlayerSmsVerificationContainer"},i("p",{key:"e1bc65f9059db1026cf8ccfbe6ed1be7260ea92a",class:"PlayerSmsVerificationMsg"+(this.msgEnterCode?"":" Hidden")},t(this.msgEnterCode,this.lang)),i("div",{key:"141b38acc8f8f2500327782990cad15955af3608",class:"PlayerSmsVerificationInput"},i("input",{key:"3e68caa0da49cb710df3f317889d60ca8c22e5b1",type:"text",onInput:e=>this.handleInput(e),value:this.code})),this.errMsg?i("p",{class:"PlayerSmsVerificationErrMsg"},t(this.errMsg,this.lang)):i("p",{class:"PlayerSmsVerificationMsg"+(!this.isBtnSendAvailable&&this.isCodeSentOnce?"":" Hidden")},t("msgResendNotice",this.lang)),!this.errMsg&&i("p",{key:"db78c93955b31f9f0f612902c805efeb41574dff",class:"PlayerSMSErrorTextPlaceholder"})),i("div",{key:"88b6294ad365a63961641b17bca33e1ecdd22b3b",class:"PlayerSmsVerificationButtonContainer"},i("button",{key:"5eab8b95b13af28c130a1d243e348fea411b134c",class:"PlayerSmsVerificationButton",onClick:this.debounce(this.handleSendCode.bind(this),850),disabled:!this.isBtnSendAvailable},this.isCodeSentOnce?this.isBtnSendAvailable?t("btnResend",this.lang):this.tempBtnResendCount:t("btnSend",this.lang)),i("button",{key:"dbb64063224e6fe3f41838c21ce4b2711b3cd5f1",class:"PlayerSmsVerificationButton",onClick:this.debounce(this.handleCheckCode.bind(this),850),disabled:!this.isCodeSentOnce||""===this.code||void 0===this.code},t("btnActivate",this.lang))))}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"]}}};a.style=":host{display:block}.PlayerSmsVerification{padding:30px;display:flex;align-items:center;flex-direction:column;background:var(--emw--registration-color-bg, var(--emw--color-gray-50, #F9F8F8))}.PlayerSmsVerificationTitleContainer{color:var(--emw--registration-contrast, var(--emw--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(--emw--button-typography, var(--emw--color-white, #FFFFFF));background:var(--emw--registration-color-primary, var(--emw--color-primary, #22B04E));border:1px solid var(--emw--registration-color-primary, var(--emw--color-primary, #22B04E));border-radius:5px;width:100%;height:60px;padding:0;text-transform:uppercase;font-size:18px;cursor:pointer;font-family:inherit}.PlayerSmsVerificationButton:disabled{background:var(--emw--color-gray-100, #E6E6E6);border:1px solid var(--emw--color-gray-150, #828282);cursor:not-allowed}.PlayerSmsVerificationInput{color:var(--emw--registration-contrast, var(--emw--color-gray-300, #58586B));display:flex;flex-direction:column;position:relative;width:100%}.PlayerSmsVerificationInput input{width:100%;height:44px;border:1px solid var(--emw--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(--emw--registration-contrast, var(--emw--color-gray-300, #58586B))}.PlayerSmsVerificationMsg.Hidden{display:none}.PlayerSmsVerificationErrMsg{font-size:12px;color:var(--emw--color-error, var(--emw--color-red, #ed0909))}.PlayerSMSErrorTextPlaceholder{padding:3px}";export{a as player_sms_verification}
|
|
1
|
+
import{r as e,h as i}from"./index-99e378bb.js";const r={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:"Verificare SMS necesară",subtitle:"Trebuie să vă verificați numărul de telefon",btnSend:"Trimite cod",btnResend:"Retrimite cod",btnActivate:"Activează",msgEnterCode:"Introduceți codul de verificare primit pe numărul dvs.",msgResendNotice:"Un nou cod de verificare a fost trimis pe numărul dvs. de telefon",errGenerateCode:"A apărut o eroare la generarea codului. Apăsați butonul de retrimitere pentru a genera un nou cod",errInvalidCode:"Codul este incorect",errExceededAttempts:"Prea multe încercări. Încercați din nou mai târziu",errExpiredToken:"Codul a expirat, retrimiteți codul",errInvalidPhone:"Numărul de telefon furnizat este invalid"},fr:{title:"Vérification SMS requise",subtitle:"Vous devez vérifier votre numéro de téléphone",btnSend:"Envoyer le code",btnResend:"Renvoyer le code",btnActivate:"Activer",msgEnterCode:"Veuillez entrer le code de vérification reçu sur votre numéro",msgResendNotice:"Un nouveau code de vérification a été envoyé à votre numéro de téléphone",errGenerateCode:"Une erreur est survenue lors de la génération de votre code. Cliquez sur le bouton renvoyer pour générer un nouveau code",errInvalidCode:"Le code est incorrect",errExceededAttempts:"Trop de tentatives. Réessayez plus tard",errExpiredToken:"Le code a expiré, renvoyez le code",errInvalidPhone:"Le numéro de téléphone fourni est invalide"},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:"Verificación por SMS requerida",subtitle:"Debe verificar su número de teléfono",btnSend:"Enviar código",btnResend:"Reenviar código",btnActivate:"Activar",msgEnterCode:"Por favor, introduzca el código de verificación recibido en su número",msgResendNotice:"Se ha enviado un nuevo código de verificación a su número de teléfono",errGenerateCode:"Ocurrió un error al generar su código. Haga clic en el botón de reenviar para generar un nuevo código",errInvalidCode:"El código es incorrecto",errExceededAttempts:"Demasiados intentos. Inténtelo más tarde",errExpiredToken:"El código ha expirado, reenviar código",errInvalidPhone:"El número de teléfono proporcionado no es válido"},pt:{title:"Verificação SMS necessária",subtitle:"Você precisa verificar seu número de telefone",btnSend:"Enviar código",btnResend:"Reenviar código",btnActivate:"Ativar",msgEnterCode:"Por favor, insira o código de verificação recebido no seu número",msgResendNotice:"Um novo código de verificação foi enviado para o seu número de telefone",errGenerateCode:"Ocorreu um erro ao gerar seu código. Clique no botão reenviar para gerar um novo código",errInvalidCode:"O código está incorreto",errExceededAttempts:"Muitas tentativas. Tente novamente mais tarde",errExpiredToken:"O código expirou, reenviar código",errInvalidPhone:"O número de telefone fornecido é inválido"},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"},de:{title:"SMS-Verifizierung erforderlich",subtitle:"Sie müssen Ihre Telefonnummer verifizieren",btnSend:"Code senden",btnResend:"Code erneut senden",btnActivate:"Aktivieren",msgEnterCode:"Bitte geben Sie den Verifizierungscode ein, den Sie auf Ihrer Nummer erhalten haben",msgResendNotice:"Ein neuer Verifizierungscode wurde an Ihre Telefonnummer gesendet",errGenerateCode:"Es ist ein Fehler bei der Generierung Ihres Codes aufgetreten. Klicken Sie auf die Schaltfläche zum erneuten Senden, um einen neuen Code zu generieren",errInvalidCode:"Der Code ist falsch",errExceededAttempts:"Zu viele Versuche. Bitte versuchen Sie es später erneut",errExpiredToken:"Der Code ist abgelaufen, bitte erneut senden",errInvalidPhone:"Die angegebene Telefonnummer ist ungültig"},"es-mx":{title:"Verificación por SMS requerida",subtitle:"Debe verificar su número de teléfono",btnSend:"Enviar código",btnResend:"Reenviar código",btnActivate:"Activar",msgEnterCode:"Por favor, introduzca el código de verificación recibido en su número",msgResendNotice:"Se ha enviado un nuevo código de verificación a su número de teléfono",errGenerateCode:"Ocurrió un error al generar su código. Haga clic en el botón de reenviar para generar un nuevo código",errInvalidCode:"El código es incorrecto",errExceededAttempts:"Demasiados intentos. Inténtelo más tarde",errExpiredToken:"El código ha expirado, reenviar código",errInvalidPhone:"El número de teléfono proporcionado no es válido"},"pt-br":{title:"Verificação SMS necessária",subtitle:"Você precisa verificar seu número de telefone",btnSend:"Enviar código",btnResend:"Reenviar código",btnActivate:"Ativar",msgEnterCode:"Por favor, insira o código de verificação recebido no seu número",msgResendNotice:"Um novo código de verificação foi enviado para o seu número de telefone",errGenerateCode:"Ocorreu um erro ao gerar seu código. Clique no botão reenviar para gerar um novo código",errInvalidCode:"O código está incorreto",errExceededAttempts:"Muitas tentativas. Tente novamente mais tarde",errExpiredToken:"O código expirou, reenviar código",errInvalidPhone:"O número de telefone fornecido é inválido"}},t=(e,i)=>r[void 0!==i?i:"en"][e],n="__WIDGET_GLOBAL_STYLE_CACHE__";function o(e,i){if(e){const r=document.createElement("style");r.innerHTML=i,e.appendChild(r)}}function a(e,i){if(!e||!i)return;const r=new URL(i);fetch(r.href).then((e=>e.text())).then((i=>{const r=document.createElement("style");r.innerHTML=i,e&&e.appendChild(r)})).catch((e=>{console.error("There was an error while trying to load client styling from URL",e)}))}const d=class{constructor(i){e(this,i),this.btnResendCount=60,this.isCodeSentOnce=!1,this.isBtnSendAvailable=!0,this.endpoint=void 0,this.userId=void 0,this.lang="en",this.clientStyling="",this.clientStylingUrl="",this.mbSource=void 0,this.translationUrl="",this.tempBtnResendCount=void 0,this.code="",this.errMsg="",this.msgEnterCode=""}handleClientStylingChange(e,i){e!=i&&o(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(e,i){e!=i&&this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)}componentWillLoad(){if(this.translationUrl)return e=this.translationUrl,new Promise((i=>{fetch(e).then((e=>e.json())).then((e=>{Object.keys(e).forEach((i=>{for(let t in e[i])r[i][t]=e[i][t]})),i(!0)}))}));var e}componentDidLoad(){this.stylingContainer&&(null!=window.emMessageBus?function(e,i,r,t=!1){if(!window.emMessageBus)return;if(!("adoptedStyleSheets"in Document.prototype)||!t)return function(e,i){const r=document.createElement("style");return window.emMessageBus.subscribe(i,(i=>{e&&(r.innerHTML=i,e.appendChild(r))}))}(e,i);window[n]||(window[n]={});const o=(r=function(e,i){return window.emMessageBus.subscribe(i,(r=>{if(!e)return;const t=e.getRootNode(),o=window[n];let a=o[i]?.sheet;a?o[i].refCount=o[i].refCount+1:(a=new CSSStyleSheet,a.replaceSync(r),o[i]={sheet:a,refCount:1});const d=t.adoptedStyleSheets||[];d.includes(a)||(t.adoptedStyleSheets=[...d,a])}))}(e,i)).unsubscribe.bind(r);r.unsubscribe=()=>{if(window[n][i]){const e=window[n][i];e.refCount>1?e.refCount=e.refCount-1:delete window[n][i]}o()}}(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription):(this.clientStyling&&o(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)))}startTimerBtnResendCode(){this.isBtnSendAvailable=!1,this.tempBtnResendCount=this.btnResendCount,this.btnResendTimer=setInterval((()=>{this.tempBtnResendCount--,this.tempBtnResendCount<0&&(clearInterval(this.btnResendTimer),this.isBtnSendAvailable=!0,((e,i={})=>{const r=new CustomEvent("track-custom-event",{detail:{type:"sms_code_resend",data:i},bubbles:!0,composed:!0});document.dispatchEvent(r)})(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,i){return function(...r){clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout((()=>{e.apply(this,r)}),i)}}handleSendCode(){this.errMsg="";let e=new URL(`${this.endpoint}/v1/player/legislation/generate2FACode`);const i={method:"POST",headers:{accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({userId:`${this.userId}`})};fetch(e.href,i).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:t(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}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}render(){return i("div",{key:"449bdf96de92603f0882bd37fff03fa6edbbb905",class:"PlayerSmsVerification",ref:e=>this.stylingContainer=e},i("div",{key:"af4bc93419d2a2fb169d719a0a2245dfe73952bf",class:"PlayerSmsVerificationTitleContainer"},i("h4",{key:"05bc166a71aaad15e135e33c26375848d5fa7896",class:"PlayerSmsVerificationTitle"},t("title",this.lang)),i("p",{key:"69e71af868c18a8c7658c447cd4faad8474404d8",class:"PlayerSmsVerificationSubtitle"},t("subtitle",this.lang))),i("div",{key:"379d4223df2bb70d077fe0a61ce625988d94a4db",class:"PlayerSmsVerificationContainer"},i("p",{key:"e1bc65f9059db1026cf8ccfbe6ed1be7260ea92a",class:"PlayerSmsVerificationMsg"+(this.msgEnterCode?"":" Hidden")},t(this.msgEnterCode,this.lang)),i("div",{key:"141b38acc8f8f2500327782990cad15955af3608",class:"PlayerSmsVerificationInput"},i("input",{key:"3e68caa0da49cb710df3f317889d60ca8c22e5b1",type:"text",onInput:e=>this.handleInput(e),value:this.code})),this.errMsg?i("p",{class:"PlayerSmsVerificationErrMsg"},t(this.errMsg,this.lang)):i("p",{class:"PlayerSmsVerificationMsg"+(!this.isBtnSendAvailable&&this.isCodeSentOnce?"":" Hidden")},t("msgResendNotice",this.lang)),!this.errMsg&&i("p",{key:"db78c93955b31f9f0f612902c805efeb41574dff",class:"PlayerSMSErrorTextPlaceholder"})),i("div",{key:"88b6294ad365a63961641b17bca33e1ecdd22b3b",class:"PlayerSmsVerificationButtonContainer"},i("button",{key:"5eab8b95b13af28c130a1d243e348fea411b134c",class:"PlayerSmsVerificationButton",onClick:this.debounce(this.handleSendCode.bind(this),850),disabled:!this.isBtnSendAvailable},this.isCodeSentOnce?this.isBtnSendAvailable?t("btnResend",this.lang):this.tempBtnResendCount:t("btnSend",this.lang)),i("button",{key:"dbb64063224e6fe3f41838c21ce4b2711b3cd5f1",class:"PlayerSmsVerificationButton",onClick:this.debounce(this.handleCheckCode.bind(this),850),disabled:!this.isCodeSentOnce||""===this.code||void 0===this.code},t("btnActivate",this.lang))))}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"]}}};d.style=":host{display:block}.PlayerSmsVerification{padding:30px;display:flex;align-items:center;flex-direction:column;background:var(--emw--registration-color-bg, var(--emw--color-gray-50, #F9F8F8))}.PlayerSmsVerificationTitleContainer{color:var(--emw--registration-contrast, var(--emw--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(--emw--button-typography, var(--emw--color-white, #FFFFFF));background:var(--emw--registration-color-primary, var(--emw--color-primary, #22B04E));border:1px solid var(--emw--registration-color-primary, var(--emw--color-primary, #22B04E));border-radius:5px;width:100%;height:60px;padding:0;text-transform:uppercase;font-size:18px;cursor:pointer;font-family:inherit}.PlayerSmsVerificationButton:disabled{background:var(--emw--color-gray-100, #E6E6E6);border:1px solid var(--emw--color-gray-150, #828282);cursor:not-allowed}.PlayerSmsVerificationInput{color:var(--emw--registration-contrast, var(--emw--color-gray-300, #58586B));display:flex;flex-direction:column;position:relative;width:100%}.PlayerSmsVerificationInput input{width:100%;height:44px;border:1px solid var(--emw--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(--emw--registration-contrast, var(--emw--color-gray-300, #58586B))}.PlayerSmsVerificationMsg.Hidden{display:none}.PlayerSmsVerificationErrMsg{font-size:12px;color:var(--emw--color-error, var(--emw--color-red, #ed0909))}.PlayerSMSErrorTextPlaceholder{padding:3px}";export{d as player_sms_verification}
|