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