@everymatrix/general-player-register-form-step1 1.17.5 → 1.18.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/general-player-register-form-step1",
3
- "version": "1.17.5",
3
+ "version": "1.18.0",
4
4
  "main": "dist/general-player-register-form-step1.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -35,5 +35,5 @@
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "e558426aacbc1f9a28260526551afc6d4cf887b1"
38
+ "gitHead": "6e90294022b2d742320099f1a4681ee431732dd5"
39
39
  }
@@ -6,7 +6,7 @@
6
6
  import { TRANSLATIONS } from './translations';
7
7
 
8
8
  export let lang:string = '';
9
- // Possible disabled fields: ['email', 'username', 'name', 'password', 'confirmPassword', 'securityQuestion', 'securityAnswer']
9
+ // Possible disabled fields: ['email', 'username', 'name', 'password', 'confirmPassword', 'securityQuestion', 'securityAnswer', 'promoCode']
10
10
  export let disabledfields:string = '';
11
11
  export let defaultoptions:string = '';
12
12
  export let simplepasswordvalidation:string = 'false';
@@ -22,6 +22,7 @@
22
22
  let invalidConfirmPassword:boolean = false;
23
23
  let invalidSecurityQuestion:boolean = false;
24
24
  let invalidSecurityAnswer:boolean = false;
25
+ let invalidPromoCode:boolean = false;
25
26
 
26
27
  let emailFocus:boolean = false;
27
28
  let usernameFocus:boolean = false;
@@ -29,6 +30,7 @@
29
30
  let confirmPasswordFocus:boolean = false;
30
31
  let securityQFocus:boolean = false;
31
32
  let securityAFocus:boolean = false;
33
+ let promoCodeFocus:boolean = false;
32
34
 
33
35
  let disabledFieldsList:Array<string>;
34
36
 
@@ -38,6 +40,7 @@
38
40
  let confirmUserPassword:string = '';
39
41
  let securityQuestion:string = '';
40
42
  let securityAnswer:string = '';
43
+ let promoCode:string = '';
41
44
 
42
45
  let isPasswordVisible:boolean = false;
43
46
  let isConfirmPasswordVisible:boolean = false;
@@ -77,8 +80,9 @@
77
80
  });
78
81
 
79
82
  const checkIsValid = ():void => {
80
- isValid = !(invalidEmail || invalidName || invalidPassword || invalidConfirmPassword || invalidSecurityQuestion || invalidSecurityAnswer);
83
+ isValid = !(invalidEmail || invalidName || invalidPassword || invalidConfirmPassword || invalidSecurityQuestion || invalidSecurityAnswer || invalidPromoCode);
81
84
 
85
+ // not adding invalidPromoCode to this check because the business case states that it is an optional field
82
86
  if (userValue.length <= 0 || userEmail.length <= 0 || userPassword.length <= 0 || confirmUserPassword.length <= 0 || securityQuestion.length <= 0 || securityAnswer.length <= 0) {
83
87
  isValid = false;
84
88
  }
@@ -181,6 +185,16 @@
181
185
  checkIsValid();
182
186
  }
183
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
+
184
198
  const checkSecurityQuestion = ():boolean => {
185
199
  if (securityQuestion)
186
200
  switch(custominputtextswitch) {
@@ -237,7 +251,8 @@
237
251
  userPassword,
238
252
  confirmUserPassword,
239
253
  securityQuestion,
240
- securityAnswer
254
+ securityAnswer,
255
+ promoCode
241
256
  };
242
257
 
243
258
  window.postMessage({ type: 'RegisterStepOne', registerStepOneData }, window.location.href);
@@ -253,6 +268,7 @@
253
268
  confirmUserPassword = e.data.userData.password;
254
269
  securityQuestion = e.data.userData.securityQuestion;
255
270
  securityAnswer = e.data.userData.securityAnswer;
271
+ promoCode = e.data.userData.promoCode
256
272
  checkIsValid();
257
273
  break;
258
274
  }
