@everymatrix/user-login 1.37.11 → 1.39.0

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.
@@ -14,7 +14,8 @@ const TRANSLATIONS = {
14
14
  password: 'Password',
15
15
  login: 'Login',
16
16
  genericError: 'An unexpected error has occured',
17
- successMessage: 'Login successful'
17
+ successMessage: 'Login successful',
18
+ Forbidden_UserAccount_Blocked: 'Player account blocked'
18
19
  },
19
20
  ro: {
20
21
  invalidField: 'This field is invalid',
@@ -23,7 +24,8 @@ const TRANSLATIONS = {
23
24
  password: 'Password',
24
25
  login: 'Login',
25
26
  genericError: 'An unexpected error has occured',
26
- successMessage: 'Login successful'
27
+ successMessage: 'Login successful',
28
+ Forbidden_UserAccount_Blocked: 'Player account blocked'
27
29
  },
28
30
  hr: {
29
31
  invalidField: 'Ovo polje je nevažeće',
@@ -32,7 +34,8 @@ const TRANSLATIONS = {
32
34
  password: 'Lozinka',
33
35
  login: 'Prijava',
34
36
  genericError: 'Došlo je do neočekivane pogreške',
35
- successMessage: 'Prijava uspješna'
37
+ successMessage: 'Prijava uspješna',
38
+ Forbidden_UserAccount_Blocked: 'Vaš račun je blokiran'
36
39
  },
37
40
  fr: {
38
41
  invalidField: 'This field is invalid',
@@ -41,7 +44,8 @@ const TRANSLATIONS = {
41
44
  password: 'Password',
42
45
  login: 'Login',
43
46
  genericError: 'An unexpected error has occured',
44
- successMessage: 'Login successful'
47
+ successMessage: 'Login successful',
48
+ Forbidden_UserAccount_Blocked: 'Player account blocked'
45
49
  },
46
50
  cs: {
47
51
  invalidField: 'Ovo polje je nevažeće.',
@@ -50,7 +54,8 @@ const TRANSLATIONS = {
50
54
  password: 'Lozinka',
51
55
  login: 'Prijava',
52
56
  genericError: 'An unexpected error has occured',
53
- successMessage: 'Login successful'
57
+ successMessage: 'Login successful',
58
+ Forbidden_UserAccount_Blocked: 'Player account blocked'
54
59
  },
55
60
  de: {
56
61
  invalidField: 'This field is invalid',
@@ -59,7 +64,8 @@ const TRANSLATIONS = {
59
64
  password: 'Password',
60
65
  login: 'Login',
61
66
  genericError: 'An unexpected error has occured',
62
- successMessage: 'Login successful'
67
+ successMessage: 'Login successful',
68
+ Forbidden_UserAccount_Blocked: 'Player account blocked'
63
69
  },
64
70
  'pt-br': {
65
71
  'invalidField': 'O campo é inválido',
@@ -68,7 +74,8 @@ const TRANSLATIONS = {
68
74
  'Password': 'Senha',
69
75
  'login': 'Entrem',
70
76
  'genericError': 'Ocorreu um erro inesperado',
71
- 'successMessage': 'Você fez login com sucesso'
77
+ 'successMessage': 'Você fez login com sucesso',
78
+ 'Forbidden_UserAccount_Blocked': 'Player account blocked'
72
79
  },
73
80
  'es-mx': {
74
81
  'invalidField': 'El campo es inválido',
@@ -77,7 +84,8 @@ const TRANSLATIONS = {
77
84
  'Password': 'Contraseña',
78
85
  'login': 'Entrar',
79
86
  'genericError': 'Ha ocurrido un error inesperado',
80
- 'successMessage': 'Ha ingreasado de forma exitosa'
87
+ 'successMessage': 'Ha ingreasado de forma exitosa',
88
+ 'Forbidden_UserAccount_Blocked': 'Player account blocked'
81
89
  }
82
90
  };
83
91
  const getTranslations = (url) => {
@@ -158,6 +166,7 @@ const UserLogin = class {
158
166
  this.limitStylingAppends = false;
159
167
  this.errorMessage = '';
160
168
  this.hasError = false;
169
+ this.errorCode = '';
161
170
  this.setClientStyling = () => {
162
171
  let sheet = document.createElement('style');
163
172
  sheet.innerHTML = this.clientStyling;
@@ -195,7 +204,7 @@ const UserLogin = class {
195
204
  .then((res) => {
196
205
  return res.json();
197
206
  }).then((data) => {
198
- var _a, _b;
207
+ var _a, _b, _c;
199
208
  if ((_a = data.sessionBlockers) === null || _a === void 0 ? void 0 : _a.includes('has-to-set-consents')) {
200
209
  window.postMessage({ type: 'PlayerActions', gmversion: 'gm16' }, window.location.href);
201
210
  }
@@ -213,7 +222,8 @@ const UserLogin = class {
213
222
  else {
214
223
  // handles errors thrown by api
215
224
  this.hasError = true;
216
- this.errorMessage = (_b = data === null || data === void 0 ? void 0 : data.thirdPartyResponse) === null || _b === void 0 ? void 0 : _b.message;
225
+ this.errorCode = (_b = data === null || data === void 0 ? void 0 : data.thirdPartyResponse) === null || _b === void 0 ? void 0 : _b.errorCode;
226
+ 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);
217
227
  if (this.errorMessage) {
218
228
  console.error(this.errorMessage);
219
229
  this.sendErrorNotification(this.errorMessage);
@@ -325,7 +335,7 @@ const UserLogin = class {
325
335
  index.h("p", { class: "InvalidField" }, translate('invalidField', this.lang))), index.h("div", { class: (!this.isValidPassword || this.hasError) ? 'InputBox InputInvalidBox' : 'InputBox' }, visibilityIcon, index.h("input", { type: this.isPasswordVisible ? "text" : "password", placeholder: '', value: this.userPassword, onFocus: (event) => this.handleInputChange(event, 'password'), onInput: (event) => this.handleInputChange(event, 'password'), required: true }), index.h("label", { class: (this.userPassword ? 'FieldFilledIn' : '') + ' ' + (!this.isValidPassword || this.hasError ? 'FieldInvalid' : '') }, translate('password', this.lang)), !this.isValidPassword &&
326
336
  index.h("p", { class: "InvalidField" }, translate('invalidField', this.lang))), this.passwordReset == 'true' &&
327
337
  index.h("div", { class: "ForgotPassword" }, index.h("button", { onClick: () => this.resetPassword() }, translate('forgotPassword', this.lang))), index.h("button", { disabled: (!this.isValidUserEmail || !this.isValidPassword || !this.userNameEmail || !this.userPassword), class: "SubmitCredentials", onClick: () => this.handleLogin() }, translate('login', this.lang)), this.hasError &&
328
- index.h("p", { class: "CredentialsError" }, this.errorMessage ? this.errorMessage : translate('genericError', this.lang))));
338
+ index.h("p", { class: "CredentialsError" }, this.errorMessage)));
329
339
  return index.h("section", { ref: el => this.stylingContainer = el }, userIdentification);
330
340
  }
331
341
  static get watchers() { return {
@@ -48,6 +48,7 @@ export class UserLogin {
48
48
  this.limitStylingAppends = false;
49
49
  this.errorMessage = '';
50
50
  this.hasError = false;
51
+ this.errorCode = '';
51
52
  this.setClientStyling = () => {
52
53
  let sheet = document.createElement('style');
53
54
  sheet.innerHTML = this.clientStyling;
@@ -85,7 +86,7 @@ export class UserLogin {
85
86
  .then((res) => {
86
87
  return res.json();
87
88
  }).then((data) => {
88
- var _a, _b;
89
+ var _a, _b, _c;
89
90
  if ((_a = data.sessionBlockers) === null || _a === void 0 ? void 0 : _a.includes('has-to-set-consents')) {
90
91
  window.postMessage({ type: 'PlayerActions', gmversion: 'gm16' }, window.location.href);
91
92
  }
@@ -103,7 +104,8 @@ export class UserLogin {
103
104
  else {
104
105
  // handles errors thrown by api
105
106
  this.hasError = true;
106
- this.errorMessage = (_b = data === null || data === void 0 ? void 0 : data.thirdPartyResponse) === null || _b === void 0 ? void 0 : _b.message;
107
+ this.errorCode = (_b = data === null || data === void 0 ? void 0 : data.thirdPartyResponse) === null || _b === void 0 ? void 0 : _b.errorCode;
108
+ 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);
107
109
  if (this.errorMessage) {
108
110
  console.error(this.errorMessage);
109
111
  this.sendErrorNotification(this.errorMessage);
@@ -243,7 +245,7 @@ export class UserLogin {
243
245
  h("button", { onClick: () => this.resetPassword() }, translate('forgotPassword', this.lang))),
244
246
  h("button", { disabled: (!this.isValidUserEmail || !this.isValidPassword || !this.userNameEmail || !this.userPassword), class: "SubmitCredentials", onClick: () => this.handleLogin() }, translate('login', this.lang)),
245
247
  this.hasError &&
246
- h("p", { class: "CredentialsError" }, this.errorMessage ? this.errorMessage : translate('genericError', this.lang))));
248
+ h("p", { class: "CredentialsError" }, this.errorMessage)));
247
249
  return h("section", { ref: el => this.stylingContainer = el }, userIdentification);
248
250
  }
249
251
  static get is() { return "user-login"; }
@@ -8,7 +8,8 @@ const TRANSLATIONS = {
8
8
  password: 'Password',
9
9
  login: 'Login',
10
10
  genericError: 'An unexpected error has occured',
11
- successMessage: 'Login successful'
11
+ successMessage: 'Login successful',
12
+ Forbidden_UserAccount_Blocked: 'Player account blocked'
12
13
  },
13
14
  ro: {
14
15
  invalidField: 'This field is invalid',
@@ -17,7 +18,8 @@ const TRANSLATIONS = {
17
18
  password: 'Password',
18
19
  login: 'Login',
19
20
  genericError: 'An unexpected error has occured',
20
- successMessage: 'Login successful'
21
+ successMessage: 'Login successful',
22
+ Forbidden_UserAccount_Blocked: 'Player account blocked'
21
23
  },
22
24
  hr: {
23
25
  invalidField: 'Ovo polje je nevažeće',
@@ -26,7 +28,8 @@ const TRANSLATIONS = {
26
28
  password: 'Lozinka',
27
29
  login: 'Prijava',
28
30
  genericError: 'Došlo je do neočekivane pogreške',
29
- successMessage: 'Prijava uspješna'
31
+ successMessage: 'Prijava uspješna',
32
+ Forbidden_UserAccount_Blocked: 'Vaš račun je blokiran'
30
33
  },
31
34
  fr: {
32
35
  invalidField: 'This field is invalid',
@@ -35,7 +38,8 @@ const TRANSLATIONS = {
35
38
  password: 'Password',
36
39
  login: 'Login',
37
40
  genericError: 'An unexpected error has occured',
38
- successMessage: 'Login successful'
41
+ successMessage: 'Login successful',
42
+ Forbidden_UserAccount_Blocked: 'Player account blocked'
39
43
  },
40
44
  cs: {
41
45
  invalidField: 'Ovo polje je nevažeće.',
@@ -44,7 +48,8 @@ const TRANSLATIONS = {
44
48
  password: 'Lozinka',
45
49
  login: 'Prijava',
46
50
  genericError: 'An unexpected error has occured',
47
- successMessage: 'Login successful'
51
+ successMessage: 'Login successful',
52
+ Forbidden_UserAccount_Blocked: 'Player account blocked'
48
53
  },
49
54
  de: {
50
55
  invalidField: 'This field is invalid',
@@ -53,7 +58,8 @@ const TRANSLATIONS = {
53
58
  password: 'Password',
54
59
  login: 'Login',
55
60
  genericError: 'An unexpected error has occured',
56
- successMessage: 'Login successful'
61
+ successMessage: 'Login successful',
62
+ Forbidden_UserAccount_Blocked: 'Player account blocked'
57
63
  },
58
64
  'pt-br': {
59
65
  'invalidField': 'O campo é inválido',
@@ -62,7 +68,8 @@ const TRANSLATIONS = {
62
68
  'Password': 'Senha',
63
69
  'login': 'Entrem',
64
70
  'genericError': 'Ocorreu um erro inesperado',
65
- 'successMessage': 'Você fez login com sucesso'
71
+ 'successMessage': 'Você fez login com sucesso',
72
+ 'Forbidden_UserAccount_Blocked': 'Player account blocked'
66
73
  },
67
74
  'es-mx': {
68
75
  'invalidField': 'El campo es inválido',
@@ -71,7 +78,8 @@ const TRANSLATIONS = {
71
78
  'Password': 'Contraseña',
72
79
  'login': 'Entrar',
73
80
  'genericError': 'Ha ocurrido un error inesperado',
74
- 'successMessage': 'Ha ingreasado de forma exitosa'
81
+ 'successMessage': 'Ha ingreasado de forma exitosa',
82
+ 'Forbidden_UserAccount_Blocked': 'Player account blocked'
75
83
  }
76
84
  };
77
85
  export const getTranslations = (url) => {
@@ -10,7 +10,8 @@ const TRANSLATIONS = {
10
10
  password: 'Password',
11
11
  login: 'Login',
12
12
  genericError: 'An unexpected error has occured',
13
- successMessage: 'Login successful'
13
+ successMessage: 'Login successful',
14
+ Forbidden_UserAccount_Blocked: 'Player account blocked'
14
15
  },
15
16
  ro: {
16
17
  invalidField: 'This field is invalid',
@@ -19,7 +20,8 @@ const TRANSLATIONS = {
19
20
  password: 'Password',
20
21
  login: 'Login',
21
22
  genericError: 'An unexpected error has occured',
22
- successMessage: 'Login successful'
23
+ successMessage: 'Login successful',
24
+ Forbidden_UserAccount_Blocked: 'Player account blocked'
23
25
  },
24
26
  hr: {
25
27
  invalidField: 'Ovo polje je nevažeće',
@@ -28,7 +30,8 @@ const TRANSLATIONS = {
28
30
  password: 'Lozinka',
29
31
  login: 'Prijava',
30
32
  genericError: 'Došlo je do neočekivane pogreške',
31
- successMessage: 'Prijava uspješna'
33
+ successMessage: 'Prijava uspješna',
34
+ Forbidden_UserAccount_Blocked: 'Vaš račun je blokiran'
32
35
  },
33
36
  fr: {
34
37
  invalidField: 'This field is invalid',
@@ -37,7 +40,8 @@ const TRANSLATIONS = {
37
40
  password: 'Password',
38
41
  login: 'Login',
39
42
  genericError: 'An unexpected error has occured',
40
- successMessage: 'Login successful'
43
+ successMessage: 'Login successful',
44
+ Forbidden_UserAccount_Blocked: 'Player account blocked'
41
45
  },
42
46
  cs: {
43
47
  invalidField: 'Ovo polje je nevažeće.',
@@ -46,7 +50,8 @@ const TRANSLATIONS = {
46
50
  password: 'Lozinka',
47
51
  login: 'Prijava',
48
52
  genericError: 'An unexpected error has occured',
49
- successMessage: 'Login successful'
53
+ successMessage: 'Login successful',
54
+ Forbidden_UserAccount_Blocked: 'Player account blocked'
50
55
  },
51
56
  de: {
52
57
  invalidField: 'This field is invalid',
@@ -55,7 +60,8 @@ const TRANSLATIONS = {
55
60
  password: 'Password',
56
61
  login: 'Login',
57
62
  genericError: 'An unexpected error has occured',
58
- successMessage: 'Login successful'
63
+ successMessage: 'Login successful',
64
+ Forbidden_UserAccount_Blocked: 'Player account blocked'
59
65
  },
60
66
  'pt-br': {
61
67
  'invalidField': 'O campo é inválido',
@@ -64,7 +70,8 @@ const TRANSLATIONS = {
64
70
  'Password': 'Senha',
65
71
  'login': 'Entrem',
66
72
  'genericError': 'Ocorreu um erro inesperado',
67
- 'successMessage': 'Você fez login com sucesso'
73
+ 'successMessage': 'Você fez login com sucesso',
74
+ 'Forbidden_UserAccount_Blocked': 'Player account blocked'
68
75
  },
69
76
  'es-mx': {
70
77
  'invalidField': 'El campo es inválido',
@@ -73,7 +80,8 @@ const TRANSLATIONS = {
73
80
  'Password': 'Contraseña',
74
81
  'login': 'Entrar',
75
82
  'genericError': 'Ha ocurrido un error inesperado',
76
- 'successMessage': 'Ha ingreasado de forma exitosa'
83
+ 'successMessage': 'Ha ingreasado de forma exitosa',
84
+ 'Forbidden_UserAccount_Blocked': 'Player account blocked'
77
85
  }
78
86
  };
79
87
  const getTranslations = (url) => {
@@ -156,6 +164,7 @@ const UserLogin$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
156
164
  this.limitStylingAppends = false;
157
165
  this.errorMessage = '';
158
166
  this.hasError = false;
167
+ this.errorCode = '';
159
168
  this.setClientStyling = () => {
160
169
  let sheet = document.createElement('style');
161
170
  sheet.innerHTML = this.clientStyling;
@@ -193,7 +202,7 @@ const UserLogin$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
193
202
  .then((res) => {
194
203
  return res.json();
195
204
  }).then((data) => {
196
- var _a, _b;
205
+ var _a, _b, _c;
197
206
  if ((_a = data.sessionBlockers) === null || _a === void 0 ? void 0 : _a.includes('has-to-set-consents')) {
198
207
  window.postMessage({ type: 'PlayerActions', gmversion: 'gm16' }, window.location.href);
199
208
  }
@@ -211,7 +220,8 @@ const UserLogin$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
211
220
  else {
212
221
  // handles errors thrown by api
213
222
  this.hasError = true;
214
- this.errorMessage = (_b = data === null || data === void 0 ? void 0 : data.thirdPartyResponse) === null || _b === void 0 ? void 0 : _b.message;
223
+ this.errorCode = (_b = data === null || data === void 0 ? void 0 : data.thirdPartyResponse) === null || _b === void 0 ? void 0 : _b.errorCode;
224
+ 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);
215
225
  if (this.errorMessage) {
216
226
  console.error(this.errorMessage);
217
227
  this.sendErrorNotification(this.errorMessage);
@@ -323,7 +333,7 @@ const UserLogin$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
323
333
  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'), required: true }), h("label", { class: (this.userPassword ? 'FieldFilledIn' : '') + ' ' + (!this.isValidPassword || this.hasError ? 'FieldInvalid' : '') }, translate('password', this.lang)), !this.isValidPassword &&
324
334
  h("p", { class: "InvalidField" }, translate('invalidField', this.lang))), this.passwordReset == 'true' &&
325
335
  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 &&
326
- h("p", { class: "CredentialsError" }, this.errorMessage ? this.errorMessage : translate('genericError', this.lang))));
336
+ h("p", { class: "CredentialsError" }, this.errorMessage)));
327
337
  return h("section", { ref: el => this.stylingContainer = el }, userIdentification);
328
338
  }
329
339
  static get watchers() { return {
@@ -10,7 +10,8 @@ const TRANSLATIONS = {
10
10
  password: 'Password',
11
11
  login: 'Login',
12
12
  genericError: 'An unexpected error has occured',
13
- successMessage: 'Login successful'
13
+ successMessage: 'Login successful',
14
+ Forbidden_UserAccount_Blocked: 'Player account blocked'
14
15
  },
15
16
  ro: {
16
17
  invalidField: 'This field is invalid',
@@ -19,7 +20,8 @@ const TRANSLATIONS = {
19
20
  password: 'Password',
20
21
  login: 'Login',
21
22
  genericError: 'An unexpected error has occured',
22
- successMessage: 'Login successful'
23
+ successMessage: 'Login successful',
24
+ Forbidden_UserAccount_Blocked: 'Player account blocked'
23
25
  },
24
26
  hr: {
25
27
  invalidField: 'Ovo polje je nevažeće',
@@ -28,7 +30,8 @@ const TRANSLATIONS = {
28
30
  password: 'Lozinka',
29
31
  login: 'Prijava',
30
32
  genericError: 'Došlo je do neočekivane pogreške',
31
- successMessage: 'Prijava uspješna'
33
+ successMessage: 'Prijava uspješna',
34
+ Forbidden_UserAccount_Blocked: 'Vaš račun je blokiran'
32
35
  },
33
36
  fr: {
34
37
  invalidField: 'This field is invalid',
@@ -37,7 +40,8 @@ const TRANSLATIONS = {
37
40
  password: 'Password',
38
41
  login: 'Login',
39
42
  genericError: 'An unexpected error has occured',
40
- successMessage: 'Login successful'
43
+ successMessage: 'Login successful',
44
+ Forbidden_UserAccount_Blocked: 'Player account blocked'
41
45
  },
42
46
  cs: {
43
47
  invalidField: 'Ovo polje je nevažeće.',
@@ -46,7 +50,8 @@ const TRANSLATIONS = {
46
50
  password: 'Lozinka',
47
51
  login: 'Prijava',
48
52
  genericError: 'An unexpected error has occured',
49
- successMessage: 'Login successful'
53
+ successMessage: 'Login successful',
54
+ Forbidden_UserAccount_Blocked: 'Player account blocked'
50
55
  },
51
56
  de: {
52
57
  invalidField: 'This field is invalid',
@@ -55,7 +60,8 @@ const TRANSLATIONS = {
55
60
  password: 'Password',
56
61
  login: 'Login',
57
62
  genericError: 'An unexpected error has occured',
58
- successMessage: 'Login successful'
63
+ successMessage: 'Login successful',
64
+ Forbidden_UserAccount_Blocked: 'Player account blocked'
59
65
  },
60
66
  'pt-br': {
61
67
  'invalidField': 'O campo é inválido',
@@ -64,7 +70,8 @@ const TRANSLATIONS = {
64
70
  'Password': 'Senha',
65
71
  'login': 'Entrem',
66
72
  'genericError': 'Ocorreu um erro inesperado',
67
- 'successMessage': 'Você fez login com sucesso'
73
+ 'successMessage': 'Você fez login com sucesso',
74
+ 'Forbidden_UserAccount_Blocked': 'Player account blocked'
68
75
  },
69
76
  'es-mx': {
70
77
  'invalidField': 'El campo es inválido',
@@ -73,7 +80,8 @@ const TRANSLATIONS = {
73
80
  'Password': 'Contraseña',
74
81
  'login': 'Entrar',
75
82
  'genericError': 'Ha ocurrido un error inesperado',
76
- 'successMessage': 'Ha ingreasado de forma exitosa'
83
+ 'successMessage': 'Ha ingreasado de forma exitosa',
84
+ 'Forbidden_UserAccount_Blocked': 'Player account blocked'
77
85
  }
78
86
  };
79
87
  const getTranslations = (url) => {
@@ -154,6 +162,7 @@ const UserLogin = class {
154
162
  this.limitStylingAppends = false;
155
163
  this.errorMessage = '';
156
164
  this.hasError = false;
165
+ this.errorCode = '';
157
166
  this.setClientStyling = () => {
158
167
  let sheet = document.createElement('style');
159
168
  sheet.innerHTML = this.clientStyling;
@@ -191,7 +200,7 @@ const UserLogin = class {
191
200
  .then((res) => {
192
201
  return res.json();
193
202
  }).then((data) => {
194
- var _a, _b;
203
+ var _a, _b, _c;
195
204
  if ((_a = data.sessionBlockers) === null || _a === void 0 ? void 0 : _a.includes('has-to-set-consents')) {
196
205
  window.postMessage({ type: 'PlayerActions', gmversion: 'gm16' }, window.location.href);
197
206
  }
@@ -209,7 +218,8 @@ const UserLogin = class {
209
218
  else {
210
219
  // handles errors thrown by api
211
220
  this.hasError = true;
212
- this.errorMessage = (_b = data === null || data === void 0 ? void 0 : data.thirdPartyResponse) === null || _b === void 0 ? void 0 : _b.message;
221
+ this.errorCode = (_b = data === null || data === void 0 ? void 0 : data.thirdPartyResponse) === null || _b === void 0 ? void 0 : _b.errorCode;
222
+ 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);
213
223
  if (this.errorMessage) {
214
224
  console.error(this.errorMessage);
215
225
  this.sendErrorNotification(this.errorMessage);
@@ -321,7 +331,7 @@ const UserLogin = class {
321
331
  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'), required: true }), h("label", { class: (this.userPassword ? 'FieldFilledIn' : '') + ' ' + (!this.isValidPassword || this.hasError ? 'FieldInvalid' : '') }, translate('password', this.lang)), !this.isValidPassword &&
322
332
  h("p", { class: "InvalidField" }, translate('invalidField', this.lang))), this.passwordReset == 'true' &&
323
333
  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 &&
324
- h("p", { class: "CredentialsError" }, this.errorMessage ? this.errorMessage : translate('genericError', this.lang))));
334
+ h("p", { class: "CredentialsError" }, this.errorMessage)));
325
335
  return h("section", { ref: el => this.stylingContainer = el }, userIdentification);
326
336
  }
327
337
  static get watchers() { return {
@@ -53,6 +53,7 @@ export declare class UserLogin {
53
53
  private limitStylingAppends;
54
54
  private errorMessage;
55
55
  private hasError;
56
+ private errorCode;
56
57
  private stylingContainer;
57
58
  updateLoginCredentialsEvent: CustomEvent;
58
59
  handleNewTranslations(): void;
@@ -0,0 +1 @@
1
+ import{r as i,h as o}from"./p-55726395.js";const s=["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",Forbidden_UserAccount_Blocked:"Player account blocked"},ro:{invalidField:"This field is invalid",forgotPassword:"Forgot Password",userEmail:"Username or Email",password:"Password",login:"Login",genericError:"An unexpected error has occured",successMessage:"Login successful",Forbidden_UserAccount_Blocked:"Player account blocked"},hr:{invalidField:"Ovo polje je nevažeće",forgotPassword:"Zaboravljena lozinka",userEmail:"Korisničko ime ili email",password:"Lozinka",login:"Prijava",genericError:"Došlo je do neočekivane pogreške",successMessage:"Prijava uspješna",Forbidden_UserAccount_Blocked:"Vaš račun je blokiran"},fr:{invalidField:"This field is invalid",forgotPassword:"Forgot Password",userEmail:"Username or Email",password:"Password",login:"Login",genericError:"An unexpected error has occured",successMessage:"Login successful",Forbidden_UserAccount_Blocked:"Player account blocked"},cs:{invalidField:"Ovo polje je nevažeće.",forgotPassword:"Zaboravio sam lozinku ",userEmail:"Korisničko ime ili email",password:"Lozinka",login:"Prijava",genericError:"An unexpected error has occured",successMessage:"Login successful",Forbidden_UserAccount_Blocked:"Player account blocked"},de:{invalidField:"This field is invalid",forgotPassword:"Forgot Password",userEmail:"Username or Email",password:"Password",login:"Login",genericError:"An unexpected error has occured",successMessage:"Login successful",Forbidden_UserAccount_Blocked:"Player account blocked"},"pt-br":{invalidField:"O campo é inválido",forgotPassword:"Esqueceu sua senha",userEmail:"Usuário ou e-mail",Password:"Senha",login:"Entrem",genericError:"Ocorreu um erro inesperado",successMessage:"Você fez login com sucesso",Forbidden_UserAccount_Blocked:"Player account blocked"},"es-mx":{invalidField:"El campo es inválido",forgotPassword:"Olvidó contraseña",userEmail:"Usuario o Correo Electrónico",Password:"Contraseña",login:"Entrar",genericError:"Ha ocurrido un error inesperado",successMessage:"Ha ingreasado de forma exitosa",Forbidden_UserAccount_Blocked:"Player account blocked"}},r=i=>new Promise((o=>{fetch(i).then((i=>i.json())).then((i=>{Object.keys(i).forEach((o=>{for(let s in i[o])e[o][s]=i[o][s]})),o(!0)}))})),t=(i,o,r)=>{const t=o;let a=e[void 0!==t&&s.includes(t)?t:"en"][i];if(void 0!==r)for(const[i,o]of Object.entries(r.values)){const s=new RegExp(`{${i}}`,"g");a=a.replace(s,o)}return a},a=class{constructor(o){i(this,o),this.endpoint="",this.lang="en",this.clientStyling="",this.clientStylingUrl="",this.translationUrl="",this.passwordReset="false",this.userEmailRegexOptions="i",this.passwordRegexOptions="",this.userNameEmail="",this.userPassword="",this.isValidUserEmail=!0,this.isValidPassword=!0,this.isPasswordVisible=!1,this.limitStylingAppends=!1,this.errorMessage="",this.hasError=!1,this.errorCode="",this.setClientStyling=()=>{let i=document.createElement("style");i.innerHTML=this.clientStyling,this.stylingContainer.appendChild(i)},this.setClientStylingURL=()=>{let i=new URL(this.clientStylingUrl),o=document.createElement("style");fetch(i.href).then((i=>i.text())).then((i=>{o.innerHTML=i,setTimeout((()=>{this.stylingContainer.appendChild(o)}),1)}))},this.autofillCredentialsHandler=i=>{this.userNameEmail=i.detail.userNameEmail,this.userPassword=i.detail.userPassword,this.handleLogin()},this.userLogin=async({username:i,password:o})=>{let s={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:i,password:o})};fetch(`${this.endpoint}/v1/player/legislation/login`,s).then((i=>i.json())).then((i=>{var o,s,e;(null===(o=i.sessionBlockers)||void 0===o?void 0:o.includes("has-to-set-consents"))&&window.postMessage({type:"PlayerActions",gmversion:"gm16"},window.location.href),!0===(null==i?void 0:i.hasToSetPass)&&window.postMessage({type:"HasToSetPass"},window.location.href),i.sessionId?(window.postMessage({type:"UserSessionID",session:i.sessionId,userid:i.userId},window.location.href),window.postMessage({type:"WidgetNotification",data:{type:"success",message:t("successMessage",this.lang)}},window.location.href),this.hasError=!1):(this.hasError=!0,this.errorCode=null===(s=null==i?void 0:i.thirdPartyResponse)||void 0===s?void 0:s.errorCode,this.errorMessage=t(`${this.errorCode}`,this.lang)||(null===(e=null==i?void 0:i.thirdPartyResponse)||void 0===e?void 0:e.message)||t("genericError",this.lang),this.errorMessage&&(console.error(this.errorMessage),this.sendErrorNotification(this.errorMessage)))})).catch((i=>{console.error(i),this.hasError=!0,this.errorMessage=t("genericError",this.lang),this.sendErrorNotification(this.errorMessage)}))},this.debouncedUserLogin=this.debounce(this.userLogin,850),this.handleLogin=()=>{this.debouncedUserLogin({username:this.userNameEmail,password:this.userPassword}),this.dispatchUpdateLoginCredentialsEvent()},this.handleInputChange=(i,o)=>{this.hasError=!1;const s=i.target.value;"user"===o?(this.userNameEmail=s,this.isValidUserEmail=this.userEmailValidation(this.userNameEmail)):(this.userPassword=s,this.isValidPassword=this.passwordValidation(s))},this.userEmailValidation=i=>new RegExp(this.userEmailRegex,this.userEmailRegexOptions).test(i),this.passwordValidation=i=>new RegExp(this.passwordRegex,this.passwordRegexOptions).test(i),this.togglePassword=()=>{this.isPasswordVisible=!this.isPasswordVisible},this.resetPassword=()=>{window.postMessage({type:"NavForgotPassword"},window.location.href)}}handleNewTranslations(){r(this.translationUrl)}async componentWillLoad(){this.translationUrl.length>2&&await r(this.translationUrl)}componentDidLoad(){window.addEventListener("LoginCredentials",this.autofillCredentialsHandler),window.postMessage({type:"UserLoginDidLoad"})}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}disconnectedCallback(){window.removeEventListener("LoginCredentials",this.autofillCredentialsHandler)}sendErrorNotification(i){window.postMessage({type:"HasError",error:i},window.location.href),window.postMessage({type:"WidgetNotification",data:{type:"error",message:i}},window.location.href)}debounce(i,o){let s;return function(...e){clearTimeout(s),s=setTimeout((()=>{i.apply(this,e)}),o)}}dispatchUpdateLoginCredentialsEvent(){this.hasError||(this.updateLoginCredentialsEvent=new CustomEvent("UpdateLoginCredentials",{bubbles:!0,detail:{userNameEmail:this.userNameEmail,userPassword:this.userPassword}}),window.dispatchEvent(this.updateLoginCredentialsEvent))}render(){let i=o("span",{class:"InputIcon"},this.isPasswordVisible&&o("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"},o("g",{transform:"translate(-110.856 -23.242)"},o("circle",{class:"PasswordVisibilityIcon",cx:"0.05",cy:"0.05",r:"0.05",transform:"translate(121.017 31.148)"}),o("g",{transform:"translate(117.499 27.37)"},o("path",{class:"PasswordVisibilityIcon",d:"M147.413,43.174a2.774,2.774,0,0,0-3.229-3.943Z",transform:"translate(-142.164 -39.123)"}),o("path",{class:"PasswordVisibilityIcon",d:"M137.031,43.1a2.778,2.778,0,0,0,3.447,4.209Z",transform:"translate(-136.413 -42.068)"})),o("g",{transform:"translate(110.856 24.899)"},o("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)"}),o("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)"})),o("rect",{class:"PasswordVisibilityIcon",width:"0.972",height:"15.861",rx:"0.486",transform:"translate(114.827 23.858) rotate(-39.315)"}))),!this.isPasswordVisible&&o("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"},o("g",{transform:"translate(-14.185 -27.832)"},o("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)"}),o("circle",{class:"PasswordVisibilityIcon",cx:"2.779",cy:"2.779",r:"2.779",transform:"translate(20.827 30.303)"})))),s=o("div",{class:"FormBox"},o("div",{class:"FormValue"},o("div",{class:!this.isValidUserEmail||this.hasError?"InputBox InputInvalidBox":"InputBox"},o("input",{type:"text",placeholder:"",value:this.userNameEmail,onFocus:i=>this.handleInputChange(i,"user"),onInput:i=>this.handleInputChange(i,"user"),required:!0}),o("label",{class:(this.userNameEmail?"FieldFilledIn":"")+" "+(!this.isValidUserEmail||this.hasError?"FieldInvalid":"")},t("userEmail",this.lang)),!this.isValidUserEmail&&o("p",{class:"InvalidField"},t("invalidField",this.lang))),o("div",{class:!this.isValidPassword||this.hasError?"InputBox InputInvalidBox":"InputBox"},i,o("input",{type:this.isPasswordVisible?"text":"password",placeholder:"",value:this.userPassword,onFocus:i=>this.handleInputChange(i,"password"),onInput:i=>this.handleInputChange(i,"password"),required:!0}),o("label",{class:(this.userPassword?"FieldFilledIn":"")+" "+(!this.isValidPassword||this.hasError?"FieldInvalid":"")},t("password",this.lang)),!this.isValidPassword&&o("p",{class:"InvalidField"},t("invalidField",this.lang))),"true"==this.passwordReset&&o("div",{class:"ForgotPassword"},o("button",{onClick:()=>this.resetPassword()},t("forgotPassword",this.lang))),o("button",{disabled:!(this.isValidUserEmail&&this.isValidPassword&&this.userNameEmail&&this.userPassword),class:"SubmitCredentials",onClick:()=>this.handleLogin()},t("login",this.lang)),this.hasError&&o("p",{class:"CredentialsError"},this.errorMessage)));return o("section",{ref:i=>this.stylingContainer=i},s)}static get watchers(){return{translationUrl:["handleNewTranslations"]}}};a.style=':host{display:block;font-family:"Roboto", sans-serif}section{height:100%;width:100%;background-position:center;background-size:cover}.FormValue{width:100%}.FormBox{height:100%;display:flex;position:relative;background:none;border:none;justify-content:center;align-items:center}.InputBox{position:relative;margin:30px 0;width:100%;border-bottom:2px solid var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #22B04E))}.InputBox.InputInvalidBox .PasswordVisibilityIcon{fill:var(--emfw-w-color-error, var(--emfe-w-color-red, #FD2839))}.InputBox.InputInvalidBox input{color:var(--emfw-w-color-error, var(--emfe-w-color-red, #FD2839))}.InputBox.InputInvalidBox::after{content:"";height:2px;width:100%;transition:width 0.6s linear;background:var(--emfw-w-color-error, var(--emfe-w-color-red, #FD2839))}.InputBox::after{content:"";display:block;width:0;height:2px;position:relative;top:2px}.InputBox .PasswordVisibilityIcon{fill:var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #22B04E))}.InputBox .InputIcon .TogglePasswordVisibility{cursor:pointer;position:absolute;top:18px;right:0}.InputBox .InputIcon .TogglePasswordVisibility.PasswordVisible{top:19.5px}.InputBox label{position:absolute;top:50%;left:5px;transform:translateY(-50%);color:var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #22B04E));font-size:1em;pointer-events:none;transition:0.5s}.InputBox label.FieldInvalid{color:#C23135}.InputBox input{width:100%;height:50px;background:transparent;border:none;outline:none;font-size:1em;padding:0 35px 0 5px;color:var(--emfe-w-registration-typography, var(--emfe-w-color-typography, #FFFFFF));box-sizing:border-box}input:focus~label,label.FieldFilledIn{top:-3px;font-size:0.7em}.ForgotPassword button{margin:-10px 0 17px;font-size:0.9em;color:var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #22B04E));display:flex;justify-content:space-between;background-color:transparent;padding:0;height:unset;border:0;cursor:pointer}.SubmitCredentials{display:block;margin:0 auto;outline:none;cursor:pointer;background-image:linear-gradient(to bottom, color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, black 20%), var(--emw--color-primary, #22B04E), color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, white 30%));border:2px solid var(--emw--button-border-color, #0E5924);border-radius:var(--emw--button-border-radius, 50px);padding:10px 20px;font-size:var(--emw--font-size-large, 20px);font-family:var(--emw--button-typography);color:var(--emw--button-text-color, #FFFFFF)}.SubmitCredentials:disabled{background:#707070}.Register{font-size:0.9em;color:var(--emfe-w-registration-typography, var(--emfe-w-color-typography, #FFFFFF));text-align:center;margin:25px 0 10px}.Register p a{text-decoration:none;font-weight:600}.Register p a:hover{text-decoration:underline}.InvalidField{position:absolute;top:45px;color:var(--emfw-w-color-error, var(--emfe-w-color-red, #FD2839));font-size:0.7em}.SubmitCredentials{margin-bottom:20px}.CredentialsError{color:var(--emfw-w-color-error, var(--emfe-w-color-red, #FD2839));font-size:0.7em;padding:0 0 20px 0;margin:0}.CredentialsError input{color:var(--emfw-w-color-error, var(--emfe-w-color-red, #FD2839))}@media screen and (max-width: 480px){.FormBox{width:100%;border-radius:0px}}';export{a as user_login}
@@ -1 +1 @@
1
- import{p as s,b as e}from"./p-55726395.js";(()=>{const e=import.meta.url,r={};return""!==e&&(r.resourcesUrl=new URL(".",e).href),s(r)})().then((s=>e([["p-84f4aeec",[[1,"user-login",{endpoint:[513],lang:[1537],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],translationUrl:[513,"translation-url"],passwordReset:[513,"password-reset"],userEmailRegex:[513,"user-email-regex"],userEmailRegexOptions:[513,"user-email-regex-options"],passwordRegex:[513,"password-regex"],passwordRegexOptions:[513,"password-regex-options"],userNameEmail:[32],userPassword:[32],isValidUserEmail:[32],isValidPassword:[32],isPasswordVisible:[32],limitStylingAppends:[32],errorMessage:[32],hasError:[32]}]]]],s)));
1
+ import{p as s,b as e}from"./p-55726395.js";(()=>{const e=import.meta.url,r={};return""!==e&&(r.resourcesUrl=new URL(".",e).href),s(r)})().then((s=>e([["p-4228a021",[[1,"user-login",{endpoint:[513],lang:[1537],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],translationUrl:[513,"translation-url"],passwordReset:[513,"password-reset"],userEmailRegex:[513,"user-email-regex"],userEmailRegexOptions:[513,"user-email-regex-options"],passwordRegex:[513,"password-regex"],passwordRegexOptions:[513,"password-regex-options"],userNameEmail:[32],userPassword:[32],isValidUserEmail:[32],isValidPassword:[32],isPasswordVisible:[32],limitStylingAppends:[32],errorMessage:[32],hasError:[32]}]]]],s)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/user-login",
3
- "version": "1.37.11",
3
+ "version": "1.39.0",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",
@@ -1 +0,0 @@
1
- import{r as i,h as s}from"./p-55726395.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:"Prijava uspješna"},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"},"pt-br":{invalidField:"O campo é inválido",forgotPassword:"Esqueceu sua senha",userEmail:"Usuário ou e-mail",Password:"Senha",login:"Entrem",genericError:"Ocorreu um erro inesperado",successMessage:"Você fez login com sucesso"},"es-mx":{invalidField:"El campo es inválido",forgotPassword:"Olvidó contraseña",userEmail:"Usuario o Correo Electrónico",Password:"Contraseña",login:"Entrar",genericError:"Ha ocurrido un error inesperado",successMessage:"Ha ingreasado de forma exitosa"}},r=i=>new Promise((s=>{fetch(i).then((i=>i.json())).then((i=>{Object.keys(i).forEach((s=>{for(let o in i[s])e[s][o]=i[s][o]})),s(!0)}))})),t=(i,s,r)=>{const t=s;let a=e[void 0!==t&&o.includes(t)?t:"en"][i];if(void 0!==r)for(const[i,s]of Object.entries(r.values)){const o=new RegExp(`{${i}}`,"g");a=a.replace(o,s)}return a},a=class{constructor(s){i(this,s),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.setClientStyling=()=>{let i=document.createElement("style");i.innerHTML=this.clientStyling,this.stylingContainer.appendChild(i)},this.setClientStylingURL=()=>{let i=new URL(this.clientStylingUrl),s=document.createElement("style");fetch(i.href).then((i=>i.text())).then((i=>{s.innerHTML=i,setTimeout((()=>{this.stylingContainer.appendChild(s)}),1)}))},this.autofillCredentialsHandler=i=>{this.userNameEmail=i.detail.userNameEmail,this.userPassword=i.detail.userPassword,this.handleLogin()},this.userLogin=async({username:i,password:s})=>{let o={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:i,password:s})};fetch(`${this.endpoint}/v1/player/legislation/login`,o).then((i=>i.json())).then((i=>{var s,o;(null===(s=i.sessionBlockers)||void 0===s?void 0:s.includes("has-to-set-consents"))&&window.postMessage({type:"PlayerActions",gmversion:"gm16"},window.location.href),!0===(null==i?void 0:i.hasToSetPass)&&window.postMessage({type:"HasToSetPass"},window.location.href),i.sessionId?(window.postMessage({type:"UserSessionID",session:i.sessionId,userid:i.userId},window.location.href),window.postMessage({type:"WidgetNotification",data:{type:"success",message:t("successMessage",this.lang)}},window.location.href),this.hasError=!1):(this.hasError=!0,this.errorMessage=null===(o=null==i?void 0:i.thirdPartyResponse)||void 0===o?void 0:o.message,this.errorMessage&&(console.error(this.errorMessage),this.sendErrorNotification(this.errorMessage)))})).catch((i=>{console.error(i),this.hasError=!0,this.errorMessage=t("genericError",this.lang),this.sendErrorNotification(this.errorMessage)}))},this.debouncedUserLogin=this.debounce(this.userLogin,850),this.handleLogin=()=>{this.debouncedUserLogin({username:this.userNameEmail,password:this.userPassword}),this.dispatchUpdateLoginCredentialsEvent()},this.handleInputChange=(i,s)=>{this.hasError=!1;const o=i.target.value;"user"===s?(this.userNameEmail=o,this.isValidUserEmail=this.userEmailValidation(this.userNameEmail)):(this.userPassword=o,this.isValidPassword=this.passwordValidation(o))},this.userEmailValidation=i=>new RegExp(this.userEmailRegex,this.userEmailRegexOptions).test(i),this.passwordValidation=i=>new RegExp(this.passwordRegex,this.passwordRegexOptions).test(i),this.togglePassword=()=>{this.isPasswordVisible=!this.isPasswordVisible},this.resetPassword=()=>{window.postMessage({type:"NavForgotPassword"},window.location.href)}}handleNewTranslations(){r(this.translationUrl)}async componentWillLoad(){this.translationUrl.length>2&&await r(this.translationUrl)}componentDidLoad(){window.addEventListener("LoginCredentials",this.autofillCredentialsHandler),window.postMessage({type:"UserLoginDidLoad"})}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}disconnectedCallback(){window.removeEventListener("LoginCredentials",this.autofillCredentialsHandler)}sendErrorNotification(i){window.postMessage({type:"HasError",error:i},window.location.href),window.postMessage({type:"WidgetNotification",data:{type:"error",message:i}},window.location.href)}debounce(i,s){let o;return function(...e){clearTimeout(o),o=setTimeout((()=>{i.apply(this,e)}),s)}}dispatchUpdateLoginCredentialsEvent(){this.hasError||(this.updateLoginCredentialsEvent=new CustomEvent("UpdateLoginCredentials",{bubbles:!0,detail:{userNameEmail:this.userNameEmail,userPassword:this.userPassword}}),window.dispatchEvent(this.updateLoginCredentialsEvent))}render(){let i=s("span",{class:"InputIcon"},this.isPasswordVisible&&s("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"},s("g",{transform:"translate(-110.856 -23.242)"},s("circle",{class:"PasswordVisibilityIcon",cx:"0.05",cy:"0.05",r:"0.05",transform:"translate(121.017 31.148)"}),s("g",{transform:"translate(117.499 27.37)"},s("path",{class:"PasswordVisibilityIcon",d:"M147.413,43.174a2.774,2.774,0,0,0-3.229-3.943Z",transform:"translate(-142.164 -39.123)"}),s("path",{class:"PasswordVisibilityIcon",d:"M137.031,43.1a2.778,2.778,0,0,0,3.447,4.209Z",transform:"translate(-136.413 -42.068)"})),s("g",{transform:"translate(110.856 24.899)"},s("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)"}),s("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)"})),s("rect",{class:"PasswordVisibilityIcon",width:"0.972",height:"15.861",rx:"0.486",transform:"translate(114.827 23.858) rotate(-39.315)"}))),!this.isPasswordVisible&&s("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"},s("g",{transform:"translate(-14.185 -27.832)"},s("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)"}),s("circle",{class:"PasswordVisibilityIcon",cx:"2.779",cy:"2.779",r:"2.779",transform:"translate(20.827 30.303)"})))),o=s("div",{class:"FormBox"},s("div",{class:"FormValue"},s("div",{class:!this.isValidUserEmail||this.hasError?"InputBox InputInvalidBox":"InputBox"},s("input",{type:"text",placeholder:"",value:this.userNameEmail,onFocus:i=>this.handleInputChange(i,"user"),onInput:i=>this.handleInputChange(i,"user"),required:!0}),s("label",{class:(this.userNameEmail?"FieldFilledIn":"")+" "+(!this.isValidUserEmail||this.hasError?"FieldInvalid":"")},t("userEmail",this.lang)),!this.isValidUserEmail&&s("p",{class:"InvalidField"},t("invalidField",this.lang))),s("div",{class:!this.isValidPassword||this.hasError?"InputBox InputInvalidBox":"InputBox"},i,s("input",{type:this.isPasswordVisible?"text":"password",placeholder:"",value:this.userPassword,onFocus:i=>this.handleInputChange(i,"password"),onInput:i=>this.handleInputChange(i,"password"),required:!0}),s("label",{class:(this.userPassword?"FieldFilledIn":"")+" "+(!this.isValidPassword||this.hasError?"FieldInvalid":"")},t("password",this.lang)),!this.isValidPassword&&s("p",{class:"InvalidField"},t("invalidField",this.lang))),"true"==this.passwordReset&&s("div",{class:"ForgotPassword"},s("button",{onClick:()=>this.resetPassword()},t("forgotPassword",this.lang))),s("button",{disabled:!(this.isValidUserEmail&&this.isValidPassword&&this.userNameEmail&&this.userPassword),class:"SubmitCredentials",onClick:()=>this.handleLogin()},t("login",this.lang)),this.hasError&&s("p",{class:"CredentialsError"},this.errorMessage?this.errorMessage:t("genericError",this.lang))));return s("section",{ref:i=>this.stylingContainer=i},o)}static get watchers(){return{translationUrl:["handleNewTranslations"]}}};a.style=':host{display:block;font-family:"Roboto", sans-serif}section{height:100%;width:100%;background-position:center;background-size:cover}.FormValue{width:100%}.FormBox{height:100%;display:flex;position:relative;background:none;border:none;justify-content:center;align-items:center}.InputBox{position:relative;margin:30px 0;width:100%;border-bottom:2px solid var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #22B04E))}.InputBox.InputInvalidBox .PasswordVisibilityIcon{fill:var(--emfw-w-color-error, var(--emfe-w-color-red, #FD2839))}.InputBox.InputInvalidBox input{color:var(--emfw-w-color-error, var(--emfe-w-color-red, #FD2839))}.InputBox.InputInvalidBox::after{content:"";height:2px;width:100%;transition:width 0.6s linear;background:var(--emfw-w-color-error, var(--emfe-w-color-red, #FD2839))}.InputBox::after{content:"";display:block;width:0;height:2px;position:relative;top:2px}.InputBox .PasswordVisibilityIcon{fill:var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #22B04E))}.InputBox .InputIcon .TogglePasswordVisibility{cursor:pointer;position:absolute;top:18px;right:0}.InputBox .InputIcon .TogglePasswordVisibility.PasswordVisible{top:19.5px}.InputBox label{position:absolute;top:50%;left:5px;transform:translateY(-50%);color:var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #22B04E));font-size:1em;pointer-events:none;transition:0.5s}.InputBox label.FieldInvalid{color:#C23135}.InputBox input{width:100%;height:50px;background:transparent;border:none;outline:none;font-size:1em;padding:0 35px 0 5px;color:var(--emfe-w-registration-typography, var(--emfe-w-color-typography, #FFFFFF));box-sizing:border-box}input:focus~label,label.FieldFilledIn{top:-3px;font-size:0.7em}.ForgotPassword button{margin:-10px 0 17px;font-size:0.9em;color:var(--emfe-w-registration-color-primary, var(--emfe-w-color-primary, #22B04E));display:flex;justify-content:space-between;background-color:transparent;padding:0;height:unset;border:0;cursor:pointer}.SubmitCredentials{display:block;margin:0 auto;outline:none;cursor:pointer;background-image:linear-gradient(to bottom, color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, black 20%), var(--emw--color-primary, #22B04E), color-mix(in srgb, var(--emw--color-primary, #22B04E) 80%, white 30%));border:2px solid var(--emw--button-border-color, #0E5924);border-radius:var(--emw--button-border-radius, 50px);padding:10px 20px;font-size:var(--emw--font-size-large, 20px);font-family:var(--emw--button-typography);color:var(--emw--button-text-color, #FFFFFF)}.SubmitCredentials:disabled{background:#707070}.Register{font-size:0.9em;color:var(--emfe-w-registration-typography, var(--emfe-w-color-typography, #FFFFFF));text-align:center;margin:25px 0 10px}.Register p a{text-decoration:none;font-weight:600}.Register p a:hover{text-decoration:underline}.InvalidField{position:absolute;top:45px;color:var(--emfw-w-color-error, var(--emfe-w-color-red, #FD2839));font-size:0.7em}.SubmitCredentials{margin-bottom:20px}.CredentialsError{color:var(--emfw-w-color-error, var(--emfe-w-color-red, #FD2839));font-size:0.7em;padding:0 0 20px 0;margin:0}.CredentialsError input{color:var(--emfw-w-color-error, var(--emfe-w-color-red, #FD2839))}@media screen and (max-width: 480px){.FormBox{width:100%;border-radius:0px}}';export{a as user_login}