@adyen/kyc-components 2.9.0 → 2.9.2

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.
@@ -440,6 +440,7 @@ const numerodeIVA = "Número de IVA";
440
440
  const NIF = "NIF (Número de Identificación Fiscal)";
441
441
  const uen = "Unique Entity Number (UEN)";
442
442
  const gst = "Goods and Services Tax (GST)";
443
+ const iDoNotHaveGst = "I do not have a Goods and Services Tax (GST) number";
443
444
  const number = "Number";
444
445
  const nric = "National Registration Identity Card (NRIC)";
445
446
  const hkid = "HKID Number";
@@ -1495,6 +1496,7 @@ const defaultTrans = {
1495
1496
  NIF,
1496
1497
  uen,
1497
1498
  gst,
1499
+ iDoNotHaveGst,
1498
1500
  number,
1499
1501
  nric,
1500
1502
  hkid,
@@ -4603,7 +4605,8 @@ const DriversLicenseNumberPatterns = {
4603
4605
  };
4604
4606
  const PassportNumberPatterns = {
4605
4607
  [CountryCodes.Australia]: /^[A-Z]{1,2}\d{7}$/,
4606
- [CountryCodes.HongKong]: /^(?=.{9}$)[A-Z]{1,2}\d{6}[A-Z0-9]{1,2}$/
4608
+ [CountryCodes.HongKong]: /^(?=.{9}$)[A-Z]{1,2}\d{6}[A-Z0-9]{1,2}$/,
4609
+ [CountryCodes.NewZealand]: /[A-Za-z0-9]{8,9}/
4607
4610
  };
4608
4611
  const ProofOfIdentityCardPatterns = {
4609
4612
  [CountryCodes.Australia]: /^[A-Za-z\d]{6,10}$/,
@@ -5200,59 +5203,6 @@ function InputDate(props) {
5200
5203
  maxLength: 10
5201
5204
  });
5202
5205
  }
5203
- const RadioGroup$1 = "";
5204
- const _inputRadio = "";
5205
- const InputRadio = ({
5206
- className,
5207
- ...props
5208
- }) => jsx("input", {
5209
- ...props,
5210
- className: cx("adl-input-radio__input", className)
5211
- });
5212
- function RadioGroup({
5213
- items,
5214
- i18n,
5215
- name,
5216
- onChange,
5217
- value,
5218
- isInvalid,
5219
- uniqueId: uniqueId2,
5220
- className,
5221
- disabled = false
5222
- }) {
5223
- const uniqueIdBase = uniqueId2 == null ? void 0 : uniqueId2.replace(/[0-9]/g, "").substring(0, uniqueId2.lastIndexOf("-"));
5224
- return jsx("div", {
5225
- className: "adyen-kyc-radio-group",
5226
- children: items.map((item) => {
5227
- const uniqueId22 = getUniqueId(uniqueIdBase);
5228
- return jsxs("label", {
5229
- htmlFor: uniqueId22,
5230
- className: "adl-input-radio",
5231
- children: [jsx(InputRadio, {
5232
- id: uniqueId22,
5233
- type: "radio",
5234
- checked: value === item.id,
5235
- "aria-checked": value === item.id,
5236
- name,
5237
- onChange,
5238
- onClick: onChange,
5239
- value: item.id,
5240
- disabled
5241
- }), jsx("span", {
5242
- className: cx(["adl-input-radio__label", "adyen-kyc-label__text", className, {
5243
- "adyen-kyc-radio-group__label--invalid": isInvalid
5244
- }]),
5245
- children: i18n.get(item.name)
5246
- })]
5247
- }, item.id);
5248
- })
5249
- });
5250
- }
5251
- RadioGroup.defaultProps = {
5252
- onChange: () => {
5253
- },
5254
- items: []
5255
- };
5256
5206
  const FormHeader$1 = "";
