@everymatrix/user-login 1.32.4 → 1.33.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.
- package/dist/cjs/index-c277c06d.js +1229 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/user-login.cjs.entry.js +326 -0
- package/dist/cjs/user-login.cjs.js +19 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/user-login/user-login.css +162 -0
- package/dist/collection/components/user-login/user-login.js +440 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +102 -0
- package/dist/collection/utils/utils.js +3 -0
- package/dist/components/index.d.ts +26 -0
- package/dist/components/index.js +1 -0
- package/dist/components/user-login.d.ts +11 -0
- package/dist/components/user-login.js +359 -0
- package/dist/esm/index-adf399de.js +1204 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/user-login.entry.js +322 -0
- package/dist/esm/user-login.js +17 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.js +22 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/user-login/.stencil/packages/user-login/stencil.config.d.ts +2 -0
- package/dist/types/components/user-login/user-login.d.ts +78 -0
- package/dist/types/components.d.ts +117 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1565 -0
- package/dist/types/utils/locale.utils.d.ts +2 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/dist/user-login/index.esm.js +0 -0
- package/dist/user-login/p-05867322.entry.js +1 -0
- package/dist/user-login/p-f775dfb7.js +1 -0
- package/dist/user-login/user-login.esm.js +1 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +2 -3
- package/LICENSE +0 -21
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import { Component, Prop, State, Watch, h } from '@stencil/core';
|
|
2
|
+
import { getTranslations, translate } from '../../utils/locale.utils';
|
|
3
|
+
export class UserLogin {
|
|
4
|
+
constructor() {
|
|
5
|
+
/**
|
|
6
|
+
* Endpoint
|
|
7
|
+
*/
|
|
8
|
+
this.endpoint = '';
|
|
9
|
+
/**
|
|
10
|
+
* Language
|
|
11
|
+
*/
|
|
12
|
+
this.lang = 'en';
|
|
13
|
+
/**
|
|
14
|
+
* Client styling
|
|
15
|
+
*/
|
|
16
|
+
this.clientStyling = '';
|
|
17
|
+
/**
|
|
18
|
+
* Client styling by url
|
|
19
|
+
*/
|
|
20
|
+
this.clientStylingUrl = '';
|
|
21
|
+
/**
|
|
22
|
+
* Translation url
|
|
23
|
+
*/
|
|
24
|
+
this.translationUrl = '';
|
|
25
|
+
/**
|
|
26
|
+
* Password reset
|
|
27
|
+
*/
|
|
28
|
+
this.passwordReset = 'false';
|
|
29
|
+
/**
|
|
30
|
+
* User email regex options
|
|
31
|
+
*/
|
|
32
|
+
this.userEmailRegexOptions = 'i';
|
|
33
|
+
/**
|
|
34
|
+
* Password regex options
|
|
35
|
+
*/
|
|
36
|
+
this.passwordRegexOptions = '';
|
|
37
|
+
/**
|
|
38
|
+
* Username
|
|
39
|
+
*/
|
|
40
|
+
this.userNameEmail = '';
|
|
41
|
+
/**
|
|
42
|
+
* Password
|
|
43
|
+
*/
|
|
44
|
+
this.userPassword = '';
|
|
45
|
+
this.isValidUserEmail = true;
|
|
46
|
+
this.isValidPassword = true;
|
|
47
|
+
this.isPasswordVisible = false;
|
|
48
|
+
this.limitStylingAppends = false;
|
|
49
|
+
this.errorMessage = '';
|
|
50
|
+
this.hasError = false;
|
|
51
|
+
this.setClientStyling = () => {
|
|
52
|
+
let sheet = document.createElement('style');
|
|
53
|
+
sheet.innerHTML = this.clientStyling;
|
|
54
|
+
this.stylingContainer.appendChild(sheet);
|
|
55
|
+
};
|
|
56
|
+
this.setClientStylingURL = () => {
|
|
57
|
+
let url = new URL(this.clientStylingUrl);
|
|
58
|
+
let cssFile = document.createElement('style');
|
|
59
|
+
fetch(url.href)
|
|
60
|
+
.then((res) => res.text())
|
|
61
|
+
.then((data) => {
|
|
62
|
+
cssFile.innerHTML = data;
|
|
63
|
+
setTimeout(() => { this.stylingContainer.appendChild(cssFile); }, 1);
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
this.messageHandler = (e) => {
|
|
67
|
+
switch (e.data.type) {
|
|
68
|
+
case 'SendLoginCredentials':
|
|
69
|
+
this.userNameEmail = e.data.data.userNameEmail;
|
|
70
|
+
this.userPassword = e.data.data.userPassword;
|
|
71
|
+
this.userLogin({
|
|
72
|
+
username: this.userNameEmail,
|
|
73
|
+
password: this.userPassword
|
|
74
|
+
});
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
this.userLogin = async ({ username, password }) => {
|
|
79
|
+
let headers = {
|
|
80
|
+
'Content-Type': 'application/json'
|
|
81
|
+
};
|
|
82
|
+
let bodyData = {
|
|
83
|
+
username,
|
|
84
|
+
password
|
|
85
|
+
};
|
|
86
|
+
let options = {
|
|
87
|
+
method: 'POST',
|
|
88
|
+
headers,
|
|
89
|
+
body: JSON.stringify(bodyData),
|
|
90
|
+
};
|
|
91
|
+
fetch(`${this.endpoint}/v1/player/legislation/login`, options)
|
|
92
|
+
.then((res) => {
|
|
93
|
+
return res.json();
|
|
94
|
+
}).then((data) => {
|
|
95
|
+
var _a, _b;
|
|
96
|
+
if ((_a = data.sessionBlockers) === null || _a === void 0 ? void 0 : _a.includes('has-to-set-consents')) {
|
|
97
|
+
window.postMessage({ type: 'PlayerActions', gmversion: 'gm16' }, window.location.href);
|
|
98
|
+
}
|
|
99
|
+
if ((data === null || data === void 0 ? void 0 : data.hasToSetPass) === true) {
|
|
100
|
+
window.postMessage({ type: 'HasToSetPass' }, window.location.href);
|
|
101
|
+
}
|
|
102
|
+
if (data.sessionId) {
|
|
103
|
+
window.postMessage({ type: 'UserSessionID', session: data.sessionId, userid: data.userId }, window.location.href);
|
|
104
|
+
window.postMessage({ type: 'WidgetNotification', data: {
|
|
105
|
+
type: 'success',
|
|
106
|
+
message: translate('successMessage', this.lang)
|
|
107
|
+
} }, window.location.href);
|
|
108
|
+
this.hasError = false;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
// handles errors thrown by api
|
|
112
|
+
this.hasError = true;
|
|
113
|
+
this.errorMessage = (_b = data === null || data === void 0 ? void 0 : data.thirdPartyResponse) === null || _b === void 0 ? void 0 : _b.message;
|
|
114
|
+
if (this.errorMessage) {
|
|
115
|
+
console.error(this.errorMessage);
|
|
116
|
+
this.sendErrorNotification(this.errorMessage);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}).catch((err) => {
|
|
120
|
+
// handles unexpected errors
|
|
121
|
+
console.error(err);
|
|
122
|
+
this.hasError = true;
|
|
123
|
+
this.errorMessage = translate('genericError', this.lang);
|
|
124
|
+
this.sendErrorNotification(this.errorMessage);
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
this.debouncedUserLogin = this.debounce(this.userLogin, 850);
|
|
128
|
+
this.handleLogin = () => {
|
|
129
|
+
this.debouncedUserLogin({
|
|
130
|
+
username: this.userNameEmail,
|
|
131
|
+
password: this.userPassword
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
this.handleInputChange = (event, location) => {
|
|
135
|
+
this.hasError = false;
|
|
136
|
+
const inputValue = event.target.value;
|
|
137
|
+
if (location === 'user') {
|
|
138
|
+
this.userNameEmail = inputValue;
|
|
139
|
+
this.isValidUserEmail = this.userEmailValidation(this.userNameEmail);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
this.userPassword = inputValue;
|
|
143
|
+
this.isValidPassword = this.passwordValidation(inputValue);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
this.userEmailValidation = (input) => {
|
|
147
|
+
const regex = new RegExp(this.userEmailRegex, this.userEmailRegexOptions);
|
|
148
|
+
return regex.test(input);
|
|
149
|
+
};
|
|
150
|
+
this.passwordValidation = (input) => {
|
|
151
|
+
const regex = new RegExp(this.passwordRegex, this.passwordRegexOptions);
|
|
152
|
+
return regex.test(input);
|
|
153
|
+
};
|
|
154
|
+
this.togglePassword = () => {
|
|
155
|
+
this.isPasswordVisible = !this.isPasswordVisible;
|
|
156
|
+
};
|
|
157
|
+
this.resetPassword = () => {
|
|
158
|
+
window.postMessage({ type: "NavForgotPassword" }, window.location.href);
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
handleNewTranslations() {
|
|
162
|
+
getTranslations(this.translationUrl);
|
|
163
|
+
}
|
|
164
|
+
async componentWillLoad() {
|
|
165
|
+
if (this.translationUrl.length > 2) {
|
|
166
|
+
await getTranslations(this.translationUrl);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
componentDidLoad() {
|
|
170
|
+
window.addEventListener('message', this.messageHandler);
|
|
171
|
+
}
|
|
172
|
+
componentDidRender() {
|
|
173
|
+
// start custom styling area
|
|
174
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
175
|
+
if (this.clientStyling)
|
|
176
|
+
this.setClientStyling();
|
|
177
|
+
if (this.clientStylingUrl)
|
|
178
|
+
this.setClientStylingURL();
|
|
179
|
+
this.limitStylingAppends = true;
|
|
180
|
+
}
|
|
181
|
+
// end custom styling area
|
|
182
|
+
}
|
|
183
|
+
sendErrorNotification(errorMessage) {
|
|
184
|
+
window.postMessage({ type: "HasError", error: errorMessage }, window.location.href);
|
|
185
|
+
window.postMessage({ type: 'WidgetNotification', data: {
|
|
186
|
+
type: 'error',
|
|
187
|
+
message: errorMessage
|
|
188
|
+
} }, window.location.href);
|
|
189
|
+
}
|
|
190
|
+
debounce(func, delay) {
|
|
191
|
+
let timer;
|
|
192
|
+
return function (...args) {
|
|
193
|
+
clearTimeout(timer);
|
|
194
|
+
timer = setTimeout(() => {
|
|
195
|
+
func.apply(this, args);
|
|
196
|
+
}, delay);
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
render() {
|
|
200
|
+
let visibilityIcon = h("span", { class: "InputIcon" },
|
|
201
|
+
this.isPasswordVisible &&
|
|
202
|
+
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" },
|
|
203
|
+
h("g", { transform: "translate(-110.856 -23.242)" },
|
|
204
|
+
h("circle", { class: "PasswordVisibilityIcon", cx: "0.05", cy: "0.05", r: "0.05", transform: "translate(121.017 31.148)" }),
|
|
205
|
+
h("g", { transform: "translate(117.499 27.37)" },
|
|
206
|
+
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)" }),
|
|
207
|
+
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)" })),
|
|
208
|
+
h("g", { transform: "translate(110.856 24.899)" },
|
|
209
|
+
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)" }),
|
|
210
|
+
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)" })),
|
|
211
|
+
h("rect", { class: "PasswordVisibilityIcon", width: "0.972", height: "15.861", rx: "0.486", transform: "translate(114.827 23.858) rotate(-39.315)" }))),
|
|
212
|
+
!this.isPasswordVisible &&
|
|
213
|
+
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" },
|
|
214
|
+
h("g", { transform: "translate(-14.185 -27.832)" },
|
|
215
|
+
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)" }),
|
|
216
|
+
h("circle", { class: "PasswordVisibilityIcon", cx: "2.779", cy: "2.779", r: "2.779", transform: "translate(20.827 30.303)" }))));
|
|
217
|
+
let userIdentification = h("div", { class: "FormBox" },
|
|
218
|
+
h("div", { class: "FormValue" },
|
|
219
|
+
h("div", { class: (!this.isValidUserEmail || this.hasError) ? 'InputBox InputInvalidBox' : 'InputBox' },
|
|
220
|
+
h("input", { type: "text", placeholder: '', value: this.userNameEmail, onFocus: (event) => this.handleInputChange(event, 'user'), onInput: (event) => this.handleInputChange(event, 'user'), required: true }),
|
|
221
|
+
h("label", { class: (this.userNameEmail ? 'FieldFilledIn' : '') + ' ' + (!this.isValidUserEmail || this.hasError ? 'FieldInvalid' : '') }, translate('userEmail', this.lang)),
|
|
222
|
+
!this.isValidUserEmail &&
|
|
223
|
+
h("p", { class: "InvalidField" }, translate('invalidField', this.lang))),
|
|
224
|
+
h("div", { class: (!this.isValidPassword || this.hasError) ? 'InputBox InputInvalidBox' : 'InputBox' },
|
|
225
|
+
visibilityIcon,
|
|
226
|
+
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 }),
|
|
227
|
+
h("label", { class: (this.userPassword ? 'FieldFilledIn' : '') + ' ' + (!this.isValidPassword || this.hasError ? 'FieldInvalid' : '') }, translate('password', this.lang)),
|
|
228
|
+
!this.isValidPassword &&
|
|
229
|
+
h("p", { class: "InvalidField" }, translate('invalidField', this.lang))),
|
|
230
|
+
this.passwordReset == 'true' &&
|
|
231
|
+
h("div", { class: "ForgotPassword" },
|
|
232
|
+
h("button", { onClick: () => this.resetPassword() }, translate('forgotPassword', this.lang))),
|
|
233
|
+
h("button", { disabled: (!this.isValidUserEmail || !this.isValidPassword || !this.userNameEmail || !this.userPassword), class: "SubmitCredentials", onClick: () => this.handleLogin() }, translate('login', this.lang)),
|
|
234
|
+
this.hasError &&
|
|
235
|
+
h("p", { class: "CredentialsError" }, this.errorMessage ? this.errorMessage : translate('genericError', this.lang))));
|
|
236
|
+
return h("section", { ref: el => this.stylingContainer = el }, userIdentification);
|
|
237
|
+
}
|
|
238
|
+
static get is() { return "user-login"; }
|
|
239
|
+
static get encapsulation() { return "shadow"; }
|
|
240
|
+
static get originalStyleUrls() { return {
|
|
241
|
+
"$": ["user-login.scss"]
|
|
242
|
+
}; }
|
|
243
|
+
static get styleUrls() { return {
|
|
244
|
+
"$": ["user-login.css"]
|
|
245
|
+
}; }
|
|
246
|
+
static get properties() { return {
|
|
247
|
+
"endpoint": {
|
|
248
|
+
"type": "string",
|
|
249
|
+
"mutable": false,
|
|
250
|
+
"complexType": {
|
|
251
|
+
"original": "string",
|
|
252
|
+
"resolved": "string",
|
|
253
|
+
"references": {}
|
|
254
|
+
},
|
|
255
|
+
"required": false,
|
|
256
|
+
"optional": false,
|
|
257
|
+
"docs": {
|
|
258
|
+
"tags": [],
|
|
259
|
+
"text": "Endpoint"
|
|
260
|
+
},
|
|
261
|
+
"attribute": "endpoint",
|
|
262
|
+
"reflect": true,
|
|
263
|
+
"defaultValue": "''"
|
|
264
|
+
},
|
|
265
|
+
"lang": {
|
|
266
|
+
"type": "string",
|
|
267
|
+
"mutable": true,
|
|
268
|
+
"complexType": {
|
|
269
|
+
"original": "string",
|
|
270
|
+
"resolved": "string",
|
|
271
|
+
"references": {}
|
|
272
|
+
},
|
|
273
|
+
"required": false,
|
|
274
|
+
"optional": false,
|
|
275
|
+
"docs": {
|
|
276
|
+
"tags": [],
|
|
277
|
+
"text": "Language"
|
|
278
|
+
},
|
|
279
|
+
"attribute": "lang",
|
|
280
|
+
"reflect": true,
|
|
281
|
+
"defaultValue": "'en'"
|
|
282
|
+
},
|
|
283
|
+
"clientStyling": {
|
|
284
|
+
"type": "string",
|
|
285
|
+
"mutable": false,
|
|
286
|
+
"complexType": {
|
|
287
|
+
"original": "string",
|
|
288
|
+
"resolved": "string",
|
|
289
|
+
"references": {}
|
|
290
|
+
},
|
|
291
|
+
"required": false,
|
|
292
|
+
"optional": false,
|
|
293
|
+
"docs": {
|
|
294
|
+
"tags": [],
|
|
295
|
+
"text": "Client styling"
|
|
296
|
+
},
|
|
297
|
+
"attribute": "client-styling",
|
|
298
|
+
"reflect": true,
|
|
299
|
+
"defaultValue": "''"
|
|
300
|
+
},
|
|
301
|
+
"clientStylingUrl": {
|
|
302
|
+
"type": "string",
|
|
303
|
+
"mutable": false,
|
|
304
|
+
"complexType": {
|
|
305
|
+
"original": "string",
|
|
306
|
+
"resolved": "string",
|
|
307
|
+
"references": {}
|
|
308
|
+
},
|
|
309
|
+
"required": false,
|
|
310
|
+
"optional": false,
|
|
311
|
+
"docs": {
|
|
312
|
+
"tags": [],
|
|
313
|
+
"text": "Client styling by url"
|
|
314
|
+
},
|
|
315
|
+
"attribute": "client-styling-url",
|
|
316
|
+
"reflect": true,
|
|
317
|
+
"defaultValue": "''"
|
|
318
|
+
},
|
|
319
|
+
"translationUrl": {
|
|
320
|
+
"type": "string",
|
|
321
|
+
"mutable": false,
|
|
322
|
+
"complexType": {
|
|
323
|
+
"original": "string",
|
|
324
|
+
"resolved": "string",
|
|
325
|
+
"references": {}
|
|
326
|
+
},
|
|
327
|
+
"required": false,
|
|
328
|
+
"optional": false,
|
|
329
|
+
"docs": {
|
|
330
|
+
"tags": [],
|
|
331
|
+
"text": "Translation url"
|
|
332
|
+
},
|
|
333
|
+
"attribute": "translation-url",
|
|
334
|
+
"reflect": true,
|
|
335
|
+
"defaultValue": "''"
|
|
336
|
+
},
|
|
337
|
+
"passwordReset": {
|
|
338
|
+
"type": "string",
|
|
339
|
+
"mutable": false,
|
|
340
|
+
"complexType": {
|
|
341
|
+
"original": "string",
|
|
342
|
+
"resolved": "string",
|
|
343
|
+
"references": {}
|
|
344
|
+
},
|
|
345
|
+
"required": false,
|
|
346
|
+
"optional": false,
|
|
347
|
+
"docs": {
|
|
348
|
+
"tags": [],
|
|
349
|
+
"text": "Password reset"
|
|
350
|
+
},
|
|
351
|
+
"attribute": "password-reset",
|
|
352
|
+
"reflect": true,
|
|
353
|
+
"defaultValue": "'false'"
|
|
354
|
+
},
|
|
355
|
+
"userEmailRegex": {
|
|
356
|
+
"type": "string",
|
|
357
|
+
"mutable": false,
|
|
358
|
+
"complexType": {
|
|
359
|
+
"original": "string",
|
|
360
|
+
"resolved": "string",
|
|
361
|
+
"references": {}
|
|
362
|
+
},
|
|
363
|
+
"required": false,
|
|
364
|
+
"optional": false,
|
|
365
|
+
"docs": {
|
|
366
|
+
"tags": [],
|
|
367
|
+
"text": "User email regex"
|
|
368
|
+
},
|
|
369
|
+
"attribute": "user-email-regex",
|
|
370
|
+
"reflect": true
|
|
371
|
+
},
|
|
372
|
+
"userEmailRegexOptions": {
|
|
373
|
+
"type": "string",
|
|
374
|
+
"mutable": false,
|
|
375
|
+
"complexType": {
|
|
376
|
+
"original": "string",
|
|
377
|
+
"resolved": "string",
|
|
378
|
+
"references": {}
|
|
379
|
+
},
|
|
380
|
+
"required": false,
|
|
381
|
+
"optional": false,
|
|
382
|
+
"docs": {
|
|
383
|
+
"tags": [],
|
|
384
|
+
"text": "User email regex options"
|
|
385
|
+
},
|
|
386
|
+
"attribute": "user-email-regex-options",
|
|
387
|
+
"reflect": true,
|
|
388
|
+
"defaultValue": "'i'"
|
|
389
|
+
},
|
|
390
|
+
"passwordRegex": {
|
|
391
|
+
"type": "string",
|
|
392
|
+
"mutable": false,
|
|
393
|
+
"complexType": {
|
|
394
|
+
"original": "string",
|
|
395
|
+
"resolved": "string",
|
|
396
|
+
"references": {}
|
|
397
|
+
},
|
|
398
|
+
"required": false,
|
|
399
|
+
"optional": false,
|
|
400
|
+
"docs": {
|
|
401
|
+
"tags": [],
|
|
402
|
+
"text": "Password regex"
|
|
403
|
+
},
|
|
404
|
+
"attribute": "password-regex",
|
|
405
|
+
"reflect": true
|
|
406
|
+
},
|
|
407
|
+
"passwordRegexOptions": {
|
|
408
|
+
"type": "string",
|
|
409
|
+
"mutable": false,
|
|
410
|
+
"complexType": {
|
|
411
|
+
"original": "string",
|
|
412
|
+
"resolved": "string",
|
|
413
|
+
"references": {}
|
|
414
|
+
},
|
|
415
|
+
"required": false,
|
|
416
|
+
"optional": false,
|
|
417
|
+
"docs": {
|
|
418
|
+
"tags": [],
|
|
419
|
+
"text": "Password regex options"
|
|
420
|
+
},
|
|
421
|
+
"attribute": "password-regex-options",
|
|
422
|
+
"reflect": true,
|
|
423
|
+
"defaultValue": "''"
|
|
424
|
+
}
|
|
425
|
+
}; }
|
|
426
|
+
static get states() { return {
|
|
427
|
+
"userNameEmail": {},
|
|
428
|
+
"userPassword": {},
|
|
429
|
+
"isValidUserEmail": {},
|
|
430
|
+
"isValidPassword": {},
|
|
431
|
+
"isPasswordVisible": {},
|
|
432
|
+
"limitStylingAppends": {},
|
|
433
|
+
"errorMessage": {},
|
|
434
|
+
"hasError": {}
|
|
435
|
+
}; }
|
|
436
|
+
static get watchers() { return [{
|
|
437
|
+
"propName": "translationUrl",
|
|
438
|
+
"methodName": "handleNewTranslations"
|
|
439
|
+
}]; }
|
|
440
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
2
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en', 'cz', 'de', 'hr'];
|
|
3
|
+
const TRANSLATIONS = {
|
|
4
|
+
en: {
|
|
5
|
+
invalidField: 'This field is invalid',
|
|
6
|
+
forgotPassword: 'Forgot Password',
|
|
7
|
+
userEmail: 'Username or Email',
|
|
8
|
+
password: 'Password',
|
|
9
|
+
login: 'Login',
|
|
10
|
+
genericError: 'An unexpected error has occured',
|
|
11
|
+
successMessage: 'Login successful'
|
|
12
|
+
},
|
|
13
|
+
ro: {
|
|
14
|
+
invalidField: 'This field is invalid',
|
|
15
|
+
forgotPassword: 'Forgot Password',
|
|
16
|
+
userEmail: 'Username or Email',
|
|
17
|
+
password: 'Password',
|
|
18
|
+
login: 'Login',
|
|
19
|
+
genericError: 'An unexpected error has occured',
|
|
20
|
+
successMessage: 'Login successful'
|
|
21
|
+
},
|
|
22
|
+
hr: {
|
|
23
|
+
invalidField: 'Ovo polje je nevažeće',
|
|
24
|
+
forgotPassword: 'Zaboravljena lozinka',
|
|
25
|
+
userEmail: 'Korisničko ime ili email',
|
|
26
|
+
password: 'Lozinka',
|
|
27
|
+
login: 'Prijava',
|
|
28
|
+
genericError: 'Došlo je do neočekivane pogreške',
|
|
29
|
+
successMessage: 'Prijava uspješna'
|
|
30
|
+
},
|
|
31
|
+
fr: {
|
|
32
|
+
invalidField: 'This field is invalid',
|
|
33
|
+
forgotPassword: 'Forgot Password',
|
|
34
|
+
userEmail: 'Username or Email',
|
|
35
|
+
password: 'Password',
|
|
36
|
+
login: 'Login',
|
|
37
|
+
genericError: 'An unexpected error has occured',
|
|
38
|
+
successMessage: 'Login successful'
|
|
39
|
+
},
|
|
40
|
+
cs: {
|
|
41
|
+
invalidField: 'Ovo polje je nevažeće.',
|
|
42
|
+
forgotPassword: 'Zaboravio sam lozinku ',
|
|
43
|
+
userEmail: 'Korisničko ime ili email',
|
|
44
|
+
password: 'Lozinka',
|
|
45
|
+
login: 'Prijava',
|
|
46
|
+
genericError: 'An unexpected error has occured',
|
|
47
|
+
successMessage: 'Login successful'
|
|
48
|
+
},
|
|
49
|
+
de: {
|
|
50
|
+
invalidField: 'This field is invalid',
|
|
51
|
+
forgotPassword: 'Forgot Password',
|
|
52
|
+
userEmail: 'Username or Email',
|
|
53
|
+
password: 'Password',
|
|
54
|
+
login: 'Login',
|
|
55
|
+
genericError: 'An unexpected error has occured',
|
|
56
|
+
successMessage: 'Login successful'
|
|
57
|
+
},
|
|
58
|
+
'pt-br': {
|
|
59
|
+
'invalidField': 'O campo é inválido',
|
|
60
|
+
'forgotPassword': 'Esqueceu sua senha',
|
|
61
|
+
'userEmail': 'Usuário ou e-mail',
|
|
62
|
+
'Password': 'Senha',
|
|
63
|
+
'login': 'Entrem',
|
|
64
|
+
'genericError': 'Ocorreu um erro inesperado',
|
|
65
|
+
'successMessage': 'Você fez login com sucesso'
|
|
66
|
+
},
|
|
67
|
+
'es-mx': {
|
|
68
|
+
'invalidField': 'El campo es inválido',
|
|
69
|
+
'forgotPassword': 'Olvidó contraseña',
|
|
70
|
+
'userEmail': 'Usuario o Correo Electrónico',
|
|
71
|
+
'Password': 'Contraseña',
|
|
72
|
+
'login': 'Entrar',
|
|
73
|
+
'genericError': 'Ha ocurrido un error inesperado',
|
|
74
|
+
'successMessage': 'Ha ingreasado de forma exitosa'
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
export const getTranslations = (url) => {
|
|
78
|
+
// fetch url, get the data, replace the TRANSLATIONS content
|
|
79
|
+
return new Promise((resolve) => {
|
|
80
|
+
fetch(url)
|
|
81
|
+
.then((res) => res.json())
|
|
82
|
+
.then((data) => {
|
|
83
|
+
Object.keys(data).forEach((item) => {
|
|
84
|
+
for (let key in data[item]) {
|
|
85
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
resolve(true);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
export const translate = (key, customLang, values) => {
|
|
93
|
+
const lang = customLang;
|
|
94
|
+
let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
95
|
+
if (values !== undefined) {
|
|
96
|
+
for (const [key, value] of Object.entries(values.values)) {
|
|
97
|
+
const regex = new RegExp(`{${key}}`, 'g');
|
|
98
|
+
translation = translation.replace(regex, value);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return translation;
|
|
102
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* UserLogin custom elements */
|
|
2
|
+
|
|
3
|
+
import type { Components, JSX } from "../types/components";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Used to manually set the base path where assets can be found.
|
|
7
|
+
* If the script is used as "module", it's recommended to use "import.meta.url",
|
|
8
|
+
* such as "setAssetPath(import.meta.url)". Other options include
|
|
9
|
+
* "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
|
|
10
|
+
* dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
|
|
11
|
+
* But do note that this configuration depends on how your script is bundled, or lack of
|
|
12
|
+
* bundling, and where your assets can be loaded from. Additionally custom bundling
|
|
13
|
+
* will have to ensure the static assets are copied to its build directory.
|
|
14
|
+
*/
|
|
15
|
+
export declare const setAssetPath: (path: string) => void;
|
|
16
|
+
|
|
17
|
+
export interface SetPlatformOptions {
|
|
18
|
+
raf?: (c: FrameRequestCallback) => number;
|
|
19
|
+
ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
20
|
+
rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
|
|
23
|
+
|
|
24
|
+
export type { Components, JSX };
|
|
25
|
+
|
|
26
|
+
export * from '../types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface UserLogin extends Components.UserLogin, HTMLElement {}
|
|
4
|
+
export const UserLogin: {
|
|
5
|
+
prototype: UserLogin;
|
|
6
|
+
new (): UserLogin;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|