@everymatrix/user-login 1.42.0 → 1.43.1

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.
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-5d65f61a.js');
6
6
 
7
7
  const DEFAULT_LANGUAGE = 'en';
8
- const SUPPORTED_LANGUAGES = ['ro', 'en', 'cz', 'de', 'hr'];
9
8
  const TRANSLATIONS = {
10
9
  en: {
11
10
  invalidField: 'This field is invalid',
@@ -97,14 +96,16 @@ const TRANSLATIONS = {
97
96
  }
98
97
  };
99
98
  const getTranslations = (url) => {
100
- // fetch url, get the data, replace the TRANSLATIONS content
101
99
  return new Promise((resolve) => {
102
100
  fetch(url)
103
101
  .then((res) => res.json())
104
102
  .then((data) => {
105
- Object.keys(data).forEach((item) => {
106
- for (let key in data[item]) {
107
- TRANSLATIONS[item][key] = data[item][key];
103
+ Object.keys(data).forEach((lang) => {
104
+ if (!TRANSLATIONS[lang]) {
105
+ TRANSLATIONS[lang] = {};
106
+ }
107
+ for (let key in data[lang]) {
108
+ TRANSLATIONS[lang][key] = data[lang][key];
108
109
  }
109
110
  });
110
111
  resolve(true);
@@ -113,7 +114,7 @@ const getTranslations = (url) => {
113
114
  };
114
115
  const translate = (key, customLang, values) => {
115
116
  const lang = customLang;
116
- let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
117
+ let translation = TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
117
118
  if (values !== undefined) {
118
119
  for (const [key, value] of Object.entries(values.values)) {
119
120
  const regex = new RegExp(`{${key}}`, 'g');
@@ -1,5 +1,4 @@
1
1
  const DEFAULT_LANGUAGE = 'en';
2
- const SUPPORTED_LANGUAGES = ['ro', 'en', 'cz', 'de', 'hr'];
3
2
  const TRANSLATIONS = {
4
3
  en: {
5
4
  invalidField: 'This field is invalid',
@@ -91,14 +90,16 @@ const TRANSLATIONS = {
91
90
  }
92
91
  };
93
92
  export const getTranslations = (url) => {
94
- // fetch url, get the data, replace the TRANSLATIONS content
95
93
  return new Promise((resolve) => {
96
94
  fetch(url)
97
95
  .then((res) => res.json())
98
96
  .then((data) => {
99
- Object.keys(data).forEach((item) => {
100
- for (let key in data[item]) {
101
- TRANSLATIONS[item][key] = data[item][key];
97
+ Object.keys(data).forEach((lang) => {
98
+ if (!TRANSLATIONS[lang]) {
99
+ TRANSLATIONS[lang] = {};
100
+ }
101
+ for (let key in data[lang]) {
102
+ TRANSLATIONS[lang][key] = data[lang][key];
102
103
  }
103
104
  });
104
105
  resolve(true);
@@ -107,7 +108,7 @@ export const getTranslations = (url) => {
107
108
  };
108
109
  export const translate = (key, customLang, values) => {
109
110
  const lang = customLang;
110
- let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
111
+ let translation = TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
111
112
  if (values !== undefined) {
112
113
  for (const [key, value] of Object.entries(values.values)) {
113
114
  const regex = new RegExp(`{${key}}`, 'g');
@@ -1,7 +1,6 @@
1
1
  import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
2
 
3
3
  const DEFAULT_LANGUAGE = 'en';
4
- const SUPPORTED_LANGUAGES = ['ro', 'en', 'cz', 'de', 'hr'];
5
4
  const TRANSLATIONS = {
6
5
  en: {
7
6
  invalidField: 'This field is invalid',
@@ -93,14 +92,16 @@ const TRANSLATIONS = {
93
92
  }
94
93
  };
95
94
  const getTranslations = (url) => {
96
- // fetch url, get the data, replace the TRANSLATIONS content
97
95
  return new Promise((resolve) => {
98
96
  fetch(url)
99
97
  .then((res) => res.json())
100
98
  .then((data) => {
101
- Object.keys(data).forEach((item) => {
102
- for (let key in data[item]) {
103
- TRANSLATIONS[item][key] = data[item][key];
99
+ Object.keys(data).forEach((lang) => {
100
+ if (!TRANSLATIONS[lang]) {
101
+ TRANSLATIONS[lang] = {};
102
+ }
103
+ for (let key in data[lang]) {
104
+ TRANSLATIONS[lang][key] = data[lang][key];
104
105
  }
105
106
  });
106
107
  resolve(true);
@@ -109,7 +110,7 @@ const getTranslations = (url) => {
109
110
  };
110
111
  const translate = (key, customLang, values) => {
111
112
  const lang = customLang;
112
- let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
113
+ let translation = TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
113
114
  if (values !== undefined) {
114
115
  for (const [key, value] of Object.entries(values.values)) {
115
116
  const regex = new RegExp(`{${key}}`, 'g');
@@ -1,7 +1,6 @@
1
1
  import { r as registerInstance, h } from './index-20da8fd1.js';
2
2
 
3
3
  const DEFAULT_LANGUAGE = 'en';
4
- const SUPPORTED_LANGUAGES = ['ro', 'en', 'cz', 'de', 'hr'];
5
4
  const TRANSLATIONS = {
6
5
  en: {
7
6
  invalidField: 'This field is invalid',
@@ -93,14 +92,16 @@ const TRANSLATIONS = {
93
92
  }
94
93
  };
95
94
  const getTranslations = (url) => {
96
- // fetch url, get the data, replace the TRANSLATIONS content
97
95
  return new Promise((resolve) => {
98
96
  fetch(url)
99
97
  .then((res) => res.json())
100
98
  .then((data) => {
101
- Object.keys(data).forEach((item) => {
102
- for (let key in data[item]) {
103
- TRANSLATIONS[item][key] = data[item][key];
99
+ Object.keys(data).forEach((lang) => {
100
+ if (!TRANSLATIONS[lang]) {
101
+ TRANSLATIONS[lang] = {};
102
+ }
103
+ for (let key in data[lang]) {
104
+ TRANSLATIONS[lang][key] = data[lang][key];
104
105
  }
105
106
  });
106
107
  resolve(true);
@@ -109,7 +110,7 @@ const getTranslations = (url) => {
109
110
  };
110
111
  const translate = (key, customLang, values) => {
111
112
  const lang = customLang;
112
- let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
113
+ let translation = TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
113
114
  if (values !== undefined) {
114
115
  for (const [key, value] of Object.entries(values.values)) {
115
116
  const regex = new RegExp(`{${key}}`, 'g');
@@ -0,0 +1 @@
1
+ import{r as o,h as e}from"./p-55726395.js";const i={en:{invalidField:"This field is invalid",forgotPassword:"Forgot Password",userEmail:"Username or Email",password:"Password",login:"Login",genericError:"An unexpected error has occured",successMessage:"Login successful",Forbidden_UserAccount_Blocked:"Player account blocked",Unauthorized:"The player account number, e-mail address or password is incorrect"},ro:{invalidField:"This field is invalid",forgotPassword:"Forgot Password",userEmail:"Username or Email",password:"Password",login:"Login",genericError:"An unexpected error has occured",successMessage:"Login successful",Forbidden_UserAccount_Blocked:"Player account blocked",Unauthorized:"Numărul contului de jucător, adresa de e-mail sau parola este incorectă"},hr:{invalidField:"Ovo polje je nevažeće",forgotPassword:"Zaboravljena lozinka",userEmail:"Korisničko ime ili email",password:"Lozinka",login:"Prijava",genericError:"Došlo je do neočekivane pogreške",successMessage:"Prijava uspješna",Forbidden_UserAccount_Blocked:"Vaš račun je blokiran",Unauthorized:"Lozinka, e-mail adresa ili korisničko ime su pogrešno uneseni"},fr:{invalidField:"This field is invalid",forgotPassword:"Forgot Password",userEmail:"Username or Email",password:"Password",login:"Login",genericError:"An unexpected error has occured",successMessage:"Login successful",Forbidden_UserAccount_Blocked:"Player account blocked",Unauthorized:"Le numéro de compte du joueur, l'adresse e-mail ou le mot de passe est incorrect"},cs:{invalidField:"Ovo polje je nevažeće.",forgotPassword:"Zaboravio sam lozinku ",userEmail:"Korisničko ime ili email",password:"Lozinka",login:"Prijava",genericError:"An unexpected error has occured",successMessage:"Login successful",Forbidden_UserAccount_Blocked:"Player account blocked",Unauthorized:"Číslo účtu hráče, e-mailová adresa nebo heslo je nesprávné"},de:{invalidField:"This field is invalid",forgotPassword:"Forgot Password",userEmail:"Username or Email",password:"Password",login:"Login",genericError:"An unexpected error has occured",successMessage:"Login successful",Forbidden_UserAccount_Blocked:"Player account blocked",Unauthorized:"Die Spielerkontonummer, E-Mail-Adresse oder das Passwort ist falsch"},"pt-br":{invalidField:"O campo é inválido",forgotPassword:"Esqueceu sua senha",userEmail:"Usuário ou e-mail",Password:"Senha",login:"Entrem",genericError:"Ocorreu um erro inesperado",successMessage:"Você fez login com sucesso",Forbidden_UserAccount_Blocked:"Player account blocked",Unauthorized:"O número da conta do jogador, o endereço de e-mail ou a senha estão incorretos"},"es-mx":{invalidField:"El campo es inválido",forgotPassword:"Olvidó contraseña",userEmail:"Usuario o Correo Electrónico",Password:"Contraseña",login:"Entrar",genericError:"Ha ocurrido un error inesperado",successMessage:"Ha ingreasado de forma exitosa",Forbidden_UserAccount_Blocked:"Player account blocked",Unauthorized:"El número de cuenta del jugador, la dirección de correo electrónico o la contraseña son incorrectos"}},s=o=>new Promise((e=>{fetch(o).then((o=>o.json())).then((o=>{Object.keys(o).forEach((e=>{i[e]||(i[e]={});for(let s in o[e])i[e][s]=o[e][s]})),e(!0)}))})),r=(o,e,s)=>{let r=i[void 0!==e&&e in i?e:"en"][o];if(void 0!==s)for(const[o,e]of Object.entries(s.values)){const i=new RegExp(`{${o}}`,"g");r=r.replace(i,e)}return r},t=class{constructor(e){o(this,e),this.endpoint="",this.lang="en",this.clientStyling="",this.clientStylingUrl="",this.translationUrl="",this.passwordReset="false",this.userEmailRegexOptions="i",this.passwordRegexOptions="",this.userNameEmail="",this.userPassword="",this.isValidUserEmail=!0,this.isValidPassword=!0,this.isPasswordVisible=!1,this.limitStylingAppends=!1,this.errorMessage="",this.hasError=!1,this.errorCode="",this.setClientStyling=()=>{let o=document.createElement("style");o.innerHTML=this.clientStyling,this.stylingContainer.appendChild(o)},this.setClientStylingURL=()=>{let o=new URL(this.clientStylingUrl),e=document.createElement("style");fetch(o.href).then((o=>o.text())).then((o=>{e.innerHTML=o,setTimeout((()=>{this.stylingContainer.appendChild(e)}),1)}))},this.autofillCredentialsHandler=o=>{this.userNameEmail=o.detail.userNameEmail,this.userPassword=o.detail.userPassword,this.handleLogin()},this.userLogin=async({username:o,password:e})=>{let i={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:o,password:e})};fetch(`${this.endpoint}/v1/player/legislation/login`,i).then((o=>o.json())).then((o=>{var e,i,s;(null===(e=o.sessionBlockers)||void 0===e?void 0:e.includes("has-to-set-consents"))&&window.postMessage({type:"PlayerActions",gmversion:"gm16"},window.location.href),!0===(null==o?void 0:o.hasToSetPass)&&window.postMessage({type:"HasToSetPass"},window.location.href),o.sessionId?(window.postMessage({type:"UserSessionID",session:o.sessionId,userid:o.userId},window.location.href),window.postMessage({type:"WidgetNotification",data:{type:"success",message:r("successMessage",this.lang)}},window.location.href),this.hasError=!1):(this.hasError=!0,this.errorCode=null===(i=null==o?void 0:o.thirdPartyResponse)||void 0===i?void 0:i.errorCode,this.errorMessage=r(`${this.errorCode}`,this.lang)||(null===(s=null==o?void 0:o.thirdPartyResponse)||void 0===s?void 0:s.message)||r("genericError",this.lang),this.errorMessage&&(console.error(this.errorMessage),this.sendErrorNotification(this.errorMessage)))})).catch((o=>{console.error(o),this.hasError=!0,this.errorMessage=r("genericError",this.lang),this.sendErrorNotification(this.errorMessage)}))},this.debouncedUserLogin=this.debounce(this.userLogin,850),this.handleLogin=()=>{this.debouncedUserLogin({username:this.userNameEmail,password:this.userPassword}),this.dispatchUpdateLoginCredentialsEvent()},this.handleInputChange=(o,e)=>{this.hasError=!1;const i=o.target.value;"user"===e?(this.userNameEmail=i,this.isValidUserEmail=this.userEmailValidation(this.userNameEmail)):(this.userPassword=i,this.isValidPassword=this.passwordValidation(i))},this.userEmailValidation=o=>new RegExp(this.userEmailRegex,this.userEmailRegexOptions).test(o),this.passwordValidation=o=>new RegExp(this.passwordRegex,this.passwordRegexOptions).test(o),this.togglePassword=()=>{this.isPasswordVisible=!this.isPasswordVisible},this.resetPassword=()=>{window.postMessage({type:"NavForgotPassword"},window.location.href)}}handleNewTranslations(){s(this.translationUrl)}async componentWillLoad(){this.translationUrl.length>2&&await s(this.translationUrl)}componentDidLoad(){window.addEventListener("LoginCredentials",this.autofillCredentialsHandler),window.postMessage({type:"UserLoginDidLoad"})}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}disconnectedCallback(){window.removeEventListener("LoginCredentials",this.autofillCredentialsHandler)}sendErrorNotification(o){window.postMessage({type:"HasError",error:o},window.location.href),window.postMessage({type:"WidgetNotification",data:{type:"error",message:o}},window.location.href)}debounce(o,e){let i;return function(...s){clearTimeout(i),i=setTimeout((()=>{o.apply(this,s)}),e)}}dispatchUpdateLoginCredentialsEvent(){this.hasError||(this.updateLoginCredentialsEvent=new CustomEvent("UpdateLoginCredentials",{bubbles:!0,detail:{userNameEmail:this.userNameEmail,userPassword:this.userPassword}}),window.dispatchEvent(this.updateLoginCredentialsEvent))}render(){let o=e("span",{class:"InputIcon"},this.isPasswordVisible&&e("svg",{onClick:()=>this.togglePassword(),class:"TogglePasswordVisibility",part:"TogglePasswordVisibility",xmlns:"http://www.w3.org/2000/svg",width:"18.844",height:"12.887",viewBox:"0 0 18.844 12.887"},e("g",{transform:"translate(-110.856 -23.242)"},e("circle",{class:"PasswordVisibilityIcon",cx:"0.05",cy:"0.05",r:"0.05",transform:"translate(121.017 31.148)"}),e("g",{transform:"translate(117.499 27.37)"},e("path",{class:"PasswordVisibilityIcon",d:"M147.413,43.174a2.774,2.774,0,0,0-3.229-3.943Z",transform:"translate(-142.164 -39.123)"}),e("path",{class:"PasswordVisibilityIcon",d:"M137.031,43.1a2.778,2.778,0,0,0,3.447,4.209Z",transform:"translate(-136.413 -42.068)"})),e("g",{transform:"translate(110.856 24.899)"},e("path",{class:"PasswordVisibilityIcon",d:"M122.538,42.061a7.043,7.043,0,0,1-2.325.53,10.373,10.373,0,0,1-4.393-1.482,36.509,36.509,0,0,1-3.873-2.391.13.13,0,0,1,0-.208,44.141,44.141,0,0,1,3.873-2.651c.394-.233.768-.437,1.13-.622l-.686-.838c-.322.167-.651.347-.99.55a37.989,37.989,0,0,0-3.977,2.729,1.21,1.21,0,0,0-.442.962,1.1,1.1,0,0,0,.494.936,34.416,34.416,0,0,0,3.977,2.469,11.468,11.468,0,0,0,4.886,1.611,8.427,8.427,0,0,0,3.039-.725Z",transform:"translate(-110.856 -33.157)"}),e("path",{class:"PasswordVisibilityIcon",d:"M149.119,34.14a45.875,45.875,0,0,0-4.055-2.729,20.541,20.541,0,0,0-2.547-1.248,5.6,5.6,0,0,0-4.79-.017l.7.856a5.254,5.254,0,0,1,1.672-.346,10.072,10.072,0,0,1,4.445,1.663,34.132,34.132,0,0,1,3.925,2.651.13.13,0,0,1,0,.208,40.2,40.2,0,0,1-3.925,2.391c-.179.092-.352.176-.525.26l.684.835c.1-.054.2-.1.309-.159a36.356,36.356,0,0,0,4.055-2.469,1.067,1.067,0,0,0,.52-.936A1.159,1.159,0,0,0,149.119,34.14Z",transform:"translate(-130.743 -29.617)"})),e("rect",{class:"PasswordVisibilityIcon",width:"0.972",height:"15.861",rx:"0.486",transform:"translate(114.827 23.858) rotate(-39.315)"}))),!this.isPasswordVisible&&e("svg",{onClick:()=>this.togglePassword(),class:"TogglePasswordVisibility PasswordVisible",part:"TogglePasswordVisibility",xmlns:"http://www.w3.org/2000/svg",width:"18.843",height:"10.5",viewBox:"0 0 18.843 10.5"},e("g",{transform:"translate(-14.185 -27.832)"},e("path",{class:"PasswordVisibilityIcon",d:"M23.541,38.332a11.467,11.467,0,0,1-4.886-1.611,34.413,34.413,0,0,1-3.976-2.469,1.1,1.1,0,0,1-.494-.936,1.21,1.21,0,0,1,.442-.962A37.986,37.986,0,0,1,18.6,29.625a16.06,16.06,0,0,1,2.521-1.248,6.862,6.862,0,0,1,2.417-.546,6.862,6.862,0,0,1,2.417.546,20.541,20.541,0,0,1,2.547,1.248,45.872,45.872,0,0,1,4.054,2.729,1.159,1.159,0,0,1,.468.962,1.067,1.067,0,0,1-.52.936,36.353,36.353,0,0,1-4.054,2.469A11.2,11.2,0,0,1,23.541,38.332Zm0-9.46a9.813,9.813,0,0,0-4.392,1.663,44.138,44.138,0,0,0-3.873,2.651.13.13,0,0,0,0,.208,36.5,36.5,0,0,0,3.873,2.391,10.372,10.372,0,0,0,4.392,1.481,11.051,11.051,0,0,0,4.444-1.481,40.2,40.2,0,0,0,3.925-2.391.13.13,0,0,0,0-.208h0a34.132,34.132,0,0,0-3.925-2.651A10.072,10.072,0,0,0,23.541,28.872Z",transform:"translate(0)"}),e("circle",{class:"PasswordVisibilityIcon",cx:"2.779",cy:"2.779",r:"2.779",transform:"translate(20.827 30.303)"})))),i=e("div",{class:"FormBox"},e("div",{class:"FormValue"},e("div",{class:!this.isValidUserEmail||this.hasError?"InputBox InputInvalidBox":"InputBox"},e("input",{type:"text",placeholder:"",value:this.userNameEmail,onFocus:o=>this.handleInputChange(o,"user"),onInput:o=>this.handleInputChange(o,"user"),required:!0}),e("label",{class:(this.userNameEmail?"FieldFilledIn":"")+" "+(!this.isValidUserEmail||this.hasError?"FieldInvalid":"")},r("userEmail",this.lang)),!this.isValidUserEmail&&e("p",{class:"InvalidField"},r("invalidField",this.lang))),e("div",{class:!this.isValidPassword||this.hasError?"InputBox InputInvalidBox":"InputBox"},o,e("input",{type:this.isPasswordVisible?"text":"password",placeholder:"",value:this.userPassword,onFocus:o=>this.handleInputChange(o,"password"),onInput:o=>this.handleInputChange(o,"password"),required:!0}),e("label",{class:(this.userPassword?"FieldFilledIn":"")+" "+(!this.isValidPassword||this.hasError?"FieldInvalid":"")},r("password",this.lang)),!this.isValidPassword&&e("p",{class:"InvalidField"},r("invalidField",this.lang))),"true"==this.passwordReset&&e("div",{class:"ForgotPassword"},e("button",{onClick:()=>this.resetPassword()},r("forgotPassword",this.lang))),e("button",{disabled:!(this.isValidUserEmail&&this.isValidPassword&&this.userNameEmail&&this.userPassword),class:"SubmitCredentials",onClick:()=>this.handleLogin()},r("login",this.lang)),this.hasError&&e("p",{class:"CredentialsError"},this.errorMessage)));return e("section",{ref:o=>this.stylingContainer=o},i)}static get watchers(){return{translationUrl:["handleNewTranslations"]}}};t.style=':host{display:block;font-family:"Roboto", sans-serif}section{height:100%;width:100%;background-position:center;background-size:cover}.FormValue{width:100%}.FormBox{height:100%;display:flex;position:relative;background:none;border:none;justify-content:center;align-items:center}.InputBox{position:relative;margin:30px 0;width:100%;border-bottom:2px solid var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #22B04E))}.InputBox.InputInvalidBox .PasswordVisibilityIcon{fill:var(--emfw-w-color-error, var(--emfe-w-color-red, #FD2839))}.InputBox.InputInvalidBox input{color:var(--emfw-w-color-error, var(--emfe-w-color-red, #FD2839))}.InputBox.InputInvalidBox::after{content:"";height:2px;width:100%;transition:width 0.6s linear;background:var(--emfw-w-color-error, var(--emfe-w-color-red, #FD2839))}.InputBox::after{content:"";display:block;width:0;height:2px;position:relative;top:2px}.InputBox .PasswordVisibilityIcon{fill:var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #22B04E))}.InputBox .InputIcon .TogglePasswordVisibility{cursor:pointer;position:absolute;top:18px;right:0}.InputBox .InputIcon .TogglePasswordVisibility.PasswordVisible{top:19.5px}.InputBox label{position:absolute;top:50%;left:5px;transform:translateY(-50%);color:var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #22B04E));font-size:1em;pointer-events:none;transition:0.5s}.InputBox label.FieldInvalid{color:#C23135}.InputBox input{width:100%;height:50px;background:transparent;border:none;outline:none;font-size:1em;padding:0 35px 0 5px;color:var(--emfe-w-registration-typography, var(--emfe-w-color-typography, #FFFFFF));box-sizing:border-box}input:focus~label,label.FieldFilledIn{top:-3px;font-size:0.7em}.ForgotPassword button{margin:-10px 0 17px;font-size:0.9em;color:var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #22B04E));display:flex;justify-content:space-between;background-color:transparent;padding:0;height:unset;border:0;cursor:pointer}.SubmitCredentials{display:block;margin:0 auto;outline:none;cursor:pointer;background-image:linear-gradient(to bottom, color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, black 20%), var(--emw--color-primary, #22B04E), color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, white 30%));border:2px solid var(--emw--button-border-color, #0E5924);border-radius:var(--emw--button-border-radius, 50px);padding:10px 20px;font-size:var(--emw--font-size-large, 20px);font-family:var(--emw--button-typography);color:var(--emw--button-text-color, #FFFFFF)}.SubmitCredentials:disabled{background:#707070}.Register{font-size:0.9em;color:var(--emfe-w-registration-typography, var(--emfe-w-color-typography, #FFFFFF));text-align:center;margin:25px 0 10px}.Register p a{text-decoration:none;font-weight:600}.Register p a:hover{text-decoration:underline}.InvalidField{position:absolute;top:45px;color:var(--emfw-w-color-error, var(--emfe-w-color-red, #FD2839));font-size:0.7em}.SubmitCredentials{margin-bottom:20px}.CredentialsError{color:var(--emfw-w-color-error, var(--emfe-w-color-red, #FD2839));font-size:0.7em;padding:0 0 20px 0;margin:0}.CredentialsError input{color:var(--emfw-w-color-error, var(--emfe-w-color-red, #FD2839))}@media screen and (max-width: 480px){.FormBox{width:100%;border-radius:0px}}';export{t as user_login}
@@ -1 +1 @@
1
- import{p as s,b as e}from"./p-55726395.js";(()=>{const e=import.meta.url,r={};return""!==e&&(r.resourcesUrl=new URL(".",e).href),s(r)})().then((s=>e([["p-12204d5f",[[1,"user-login",{endpoint:[513],lang:[1537],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],translationUrl:[513,"translation-url"],passwordReset:[513,"password-reset"],userEmailRegex:[513,"user-email-regex"],userEmailRegexOptions:[513,"user-email-regex-options"],passwordRegex:[513,"password-regex"],passwordRegexOptions:[513,"password-regex-options"],userNameEmail:[32],userPassword:[32],isValidUserEmail:[32],isValidPassword:[32],isPasswordVisible:[32],limitStylingAppends:[32],errorMessage:[32],hasError:[32]}]]]],s)));
1
+ import{p as s,b as e}from"./p-55726395.js";(()=>{const e=import.meta.url,r={};return""!==e&&(r.resourcesUrl=new URL(".",e).href),s(r)})().then((s=>e([["p-272dfe10",[[1,"user-login",{endpoint:[513],lang:[1537],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],translationUrl:[513,"translation-url"],passwordReset:[513,"password-reset"],userEmailRegex:[513,"user-email-regex"],userEmailRegexOptions:[513,"user-email-regex-options"],passwordRegex:[513,"password-regex"],passwordRegexOptions:[513,"password-regex-options"],userNameEmail:[32],userPassword:[32],isValidUserEmail:[32],isValidPassword:[32],isPasswordVisible:[32],limitStylingAppends:[32],errorMessage:[32],hasError:[32]}]]]],s)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/user-login",
3
- "version": "1.42.0",
3
+ "version": "1.43.1",
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 o,h as e}from"./p-55726395.js";const i=["ro","en","cz","de","hr"],s={en:{invalidField:"This field is invalid",forgotPassword:"Forgot Password",userEmail:"Username or Email",password:"Password",login:"Login",genericError:"An unexpected error has occured",successMessage:"Login successful",Forbidden_UserAccount_Blocked:"Player account blocked",Unauthorized:"The player account number, e-mail address or password is incorrect"},ro:{invalidField:"This field is invalid",forgotPassword:"Forgot Password",userEmail:"Username or Email",password:"Password",login:"Login",genericError:"An unexpected error has occured",successMessage:"Login successful",Forbidden_UserAccount_Blocked:"Player account blocked",Unauthorized:"Numărul contului de jucător, adresa de e-mail sau parola este incorectă"},hr:{invalidField:"Ovo polje je nevažeće",forgotPassword:"Zaboravljena lozinka",userEmail:"Korisničko ime ili email",password:"Lozinka",login:"Prijava",genericError:"Došlo je do neočekivane pogreške",successMessage:"Prijava uspješna",Forbidden_UserAccount_Blocked:"Vaš račun je blokiran",Unauthorized:"Lozinka, e-mail adresa ili korisničko ime su pogrešno uneseni"},fr:{invalidField:"This field is invalid",forgotPassword:"Forgot Password",userEmail:"Username or Email",password:"Password",login:"Login",genericError:"An unexpected error has occured",successMessage:"Login successful",Forbidden_UserAccount_Blocked:"Player account blocked",Unauthorized:"Le numéro de compte du joueur, l'adresse e-mail ou le mot de passe est incorrect"},cs:{invalidField:"Ovo polje je nevažeće.",forgotPassword:"Zaboravio sam lozinku ",userEmail:"Korisničko ime ili email",password:"Lozinka",login:"Prijava",genericError:"An unexpected error has occured",successMessage:"Login successful",Forbidden_UserAccount_Blocked:"Player account blocked",Unauthorized:"Číslo účtu hráče, e-mailová adresa nebo heslo je nesprávné"},de:{invalidField:"This field is invalid",forgotPassword:"Forgot Password",userEmail:"Username or Email",password:"Password",login:"Login",genericError:"An unexpected error has occured",successMessage:"Login successful",Forbidden_UserAccount_Blocked:"Player account blocked",Unauthorized:"Die Spielerkontonummer, E-Mail-Adresse oder das Passwort ist falsch"},"pt-br":{invalidField:"O campo é inválido",forgotPassword:"Esqueceu sua senha",userEmail:"Usuário ou e-mail",Password:"Senha",login:"Entrem",genericError:"Ocorreu um erro inesperado",successMessage:"Você fez login com sucesso",Forbidden_UserAccount_Blocked:"Player account blocked",Unauthorized:"O número da conta do jogador, o endereço de e-mail ou a senha estão incorretos"},"es-mx":{invalidField:"El campo es inválido",forgotPassword:"Olvidó contraseña",userEmail:"Usuario o Correo Electrónico",Password:"Contraseña",login:"Entrar",genericError:"Ha ocurrido un error inesperado",successMessage:"Ha ingreasado de forma exitosa",Forbidden_UserAccount_Blocked:"Player account blocked",Unauthorized:"El número de cuenta del jugador, la dirección de correo electrónico o la contraseña son incorrectos"}},r=o=>new Promise((e=>{fetch(o).then((o=>o.json())).then((o=>{Object.keys(o).forEach((e=>{for(let i in o[e])s[e][i]=o[e][i]})),e(!0)}))})),t=(o,e,r)=>{const t=e;let a=s[void 0!==t&&i.includes(t)?t:"en"][o];if(void 0!==r)for(const[o,e]of Object.entries(r.values)){const i=new RegExp(`{${o}}`,"g");a=a.replace(i,e)}return a},a=class{constructor(e){o(this,e),this.endpoint="",this.lang="en",this.clientStyling="",this.clientStylingUrl="",this.translationUrl="",this.passwordReset="false",this.userEmailRegexOptions="i",this.passwordRegexOptions="",this.userNameEmail="",this.userPassword="",this.isValidUserEmail=!0,this.isValidPassword=!0,this.isPasswordVisible=!1,this.limitStylingAppends=!1,this.errorMessage="",this.hasError=!1,this.errorCode="",this.setClientStyling=()=>{let o=document.createElement("style");o.innerHTML=this.clientStyling,this.stylingContainer.appendChild(o)},this.setClientStylingURL=()=>{let o=new URL(this.clientStylingUrl),e=document.createElement("style");fetch(o.href).then((o=>o.text())).then((o=>{e.innerHTML=o,setTimeout((()=>{this.stylingContainer.appendChild(e)}),1)}))},this.autofillCredentialsHandler=o=>{this.userNameEmail=o.detail.userNameEmail,this.userPassword=o.detail.userPassword,this.handleLogin()},this.userLogin=async({username:o,password:e})=>{let i={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:o,password:e})};fetch(`${this.endpoint}/v1/player/legislation/login`,i).then((o=>o.json())).then((o=>{var e,i,s;(null===(e=o.sessionBlockers)||void 0===e?void 0:e.includes("has-to-set-consents"))&&window.postMessage({type:"PlayerActions",gmversion:"gm16"},window.location.href),!0===(null==o?void 0:o.hasToSetPass)&&window.postMessage({type:"HasToSetPass"},window.location.href),o.sessionId?(window.postMessage({type:"UserSessionID",session:o.sessionId,userid:o.userId},window.location.href),window.postMessage({type:"WidgetNotification",data:{type:"success",message:t("successMessage",this.lang)}},window.location.href),this.hasError=!1):(this.hasError=!0,this.errorCode=null===(i=null==o?void 0:o.thirdPartyResponse)||void 0===i?void 0:i.errorCode,this.errorMessage=t(`${this.errorCode}`,this.lang)||(null===(s=null==o?void 0:o.thirdPartyResponse)||void 0===s?void 0:s.message)||t("genericError",this.lang),this.errorMessage&&(console.error(this.errorMessage),this.sendErrorNotification(this.errorMessage)))})).catch((o=>{console.error(o),this.hasError=!0,this.errorMessage=t("genericError",this.lang),this.sendErrorNotification(this.errorMessage)}))},this.debouncedUserLogin=this.debounce(this.userLogin,850),this.handleLogin=()=>{this.debouncedUserLogin({username:this.userNameEmail,password:this.userPassword}),this.dispatchUpdateLoginCredentialsEvent()},this.handleInputChange=(o,e)=>{this.hasError=!1;const i=o.target.value;"user"===e?(this.userNameEmail=i,this.isValidUserEmail=this.userEmailValidation(this.userNameEmail)):(this.userPassword=i,this.isValidPassword=this.passwordValidation(i))},this.userEmailValidation=o=>new RegExp(this.userEmailRegex,this.userEmailRegexOptions).test(o),this.passwordValidation=o=>new RegExp(this.passwordRegex,this.passwordRegexOptions).test(o),this.togglePassword=()=>{this.isPasswordVisible=!this.isPasswordVisible},this.resetPassword=()=>{window.postMessage({type:"NavForgotPassword"},window.location.href)}}handleNewTranslations(){r(this.translationUrl)}async componentWillLoad(){this.translationUrl.length>2&&await r(this.translationUrl)}componentDidLoad(){window.addEventListener("LoginCredentials",this.autofillCredentialsHandler),window.postMessage({type:"UserLoginDidLoad"})}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}disconnectedCallback(){window.removeEventListener("LoginCredentials",this.autofillCredentialsHandler)}sendErrorNotification(o){window.postMessage({type:"HasError",error:o},window.location.href),window.postMessage({type:"WidgetNotification",data:{type:"error",message:o}},window.location.href)}debounce(o,e){let i;return function(...s){clearTimeout(i),i=setTimeout((()=>{o.apply(this,s)}),e)}}dispatchUpdateLoginCredentialsEvent(){this.hasError||(this.updateLoginCredentialsEvent=new CustomEvent("UpdateLoginCredentials",{bubbles:!0,detail:{userNameEmail:this.userNameEmail,userPassword:this.userPassword}}),window.dispatchEvent(this.updateLoginCredentialsEvent))}render(){let o=e("span",{class:"InputIcon"},this.isPasswordVisible&&e("svg",{onClick:()=>this.togglePassword(),class:"TogglePasswordVisibility",part:"TogglePasswordVisibility",xmlns:"http://www.w3.org/2000/svg",width:"18.844",height:"12.887",viewBox:"0 0 18.844 12.887"},e("g",{transform:"translate(-110.856 -23.242)"},e("circle",{class:"PasswordVisibilityIcon",cx:"0.05",cy:"0.05",r:"0.05",transform:"translate(121.017 31.148)"}),e("g",{transform:"translate(117.499 27.37)"},e("path",{class:"PasswordVisibilityIcon",d:"M147.413,43.174a2.774,2.774,0,0,0-3.229-3.943Z",transform:"translate(-142.164 -39.123)"}),e("path",{class:"PasswordVisibilityIcon",d:"M137.031,43.1a2.778,2.778,0,0,0,3.447,4.209Z",transform:"translate(-136.413 -42.068)"})),e("g",{transform:"translate(110.856 24.899)"},e("path",{class:"PasswordVisibilityIcon",d:"M122.538,42.061a7.043,7.043,0,0,1-2.325.53,10.373,10.373,0,0,1-4.393-1.482,36.509,36.509,0,0,1-3.873-2.391.13.13,0,0,1,0-.208,44.141,44.141,0,0,1,3.873-2.651c.394-.233.768-.437,1.13-.622l-.686-.838c-.322.167-.651.347-.99.55a37.989,37.989,0,0,0-3.977,2.729,1.21,1.21,0,0,0-.442.962,1.1,1.1,0,0,0,.494.936,34.416,34.416,0,0,0,3.977,2.469,11.468,11.468,0,0,0,4.886,1.611,8.427,8.427,0,0,0,3.039-.725Z",transform:"translate(-110.856 -33.157)"}),e("path",{class:"PasswordVisibilityIcon",d:"M149.119,34.14a45.875,45.875,0,0,0-4.055-2.729,20.541,20.541,0,0,0-2.547-1.248,5.6,5.6,0,0,0-4.79-.017l.7.856a5.254,5.254,0,0,1,1.672-.346,10.072,10.072,0,0,1,4.445,1.663,34.132,34.132,0,0,1,3.925,2.651.13.13,0,0,1,0,.208,40.2,40.2,0,0,1-3.925,2.391c-.179.092-.352.176-.525.26l.684.835c.1-.054.2-.1.309-.159a36.356,36.356,0,0,0,4.055-2.469,1.067,1.067,0,0,0,.52-.936A1.159,1.159,0,0,0,149.119,34.14Z",transform:"translate(-130.743 -29.617)"})),e("rect",{class:"PasswordVisibilityIcon",width:"0.972",height:"15.861",rx:"0.486",transform:"translate(114.827 23.858) rotate(-39.315)"}))),!this.isPasswordVisible&&e("svg",{onClick:()=>this.togglePassword(),class:"TogglePasswordVisibility PasswordVisible",part:"TogglePasswordVisibility",xmlns:"http://www.w3.org/2000/svg",width:"18.843",height:"10.5",viewBox:"0 0 18.843 10.5"},e("g",{transform:"translate(-14.185 -27.832)"},e("path",{class:"PasswordVisibilityIcon",d:"M23.541,38.332a11.467,11.467,0,0,1-4.886-1.611,34.413,34.413,0,0,1-3.976-2.469,1.1,1.1,0,0,1-.494-.936,1.21,1.21,0,0,1,.442-.962A37.986,37.986,0,0,1,18.6,29.625a16.06,16.06,0,0,1,2.521-1.248,6.862,6.862,0,0,1,2.417-.546,6.862,6.862,0,0,1,2.417.546,20.541,20.541,0,0,1,2.547,1.248,45.872,45.872,0,0,1,4.054,2.729,1.159,1.159,0,0,1,.468.962,1.067,1.067,0,0,1-.52.936,36.353,36.353,0,0,1-4.054,2.469A11.2,11.2,0,0,1,23.541,38.332Zm0-9.46a9.813,9.813,0,0,0-4.392,1.663,44.138,44.138,0,0,0-3.873,2.651.13.13,0,0,0,0,.208,36.5,36.5,0,0,0,3.873,2.391,10.372,10.372,0,0,0,4.392,1.481,11.051,11.051,0,0,0,4.444-1.481,40.2,40.2,0,0,0,3.925-2.391.13.13,0,0,0,0-.208h0a34.132,34.132,0,0,0-3.925-2.651A10.072,10.072,0,0,0,23.541,28.872Z",transform:"translate(0)"}),e("circle",{class:"PasswordVisibilityIcon",cx:"2.779",cy:"2.779",r:"2.779",transform:"translate(20.827 30.303)"})))),i=e("div",{class:"FormBox"},e("div",{class:"FormValue"},e("div",{class:!this.isValidUserEmail||this.hasError?"InputBox InputInvalidBox":"InputBox"},e("input",{type:"text",placeholder:"",value:this.userNameEmail,onFocus:o=>this.handleInputChange(o,"user"),onInput:o=>this.handleInputChange(o,"user"),required:!0}),e("label",{class:(this.userNameEmail?"FieldFilledIn":"")+" "+(!this.isValidUserEmail||this.hasError?"FieldInvalid":"")},t("userEmail",this.lang)),!this.isValidUserEmail&&e("p",{class:"InvalidField"},t("invalidField",this.lang))),e("div",{class:!this.isValidPassword||this.hasError?"InputBox InputInvalidBox":"InputBox"},o,e("input",{type:this.isPasswordVisible?"text":"password",placeholder:"",value:this.userPassword,onFocus:o=>this.handleInputChange(o,"password"),onInput:o=>this.handleInputChange(o,"password"),required:!0}),e("label",{class:(this.userPassword?"FieldFilledIn":"")+" "+(!this.isValidPassword||this.hasError?"FieldInvalid":"")},t("password",this.lang)),!this.isValidPassword&&e("p",{class:"InvalidField"},t("invalidField",this.lang))),"true"==this.passwordReset&&e("div",{class:"ForgotPassword"},e("button",{onClick:()=>this.resetPassword()},t("forgotPassword",this.lang))),e("button",{disabled:!(this.isValidUserEmail&&this.isValidPassword&&this.userNameEmail&&this.userPassword),class:"SubmitCredentials",onClick:()=>this.handleLogin()},t("login",this.lang)),this.hasError&&e("p",{class:"CredentialsError"},this.errorMessage)));return e("section",{ref:o=>this.stylingContainer=o},i)}static get watchers(){return{translationUrl:["handleNewTranslations"]}}};a.style=':host{display:block;font-family:"Roboto", sans-serif}section{height:100%;width:100%;background-position:center;background-size:cover}.FormValue{width:100%}.FormBox{height:100%;display:flex;position:relative;background:none;border:none;justify-content:center;align-items:center}.InputBox{position:relative;margin:30px 0;width:100%;border-bottom:2px solid var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #22B04E))}.InputBox.InputInvalidBox .PasswordVisibilityIcon{fill:var(--emfw-w-color-error, var(--emfe-w-color-red, #FD2839))}.InputBox.InputInvalidBox input{color:var(--emfw-w-color-error, var(--emfe-w-color-red, #FD2839))}.InputBox.InputInvalidBox::after{content:"";height:2px;width:100%;transition:width 0.6s linear;background:var(--emfw-w-color-error, var(--emfe-w-color-red, #FD2839))}.InputBox::after{content:"";display:block;width:0;height:2px;position:relative;top:2px}.InputBox .PasswordVisibilityIcon{fill:var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #22B04E))}.InputBox .InputIcon .TogglePasswordVisibility{cursor:pointer;position:absolute;top:18px;right:0}.InputBox .InputIcon .TogglePasswordVisibility.PasswordVisible{top:19.5px}.InputBox label{position:absolute;top:50%;left:5px;transform:translateY(-50%);color:var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #22B04E));font-size:1em;pointer-events:none;transition:0.5s}.InputBox label.FieldInvalid{color:#C23135}.InputBox input{width:100%;height:50px;background:transparent;border:none;outline:none;font-size:1em;padding:0 35px 0 5px;color:var(--emfe-w-registration-typography, var(--emfe-w-color-typography, #FFFFFF));box-sizing:border-box}input:focus~label,label.FieldFilledIn{top:-3px;font-size:0.7em}.ForgotPassword button{margin:-10px 0 17px;font-size:0.9em;color:var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #22B04E));display:flex;justify-content:space-between;background-color:transparent;padding:0;height:unset;border:0;cursor:pointer}.SubmitCredentials{display:block;margin:0 auto;outline:none;cursor:pointer;background-image:linear-gradient(to bottom, color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, black 20%), var(--emw--color-primary, #22B04E), color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, white 30%));border:2px solid var(--emw--button-border-color, #0E5924);border-radius:var(--emw--button-border-radius, 50px);padding:10px 20px;font-size:var(--emw--font-size-large, 20px);font-family:var(--emw--button-typography);color:var(--emw--button-text-color, #FFFFFF)}.SubmitCredentials:disabled{background:#707070}.Register{font-size:0.9em;color:var(--emfe-w-registration-typography, var(--emfe-w-color-typography, #FFFFFF));text-align:center;margin:25px 0 10px}.Register p a{text-decoration:none;font-weight:600}.Register p a:hover{text-decoration:underline}.InvalidField{position:absolute;top:45px;color:var(--emfw-w-color-error, var(--emfe-w-color-red, #FD2839));font-size:0.7em}.SubmitCredentials{margin-bottom:20px}.CredentialsError{color:var(--emfw-w-color-error, var(--emfe-w-color-red, #FD2839));font-size:0.7em;padding:0 0 20px 0;margin:0}.CredentialsError input{color:var(--emfw-w-color-error, var(--emfe-w-color-red, #FD2839))}@media screen and (max-width: 480px){.FormBox{width:100%;border-radius:0px}}';export{a as user_login}