5257
5207
  function FormHeader({
5258
5208
  heading,
@@ -5289,6 +5239,53 @@ function FormHeader({
5289
5239
  children: [headerEl, descEl]
5290
5240
  });
5291
5241
  }
5242
+ const ON_CHANGE_DEBOUNCE_DURATION = 200;
5243
+ const KEYBOARD_KEYS = {
5244
+ arrowDown: "ArrowDown",
5245
+ arrowUp: "ArrowUp",
5246
+ enter: "Enter",
5247
+ escape: "Escape",
5248
+ space: " ",
5249
+ tab: "Tab"
5250
+ };
5251
+ function useGlobalData() {
5252
+ const {
5253
+ getData
5254
+ } = useStateContext();
5255
+ return getData();
5256
+ }
5257
+ function useGlobalDataSlice(sliceId, caller) {
5258
+ const {
5259
+ dispatch,
5260
+ getData
5261
+ } = useStateContext();
5262
+ const sliceData = getData()[sliceId];
5263
+ const updateState = useCallback((updatedSlice) => dispatch({
5264
+ type: "addToState",
5265
+ value: {
5266
+ ...updatedSlice,
5267
+ dataStoreId: sliceId,
5268
+ caller
5269
+ }
5270
+ // TODO merge SFValue and StateSlice types
5271
+ }), [sliceId, caller]);
5272
+ const updateStateSlice = useMemo(() => debounce(updateState, ON_CHANGE_DEBOUNCE_DURATION), [updateState]);
5273
+ return {
5274
+ sliceData,
5275
+ updateStateSlice
5276
+ };
5277
+ }
5278
+ function useResetGlobalData(caller) {
5279
+ const {
5280
+ dispatch
5281
+ } = useStateContext();
5282
+ return useCallback(() => dispatch({
5283
+ type: "resetState",
5284
+ value: {
5285
+ caller
5286
+ }
5287
+ }), [dispatch, caller]);
5288
+ }
5292
5289
  const BR_PATTERNS = {
5293
5290
  // CNPJ is a 14 digits number, formatted like 00.000.000/0001-00
5294
5291
  tax: [/^\d{14}$/, /^\d{2}\.\d{3}\.\d{3}\/\d{4}-\d{2}$/],
@@ -5437,7 +5434,7 @@ const countryBasedValidatorRules$1 = {
5437
5434
  }]
5438
5435
  }
5439
5436
  };
5440
- const taxIdFields = ["taxId", "exemptedFromTax"];
5437
+ const taxIdFields = ["taxId", "exemptedFromTax", "isUen"];
5441
5438
  function TaxId(props) {
5442
5439
  const {
5443
5440
  data: propData,
@@ -5462,13 +5459,14 @@ function TaxId(props) {
5462
5459
  fieldProblems
5463
5460
  } = useForm({
5464
5461
  ...props,
5465
- schema: (data2) => data2.exemptedFromTax ? ["exemptedFromTax"] : ["taxId", "exemptedFromTax"],
5462
+ schema: (data2) => formUtils.isRequiredField("isUen") ? ["taxId", "isUen"] : data2.exemptedFromTax ? ["exemptedFromTax"] : ["taxId", "exemptedFromTax"],
5466
5463
  rules: validationRules,
5467
5464
  defaultData: {
5468
5465
  ...propData,
5469
- exemptedFromTax: Boolean(propData == null ? void 0 : propData.exemptedFromTax)
5466
+ exemptedFromTax: Boolean(propData == null ? void 0 : propData.exemptedFromTax),
5467
+ // exemptedFromTax should be a boolean
5468
+ isUen: formUtils.isRequiredField("isUen") ? Boolean(propData == null ? void 0 : propData.isUen) : void 0
5470
5469
  },
5471
- // exemptedFromTax should be a boolean
5472
5470
  fieldProblems: fieldValidationErrors
5473
5471
  });
5474
5472
  useEffect(() => {
@@ -5489,11 +5487,28 @@ function TaxId(props) {
5489
5487
  }
5490
5488
  });
5491
5489
  }, [data, valid, errors, isValid, dataStoreId]);
