@adyen/kyc-components 3.0.1 → 3.0.3

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.
@@ -6187,6 +6187,7 @@ const nonInputs = (str, options) => Array.from(str).map((char) => ({
6187
6187
  includeInValue: (options == null ? void 0 : options.includeInValue) ?? false,
6188
6188
  displayEagerly: (options == null ? void 0 : options.displayEagerly) ?? true
6189
6189
  }));
6190
+ const spacer = nonInputs(" ")[0];
6190
6191
  const alphaInputs = (length, optional = false) => makeArrayOfRepeatedObjects(length, {
6191
6192
  type: "input",
6192
6193
  allow: /[A-Za-z]/,
@@ -6294,7 +6295,7 @@ const businessRegistrationNumberMasks = {
6294
6295
  },
6295
6296
  [CountryCodes.Finland]: {
6296
6297
  default: {
6297
- mask: makeMask(...numericInputs(8), ...nonInputs(" - "), ...numericInputs(1))
6298
+ mask: makeMask(...numericInputs(7), ...nonInputs(" - "), ...numericInputs(1))
6298
6299
  }
6299
6300
  },
6300
6301
  [CountryCodes.France]: {
@@ -6374,7 +6375,15 @@ const businessRegistrationNumberMasks = {
6374
6375
  default: {
6375
6376
  mask: makeMask(...nonInputs("FL", {
6376
6377
  includeInValue: true
6377
- }), ...nonInputs(" - "), ...numericInputs(4), ...nonInputs(" . "), ...numericInputs(3), ...nonInputs(" . "), ...numericInputs(3), ...nonInputs(" - "), ...numericInputs(1))
6378
+ }), spacer, ...nonInputs("-", {
6379
+ includeInValue: true
6380
+ }), spacer, ...numericInputs(4), spacer, ...nonInputs(".", {
6381
+ includeInValue: true
6382
+ }), spacer, ...numericInputs(3), spacer, ...nonInputs(".", {
6383
+ includeInValue: true
6384
+ }), spacer, ...numericInputs(3), spacer, ...nonInputs("-", {
6385
+ includeInValue: true
6386
+ }), spacer, ...numericInputs(1))
6378
6387
  }
6379
6388
  },
