@everymatrix/user-login 1.26.1 → 1.27.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.
- package/dist/cjs/user-login.cjs.entry.js +13 -12
- package/dist/collection/components/user-login/user-login.js +13 -12
- package/dist/components/user-login.js +13 -12
- package/dist/esm/user-login.entry.js +13 -12
- package/dist/types/components/user-login/user-login.d.ts +1 -0
- package/dist/user-login/p-23e99565.entry.js +1 -0
- package/dist/user-login/user-login.esm.js +1 -1
- package/package.json +1 -1
- package/dist/user-login/p-180de099.entry.js +0 -1
|
@@ -178,26 +178,20 @@ const UserLogin = class {
|
|
|
178
178
|
// handles errors thrown by api
|
|
179
179
|
this.hasError = true;
|
|
180
180
|
this.errorMessage = (_b = data === null || data === void 0 ? void 0 : data.thirdPartyResponse) === null || _b === void 0 ? void 0 : _b.message;
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
message: this.errorMessage
|
|
186
|
-
} }, window.location.href);
|
|
181
|
+
if (this.errorMessage) {
|
|
182
|
+
console.error(this.errorMessage);
|
|
183
|
+
this.sendErrorNotification(this.errorMessage);
|
|
184
|
+
}
|
|
187
185
|
}
|
|
188
186
|
}).catch((err) => {
|
|
189
187
|
// handles unexpected errors
|
|
190
188
|
console.error(err);
|
|
191
189
|
this.hasError = true;
|
|
192
190
|
this.errorMessage = translate('genericError', this.lang);
|
|
193
|
-
|
|
194
|
-
window.postMessage({ type: 'WidgetNotification', data: {
|
|
195
|
-
type: 'error',
|
|
196
|
-
message: this.errorMessage
|
|
197
|
-
} }, window.location.href);
|
|
191
|
+
this.sendErrorNotification(this.errorMessage);
|
|
198
192
|
});
|
|
199
193
|
};
|
|
200
|
-
this.debouncedUserLogin = this.debounce(this.userLogin,
|
|
194
|
+
this.debouncedUserLogin = this.debounce(this.userLogin, 850);
|
|
201
195
|
this.handleLogin = () => {
|
|
202
196
|
this.debouncedUserLogin({
|
|
203
197
|
username: this.userNameEmail,
|
|
@@ -254,6 +248,13 @@ const UserLogin = class {
|
|
|
254
248
|
await getTranslations(this.translationUrl);
|
|
255
249
|
}
|
|
256
250
|
}
|
|
251
|
+
sendErrorNotification(errorMessage) {
|
|
252
|
+
window.postMessage({ type: "HasError", error: errorMessage }, window.location.href);
|
|
253
|
+
window.postMessage({ type: 'WidgetNotification', data: {
|
|
254
|
+
type: 'error',
|
|
255
|
+
message: errorMessage
|
|
256
|
+
} }, window.location.href);
|
|
257
|
+
}
|
|
257
258
|
debounce(func, delay) {
|
|
258
259
|
let timer;
|
|
259
260
|
return function (...args) {
|
|
@@ -85,26 +85,20 @@ export class UserLogin {
|
|
|
85
85
|
// handles errors thrown by api
|
|
86
86
|
this.hasError = true;
|
|
87
87
|
this.errorMessage = (_b = data === null || data === void 0 ? void 0 : data.thirdPartyResponse) === null || _b === void 0 ? void 0 : _b.message;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
message: this.errorMessage
|
|
93
|
-
} }, window.location.href);
|
|
88
|
+
if (this.errorMessage) {
|
|
89
|
+
console.error(this.errorMessage);
|
|
90
|
+
this.sendErrorNotification(this.errorMessage);
|
|
91
|
+
}
|
|
94
92
|
}
|
|
95
93
|
}).catch((err) => {
|
|
96
94
|
// handles unexpected errors
|
|
97
95
|
console.error(err);
|
|
98
96
|
this.hasError = true;
|
|
99
97
|
this.errorMessage = translate('genericError', this.lang);
|
|
100
|
-
|
|
101
|
-
window.postMessage({ type: 'WidgetNotification', data: {
|
|
102
|
-
type: 'error',
|
|
103
|
-
message: this.errorMessage
|
|
104
|
-
} }, window.location.href);
|
|
98
|
+
this.sendErrorNotification(this.errorMessage);
|
|
105
99
|
});
|
|
106
100
|
};
|
|
107
|
-
this.debouncedUserLogin = this.debounce(this.userLogin,
|
|
101
|
+
this.debouncedUserLogin = this.debounce(this.userLogin, 850);
|
|
108
102
|
this.handleLogin = () => {
|
|
109
103
|
this.debouncedUserLogin({
|
|
110
104
|
username: this.userNameEmail,
|
|
@@ -161,6 +155,13 @@ export class UserLogin {
|
|
|
161
155
|
await getTranslations(this.translationUrl);
|
|
162
156
|
}
|
|
163
157
|
}
|
|
158
|
+
sendErrorNotification(errorMessage) {
|
|
159
|
+
window.postMessage({ type: "HasError", error: errorMessage }, window.location.href);
|
|
160
|
+
window.postMessage({ type: 'WidgetNotification', data: {
|
|
161
|
+
type: 'error',
|
|
162
|
+
message: errorMessage
|
|
163
|
+
} }, window.location.href);
|
|
164
|
+
}
|
|
164
165
|
debounce(func, delay) {
|
|
165
166
|
let timer;
|
|
166
167
|
return function (...args) {
|
|
@@ -176,26 +176,20 @@ const UserLogin$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
176
176
|
// handles errors thrown by api
|
|
177
177
|
this.hasError = true;
|
|
178
178
|
this.errorMessage = (_b = data === null || data === void 0 ? void 0 : data.thirdPartyResponse) === null || _b === void 0 ? void 0 : _b.message;
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
message: this.errorMessage
|
|
184
|
-
} }, window.location.href);
|
|
179
|
+
if (this.errorMessage) {
|
|
180
|
+
console.error(this.errorMessage);
|
|
181
|
+
this.sendErrorNotification(this.errorMessage);
|
|
182
|
+
}
|
|
185
183
|
}
|
|
186
184
|
}).catch((err) => {
|
|
187
185
|
// handles unexpected errors
|
|
188
186
|
console.error(err);
|
|
189
187
|
this.hasError = true;
|
|
190
188
|
this.errorMessage = translate('genericError', this.lang);
|
|
191
|
-
|
|
192
|
-
window.postMessage({ type: 'WidgetNotification', data: {
|
|
193
|
-
type: 'error',
|
|
194
|
-
message: this.errorMessage
|
|
195
|
-
} }, window.location.href);
|
|
189
|
+
this.sendErrorNotification(this.errorMessage);
|
|
196
190
|
});
|
|
197
191
|
};
|
|
198
|
-
this.debouncedUserLogin = this.debounce(this.userLogin,
|
|
192
|
+
this.debouncedUserLogin = this.debounce(this.userLogin, 850);
|
|
199
193
|
this.handleLogin = () => {
|
|
200
194
|
this.debouncedUserLogin({
|
|
201
195
|
username: this.userNameEmail,
|
|
@@ -252,6 +246,13 @@ const UserLogin$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
252
246
|
await getTranslations(this.translationUrl);
|
|
253
247
|
}
|
|
254
248
|
}
|
|
249
|
+
sendErrorNotification(errorMessage) {
|
|
250
|
+
window.postMessage({ type: "HasError", error: errorMessage }, window.location.href);
|
|
251
|
+
window.postMessage({ type: 'WidgetNotification', data: {
|
|
252
|
+
type: 'error',
|
|
253
|
+
message: errorMessage
|
|
254
|
+
} }, window.location.href);
|
|
255
|
+
}
|
|
255
256
|
debounce(func, delay) {
|
|
256
257
|
let timer;
|
|
257
258
|
return function (...args) {
|
|
@@ -174,26 +174,20 @@ const UserLogin = class {
|
|
|
174
174
|
// handles errors thrown by api
|
|
175
175
|
this.hasError = true;
|
|
176
176
|
this.errorMessage = (_b = data === null || data === void 0 ? void 0 : data.thirdPartyResponse) === null || _b === void 0 ? void 0 : _b.message;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
message: this.errorMessage
|
|
182
|
-
} }, window.location.href);
|
|
177
|
+
if (this.errorMessage) {
|
|
178
|
+
console.error(this.errorMessage);
|
|
179
|
+
this.sendErrorNotification(this.errorMessage);
|
|
180
|
+
}
|
|
183
181
|
}
|
|
184
182
|
}).catch((err) => {
|
|
185
183
|
// handles unexpected errors
|
|
186
184
|
console.error(err);
|
|
187
185
|
this.hasError = true;
|
|
188
186
|
this.errorMessage = translate('genericError', this.lang);
|
|
189
|
-
|
|
190
|
-
window.postMessage({ type: 'WidgetNotification', data: {
|
|
191
|
-
type: 'error',
|
|
192
|
-
message: this.errorMessage
|
|
193
|
-
} }, window.location.href);
|
|
187
|
+
this.sendErrorNotification(this.errorMessage);
|
|
194
188
|
});
|
|
195
189
|
};
|
|
196
|
-
this.debouncedUserLogin = this.debounce(this.userLogin,
|
|
190
|
+
this.debouncedUserLogin = this.debounce(this.userLogin, 850);
|
|
197
191
|
this.handleLogin = () => {
|
|
198
192
|
this.debouncedUserLogin({
|
|
199
193
|
username: this.userNameEmail,
|
|
@@ -250,6 +244,13 @@ const UserLogin = class {
|
|
|
250
244
|
await getTranslations(this.translationUrl);
|
|
251
245
|
}
|
|
252
246
|
}
|
|
247
|
+
sendErrorNotification(errorMessage) {
|
|
248
|
+
window.postMessage({ type: "HasError", error: errorMessage }, window.location.href);
|
|
249
|
+
window.postMessage({ type: 'WidgetNotification', data: {
|
|
250
|
+
type: 'error',
|
|
251
|
+
message: errorMessage
|
|
252
|
+
} }, window.location.href);
|
|
253
|
+
}
|
|
253
254
|
debounce(func, delay) {
|
|
254
255
|
let timer;
|
|
255
256
|
return function (...args) {
|
|
@@ -62,6 +62,7 @@ export declare class UserLogin {
|
|
|
62
62
|
username: any;
|
|
63
63
|
password: any;
|
|
64
64
|
}) => Promise<any>;
|
|
65
|
+
sendErrorNotification(errorMessage: any): void;
|
|
65
66
|
debounce(func: any, delay: any): (...args: any[]) => void;
|
|
66
67
|
debouncedUserLogin: (...args: any[]) => void;
|
|
67
68
|
handleLogin: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,c as i,h as t}from"./p-8235eaf1.js";const o=["ro","en","cz","de","hr"],e={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"},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"},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:"Login successful"},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"},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"},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"}},r=s=>new Promise((i=>{fetch(s).then((s=>s.json())).then((s=>{Object.keys(s).forEach((i=>{for(let t in s[i])e[i][t]=s[i][t]})),i(!0)}))})),n=(s,i,t)=>{const r=i;let n=e[void 0!==r&&o.includes(r)?r:"en"][s];if(void 0!==t)for(const[s,i]of Object.entries(t.values)){const t=new RegExp(`{${s}}`,"g");n=n.replace(t,i)}return n},a=class{constructor(t){s(this,t),this.hasToSetConsents=i(this,"hasToSetConsents",7),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.userLogin=async({username:s,password:i})=>{let t={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:s,password:i})};fetch(`${this.endpoint}/v1/player/legislation/login`,t).then((s=>s.json())).then((s=>{var i,t;(null===(i=s.sessionBlockers)||void 0===i?void 0:i.includes("has-to-set-consents"))&&this.hasToSetConsents.emit(),!0===(null==s?void 0:s.hasToSetPass)&&window.postMessage({type:"HasToSetPass"},window.location.href),s.sessionId?(window.postMessage({type:"UserSessionID",session:s.sessionId,userid:s.userId},window.location.href),window.postMessage({type:"WidgetNotification",data:{type:"success",message:n("successMessage",this.lang)}},window.location.href),window.postMessage({type:"ModalStatus",open:!0},window.location.href),this.hasError=!1):(this.hasError=!0,this.errorMessage=null===(t=null==s?void 0:s.thirdPartyResponse)||void 0===t?void 0:t.message,this.errorMessage&&(console.error(this.errorMessage),this.sendErrorNotification(this.errorMessage)))})).catch((s=>{console.error(s),this.hasError=!0,this.errorMessage=n("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.setClientStyling=()=>{let s=document.createElement("style");s.innerHTML=this.clientStyling,this.stylingContainer.appendChild(s)},this.setClientStylingURL=()=>{let s=new URL(this.clientStylingUrl),i=document.createElement("style");fetch(s.href).then((s=>s.text())).then((s=>{i.innerHTML=s,setTimeout((()=>{this.stylingContainer.appendChild(i)}),1)}))},this.handleInputChange=(s,i)=>{this.hasError=!1;const t=s.target.value;"user"===i?(this.userNameEmail=t,this.isValidUserEmail=this.userEmailValidation(this.userNameEmail)):(this.userPassword=t,this.isValidPassword=this.passwordValidation(t))},this.userEmailValidation=s=>new RegExp(this.userEmailRegex,this.userEmailRegexOptions).test(s),this.passwordValidation=s=>new RegExp(this.passwordRegex,this.passwordRegexOptions).test(s),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)}sendErrorNotification(s){window.postMessage({type:"HasError",error:s},window.location.href),window.postMessage({type:"WidgetNotification",data:{type:"error",message:s}},window.location.href)}debounce(s,i){let t;return function(...o){clearTimeout(t),t=setTimeout((()=>{s.apply(this,o)}),i)}}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}render(){let s=t("span",{class:"InputIcon"},this.isPasswordVisible&&t("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"},t("g",{transform:"translate(-110.856 -23.242)"},t("circle",{class:"PasswordVisibilityIcon",cx:"0.05",cy:"0.05",r:"0.05",transform:"translate(121.017 31.148)"}),t("g",{transform:"translate(117.499 27.37)"},t("path",{class:"PasswordVisibilityIcon",d:"M147.413,43.174a2.774,2.774,0,0,0-3.229-3.943Z",transform:"translate(-142.164 -39.123)"}),t("path",{class:"PasswordVisibilityIcon",d:"M137.031,43.1a2.778,2.778,0,0,0,3.447,4.209Z",transform:"translate(-136.413 -42.068)"})),t("g",{transform:"translate(110.856 24.899)"},t("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)"}),t("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)"})),t("rect",{class:"PasswordVisibilityIcon",width:"0.972",height:"15.861",rx:"0.486",transform:"translate(114.827 23.858) rotate(-39.315)"}))),!this.isPasswordVisible&&t("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"},t("g",{transform:"translate(-14.185 -27.832)"},t("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)"}),t("circle",{class:"PasswordVisibilityIcon",cx:"2.779",cy:"2.779",r:"2.779",transform:"translate(20.827 30.303)"})))),i=t("div",{class:"FormBox"},t("div",{class:"FormValue"},t("div",{class:!this.isValidUserEmail||this.hasError?"InputBox InputInvalidBox":"InputBox"},t("input",{type:"text",placeholder:"",value:this.userNameEmail,onFocus:s=>this.handleInputChange(s,"user"),onInput:s=>this.handleInputChange(s,"user"),required:!0}),t("label",{class:(this.userNameEmail?"FieldFilledIn":"")+" "+(!this.isValidUserEmail||this.hasError?"FieldInvalid":"")},n("userEmail",this.lang)),!this.isValidUserEmail&&t("p",{class:"InvalidField"},n("invalidField",this.lang))),t("div",{class:!this.isValidPassword||this.hasError?"InputBox InputInvalidBox":"InputBox"},s,t("input",{type:this.isPasswordVisible?"text":"password",placeholder:"",value:this.userPassword,onFocus:s=>this.handleInputChange(s,"password"),onInput:s=>this.handleInputChange(s,"password"),required:!0}),t("label",{class:(this.userPassword?"FieldFilledIn":"")+" "+(!this.isValidPassword||this.hasError?"FieldInvalid":"")},n("password",this.lang)),!this.isValidPassword&&t("p",{class:"InvalidField"},n("invalidField",this.lang))),"true"==this.passwordReset&&t("div",{class:"ForgotPassword"},t("button",{onClick:()=>this.resetPassword()},n("forgotPassword",this.lang))),t("button",{disabled:!(this.isValidUserEmail&&this.isValidPassword&&this.userNameEmail&&this.userPassword),class:"SubmitCredentials",onClick:()=>this.handleLogin()},n("login",this.lang)),this.hasError&&t("p",{class:"CredentialsError"},this.errorMessage?this.errorMessage:n("genericError",this.lang))));return t("section",{ref:s=>this.stylingContainer=s},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}.FormBox{height:100%;display:flex;position:relative;background:none;border:none;backdrop-filter:blur(15px) brightness(80%);justify-content:center;align-items:center}.InputBox{position:relative;margin:30px 0;width:310px;border-bottom:2px solid #0797B9}.InputBox.InputInvalidBox::after{content:"";height:2px;width:100%;transition:width 0.6s linear;background:#C23135}.InputBox::after{content:"";display:block;width:0;height:2px;position:relative;top:2px}.InputBox .PasswordVisibilityIcon{fill:#0797B9}.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:#0797B9;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:#fff;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:#0797B9;display:flex;justify-content:space-between;background-color:transparent;padding:0;height:unset;border:0;cursor:pointer}.ForgotPassword button:hover{color:#fff}.SubmitCredentials{display:block;margin:0 auto;padding:10px 20px;border-radius:5px;color:#fff;background:linear-gradient(to right, #EA0C66, #77318F);border:none;outline:none;cursor:pointer;font-size:1em}.SubmitCredentials:disabled{background:#707070}.Register{font-size:0.9em;color:#fff;text-align:center;margin:25px 0 10px}.Register p a{text-decoration:none;color:#fff;font-weight:600}.Register p a:hover{text-decoration:underline}.InvalidField{position:absolute;top:45px;color:#C23135;font-size:0.7em}.SubmitCredentials{margin-bottom:20px}.CredentialsError{color:#C23135;font-size:0.7em;padding:0 0 20px 0;margin:0}@media screen and (max-width: 480px){.FormBox{width:100%;border-radius:0px}}';export{a as user_login}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as s,b as e}from"./p-8235eaf1.js";(()=>{const e=import.meta.url,r={};return""!==e&&(r.resourcesUrl=new URL(".",e).href),s(r)})().then((s=>e([["p-
|
|
1
|
+
import{p as s,b as e}from"./p-8235eaf1.js";(()=>{const e=import.meta.url,r={};return""!==e&&(r.resourcesUrl=new URL(".",e).href),s(r)})().then((s=>e([["p-23e99565",[[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 +0,0 @@
|
|
|
1
|
-
import{r as s,c as i,h as t}from"./p-8235eaf1.js";const o=["ro","en","cz","de","hr"],e={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"},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"},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:"Login successful"},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"},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"},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"}},r=s=>new Promise((i=>{fetch(s).then((s=>s.json())).then((s=>{Object.keys(s).forEach((i=>{for(let t in s[i])e[i][t]=s[i][t]})),i(!0)}))})),n=(s,i,t)=>{const r=i;let n=e[void 0!==r&&o.includes(r)?r:"en"][s];if(void 0!==t)for(const[s,i]of Object.entries(t.values)){const t=new RegExp(`{${s}}`,"g");n=n.replace(t,i)}return n},a=class{constructor(t){s(this,t),this.hasToSetConsents=i(this,"hasToSetConsents",7),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.userLogin=async({username:s,password:i})=>{let t={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:s,password:i})};fetch(`${this.endpoint}/v1/player/legislation/login`,t).then((s=>s.json())).then((s=>{var i,t;(null===(i=s.sessionBlockers)||void 0===i?void 0:i.includes("has-to-set-consents"))&&this.hasToSetConsents.emit(),!0===(null==s?void 0:s.hasToSetPass)&&window.postMessage({type:"HasToSetPass"},window.location.href),s.sessionId?(window.postMessage({type:"UserSessionID",session:s.sessionId,userid:s.userId},window.location.href),window.postMessage({type:"WidgetNotification",data:{type:"success",message:n("successMessage",this.lang)}},window.location.href),window.postMessage({type:"ModalStatus",open:!0},window.location.href),this.hasError=!1):(this.hasError=!0,this.errorMessage=null===(t=null==s?void 0:s.thirdPartyResponse)||void 0===t?void 0:t.message,console.error(this.errorMessage),window.postMessage({type:"HasError",error:this.errorMessage},window.location.href),window.postMessage({type:"WidgetNotification",data:{type:"error",message:this.errorMessage}},window.location.href))})).catch((s=>{console.error(s),this.hasError=!0,this.errorMessage=n("genericError",this.lang),window.postMessage({type:"HasError",error:this.errorMessage},window.location.href),window.postMessage({type:"WidgetNotification",data:{type:"error",message:this.errorMessage}},window.location.href)}))},this.debouncedUserLogin=this.debounce(this.userLogin,500),this.handleLogin=()=>{this.debouncedUserLogin({username:this.userNameEmail,password:this.userPassword})},this.setClientStyling=()=>{let s=document.createElement("style");s.innerHTML=this.clientStyling,this.stylingContainer.appendChild(s)},this.setClientStylingURL=()=>{let s=new URL(this.clientStylingUrl),i=document.createElement("style");fetch(s.href).then((s=>s.text())).then((s=>{i.innerHTML=s,setTimeout((()=>{this.stylingContainer.appendChild(i)}),1)}))},this.handleInputChange=(s,i)=>{this.hasError=!1;const t=s.target.value;"user"===i?(this.userNameEmail=t,this.isValidUserEmail=this.userEmailValidation(this.userNameEmail)):(this.userPassword=t,this.isValidPassword=this.passwordValidation(t))},this.userEmailValidation=s=>new RegExp(this.userEmailRegex,this.userEmailRegexOptions).test(s),this.passwordValidation=s=>new RegExp(this.passwordRegex,this.passwordRegexOptions).test(s),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)}debounce(s,i){let t;return function(...o){clearTimeout(t),t=setTimeout((()=>{s.apply(this,o)}),i)}}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}render(){let s=t("span",{class:"InputIcon"},this.isPasswordVisible&&t("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"},t("g",{transform:"translate(-110.856 -23.242)"},t("circle",{class:"PasswordVisibilityIcon",cx:"0.05",cy:"0.05",r:"0.05",transform:"translate(121.017 31.148)"}),t("g",{transform:"translate(117.499 27.37)"},t("path",{class:"PasswordVisibilityIcon",d:"M147.413,43.174a2.774,2.774,0,0,0-3.229-3.943Z",transform:"translate(-142.164 -39.123)"}),t("path",{class:"PasswordVisibilityIcon",d:"M137.031,43.1a2.778,2.778,0,0,0,3.447,4.209Z",transform:"translate(-136.413 -42.068)"})),t("g",{transform:"translate(110.856 24.899)"},t("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)"}),t("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)"})),t("rect",{class:"PasswordVisibilityIcon",width:"0.972",height:"15.861",rx:"0.486",transform:"translate(114.827 23.858) rotate(-39.315)"}))),!this.isPasswordVisible&&t("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"},t("g",{transform:"translate(-14.185 -27.832)"},t("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)"}),t("circle",{class:"PasswordVisibilityIcon",cx:"2.779",cy:"2.779",r:"2.779",transform:"translate(20.827 30.303)"})))),i=t("div",{class:"FormBox"},t("div",{class:"FormValue"},t("div",{class:!this.isValidUserEmail||this.hasError?"InputBox InputInvalidBox":"InputBox"},t("input",{type:"text",placeholder:"",value:this.userNameEmail,onFocus:s=>this.handleInputChange(s,"user"),onInput:s=>this.handleInputChange(s,"user"),required:!0}),t("label",{class:(this.userNameEmail?"FieldFilledIn":"")+" "+(!this.isValidUserEmail||this.hasError?"FieldInvalid":"")},n("userEmail",this.lang)),!this.isValidUserEmail&&t("p",{class:"InvalidField"},n("invalidField",this.lang))),t("div",{class:!this.isValidPassword||this.hasError?"InputBox InputInvalidBox":"InputBox"},s,t("input",{type:this.isPasswordVisible?"text":"password",placeholder:"",value:this.userPassword,onFocus:s=>this.handleInputChange(s,"password"),onInput:s=>this.handleInputChange(s,"password"),required:!0}),t("label",{class:(this.userPassword?"FieldFilledIn":"")+" "+(!this.isValidPassword||this.hasError?"FieldInvalid":"")},n("password",this.lang)),!this.isValidPassword&&t("p",{class:"InvalidField"},n("invalidField",this.lang))),"true"==this.passwordReset&&t("div",{class:"ForgotPassword"},t("button",{onClick:()=>this.resetPassword()},n("forgotPassword",this.lang))),t("button",{disabled:!(this.isValidUserEmail&&this.isValidPassword&&this.userNameEmail&&this.userPassword),class:"SubmitCredentials",onClick:()=>this.handleLogin()},n("login",this.lang)),this.hasError&&t("p",{class:"CredentialsError"},this.errorMessage?this.errorMessage:n("genericError",this.lang))));return t("section",{ref:s=>this.stylingContainer=s},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}.FormBox{height:100%;display:flex;position:relative;background:none;border:none;backdrop-filter:blur(15px) brightness(80%);justify-content:center;align-items:center}.InputBox{position:relative;margin:30px 0;width:310px;border-bottom:2px solid #0797B9}.InputBox.InputInvalidBox::after{content:"";height:2px;width:100%;transition:width 0.6s linear;background:#C23135}.InputBox::after{content:"";display:block;width:0;height:2px;position:relative;top:2px}.InputBox .PasswordVisibilityIcon{fill:#0797B9}.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:#0797B9;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:#fff;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:#0797B9;display:flex;justify-content:space-between;background-color:transparent;padding:0;height:unset;border:0;cursor:pointer}.ForgotPassword button:hover{color:#fff}.SubmitCredentials{display:block;margin:0 auto;padding:10px 20px;border-radius:5px;color:#fff;background:linear-gradient(to right, #EA0C66, #77318F);border:none;outline:none;cursor:pointer;font-size:1em}.SubmitCredentials:disabled{background:#707070}.Register{font-size:0.9em;color:#fff;text-align:center;margin:25px 0 10px}.Register p a{text-decoration:none;color:#fff;font-weight:600}.Register p a:hover{text-decoration:underline}.InvalidField{position:absolute;top:45px;color:#C23135;font-size:0.7em}.SubmitCredentials{margin-bottom:20px}.CredentialsError{color:#C23135;font-size:0.7em;padding:0 0 20px 0;margin:0}@media screen and (max-width: 480px){.FormBox{width:100%;border-radius:0px}}';export{a as user_login}
|