5490
+ const {
5491
+ sliceData: companyDetails2
5492
+ } = useGlobalDataSlice("companyDetails");
5493
+ const registrationNumber2 = companyDetails2 == null ? void 0 : companyDetails2.registrationNumber;
5494
+ const handleUenOrGstChange = (isUen) => {
5495
+ handleChangeFor("isUen", "input")(isUen);
5496
+ if (isUen) {
5497
+ handleChangeFor("taxId", "blur")(registrationNumber2);
5498
+ return;
5499
+ }
5500
+ handleChangeFor("taxId", "blur")("");
5501
+ };
5502
+ useEffect(() => {
5503
+ if (data.isUen) {
5504
+ handleChangeFor("taxId", "blur")(registrationNumber2);
5505
+ }
5506
+ }, [registrationNumber2]);
5492
5507
  return !formUtils.isRequiredField("taxId") ? null : jsxs("div", {
5493
5508
  className: "adyen-kyc-field--tax-id",
5494
5509
  children: [jsx(StateContextSetter, {
5495
5510
  stateRef
5496
- }), jsx(Field, {
5511
+ }), !data.isUen && jsx(Field, {
5497
5512
  name: "taxId",
5498
5513
  label: formUtils.getLabel("taxId"),
5499
5514
  classNameModifiers: ["tax-id"],
@@ -5507,11 +5522,20 @@ function TaxId(props) {
5507
5522
  classNameModifiers: ["taxId"],
5508
5523
  onInput: handleChangeFor("taxId", "input"),
5509
5524
  onBlur: handleChangeFor("taxId", "blur"),
5510
- disabled: data.exemptedFromTax,
5525
+ disabled: data.exemptedFromTax || data.isUen,
5511
5526
  "aria-required": true,
5512
5527
  "aria-label": formUtils.getLabel("taxId"),
5513
5528
  "aria-invalid": !valid.taxId
5514
5529
  })
5530
+ }), formUtils.isRequiredField("isUen") && jsx(Checkbox, {
5531
+ name: "isUen",
5532
+ label: formUtils.getLabel("iDoNotHaveGst"),
5533
+ classNameModifiers: ["exempted-from-tax"],
5534
+ checked: Boolean(data.isUen),
5535
+ onChange: handleUenOrGstChange,
5536
+ "aria-required": false,
5537
+ "aria-label": formUtils.getLabel("iDoNotHaveGst"),
5538
+ "aria-invalid": false
5515
5539
  }), formUtils.isRequiredField("exemptedFromTax") && jsx(Checkbox, {
5516
5540
  name: "exemptedFromTax",
5517
5541
  label: formUtils.getLabel("exemptedFromTax"),
@@ -5528,15 +5552,6 @@ function TaxId(props) {
5528
5552
  }
5529
5553
  const vatAbsenceReasons = ["industryExemption", "belowTaxThreshold"];
5530
5554
  const Select$1 = "";
5531
- const ON_CHANGE_DEBOUNCE_DURATION = 200;
5532
- const KEYBOARD_KEYS = {
5533
- arrowDown: "ArrowDown",
5534
- arrowUp: "ArrowUp",
5535
- enter: "Enter",
5536
- escape: "Escape",
5537
- space: " ",
5538
- tab: "Tab"
5539
- };
5540
5555
  const getScrollParent = (node) => {
5541
5556
  const isElement = node instanceof HTMLElement;
5542
5557
  const overflowY = isElement && window.getComputedStyle(node).overflowY;
@@ -7117,13 +7132,6 @@ function VatNumber(props) {
7117
7132
  }) : null]
7118
7133
  });
7119
7134
  }
7120
- const uenOrGstItems = [{
7121
- id: "UEN",
7122
- name: "uen"
7123
- }, {
7124
- id: "GST",
7125
- name: "gst"
7126
- }];
7127
7135
  const companyDetailsValidationRules = {
7128
7136
  tradingName: {
7129
7137
  modes: ["blur"],
@@ -7152,11 +7160,6 @@ const companyDetailsValidationRules = {
7152
7160
  modes: ["blur"],
7153
7161
  validate: (dateOfIncorporation2) => dateOfIncorporation2 && new Date(dateOfIncorporation2) < /* @__PURE__ */ new Date(),
7154
7162
  errorMessage: "invalidDateOfIncorporation"
7155
- }],
7156
- uenOrGst: [{
7157
- modes: ["blur"],
7158
- validate: (uenOrGst) => !!uenOrGst,
7159
- errorMessage: "fieldIsRequired"
7160
7163
  }]
7161
7164
  };