6380
6389
  [CountryCodes.Lithuania]: {
@@ -6438,7 +6447,11 @@ const businessRegistrationNumberMasks = {
6438
6447
  },
6439
6448
  [CountryCodes.Romania]: {
6440
6449
  default: {
6441
- mask: makeMask(...alphaInputs(1), ...numericInputs(2), ...nonInputs(" / "), ...numericInputs(1), ...numericInputs(8, true), ...nonInputs(" / "), ...numericInputs(4)),
6450
+ mask: makeMask(...alphaInputs(1), ...numericInputs(2), spacer, ...nonInputs("/", {
6451
+ includeInValue: true
6452
+ }), spacer, ...numericInputs(1), ...numericInputs(8, true), spacer, ...nonInputs("/", {
6453
+ includeInValue: true
6454
+ }), spacer, ...numericInputs(4)),
6442
6455
  transformOnType: uppercase
6443
6456
  }
6444
6457
  },
@@ -6480,6 +6493,9 @@ const businessRegistrationNumberMasks = {
6480
6493
  default: {
6481
6494
  mask: makeMask(...alphanumericInputs(8)),
6482
6495
  transformOnType: uppercase
6496
+ },
6497
+ nonProfit: {
6498
+ mask: makeMask(...numericInputs(6), ...numericInputs(1, true))
6483
6499
  }
6484
6500
  },
6485
6501
  [CountryCodes.UnitedStates]: {
@@ -6528,7 +6544,7 @@ const businessRegistrationNumberPatterns = {
6528
6544
  soleProprietorship: /^\d{8}$/
6529
6545
  },
6530
6546
  [CountryCodes.Cyprus]: {
6531
- default: /^[COP]{1,2}\d{1,8}$/
6547
+ default: /^[A-Z]{1,2}\d{1,8}$/
6532
6548
  },
6533
6549
  [CountryCodes.CzechRepublic]: {
6534
6550
  default: /^\d{8,10}$/
@@ -6540,7 +6556,7 @@ const businessRegistrationNumberPatterns = {
6540
6556
  default: /^\d{8}$/
6541
6557
  },
6542
6558
  [CountryCodes.Finland]: {
6543
- default: /^\d{7}-?\d$/
6559
+ default: /^\d{8}$/
6544
6560
  },
6545
6561
  [CountryCodes.France]: {
6546
6562
  SIRET: /^\d{9}-?\d{5}$/,
@@ -6635,7 +6651,7 @@ const businessRegistrationNumberPatterns = {
6635
6651
  default: /^\d{9}$/
6636
6652
  },
6637
6653
  [CountryCodes.Romania]: {
6638
- default: /^J\d{2}\/\d{1,9}\/\d{4}$/
6654
+ default: /^[A-Z]\d{2}\/\d{1,9}\/\d{4}$/
6639
6655
  },
6640
6656
  [CountryCodes.Singapore]: {
6641
6657
  default: /^[a-zA-Z0-9]{9,10}$/
@@ -6650,7 +6666,7 @@ const businessRegistrationNumberPatterns = {
6650
6666
  default: /^[a-zA-Z][a-zA-Z0-9]{8}$/
6651
6667
  },
6652
6668
  [CountryCodes.Sweden]: {
6653
- default: /^\d{6}-\d{4}$/
6669
+ default: /^\d{10}$/
6654
6670
  },
6655
6671
  [CountryCodes.Switzerland]: {
6656
6672
  default: /^CHE\d{9}$|^CH\d{11}$/
@@ -6810,7 +6826,7 @@ const defaultFieldConfig = {
6810
6826
  helperText: {
6811
6827
  key: "enterAMaximumOfNCharactersWithAMixForExample",
6812
6828
  values: {
6813
- numChars: "9",
6829
+ maxChars: "9",
6814
6830
  example: "T1001a, FN89060n"
6815
6831
  }
6816
6832
  }
@@ -7189,7 +7205,7 @@ const defaultFieldConfig = {
7189
7205
  values: {
7190
7206
  minChars: "8",
7191
7207
  maxChars: "11",
7192
- example: "8732PN92873"
7208
+ example: "8732P92873"
7193
7209
  }
7194
7210
  }
7195
7211
  } : {
@@ -7310,7 +7326,7 @@ const defaultFieldConfig = {
7310
7326
  helperText: {
7311
7327
  key: "enterAMaximumOfNMoreDigitsForExample",
7312
7328
  values: {
7313
- numDigits: "15",
7329
+ maxDigits: "15",
7314
7330
  example: "J40/8302/1997"
7315
7331
  }
7316
7332
  }
@@ -7322,8 +7338,8 @@ const defaultFieldConfig = {
7322
7338
  helperText: {
7323
7339
  key: "enterXToYCharactersWithAMixForExample",
7324
7340
  values: {
7325
- minDigits: "9",
7326
- maxDigits: "10",
7341
+ minChars: "9",
7342
+ maxChars: "10",
7327
7343
  example: "200312345A"
7328
7344
  }
7329
7345
  }
@@ -7388,16 +7404,37 @@ const defaultFieldConfig = {
7388
7404
  }
7389
7405
  }
7390
7406
  },
7391
- [CountryCodes.UnitedKingdom]: {
7392
- label: "companyNumber",
7393
- mask: businessRegistrationNumberMasks[CountryCodes.UnitedKingdom].default,
7394
- validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.UnitedKingdom].default),
7395
- helperText: {
7396
- key: "enterNCharactersForExample",
7397
- values: {
7398
- numChars: "8",
7399
- example: "43668490"
7400
- }
7407
+ [CountryCodes.UnitedKingdom]: ({
7408
+ companyType: companyType2
7409
+ }) => {
7410
+ switch (companyType2) {
7411
+ case "nonProfit":
7412
+ return {
7413
+ label: "charityNumber",
7414
+ mask: businessRegistrationNumberMasks[CountryCodes.UnitedKingdom].nonProfit,
7415
+ validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.UnitedKingdom].nonProfit),
7416
+ helperText: {
7417
+ key: "enterXToYDigitsForExample",
7418
+ values: {
7419
+ minDigits: "6",
7420
+ maxDigits: "7",
7421
+ example: "123456"
7422
+ }
7423
+ }
7424
+ };
7425
+ default:
7426
+ return {
7427
+ label: "companyNumber",
7428
+ mask: businessRegistrationNumberMasks[CountryCodes.UnitedKingdom].default,
7429
+ validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.UnitedKingdom].default),
7430
+ helperText: {
7431
+ key: "enterNCharactersForExample",
7432
+ values: {
7433
+ numChars: "8",
7434
+ example: "43668490"
7435
+ }
7436
+ }
7437
+ };
7401
7438
  }
7402
7439
  },
7403
7440
  [CountryCodes.UnitedStates]: {}
@@ -1,5 +1,6 @@
1
1
  import { InputToken, Mask, MaskToken, NonInputToken } from './maskTypes';
2
2
  export declare const nonInputs: (str: string, options?: Partial<NonInputToken>) => NonInputToken[];
3
+ export declare const spacer: NonInputToken;
3
4
  export declare const alphaInputs: (length: number, optional?: boolean) => InputToken[];
4
5
  export declare const numericInputs: (length: number, optional?: boolean) => InputToken[];
5
6
  export declare const alphanumericInputs: (length: number, optional?: boolean) => InputToken[];
@@ -247,6 +247,9 @@ export declare const businessRegistrationNumberMasks: {
247
247
  mask: import("../maskTypes").Mask;
248
248
  transformOnType: import("../transformers/types").InputTransformer;
249
249
  };
250
+ nonProfit: {
251
+ mask: import("../maskTypes").Mask;
252
+ };
250
253
  };
251
254
  US: {
252
255
  default: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adyen/kyc-components",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "files": [