@everymatrix/general-registration-hsl 1.74.3 → 1.74.4
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/checkbox-group-input_14.cjs.entry.js +2 -1
- package/dist/cjs/general-registration-hsl-6e5b947f.js +1045 -0
- package/dist/cjs/index.cjs.js +2 -1
- package/dist/collection/components/general-registration-hsl/general-registration-hsl.js +1 -1
- package/dist/esm/checkbox-group-input_14.entry.js +2 -1
- package/dist/esm/general-registration-hsl-45a83517.js +1043 -0
- package/dist/esm/index.js +2 -1
- package/dist/general-registration-hsl/checkbox-group-input_14.entry.js +1 -1
- package/dist/general-registration-hsl/general-registration-hsl-45a83517.js +1 -0
- package/dist/general-registration-hsl/index.esm.js +1 -1
- package/dist/types/components/general-registration-hsl/general-registration-hsl.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cjs/general-registration-hsl-c647d737.js +0 -1058
- package/dist/esm/general-registration-hsl-dbdf19c5.js +0 -1056
- package/dist/general-registration-hsl/general-registration-hsl-dbdf19c5.js +0 -1
|
@@ -0,0 +1,1043 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-8c1bd3e8.js';
|
|
2
|
+
import '@everymatrix/player-consents/dist';
|
|
3
|
+
|
|
4
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
5
|
+
const TRANSLATIONS = {
|
|
6
|
+
"en": {
|
|
7
|
+
"GmErr_AMOUNT_INVALID": "The specified amount is invalid.",
|
|
8
|
+
"GmErr_REGISTER_OVERAGE": "The registration has exceeded the allowable limit.",
|
|
9
|
+
"GmErr_REGISTER_UNDERAGE": "The registration is under the allowable limit.",
|
|
10
|
+
"GmErr_USER_AUTH_FAILED_TOO_MANY_ATTEMPTS": "User authentication failed due to too many unsuccessful attempts.",
|
|
11
|
+
"GmErr_USER_ACCOUNT_BLOCKED": "The user account is blocked.",
|
|
12
|
+
"GmErr_USER_NOT_VERIFIED": "The user has not been verified.",
|
|
13
|
+
"GmErr_USER_NOT_FOUND": "No user found with the provided information.",
|
|
14
|
+
"GmErr_USER_ID_INVALID": "The user ID provided is invalid.",
|
|
15
|
+
"GmErr_USER_AUTH_FAILED": "User authentication failed.",
|
|
16
|
+
"GmErr_USER_DUPLICATED": "The user already exists in the system.",
|
|
17
|
+
"GmErr_USER_NOT_ACTIVATED": "The user account has not been activated.",
|
|
18
|
+
"GmErr_PASSWORD_CONTAINS_EMAIL": "The password cannot contain the email address.",
|
|
19
|
+
"GmErr_PASSWORD_CONTAINS_USERNAME": "The password cannot contain the username.",
|
|
20
|
+
"GmErr_PASSWORD_CONTAINS_SPACES": "The password cannot contain spaces.",
|
|
21
|
+
"GmErr_USER_4TS_CHECK_EXISTS": "The user 4TS check already exists.",
|
|
22
|
+
"GmErr_USER_NAV_EXCLUDED_REGISTRATION": "The user is excluded from registration.",
|
|
23
|
+
"GmErr_USER_NAV_EXCLUDED_LOGIN": "The user is excluded from login.",
|
|
24
|
+
"GmErr_USERNAME_REQUIRED": "A username is required.",
|
|
25
|
+
"GmErr_USER_EMAIL_NOT_VERIFIED": "The user's email address has not been verified.",
|
|
26
|
+
"GmErr_EMAIL_ALREADY_EXISTS": "User with same email already exists",
|
|
27
|
+
"GmErr_EMAIL_REQUIRED": "An email address is required.",
|
|
28
|
+
"GmErr_USERNAME_ALREADY_EXISTS": "The username is already taken.",
|
|
29
|
+
"GmErr_DUPLICATE_PERSONAL_ID": "Duplicate personal ID found.",
|
|
30
|
+
"GmErr_INVALID_USER_DOCUMENT": "The user document is invalid.",
|
|
31
|
+
"GmErr_INVALID_CODE": "The code provided is invalid.",
|
|
32
|
+
"GmErr_EXPIRED_TOKEN": "The token has expired.",
|
|
33
|
+
"GmErr_ATTEMPTS_EXCEEDED": "The maximum number of attempts has been exceeded.",
|
|
34
|
+
"GmErr_BLOCK_USER_INCORRECT_CODE": "The user has been blocked due to an incorrect code.",
|
|
35
|
+
"GmErr_TOKEN_NOT_FOUND": "The token was not found.",
|
|
36
|
+
"GmErr_INVALID_PHONE_NUMBER": "The phone number provided is invalid.",
|
|
37
|
+
"GmErr_CODE_MISSING": "The code is missing.",
|
|
38
|
+
"GmErr_UNREGISTERED_USER": "The user is not registered.",
|
|
39
|
+
"GmErr_ATTEMPTS_TO_GENERATE_CODE_EXCEEDED": "Maximum attempts to generate a code have been exceeded.",
|
|
40
|
+
"GmErr_UNEXPECTED_EXCEPTION": "An unexpected exception occurred.",
|
|
41
|
+
"GmErr_INVALID_USER_ID": "The user ID provided is invalid.",
|
|
42
|
+
"GmErr_NOT_ALLOWED_EXCEPTION": "This action is not allowed.",
|
|
43
|
+
"GmErr_CAN_NOT_FIND_ROLE": "Unable to find the specified role.",
|
|
44
|
+
"GmErr_NO_SESSION_PROVIDED": "No session was provided.",
|
|
45
|
+
"GmErr_NO_ACTIVE_SESSION_FOUND_FOR_THIS_USER": "No active session found for this user.",
|
|
46
|
+
"GmErr_USER_HAS_ALREADY_BEEN_ANONYMIZED": "The user has already been anonymized.",
|
|
47
|
+
"GmErr_NO_ROLE_HAS_BEEN_SET_UP_TO_BE_ASSIGNED": "No role has been set up to be assigned.",
|
|
48
|
+
"GmErr_PROVIDED_SESSION_DOES_NOT_BELONG_TO_THE_USER": "The provided session does not belong to the user.",
|
|
49
|
+
"GmErr_PROVIDED_SESSION_DOES_NOT_EXIST": "The provided session does not exist.",
|
|
50
|
+
"GmErr_ROLE_ALREADY_ASSIGNED_FOR_USER": "The role has already been assigned to the user.",
|
|
51
|
+
"GmErr_ASSIGN_USER_ROLE_FAILED": "Failed to assign a role to the user.",
|
|
52
|
+
"GmErr_BadRequest_1000": "There was a problem with the personal identification number",
|
|
53
|
+
"CountryRestricted": "Unfortunately, you are attempting to register from a country where we cannot accept gameplay. We are unable to process your registration for this reason.",
|
|
54
|
+
"nextButton": 'Next',
|
|
55
|
+
"backButton": 'Back',
|
|
56
|
+
"doneButton": 'Done',
|
|
57
|
+
"generalError": "Something went wrong... Please try again.",
|
|
58
|
+
"successMessage": "Register successful",
|
|
59
|
+
"requestTwofaError": "There was an error when sending the code",
|
|
60
|
+
"loadingMessage": "Please wait, loading...",
|
|
61
|
+
//Prod old errors which will be deleted after prod is updated to new keys.
|
|
62
|
+
"GmErr_BadRequest_Duplicate_User": 'A user with this information already exists.',
|
|
63
|
+
"GmErr_BadRequest_PasswordContainsUsername": "The password cannot be the same as the username.",
|
|
64
|
+
"GmErr_BadRequest_PasswordContainsEmail": "The password cannot be the same as the email.",
|
|
65
|
+
"GmErr_BadRequest_Duplicate_PersonalId": "There is already a registration with the data you entered or you entered your data in an incorrect format.",
|
|
66
|
+
"GmErr_Forbidden_UserAccount_NavExcluded": 'User is NAV Excluded. Registration was denied.',
|
|
67
|
+
"GmErr_BadRequest_ModelValidationFailed": 'Something went wrong... Please try again.',
|
|
68
|
+
"GmErr_BadInternalConfigs": 'Something went wrong... Please try again.',
|
|
69
|
+
"GmErr_Unauthorized": 'Something went wrong... Please try again.',
|
|
70
|
+
"GmErr_NotFound": 'Something went wrong... Please try again.',
|
|
71
|
+
"BadRequest_Duplicate_User": "User with same username already exists.",
|
|
72
|
+
"BadRequest": "The request is invalid, please check the API.",
|
|
73
|
+
"Unauthorized": "The player account number, e-mail address or password is incorrect",
|
|
74
|
+
"Forbidden_TooManyAttempts": "You have made too many invalid login attempts, your account has been blocked, please try again later.",
|
|
75
|
+
"Forbidden_UserAccount_NotActive": "It appears that you have not yet confirmed your email address. To complete your registration and access your account, please check your email inbox for a confirmation message. If you haven't received the email, please also check your spam folder. If you need assistance, you can request help via the customer service.",
|
|
76
|
+
"GmErr_BadRequest_ExpiredToken": "The token you are using is expired.",
|
|
77
|
+
"GmErr_BadRequest_INVALID_CODE": "The code you are using is invalid.",
|
|
78
|
+
"GmErr_BadRequest_ATTEMPTS_TO_VALIDATE_CODE_EXCEEDED": "You have made too many attempts to validate your code.",
|
|
79
|
+
"GmErr_BadRequest_ATTEMPTS_TO_GENERATE_CODE_EXCEEDED": "You have made too many attempts to generate your code.",
|
|
80
|
+
"GmErr_BadRequest_BLOCK_USER_INCORRECT_CODE": "You have been blocked due to an invalid code.",
|
|
81
|
+
"GmErr_BadRequest_CODE_MISSING": "The token is missing for your reqest.",
|
|
82
|
+
"GmErr_BadRequest_TOKEN_NOT_FOUND": "The token is not found for your request.",
|
|
83
|
+
"GmErr_BadRequest_USER_NOT_REGISTERED": "The user is not register. Please register first.",
|
|
84
|
+
"GmErr_BadRequest_INVALID_PHONE_NUMBER": "The phone number you are using is invalid.",
|
|
85
|
+
"GmErr_BadRequest_INVALID_USER_ID": "The user ID is invalid.",
|
|
86
|
+
"GmErr_UnexpectedException": "Something went wrong... Please try again.",
|
|
87
|
+
"GmErr_BadRequest_INVALID_USER_DOCUMENT": "The user document is invalid.",
|
|
88
|
+
"GmErr_BadRequest_USER_CROATIAN_MOF_VERIFICATION_FAILURE": "Registration was blocked due to the Croatian Ministry of Finance PersonaID verification failure with reason: MoF response confirms player IS underaged or IS NOT a Croatian resident.",
|
|
89
|
+
"GmErr_BadRequest_USER_CROATIAN_MOF_PROVIDER_COMMUNICATION_ERROR": "Registration was blocked due to the Croatian Ministry of Finance PersonaID verification failure with reason: MoF fails to return a response.",
|
|
90
|
+
"GmErr_BadRequest_USER_CROATIAN_MOF_PROVIDER_UNEXPECTED_ERROR": "Registration was blocked due to the Croatian Ministry of Finance PersonaID verification failure with reason: Internal error.",
|
|
91
|
+
},
|
|
92
|
+
"hu": {
|
|
93
|
+
"GmErr_AMOUNT_INVALID": "A megadott összeg érvénytelen.",
|
|
94
|
+
"GmErr_REGISTER_OVERAGE": "A regisztráció túllépte a megengedett határt.",
|
|
95
|
+
"GmErr_REGISTER_UNDERAGE": "A regisztráció a megengedett határ alatt van.",
|
|
96
|
+
"GmErr_USER_AUTH_FAILED_TOO_MANY_ATTEMPTS": "A felhasználó hitelesítése túl sok sikertelen próbálkozás miatt meghiúsult.",
|
|
97
|
+
"GmErr_USER_ACCOUNT_BLOCKED": "A felhasználói fiók le van tiltva.",
|
|
98
|
+
"GmErr_USER_NOT_VERIFIED": "A felhasználó nincs ellenőrizve.",
|
|
99
|
+
"GmErr_USER_NOT_FOUND": "A megadott adatokkal nem található felhasználó.",
|
|
100
|
+
"GmErr_USER_ID_INVALID": "A megadott felhasználói azonosító érvénytelen.",
|
|
101
|
+
"GmErr_USER_AUTH_FAILED": "A felhasználó hitelesítése meghiúsult.",
|
|
102
|
+
"GmErr_USER_DUPLICATED": "A felhasználó már létezik a rendszerben.",
|
|
103
|
+
"GmErr_USER_NOT_ACTIVATED": "A felhasználó fiókja nincs aktiválva.",
|
|
104
|
+
"GmErr_PASSWORD_CONTAINS_EMAIL": "A jelszó nem tartalmazhat e-mail címet.",
|
|
105
|
+
"GmErr_PASSWORD_CONTAINS_USERNAME": "A jelszó nem tartalmazhat felhasználónevet.",
|
|
106
|
+
"GmErr_PASSWORD_CONTAINS_SPACES": "A jelszó nem tartalmazhat szóközöket.",
|
|
107
|
+
"GmErr_USER_4TS_CHECK_EXISTS": "A felhasználó 4TS ellenőrzése már létezik.",
|
|
108
|
+
"GmErr_USER_NAV_EXCLUDED_REGISTRATION": "A felhasználó kizárva a regisztrációból.",
|
|
109
|
+
"GmErr_USER_NAV_EXCLUDED_LOGIN": "A felhasználó kizárva a bejelentkezésből.",
|
|
110
|
+
"GmErr_USERNAME_REQUIRED": "Felhasználónév megadása szükséges.",
|
|
111
|
+
"GmErr_USER_EMAIL_NOT_VERIFIED": "A felhasználó e-mail címe nincs megerősítve.",
|
|
112
|
+
"GmErr_EMAIL_ALREADY_EXISTS": "A megadott e-mail címmel már létezik felhasználó",
|
|
113
|
+
"GmErr_EMAIL_REQUIRED": "E-mail cím megadása szükséges.",
|
|
114
|
+
"GmErr_USERNAME_ALREADY_EXISTS": "A felhasználónév már foglalt.",
|
|
115
|
+
"GmErr_DUPLICATE_PERSONAL_ID": "Már létező személyes azonosító.",
|
|
116
|
+
"GmErr_INVALID_USER_DOCUMENT": "A felhasználói dokumentum érvénytelen.",
|
|
117
|
+
"GmErr_INVALID_CODE": "A megadott kód érvénytelen.",
|
|
118
|
+
"GmErr_EXPIRED_TOKEN": "A token lejárt.",
|
|
119
|
+
"GmErr_ATTEMPTS_EXCEEDED": "A megengedett próbálkozások száma túllépve.",
|
|
120
|
+
"GmErr_BLOCK_USER_INCORRECT_CODE": "A felhasználó blokkolva lett a hibás kód miatt.",
|
|
121
|
+
"GmErr_TOKEN_NOT_FOUND": "A token nem található.",
|
|
122
|
+
"GmErr_INVALID_PHONE_NUMBER": "A megadott telefonszám érvénytelen.",
|
|
123
|
+
"GmErr_CODE_MISSING": "A szükséges kód hiányzik.",
|
|
124
|
+
"GmErr_UNREGISTERED_USER": "A felhasználó nincs regisztrálva.",
|
|
125
|
+
"GmErr_ATTEMPTS_TO_GENERATE_CODE_EXCEEDED": "Túllépték a kódgenerálási próbálkozások számát.",
|
|
126
|
+
"GmErr_UNEXPECTED_EXCEPTION": "Váratlan kivétel történt.",
|
|
127
|
+
"GmErr_INVALID_USER_ID": "A felhasználói azonosító érvénytelen.",
|
|
128
|
+
"GmErr_NOT_ALLOWED_EXCEPTION": "Ez a művelet nem engedélyezett.",
|
|
129
|
+
"GmErr_CAN_NOT_FIND_ROLE": "A megadott szerepkör nem található.",
|
|
130
|
+
"GmErr_NO_SESSION_PROVIDED": "Nem került megadásra munkamenet.",
|
|
131
|
+
"GmErr_NO_ACTIVE_SESSION_FOUND_FOR_THIS_USER": "Nincs aktív munkamenet ehhez a felhasználóhoz.",
|
|
132
|
+
"GmErr_USER_HAS_ALREADY_BEEN_ANONYMIZED": "A felhasználó már anonimizálva lett.",
|
|
133
|
+
"GmErr_NO_ROLE_HAS_BEEN_SET_UP_TO_BE_ASSIGNED": "Nincs beállítva hozzárendelhető szerepkör.",
|
|
134
|
+
"GmErr_PROVIDED_SESSION_DOES_NOT_BELONG_TO_THE_USER": "A megadott munkamenet nem tartozik a felhasználóhoz.",
|
|
135
|
+
"GmErr_PROVIDED_SESSION_DOES_NOT_EXIST": "A megadott munkamenet nem létezik.",
|
|
136
|
+
"GmErr_ROLE_ALREADY_ASSIGNED_FOR_USER": "A szerepkör már hozzá lett rendelve a felhasználóhoz.",
|
|
137
|
+
"GmErr_ASSIGN_USER_ROLE_FAILED": "Nem sikerült a felhasználói szerepkört hozzárendelni.",
|
|
138
|
+
"GmErr_BadRequest_1000": "Probléma volt a személyi azonosító számmal",
|
|
139
|
+
"CountryRestricted": "Sajnálatos módon olyan országból próbál regisztrálni, ahonnan nem fogadhatunk játékot. Emiatt nem tudjuk feldolgozni a regisztrációját.",
|
|
140
|
+
"nextButton": 'Következő',
|
|
141
|
+
"backButton": 'Vissza',
|
|
142
|
+
"doneButton": 'Kész',
|
|
143
|
+
"generalError": "Valami hiba történt... Próbáld újra.",
|
|
144
|
+
"requestTwofaError": "Hiba történt a kód elküldésekor",
|
|
145
|
+
"successMessage": "Sikeres regisztráció",
|
|
146
|
+
"loadingMessage": "Kérjük, várjon, betöltés folyamatban...",
|
|
147
|
+
//Prod old errors which will be deleted after prod is updated to new keys.
|
|
148
|
+
"GmErr_BadRequest_Duplicate_User": 'Egy ilyen információval rendelkező felhasználó már létezik.',
|
|
149
|
+
"GmErr_BadRequest_PasswordContainsUsername": "A jelszó nem lehet azonos a felhasználónévvel.",
|
|
150
|
+
"GmErr_BadRequest_PasswordContainsEmail": "A jelszó nem lehet azonos az e-mail címmel.",
|
|
151
|
+
"GmErr_BadRequest_Duplicate_PersonalId": "Már létezik egy regisztráció az Ön által megadott adatokkal, vagy helytelen formátumban adta meg az adatokat.",
|
|
152
|
+
"GmErr_Forbidden_UserAccount_NavExcluded": 'A felhasználó NAV kizárt. A regisztrációt elutasították.',
|
|
153
|
+
"GmErr_BadRequest_ModelValidationFailed": 'Valami hiba történt... Kérjük, próbálja újra.',
|
|
154
|
+
"GmErr_BadInternalConfigs": 'Valami hiba történt... Kérjük, próbálja újra.',
|
|
155
|
+
"GmErr_Unauthorized": 'Valami hiba történt... Kérjük, próbálja újra.',
|
|
156
|
+
"GmErr_NotFound": 'Valami hiba történt... Kérjük, próbálja újra.',
|
|
157
|
+
"BadRequest_Duplicate_User": "Már létezik egy felhasználó ugyanazzal a felhasználónévvel.",
|
|
158
|
+
"BadRequest": "A kérés érvénytelen, kérjük, ellenőrizze az API-t.",
|
|
159
|
+
"Unauthorized": "A játékos számlaszáma, e-mail címe vagy jelszava helytelen",
|
|
160
|
+
"Forbidden_TooManyAttempts": "Túl sok érvénytelen bejelentkezési kísérletet tett, fiókját zárolták, kérjük, próbálja újra később.",
|
|
161
|
+
"Forbidden_UserAccount_NotActive": "Úgy tűnik, még nem erősítette meg e-mail címét. A regisztráció befejezéséhez és fiókjához való hozzáféréshez kérjük, ellenőrizze e-mail fiókját egy megerősítő üzenetért. Ha nem kapta meg az e-mailt, kérjük, ellenőrizze a spam mappát is. Ha segítségre van szüksége, kérhet segítséget az ügyfélszolgálaton keresztül.",
|
|
162
|
+
"GmErr_BadRequest_ExpiredToken": "A használt token lejárt.",
|
|
163
|
+
"GmErr_BadRequest_INVALID_CODE": "A használt kód érvénytelen.",
|
|
164
|
+
"GmErr_BadRequest_ATTEMPTS_TO_VALIDATE_CODE_EXCEEDED": "Túl sok kísérletet tett a kód érvényesítésére.",
|
|
165
|
+
"GmErr_BadRequest_ATTEMPTS_TO_GENERATE_CODE_EXCEEDED": "Túl sok kísérletet tett a kód generálására.",
|
|
166
|
+
"GmErr_BadRequest_BLOCK_USER_INCORRECT_CODE": "Érvénytelen kód miatt zárolták.",
|
|
167
|
+
"GmErr_BadRequest_CODE_MISSING": "A kéréshez hiányzik a token.",
|
|
168
|
+
"GmErr_BadRequest_TOKEN_NOT_FOUND": "A kéréshez nem található token.",
|
|
169
|
+
"GmErr_BadRequest_USER_NOT_REGISTERED": "A felhasználó nincs regisztrálva. Kérjük, regisztráljon először.",
|
|
170
|
+
"GmErr_BadRequest_INVALID_PHONE_NUMBER": "A használt telefonszám érvénytelen.",
|
|
171
|
+
"GmErr_BadRequest_INVALID_USER_ID": "A felhasználói azonosító érvénytelen.",
|
|
172
|
+
"GmErr_UnexpectedException": "Valami hiba történt... Kérjük, próbálja újra.",
|
|
173
|
+
"GmErr_BadRequest_INVALID_USER_DOCUMENT": "A felhasználói dokumentum érvénytelen.",
|
|
174
|
+
"GmErr_BadRequest_USER_CROATIAN_MOF_VERIFICATION_FAILURE": "A regisztrációt blokkolták a horvát Pénzügyminisztérium PersonaID ellenőrzési hibája miatt az alábbi okkal: A MoF válasza megerősíti, hogy a játékos kiskorú vagy nem horvát lakos.",
|
|
175
|
+
"GmErr_BadRequest_USER_CROATIAN_MOF_PROVIDER_COMMUNICATION_ERROR": "A regisztrációt blokkolták a horvát Pénzügyminisztérium PersonaID ellenőrzési hibája miatt az alábbi okkal: A MoF nem ad választ.",
|
|
176
|
+
"GmErr_BadRequest_USER_CROATIAN_MOF_PROVIDER_UNEXPECTED_ERROR": "A regisztrációt blokkolták a horvát Pénzügyminisztérium PersonaID ellenőrzési hibája miatt az alábbi okkal: Belső hiba.",
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
const getTranslations = (url) => {
|
|
180
|
+
// fetch url, get the data, replace the TRANSLATIONS content
|
|
181
|
+
return new Promise((resolve) => {
|
|
182
|
+
fetch(url)
|
|
183
|
+
.then((res) => res.json())
|
|
184
|
+
.then((data) => {
|
|
185
|
+
Object.keys(data).forEach((item) => {
|
|
186
|
+
TRANSLATIONS[item] = TRANSLATIONS[item] || {};
|
|
187
|
+
for (let key in data[item]) {
|
|
188
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
resolve(true);
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
const translate = (key, customLang, values) => {
|
|
196
|
+
let lang = TRANSLATIONS[customLang] ? customLang : DEFAULT_LANGUAGE;
|
|
197
|
+
let translation = TRANSLATIONS[lang][key];
|
|
198
|
+
if (values !== undefined) {
|
|
199
|
+
for (const [key, value] of Object.entries(values.values)) {
|
|
200
|
+
const regex = new RegExp(`{${key}}`, 'g');
|
|
201
|
+
translation = translation.replace(regex, value);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return translation;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* @name dispatchCustomEvent
|
|
209
|
+
* @description dispatches the custom event CustomEventProcessor is listening for
|
|
210
|
+
* @param {string} type of the custom event
|
|
211
|
+
* @param {Object} data may contain additional information about the event, e.g. userId
|
|
212
|
+
*/
|
|
213
|
+
const dispatchCustomEvent = (type, data = {}) => {
|
|
214
|
+
const event = new CustomEvent('track-custom-event', {
|
|
215
|
+
detail: {
|
|
216
|
+
type,
|
|
217
|
+
data
|
|
218
|
+
},
|
|
219
|
+
bubbles: true,
|
|
220
|
+
composed: true
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
document.dispatchEvent(event);
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
const generalRegistrationHslCss = "*,\n*::before,\n*::after {\n padding: 0;\n margin: 0;\n box-sizing: border-box;\n}\n\n.registration__form.hidden {\n display: none;\n}\n\n.registration {\n font-family: \"Roboto\";\n font-style: normal;\n font-family: sans-serif;\n display: flex;\n flex-direction: column;\n gap: 24px;\n width: 100%;\n height: 100%;\n container-type: inline-size;\n}\n.registration__wrapper {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.registration__error-message {\n color: var(--emw--color-error, var(--emw--color-red, #ed0909));\n font-size: var(--emw-font-size-small, 13px);\n display: block;\n justify-content: center;\n text-align: center;\n}\n.registration__loading-message {\n padding-top: 20px;\n text-align: center;\n}\n.registration__form {\n display: grid;\n grid-template-columns: repeat(1, 1fr);\n gap: 40px;\n justify-items: stretch;\n align-content: flex-start;\n overflow: auto;\n width: 100%;\n height: 100%;\n}\n.registration__buttons-wrapper {\n display: flex;\n flex-direction: column;\n justify-content: space-around;\n align-items: center;\n position: relative;\n}\n.registration__button {\n border-radius: 5px;\n background: var(--emw--login-color-primary, var(--emw--color-primary, #22B04E));\n border: 1px solid var(--emw--login-color-primary, var(--emw--color-primary, #22B04E));\n color: var(--emw--button-typography, var(--emw--color-white, #FFFFFF));\n text-transform: uppercase;\n font-size: 20px;\n height: 44px;\n width: 100%;\n margin: 0px auto;\n padding: 10px 20px;\n font-weight: normal;\n box-shadow: none;\n cursor: pointer;\n}\n.registration__button--disabled {\n background: var(--emw--color-gray-100, #E6E6E6);\n border: 1px solid var(--emw--color-gray-150, #828282);\n pointer-events: none;\n box-shadow: none;\n}\n.registration__button--first-step {\n display: none;\n}\n\n@container (min-width: 450px) {\n .registration__form {\n grid-template-columns: repeat(2, 1fr);\n }\n .registration__buttons-wrapper {\n flex-direction: row-reverse;\n gap: 15px;\n }\n}\n.spinner {\n animation: rotate 2s linear infinite;\n z-index: 2;\n position: absolute;\n top: 50%;\n left: 50%;\n margin: -25px 0 0 -25px;\n width: 50px;\n height: 50px;\n}\n.spinner .path {\n stroke: var(--emw--login-color-primary, var(--emw--color-primary, #22B04E));\n stroke-linecap: round;\n animation: dash 1.5s ease-in-out infinite;\n}\n\n.input-description {\n margin-top: 5px;\n font-size: var(--emw-font-size-x-small, 12px);\n}\n\n@keyframes rotate {\n 100% {\n transform: rotate(360deg);\n }\n}\n@keyframes dash {\n 0% {\n stroke-dasharray: 1, 150;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -35;\n }\n 100% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -124;\n }\n}";
|
|
227
|
+
const GeneralRegistrationHslStyle0 = generalRegistrationHslCss;
|
|
228
|
+
|
|
229
|
+
const GeneralRegistrationHsl = class {
|
|
230
|
+
constructor(hostRef) {
|
|
231
|
+
registerInstance(this, hostRef);
|
|
232
|
+
this.registrationWidgetLoaded = createEvent(this, "registrationWidgetLoaded", 7);
|
|
233
|
+
this.registrationStepUpdated = createEvent(this, "registrationStepUpdated", 7);
|
|
234
|
+
this.validationChange = createEvent(this, "validationChange", 7);
|
|
235
|
+
this.listOfInputValues = [];
|
|
236
|
+
this.listOfInputValidity = [];
|
|
237
|
+
this.listOfActions = [];
|
|
238
|
+
this.listOfInputs = [];
|
|
239
|
+
this.conditionalValidationMap = {};
|
|
240
|
+
this.lastStep = '';
|
|
241
|
+
this.emitValue = false;
|
|
242
|
+
this.form = null;
|
|
243
|
+
this.errorCode = '';
|
|
244
|
+
this.backButtonPressed = false;
|
|
245
|
+
this.registerErrors = false;
|
|
246
|
+
this.extraActions = [];
|
|
247
|
+
this.registerCredentialsEvent = null;
|
|
248
|
+
this.twofaDestination = '';
|
|
249
|
+
this.registrationStepsState = {
|
|
250
|
+
regId: null
|
|
251
|
+
};
|
|
252
|
+
this.setClientStyling = () => {
|
|
253
|
+
let sheet = document.createElement('style');
|
|
254
|
+
sheet.innerHTML = this.clientStyling;
|
|
255
|
+
this.host.shadowRoot.prepend(sheet);
|
|
256
|
+
};
|
|
257
|
+
this.setClientStylingURL = () => {
|
|
258
|
+
let url = new URL(this.clientStylingUrl);
|
|
259
|
+
let cssFile = document.createElement('style');
|
|
260
|
+
fetch(url.href)
|
|
261
|
+
.then((res) => res.text())
|
|
262
|
+
.then((data) => {
|
|
263
|
+
cssFile.innerHTML = data;
|
|
264
|
+
this.clientStyling = data;
|
|
265
|
+
setTimeout(() => { this.host.shadowRoot.prepend(cssFile); }, 1);
|
|
266
|
+
});
|
|
267
|
+
};
|
|
268
|
+
this.setStreamStyling = (domain) => {
|
|
269
|
+
if (window.emMessageBus) {
|
|
270
|
+
const sheet = document.createElement('style');
|
|
271
|
+
this.stylingSubscription = window.emMessageBus.subscribe(domain, (data) => {
|
|
272
|
+
sheet.innerHTML = data;
|
|
273
|
+
this.clientStyling = data;
|
|
274
|
+
this.host.shadowRoot.prepend(sheet);
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
// handles sending a custom event for initial interaction with the registration form
|
|
279
|
+
this.handleInitialClick = (e) => {
|
|
280
|
+
if (!this.isInitalInteraction)
|
|
281
|
+
return;
|
|
282
|
+
dispatchCustomEvent('register_start', { field: e.target.name });
|
|
283
|
+
this.isInitalInteraction = false;
|
|
284
|
+
};
|
|
285
|
+
this.endpoint = undefined;
|
|
286
|
+
this.language = 'en';
|
|
287
|
+
this.clientStyling = '';
|
|
288
|
+
this.mbSource = undefined;
|
|
289
|
+
this.clientStylingUrl = '';
|
|
290
|
+
this.translationUrl = '';
|
|
291
|
+
this.dateFormat = undefined;
|
|
292
|
+
this.buttonInsideForm = undefined;
|
|
293
|
+
this.btag = null;
|
|
294
|
+
this.emitOnClick = false;
|
|
295
|
+
this.errorMessage = '';
|
|
296
|
+
this.isFormValid = false;
|
|
297
|
+
this.isConsentValid = false;
|
|
298
|
+
this.isConsentReady = false;
|
|
299
|
+
this.isLoading = true;
|
|
300
|
+
this.isLoadingPOST = false;
|
|
301
|
+
this.registrationStep = '';
|
|
302
|
+
this.forms = [];
|
|
303
|
+
this.limitStylingAppends = false;
|
|
304
|
+
this.autofilled = false;
|
|
305
|
+
this.isInitalInteraction = true;
|
|
306
|
+
}
|
|
307
|
+
sendStep() {
|
|
308
|
+
this.registrationStepUpdated.emit(this.registrationStep);
|
|
309
|
+
window.postMessage({ type: 'registrationStepUpdated', step: this.registrationStep }, window.location.href);
|
|
310
|
+
}
|
|
311
|
+
handleStylingChange(newValue, oldValue) {
|
|
312
|
+
if (newValue !== oldValue)
|
|
313
|
+
this.setClientStyling();
|
|
314
|
+
}
|
|
315
|
+
handleStylingUrlChange(newValue, oldValue) {
|
|
316
|
+
if (newValue !== oldValue)
|
|
317
|
+
this.setClientStylingURL();
|
|
318
|
+
}
|
|
319
|
+
setFormValidity() {
|
|
320
|
+
this.errorMessage = '';
|
|
321
|
+
if (this.listOfInputValidity) {
|
|
322
|
+
this.isFormValid = !this.getInvalidStatus(this.listOfInputValidity);
|
|
323
|
+
}
|
|
324
|
+
//Check for autofilled.
|
|
325
|
+
if (this.listOfInputs.some(inputs => inputs.autofill)) {
|
|
326
|
+
this.autofilled = true;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
addBtag() {
|
|
330
|
+
this.addBtagValue();
|
|
331
|
+
}
|
|
332
|
+
checkInputsValidityHandler(event) {
|
|
333
|
+
// Set isValid state of the input in the list.
|
|
334
|
+
this.listOfInputValidity.find(input => input.name == event.detail.name).isValid = event.detail.valid;
|
|
335
|
+
// Check if any one is invalid.
|
|
336
|
+
this.isFormValid = !this.getInvalidStatus(this.listOfInputValidity);
|
|
337
|
+
}
|
|
338
|
+
getInputsValueHandler(event) {
|
|
339
|
+
this.listOfInputValues.find(input => {
|
|
340
|
+
if (input.name == event.detail.name) {
|
|
341
|
+
input.value = event.detail.value;
|
|
342
|
+
input.type = event.detail.type || null;
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
this.stepsStateMachine({ event: 'set', type: 'values' });
|
|
346
|
+
this.handleConditionalValidation(event.detail.name, event.detail.value);
|
|
347
|
+
}
|
|
348
|
+
handleRequestTwofa() {
|
|
349
|
+
if (!this.twofaDestination)
|
|
350
|
+
return;
|
|
351
|
+
const url = new URL('api/v1/gm/legislation/twoFaCode/', this.endpoint);
|
|
352
|
+
const headers = new Headers({
|
|
353
|
+
'Content-Type': 'application/problem+json; charset=utf-8'
|
|
354
|
+
});
|
|
355
|
+
const body = JSON.stringify({
|
|
356
|
+
channel: 'Sms',
|
|
357
|
+
destination: this.twofaDestination
|
|
358
|
+
});
|
|
359
|
+
const options = { method: 'POST', headers, body };
|
|
360
|
+
fetch(url.href, options)
|
|
361
|
+
.then(res => {
|
|
362
|
+
if (res.ok)
|
|
363
|
+
return;
|
|
364
|
+
res.json().then(err => {
|
|
365
|
+
var _a;
|
|
366
|
+
const errorCode = (_a = err.thirdPartyResponse) === null || _a === void 0 ? void 0 : _a.errorCode;
|
|
367
|
+
this.errorMessage = translate(errorCode, this.language) || translate('requestTwofaError', this.language);
|
|
368
|
+
});
|
|
369
|
+
})
|
|
370
|
+
.catch((err) => console.log(err));
|
|
371
|
+
}
|
|
372
|
+
messageHandler(e) {
|
|
373
|
+
//Handle Consents Message
|
|
374
|
+
if (!e.data)
|
|
375
|
+
return;
|
|
376
|
+
switch (e.data.type) {
|
|
377
|
+
case 'isConsentsValid':
|
|
378
|
+
this.listOfInputValidity.find((input) => input.name === "Consents").isValid = e.data.isValid;
|
|
379
|
+
this.isConsentValid = e.data.isValid;
|
|
380
|
+
this.isFormValid = !this.getInvalidStatus(this.listOfInputValidity);
|
|
381
|
+
break;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
componentWillLoad() {
|
|
385
|
+
return this.getRegisterConfig()
|
|
386
|
+
.then((config) => {
|
|
387
|
+
this.formatConfig(config);
|
|
388
|
+
this.isFormValid = !this.getInvalidStatus(this.listOfInputValidity);
|
|
389
|
+
this.stepsStateMachine({ event: 'set', type: 'inputs' });
|
|
390
|
+
this.setupConditionalValidationMap();
|
|
391
|
+
}, (err) => {
|
|
392
|
+
console.error(err);
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
componentDidLoad() {
|
|
396
|
+
this.registrationWidgetLoaded.emit();
|
|
397
|
+
window.postMessage({ type: 'registrationWidgetLoaded' }, window.location.href);
|
|
398
|
+
if (!this.limitStylingAppends && this.host) {
|
|
399
|
+
if (window.emMessageBus != undefined) {
|
|
400
|
+
this.setStreamStyling(`${this.mbSource}.Style`);
|
|
401
|
+
}
|
|
402
|
+
else {
|
|
403
|
+
if (this.clientStyling)
|
|
404
|
+
this.setClientStyling();
|
|
405
|
+
if (this.clientStylingUrl)
|
|
406
|
+
this.setClientStylingURL();
|
|
407
|
+
this.limitStylingAppends = true;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
disconnectedCallback() {
|
|
412
|
+
this.stylingSubscription && this.stylingSubscription.unsubscribe();
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* This function produces the conditionalValidationMap object presented below
|
|
416
|
+
*
|
|
417
|
+
* this.conditionalValidationMap =
|
|
418
|
+
* {
|
|
419
|
+
* correlationField: {
|
|
420
|
+
* correlationValue: {
|
|
421
|
+
* field: {
|
|
422
|
+
* ...validation
|
|
423
|
+
* },
|
|
424
|
+
* ...
|
|
425
|
+
* },
|
|
426
|
+
* ...
|
|
427
|
+
* },
|
|
428
|
+
* ...
|
|
429
|
+
* }
|
|
430
|
+
*
|
|
431
|
+
* - this object describes the conditional validation of some fields based on the value of others.
|
|
432
|
+
* - correlationField is the conditioning field, correlationValue is the value of the correlationField for which
|
|
433
|
+
* a certain validation is applied to the affected fields. {...validation} is an object of type ValidationSchema
|
|
434
|
+
*/
|
|
435
|
+
setupConditionalValidationMap() {
|
|
436
|
+
for (const input of this.listOfInputs) {
|
|
437
|
+
// unconditioned rules (i.e correlationField and corrlationValue == null)
|
|
438
|
+
const staticRules = [];
|
|
439
|
+
// conditional rules
|
|
440
|
+
const conditionalRules = [];
|
|
441
|
+
for (const rule of input.validate.custom) {
|
|
442
|
+
if (!rule.correlationField || !rule.correlationValue) {
|
|
443
|
+
staticRules.push(rule);
|
|
444
|
+
continue;
|
|
445
|
+
}
|
|
446
|
+
conditionalRules.push(rule);
|
|
447
|
+
}
|
|
448
|
+
for (const rule of conditionalRules) {
|
|
449
|
+
if (rule.rule === 'regex') {
|
|
450
|
+
/**
|
|
451
|
+
* copy the original validation, replace the original "custom" rules (which contain all conditional rules)
|
|
452
|
+
* with only one conditional rule + all static rules, resulting in the validation for ${input} when
|
|
453
|
+
* ${rule.correlationField} takes value ${rule.correlationValue}
|
|
454
|
+
*/
|
|
455
|
+
const validate = Object.assign({}, input.validate);
|
|
456
|
+
validate.custom = [...staticRules, rule];
|
|
457
|
+
const cf = rule.correlationField;
|
|
458
|
+
const cv = rule.correlationValue;
|
|
459
|
+
// assign new validation to ${input}
|
|
460
|
+
this.conditionalValidationMap[cf] = this.conditionalValidationMap[cf] || {};
|
|
461
|
+
this.conditionalValidationMap[cf][cv] = this.conditionalValidationMap[cf][cv] || {};
|
|
462
|
+
this.conditionalValidationMap[cf][cv][input.name] = validate;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Whenever a field changes its value, we check if it is conditioning any other fields and
|
|
469
|
+
* if it is we update the validation of the affected fields.
|
|
470
|
+
*/
|
|
471
|
+
handleConditionalValidation(correlationField, correlationValue) {
|
|
472
|
+
if (!this.conditionalValidationMap[correlationField] ||
|
|
473
|
+
!this.conditionalValidationMap[correlationField][correlationValue]) {
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
for (const [field, validation] of Object.entries(this.conditionalValidationMap[correlationField][correlationValue])) {
|
|
477
|
+
const registrationStepIdx = this.registrationStep && parseInt(this.registrationStep.replace('Step', '')) - 1;
|
|
478
|
+
this.forms[registrationStepIdx][this.registrationStep].find(item => item.name === field).validate = validation;
|
|
479
|
+
this.validationChange.emit({ validation, field });
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
nextHandler(e) {
|
|
483
|
+
e.preventDefault();
|
|
484
|
+
// Trigger events in subwidgets.
|
|
485
|
+
this.emitValue = true;
|
|
486
|
+
this.errorMessage = '';
|
|
487
|
+
this.registerErrors = false;
|
|
488
|
+
this.setRegisterStep();
|
|
489
|
+
}
|
|
490
|
+
backHandler(e) {
|
|
491
|
+
e.preventDefault();
|
|
492
|
+
this.registrationStep = this.stepChange('decrement');
|
|
493
|
+
this.errorMessage = '';
|
|
494
|
+
this.stepsStateMachine({ event: 'get', type: 'inputs' });
|
|
495
|
+
this.stepsStateMachine({ event: 'get', type: 'values' });
|
|
496
|
+
}
|
|
497
|
+
dispatchRegisterCredentialsEvent() {
|
|
498
|
+
let userNameEmail = '';
|
|
499
|
+
let userPassword = '';
|
|
500
|
+
Object.keys(this.registrationStepsState).forEach((step) => {
|
|
501
|
+
if (!this.registrationStepsState[step]['registerUserData'])
|
|
502
|
+
return;
|
|
503
|
+
if (!userNameEmail) {
|
|
504
|
+
userNameEmail = this.registrationStepsState[step]['registerUserData']['Email']
|
|
505
|
+
? this.registrationStepsState[step]['registerUserData']['Email']['value']
|
|
506
|
+
: userNameEmail;
|
|
507
|
+
}
|
|
508
|
+
if (!userPassword) {
|
|
509
|
+
userPassword = this.registrationStepsState[step]['registerUserData']['Password']
|
|
510
|
+
? this.registrationStepsState[step]['registerUserData']['Password']['value']
|
|
511
|
+
: userPassword;
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
this.registerCredentialsEvent = new CustomEvent('RegisterCredentials', {
|
|
515
|
+
bubbles: true,
|
|
516
|
+
detail: {
|
|
517
|
+
userNameEmail: userNameEmail,
|
|
518
|
+
userPassword: userPassword
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
window.dispatchEvent(this.registerCredentialsEvent);
|
|
522
|
+
}
|
|
523
|
+
stepsStateMachine(state) {
|
|
524
|
+
const saveToLocalStorage = () => {
|
|
525
|
+
localStorage.setItem('registrationStepsState', JSON.stringify(this.registrationStepsState));
|
|
526
|
+
};
|
|
527
|
+
const loadFromLocalStorage = () => {
|
|
528
|
+
return JSON.parse(localStorage.getItem('registrationStepsState'));
|
|
529
|
+
};
|
|
530
|
+
switch (state.event) {
|
|
531
|
+
case 'set':
|
|
532
|
+
if (state.type == 'inputs') {
|
|
533
|
+
// Store input-related data into the current step state
|
|
534
|
+
const currentStep = this.registrationStepsState[this.registrationStep];
|
|
535
|
+
currentStep.fields = this.listOfInputs;
|
|
536
|
+
currentStep.actions = this.listOfActions;
|
|
537
|
+
currentStep.fieldsValidity = this.listOfInputValidity;
|
|
538
|
+
}
|
|
539
|
+
if (state.type == 'values') {
|
|
540
|
+
// Map input values into the current step state
|
|
541
|
+
const currentStep = this.registrationStepsState[this.registrationStep];
|
|
542
|
+
currentStep.registerUserData = this.listOfInputValues.reduce((acc, curr) => {
|
|
543
|
+
acc[curr.name] = { value: curr.value, isDuplicate: curr.isDuplicate };
|
|
544
|
+
return acc;
|
|
545
|
+
}, {});
|
|
546
|
+
}
|
|
547
|
+
saveToLocalStorage();
|
|
548
|
+
break;
|
|
549
|
+
case 'get':
|
|
550
|
+
const savedUserData = loadFromLocalStorage();
|
|
551
|
+
if (!savedUserData)
|
|
552
|
+
return;
|
|
553
|
+
if (state.type == 'inputs') {
|
|
554
|
+
// Load input-related data from the saved state
|
|
555
|
+
const currentStep = this.registrationStepsState[this.registrationStep];
|
|
556
|
+
this.listOfInputs = currentStep.fields;
|
|
557
|
+
this.listOfActions = currentStep.actions;
|
|
558
|
+
this.listOfInputValidity = currentStep.fieldsValidity;
|
|
559
|
+
}
|
|
560
|
+
if (state.type == 'values') {
|
|
561
|
+
const savedValues = savedUserData[this.registrationStep].registerUserData;
|
|
562
|
+
// Convert saved values to the expected format for inputs
|
|
563
|
+
this.listOfInputValues = Object.keys(savedValues).map(name => {
|
|
564
|
+
return { name, value: savedValues[name].value, isDuplicate: savedValues[name].isDuplicate };
|
|
565
|
+
});
|
|
566
|
+
// Give to each field the user input as the default value.
|
|
567
|
+
this.listOfInputValues.forEach(inputValue => {
|
|
568
|
+
const input = this.listOfInputs.find(input => input.name === inputValue.name);
|
|
569
|
+
if (input) {
|
|
570
|
+
input.defaultValue = inputValue.value;
|
|
571
|
+
// if the input is a togglecheckbox, set the default value for each subfield.
|
|
572
|
+
if (input.inputType === 'togglecheckbox') {
|
|
573
|
+
input.data.subFields.forEach((subfield) => {
|
|
574
|
+
const subfieldValue = this.listOfInputValues.find(subfieldValue => subfieldValue.name === subfield.name);
|
|
575
|
+
subfield.defaultValue = subfieldValue.value;
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
this.isConsentReady = this.listOfActions.some(action => action === '/Consents');
|
|
582
|
+
this.isFormValid = !this.getInvalidStatus(this.listOfInputValidity);
|
|
583
|
+
break;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
triggerNotification(errMsg, errType = 'WidgetNotification') {
|
|
587
|
+
window.postMessage({
|
|
588
|
+
type: errType,
|
|
589
|
+
data: {
|
|
590
|
+
type: 'error',
|
|
591
|
+
message: errMsg
|
|
592
|
+
}
|
|
593
|
+
}, window.location.href);
|
|
594
|
+
}
|
|
595
|
+
getRegisterConfig(registrationID) {
|
|
596
|
+
const url = new URL('v1/player/legislation/registration/config/', this.endpoint);
|
|
597
|
+
const headers = new Headers();
|
|
598
|
+
headers.append('Content-Type', 'application/json');
|
|
599
|
+
headers.append('Accept', 'application/json');
|
|
600
|
+
if (registrationID) {
|
|
601
|
+
url.searchParams.append('registrationId', registrationID);
|
|
602
|
+
}
|
|
603
|
+
const options = {
|
|
604
|
+
method: 'GET',
|
|
605
|
+
headers
|
|
606
|
+
};
|
|
607
|
+
return new Promise((resolve, reject) => {
|
|
608
|
+
this.isLoading = true;
|
|
609
|
+
fetch(url.href, options)
|
|
610
|
+
.then((res) => {
|
|
611
|
+
if (!res.ok) {
|
|
612
|
+
this.registerErrors = true;
|
|
613
|
+
return res.json().then(error => {
|
|
614
|
+
this.errorCode = error.thirdPartyResponse.errorCode;
|
|
615
|
+
this.errorMessage = translate(`${this.errorCode}`, this.language) || translate(`generalError`, this.language);
|
|
616
|
+
this.triggerNotification(this.errorMessage);
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
return res.json();
|
|
620
|
+
})
|
|
621
|
+
.then((config) => {
|
|
622
|
+
this.isLoading = false;
|
|
623
|
+
if (!config) {
|
|
624
|
+
return reject('Get register config is empty or has an error.');
|
|
625
|
+
}
|
|
626
|
+
return resolve(config);
|
|
627
|
+
}, (err) => {
|
|
628
|
+
console.error('Get register config is empty or has an error: ', err);
|
|
629
|
+
return reject(err);
|
|
630
|
+
}).finally(() => {
|
|
631
|
+
this.isLoading = false;
|
|
632
|
+
});
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
setRegisterStep() {
|
|
636
|
+
this.isLoadingPOST = true;
|
|
637
|
+
const url = new URL('v1/player/legislation/registration/step/', this.endpoint);
|
|
638
|
+
const registerStep = {
|
|
639
|
+
registrationId: this.registrationID,
|
|
640
|
+
registerUserDto: this.listOfInputValues
|
|
641
|
+
.filter(input => !input.isDuplicate)
|
|
642
|
+
.reduce((acc, curr) => {
|
|
643
|
+
// Because the API is very robust, some values need to be split as separate entities.
|
|
644
|
+
if (curr.name === 'TypeOfPublicArea') {
|
|
645
|
+
acc[curr.name] = curr.value.toLowerCase();
|
|
646
|
+
}
|
|
647
|
+
else if (curr.type === 'tel') {
|
|
648
|
+
//@ts-ignore
|
|
649
|
+
acc['MobilePrefix'] = curr.value.prefix;
|
|
650
|
+
//@ts-ignore
|
|
651
|
+
acc[curr.name] = curr.value.phone;
|
|
652
|
+
}
|
|
653
|
+
else if (curr.type === 'checkboxgroup') {
|
|
654
|
+
// Skip adding the parent of the checkboxgroup as a key.
|
|
655
|
+
if (curr.value !== null) {
|
|
656
|
+
Object.entries(curr.value).forEach(([key, value]) => {
|
|
657
|
+
acc[key] = value ? 'true' : 'false';
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
else if (curr.type === 'toggle') {
|
|
662
|
+
acc[curr.name] = curr.value ? 'true' : 'false';
|
|
663
|
+
}
|
|
664
|
+
else {
|
|
665
|
+
acc[curr.name] = curr.value;
|
|
666
|
+
}
|
|
667
|
+
return acc;
|
|
668
|
+
}, {}),
|
|
669
|
+
step: this.registrationStep,
|
|
670
|
+
};
|
|
671
|
+
const headers = new Headers();
|
|
672
|
+
headers.append('Content-Type', 'application/json');
|
|
673
|
+
headers.append('Accept', 'application/json');
|
|
674
|
+
const options = {
|
|
675
|
+
method: 'POST',
|
|
676
|
+
body: JSON.stringify(registerStep),
|
|
677
|
+
headers
|
|
678
|
+
};
|
|
679
|
+
fetch(url.href, options)
|
|
680
|
+
.then((res) => {
|
|
681
|
+
if (!res.ok) {
|
|
682
|
+
return res.json().then(error => {
|
|
683
|
+
this.errorCode = error.thirdPartyResponse.errorCode;
|
|
684
|
+
// Show the idomsoft error if it is the case
|
|
685
|
+
if (this.errorCode == 'GmErr_BadRequest_IdomsoftVerification_ShouldRetry') {
|
|
686
|
+
this.errorMessage = error.thirdPartyResponse.message;
|
|
687
|
+
}
|
|
688
|
+
else if (this.errorCode === 'GmErr_Forbidden_UserAccount_NavExcluded') {
|
|
689
|
+
this.errorMessage = translate(`${this.errorCode}`, this.language);
|
|
690
|
+
}
|
|
691
|
+
else if (this.errorCode == 'GmErr_BadRequest') {
|
|
692
|
+
this.errorMessage = error.thirdPartyResponse.message;
|
|
693
|
+
}
|
|
694
|
+
else {
|
|
695
|
+
this.errorMessage = translate(`${this.errorCode}`, this.language) || translate(`generalError`, this.language);
|
|
696
|
+
}
|
|
697
|
+
this.triggerNotification(this.errorMessage);
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
// handles sending suctom events and the requested data for each registration step
|
|
701
|
+
if (this.registrationStep === 'Step1') {
|
|
702
|
+
const eventData = {
|
|
703
|
+
// @ts-ignore
|
|
704
|
+
IBAN: registerStep.registerUserDto.IBAN,
|
|
705
|
+
// @ts-ignore
|
|
706
|
+
username: registerStep.registerUserDto.Username,
|
|
707
|
+
};
|
|
708
|
+
dispatchCustomEvent('register_step1', { eventLabel: this.registrationStep, eventAction: 'nextStep', eventCategory: 'Registration', eventData: eventData });
|
|
709
|
+
}
|
|
710
|
+
else if (this.registrationStep === 'Step2') {
|
|
711
|
+
const eventData = {
|
|
712
|
+
// @ts-ignore
|
|
713
|
+
gender: registerStep.registerUserDto.Gender,
|
|
714
|
+
// @ts-ignore
|
|
715
|
+
fullName: `${registerStep.registerUserDto.FirstnameOnDocument} ${registerStep.registerUserDto.LastNameOnDocument}`,
|
|
716
|
+
// @ts-ignore
|
|
717
|
+
city: registerStep.registerUserDto.City
|
|
718
|
+
};
|
|
719
|
+
dispatchCustomEvent('register_step2', { eventLabel: this.registrationStep, eventAction: 'nextStep', eventCategory: 'Registration', eventData: eventData });
|
|
720
|
+
}
|
|
721
|
+
else if (this.registrationStep === 'Step3') {
|
|
722
|
+
const eventData = {
|
|
723
|
+
// @ts-ignore
|
|
724
|
+
OIB: registerStep.registerUserDto.PersonalID,
|
|
725
|
+
// @ts-ignore
|
|
726
|
+
documentType: registerStep.registerUserDto.DocumentType,
|
|
727
|
+
};
|
|
728
|
+
dispatchCustomEvent('register_step3', { eventLabel: this.registrationStep, eventAction: 'nextStep', eventCategory: 'Registration', eventData: eventData });
|
|
729
|
+
}
|
|
730
|
+
return res.json();
|
|
731
|
+
})
|
|
732
|
+
.then((data) => {
|
|
733
|
+
this.isLoadingPOST = false;
|
|
734
|
+
this.registrationID = data.registrationId;
|
|
735
|
+
if (this.listOfActions.find(action => action === '/request-2FA')) {
|
|
736
|
+
this.twofaDestination = Object.values(this.listOfInputValues.find(item => item.type === 'tel').value).join('');
|
|
737
|
+
this.handleRequestTwofa();
|
|
738
|
+
}
|
|
739
|
+
if (this.listOfActions.some(action => action == '/register')) {
|
|
740
|
+
if (this.listOfActions.some(action => action == '/generate-2FA-code/Generate2FACode')) {
|
|
741
|
+
this.extraActions.push('2fa');
|
|
742
|
+
}
|
|
743
|
+
if (localStorage.getItem('playerConsents')) {
|
|
744
|
+
localStorage.removeItem("playerConsents");
|
|
745
|
+
}
|
|
746
|
+
this.setRegister();
|
|
747
|
+
}
|
|
748
|
+
else {
|
|
749
|
+
if (this.isConsentValid) {
|
|
750
|
+
window.postMessage({ type: 'setUpPlayerConsents', registerid: this.registrationID });
|
|
751
|
+
}
|
|
752
|
+
// After sending the current step, increment and check if the next one is in state.
|
|
753
|
+
this.registrationStep = this.stepChange('increment');
|
|
754
|
+
// If step is present in state do NOT fetch the next config.
|
|
755
|
+
if (Object.keys(this.registrationStepsState).find(key => key == this.registrationStep)) {
|
|
756
|
+
// Use the one from state
|
|
757
|
+
this.stepsStateMachine({ event: 'get', type: 'inputs' });
|
|
758
|
+
this.stepsStateMachine({ event: 'get', type: 'values' });
|
|
759
|
+
}
|
|
760
|
+
else {
|
|
761
|
+
this.getRegisterConfig(this.registrationID).then((config) => {
|
|
762
|
+
// Format the new step config.
|
|
763
|
+
this.formatConfig(config);
|
|
764
|
+
// Set it in local storage.
|
|
765
|
+
this.stepsStateMachine({ event: 'set', type: 'inputs' });
|
|
766
|
+
// Setup conditionalValidationMap
|
|
767
|
+
this.setupConditionalValidationMap();
|
|
768
|
+
}, (err) => {
|
|
769
|
+
// Only send the error to user because this.getRegisterConfig already has proper error logging
|
|
770
|
+
this.triggerNotification(err);
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
})
|
|
775
|
+
.catch((err) => {
|
|
776
|
+
this.isLoadingPOST = false;
|
|
777
|
+
console.error(err);
|
|
778
|
+
}).finally(() => {
|
|
779
|
+
this.isLoadingPOST = false;
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
setRegister() {
|
|
783
|
+
this.isLoading = true;
|
|
784
|
+
this.registerErrors = false;
|
|
785
|
+
const url = new URL('v1/player/legislation/register/', this.endpoint);
|
|
786
|
+
const headers = new Headers();
|
|
787
|
+
headers.append('Content-Type', 'application/json');
|
|
788
|
+
headers.append('Accept', 'application/json');
|
|
789
|
+
const options = {
|
|
790
|
+
method: 'PUT',
|
|
791
|
+
body: JSON.stringify({ registrationId: this.registrationID }),
|
|
792
|
+
headers
|
|
793
|
+
};
|
|
794
|
+
dispatchCustomEvent('register_submit', { registrationId: this.registrationID });
|
|
795
|
+
fetch(url.href, options)
|
|
796
|
+
.then((res) => {
|
|
797
|
+
if (!res.ok) {
|
|
798
|
+
this.registerErrors = true;
|
|
799
|
+
return res.json().then(error => {
|
|
800
|
+
this.errorCode = error.thirdPartyResponse.errorCode;
|
|
801
|
+
// Show the idomsoft error if it is the case
|
|
802
|
+
if (this.errorCode == 'GmErr_BadRequest_IdomsoftVerification_ShouldRetry') {
|
|
803
|
+
this.errorMessage = error.thirdPartyResponse.message;
|
|
804
|
+
}
|
|
805
|
+
else if (this.errorCode == 'GmErr_BadRequest') {
|
|
806
|
+
this.errorMessage = error.thirdPartyResponse.message;
|
|
807
|
+
}
|
|
808
|
+
else {
|
|
809
|
+
this.errorMessage = translate(`${this.errorCode}`, this.language) || translate(`generalError`, this.language);
|
|
810
|
+
}
|
|
811
|
+
window.postMessage({ type: 'registrationFailed', errorMessage: error === null || error === void 0 ? void 0 : error.thirdPartyResponse.message }, window.location.href);
|
|
812
|
+
this.triggerNotification(this.errorMessage);
|
|
813
|
+
dispatchCustomEvent('register_fail', { error: this.errorMessage });
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
return res.json();
|
|
817
|
+
})
|
|
818
|
+
.then((data) => {
|
|
819
|
+
this.isLoading = false;
|
|
820
|
+
if (!this.registerErrors) {
|
|
821
|
+
this.dispatchRegisterCredentialsEvent();
|
|
822
|
+
window.postMessage({ type: 'registrationSuccessful', userId: data === null || data === void 0 ? void 0 : data.userId, extraActions: this.extraActions }, window.location.href);
|
|
823
|
+
window.postMessage({
|
|
824
|
+
type: 'WidgetNotification', data: {
|
|
825
|
+
type: 'success',
|
|
826
|
+
message: translate('successMessage', this.language)
|
|
827
|
+
}
|
|
828
|
+
}, window.location.href);
|
|
829
|
+
dispatchCustomEvent('register_closed', { userId: data.userId });
|
|
830
|
+
}
|
|
831
|
+
})
|
|
832
|
+
.catch((err) => {
|
|
833
|
+
this.isLoading = false;
|
|
834
|
+
console.error(err);
|
|
835
|
+
})
|
|
836
|
+
.finally(() => {
|
|
837
|
+
this.isLoading = false;
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
formatConfig(config) {
|
|
841
|
+
this.listOfInputs = config.content.fields.flatMap((field) => {
|
|
842
|
+
// Special case for inputs that need to be duplicated.
|
|
843
|
+
const duplicateInputRule = field.validate.custom.find(customRule => customRule.rule === 'duplicate-input');
|
|
844
|
+
const inputElement = Object.assign({}, field);
|
|
845
|
+
if (duplicateInputRule) {
|
|
846
|
+
const duplicateInput = Object.assign(Object.assign({}, field), { name: `${field.name}Duplicate`, displayName: duplicateInputRule.displayName, isDuplicateInput: true });
|
|
847
|
+
return [inputElement, duplicateInput];
|
|
848
|
+
}
|
|
849
|
+
else {
|
|
850
|
+
return [inputElement];
|
|
851
|
+
}
|
|
852
|
+
});
|
|
853
|
+
this.listOfInputValidity = this.listOfInputs.reduce((acc, field) => {
|
|
854
|
+
var _a;
|
|
855
|
+
// If the field is a togglecheckbox, add its subfields
|
|
856
|
+
if (((_a = field.inputType) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "togglecheckbox") {
|
|
857
|
+
field.data.subFields.forEach(subfield => {
|
|
858
|
+
acc.push({
|
|
859
|
+
name: subfield.name,
|
|
860
|
+
isValid: this.setInitialValidStatus(subfield)
|
|
861
|
+
});
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
else {
|
|
865
|
+
acc.push({
|
|
866
|
+
name: field.name,
|
|
867
|
+
isValid: this.setInitialValidStatus(field)
|
|
868
|
+
});
|
|
869
|
+
}
|
|
870
|
+
return acc;
|
|
871
|
+
}, []);
|
|
872
|
+
this.listOfInputValues = this.listOfInputs.reduce((acc, field) => {
|
|
873
|
+
var _a;
|
|
874
|
+
const inputType = (_a = field.inputType) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
875
|
+
// If the field type is a 'togglecheckbox', add its subfields
|
|
876
|
+
if (inputType === 'togglecheckbox') {
|
|
877
|
+
field.data.subFields.forEach(subfield => {
|
|
878
|
+
var _a;
|
|
879
|
+
acc.push({
|
|
880
|
+
name: subfield.name,
|
|
881
|
+
value: ((_a = subfield.inputType) === null || _a === void 0 ? void 0 : _a.toLowerCase()) == 'checkbox' ? 'false' : null,
|
|
882
|
+
isDuplicate: subfield.isDuplicateInput || false,
|
|
883
|
+
type: inputType === 'togglecheckbox' ? 'togglecheckbox' : null
|
|
884
|
+
});
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
acc.push({
|
|
888
|
+
name: field.name,
|
|
889
|
+
value: inputType === 'checkbox' || inputType === 'togglecheckbox' ? 'false' : null,
|
|
890
|
+
isDuplicate: field.isDuplicateInput || false,
|
|
891
|
+
type: inputType === 'checkboxgroup' ? 'checkboxgroup' : (inputType === 'togglecheckbox' ? 'toggle' : null)
|
|
892
|
+
});
|
|
893
|
+
return acc;
|
|
894
|
+
}, []);
|
|
895
|
+
if (this.btag)
|
|
896
|
+
this.addBtagValue();
|
|
897
|
+
// Set the list of actions
|
|
898
|
+
this.listOfActions = config.content.actions.map(action => action);
|
|
899
|
+
this.registrationID = config.content.registrationID;
|
|
900
|
+
this.registrationStep = config.content.step;
|
|
901
|
+
if (this.listOfActions.some(action => action == '/register')) {
|
|
902
|
+
this.lastStep = this.registrationStep;
|
|
903
|
+
}
|
|
904
|
+
if (this.listOfActions.some(action => action == '/Consents')) {
|
|
905
|
+
if (this.isConsentReady) {
|
|
906
|
+
this.listOfInputValidity.find((input) => input.name === "Consents").isValid = false;
|
|
907
|
+
this.isFormValid = !this.getInvalidStatus(this.listOfInputValidity);
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
910
|
+
this.listOfInputValidity.push({ name: 'Consents', isValid: false });
|
|
911
|
+
this.isConsentReady = true;
|
|
912
|
+
}
|
|
913
|
+
else {
|
|
914
|
+
this.isConsentReady = false;
|
|
915
|
+
}
|
|
916
|
+
// The translations for fields happens here.
|
|
917
|
+
if (this.translationUrl) {
|
|
918
|
+
getTranslations(this.translationUrl).then(() => {
|
|
919
|
+
this.listOfInputs.forEach(field => {
|
|
920
|
+
var _a, _b;
|
|
921
|
+
this.addTranslation(field);
|
|
922
|
+
// Logic for field types that have subfields
|
|
923
|
+
if (((_a = field.inputType) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'togglecheckbox') {
|
|
924
|
+
field.data.subFields.forEach(subField => this.addTranslation(subField));
|
|
925
|
+
}
|
|
926
|
+
if (((_b = field.inputType) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'checkboxgroup') {
|
|
927
|
+
this.addTranslation(field);
|
|
928
|
+
field.data.subFields.forEach(subField => this.addTranslation(subField));
|
|
929
|
+
}
|
|
930
|
+
return field;
|
|
931
|
+
});
|
|
932
|
+
})
|
|
933
|
+
.catch((error) => {
|
|
934
|
+
console.error('Failed to fetch translations:', error);
|
|
935
|
+
}).finally(() => {
|
|
936
|
+
this.forms = [...this.forms, { [this.registrationStep]: this.listOfInputs }];
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
else {
|
|
940
|
+
this.forms = [...this.forms, { [this.registrationStep]: this.listOfInputs }];
|
|
941
|
+
}
|
|
942
|
+
// Add the step to the registrationStepsData
|
|
943
|
+
this.registrationStepsState.regId = this.registrationID;
|
|
944
|
+
if (!this.registrationStepsState[this.registrationStep]) {
|
|
945
|
+
this.registrationStepsState[this.registrationStep] = {
|
|
946
|
+
fields: [],
|
|
947
|
+
fieldsValidity: [],
|
|
948
|
+
registerUserData: {},
|
|
949
|
+
actions: []
|
|
950
|
+
};
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
addBtagValue() {
|
|
954
|
+
const btagField = this.listOfInputs.find(input => input.name.toLowerCase() === 'btag');
|
|
955
|
+
if (btagField) {
|
|
956
|
+
btagField.defaultValue = this.btag;
|
|
957
|
+
}
|
|
958
|
+
const btagValue = this.listOfInputValues.find(input => input.name.toLowerCase() === 'btag');
|
|
959
|
+
if (btagValue) {
|
|
960
|
+
btagValue.value = this.btag;
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
addTranslation(field) {
|
|
964
|
+
const lang = TRANSLATIONS[this.language] ? this.language : DEFAULT_LANGUAGE;
|
|
965
|
+
if (TRANSLATIONS[lang][field.name]) {
|
|
966
|
+
Object.keys(TRANSLATIONS[this.language][field.name]).forEach((key) => {
|
|
967
|
+
field[key] = TRANSLATIONS[this.language][field.name][key];
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
setInitialValidStatus(field) {
|
|
972
|
+
var _a, _b, _c, _d;
|
|
973
|
+
// Input type checkbox, with no validation are valid
|
|
974
|
+
if (((_a = field.inputType) === null || _a === void 0 ? void 0 : _a.toLowerCase()) == 'checkbox' && ((_b = field.validate) === null || _b === void 0 ? void 0 : _b.mandatory) == false) {
|
|
975
|
+
return true;
|
|
976
|
+
}
|
|
977
|
+
//Checkboxes that are mandatory and set as false || null should't be valid.
|
|
978
|
+
if (((_c = field.inputType) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'checkbox' && ((_d = field.validate) === null || _d === void 0 ? void 0 : _d.mandatory) && field.defaultValue !== 'true') {
|
|
979
|
+
return false;
|
|
980
|
+
}
|
|
981
|
+
//Inputs that have default value and aren't mandatory are valid.
|
|
982
|
+
if (field.defaultValue !== null) {
|
|
983
|
+
return true;
|
|
984
|
+
}
|
|
985
|
+
return false;
|
|
986
|
+
}
|
|
987
|
+
stepChange(action) {
|
|
988
|
+
const stepNum = parseInt(this.registrationStep.replace('Step', ''));
|
|
989
|
+
if (action === 'increment') {
|
|
990
|
+
return 'Step' + (stepNum + 1);
|
|
991
|
+
}
|
|
992
|
+
if (action === 'decrement') {
|
|
993
|
+
return 'Step' + (stepNum - 1);
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
getInvalidStatus(listOfInputs) {
|
|
997
|
+
return listOfInputs.filter(input => input.isValid == false).length > 0;
|
|
998
|
+
}
|
|
999
|
+
renderErrorMessage(errorMsg) {
|
|
1000
|
+
return (h("p", { class: "registration registration__error-message" }, errorMsg));
|
|
1001
|
+
}
|
|
1002
|
+
renderForm() {
|
|
1003
|
+
return this.forms.map((form, index) => {
|
|
1004
|
+
return h("form", { action: '.', id: `RegistrationForm${this.registrationStep}`, class: `registration__form ${this.registrationStep !== `Step${index + 1}` ? 'hidden' : ''}`, ref: el => this.form = el, onClick: this.handleInitialClick }, form[this.registrationStep] && form[this.registrationStep].map((input) => {
|
|
1005
|
+
var _a, _b;
|
|
1006
|
+
return h("div", { key: input.name, class: "input-wrapper" }, h("general-input-hsl", { type: input.inputType, name: input.name, displayName: input.displayName, validation: input.validate, action: input.action || null, options: input.data
|
|
1007
|
+
? (input.inputType.toLowerCase() === 'checkboxgroup' || input.inputType.toLowerCase() === 'togglecheckbox')
|
|
1008
|
+
? input.data.subFields
|
|
1009
|
+
: input.data.values
|
|
1010
|
+
: [], defaultValue: input.defaultValue, autofilled: input.autofill, emitValue: this.emitValue, language: this.language, isDuplicateInput: input.isDuplicateInput, "client-styling": this.clientStyling, tooltip: input.tooltip, placeholder: input.placeholder == null ? '' : input.placeholder, "date-format": this.dateFormat, "twofa-destination": this.twofaDestination, "twofa-resend-interval-seconds": (_a = input.customInfo) === null || _a === void 0 ? void 0 : _a.twofaResendIntervalSeconds, "translation-url": this.translationUrl, emitOnClick: this.emitOnClick, onClick: this.handleInitialClick }), ((_b = input.customInfo) === null || _b === void 0 ? void 0 : _b.description) && (h("div", { class: "input-description" }, input.customInfo.description)));
|
|
1011
|
+
}), this.isConsentReady && this.renderConsents(), this.buttonInsideForm && this.renderButtons(), h("div", { class: 'registration__wrapper--flex' }, h("p", { class: 'registration__error-message', innerHTML: this.errorMessage })));
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
;
|
|
1015
|
+
renderConsents() {
|
|
1016
|
+
return (h("div", { class: "consentsContainer" }, h("player-consents", { endpoint: this.endpoint })));
|
|
1017
|
+
}
|
|
1018
|
+
renderButtons() {
|
|
1019
|
+
return (h("div", null, this.isLoadingPOST
|
|
1020
|
+
&& h("slot", { name: 'spinner' })
|
|
1021
|
+
&& h("svg", { class: "spinner", viewBox: "0 0 50 50" }, h("circle", { class: "path", cx: "25", cy: "25", r: "20", fill: "none", "stroke-width": "5" })), !this.isLoadingPOST && h("div", { class: `registration__buttons-wrapper ${this.autofilled ? 'registration__buttons-wrapper--autofilled' : ''}` }, h("button", { class: `registration__button registration__button--next ${this.isFormValid ? '' : 'registration__button--disabled'}`, type: 'submit', form: `RegistrationForm${this.registrationStep}`, onClick: (e) => this.nextHandler(e), disabled: !this.isFormValid }, this.lastStep === this.registrationStep ? translate('doneButton', this.language) : translate('nextButton', this.language)), h("button", { class: `registration__button registration__button--back ${this.registrationStep == 'Step1' ? 'registration__button--first-step' : ''}`, onClick: (e) => this.backHandler(e) }, translate('backButton', this.language)))));
|
|
1022
|
+
}
|
|
1023
|
+
render() {
|
|
1024
|
+
if (this.isLoading && !this.registerErrors) {
|
|
1025
|
+
return h("p", { class: `registration registration__loading-message` }, translate('loadingMessage', this.language));
|
|
1026
|
+
}
|
|
1027
|
+
else if (!this.isLoading && this.registerErrors) {
|
|
1028
|
+
return this.renderErrorMessage(this.errorMessage);
|
|
1029
|
+
}
|
|
1030
|
+
return (h("div", { class: `registration registration__${this.registrationStep}` }, this.renderForm(), !this.buttonInsideForm && this.renderButtons()));
|
|
1031
|
+
}
|
|
1032
|
+
get host() { return getElement(this); }
|
|
1033
|
+
static get watchers() { return {
|
|
1034
|
+
"registrationStep": ["sendStep"],
|
|
1035
|
+
"clientStyling": ["handleStylingChange"],
|
|
1036
|
+
"clientStylingUrl": ["handleStylingUrlChange"],
|
|
1037
|
+
"forms": ["setFormValidity"],
|
|
1038
|
+
"btag": ["addBtag"]
|
|
1039
|
+
}; }
|
|
1040
|
+
};
|
|
1041
|
+
GeneralRegistrationHsl.style = GeneralRegistrationHslStyle0;
|
|
1042
|
+
|
|
1043
|
+
export { GeneralRegistrationHsl as G };
|