@everymatrix/player-profile-info 1.14.7 → 1.15.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/player-profile-info",
3
- "version": "1.14.7",
3
+ "version": "1.15.0",
4
4
  "main": "dist/player-profile-info.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": "e0c4908ae0358ad455046427736d3bbb675e6fb6"
38
+ "gitHead": "15ce8765c213b2c036dd5fbc5007d6ea5a666dc1"
39
39
  }
@@ -16,6 +16,7 @@
16
16
  export let clientstyling:string = '';
17
17
  export let clientstylingurl:string = '';
18
18
  export let translationurl:string = '';
19
+ export let custominputtextswitch:string = 'false';
19
20
 
20
21
  let customStylingContainer:HTMLElement;
21
22
  let isLoading:boolean = true;
@@ -55,6 +56,10 @@
55
56
  // Native bridge
56
57
  let isOnNative:boolean = false;
57
58
 
59
+ let regexValidators:any = {
60
+ document: /^(?=.*[a-zA-Z0-9])[a-zA-Z0-9\s]+$/
61
+ }
62
+
58
63
  const setTranslationUrl = ():void => {
59
64
  let url:string = translationurl;
60
65
 
@@ -267,8 +272,19 @@
267
272
  }
268
273
 
269
274
  const checkSecurityQuestion = ():boolean => {
270
- if (playerQuestion && playerQuestion.length <= 120) {
271
- return true;
275
+ if (securityQuestion)
276
+ switch(custominputtextswitch) {
277
+ case 'true':
278
+ if (regexValidators.document.test(securityQuestion) && securityQuestion.length <= 50) {
279
+ return true;
280
+ }
281
+ break;
282
+
283
+ case 'false':
284
+ if (securityQuestion && securityQuestion.length <= 120) {
285
+ return true;
286
+ }
287
+ break;
272
288
  }
273
289
 
274
290
  return false;
@@ -280,8 +296,19 @@
280
296
  }
281
297
 
282
298
  const checkSecurityAnswer = ():boolean => {
283
- if (playerAnswer && playerAnswer.length <= 120) {
284
- return true;
299
+ if (securityAnswer)
300
+ switch(custominputtextswitch) {
301
+ case 'true':
302
+ if (regexValidators.document.test(securityAnswer) && securityAnswer.length <= 50) {
303
+ return true;
304
+ }
305
+ break;
306
+
307
+ case 'false':
308
+ if (securityAnswer && securityAnswer.length <= 120) {
309
+ return true;
310
+ }
311
+ break;
285
312
  }
286
313
 
287
314
  return false;
@@ -492,17 +519,17 @@
492
519
  {/if}
493
520
  </div>
494
521
  <div class="PlayerInfoBox {invalidSecurityQuestion ? 'InvalidField' : ''}">
495
- <label>{$_('securityQuestion')}</label>
522
+ <label for="SecurityQuestion">{custominputtextswitch == 'true' ? $_('profileSecurityQuestion2') : $_('profileSecurityQuestion')}:<span class="FormRequired">*</span></label>
496
523
  <input type="text" bind:value={playerQuestion} on:keyup={() => checkForChanges()} on:blur={validateSecurityQuestion} placeholder={noPlayerData ? securityQuestion : ''} />
497
524
  {#if invalidSecurityQuestion}
498
- <p class="InvalidInput">{$_('securityQuestionError')}</p>
525
+ <p class="InvalidInput">{custominputtextswitch == 'true' ? $_('profileSecurityQuestionError2') : $_('profileSecurityQuestionError')}</p>
499
526
  {/if}
500
527
  </div>
501
528
  <div class="PlayerInfoBox {invalidSecurityAnswer ? 'InvalidField' : ''}">
502
- <label>{$_('securityAnswer')}</label>
529
+ <label for="SecurityAnswer">{custominputtextswitch == 'true' ? $_('profileSecurityAnswer2') : $_('profileSecurityAnswer')}:<span class="FormRequired">*</span></label>
503
530
  <input type="text" bind:value={playerAnswer} on:keyup={() => checkForChanges()} on:blur={validateSecurityAnswer} placeholder={noPlayerData ? securityAnswer : ''} />
504
531
  {#if invalidSecurityAnswer}
505
- <p class="InvalidInput">{$_('securityAnswerError')}</p>
532
+ <p class="InvalidInput">{custominputtextswitch == 'true' ? $_('profileSecurityAnswerError2') : $_('profileSecurityAnswerError')}</p>
506
533
  {/if}
507
534
  </div>
508
535
  <div class="PlayerInfoBox">
@@ -6,11 +6,15 @@ export const TRANSLATIONS = {
6
6
  "userPhone": "Phone:",
7
7
  "userPhoneError": "Mobile must be at least 5 character long and 12 characters maximum.",
8
8
  "userEmail": "Email:",
9
- "securityQuestion": "Document Type (DNI, Foreign ID Card, Passport):",
10
- "securityQuestionError": "Security question must be at least 1 character long and maximum 120 characters.",
9
+ "profileSecurityQuestion": "Security Question",
10
+ 'profileSecurityQuestion2': 'Document Type (DNI, Foreign ID Card, Passport)',
11
+ "profileSecurityQuestionError": "Security question must be at least 1 character long and maximum 120 characters.",
12
+ "profileSecurityQuestionError2": "Only letters and numbers are accepted.",
11
13
  "firstName": "First Name:",
12
- "securityAnswer": "Document Number:",
13
- "securityAnswerError": "Security answer must be at least 1 character long and maximum 120 characters.",
14
+ "profileSecurityAnswer": "Security Answer",
15
+ "profileSecurityAnswer2": "Document Number:",
16
+ "profileSecurityAnswerError": "Security answer must be at least 1 character long and maximum 120 characters.",
17
+ "profileSecurityAnswerError2": "Only letters and numbers are accepted.",
14
18
  "lastName": "Last Name:",
15
19
  "dateOfBirth": "Date of Birth:",
16
20
  "currency": "Currency:",