7162
7165
  const FLOWS_THAT_HIDE_REGISTRATION_NUMBER = [{
@@ -7178,7 +7181,7 @@ const FLOWS_THAT_HIDE_REGISTRATION_NUMBER = [{
7178
7181
  companyType: [CompanyTypesValue.SOLE_PROPRIETORSHIP],
7179
7182
  country: CountryCodes.PuertoRico
7180
7183
  }];
7181
- const companyDetailFields = ["tradingName", "sameNameAsLegalName", ...businessRegistrationNumberFields, "stockExchangeMIC", "stockISIN", ...vatNumberFields, ...taxIdFields, "dateOfIncorporation", "uenOrGst"];
7184
+ const companyDetailFields = ["tradingName", "sameNameAsLegalName", ...businessRegistrationNumberFields, "stockExchangeMIC", "stockISIN", ...vatNumberFields, ...taxIdFields, "dateOfIncorporation"];
7182
7185
  function CompanyDetailsComponent(props) {
7183
7186
  var _a, _b;
7184
7187
  const {
@@ -7192,7 +7195,7 @@ function CompanyDetailsComponent(props) {
7192
7195
  setState: null
7193
7196
  });
7194
7197
  const COMPANY_DETAILS = props.id;
7195
- const directChildFields = (props.requiredFields || companyDetailFields).filter((field) => ["tradingName", "sameNameAsLegalName", "stockExchangeMIC", "stockISIN", "dateOfIncorporation", "uenOrGst"].includes(field));
7198
+ const directChildFields = (props.requiredFields || companyDetailFields).filter((field) => ["tradingName", "sameNameAsLegalName", "stockExchangeMIC", "stockISIN", "dateOfIncorporation"].includes(field));
7196
7199
  const {
7197
7200
  getData
7198
7201
  } = useStateContext();
@@ -7386,25 +7389,7 @@ function CompanyDetailsComponent(props) {
7386
7389
  ...vatNumberProps,
7387
7390
  dataStoreId: COMPANY_DETAILS,
7388
7391
  country: props.country
7389
- }), formUtils.isRequiredField("uenOrGst") && jsx(Field, {
7390
- name: "uenOrGst",
7391
- label: formUtils.getLabel("UEN/GST"),
7392
- classNameModifiers: ["uenOrGst"],
7393
- errorMessage: formUtils.getErrorMessage("dateOfIncorporation", errors, fieldProblems),
7394
- isValid: valid.uenOrGst,
7395
- children: (childProps) => jsx(RadioGroup, {
7396
- ...childProps,
7397
- name: "uenOrGst",
7398
- items: uenOrGstItems,
7399
- value: data.uenOrGst,
7400
- i18n,
7401
- disabled: formUtils.isReadOnly("uenOrGst"),
7402
- onChange: handleChangeFor("uenOrGst", "input"),
7403
- "aria-required": true,
7404
- "aria-label": formUtils.getLabel("uenOrGst"),
7405
- "aria-invalid": !valid.uenOrGst
7406
- })
7407
- }), (formUtils.isRequiredField("taxId") && !formUtils.isRequiredField("uenOrGst") || formUtils.isRequiredField("uenOrGst") && !!data.uenOrGst) && jsx(TaxId, {
7392
+ }), formUtils.isRequiredField("taxId") && jsx(TaxId, {
7408
7393
  ...taxIdProps,
7409
7394
  dataStoreId: COMPANY_DETAILS,
7410
7395
  country: props.country
@@ -7443,44 +7428,6 @@ var SettingNames = /* @__PURE__ */ ((SettingNames2) => {
7443
7428
  SettingNames2["RequirePciSignPosMoto"] = "requirePciSignPosMoto";
7444
7429
  return SettingNames2;
7445
7430
  })(SettingNames || {});
7446
- function useGlobalData() {
7447
- const {
7448
- getData
7449
- } = useStateContext();
7450
- return getData();
7451
- }
7452
- function useGlobalDataSlice(sliceId, caller) {
7453
- const {
7454
- dispatch,
7455
- getData
7456
- } = useStateContext();
7457
- const sliceData = getData()[sliceId];
7458
- const updateState = useCallback((updatedSlice) => dispatch({
7459
- type: "addToState",
7460
- value: {
7461
- ...updatedSlice,
7462
- dataStoreId: sliceId,
7463
- caller
7464
- }
7465
- // TODO merge SFValue and StateSlice types
7466
- }), [sliceId, caller]);
7467
- const updateStateSlice = useMemo(() => debounce(updateState, ON_CHANGE_DEBOUNCE_DURATION), [updateState]);
7468
- return {
7469
- sliceData,
7470
- updateStateSlice
7471
- };
7472
- }
7473
- function useResetGlobalData(caller) {
7474
- const {
7475
- dispatch
7476
- } = useStateContext();
7477
- return useCallback(() => dispatch({
7478
- type: "resetState",
7479
- value: {
7480
- caller
7481
- }
7482
- }), [dispatch, caller]);
7483
- }
7484
7431
  function useDataset(datasetIdentifier2, skip) {
7485
7432
  const {
7486
7433
  i18n
@@ -7806,9 +7753,6 @@ const companyBase = {
7806
7753
  dateOfIncorporation: {
7807
7754
  rule: "countryRequiresDateOfIncorporationForCompanies"
7808
7755
  },
7809
- uenOrGst: {
7810
- rule: "countryUsesUenOrGst"
7811
- },
7812
7756
  exemptedFromRegistrationNumber: {
7813
7757
  rule: "companyRegistrationNumberExemptionAllowed"
7814
7758
  },
@@ -7831,6 +7775,9 @@ const taxIdBase$1 = {
7831
7775
  },
7832
7776
  vatNumber: {
7833
7777
  rule: "countryUsesVat"
7778
+ },
7779
+ isUen: {
7780
+ rule: "countryUsesUenOrGst"
7834
7781
  }
7835
7782
  };
7836
7783
  const companyTypes = [{
@@ -8271,7 +8218,7 @@ const countryConfig$4 = {
8271
8218
  label: "irdDocument"
8272
8219
  },
8273
8220
  registrationNumber: {
8274
- label: "NZBN"
8221
+ label: "NZBN/NCN"
8275
8222
  },
8276
8223
  taxId: {
8277
8224
  label: "IRD"
@@ -8388,7 +8335,7 @@ const countryConfig$4 = {
8388
8335
  label: "companyType"
8389
8336
  },
8390
8337
  taxId: {
8391
- label: "number"
8338
+ label: "gst"
8392
8339
  },
8393
8340
  exemptedFromVat: {
8394
8341
  label: "vatNumberExempted"
@@ -8795,6 +8742,14 @@ function AccountHolder(props) {
8795
8742
  });
8796
8743
  }
8797
8744
  const RadioCard$1 = "";
8745
+ const _inputRadio = "";
8746
+ const InputRadio = ({
8747
+ className,
8748
+ ...props
8749
+ }) => jsx("input", {
8750
+ ...props,
8751
+ className: cx("adl-input-radio__input", className)
8752
+ });
8798
8753
  const RadioCard = ({
8799
8754
  optionId,
8800
8755
  optionName,
@@ -9675,6 +9630,7 @@ const ADDRESS_SCHEMAS = {
9675
9630
  [CountryCodes.UnitedKingdom]: [COUNTRY, HOUSE_NUMBER, STREET, CITY, POSTAL_CODE, STATE],
9676
9631
  [CountryCodes.UnitedStates]: [COUNTRY, STREET, HOUSE_NUMBER, CITY, STATE, POSTAL_CODE],
9677
9632
  [CountryCodes.HongKong]: [COUNTRY, STREET, HOUSE_NUMBER, CITY, STATE],
9633
+ [CountryCodes.NewZealand]: [COUNTRY, STREET, HOUSE_NUMBER, POSTAL_CODE, CITY, STATE],
9678
9634
  default: [COUNTRY, STREET, HOUSE_NUMBER, POSTAL_CODE, CITY, STATE]
9679
9635
  };
9680
9636
  const LABELS = {
@@ -10621,6 +10577,51 @@ Address.defaultProps = {
10621
10577
  requiredFields: ADDRESS_SCHEMA,
10622
10578
  countryCode: null
10623
10579
  };
10580
+ const RadioGroup$1 = "";
10581
+ function RadioGroup({
10582
+ items,
10583
+ i18n,
10584
+ name,
10585
+ onChange,
10586
+ value,
10587
+ isInvalid,
10588
+ uniqueId: uniqueId2,
10589
+ className,
10590
+ disabled = false
10591
+ }) {
10592
+ const uniqueIdBase = uniqueId2 == null ? void 0 : uniqueId2.replace(/[0-9]/g, "").substring(0, uniqueId2.lastIndexOf("-"));
10593
+ return jsx("div", {
10594
+ className: "adyen-kyc-radio-group",
10595
+ children: items.map((item) => {
10596
+ const uniqueId22 = getUniqueId(uniqueIdBase);
10597
+ return jsxs("label", {
10598
+ htmlFor: uniqueId22,
10599
+ className: "adl-input-radio",
10600
+ children: [jsx(InputRadio, {
10601
+ id: uniqueId22,
10602
+ type: "radio",
10603
+ checked: value === item.id,
10604
+ "aria-checked": value === item.id,
10605
+ name,
10606
+ onChange,
10607
+ onClick: onChange,
10608
+ value: item.id,
10609
+ disabled
10610
+ }), jsx("span", {
10611
+ className: cx(["adl-input-radio__label", "adyen-kyc-label__text", className, {
10612
+ "adyen-kyc-radio-group__label--invalid": isInvalid
10613
+ }]),
10614
+ children: i18n.get(item.name)
10615
+ })]
10616
+ }, item.id);
10617
+ })
10618
+ });
10619
+ }
10620
+ RadioGroup.defaultProps = {
10621
+ onChange: () => {
10622
+ },
10623
+ items: []
10624
+ };
10624
10625
  var operationalAddressIsSameIds = /* @__PURE__ */ ((operationalAddressIsSameIds2) => {
10625
10626
  operationalAddressIsSameIds2["OPERATIONAL_ADDRESS_IS_SAME"] = "OperationAddressAnswerYes";
10626
10627
  operationalAddressIsSameIds2["OPERATIONAL_ADDRESS_IS_NOT_SAME"] = "OperationAddressAnswerNo";
@@ -11132,7 +11133,7 @@ const fileToBase64 = (file) => new Promise((resolve, reject) => {
11132
11133
  });
11133
11134
  const getFileExtention = (fileName2) => fileName2.split(".").pop();
11134
11135
  const COUNTRIES_THAT_DONT_REQUIRE_SOLE_PROP_REGISTRATION = [CountryCodes.Australia, CountryCodes.Gibraltar, CountryCodes.Guernsey, CountryCodes.Ireland, CountryCodes.IsleOfMan, CountryCodes.Jersey, CountryCodes.Malta, CountryCodes.PuertoRico, CountryCodes.Spain, CountryCodes.UnitedKingdom, CountryCodes.UnitedStates];
11135
- const COUNTRIES_THAT_DONT_REQUIRE_COMPANY_REGISTRATION = [CountryCodes.Singapore, CountryCodes.UnitedStates];
11136
+ const COUNTRIES_THAT_DONT_REQUIRE_COMPANY_REGISTRATION = [CountryCodes.UnitedStates];
11136
11137
  const COUNTRIES_WITH_POSSIBLE_REGISTRATION_EXEMPTIONS_FOR_SOLE_PROPS = [CountryCodes.Austria, CountryCodes.Canada, CountryCodes.Finland, CountryCodes.Germany, CountryCodes.Lithuania, CountryCodes.Luxembourg, CountryCodes.Poland, CountryCodes.Sweden, CountryCodes.Switzerland];
11137
11138
  const COUNTRIES_THAT_USE_TAX_ID_INSTEAD_OF_VAT = [CountryCodes.Australia, CountryCodes.Canada, CountryCodes.Gibraltar, CountryCodes.HongKong, CountryCodes.NewZealand, CountryCodes.PuertoRico, CountryCodes.Singapore, CountryCodes.UnitedStates];
11138
11139
  const COUNTRIES_THAT_DO_NOT_USE_TAX_ID_FOR_SOLE_PROP = [CountryCodes.NewZealand, CountryCodes.Singapore];
@@ -11674,6 +11675,7 @@ const updateTaxInformation = ({
11674
11675
  taxId: taxId2,
11675
11676
  country: country2,
11676
11677
  exemptedFromTax: exemptedFromTax2 = false,
11678
+ isUen,
11677
11679
  entity
11678
11680
  }) => {
11679
11681
  var _a;
@@ -11684,13 +11686,12 @@ const updateTaxInformation = ({
11684
11686
  }, {})) ?? {};
11685
11687
  if (exemptedFromTax2) {
11686
11688
  delete taxInformation[country2];
11687
- } else if (updatedEntity.uenOrGst) {
11689
+ } else if (isUen !== void 0) {
11688
11690
  taxInformation[country2] = {
11689
11691
  country: country2,
11690
- type: updatedEntity.uenOrGst,
11692
+ type: isUen ? "UEN" : "GST",
11691
11693
  number: taxId2
11692
11694
  };
11693
- delete updatedEntity.uenOrGst;
11694
11695
  } else {
11695
11696
  taxInformation[country2] = {
11696
11697
  country: country2,
@@ -11803,7 +11804,7 @@ const companyBaseMapping = {
11803
11804
  "companyDetails.vatNumber": "organization.vatNumber",
11804
11805
  "companyDetails.vatAbsenceReason": "organization.vatAbsenceReason",
11805
11806
  "companyDetails.dateOfIncorporation": "organization.dateOfIncorporation",
11806
- "companyDetails.uenOrGst": "organization.uenOrGst",
11807
+ "companyDetails.isUen": "organization.isUen",
11807
11808
  "companyDetails.stockExchangeMIC": "organization.stockData.marketIdentifier",
11808
11809
  "companyDetails.stockISIN": "organization.stockData.stockNumber",
11809
11810
  "companyRegistrationAddress.registrationAddress.city": "organization.registeredAddress.city",
@@ -12053,7 +12054,12 @@ const mapLegalEntityToCompany = (legalEntity, isChangingType) => {
12053
12054
  const countryTaxInformation = taxInformation.find((info) => info.country === country2);
12054
12055
  companyCompData.companyDetails.taxId = countryTaxInformation == null ? void 0 : countryTaxInformation.number;
12055
12056
  companyCompData.companyDetails.exemptedFromTax = false;
12056
- companyCompData.companyDetails.uenOrGst = countryTaxInformation == null ? void 0 : countryTaxInformation.type;
12057
+ if ((countryTaxInformation == null ? void 0 : countryTaxInformation.type) === "UEN") {
12058
+ companyCompData.companyDetails.isUen = true;
12059
+ }
12060
+ if ((countryTaxInformation == null ? void 0 : countryTaxInformation.type) === "GST") {
12061
+ companyCompData.companyDetails.isUen = false;
12062
+ }
12057
12063
  }
12058
12064
  if ((_d = legalEntity == null ? void 0 : legalEntity.documentDetails) == null ? void 0 : _d.length) {
12059
12065
  companyCompData = {
@@ -12082,6 +12088,7 @@ const mapCompanyToLegalEntity = (data) => {
12082
12088
  requestObj.organization = updateTaxInformation({
12083
12089
  taxId: data.companyDetails.taxId,
12084
12090
  country: data.companyNameAndCountry.country,
12091
+ isUen: data.companyDetails.isUen,
12085
12092
  entity: requestObj.organization
12086
12093
  });
12087
12094
  }
@@ -15046,7 +15053,6 @@ function IdentityHKComponent(props) {
15046
15053
  const hkIdentityFields = [...additionalIdentityInfoFields$1, "idNumber"];
15047
15054
  const additionalIdentityInfoFields = ["typeOfIdentity", "licenseCardNumber"];
15048
15055
  const identityTypes = ["nationalIdNumber", "passport", "driversLicense", "proofOfIdentityCard"];
15049
- const PASSPORT_NUMBER_PATTERN = /^[A-Z]{1,2}\d{7}$/;
15050
15056
  const nzIdentityValidationRules = {
15051
15057
  typeOfIdentity: [isTruthyValidator],
15052
15058
  idNumber: [{
@@ -15055,7 +15061,7 @@ const nzIdentityValidationRules = {
15055
15061
  const value = val ?? "";
15056
15062
  switch ((_b = (_a = context == null ? void 0 : context.state) == null ? void 0 : _a.data) == null ? void 0 : _b.typeOfIdentity) {
15057
15063
  case "passport":
15058
- return PASSPORT_NUMBER_PATTERN.test(value);
15064
+ return PassportNumberPatterns[CountryCodes.NewZealand].test(value);
15059
15065
  case "driversLicense":
15060
15066
  return DriversLicenseNumberPatterns[CountryCodes.NewZealand].test(value);
15061
15067
  default:
@@ -18498,18 +18504,6 @@ function SolePropComponent(props) {
18498
18504
  });
18499
18505
  }
18500
18506
  const Trust = "";
18501
- const ContextHelper$1 = "";
18502
- const ContextHelper = ({
18503
- content
18504
- }) => jsx("div", {
18505
- className: "adl-context-helper",
18506
- children: jsxs("div", {
18507
- className: "adl-context-helper__content",
18508
- children: [jsx(Icon, {
18509
- name: "info-circle"
18510
- }), content]
18511
- })
18512
- });
18513
18507
  var TrustTypes = /* @__PURE__ */ ((TrustTypes2) => {
18514
18508
  TrustTypes2["BUSINESS_TRUST"] = "businessTrust";
18515
18509
  TrustTypes2["CASH_MANAGEMENT_TRUST"] = "cashManagementTrust";
@@ -18532,6 +18526,18 @@ var TrustTypes = /* @__PURE__ */ ((TrustTypes2) => {
18532
18526
  TrustTypes2["UNLISTED_PUBLIC_UNIT_TRUST"] = "unlistedPublicUnitTrust";
18533
18527
  return TrustTypes2;
18534
18528
  })(TrustTypes || {});
18529
+ const ContextHelper$1 = "";
18530
+ const ContextHelper = ({
18531
+ content
18532
+ }) => jsx("div", {
18533
+ className: "adl-context-helper",
18534
+ children: jsxs("div", {
18535
+ className: "adl-context-helper__content",
18536
+ children: [jsx(Icon, {
18537
+ name: "info-circle"
18538
+ }), content]
18539
+ })
18540
+ });
18535
18541
  const trustTypeOptions = [{
18536
18542
  id: TrustTypes.BUSINESS_TRUST,
18537
18543
  name: "businessTrust"
@@ -18658,6 +18664,8 @@ function TrustRegistrationDetailsComponent(props) {
18658
18664
  triggerValidation(["country"]);
18659
18665
  }
18660
18666
  }, [(_a = props.data) == null ? void 0 : _a.country]);
18667
+ const nzTrustTypes = [TrustTypes.DISCRETIONARY_TRUST, TrustTypes.FAMILY_TRUST, TrustTypes.CHARTIABLE_TRUST, TrustTypes.FAMILY_TRUST];
18668
+ const selectableTrustTypeOptions = props.country === CountryCodes.NewZealand ? [...nzTrustTypes, TrustTypes.OTHER_TRUST].map((nzTrustType) => trustTypeOptions.find((trustTypeOption) => trustTypeOption.id === nzTrustType)).filter((t) => !!t) : trustTypeOptions.filter((trustTypeOption) => !nzTrustTypes.includes(trustTypeOption.id));
18661
18669
  return jsxs(Fragment, {
18662
18670
  children: [jsx(StateContextSetter, {
18663
18671
  owner: TRUST_REGISTRATION_DETAILS,
@@ -18711,7 +18719,7 @@ function TrustRegistrationDetailsComponent(props) {
18711
18719
  name: "trustType",
18712
18720
  onChange: handleChangeFor("trustType", "blur"),
18713
18721
  selected: data.trustType,
18714
- items: trustTypeOptions.map(({
18722
+ items: selectableTrustTypeOptions.map(({
18715
18723
  id: id2,
18716
18724
  name
18717
18725
  }) => ({
@@ -20344,15 +20352,17 @@ function getBaseTrackingPayload({
20344
20352
  }
20345
20353
  const removeOldDataBySchema = (dataSubmitted, savedLegalEntityData) => {
20346
20354
  Object.keys(savedLegalEntityData).forEach((formId) => {
20347
- Object.keys(savedLegalEntityData[formId]).forEach((key) => {
20348
- if (dataSubmitted[formId][key] === void 0) {
20349
- if (Array.isArray(savedLegalEntityData[formId][key])) {
20350
- dataSubmitted[formId][key] = [];
20351
- } else {
20352
- dataSubmitted[formId][key] = "";
20355
+ if (savedLegalEntityData[formId]) {
20356
+ Object.keys(savedLegalEntityData[formId]).forEach((key) => {
20357
+ if (dataSubmitted[formId][key] === void 0) {
20358
+ if (Array.isArray(savedLegalEntityData[formId][key])) {
20359
+ dataSubmitted[formId][key] = [];
20360
+ } else {
20361
+ dataSubmitted[formId][key] = "";
20362
+ }
20353
20363
  }
20354
- }
20355
- });
20364
+ });
20365
+ }
20356
20366
  });
20357
20367
  return dataSubmitted;
20358
20368
  };