@everymatrix/general-player-register-form-step1-nd 1.37.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.
@@ -0,0 +1,578 @@
1
+ <svelte:options tag={null} />
2
+
3
+ <script lang="ts">
4
+ import { onMount } from "svelte";
5
+ import { _, addNewMessages, setLocale, setupI18n } from './i18n';
6
+ import { TRANSLATIONS } from './translations';
7
+
8
+ export let lang:string = '';
9
+ // Possible disabled fields: ['email', 'username', 'name', 'password', 'confirmPassword', 'securityQuestion', 'securityAnswer', 'promoCode']
10
+ export let disabledfields:string = '';
11
+ export let defaultoptions:string = '';
12
+ export let simplepasswordvalidation:string = 'false';
13
+ export let clientstyling:string = '';
14
+ export let clientstylingurl:string = '';
15
+ export let translationurl:string = '';
16
+ export let savecredentials:string = '';
17
+ export let custominputtextswitch:string = 'false';
18
+
19
+ let invalidEmail:boolean = false;
20
+ let invalidName:boolean = false;
21
+ let invalidPassword:boolean = false;
22
+ let invalidConfirmPassword:boolean = false;
23
+ let invalidSecurityQuestion:boolean = false;
24
+ let invalidSecurityAnswer:boolean = false;
25
+ let invalidPromoCode:boolean = false;
26
+
27
+ let emailFocus:boolean = false;
28
+ let usernameFocus:boolean = false;
29
+ let passwordFocus:boolean = false;
30
+ let confirmPasswordFocus:boolean = false;
31
+ let securityQFocus:boolean = false;
32
+ let securityAFocus:boolean = false;
33
+ let promoCodeFocus:boolean = false;
34
+
35
+ let disabledFieldsList:Array<string>;
36
+
37
+ let userValue:string = '';
38
+ let userEmail:string = '';
39
+ let userPassword:string = '';
40
+ let confirmUserPassword:string = '';
41
+ let securityQuestion:string = '';
42
+ let securityAnswer:string = '';
43
+ let promoCode:string = '';
44
+
45
+ let isPasswordVisible:boolean = false;
46
+ let isConfirmPasswordVisible:boolean = false;
47
+
48
+ let passwordVisibilityToggle:HTMLElement;
49
+ let confirmPasswordVisibilityToggle:HTMLElement;
50
+
51
+ let isValid:boolean = false;
52
+
53
+ let customStylingContainer:HTMLElement;
54
+ let displayNone:boolean = false;
55
+
56
+ let regexValidators:any = {
57
+ user: /^(?!(?:.*\d){9})(?=(?:.*[a-zA-Z]){4})^[a-zA-Z\d]*$/,
58
+ email: /^[^<>()*{}=/|?`~[\]\\,;:\%#^\s@\"$&!@]+@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z0-9]+\.)+[a-zA-Z]{2,}))$/i,
59
+ password: /^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[^\w\s]).{8,20}$/,
60
+ document: /^(?=.*[a-zA-Z0-9])[a-zA-Z0-9\s]+$/
61
+ }
62
+
63
+ // setupI18n({ withLocale: 'en', translations: {}});
64
+
65
+ const setTranslationUrl = ():void => {
66
+ let url:string = translationurl;
67
+
68
+ fetch(url).then((res:any) => res.json())
69
+ .then((res) => {
70
+ Object.keys(res).forEach((item:any):void => {
71
+ addNewMessages(item, res[item]);
72
+ });
73
+ }).catch((err:any) => {
74
+ console.log(err);
75
+ });
76
+ }
77
+
78
+ Object.keys(TRANSLATIONS).forEach((item:any) => {
79
+ addNewMessages(item, TRANSLATIONS[item]);
80
+ });
81
+
82
+ const checkIsValid = ():void => {
83
+ isValid = !(invalidEmail || invalidName || invalidPassword || invalidConfirmPassword || invalidSecurityQuestion || invalidSecurityAnswer || invalidPromoCode);
84
+
85
+ // not adding invalidPromoCode to this check because the business case states that it is an optional field
86
+ if (userValue.length <= 0 || userEmail.length <= 0 || userPassword.length <= 0 || confirmUserPassword.length <= 0 || securityQuestion.length <= 0 || securityAnswer.length <= 0) {
87
+ isValid = false;
88
+ }
89
+ }
90
+
91
+ const switchToLogin = ():void => {
92
+ window.postMessage({ type: "ToLogin" }, window.location.href);
93
+ }
94
+
95
+ const verifyTypeOfPassword = ():void => {
96
+ if (simplepasswordvalidation == 'true') {
97
+ regexValidators.password = /^(?!.* ).{8,20}$/;
98
+ }
99
+ }
100
+
101
+ const checkEmailIdentifier = (email:string):boolean => {
102
+ if (regexValidators.email.test(email) && email.length <= 100) {
103
+ return true;
104
+ }
105
+
106
+ return false;
107
+ }
108
+
109
+ const validateEmail = ():void => {
110
+ invalidEmail = !checkEmailIdentifier(userEmail);
111
+ checkIsValid();
112
+ }
113
+
114
+ const checkUserIdentifier = (user:string):boolean => {
115
+ if (regexValidators.user.test(user) && user.length <= 20) {
116
+ return true;
117
+ }
118
+
119
+ return false;
120
+ }
121
+
122
+ const validateUserName = ():void => {
123
+ invalidName = !checkUserIdentifier(userValue);
124
+ checkIsValid();
125
+ }
126
+
127
+ const showPassword = ():void => {
128
+ isPasswordVisible = true;
129
+ togglePasswordVisibility();
130
+ }
131
+
132
+ const showConfirmPassword = ():void => {
133
+ isConfirmPasswordVisible = true;
134
+ toggleConfirmPasswordVisibility();
135
+ }
136
+
137
+ const hidePassword = ():void => {
138
+ isPasswordVisible = false;
139
+ togglePasswordVisibility();
140
+ }
141
+
142
+ const hideConfirmPassword = ():void => {
143
+ isConfirmPasswordVisible = false;
144
+ toggleConfirmPasswordVisibility();
145
+ }
146
+
147
+ const togglePasswordVisibility = ():void => {
148
+ passwordVisibilityToggle.type = isPasswordVisible ? "text" : "password";
149
+ }
150
+
151
+ const toggleConfirmPasswordVisibility = ():void => {
152
+ confirmPasswordVisibilityToggle.type = isConfirmPasswordVisible ? "text" : "password";
153
+ }
154
+
155
+ const checkUserPassword = (password:string):boolean => {
156
+ if (regexValidators.password.test(password)) {
157
+ return true;
158
+ }
159
+
160
+ return false;
161
+ }
162
+
163
+ const validatePassword = ():void => {
164
+ invalidPassword = !checkUserPassword(userPassword);
165
+
166
+ if (userPassword !== confirmUserPassword && confirmUserPassword.length > 0) {
167
+ invalidConfirmPassword = true;
168
+ } else {
169
+ invalidConfirmPassword = false;
170
+ }
171
+
172
+ checkIsValid();
173
+ }
174
+
175
+ const checkUserConfirmPassword = ():boolean => {
176
+ if (userPassword === confirmUserPassword) {
177
+ return true;
178
+ }
179
+
180
+ return false;
181
+ }
182
+
183
+ const validateConfirmPassword = ():void => {
184
+ invalidConfirmPassword = !checkUserConfirmPassword();
185
+ checkIsValid();
186
+ }
187
+
188
+ // as per the current business case, the promo code field is always valid. Still adding the same overall structure as the other fields for easy maintanence in case this ever changes
189
+ const checkPromoCode = ():boolean => {
190
+ return true;
191
+ }
192
+
193
+ const validatePromoCode = ():void => {
194
+ invalidPromoCode = !checkPromoCode();
195
+ checkIsValid();
196
+ }
197
+
198
+ const checkSecurityQuestion = ():boolean => {
199
+ if (securityQuestion)
200
+ switch(custominputtextswitch) {
201
+ case 'true':
202
+ if (regexValidators.document.test(securityQuestion) && securityQuestion.length <= 50) {
203
+ return true;
204
+ }
205
+ break;
206
+
207
+ case 'false':
208
+ if (securityQuestion && securityQuestion.length <= 120) {
209
+ return true;
210
+ }
211
+ break;
212
+ }
213
+
214
+ return false;
215
+ }
216
+
217
+ const validateSecurityQuestion = ():void => {
218
+ invalidSecurityQuestion = !checkSecurityQuestion();
219
+ checkIsValid();
220
+ }
221
+
222
+ const checkSecurityAnswer = ():boolean => {
223
+ if (securityAnswer)
224
+ switch(custominputtextswitch) {
225
+ case 'true':
226
+ if (regexValidators.document.test(securityAnswer) && securityAnswer.length <= 50) {
227
+ return true;
228
+ }
229
+ break;
230
+
231
+ case 'false':
232
+ if (securityAnswer && securityAnswer.length <= 120) {
233
+ return true;
234
+ }
235
+ break;
236
+ }
237
+
238
+ return false;
239
+ }
240
+
241
+ const validateSecurityAnswer = ():void => {
242
+ invalidSecurityAnswer = !checkSecurityAnswer();
243
+ checkIsValid();
244
+ }
245
+
246
+ const goNext = (e):void => {
247
+ e.preventDefault();
248
+ let registerStepOneData = {
249
+ userEmail,
250
+ userValue,
251
+ userPassword,
252
+ confirmUserPassword,
253
+ securityQuestion,
254
+ securityAnswer,
255
+ promoCode
256
+ };
257
+
258
+ window.postMessage({ type: 'RegisterStepOne', registerStepOneData }, window.location.href);
259
+ }
260
+
261
+ const messageHandler = (e:any):void => {
262
+ if (e.data) {
263
+ switch(e.data.type) {
264
+ case 'StepOneDataBackup':
265
+ userEmail = e.data.userData.email;
266
+ userValue = e.data.userData.username;
267
+ userPassword = e.data.userData.password;
268
+ confirmUserPassword = e.data.userData.password;
269
+ securityQuestion = e.data.userData.securityQuestion;
270
+ securityAnswer = e.data.userData.securityAnswer;
271
+ promoCode = e.data.userData.promoCode
272
+ checkIsValid();
273
+ break;
274
+ }
275
+ }
276
+ }
277
+
278
+ const formatDisabledFields = ():void => {
279
+ disabledFieldsList = disabledfields.split(',');
280
+
281
+ if (disabledFieldsList.indexOf('email') >= 0) {
282
+ userEmail = 'dummy@dummy.com';
283
+ invalidEmail = false;
284
+ }
285
+
286
+ if (disabledFieldsList.indexOf('username') >= 0) {
287
+ userValue = 'dummy username';
288
+ invalidName = false;
289
+ }
290
+
291
+ if (disabledFieldsList.indexOf('password') >= 0) {
292
+ userPassword = 'dummy password';
293
+ invalidPassword = false;
294
+ }
295
+
296
+ if (disabledFieldsList.indexOf('confirmPassword') >= 0) {
297
+ confirmUserPassword = 'dummy password';
298
+ invalidConfirmPassword = false;
299
+ }
300
+
301
+ if (disabledFieldsList.indexOf('securityQuestion') >= 0) {
302
+ securityQuestion = 'dummy question';
303
+ invalidSecurityQuestion = false;
304
+ }
305
+
306
+ if (disabledFieldsList.indexOf('securityAnswer') >= 0) {
307
+ securityAnswer = 'dummy answer';
308
+ invalidSecurityAnswer = false;
309
+ }
310
+
311
+ if (disabledFieldsList.indexOf('promoCode') >= 0) {
312
+
313
+ invalidPromoCode = false;
314
+ }
315
+ }
316
+
317
+ const setActiveLanguage = ():void => {
318
+ setLocale(lang);
319
+ }
320
+
321
+ const setClientStyling = ():void => {
322
+ let sheet = document.createElement('style');
323
+ sheet.innerHTML = clientstyling;
324
+ customStylingContainer.appendChild(sheet);
325
+ }
326
+
327
+ const setClientStylingURL = ():void => {
328
+ displayNone = true;
329
+
330
+ let url:URL = new URL(clientstylingurl);
331
+ let cssFile:HTMLElement = document.createElement('style');
332
+
333
+ fetch(url.href)
334
+ .then((res:any) => res.text())
335
+ .then((data:any) => {
336
+ cssFile.innerHTML = data
337
+
338
+ setTimeout(() => { customStylingContainer.appendChild(cssFile) }, 1);
339
+ setTimeout(() => { displayNone = false; }, 500);
340
+ });
341
+ }
342
+
343
+ onMount(() => {
344
+ window.addEventListener('message', messageHandler, false);
345
+
346
+ return () => {
347
+ window.removeEventListener('message', messageHandler);
348
+ }
349
+ });
350
+
351
+ $: lang && setActiveLanguage();
352
+ $: disabledfields && formatDisabledFields();
353
+ $: simplepasswordvalidation && verifyTypeOfPassword();
354
+ $: clientstyling && customStylingContainer && setClientStyling();
355
+ $: clientstylingurl && customStylingContainer && setClientStylingURL();
356
+ $: translationurl && setTranslationUrl();
357
+ </script>
358
+
359
+ <div bind:this={customStylingContainer}>
360
+ <div class="RegisterFormHeader">
361
+ <h2 class="RegisterFormTitle">{$_('registerTitle')}</h2>
362
+ <p class="RegisterFormSubtitle">{$_('registerSubtitle')} <span class="FormLoginCallToAction" on:click={() => switchToLogin()}>{$_('registerSubtitleLogin')}</span></p>
363
+ </div>
364
+ <form class="RegisterFormContent">
365
+ <div class="EmailContainer {invalidEmail && !emailFocus ? 'InvalidField' : ''}{disabledFieldsList?.indexOf('email') >= 0 ? 'Hidden' : ''}" >
366
+ <label for="Email">{$_('registerEmail')}:<span class="FormRequired">*</span></label>
367
+ <input bind:value={userEmail} on:keyup={validateEmail} on:focus={() => emailFocus = true} on:blur={() => emailFocus = false} type="text" id="Email" />
368
+ {#if invalidEmail}
369
+ <p class="InvalidInput">{$_('registerEmailError')}</p>
370
+ {/if}
371
+ </div>
372
+ <div class="UserContainer {invalidName && !usernameFocus? 'InvalidField' : ''}{disabledFieldsList?.indexOf('username') >= 0 ? 'Hidden' : ''}">
373
+ <label for="UserName">{$_('registerUsername')}:<span class="FormRequired">*</span></label>
374
+ <input bind:value={userValue} on:keyup={validateUserName} on:focus={() => usernameFocus = true} on:blur={() => usernameFocus = false} type="text" id="UserName" autocomplete = {savecredentials ? "username" : "off" }/>
375
+ {#if invalidName}
376
+ <p class="InvalidInput">{$_('registerUsernameError')}</p>
377
+ {/if}
378
+ </div>
379
+ <div class="PasswordContainer {invalidPassword && !passwordFocus ? 'InvalidField' : ''}{disabledFieldsList?.indexOf('password') >= 0 ? 'Hidden' : ''}" hidden={disabledFieldsList?.indexOf('password') >= 0}>
380
+ <label for="Password">{$_('registerPassword')}:<span class="FormRequired">*</span></label>
381
+ <input bind:value={userPassword} on:keyup={validatePassword} on:focus={() => passwordFocus = true} on:blur={() => passwordFocus = false} name="new-password" type="password" id="new-password" autocomplete = {savecredentials ? "new-password" : "off" } bind:this={passwordVisibilityToggle} aria-describedby="password-constraints" />
382
+ {#if isPasswordVisible}
383
+ <svg on:click={() => hidePassword()} class="TogglePasswordVisibility" xmlns="http://www.w3.org/2000/svg" width="18.844" height="12.887" viewBox="0 0 18.844 12.887"><defs><style>.a{fill:var(--emw--registration-typography, var(--emw--color-background, #07072A));}</style></defs><g transform="translate(-110.856 -23.242)"><circle class="a" cx="0.05" cy="0.05" r="0.05" transform="translate(121.017 31.148)"/><g transform="translate(117.499 27.37)"><path class="a" d="M147.413,43.174a2.774,2.774,0,0,0-3.229-3.943Z" transform="translate(-142.164 -39.123)"/><path class="a" d="M137.031,43.1a2.778,2.778,0,0,0,3.447,4.209Z" transform="translate(-136.413 -42.068)"/></g><g transform="translate(110.856 24.899)"><path class="a" 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)"/><path class="a" 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)"/></g><rect class="a" width="0.972" height="15.861" rx="0.486" transform="translate(114.827 23.858) rotate(-39.315)"/></g></svg>
384
+ {:else}
385
+ <svg on:click={() => showPassword()} class="TogglePasswordVisibility" xmlns="http://www.w3.org/2000/svg" width="18.843" height="10.5" viewBox="0 0 18.843 10.5"><defs><style>.a{fill:var(--emw--registration-typography, var(--emw--color-background, #07072A));}</style></defs><g transform="translate(-14.185 -27.832)"><path class="a" 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)"/><circle class="a" cx="2.779" cy="2.779" r="2.779" transform="translate(20.827 30.303)"/></g></svg>
386
+ {/if}
387
+ {#if invalidPassword && simplepasswordvalidation !== 'true'}
388
+ <p class="InvalidInput">{$_('registerPasswordError')}</p>
389
+ {/if}
390
+ {#if invalidPassword && simplepasswordvalidation === 'true'}
391
+ <p class="InvalidInput">{$_('registerSimplePasswordError')}</p>
392
+ {/if}
393
+ </div>
394
+ <div class="ConfirmPasswordContainer {invalidConfirmPassword && !confirmPasswordFocus? 'InvalidField' : ''}{disabledFieldsList?.indexOf('confirmPassword') >= 0 ? 'Hidden' : ''}">
395
+ <label for="ConfirmPassword">{$_('registerConfirmPassword')}:<span class="FormRequired">*</span></label>
396
+ <input bind:value={confirmUserPassword} on:keyup={validateConfirmPassword} on:focus={() => confirmPasswordFocus = true} on:blur={() => confirmPasswordFocus = false} type="password" id="ConfirmPassword" bind:this={confirmPasswordVisibilityToggle} />
397
+ {#if isConfirmPasswordVisible}
398
+ <svg on:click={() => hideConfirmPassword()} class="ToggleConfirmPasswordVisibility" xmlns="http://www.w3.org/2000/svg" width="18.844" height="12.887" viewBox="0 0 18.844 12.887"><defs><style>.a{fill:var(--emw--registration-typography, var(--emw--color-background, #07072A));}</style></defs><g transform="translate(-110.856 -23.242)"><circle class="a" cx="0.05" cy="0.05" r="0.05" transform="translate(121.017 31.148)"/><g transform="translate(117.499 27.37)"><path class="a" d="M147.413,43.174a2.774,2.774,0,0,0-3.229-3.943Z" transform="translate(-142.164 -39.123)"/><path class="a" d="M137.031,43.1a2.778,2.778,0,0,0,3.447,4.209Z" transform="translate(-136.413 -42.068)"/></g><g transform="translate(110.856 24.899)"><path class="a" 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)"/><path class="a" 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)"/></g><rect class="a" width="0.972" height="15.861" rx="0.486" transform="translate(114.827 23.858) rotate(-39.315)"/></g></svg>
399
+ {:else}
400
+ <svg on:click={() => showConfirmPassword()} class="ToggleConfirmPasswordVisibility" xmlns="http://www.w3.org/2000/svg" width="18.843" height="10.5" viewBox="0 0 18.843 10.5"><defs><style>.a{fill:var(--emw--registration-typography, var(--emw--color-background, #07072A));}</style></defs><g transform="translate(-14.185 -27.832)"><path class="a" 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)"/><circle class="a" cx="2.779" cy="2.779" r="2.779" transform="translate(20.827 30.303)"/></g></svg>
401
+ {/if}
402
+ {#if invalidConfirmPassword}
403
+ <p class="InvalidInput">{$_('registerConfirmPasswordError')}</p>
404
+ {/if}
405
+ </div>
406
+
407
+
408
+ <div class="PromoCodeContainer {disabledFieldsList?.indexOf('promoCode') >= 0 ? 'Hidden' : ''}">
409
+ <label for="PromoCode">{$_('registerPromoCode')}:</label>
410
+ <input bind:value={promoCode} on:keyup={validatePromoCode} on:focus={() => promoCodeFocus = true} on:blur={() => promoCodeFocus = false} type="text" id="PromoCode" />
411
+ {#if invalidPromoCode}
412
+ <p class="InvalidInput">{$_('promoCodeError')}</p>
413
+ {/if}
414
+ </div>
415
+
416
+
417
+ <div class="SecurityQuestionContainer {invalidSecurityQuestion && !securityQFocus? 'InvalidField' : ''}{disabledFieldsList?.indexOf('securityQuestion') >= 0 ? 'Hidden' : ''}">
418
+ <label for="SecurityQuestion">{custominputtextswitch == 'true' ? $_('registerSecurityQuestion2') : $_('registerSecurityQuestion')}:<span class="FormRequired">*</span></label>
419
+ <input bind:value={securityQuestion} on:keyup={validateSecurityQuestion} on:focus={() => securityQFocus = true} on:blur={() => securityQFocus = false} type="text" id="SecurityQuestion" />
420
+ {#if invalidSecurityQuestion}
421
+ <p class="InvalidInput">{custominputtextswitch == 'true' ? $_('registerSecurityQuestionError2') : $_('registerSecurityQuestionError')}</p>
422
+ {/if}
423
+ </div>
424
+ <div class="SecurityAnswerContainer {invalidSecurityAnswer && !securityAFocus? 'InvalidField' : ''}{disabledFieldsList?.indexOf('securityAnswer') >= 0 ? 'Hidden' : ''}">
425
+ <label for="SecurityAnswer">{custominputtextswitch == 'true' ? $_('registerSecurityAnswer2') : $_('registerSecurityAnswer')}:<span class="FormRequired">*</span></label>
426
+ <input bind:value={securityAnswer} on:keyup={validateSecurityAnswer} on:focus={() => securityAFocus = true} on:blur={() => securityAFocus = false} type="text" id="SecurityAnswer" />
427
+ {#if invalidSecurityAnswer}
428
+ <p class="InvalidInput">{custominputtextswitch == 'true' ? $_('registerSecurityAnswerError2') : $_('registerSecurityAnswerError')}</p>
429
+ {/if}
430
+ </div>
431
+ <button class="RegisterStepNext" disabled={!isValid} on:click={(e) => goNext(e)}>{$_('registerNext')}</button>
432
+ </form>
433
+ </div>
434
+
435
+ <style lang="scss">
436
+
437
+ input, select {
438
+ font-family: inherit;
439
+ }
440
+
441
+ .RegisterFormTitle {
442
+ font-size: var(--emw--font-size-large, 20px);
443
+ text-transform: uppercase;
444
+ font-weight: var(--emw--font-weight-light, 300);
445
+ margin: 0;
446
+ padding-bottom: 8px;
447
+ }
448
+
449
+ .RegisterFormSubtitle {
450
+ font-size: var(--emw--font-size-small, 14px);
451
+ margin: 0;
452
+ padding-bottom: 20px;
453
+ }
454
+
455
+ .FormLoginCallToAction {
456
+ color: var(--emw--registration-color-primary, var(--emw--color-primary, #22B04E));
457
+ font-size: var(--emw--font-size-small, 14px);
458
+ font-weight: var(--emw--font-weight-normal, 400);
459
+ text-decoration: none;
460
+ cursor: pointer;
461
+ }
462
+
463
+ .EmailContainer,
464
+ .UserContainer,
465
+ .PasswordContainer,
466
+ .ConfirmPasswordContainer,
467
+ .PromoCodeContainer,
468
+ .SecurityQuestionContainer,
469
+ .SecurityAnswerContainer {
470
+ color: var(--emw--registration-contrast, var(--emw--color-typography-cotrast, #444444));
471
+ display: flex;
472
+ flex-direction: column;
473
+ padding-bottom:40px;
474
+ position: relative;
475
+
476
+ label {
477
+ font-size: var(--emw--font-size-small, 14px);
478
+ font-weight: var(--emw--font-weight-light, 300);
479
+ padding-bottom: 5px;
480
+ }
481
+
482
+ input {
483
+ width: 100%;
484
+ height: 44px;
485
+ border-radius: var(--emw--border-radius-medium, 15px);
486
+ border: 1px solid var(--emw--registration-contrast, var(--emw--color-typography-cotrast, #444444));
487
+ box-sizing: border-box;
488
+ padding: 5px 15px;
489
+ font-size: var(--emw--font-size-medium, 16px);
490
+ line-height: 18px;
491
+
492
+ &:focus {
493
+ border: 2px solid var(--emw--registration-color-primary, var(--emw--color-primary, #22B04E));
494
+ outline: none;
495
+ }
496
+ }
497
+
498
+ &.InvalidField {
499
+ input {
500
+ border: 1px solid var(--emw--color-error, #F5090A);
501
+ background: var(--emw--color-pale, #FBECF4);
502
+ color: var(--emw--registration-contrast, var(--emw--color-typography-cotrast, #444444));
503
+ }
504
+ }
505
+
506
+ &.Hidden {
507
+ display: none;
508
+ }
509
+ }
510
+
511
+ .PasswordContainer, .ConfirmPasswordContainer {
512
+ position: relative;
513
+ }
514
+
515
+ .PasswordContainer input,
516
+ .ConfirmPasswordContainer input {
517
+ padding: 5px 30px 5px 15px;
518
+ }
519
+
520
+ .FormRequired {
521
+ color: var(--emw--categories-color-secondary, var(--emw--color-secondary, #E1A749));
522
+ }
523
+
524
+ .TogglePasswordVisibility, .ToggleConfirmPasswordVisibility {
525
+ height: 13px;
526
+ position: absolute;
527
+ right: 8px;
528
+ bottom: 55px;
529
+ &.InvalidToggle {
530
+ path, circle, rect {
531
+ fill: var(--emw--registration-color-primary, var(--emw--color-primary, #22B04E));
532
+ }
533
+ }
534
+ path, circle, rect {
535
+ fill: var(--emw--registration-contrast, var(--emw--color-typography-cotrast, #444444));
536
+ }
537
+ }
538
+
539
+ .InvalidInput {
540
+ color: var(--emw--color-error, var(--emw--color-error, #ed0909));
541
+ font-size: 10px;
542
+ position: absolute;
543
+ padding-top: 5px;
544
+ top: 55px;
545
+ line-height: 10px;
546
+ }
547
+
548
+ .ErrorMessage {
549
+ margin: 0 0 15px 0;
550
+ font-size: var(--emw--font-size-x-small, 12px);
551
+ color: var(--emw--color-error, var(--emw--color-error, #ed0909));
552
+ }
553
+
554
+ .RegisterStepNext {
555
+ 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%));
556
+ border: 2px solid var(--emw--button-border-color, #0E5924);
557
+ border-radius: var(--emw--button-border-radius, 50px);
558
+ color: var(--emw--button-typography, var(--emw--button-text-color, #FFFFFF));
559
+ width: 100%;
560
+ height: 60px;
561
+ padding: 0;
562
+ text-transform: uppercase;
563
+ font-size: var(--emw--font-size-medium, 16px);
564
+ cursor: pointer;
565
+ margin-top: 24px;
566
+ &[disabled] {
567
+ background: var(--emw--color-gray-100, #E6E6E6);
568
+ border: 1px solid var(--emw--color-gray-150, #828282);
569
+ cursor: not-allowed;
570
+ }
571
+ }
572
+
573
+ /* MS Edge */
574
+ input::-ms-reveal,
575
+ input::-ms-clear {
576
+ display: none;
577
+ }
578
+ </style>
package/src/i18n.js ADDED
@@ -0,0 +1,27 @@
1
+ import {
2
+ dictionary,
3
+ locale,
4
+ addMessages,
5
+ _
6
+ } from 'svelte-i18n';
7
+
8
+ function setupI18n({ withLocale: _locale, translations }) {
9
+ locale.subscribe((data) => {
10
+ if (data == null) {
11
+ dictionary.set(translations);
12
+ locale.set(_locale);
13
+ }
14
+ }); // maybe we will need this to make sure that the i18n is set up only once
15
+ /*dictionary.set(translations);
16
+ locale.set(_locale);*/
17
+ }
18
+
19
+ function addNewMessages(lang, dict) {
20
+ addMessages(lang, dict);
21
+ }
22
+
23
+ function setLocale(_locale) {
24
+ locale.set(_locale);
25
+ }
26
+
27
+ export { _, setupI18n, addNewMessages, setLocale };
package/src/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ import GeneralPlayerRegisterFormStep1 from './GeneralPlayerRegisterFormStep1Nd.svelte';
2
+
3
+ !customElements.get('general-player-register-form-step1-nd') && customElements.define('general-player-register-form-step1-nd', GeneralPlayerRegisterFormStep1);
4
+ export default GeneralPlayerRegisterFormStep1;