@@ -291,6 +307,11 @@
291
307
  securityAnswer = 'dummy answer';
292
308
  invalidSecurityAnswer = false;
293
309
  }
310
+
311
+ if (disabledFieldsList.indexOf('promoCode') >= 0) {
312
+
313
+ invalidPromoCode = false;
314
+ }
294
315
  }
295
316
 
296
317
  const setActiveLanguage = ():void => {
@@ -382,6 +403,17 @@
382
403
  <p class="InvalidInput">{$_('registerConfirmPasswordError')}</p>
383
404
  {/if}
384
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
+
385
417
  <div class="SecurityQuestionContainer {invalidSecurityQuestion && !securityQFocus? 'InvalidField' : ''}{disabledFieldsList?.indexOf('securityQuestion') >= 0 ? 'Hidden' : ''}">
386
418
  <label for="SecurityQuestion">{custominputtextswitch == 'true' ? $_('registerSecurityQuestion2') : $_('registerSecurityQuestion')}:<span class="FormRequired">*</span></label>
387
419
  <input bind:value={securityQuestion} on:keyup={validateSecurityQuestion} on:focus={() => securityQFocus = true} on:blur={() => securityQFocus = false} type="text" id="SecurityQuestion" />
@@ -428,6 +460,7 @@
428
460
  .UserContainer,
429
461
  .PasswordContainer,
430
462
  .ConfirmPasswordContainer,
463
+ .PromoCodeContainer,
431
464
  .SecurityQuestionContainer,
432
465
  .SecurityAnswerContainer {
433
466
  color: var(--emfe-w-registration-contrast, var(--emfe-w-color-gray-300, #58586B));
@@ -12,6 +12,8 @@ export const TRANSLATIONS = {
12
12
  'registerSimplePasswordError': 'Password must be 8-20 characters long.',
13
13
  'registerConfirmPassword': 'Confirm Password',
14
14
  'registerConfirmPasswordError': 'It doesn\'t match the password.',
15
+ 'registerPromoCode': 'Promotional Code (Facultative)',
16
+ 'promoCodeError': '',
15
17
  'registerSecurityQuestion': 'Security Question',
16
18
  'registerSecurityQuestion2': 'Document Type (DNI, Foreign ID Card, Passport)',
17
19
  'registerSecurityQuestionError': 'Security question must be at least 1 character long and maximum 120 characters.',
@@ -35,6 +37,8 @@ export const TRANSLATIONS = {
35
37
  'registerSimplePasswordError': '密码长度必须为 8-20 个字符。',
36
38
  'registerConfirmPassword': '確認密碼',
37
39
  'registerConfirmPasswordError': '它與密碼不匹配。',
40
+ 'registerPromoCode': '促销代码',
41
+ 'promoCodeError' : '',
38
42
  'registerSecurityQuestion': '安全問題',
39
43
  'registerSecurityQuestionError': '安全問題的長度必須至少為 1 個字符,最多 120 個字符。',
40
44
  'registerSecurityAnswer': '安全答案',
@@ -54,6 +58,8 @@ export const TRANSLATIONS = {
54
58
  'registerSimplePasswordError': 'Le mot de passe doit comporter entre 8 et 20 caractères.',
55
59
  'registerConfirmPassword': 'Confirmer le mot de passe',
56
60
  'registerConfirmPasswordError': 'ça ne correspond pas au mot de passe.',
61
+ 'registerPromoCode': 'Code Promotionnel (Facultatif)',
62
+ 'promoCodeError': '',
57
63
  'registerSecurityQuestion': 'Questions de sécurité',
58
64
  'registerSecurityQuestionError': 'La question de sécurité doit comporter au moins un caractère et au maximum 120 caractères.',
59
65
  'registerSecurityAnswer': 'Réponse de sécurité',