@everymatrix/user-login 1.44.0 → 1.45.2
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/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/index-465784fc.js +1240 -0
- package/dist/cjs/loader.cjs.js +7 -13
- package/dist/cjs/user-login.cjs.entry.js +301 -328
- package/dist/cjs/user-login.cjs.js +17 -11
- package/dist/collection/collection-manifest.json +3 -3
- package/dist/collection/components/user-login/index.js +1 -0
- package/dist/collection/components/user-login/user-login.js +397 -443
- package/dist/collection/utils/locale.utils.js +110 -110
- package/dist/collection/utils/utils.js +1 -1
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/index-4e85bfaa.js +1214 -0
- package/dist/esm/loader.js +7 -13
- package/dist/esm/user-login.entry.js +301 -328
- package/dist/esm/user-login.js +14 -11
- package/dist/stencil.config.dev.js +17 -0
- package/dist/stencil.config.js +14 -19
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/user-login/.stencil/packages/stencil/user-login/stencil.config.d.ts +2 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/user-login/.stencil/packages/stencil/user-login/stencil.config.dev.d.ts +2 -0
- package/dist/types/components/user-login/index.d.ts +1 -0
- package/dist/types/components/user-login/user-login.d.ts +80 -80
- package/dist/types/stencil-public-runtime.d.ts +142 -33
- package/dist/user-login/p-11519ff0.entry.js +1 -0
- package/dist/user-login/p-a86a26ad.js +2 -0
- package/dist/user-login/p-e1255160.js +1 -0
- package/dist/user-login/user-login.esm.js +1 -1
- package/loader/cdn.js +1 -3
- package/loader/index.cjs.js +1 -3
- package/loader/index.d.ts +13 -1
- package/loader/index.es2017.js +1 -3
- package/loader/index.js +1 -3
- package/loader/package.json +1 -0
- package/package.json +8 -1
- package/dist/cjs/index-5d65f61a.js +0 -1233
- package/dist/components/index.d.ts +0 -26
- package/dist/components/index.js +0 -1
- package/dist/components/user-login.d.ts +0 -11
- package/dist/components/user-login.js +0 -389
- package/dist/esm/index-20da8fd1.js +0 -1208
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/user-login/.stencil/packages/user-login/stencil.config.d.ts +0 -2
- package/dist/user-login/p-55726395.js +0 -1
- package/dist/user-login/p-f0b89924.entry.js +0 -1
|
@@ -2,355 +2,328 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-465784fc.js');
|
|
6
6
|
|
|
7
7
|
const DEFAULT_LANGUAGE = 'en';
|
|
8
8
|
const TRANSLATIONS = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
9
|
+
en: {
|
|
10
|
+
invalidField: 'This field is invalid',
|
|
11
|
+
forgotPassword: 'Forgot Password',
|
|
12
|
+
userEmail: 'Username or Email',
|
|
13
|
+
password: 'Password',
|
|
14
|
+
login: 'Login',
|
|
15
|
+
genericError: 'An unexpected error has occured',
|
|
16
|
+
successMessage: 'Login successful',
|
|
17
|
+
Forbidden_UserAccount_Blocked: 'Player account blocked',
|
|
18
|
+
Unauthorized: 'The player account number, e-mail address or password is incorrect'
|
|
19
|
+
},
|
|
20
|
+
ro: {
|
|
21
|
+
invalidField: 'This field is invalid',
|
|
22
|
+
forgotPassword: 'Forgot Password',
|
|
23
|
+
userEmail: 'Username or Email',
|
|
24
|
+
password: 'Password',
|
|
25
|
+
login: 'Login',
|
|
26
|
+
genericError: 'An unexpected error has occured',
|
|
27
|
+
successMessage: 'Login successful',
|
|
28
|
+
Forbidden_UserAccount_Blocked: 'Player account blocked',
|
|
29
|
+
Unauthorized: 'Numărul contului de jucător, adresa de e-mail sau parola este incorectă'
|
|
30
|
+
},
|
|
31
|
+
hr: {
|
|
32
|
+
invalidField: 'Ovo polje je nevažeće',
|
|
33
|
+
forgotPassword: 'Zaboravljena lozinka',
|
|
34
|
+
userEmail: 'Korisničko ime ili email',
|
|
35
|
+
password: 'Lozinka',
|
|
36
|
+
login: 'Prijava',
|
|
37
|
+
genericError: 'Došlo je do neočekivane pogreške',
|
|
38
|
+
successMessage: 'Prijava uspješna',
|
|
39
|
+
Forbidden_UserAccount_Blocked: 'Vaš račun je blokiran',
|
|
40
|
+
Unauthorized: 'Lozinka, e-mail adresa ili korisničko ime su pogrešno uneseni'
|
|
41
|
+
},
|
|
42
|
+
fr: {
|
|
43
|
+
invalidField: 'This field is invalid',
|
|
44
|
+
forgotPassword: 'Forgot Password',
|
|
45
|
+
userEmail: 'Username or Email',
|
|
46
|
+
password: 'Password',
|
|
47
|
+
login: 'Login',
|
|
48
|
+
genericError: 'An unexpected error has occured',
|
|
49
|
+
successMessage: 'Login successful',
|
|
50
|
+
Forbidden_UserAccount_Blocked: 'Player account blocked',
|
|
51
|
+
Unauthorized: 'Le numéro de compte du joueur, l\'adresse e-mail ou le mot de passe est incorrect'
|
|
52
|
+
},
|
|
53
|
+
cs: {
|
|
54
|
+
invalidField: 'Ovo polje je nevažeće.',
|
|
55
|
+
forgotPassword: 'Zaboravio sam lozinku ',
|
|
56
|
+
userEmail: 'Korisničko ime ili email',
|
|
57
|
+
password: 'Lozinka',
|
|
58
|
+
login: 'Prijava',
|
|
59
|
+
genericError: 'An unexpected error has occured',
|
|
60
|
+
successMessage: 'Login successful',
|
|
61
|
+
Forbidden_UserAccount_Blocked: 'Player account blocked',
|
|
62
|
+
Unauthorized: 'Číslo účtu hráče, e-mailová adresa nebo heslo je nesprávné'
|
|
63
|
+
},
|
|
64
|
+
de: {
|
|
65
|
+
invalidField: 'This field is invalid',
|
|
66
|
+
forgotPassword: 'Forgot Password',
|
|
67
|
+
userEmail: 'Username or Email',
|
|
68
|
+
password: 'Password',
|
|
69
|
+
login: 'Login',
|
|
70
|
+
genericError: 'An unexpected error has occured',
|
|
71
|
+
successMessage: 'Login successful',
|
|
72
|
+
Forbidden_UserAccount_Blocked: 'Player account blocked',
|
|
73
|
+
Unauthorized: 'Die Spielerkontonummer, E-Mail-Adresse oder das Passwort ist falsch'
|
|
74
|
+
},
|
|
75
|
+
'pt-br': {
|
|
76
|
+
'invalidField': 'O campo é inválido',
|
|
77
|
+
'forgotPassword': 'Esqueceu sua senha',
|
|
78
|
+
'userEmail': 'Usuário ou e-mail',
|
|
79
|
+
'Password': 'Senha',
|
|
80
|
+
'login': 'Entrem',
|
|
81
|
+
'genericError': 'Ocorreu um erro inesperado',
|
|
82
|
+
'successMessage': 'Você fez login com sucesso',
|
|
83
|
+
'Forbidden_UserAccount_Blocked': 'Player account blocked',
|
|
84
|
+
'Unauthorized': 'O número da conta do jogador, o endereço de e-mail ou a senha estão incorretos'
|
|
85
|
+
},
|
|
86
|
+
'es-mx': {
|
|
87
|
+
'invalidField': 'El campo es inválido',
|
|
88
|
+
'forgotPassword': 'Olvidó contraseña',
|
|
89
|
+
'userEmail': 'Usuario o Correo Electrónico',
|
|
90
|
+
'Password': 'Contraseña',
|
|
91
|
+
'login': 'Entrar',
|
|
92
|
+
'genericError': 'Ha ocurrido un error inesperado',
|
|
93
|
+
'successMessage': 'Ha ingreasado de forma exitosa',
|
|
94
|
+
'Forbidden_UserAccount_Blocked': 'Player account blocked',
|
|
95
|
+
'Unauthorized': 'El número de cuenta del jugador, la dirección de correo electrónico o la contraseña son incorrectos'
|
|
96
|
+
}
|
|
97
97
|
};
|
|
98
98
|
const getTranslations = (url) => {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
99
|
+
return new Promise((resolve) => {
|
|
100
|
+
fetch(url)
|
|
101
|
+
.then((res) => res.json())
|
|
102
|
+
.then((data) => {
|
|
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];
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
resolve(true);
|
|
112
|
+
});
|
|
112
113
|
});
|
|
113
|
-
});
|
|
114
114
|
};
|
|
115
115
|
const translate = (key, customLang, values) => {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
const lang = customLang;
|
|
117
|
+
let translation = TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
|
|
118
|
+
if (values !== undefined) {
|
|
119
|
+
for (const [key, value] of Object.entries(values.values)) {
|
|
120
|
+
const regex = new RegExp(`{${key}}`, 'g');
|
|
121
|
+
translation = translation.replace(regex, value);
|
|
122
|
+
}
|
|
122
123
|
}
|
|
123
|
-
|
|
124
|
-
return translation;
|
|
124
|
+
return translation;
|
|
125
125
|
};
|
|
126
126
|
|
|
127
127
|
const userLoginCss = ":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}}";
|
|
128
|
+
const UserLoginStyle0 = userLoginCss;
|
|
128
129
|
|
|
129
130
|
const UserLogin = class {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
131
|
+
constructor(hostRef) {
|
|
132
|
+
index.registerInstance(this, hostRef);
|
|
133
|
+
this.errorCode = '';
|
|
134
|
+
this.setClientStyling = () => {
|
|
135
|
+
let sheet = document.createElement('style');
|
|
136
|
+
sheet.innerHTML = this.clientStyling;
|
|
137
|
+
this.stylingContainer.appendChild(sheet);
|
|
138
|
+
};
|
|
139
|
+
this.setClientStylingURL = () => {
|
|
140
|
+
let url = new URL(this.clientStylingUrl);
|
|
141
|
+
let cssFile = document.createElement('style');
|
|
142
|
+
fetch(url.href)
|
|
143
|
+
.then((res) => res.text())
|
|
144
|
+
.then((data) => {
|
|
145
|
+
cssFile.innerHTML = data;
|
|
146
|
+
setTimeout(() => { this.stylingContainer.appendChild(cssFile); }, 1);
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
this.autofillCredentialsHandler = (e) => {
|
|
150
|
+
this.userNameEmail = e.detail.userNameEmail;
|
|
151
|
+
this.userPassword = e.detail.userPassword;
|
|
152
|
+
this.handleLogin();
|
|
153
|
+
};
|
|
154
|
+
this.userLogin = async ({ username, password }) => {
|
|
155
|
+
let headers = {
|
|
156
|
+
'Content-Type': 'application/json'
|
|
157
|
+
};
|
|
158
|
+
let bodyData = {
|
|
159
|
+
username,
|
|
160
|
+
password
|
|
161
|
+
};
|
|
162
|
+
let options = {
|
|
163
|
+
method: 'POST',
|
|
164
|
+
headers,
|
|
165
|
+
body: JSON.stringify(bodyData),
|
|
166
|
+
};
|
|
167
|
+
fetch(`${this.endpoint}/v1/player/legislation/login`, options)
|
|
168
|
+
.then((res) => {
|
|
169
|
+
return res.json();
|
|
170
|
+
}).then((data) => {
|
|
171
|
+
var _a, _b, _c;
|
|
172
|
+
if ((_a = data.sessionBlockers) === null || _a === void 0 ? void 0 : _a.includes('has-to-set-consents')) {
|
|
173
|
+
window.postMessage({ type: 'PlayerActions', gmversion: 'gm16' }, window.location.href);
|
|
174
|
+
}
|
|
175
|
+
if ((data === null || data === void 0 ? void 0 : data.hasToSetPass) === true) {
|
|
176
|
+
window.postMessage({ type: 'HasToSetPass' }, window.location.href);
|
|
177
|
+
}
|
|
178
|
+
if (data.sessionId) {
|
|
179
|
+
window.postMessage({ type: 'UserSessionID', session: data.sessionId, userid: data.userId }, window.location.href);
|
|
180
|
+
window.postMessage({ type: 'WidgetNotification', data: {
|
|
181
|
+
type: 'success',
|
|
182
|
+
message: translate('successMessage', this.lang)
|
|
183
|
+
} }, window.location.href);
|
|
184
|
+
this.hasError = false;
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
// handles errors thrown by api
|
|
188
|
+
this.hasError = true;
|
|
189
|
+
this.errorCode = (_b = data === null || data === void 0 ? void 0 : data.thirdPartyResponse) === null || _b === void 0 ? void 0 : _b.errorCode;
|
|
190
|
+
this.errorMessage = translate(`${this.errorCode}`, this.lang) || ((_c = data === null || data === void 0 ? void 0 : data.thirdPartyResponse) === null || _c === void 0 ? void 0 : _c.message) || translate('genericError', this.lang);
|
|
191
|
+
if (this.errorMessage) {
|
|
192
|
+
console.error(this.errorMessage);
|
|
193
|
+
this.sendErrorNotification(this.errorMessage);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}).catch((err) => {
|
|
197
|
+
// handles unexpected errors
|
|
198
|
+
console.error(err);
|
|
199
|
+
this.hasError = true;
|
|
200
|
+
this.errorMessage = translate('genericError', this.lang);
|
|
201
|
+
this.sendErrorNotification(this.errorMessage);
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
this.debouncedUserLogin = this.debounce(this.userLogin, 850);
|
|
205
|
+
this.handleLogin = () => {
|
|
206
|
+
this.debouncedUserLogin({
|
|
207
|
+
username: this.userNameEmail,
|
|
208
|
+
password: this.userPassword
|
|
209
|
+
});
|
|
210
|
+
this.dispatchUpdateLoginCredentialsEvent();
|
|
211
|
+
};
|
|
212
|
+
this.handleInputChange = (event, location) => {
|
|
213
|
+
this.hasError = false;
|
|
214
|
+
const inputValue = event.target.value;
|
|
215
|
+
if (location === 'user') {
|
|
216
|
+
this.userNameEmail = inputValue;
|
|
217
|
+
this.isValidUserEmail = this.userEmailValidation(this.userNameEmail);
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
this.userPassword = inputValue;
|
|
221
|
+
this.isValidPassword = this.passwordValidation(inputValue);
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
this.userEmailValidation = (input) => {
|
|
225
|
+
const regex = new RegExp(this.userEmailRegex, this.userEmailRegexOptions);
|
|
226
|
+
return regex.test(input);
|
|
227
|
+
};
|
|
228
|
+
this.passwordValidation = (input) => {
|
|
229
|
+
const regex = new RegExp(this.passwordRegex, this.passwordRegexOptions);
|
|
230
|
+
return regex.test(input);
|
|
231
|
+
};
|
|
232
|
+
this.togglePassword = () => {
|
|
233
|
+
this.isPasswordVisible = !this.isPasswordVisible;
|
|
234
|
+
};
|
|
235
|
+
this.resetPassword = () => {
|
|
236
|
+
window.postMessage({ type: "NavForgotPassword" }, window.location.href);
|
|
237
|
+
};
|
|
238
|
+
this.endpoint = '';
|
|
239
|
+
this.lang = 'en';
|
|
240
|
+
this.clientStyling = '';
|
|
241
|
+
this.clientStylingUrl = '';
|
|
242
|
+
this.translationUrl = '';
|
|
243
|
+
this.passwordReset = 'false';
|
|
244
|
+
this.userEmailRegex = undefined;
|
|
245
|
+
this.userEmailRegexOptions = 'i';
|
|
246
|
+
this.passwordRegex = undefined;
|
|
247
|
+
this.passwordRegexOptions = '';
|
|
248
|
+
this.userNameEmail = '';
|
|
249
|
+
this.userPassword = '';
|
|
250
|
+
this.isValidUserEmail = true;
|
|
251
|
+
this.isValidPassword = true;
|
|
252
|
+
this.isPasswordVisible = false;
|
|
253
|
+
this.limitStylingAppends = false;
|
|
254
|
+
this.errorMessage = '';
|
|
255
|
+
this.hasError = false;
|
|
256
|
+
}
|
|
257
|
+
handleNewTranslations() {
|
|
258
|
+
getTranslations(this.translationUrl);
|
|
259
|
+
}
|
|
260
|
+
async componentWillLoad() {
|
|
261
|
+
if (this.translationUrl.length > 2) {
|
|
262
|
+
await getTranslations(this.translationUrl);
|
|
219
263
|
}
|
|
220
|
-
|
|
221
|
-
|
|
264
|
+
}
|
|
265
|
+
componentDidLoad() {
|
|
266
|
+
window.addEventListener('LoginCredentials', this.autofillCredentialsHandler);
|
|
267
|
+
window.postMessage({ type: 'UserLoginDidLoad' });
|
|
268
|
+
}
|
|
269
|
+
componentDidRender() {
|
|
270
|
+
// start custom styling area
|
|
271
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
272
|
+
if (this.clientStyling)
|
|
273
|
+
this.setClientStyling();
|
|
274
|
+
if (this.clientStylingUrl)
|
|
275
|
+
this.setClientStylingURL();
|
|
276
|
+
this.limitStylingAppends = true;
|
|
222
277
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
278
|
+
// end custom styling area
|
|
279
|
+
}
|
|
280
|
+
disconnectedCallback() {
|
|
281
|
+
window.removeEventListener('LoginCredentials', this.autofillCredentialsHandler);
|
|
282
|
+
}
|
|
283
|
+
sendErrorNotification(errorMessage) {
|
|
284
|
+
window.postMessage({ type: "HasError", error: errorMessage }, window.location.href);
|
|
285
|
+
window.postMessage({ type: 'WidgetNotification', data: {
|
|
286
|
+
type: 'error',
|
|
287
|
+
message: errorMessage
|
|
228
288
|
} }, window.location.href);
|
|
229
|
-
this.hasError = false;
|
|
230
|
-
}
|
|
231
|
-
else {
|
|
232
|
-
// handles errors thrown by api
|
|
233
|
-
this.hasError = true;
|
|
234
|
-
this.errorCode = (_b = data === null || data === void 0 ? void 0 : data.thirdPartyResponse) === null || _b === void 0 ? void 0 : _b.errorCode;
|
|
235
|
-
this.errorMessage = translate(`${this.errorCode}`, this.lang) || ((_c = data === null || data === void 0 ? void 0 : data.thirdPartyResponse) === null || _c === void 0 ? void 0 : _c.message) || translate('genericError', this.lang);
|
|
236
|
-
if (this.errorMessage) {
|
|
237
|
-
console.error(this.errorMessage);
|
|
238
|
-
this.sendErrorNotification(this.errorMessage);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}).catch((err) => {
|
|
242
|
-
// handles unexpected errors
|
|
243
|
-
console.error(err);
|
|
244
|
-
this.hasError = true;
|
|
245
|
-
this.errorMessage = translate('genericError', this.lang);
|
|
246
|
-
this.sendErrorNotification(this.errorMessage);
|
|
247
|
-
});
|
|
248
|
-
};
|
|
249
|
-
this.debouncedUserLogin = this.debounce(this.userLogin, 850);
|
|
250
|
-
this.handleLogin = () => {
|
|
251
|
-
this.debouncedUserLogin({
|
|
252
|
-
username: this.userNameEmail,
|
|
253
|
-
password: this.userPassword
|
|
254
|
-
});
|
|
255
|
-
this.dispatchUpdateLoginCredentialsEvent();
|
|
256
|
-
};
|
|
257
|
-
this.handleInputChange = (event, location) => {
|
|
258
|
-
this.hasError = false;
|
|
259
|
-
const inputValue = event.target.value;
|
|
260
|
-
if (location === 'user') {
|
|
261
|
-
this.userNameEmail = inputValue;
|
|
262
|
-
this.isValidUserEmail = this.userEmailValidation(this.userNameEmail);
|
|
263
|
-
}
|
|
264
|
-
else {
|
|
265
|
-
this.userPassword = inputValue;
|
|
266
|
-
this.isValidPassword = this.passwordValidation(inputValue);
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
this.userEmailValidation = (input) => {
|
|
270
|
-
const regex = new RegExp(this.userEmailRegex, this.userEmailRegexOptions);
|
|
271
|
-
return regex.test(input);
|
|
272
|
-
};
|
|
273
|
-
this.passwordValidation = (input) => {
|
|
274
|
-
const regex = new RegExp(this.passwordRegex, this.passwordRegexOptions);
|
|
275
|
-
return regex.test(input);
|
|
276
|
-
};
|
|
277
|
-
this.togglePassword = () => {
|
|
278
|
-
this.isPasswordVisible = !this.isPasswordVisible;
|
|
279
|
-
};
|
|
280
|
-
this.resetPassword = () => {
|
|
281
|
-
window.postMessage({ type: "NavForgotPassword" }, window.location.href);
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
handleNewTranslations() {
|
|
285
|
-
getTranslations(this.translationUrl);
|
|
286
|
-
}
|
|
287
|
-
async componentWillLoad() {
|
|
288
|
-
if (this.translationUrl.length > 2) {
|
|
289
|
-
await getTranslations(this.translationUrl);
|
|
290
289
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
if (this.clientStyling)
|
|
300
|
-
this.setClientStyling();
|
|
301
|
-
if (this.clientStylingUrl)
|
|
302
|
-
this.setClientStylingURL();
|
|
303
|
-
this.limitStylingAppends = true;
|
|
290
|
+
debounce(func, delay) {
|
|
291
|
+
let timer;
|
|
292
|
+
return function (...args) {
|
|
293
|
+
clearTimeout(timer);
|
|
294
|
+
timer = setTimeout(() => {
|
|
295
|
+
func.apply(this, args);
|
|
296
|
+
}, delay);
|
|
297
|
+
};
|
|
304
298
|
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
} }, window.location.href);
|
|
316
|
-
}
|
|
317
|
-
debounce(func, delay) {
|
|
318
|
-
let timer;
|
|
319
|
-
return function (...args) {
|
|
320
|
-
clearTimeout(timer);
|
|
321
|
-
timer = setTimeout(() => {
|
|
322
|
-
func.apply(this, args);
|
|
323
|
-
}, delay);
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
dispatchUpdateLoginCredentialsEvent() {
|
|
327
|
-
if (!this.hasError) {
|
|
328
|
-
this.updateLoginCredentialsEvent = new CustomEvent("UpdateLoginCredentials", {
|
|
329
|
-
bubbles: true,
|
|
330
|
-
detail: {
|
|
331
|
-
userNameEmail: this.userNameEmail,
|
|
332
|
-
userPassword: this.userPassword
|
|
299
|
+
dispatchUpdateLoginCredentialsEvent() {
|
|
300
|
+
if (!this.hasError) {
|
|
301
|
+
this.updateLoginCredentialsEvent = new CustomEvent("UpdateLoginCredentials", {
|
|
302
|
+
bubbles: true,
|
|
303
|
+
detail: {
|
|
304
|
+
userNameEmail: this.userNameEmail,
|
|
305
|
+
userPassword: this.userPassword
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
window.dispatchEvent(this.updateLoginCredentialsEvent);
|
|
333
309
|
}
|
|
334
|
-
});
|
|
335
|
-
window.dispatchEvent(this.updateLoginCredentialsEvent);
|
|
336
310
|
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
}; }
|
|
311
|
+
;
|
|
312
|
+
render() {
|
|
313
|
+
let visibilityIcon = index.h("span", { key: '4ccb9d4b1c8209e22320c3667101b9e435d1b604', class: "InputIcon" }, this.isPasswordVisible &&
|
|
314
|
+
index.h("svg", { key: 'fd168b4ec7ed18213aef15d5c7bcb89183b5626d', 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" }, index.h("g", { key: '3ab8953db8743082bb19d4f97ae6191724145a0e', transform: "translate(-110.856 -23.242)" }, index.h("circle", { key: '716eb0de02150f4d5791cb7cf1cf7e904de4e8b9', class: "PasswordVisibilityIcon", cx: "0.05", cy: "0.05", r: "0.05", transform: "translate(121.017 31.148)" }), index.h("g", { key: '4ca623e6f31b09dbf6495fe657e9f6b67bfddbd8', transform: "translate(117.499 27.37)" }, index.h("path", { key: '0377c51b5536b07d0cefb77ed82d714fc82b5d9e', class: "PasswordVisibilityIcon", d: "M147.413,43.174a2.774,2.774,0,0,0-3.229-3.943Z", transform: "translate(-142.164 -39.123)" }), index.h("path", { key: '3ee2f6849511a3ce18ccfcaea0b503f1b9e57329', class: "PasswordVisibilityIcon", d: "M137.031,43.1a2.778,2.778,0,0,0,3.447,4.209Z", transform: "translate(-136.413 -42.068)" })), index.h("g", { key: '24fab8dc6f6ef08ef1a36227156b768925a2a7ba', transform: "translate(110.856 24.899)" }, index.h("path", { key: 'b41b45065b8f55772bbdfbced34ef4d7736c133a', 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)" }), index.h("path", { key: '39f77d5f4028baf654fdc07a2f03525b994d508f', 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)" })), index.h("rect", { key: '74bdc0477190de8bd67e30e0799ed1d4c255fff0', class: "PasswordVisibilityIcon", width: "0.972", height: "15.861", rx: "0.486", transform: "translate(114.827 23.858) rotate(-39.315)" }))), !this.isPasswordVisible &&
|
|
315
|
+
index.h("svg", { key: '89e71e7d5fc2af237c7a0af69838a60f997dc0ee', 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" }, index.h("g", { key: '97447b59b0e079f3b2a154681aef2cef572e445b', transform: "translate(-14.185 -27.832)" }, index.h("path", { key: 'c35b80be71460f5fc0c469ee807e3f83f5ab1cb9', 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)" }), index.h("circle", { key: '3a6bfc9d02b7c66ecd0e07481e1963a6bcab3fb0', class: "PasswordVisibilityIcon", cx: "2.779", cy: "2.779", r: "2.779", transform: "translate(20.827 30.303)" }))));
|
|
316
|
+
let userIdentification = index.h("div", { key: '5b43adf706d46ce330b81e0bc5e8bbd1bfc2b883', class: "FormBox" }, index.h("div", { key: '0c53a0428fbcb10876e16d0505cf895c5bffa3bd', class: "FormValue" }, index.h("div", { key: '8aeda926da67db1e58595287f15d815e7887dc45', class: (!this.isValidUserEmail || this.hasError) ? 'InputBox InputInvalidBox' : 'InputBox' }, index.h("input", { key: 'bf82f8b419fe217143d3928262b9b256e43a9f79', type: "text", placeholder: '', value: this.userNameEmail, onFocus: (event) => this.handleInputChange(event, 'user'), onInput: (event) => this.handleInputChange(event, 'user'), autocapitalize: "none", required: true }), index.h("label", { key: '7a0f71f2c013c8d00d0d7c66452e09badfd17bb3', class: (this.userNameEmail ? 'FieldFilledIn' : '') + ' ' + (!this.isValidUserEmail || this.hasError ? 'FieldInvalid' : '') }, translate('userEmail', this.lang)), !this.isValidUserEmail &&
|
|
317
|
+
index.h("p", { key: 'ed3453e628b9d60f8df2c3c1e04024706c532bfd', class: "InvalidField" }, translate('invalidField', this.lang))), index.h("div", { key: 'c778082662a1f29bdb6b19799c702ce3b4773a0a', class: (!this.isValidPassword || this.hasError) ? 'InputBox InputInvalidBox' : 'InputBox' }, visibilityIcon, index.h("input", { key: '7cbdd79f39f986efc4cfadf0577782c86af8eec9', type: this.isPasswordVisible ? "text" : "password", placeholder: '', value: this.userPassword, onFocus: (event) => this.handleInputChange(event, 'password'), onInput: (event) => this.handleInputChange(event, 'password'), autocapitalize: "none", required: true }), index.h("label", { key: '94d576059031cb459757f417245a241a768137fe', class: (this.userPassword ? 'FieldFilledIn' : '') + ' ' + (!this.isValidPassword || this.hasError ? 'FieldInvalid' : '') }, translate('password', this.lang)), !this.isValidPassword &&
|
|
318
|
+
index.h("p", { key: '9c961763ac1a5c3af53d63b4b4423f22d341f2a4', class: "InvalidField" }, translate('invalidField', this.lang))), this.passwordReset == 'true' &&
|
|
319
|
+
index.h("div", { key: '9f0730d9d3000def2d5b0edb2fcef7c2b77633cf', class: "ForgotPassword" }, index.h("button", { key: '3bd5379cf60cba95c1338968c451366264bec081', onClick: () => this.resetPassword() }, translate('forgotPassword', this.lang))), index.h("button", { key: '7a5ac0291a075d7c4f1a1f235dc6be2ccfa2239e', disabled: (!this.isValidUserEmail || !this.isValidPassword || !this.userNameEmail || !this.userPassword), class: "SubmitCredentials", onClick: () => this.handleLogin() }, translate('login', this.lang)), this.hasError &&
|
|
320
|
+
index.h("p", { key: 'f40b7b875d615bb6af19dac753910763638409a8', class: "CredentialsError" }, this.errorMessage)));
|
|
321
|
+
return index.h("section", { key: '6c0b3e43c5fdd9993a02f11b9bfa817b2a5069f2', ref: el => this.stylingContainer = el }, userIdentification);
|
|
322
|
+
}
|
|
323
|
+
static get watchers() { return {
|
|
324
|
+
"translationUrl": ["handleNewTranslations"]
|
|
325
|
+
}; }
|
|
353
326
|
};
|
|
354
|
-
UserLogin.style =
|
|
327
|
+
UserLogin.style = UserLoginStyle0;
|
|
355
328
|
|
|
356
329
|
exports.user_login = UserLogin;
|