@adyen/kyc-components 2.59.11 → 2.60.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.
Files changed (27) hide show
  1. package/dist/es/adyen-kyc-components.es.js +776 -597
  2. package/dist/style.css +2 -2
  3. package/dist/types/components/BusinessTypeSelection/component/BusinessTypeSelection.d.ts +1 -1
  4. package/dist/types/components/Company/component/CompanyComponent.d.ts +1 -1
  5. package/dist/types/components/CompanyRegistrationDetails/types.d.ts +2 -1
  6. package/dist/types/components/Dropins/BusinessDetailsDropin/types.d.ts +0 -13
  7. package/dist/types/components/Dropins/BusinessDetailsDropin/utils.d.ts +1 -2
  8. package/dist/types/components/Dropins/FormNavigation/types.d.ts +3 -3
  9. package/dist/types/components/Introduction/constants.d.ts +0 -14
  10. package/dist/types/components/PersonalDetails/component/IdentityComponent/IdentityAu/component/DriversLicense.d.ts +3 -1
  11. package/dist/types/components/PersonalDetails/component/IdentityComponent/IdentityNZ/component/DriversLicense.d.ts +3 -1
  12. package/dist/types/components/RegistrationAddress/types.d.ts +2 -0
  13. package/dist/types/components/SoleProp/component/SolePropComponent.d.ts +1 -1
  14. package/dist/types/components/TrustRegistrationDetails/types.d.ts +2 -1
  15. package/dist/types/components/UIElement/UIElement.d.ts +1 -1
  16. package/dist/types/components/internal/ContextGuidance/ContextGuidance.d.ts +1 -1
  17. package/dist/types/components/internal/ContextGuidance/types.d.ts +2 -0
  18. package/dist/types/components/internal/DBANameField/DBANameField.d.ts +1 -1
  19. package/dist/types/components/internal/DBANameField/types.d.ts +4 -1
  20. package/dist/types/components/internal/Summary/types.d.ts +3 -2
  21. package/dist/types/core/Context/ExperimentContext/types.d.ts +3 -2
  22. package/dist/types/core/hooks/useAnalytics.d.ts +4 -3
  23. package/dist/types/core/user-events.d.ts +38 -22
  24. package/dist/types/core/utils.d.ts +4 -5
  25. package/dist/types/utils/mapping/componentApiMapping.d.ts +11 -4
  26. package/dist/types/utils/trackNavigation.d.ts +3 -3
  27. package/package.json +1 -1
@@ -1257,6 +1257,7 @@ const defaultTrans = {
1257
1257
  sortCode: "Sort code",
1258
1258
  ssn: "SSN",
1259
1259
  stamregister: "Stamregister erhverv (SE-nummer)",
1260
+ start: "Start",
1260
1261
  startANewSessionFromTheSamePlaceYouOriginallyAccessed: "Start a new session from the same place you originally accessed this page.",
1261
1262
  startTypingTheAddress: "Start typing the address",
1262
1263
  state: "State",
@@ -2853,12 +2854,13 @@ var ExperimentNames = /* @__PURE__ */ ((ExperimentNames2) => {
2853
2854
  ExperimentNames2["HidePciTask"] = "HidePciTask";
2854
2855
  ExperimentNames2["EnableAgeVerification"] = "EnableAgeVerification";
2855
2856
  ExperimentNames2["PreserveMismatchedInitialValues"] = "PreserveMismatchedInitialValues";
2856
- ExperimentNames2["StrictNameAndAddressValidationV4"] = "StrictNameAndAddressValidationV4";
2857
2857
  ExperimentNames2["EnableNationalitySGHK"] = "EnableNationalitySGHK";
2858
2858
  ExperimentNames2["EnableAUGovernmentalOrganizationSkipRegistrationNumber"] = "EnableAUGovernmentalOrganizationSkipRegistrationNumber";
2859
2859
  ExperimentNames2["EnableMinimalRegistrationNumberValidationForAuIncorporatedAssociation"] = "EnableMinimalRegistrationNumberValidationForAuIncorporatedAssociation";
2860
- ExperimentNames2["EnableFinancialInformationComponentV4"] = "EnableFinancialInformationComponentV4";
2861
2860
  ExperimentNames2["EnablePreferInstantVerificationFlow"] = "EnablePreferInstantVerificationFlow";
2861
+ ExperimentNames2["EnableFinancialInformationComponentV4"] = "EnableFinancialInformationComponentV4";
2862
+ ExperimentNames2["StrictNameAndAddressValidationV4"] = "StrictNameAndAddressValidationV4";
2863
+ ExperimentNames2["EnableLemApiVersionV4"] = "EnableLemApiVersionV4";
2862
2864
  ExperimentNames2["EnablePhoneFieldScenario"] = "EnablePhoneFieldScenario";
2863
2865
  return ExperimentNames2;
2864
2866
  })(ExperimentNames || {});
@@ -7972,6 +7974,13 @@ class UserEvents {
7972
7974
  constructor() {
7973
7975
  this.queue = [];
7974
7976
  this.subscriptions = /* @__PURE__ */ new Set();
7977
+ this.baseTrackingPayload = {
7978
+ category: "onboarding",
7979
+ subCategory: "hosted onboarding",
7980
+ countryCode: void 0,
7981
+ capabilities: void 0,
7982
+ legalEntityId: void 0
7983
+ };
7975
7984
  }
7976
7985
  add(...args) {
7977
7986
  this.queue.push(...args);
@@ -7985,30 +7994,16 @@ class UserEvents {
7985
7994
  /**
7986
7995
  * Adds an analytics event. Optionally can include a payload.
7987
7996
  */
7988
- addEvent(key, event) {
7989
- this.add(["add_event", { key, ...event }]);
7990
- this.notifySubscribers();
7991
- }
7992
- /**
7993
- * Logs a page view event
7994
- * @param pageName - The name of the page/screen to log as viewed
7995
- */
7996
- addPageView(pageName) {
7997
- this.add(["track_pageview", pageName]);
7997
+ addEvent(eventName, properties) {
7998
+ const completeEvent = { ...this.baseTrackingPayload, ...properties };
7999
+ this.add({ type: "add_event", name: eventName, properties: { ...completeEvent } });
7998
8000
  this.notifySubscribers();
7999
8001
  }
8000
8002
  /**
8001
- * Starts a new event which is expected to be ended with `endEvent` eventually
8003
+ * Starts a timer for an event to measure the time it takes for an event to occur. Time is ended when `addEvent` is executed with the same key
8002
8004
  */
8003
- startEvent(key) {
8004
- this.add(["start_event", key]);
8005
- this.notifySubscribers();
8006
- }
8007
- /**
8008
- * Ends an event previously started with `startEvent`. Optionally can include a payload.
8009
- */
8010
- endEvent(key, event) {
8011
- this.add(["end_event", event ? { key, ...event } : key]);
8005
+ startEvent(eventName) {
8006
+ this.add({ type: "start_event", name: eventName });
8012
8007
  this.notifySubscribers();
8013
8008
  }
8014
8009
  /**
@@ -8029,6 +8024,10 @@ class UserEvents {
8029
8024
  subscribe(callback) {
8030
8025
  this.subscriptions.add(callback);
8031
8026
  }
8027
+ /** Sets params that are sent on every event */
8028
+ updateBaseTrackingPayload(baseTrackingPayload) {
8029
+ this.baseTrackingPayload = { ...this.baseTrackingPayload, ...baseTrackingPayload };
8030
+ }
8032
8031
  /**
8033
8032
  * Removes a subscribed callback
8034
8033
  */
@@ -8044,12 +8043,18 @@ function ContextGuidance({
8044
8043
  title,
8045
8044
  content,
8046
8045
  titleId,
8047
- contentId
8046
+ contentId,
8047
+ baseTrackingPayload
8048
8048
  }) {
8049
8049
  const onGuidanceToggle = (status) => {
8050
- const eventAction = status === "open" ? "Open" : "Close";
8051
- userEvents.addEvent(`${eventAction} contextual guidance information`, {
8052
- segmentation: { guidancePage: page, guidanceTitleId: titleId, guidanceContentId: contentId }
8050
+ userEvents.addEvent("Clicked accordion", {
8051
+ ...baseTrackingPayload,
8052
+ actionType: status,
8053
+ actionLevel: "field",
8054
+ field: "context guidance",
8055
+ page,
8056
+ label: titleId,
8057
+ content: contentId
8053
8058
  });
8054
8059
  };
8055
8060
  return /* @__PURE__ */ jsx(Alert, { title, type: "collapsible", variant: "info", onToggle: onGuidanceToggle, children: content });
@@ -8130,6 +8135,96 @@ const dateOfIncorporationFieldMetadata = {
8130
8135
  }
8131
8136
  ]
8132
8137
  };
8138
+ const DBA_NAME_FIELD = ["hasDba", "dbaName"];
8139
+ function DBANameField({
8140
+ data,
8141
+ valid,
8142
+ errors,
8143
+ labels: labels2,
8144
+ legalCompanyName,
8145
+ helperText,
8146
+ readonly,
8147
+ handleChangeFor,
8148
+ setErrors
8149
+ }) {
8150
+ const { i18n } = useI18nContext();
8151
+ const { isExperimentEnabled } = useExperimentsContext();
8152
+ const isLemApiVersionV4Enabled = isExperimentEnabled(ExperimentNames.EnableLemApiVersionV4);
8153
+ const selection = useMemo(() => {
8154
+ if (typeof data.hasDba === "undefined") return;
8155
+ if (!data.hasDba) setErrors == null ? void 0 : setErrors("dbaName", null);
8156
+ return data.hasDba ? "yes" : "no";
8157
+ }, [data.hasDba, setErrors]);
8158
+ const handleDbaChange = (selectedValue) => {
8159
+ const isYes = selectedValue === "yes";
8160
+ const isNo = selectedValue === "no";
8161
+ handleChangeFor("hasDba")(isYes);
8162
+ if (isLemApiVersionV4Enabled) {
8163
+ handleChangeFor("doingBusinessAbsent")(isNo);
8164
+ if (isNo) {
8165
+ handleChangeFor("dbaName")(legalCompanyName);
8166
+ }
8167
+ }
8168
+ };
8169
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
8170
+ /* @__PURE__ */ jsx(
8171
+ Field,
8172
+ {
8173
+ name: "hasDba",
8174
+ label: labels2.hasDba ?? i18n.get("hasDba"),
8175
+ helper: (helperText == null ? void 0 : helperText.hasDba) ?? i18n.get("hasDba__helperText"),
8176
+ isValid: valid.hasDba,
8177
+ errorMessage: errors.hasDba,
8178
+ children: (childProps) => /* @__PURE__ */ jsx(
8179
+ RadioGroup,
8180
+ {
8181
+ ...childProps,
8182
+ name: "hasDba",
8183
+ items: [
8184
+ { id: "yes", name: "yes" },
8185
+ { id: "no", name: "no" }
8186
+ ],
8187
+ value: selection,
8188
+ onChange: handleDbaChange,
8189
+ horizontal: true
8190
+ }
8191
+ )
8192
+ }
8193
+ ),
8194
+ data.hasDba && /* @__PURE__ */ jsx(
8195
+ Field,
8196
+ {
8197
+ name: "dbaName",
8198
+ label: labels2.dbaName ?? i18n.get("dbaName"),
8199
+ errorMessage: errors.dbaName,
8200
+ isValid: valid.dbaName,
8201
+ classNameModifiers: ["dbaName"],
8202
+ children: (childProps) => /* @__PURE__ */ jsx(
8203
+ InputText,
8204
+ {
8205
+ ...childProps,
8206
+ "aria-required": true,
8207
+ "aria-label": labels2.dbaName ?? i18n.get("dbaName"),
8208
+ "aria-invalid": !valid.dbaName,
8209
+ name: "dbaName",
8210
+ value: data.dbaName,
8211
+ readonly,
8212
+ classNameModifiers: ["dbaName"],
8213
+ onInput: handleChangeFor("dbaName", "input"),
8214
+ onBlur: handleChangeFor("dbaName", "blur")
8215
+ }
8216
+ )
8217
+ }
8218
+ )
8219
+ ] });
8220
+ }
8221
+ const hasDbaFieldMetadata = {
8222
+ validators: [validateNotEmptyOnBlur]
8223
+ };
8224
+ const dbaNameFieldMetadata = {
8225
+ label: "dbaName",
8226
+ validators: [validateNotEmptyOnBlur]
8227
+ };
8133
8228
  const inferCompanyRegistrationNumberType = (registrationNumber, country, companyType) => {
8134
8229
  const optionsForCountry = companyRegistrationNumberOptions[country];
8135
8230
  const metadataFn = defaultFieldConfig$9[country];
@@ -9865,6 +9960,46 @@ function VatNumberField({
9865
9960
  )
9866
9961
  ] });
9867
9962
  }
9963
+ var TaskTypes = /* @__PURE__ */ ((TaskTypes2) => {
9964
+ TaskTypes2["BUSINESS_TYPE_SELECTION"] = "BUSINESS_TYPE_SELECTION";
9965
+ TaskTypes2["INTRODUCTION"] = "INTRODUCTION";
9966
+ TaskTypes2["TASKS_OVERVIEW"] = "TASKS_OVERVIEW";
9967
+ TaskTypes2["REVIEW"] = "REVIEW";
9968
+ TaskTypes2["INDIVIDUAL"] = "INDIVIDUAL";
9969
+ TaskTypes2["COMPANY"] = "COMPANY";
9970
+ TaskTypes2["BUSINESS_DETAILS"] = "BUSINESS_DETAILS";
9971
+ TaskTypes2["PAYOUT"] = "PAYOUT";
9972
+ TaskTypes2["PAYIN"] = "PAYIN";
9973
+ TaskTypes2["SERVICE_AGREEMENT"] = "SERVICE_AGREEMENT";
9974
+ TaskTypes2["PCI_DSS"] = "PCI_DSS";
9975
+ TaskTypes2["DECISION_MAKER"] = "DECISION_MAKER";
9976
+ TaskTypes2["DECISION_MAKER_OVERVIEW"] = "DECISION_MAKER_OVERVIEW";
9977
+ TaskTypes2["TRUST"] = "TRUST";
9978
+ TaskTypes2["TRUST_MEMBER_OVERVIEW"] = "TRUST_MEMBER";
9979
+ TaskTypes2["TRUST_MEMBER_INDIVIDUAL"] = "TRUST_MEMBER_INDIVIDUAL";
9980
+ TaskTypes2["TRUST_MEMBER_COMPANY"] = "TRUST_MEMBER_COMPANY";
9981
+ TaskTypes2["TRUST_MEMBER_ROLE_AND_TYPE"] = "TRUST_MEMBER_ROLE_AND_TYPE";
9982
+ TaskTypes2["TRUST_MEMBER_COMPANY_OWNER"] = "TRUST_MEMBER_COMPANY_OWNER";
9983
+ TaskTypes2["SOLE_PROPRIETOR_COMPANY"] = "SOLE_PROPRIETOR_COMPANY";
9984
+ TaskTypes2["LEGAL_ENTITY_TYPE_SWITCHER"] = "LEGAL_ENTITY_TYPE_SWITCHER";
9985
+ TaskTypes2["CAPABILITY_REJECTED"] = "CAPABILITY_REJECTED";
9986
+ TaskTypes2["SINGPASS_SELECTION"] = "SINGPASS_SELECTION";
9987
+ TaskTypes2["LEGAL_REPRESENTATIVE_DETAILS"] = "LEGAL_REPRESENTATIVE_DETAILS";
9988
+ return TaskTypes2;
9989
+ })(TaskTypes || {});
9990
+ var TaskStatus = /* @__PURE__ */ ((TaskStatus2) => {
9991
+ TaskStatus2[TaskStatus2["EMPTY"] = 0] = "EMPTY";
9992
+ TaskStatus2[TaskStatus2["FINISHED"] = 1] = "FINISHED";
9993
+ TaskStatus2[TaskStatus2["PROCESSING"] = 2] = "PROCESSING";
9994
+ TaskStatus2[TaskStatus2["DETAILS_REQUIRED"] = 3] = "DETAILS_REQUIRED";
9995
+ TaskStatus2[TaskStatus2["SIGN"] = 4] = "SIGN";
9996
+ TaskStatus2[TaskStatus2["DOWNLOAD"] = 5] = "DOWNLOAD";
9997
+ TaskStatus2[TaskStatus2["ERROR"] = 6] = "ERROR";
9998
+ TaskStatus2[TaskStatus2["SIGNED"] = 7] = "SIGNED";
9999
+ TaskStatus2[TaskStatus2["SUBMIT"] = 8] = "SUBMIT";
10000
+ TaskStatus2[TaskStatus2["REMOVING"] = 9] = "REMOVING";
10001
+ return TaskStatus2;
10002
+ })(TaskStatus || {});
9868
10003
  const FLOWS_THAT_HIDE_REGISTRATION_NUMBER = [
9869
10004
  { companyType: [CompanyTypesValue.SOLE_PROPRIETORSHIP], country: CountryCodes.Gibraltar },
9870
10005
  { companyType: [CompanyTypesValue.SOLE_PROPRIETORSHIP], country: CountryCodes.Guernsey },
@@ -9875,6 +10010,7 @@ const FLOWS_THAT_HIDE_REGISTRATION_NUMBER = [
9875
10010
  ];
9876
10011
  const companyRegistrationDetailsFields = [
9877
10012
  ...TRADING_NAME_FIELD,
10013
+ ...DBA_NAME_FIELD,
9878
10014
  ...BUSINESS_REGISTRATION_NUMBER_FIELD,
9879
10015
  ...STOCK_EXCHANGE_MIC_FIELD,
9880
10016
  ...STOCK_ISIN_FIELD,
@@ -9889,6 +10025,7 @@ function CompanyRegistrationDetailsComponent(props) {
9889
10025
  const COMPANY_REGISTRATION_DETAILS = mergedProps.id ?? "companyRegistrationDetails";
9890
10026
  const { i18n } = useI18nContext();
9891
10027
  const { isExperimentEnabled } = useExperimentsContext();
10028
+ const isLemApiVersionV4Enabled = isExperimentEnabled(ExperimentNames.EnableLemApiVersionV4);
9892
10029
  const { companyNameAndCountry } = useGlobalData();
9893
10030
  const { updateStateSlice } = useGlobalDataSlice(COMPANY_REGISTRATION_DETAILS);
9894
10031
  const country = (companyNameAndCountry == null ? void 0 : companyNameAndCountry.country) ?? mergedProps.country;
@@ -9923,6 +10060,16 @@ function CompanyRegistrationDetailsComponent(props) {
9923
10060
  tradingNameFieldMetadata,
9924
10061
  mergedProps
9925
10062
  );
10063
+ mergedProps = mergeFieldMetadataIntoProps(
10064
+ "hasDba",
10065
+ hasDbaFieldMetadata,
10066
+ mergedProps
10067
+ );
10068
+ mergedProps = mergeFieldMetadataIntoProps(
10069
+ "dbaName",
10070
+ dbaNameFieldMetadata,
10071
+ mergedProps
10072
+ );
9926
10073
  mergedProps = mergeFieldMetadataIntoProps(
9927
10074
  "stockExchangeMIC",
9928
10075
  stockExchangeMICFieldMetadata,
@@ -9983,6 +10130,9 @@ function CompanyRegistrationDetailsComponent(props) {
9983
10130
  if (currentData.sameNameAsLegalName) {
9984
10131
  fieldsToRemove.push("tradingName");
9985
10132
  }
10133
+ if (!currentData.hasDba) {
10134
+ fieldsToRemove.push("dbaName");
10135
+ }
9986
10136
  if (currentData.exemptedFromVat) {
9987
10137
  fieldsToRemove.push("vatNumber");
9988
10138
  } else {
@@ -10005,7 +10155,7 @@ function CompanyRegistrationDetailsComponent(props) {
10005
10155
  },
10006
10156
  [requiredFields]
10007
10157
  );
10008
- const { schema, data, valid, errors, fieldProblems, handleChangeFor } = useForm({
10158
+ const { schema, data, valid, errors, fieldProblems, handleChangeFor, setErrors } = useForm({
10009
10159
  ...mergedProps,
10010
10160
  schema: getFormSchema2,
10011
10161
  defaultData: mergedProps.data,
@@ -10040,11 +10190,12 @@ function CompanyRegistrationDetailsComponent(props) {
10040
10190
  title: i18n.get("whyDoINeedToFillInThisInformation"),
10041
10191
  content: i18n.get("reasonForFillingCompanyRegistrationDetails"),
10042
10192
  titleId: "whyDoINeedToFillInThisInformation",
10043
- contentId: "reasonForFillingCompanyRegistrationDetails"
10193
+ contentId: "reasonForFillingCompanyRegistrationDetails",
10194
+ baseTrackingPayload: { task: TaskTypes.COMPANY }
10044
10195
  }
10045
10196
  ),
10046
10197
  /* @__PURE__ */ jsxs("fieldset", { form: COMPANY_REGISTRATION_DETAILS, children: [
10047
- formUtils.isRequiredField("tradingName") && /* @__PURE__ */ jsx("div", { className: "adyen-kyc-field-wrapper", children: /* @__PURE__ */ jsx(
10198
+ !isLemApiVersionV4Enabled && formUtils.isRequiredField("tradingName") && /* @__PURE__ */ jsx("div", { className: "adyen-kyc-field-wrapper", children: /* @__PURE__ */ jsx(
10048
10199
  TradingNameField,
10049
10200
  {
10050
10201
  data: formUtils.getFieldData(data, TRADING_NAME_FIELD),
@@ -10056,6 +10207,21 @@ function CompanyRegistrationDetailsComponent(props) {
10056
10207
  legalCompanyName
10057
10208
  }
10058
10209
  ) }),
10210
+ isLemApiVersionV4Enabled && formUtils.isRequiredField("dbaName") && /* @__PURE__ */ jsx("div", { className: "adyen-kyc-field-wrapper", children: /* @__PURE__ */ jsx(
10211
+ DBANameField,
10212
+ {
10213
+ data: formUtils.getFieldData(data, DBA_NAME_FIELD),
10214
+ valid: formUtils.getFieldValid(valid, DBA_NAME_FIELD),
10215
+ errors: formUtils.getFieldErrors(errors, fieldProblems, DBA_NAME_FIELD),
10216
+ labels: formUtils.getFieldLabels(DBA_NAME_FIELD, {
10217
+ hasDba: "hasDba"
10218
+ }),
10219
+ legalCompanyName,
10220
+ readonly: formUtils.isReadOnly("dbaName"),
10221
+ handleChangeFor,
10222
+ setErrors
10223
+ }
10224
+ ) }),
10059
10225
  formUtils.isRequiredField("stockExchangeMIC") && /* @__PURE__ */ jsx("div", { className: "adyen-kyc-field-wrapper", children: /* @__PURE__ */ jsx(
10060
10226
  StockExchangeMICField,
10061
10227
  {
@@ -10212,7 +10378,9 @@ const companyBase = {
10212
10378
  stockExchangeMIC: { rule: "ifPubliclyTradedCompany" },
10213
10379
  stockISIN: { rule: "ifPubliclyTradedCompany" },
10214
10380
  stockTickerSymbol: { rule: "ifPubliclyTradedCompany" },
10215
- tradingName: { rule: "REQUIRED" },
10381
+ tradingName: { rule: "isLemApiVersionV4Disabled" },
10382
+ dbaName: { rule: "isLemApiVersionV4Enabled" },
10383
+ hasDba: { rule: "isLemApiVersionV4Enabled" },
10216
10384
  dateOfIncorporation: { rule: "countryRequiresDateOfIncorporationForCompanies" },
10217
10385
  exemptedFromRegistrationNumber: { rule: "companyRegistrationNumberExemptionAllowed" },
10218
10386
  registrationNumber: { rule: "countryRequiresRegistrationNumberForCompanies" },
@@ -10227,6 +10395,7 @@ const businessDetailsBase = {
10227
10395
  hasDba: { rule: "REQUIRED" },
10228
10396
  dbaName: { rule: "REQUIRED" },
10229
10397
  registrationAddress: { rule: "REQUIRED" },
10398
+ operationalAddressIsSame: { rule: "REQUIRED" },
10230
10399
  /* Base optional fields */
10231
10400
  operationalAddress: { rule: "OPTIONAL" },
10232
10401
  /* Fields with custom country specific rules */
@@ -13066,9 +13235,13 @@ function AddressComponent({
13066
13235
  shouldValidate
13067
13236
  });
13068
13237
  useEffect(
13069
- () => verifiedAddress ? entriesOf(verifiedAddress).forEach(([key, value]) => {
13070
- if (formData[key] !== value) handleChangeFor(key, "input")(value);
13071
- }) : formSchema.forEach((field) => handleChangeFor(field, "input")((data == null ? void 0 : data[field]) ?? " ")),
13238
+ () => {
13239
+ if (verifiedAddress) {
13240
+ entriesOf(verifiedAddress).forEach(([key, value]) => {
13241
+ if (formData[key] !== value) handleChangeFor(key, "input")(value);
13242
+ });
13243
+ }
13244
+ },
13072
13245
  // eslint-disable-next-line react-hooks/exhaustive-deps
13073
13246
  [verifiedAddress]
13074
13247
  );
@@ -13128,9 +13301,9 @@ function AddressComponent({
13128
13301
  fieldName
13129
13302
  );
13130
13303
  };
13131
- if (condensed && (data == null ? void 0 : data.country)) {
13132
- const condensedFields = CONDENSED_ADDRESS_FIELDS[data.country] ?? [];
13133
- switch (data == null ? void 0 : data.country) {
13304
+ if (condensed && (formData == null ? void 0 : formData.country)) {
13305
+ const condensedFields = CONDENSED_ADDRESS_FIELDS[formData.country] ?? [];
13306
+ switch (formData == null ? void 0 : formData.country) {
13134
13307
  case "US":
13135
13308
  return /* @__PURE__ */ jsxs("fieldset", { className: "adyen-kyc-address", children: [
13136
13309
  formSchema.filter((field) => !condensedFields.includes(field)).map((filteredField) => createFieldComponent(filteredField)),
@@ -13198,7 +13371,8 @@ function RegistrationAddressComponent(props) {
13198
13371
  handleFindAddress,
13199
13372
  country,
13200
13373
  data,
13201
- validators: validators2
13374
+ validators: validators2,
13375
+ baseTrackingPayload
13202
13376
  } = props;
13203
13377
  const {
13204
13378
  requiredFields: registrationAddressRequiredFields,
@@ -13288,7 +13462,8 @@ function RegistrationAddressComponent(props) {
13288
13462
  titleId: "whyDoINeedToFillInThisInformation",
13289
13463
  contentId: "reasonForFillingCompanyAddressDetails",
13290
13464
  title: i18n.get("whyDoINeedToFillInThisInformation"),
13291
- content: i18n.get("reasonForFillingCompanyAddressDetails")
13465
+ content: i18n.get("reasonForFillingCompanyAddressDetails"),
13466
+ baseTrackingPayload
13292
13467
  }
13293
13468
  ),
13294
13469
  /* @__PURE__ */ jsx(
@@ -13714,7 +13889,8 @@ function CompanyComponent(props) {
13714
13889
  country: props.country,
13715
13890
  problems: props.problems,
13716
13891
  handleAddressSearch: props.handleAddressSearch,
13717
- handleFindAddress: props.handleFindAddress
13892
+ handleFindAddress: props.handleFindAddress,
13893
+ baseTrackingPayload: { task: TaskTypes.COMPANY }
13718
13894
  }
13719
13895
  )
13720
13896
  }
@@ -13946,46 +14122,6 @@ const fileToBase64 = (file) => new Promise((resolve, reject) => {
13946
14122
  reader.onerror = (error) => reject(error);
13947
14123
  });
13948
14124
  const getFileExtention = (fileName) => fileName.split(".").pop();
13949
- var TaskTypes = /* @__PURE__ */ ((TaskTypes2) => {
13950
- TaskTypes2["BUSINESS_TYPE_SELECTION"] = "BUSINESS_TYPE_SELECTION";
13951
- TaskTypes2["INTRODUCTION"] = "INTRODUCTION";
13952
- TaskTypes2["TASKS_OVERVIEW"] = "TASKS_OVERVIEW";
13953
- TaskTypes2["REVIEW"] = "REVIEW";
13954
- TaskTypes2["INDIVIDUAL"] = "INDIVIDUAL";
13955
- TaskTypes2["COMPANY"] = "COMPANY";
13956
- TaskTypes2["BUSINESS_DETAILS"] = "BUSINESS_DETAILS";
13957
- TaskTypes2["PAYOUT"] = "PAYOUT";
13958
- TaskTypes2["PAYIN"] = "PAYIN";
13959
- TaskTypes2["SERVICE_AGREEMENT"] = "SERVICE_AGREEMENT";
13960
- TaskTypes2["PCI_DSS"] = "PCI_DSS";
13961
- TaskTypes2["DECISION_MAKER"] = "DECISION_MAKER";
13962
- TaskTypes2["DECISION_MAKER_OVERVIEW"] = "DECISION_MAKER_OVERVIEW";
13963
- TaskTypes2["TRUST"] = "TRUST";
13964
- TaskTypes2["TRUST_MEMBER_OVERVIEW"] = "TRUST_MEMBER";
13965
- TaskTypes2["TRUST_MEMBER_INDIVIDUAL"] = "TRUST_MEMBER_INDIVIDUAL";
13966
- TaskTypes2["TRUST_MEMBER_COMPANY"] = "TRUST_MEMBER_COMPANY";
13967
- TaskTypes2["TRUST_MEMBER_ROLE_AND_TYPE"] = "TRUST_MEMBER_ROLE_AND_TYPE";
13968
- TaskTypes2["TRUST_MEMBER_COMPANY_OWNER"] = "TRUST_MEMBER_COMPANY_OWNER";
13969
- TaskTypes2["SOLE_PROPRIETOR_COMPANY"] = "SOLE_PROPRIETOR_COMPANY";
13970
- TaskTypes2["LEGAL_ENTITY_TYPE_SWITCHER"] = "LEGAL_ENTITY_TYPE_SWITCHER";
13971
- TaskTypes2["CAPABILITY_REJECTED"] = "CAPABILITY_REJECTED";
13972
- TaskTypes2["SINGPASS_SELECTION"] = "SINGPASS_SELECTION";
13973
- TaskTypes2["LEGAL_REPRESENTATIVE_DETAILS"] = "LEGAL_REPRESENTATIVE_DETAILS";
13974
- return TaskTypes2;
13975
- })(TaskTypes || {});
13976
- var TaskStatus = /* @__PURE__ */ ((TaskStatus2) => {
13977
- TaskStatus2[TaskStatus2["EMPTY"] = 0] = "EMPTY";
13978
- TaskStatus2[TaskStatus2["FINISHED"] = 1] = "FINISHED";
13979
- TaskStatus2[TaskStatus2["PROCESSING"] = 2] = "PROCESSING";
13980
- TaskStatus2[TaskStatus2["DETAILS_REQUIRED"] = 3] = "DETAILS_REQUIRED";
13981
- TaskStatus2[TaskStatus2["SIGN"] = 4] = "SIGN";
13982
- TaskStatus2[TaskStatus2["DOWNLOAD"] = 5] = "DOWNLOAD";
13983
- TaskStatus2[TaskStatus2["ERROR"] = 6] = "ERROR";
13984
- TaskStatus2[TaskStatus2["SIGNED"] = 7] = "SIGNED";
13985
- TaskStatus2[TaskStatus2["SUBMIT"] = 8] = "SUBMIT";
13986
- TaskStatus2[TaskStatus2["REMOVING"] = 9] = "REMOVING";
13987
- return TaskStatus2;
13988
- })(TaskStatus || {});
13989
14125
  const COUNTRIES_THAT_DONT_REQUIRE_SOLE_PROP_REGISTRATION = [
13990
14126
  CountryCodes.Australia,
13991
14127
  CountryCodes.Gibraltar,
@@ -14183,6 +14319,16 @@ const rules$3 = ({
14183
14319
  if (isExperimentEnabled("EnableFinancialInformationComponentV4") && COUNTRIES_REQUIRING_FINANCIAL_INFORMATION.includes(country)) {
14184
14320
  return "REQUIRED";
14185
14321
  }
14322
+ },
14323
+ isLemApiVersionV4Enabled: () => {
14324
+ if (isExperimentEnabled("EnableLemApiVersionV4")) {
14325
+ return "REQUIRED";
14326
+ }
14327
+ },
14328
+ isLemApiVersionV4Disabled: () => {
14329
+ if (!isExperimentEnabled("EnableLemApiVersionV4")) {
14330
+ return "REQUIRED";
14331
+ }
14186
14332
  }
14187
14333
  });
14188
14334
  var LegalEntityType = /* @__PURE__ */ ((LegalEntityType2) => {
@@ -14294,6 +14440,7 @@ const businessDetailsBaseMapping = {
14294
14440
  "additionalInformation.legalCompanyName": "organization.legalName",
14295
14441
  "additionalInformation.legalFormDescription": "organization.legalFormDescription",
14296
14442
  "additionalInformation.dbaName": "organization.doingBusinessAs",
14443
+ "additionalInformation.doingBusinessAbsent": "organization.doingBusinessAbsent",
14297
14444
  "additionalInformation.registrationNumber": "organization.registrationNumber",
14298
14445
  "additionalInformation.taxInformation": "organization.taxInformation",
14299
14446
  "additionalInformation.vatNumber": "organization.vatNumber",
@@ -14321,6 +14468,8 @@ const companyBaseMapping = {
14321
14468
  "companyNameAndCountry.countryOfGoverningLaw": "organization.countryOfGoverningLaw",
14322
14469
  "companyType.entityType": "organization.type",
14323
14470
  "companyRegistrationDetails.tradingName": "organization.doingBusinessAs",
14471
+ "companyRegistrationDetails.dbaName": "organization.doingBusinessAs",
14472
+ "companyRegistrationDetails.doingBusinessAbsent": "organization.doingBusinessAbsent",
14324
14473
  "companyRegistrationDetails.registrationNumber": "organization.registrationNumber",
14325
14474
  "companyRegistrationDetails.taxInformation": "organization.taxInformation",
14326
14475
  "companyRegistrationDetails.vatNumber": "organization.vatNumber",
@@ -14345,6 +14494,8 @@ const companyBaseMapping = {
14345
14494
  const trustBaseMapping = {
14346
14495
  "trustRegistrationDetails.trustType": "trust.type",
14347
14496
  "trustRegistrationDetails.legalName": "trust.name",
14497
+ "trustRegistrationDetails.dbaName": "trust.doingBusinessAs",
14498
+ "trustRegistrationDetails.doingBusinessAbsent": "trust.doingBusinessAbsent",
14348
14499
  "trustRegistrationDetails.country": "trust.countryOfGoverningLaw",
14349
14500
  "trustRegistrationDetails.registrationNumber": "trust.registrationNumber",
14350
14501
  "trustRegistrationAddress.registrationAddress.city": "trust.registeredAddress.city",
@@ -14364,6 +14515,8 @@ const solePropBaseMapping = {
14364
14515
  "solePropNameAndCountry.country": "soleProprietorship.countryOfGoverningLaw",
14365
14516
  "solePropNameAndCountry.legalCompanyName": "soleProprietorship.name",
14366
14517
  "solePropRegistrationDetails.tradingName": "soleProprietorship.doingBusinessAs",
14518
+ "solePropRegistrationDetails.dbaName": "soleProprietorship.doingBusinessAs",
14519
+ "solePropRegistrationDetails.doingBusinessAbsent": "soleProprietorship.doingBusinessAbsent",
14367
14520
  "solePropRegistrationDetails.vatNumber": "soleProprietorship.vatNumber",
14368
14521
  "solePropRegistrationDetails.vatAbsenceReason": "soleProprietorship.vatAbsenceReason",
14369
14522
  "solePropRegistrationDetails.exemptedFromTax": "soleProprietorship.taxAbsent",
@@ -15680,7 +15833,8 @@ function IdVerificationMethodComponent(props) {
15680
15833
  /* @__PURE__ */ jsx(Link, { href: "https://www.adyen.com/policies-and-disclaimer/privacy-policy", external: true, children: i18n.get("learnMore") })
15681
15834
  ] }),
15682
15835
  titleId: "howVerificationWithOnfidoWork",
15683
- contentId: "howVerificationWithOnfidoWorkContent"
15836
+ contentId: "howVerificationWithOnfidoWorkContent",
15837
+ baseTrackingPayload: { task: TaskTypes.INDIVIDUAL }
15684
15838
  }
15685
15839
  ),
15686
15840
  (countryOfResidence === CountryCodes.PuertoRico || countryOfResidence === CountryCodes.UnitedStates) && data.idVerificationMethod === "instantVerification" && /* @__PURE__ */ jsx(
@@ -15701,6 +15855,47 @@ var TrustedFieldsProvider = /* @__PURE__ */ ((TrustedFieldsProvider2) => {
15701
15855
  TrustedFieldsProvider2["KOMPANY"] = "kompany";
15702
15856
  return TrustedFieldsProvider2;
15703
15857
  })(TrustedFieldsProvider || {});
15858
+ function getBaseTrackingPayload({
15859
+ trackingConfig = {
15860
+ topLevelLegalEntity: {}
15861
+ },
15862
+ parentLegalEntity,
15863
+ legalEntity,
15864
+ task
15865
+ }) {
15866
+ const { topLevelLegalEntity } = trackingConfig;
15867
+ const baseTrackingPayload = {
15868
+ task,
15869
+ entityType: topLevelLegalEntity == null ? void 0 : topLevelLegalEntity.type,
15870
+ topLevelLegalEntityId: topLevelLegalEntity == null ? void 0 : topLevelLegalEntity.id,
15871
+ topLevelLegalEntityType: topLevelLegalEntity == null ? void 0 : topLevelLegalEntity.type
15872
+ };
15873
+ if (parentLegalEntity) {
15874
+ baseTrackingPayload.parentLegalEntityId = parentLegalEntity.id;
15875
+ baseTrackingPayload.parentLegalEntityType = parentLegalEntity.type;
15876
+ }
15877
+ if (legalEntity) {
15878
+ baseTrackingPayload.legalEntityId = legalEntity.id;
15879
+ baseTrackingPayload.entityType = legalEntity.type;
15880
+ }
15881
+ return baseTrackingPayload;
15882
+ }
15883
+ const removeOldDataBySchema = (dataSubmitted, savedLegalEntityData) => {
15884
+ Object.keys(savedLegalEntityData).forEach((formId) => {
15885
+ if (savedLegalEntityData[formId]) {
15886
+ Object.keys(savedLegalEntityData[formId]).forEach((key) => {
15887
+ if (dataSubmitted[formId][key] === void 0) {
15888
+ if (Array.isArray(savedLegalEntityData[formId][key])) {
15889
+ dataSubmitted[formId][key] = [];
15890
+ } else {
15891
+ dataSubmitted[formId][key] = "";
15892
+ }
15893
+ }
15894
+ });
15895
+ }
15896
+ });
15897
+ return dataSubmitted;
15898
+ };
15704
15899
  const getLegalEntityCountry = (legalEntityResponse) => legalEntityResponse.type === LegalEntityType.INDIVIDUAL ? legalEntityResponse.individual.residentialAddress.country : legalEntityResponse.organization.registeredAddress.country;
15705
15900
  const getAgeToday = (birthdate) => {
15706
15901
  const today = /* @__PURE__ */ new Date();
@@ -16742,6 +16937,8 @@ const trustBase = {
16742
16937
  legalName: {
16743
16938
  rule: "REQUIRED"
16744
16939
  },
16940
+ dbaName: { rule: "isLemApiVersionV4Enabled" },
16941
+ hasDba: { rule: "isLemApiVersionV4Enabled" },
16745
16942
  country: {
16746
16943
  rule: "REQUIRED"
16747
16944
  },
@@ -17282,7 +17479,8 @@ const DriversLicense$1 = ({
17282
17479
  formUtils,
17283
17480
  isValid,
17284
17481
  errorMessages,
17285
- shouldValidate
17482
+ shouldValidate,
17483
+ baseTrackingPayload
17286
17484
  }) => {
17287
17485
  const { i18n } = useI18nContext();
17288
17486
  const { dataset: auStates } = useDataset(datasetIdentifier.state("AU"));
@@ -17362,7 +17560,8 @@ const DriversLicense$1 = ({
17362
17560
  /* @__PURE__ */ jsx(Link, { href: "https://www.usi.gov.au/about/forms-id/drivers-licence", children: i18n.get("iStillCantFindIt") })
17363
17561
  ] }),
17364
17562
  titleId: "whereCanIFindTheseNumbersOnMyDriversLicense",
17365
- contentId: "whereToFindNumbersOnDriversLicense"
17563
+ contentId: "whereToFindNumbersOnDriversLicense",
17564
+ baseTrackingPayload
17366
17565
  }
17367
17566
  )
17368
17567
  ] });
@@ -17498,7 +17697,8 @@ function IdentityAuComponent({
17498
17697
  ),
17499
17698
  issuerState: formUtils.getErrorMessage("issuerState", errors, fieldProblems)
17500
17699
  },
17501
- shouldValidate
17700
+ shouldValidate,
17701
+ baseTrackingPayload: { task: TaskTypes.INDIVIDUAL }
17502
17702
  }
17503
17703
  ) : void 0
17504
17704
  ] });
@@ -17615,7 +17815,8 @@ const DriversLicense = ({
17615
17815
  formUtils,
17616
17816
  isValid,
17617
17817
  errorMessages,
17618
- shouldValidate
17818
+ shouldValidate,
17819
+ baseTrackingPayload
17619
17820
  }) => {
17620
17821
  const { i18n } = useI18nContext();
17621
17822
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -17674,7 +17875,8 @@ const DriversLicense = ({
17674
17875
  /* @__PURE__ */ jsx(Link, { href: "https://www.nzta.govt.nz/driver-licences/getting-a-licence/your-driver-licence-explained/", children: i18n.get("iStillCantFindIt") })
17675
17876
  ] }),
17676
17877
  titleId: "whereCanIFindTheseNumbersOnMyDriversLicense",
17677
- contentId: "whereToFindNumbersOnDriversLicense"
17878
+ contentId: "whereToFindNumbersOnDriversLicense",
17879
+ baseTrackingPayload
17678
17880
  }
17679
17881
  )
17680
17882
  ] });
@@ -17838,7 +18040,8 @@ function IdentityNZComponent({
17838
18040
  fieldProblems
17839
18041
  )
17840
18042
  },
17841
- shouldValidate
18043
+ shouldValidate,
18044
+ baseTrackingPayload: { task: TaskTypes.INDIVIDUAL }
17842
18045
  }
17843
18046
  ) : void 0
17844
18047
  ] });
@@ -18061,6 +18264,12 @@ function PersonalDetailsComponent(props) {
18061
18264
  }
18062
18265
  };
18063
18266
  const alertProps = getAlertProps();
18267
+ const baseTrackingPayload = getBaseTrackingPayload({
18268
+ trackingConfig: {
18269
+ topLevelLegalEntity: props.parentLegalEntity
18270
+ },
18271
+ task: props.taskType
18272
+ });
18064
18273
  return /* @__PURE__ */ jsxs(LoaderWrapper, { status, formOpacityWhenLoading: 0.3, loaderSize: "large", children: [
18065
18274
  /* @__PURE__ */ jsx(StateContextSetter, { owner: PERSONAL_DETAILS, stateRef }),
18066
18275
  /* @__PURE__ */ jsx(StateContextWatcher, { owner: PERSONAL_DETAILS, onChange: handleStateChange }),
@@ -18096,7 +18305,8 @@ function PersonalDetailsComponent(props) {
18096
18305
  title: i18n.get("whyDoINeedToFillInThisInformation"),
18097
18306
  content: i18n.get("reasonForFillingIndividualPersonalDetails"),
18098
18307
  titleId: "whyDoINeedToFillInThisInformation",
18099
- contentId: "reasonForFillingIndividualPersonalDetails"
18308
+ contentId: "reasonForFillingIndividualPersonalDetails",
18309
+ baseTrackingPayload
18100
18310
  }
18101
18311
  ),
18102
18312
  isDecisionMakerTask && props.trustedFieldsProvider === TrustedFieldsProvider.SINGPASS && props.readOnlyFields && /* @__PURE__ */ jsx(Typography, { color: "secondary", variant: "caption", children: i18n.get(
@@ -18608,7 +18818,8 @@ function IndividualComponent(props) {
18608
18818
  title: i18n.get("whyDoINeedToFillInThisInformation"),
18609
18819
  content: i18n.get("reasonForFillingIndividualAddressDetails"),
18610
18820
  titleId: "whyDoINeedToFillInThisInformation",
18611
- contentId: "reasonForFillingIndividualAddressDetails"
18821
+ contentId: "reasonForFillingIndividualAddressDetails",
18822
+ baseTrackingPayload: { task: taskType }
18612
18823
  }
18613
18824
  ),
18614
18825
  /* @__PURE__ */ jsx(
@@ -18616,7 +18827,10 @@ function IndividualComponent(props) {
18616
18827
  {
18617
18828
  ...addressFormProps,
18618
18829
  id: addressFormID,
18619
- data: { ...addressFormProps == null ? void 0 : addressFormProps.data, country: (_a2 = data == null ? void 0 : data.personalDetails) == null ? void 0 : _a2.residencyCountry },
18830
+ data: {
18831
+ ...addressFormProps == null ? void 0 : addressFormProps.data,
18832
+ country: country ?? ((_a2 = addressFormProps == null ? void 0 : addressFormProps.data) == null ? void 0 : _a2.country)
18833
+ },
18620
18834
  requiredFields: addressSchema,
18621
18835
  optionalFields: ["otherAddressInformation"],
18622
18836
  trustedFields: trustedFields == null ? void 0 : trustedFields.address,
@@ -21554,6 +21768,12 @@ function PayoutVerificationMethod(props) {
21554
21768
  const { dataset: countries } = useDataset(datasetIdentifier.country);
21555
21769
  const bankCountryName = ((_b = countries.find((country2) => country2.id === data.bankCountry)) == null ? void 0 : _b.name) ?? data.bankCountry;
21556
21770
  const allowedBankCountries = getAllowedBankCountries(country);
21771
+ const baseTrackingPayload = getBaseTrackingPayload({
21772
+ trackingConfig: {
21773
+ topLevelLegalEntity: legalEntityResponse
21774
+ },
21775
+ task: TaskTypes.PAYOUT
21776
+ });
21557
21777
  const countryField = /* @__PURE__ */ jsx(
21558
21778
  CountryField,
21559
21779
  {
@@ -21692,7 +21912,8 @@ function PayoutVerificationMethod(props) {
21692
21912
  ] }),
21693
21913
  /* @__PURE__ */ jsx(Typography, { children: i18n.get("adyenWillOnlyGetTemporaryAccess") }),
21694
21914
  /* @__PURE__ */ jsx(Link, { href: "https://www.adyen.com/policies-and-disclaimer/privacy-policy", external: true, children: /* @__PURE__ */ jsx(Typography, { variant: "caption", children: i18n.get("learnMore") }) })
21695
- ] })
21915
+ ] }),
21916
+ baseTrackingPayload
21696
21917
  }
21697
21918
  ) : void 0
21698
21919
  ] });
@@ -22062,7 +22283,8 @@ function SolePropComponent(props) {
22062
22283
  country: props.country,
22063
22284
  problems: props == null ? void 0 : props.problems,
22064
22285
  handleAddressSearch: props.handleAddressSearch,
22065
- handleFindAddress: props.handleFindAddress
22286
+ handleFindAddress: props.handleFindAddress,
22287
+ baseTrackingPayload: { task: TaskTypes.SOLE_PROPRIETOR_COMPANY }
22066
22288
  }
22067
22289
  )
22068
22290
  }
@@ -22744,6 +22966,7 @@ const trustRegistrationDetailsValidationsV4 = {
22744
22966
  };
22745
22967
  const trustRegistrationDetailsFields = [
22746
22968
  "legalName",
22969
+ ...DBA_NAME_FIELD,
22747
22970
  "country",
22748
22971
  "trustType",
22749
22972
  "objectOfTrust",
@@ -22758,6 +22981,7 @@ function TrustRegistrationDetailsComponent(props) {
22758
22981
  const isStrictNameAndAddressValidationEnabled = isExperimentEnabled(
22759
22982
  ExperimentNames.StrictNameAndAddressValidationV4
22760
22983
  );
22984
+ const isLemApiVersionV4Enabled = isExperimentEnabled(ExperimentNames.EnableLemApiVersionV4);
22761
22985
  const TRUST_REGISTRATION_DETAILS = props.id || trustForms.trustRegistrationDetails.formId;
22762
22986
  const stateRef = useRef({ setState: null });
22763
22987
  const requiredFieldsByTask = trustRegistrationDetailsFields;
@@ -22767,7 +22991,7 @@ function TrustRegistrationDetailsComponent(props) {
22767
22991
  field
22768
22992
  )
22769
22993
  );
22770
- const { handleChangeFor, data, valid, errors, setData, fieldProblems } = useForm({
22994
+ const { handleChangeFor, data, valid, errors, setData, fieldProblems, setErrors } = useForm({
22771
22995
  ...props,
22772
22996
  schema: directChildFields,
22773
22997
  defaultData: { ...props.data, country },
@@ -22863,6 +23087,21 @@ function TrustRegistrationDetailsComponent(props) {
22863
23087
  )
22864
23088
  }
22865
23089
  ),
23090
+ isLemApiVersionV4Enabled && formUtils.isRequiredField("dbaName") && /* @__PURE__ */ jsx("div", { className: "adyen-kyc-field-wrapper", children: /* @__PURE__ */ jsx(
23091
+ DBANameField,
23092
+ {
23093
+ data: formUtils.getFieldData(data, DBA_NAME_FIELD),
23094
+ valid: formUtils.getFieldValid(valid, DBA_NAME_FIELD),
23095
+ errors: formUtils.getFieldErrors(errors, fieldProblems, DBA_NAME_FIELD),
23096
+ labels: formUtils.getFieldLabels(DBA_NAME_FIELD, {
23097
+ hasDba: "hasDba"
23098
+ }),
23099
+ legalCompanyName: data.legalName,
23100
+ readonly: formUtils.isReadOnly("dbaName"),
23101
+ handleChangeFor,
23102
+ setErrors
23103
+ }
23104
+ ) }),
22866
23105
  formUtils.isRequiredField("trustType") && /* @__PURE__ */ jsx(
22867
23106
  Field,
22868
23107
  {
@@ -22992,7 +23231,8 @@ function TrustComponent(props) {
22992
23231
  problems: props == null ? void 0 : props.problems,
22993
23232
  labels: { operationalAddressIsSame: "isTrustOperationAddressSame" },
22994
23233
  handleAddressSearch: props.handleAddressSearch,
22995
- handleFindAddress: props.handleFindAddress
23234
+ handleFindAddress: props.handleFindAddress,
23235
+ baseTrackingPayload: { task: TaskTypes.TRUST }
22996
23236
  }
22997
23237
  )
22998
23238
  }
@@ -23601,8 +23841,8 @@ function Summary({
23601
23841
  icon: "edit",
23602
23842
  onClick: () => {
23603
23843
  trackNavigation2({
23604
- fromForm: { formName: "summary", formId: "summary" },
23605
- toForm: { formId, formName },
23844
+ fromForm: "summary",
23845
+ toForm: formName,
23606
23846
  component: "Pencil icon"
23607
23847
  });
23608
23848
  editForm(formId);
@@ -23687,15 +23927,13 @@ const trackNavigation = ({
23687
23927
  baseTrackingPayload,
23688
23928
  i18n
23689
23929
  }) => {
23690
- userEvents.addEvent("Navigated form", {
23691
- segmentation: {
23692
- ...baseTrackingPayload,
23693
- component,
23694
- from: fromForm.formId,
23695
- fromLabel: i18n.get(fromForm.formName),
23696
- to: toForm.formId,
23697
- toLabel: i18n.get(toForm.formName)
23698
- }
23930
+ userEvents.addEvent("Clicked button", {
23931
+ ...baseTrackingPayload,
23932
+ actionLevel: "page",
23933
+ actionType: "navigate",
23934
+ page: i18n.get(fromForm),
23935
+ label: component,
23936
+ toPage: i18n.get(toForm)
23699
23937
  });
23700
23938
  };
23701
23939
  const useHideButton = (condition, setHideState) => {
@@ -23758,12 +23996,12 @@ const useFormComposer = ({
23758
23996
  setActiveForm(openingStep);
23759
23997
  }
23760
23998
  }, [activeForm, forms, problems == null ? void 0 : problems.remediationActions, hasAlreadyNavigatedForm]);
23761
- const trackSectionCompletion = (form) => {
23762
- userEvents.addEvent("Completed form section", {
23763
- segmentation: {
23764
- ...baseTrackingPayload,
23765
- sectionName: form.formId
23766
- }
23999
+ const trackSectionCompletion = (formName) => {
24000
+ userEvents.addEvent("Success", {
24001
+ ...baseTrackingPayload,
24002
+ actionLevel: "page",
24003
+ actionType: "next",
24004
+ page: i18n.get(formName)
23767
24005
  });
23768
24006
  };
23769
24007
  const gotoFormByFormIndex = (nextFormIndex) => {
@@ -23802,15 +24040,14 @@ const useFormComposer = ({
23802
24040
  setShouldValidate(false);
23803
24041
  const toFormIndex = forms.findIndex((form) => form.formId === activeForm.formId) + 1;
23804
24042
  gotoFormByFormIndex(toFormIndex);
23805
- const toForm = forms[toFormIndex];
23806
24043
  trackNavigation({
23807
- fromForm: activeForm,
23808
- toForm,
24044
+ fromForm: activeForm.formName,
24045
+ toForm: forms[toFormIndex].formName,
23809
24046
  component: "ActionBar",
23810
24047
  baseTrackingPayload,
23811
24048
  i18n
23812
24049
  });
23813
- trackSectionCompletion(activeForm);
24050
+ trackSectionCompletion(activeForm.formName);
23814
24051
  };
23815
24052
  const handleBackClick = () => {
23816
24053
  const currentFormIndex = forms.findIndex((form) => form.formId === activeForm.formId);
@@ -23819,7 +24056,13 @@ const useFormComposer = ({
23819
24056
  const toForm = forms[currentFormIndex - 1];
23820
24057
  setActiveForm(toForm);
23821
24058
  setHasAlreadyNavigatedForm(true);
23822
- trackNavigation({ fromForm, toForm, component: "ActionBar", baseTrackingPayload, i18n });
24059
+ trackNavigation({
24060
+ fromForm: fromForm.formName,
24061
+ toForm: toForm.formName,
24062
+ component: "ActionBar",
24063
+ baseTrackingPayload,
24064
+ i18n
24065
+ });
23823
24066
  }
23824
24067
  };
23825
24068
  const nextButtonLabel = isFinalStep ? i18n.get(submitButtonLabel ?? "submit") : i18n.get("next");
@@ -24146,7 +24389,9 @@ const solePropBase = {
24146
24389
  stockExchangeMIC: { rule: "ifPubliclyTradedCompany" },
24147
24390
  stockISIN: { rule: "ifPubliclyTradedCompany" },
24148
24391
  stockTickerSymbol: { rule: "ifPubliclyTradedCompany" },
24149
- tradingName: { rule: "REQUIRED" },
24392
+ tradingName: { rule: "isLemApiVersionV4Disabled" },
24393
+ dbaName: { rule: "isLemApiVersionV4Enabled" },
24394
+ hasDba: { rule: "isLemApiVersionV4Enabled" },
24150
24395
  dateOfIncorporation: { rule: "countryRequiresDateOfIncorporationForCompanies" },
24151
24396
  exemptedFromRegistrationNumber: { rule: "countryHasRegistrationExemptionsForSomeSoleProps" },
24152
24397
  registrationNumber: { rule: "countryRequiresRegistrationNumberForSoleProps" },
@@ -24339,16 +24584,10 @@ function getPropsFromConfigurations(scenarioConfiguration, forms, remediationAct
24339
24584
  }
24340
24585
  case TrustedFieldsProvider.SINGPASS: {
24341
24586
  if (legalEntityType === "organization") {
24342
- const orgFields = trusted.fields.filter(
24343
- (field) => (field == null ? void 0 : field.split(".")[0]) === "organization"
24344
- );
24345
- return [...acc, ...orgFields.map((tf) => businessDetailsApiKeyMapping[tf])];
24587
+ return [...acc, ...trusted.fields.map((tf) => businessDetailsApiKeyMapping[tf])];
24346
24588
  }
24347
24589
  if (legalEntityType === "individual") {
24348
- const individualFields = trusted.fields.filter(
24349
- (field) => (field == null ? void 0 : field.split(".")[0]) === "individual"
24350
- );
24351
- return [...acc, ...individualFields.map((tf) => individualApiKeyMapping[tf])];
24590
+ return [...acc, ...trusted.fields.map((tf) => individualApiKeyMapping[tf])];
24352
24591
  }
24353
24592
  return acc;
24354
24593
  }
@@ -24477,47 +24716,6 @@ const isFieldRequiredToRemediateDataMissingError = (formId, field, dataMissingEr
24477
24716
  const getFormTrustedFields = (formId, trustedFields) => trustedFields.filter((field) => field.split(".")[0] === formId).map(
24478
24717
  (field) => field.split(".").filter((item) => formId !== item).join(".")
24479
24718
  );
24480
- function getBaseTrackingPayload({
24481
- trackingConfig = {
24482
- topLevelLegalEntity: {}
24483
- },
24484
- parentLegalEntity,
24485
- legalEntity,
24486
- task
24487
- }) {
24488
- const { topLevelLegalEntity } = trackingConfig;
24489
- const baseTrackingPayload = {
24490
- task,
24491
- flow: topLevelLegalEntity == null ? void 0 : topLevelLegalEntity.type,
24492
- topLevelLegalEntityId: topLevelLegalEntity.id,
24493
- topLevelLegalEntityType: topLevelLegalEntity.type
24494
- };
24495
- if (parentLegalEntity) {
24496
- baseTrackingPayload.parentLegalEntityId = parentLegalEntity.id;
24497
- baseTrackingPayload.parentLegalEntityType = parentLegalEntity.type;
24498
- }
24499
- if (legalEntity) {
24500
- baseTrackingPayload.legalEntityId = legalEntity.id;
24501
- baseTrackingPayload.legalEntityType = legalEntity.type;
24502
- }
24503
- return baseTrackingPayload;
24504
- }
24505
- const removeOldDataBySchema = (dataSubmitted, savedLegalEntityData) => {
24506
- Object.keys(savedLegalEntityData).forEach((formId) => {
24507
- if (savedLegalEntityData[formId]) {
24508
- Object.keys(savedLegalEntityData[formId]).forEach((key) => {
24509
- if (dataSubmitted[formId][key] === void 0) {
24510
- if (Array.isArray(savedLegalEntityData[formId][key])) {
24511
- dataSubmitted[formId][key] = [];
24512
- } else {
24513
- dataSubmitted[formId][key] = "";
24514
- }
24515
- }
24516
- });
24517
- }
24518
- });
24519
- return dataSubmitted;
24520
- };
24521
24719
  const getRequiredForms = (forms, requiredFields, optionalFields) => {
24522
24720
  const requiredForms = Object.values(forms).filter(({ formId }) => {
24523
24721
  if (requiredFields || optionalFields) {
@@ -24585,82 +24783,6 @@ const getFieldsWithExistingData = (legalEntity, isExperimentEnabled) => {
24585
24783
  }
24586
24784
  return nonDocumentFields;
24587
24785
  };
24588
- const DBA_NAME_FIELD = ["hasDba", "dbaName"];
24589
- function DBANameField({
24590
- data,
24591
- valid,
24592
- errors,
24593
- labels: labels2,
24594
- helperText,
24595
- readonly,
24596
- handleChangeFor,
24597
- setErrors
24598
- }) {
24599
- const { i18n } = useI18nContext();
24600
- const selection = useMemo(() => {
24601
- if (typeof data.hasDba === "undefined") return;
24602
- if (!data.hasDba) setErrors == null ? void 0 : setErrors("dbaName", null);
24603
- return data.hasDba ? "yes" : "no";
24604
- }, [data.hasDba, setErrors]);
24605
- return /* @__PURE__ */ jsxs(Fragment, { children: [
24606
- /* @__PURE__ */ jsx(
24607
- Field,
24608
- {
24609
- name: "hasDba",
24610
- label: labels2.hasDba ?? i18n.get("hasDba"),
24611
- helper: (helperText == null ? void 0 : helperText.hasDba) ?? i18n.get("hasDba__helperText"),
24612
- isValid: valid.hasDba,
24613
- errorMessage: errors.hasDba,
24614
- children: (childProps) => /* @__PURE__ */ jsx(
24615
- RadioGroup,
24616
- {
24617
- ...childProps,
24618
- name: "hasDba",
24619
- items: [
24620
- { id: "yes", name: "yes" },
24621
- { id: "no", name: "no" }
24622
- ],
24623
- value: selection,
24624
- onChange: (newValue) => handleChangeFor("hasDba")(newValue === "yes"),
24625
- horizontal: true
24626
- }
24627
- )
24628
- }
24629
- ),
24630
- data.hasDba && /* @__PURE__ */ jsx(
24631
- Field,
24632
- {
24633
- name: "dbaName",
24634
- label: labels2.dbaName ?? i18n.get("dbaName"),
24635
- errorMessage: errors.dbaName,
24636
- isValid: valid.dbaName,
24637
- classNameModifiers: ["dbaName"],
24638
- children: (childProps) => /* @__PURE__ */ jsx(
24639
- InputText,
24640
- {
24641
- ...childProps,
24642
- "aria-required": true,
24643
- "aria-label": labels2.dbaName ?? i18n.get("dbaName"),
24644
- "aria-invalid": !valid.dbaName,
24645
- name: "dbaName",
24646
- value: data.dbaName,
24647
- readonly,
24648
- classNameModifiers: ["dbaName"],
24649
- onInput: handleChangeFor("dbaName", "input"),
24650
- onBlur: handleChangeFor("dbaName", "blur")
24651
- }
24652
- )
24653
- }
24654
- )
24655
- ] });
24656
- }
24657
- const hasDbaFieldMetadata = {
24658
- validators: [validateNotEmptyOnBlur]
24659
- };
24660
- const dbaNameFieldMetadata = {
24661
- label: "dbaName",
24662
- validators: [validateNotEmptyOnBlur]
24663
- };
24664
24786
  const getNestedTrustedFields = (field, data, trustedFields) => {
24665
24787
  if (trustedFields && (data == null ? void 0 : data[field]) && typeof data[field] === "object") {
24666
24788
  return trustedFields.reduce((fields, trustedField) => {
@@ -24819,7 +24941,7 @@ function AdditionalInformationComponent({
24819
24941
  handleAddressSearch,
24820
24942
  handleFindAddress
24821
24943
  }) {
24822
- var _a, _b, _c, _d, _e;
24944
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
24823
24945
  const { basicInformation } = useGlobalData();
24824
24946
  const { updateStateSlice } = useGlobalDataSlice(ADDITIONAL_INFORMATION_FORM_ID);
24825
24947
  const { i18n } = useI18nContext();
@@ -25016,7 +25138,6 @@ function AdditionalInformationComponent({
25016
25138
  fieldProblems: formFieldProblems,
25017
25139
  handleChangeFor,
25018
25140
  resetToDefaultData,
25019
- setData,
25020
25141
  setErrors,
25021
25142
  setValid
25022
25143
  } = useForm({
@@ -25084,7 +25205,6 @@ function AdditionalInformationComponent({
25084
25205
  operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME
25085
25206
  );
25086
25207
  setValid("operationalAddress", true);
25087
- setData("operationalAddress", mergedDefaultData == null ? void 0 : mergedDefaultData.operationalAddress);
25088
25208
  } else {
25089
25209
  handleChangeFor("operationalAddressIsSame")(
25090
25210
  operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME
@@ -25328,9 +25448,11 @@ function AdditionalInformationComponent({
25328
25448
  {
25329
25449
  id: ADDITIONAL_INFORMATION_FORM_ID,
25330
25450
  addressType: "registrationAddress",
25331
- data: { ...mergedDefaultData == null ? void 0 : mergedDefaultData.registrationAddress, country },
25332
- labels: getAddressSchemaLabelsByCountry(country),
25333
- countryCode: country,
25451
+ data: {
25452
+ ...mergedDefaultData == null ? void 0 : mergedDefaultData.registrationAddress,
25453
+ country: country ?? ((_f = mergedDefaultData == null ? void 0 : mergedDefaultData.registrationAddress) == null ? void 0 : _f.country)
25454
+ },
25455
+ labels: getAddressSchemaLabelsByCountry(((_g = data == null ? void 0 : data.registrationAddress) == null ? void 0 : _g.country) ?? country),
25334
25456
  requiredFields: addressSchema,
25335
25457
  shouldValidate,
25336
25458
  hideCountry: true,
@@ -25378,9 +25500,11 @@ function AdditionalInformationComponent({
25378
25500
  {
25379
25501
  id: ADDITIONAL_INFORMATION_FORM_ID,
25380
25502
  addressType: "operationalAddress",
25381
- data: { ...mergedDefaultData == null ? void 0 : mergedDefaultData.operationalAddress, country },
25382
- labels: getAddressSchemaLabelsByCountry(country),
25383
- countryCode: country,
25503
+ data: {
25504
+ ...mergedDefaultData == null ? void 0 : mergedDefaultData.operationalAddress,
25505
+ country: ((_h = mergedDefaultData == null ? void 0 : mergedDefaultData.operationalAddress) == null ? void 0 : _h.country) ?? country
25506
+ },
25507
+ labels: getAddressSchemaLabelsByCountry(((_i = data == null ? void 0 : data.operationalAddress) == null ? void 0 : _i.country) ?? country),
25384
25508
  requiredFields: addressSchema,
25385
25509
  shouldValidate,
25386
25510
  hideCountry: true,
@@ -26324,11 +26448,14 @@ const mapBasicInformation = (data) => {
26324
26448
  }, {});
26325
26449
  };
26326
26450
  const mapAdditionalInformation = (data, legalEntity) => {
26327
- var _a, _b, _c, _d, _e;
26451
+ var _a, _b, _c, _d, _e, _f, _g;
26328
26452
  if (!data) return;
26329
26453
  const dbaName = ((_a = legalEntity.organization) == null ? void 0 : _a.doingBusinessAs) ? ((_b = legalEntity.organization) == null ? void 0 : _b.doingBusinessAs) !== ((_c = legalEntity.organization) == null ? void 0 : _c.legalName) ? { hasDba: true } : { hasDba: false } : {};
26330
26454
  const currentCountry = (_d = legalEntity.organization) == null ? void 0 : _d.registeredAddress.country;
26331
- const operationalAddressIsSame = ((_e = legalEntity.organization) == null ? void 0 : _e.principalPlaceOfBusiness) ? operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME : operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME;
26455
+ const operationalAddressIsSame = ((_e = legalEntity.organization) == null ? void 0 : _e.principalPlaceOfBusiness) && !objectsDeepEqual(
26456
+ (_f = legalEntity.organization) == null ? void 0 : _f.principalPlaceOfBusiness,
26457
+ (_g = legalEntity.organization) == null ? void 0 : _g.registeredAddress
26458
+ ) ? operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME : operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME;
26332
26459
  return entriesOf(data).reduce(
26333
26460
  (acc, [field]) => {
26334
26461
  if (!COUNTRIES_USING_COMPANY_SEARCH.includes(currentCountry)) {
@@ -27408,7 +27535,11 @@ function FormNavigation({
27408
27535
  const goToForm = (form) => () => {
27409
27536
  if (form.formId === activeForm.formId) return;
27410
27537
  gotoForm(getFormIndex(form));
27411
- trackNavigation2({ fromForm: form, toForm: activeForm, component: "FormNavigation" });
27538
+ trackNavigation2({
27539
+ fromForm: form.formName,
27540
+ toForm: activeForm.formName,
27541
+ component: "FormNavigation"
27542
+ });
27412
27543
  };
27413
27544
  const getNavigateHandler = (form, activeForm2) => {
27414
27545
  const priorForms = forms.slice(0, getFormIndex(form));
@@ -27608,20 +27739,6 @@ const FormWrapper = ({
27608
27739
  }
27609
27740
  );
27610
27741
  };
27611
- var BusinessDetailsEvents = /* @__PURE__ */ ((BusinessDetailsEvents2) => {
27612
- BusinessDetailsEvents2["TASK_START"] = "BusinessDetails_TaskStarted";
27613
- BusinessDetailsEvents2["TASK_SUBMIT"] = "BusinessDetails_TaskSubmitted";
27614
- BusinessDetailsEvents2["TASK_SAVED"] = "BusinessDetails_TaskSaved";
27615
- BusinessDetailsEvents2["TASK_ERROR"] = "BusinessDetails_TaskError";
27616
- BusinessDetailsEvents2["DOCUMENTS_SAVED"] = "BusinessDetails_DocumentsSaved";
27617
- BusinessDetailsEvents2["DOCUMENTS_ERROR"] = "BusinessDetails_DocumentsError";
27618
- BusinessDetailsEvents2["NO_SEARCH_RESULTS"] = "BusinessDetails_NoSearchResults";
27619
- BusinessDetailsEvents2["TIN_MATCH"] = "BusinessDetails_TinMatch";
27620
- BusinessDetailsEvents2["TIN_NO_MATCH"] = "BusinessDetails_TinNoMatch";
27621
- BusinessDetailsEvents2["SELECTION_RESET"] = "BusinessDetails_CompanySelectionReset";
27622
- BusinessDetailsEvents2["SELECTION_ERROR"] = "BusinessDetails_CompanySelectionError";
27623
- return BusinessDetailsEvents2;
27624
- })(BusinessDetailsEvents || {});
27625
27742
  const isMaintenanceModeError = (error) => error && "messageCode" in error && error.messageCode === "maintenanceMode";
27626
27743
  const API_VALIDATION_ERROR_CODE = "30_102";
27627
27744
  const ID_DOCUMENT_UPLOAD_ERROR_CODE = "30_105";
@@ -27684,7 +27801,7 @@ const mapBusinessDetailsDocumentToApiDocument = async (data, entityId) => {
27684
27801
  return documents.filter(Boolean);
27685
27802
  };
27686
27803
  const mapBusinessDetailsSchemaToLegalEntity = (data) => {
27687
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
27804
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
27688
27805
  const requestObj = {
27689
27806
  ...formatObject(data, businessDetailsApiKeyMapping)
27690
27807
  };
@@ -27709,9 +27826,12 @@ const mapBusinessDetailsSchemaToLegalEntity = (data) => {
27709
27826
  if (dbaName) {
27710
27827
  requestObj.organization.doingBusinessAs = dbaName;
27711
27828
  }
27829
+ if (((_o = data.additionalInformation) == null ? void 0 : _o.operationalAddressIsSame) === operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME && requestObj.organization.principalPlaceOfBusiness) {
27830
+ requestObj.organization.principalPlaceOfBusiness = requestObj.organization.registeredAddress;
27831
+ }
27712
27832
  }
27713
27833
  requestObj.type = LegalEntityType.ORGANIZATION;
27714
- if (((_o = requestObj.organization) == null ? void 0 : _o.registeredAddress.country) === "US") {
27834
+ if (((_p = requestObj.organization) == null ? void 0 : _p.registeredAddress.country) === "US") {
27715
27835
  delete requestObj.organization.registrationNumber;
27716
27836
  }
27717
27837
  return requestObj;
@@ -27754,7 +27874,7 @@ const formatBasicInformation = (data, labels2, datasetUtils, companyType) => {
27754
27874
  [registrationNumberLabel]: data.registrationNumber
27755
27875
  };
27756
27876
  };
27757
- const formatAdditionalInformation = (data, labels2, country, companyType) => {
27877
+ const formatAdditionalInformation = (data, labels2, country, companyType, i18n) => {
27758
27878
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
27759
27879
  const registrationNumberLabel = resolveFieldMetadata(
27760
27880
  defaultFieldConfig$9[country],
@@ -27779,7 +27899,7 @@ const formatAdditionalInformation = (data, labels2, country, companyType) => {
27779
27899
  [registrationNumberLabel]: data.registrationNumber,
27780
27900
  [taxIdLabel]: (_e = (_d = data.taxInformation) == null ? void 0 : _d.find((taxId) => country === taxId.country)) == null ? void 0 : _e.number,
27781
27901
  [((_f = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _f.vatNumber) ?? "vatNumber"]: data.vatNumber,
27782
- [((_g = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _g.vatAbsenceReason) ?? "vatAbsenceReason"]: data.vatAbsenceReason,
27902
+ [((_g = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _g.vatAbsenceReason) ?? "vatAbsenceReason"]: data.vatAbsenceReason ? i18n.get(data.vatAbsenceReason) : void 0,
27783
27903
  [((_h = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _h.dateOfIncorporation) ?? "dateOfIncorporation"]: data.dateOfIncorporation,
27784
27904
  [((_i = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _i.stockExchangeMIC) ?? "stockExchangeMIC"]: data.stockExchangeMIC,
27785
27905
  [((_j = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _j.stockISIN) ?? "stockISIN"]: data.stockISIN,
@@ -27823,13 +27943,11 @@ const formatDataForSummary = (data, forms, labels2, i18n) => {
27823
27943
  data[form],
27824
27944
  labels2,
27825
27945
  (_c = data.basicInformation) == null ? void 0 : _c.country,
27826
- (_d = data.companyStructure) == null ? void 0 : _d.entityType
27946
+ (_d = data.companyStructure) == null ? void 0 : _d.entityType,
27947
+ i18n
27827
27948
  ),
27828
- registrationAddress: mapAddressLabels(
27829
- data[form].registrationAddress,
27830
- datasetUtils
27831
- ),
27832
- operationalAddress: data[form].operationalAddress ? mapAddressLabels(data[form].operationalAddress, datasetUtils) : void 0
27949
+ registrationAddress: mapAddressLabels(data[form].registrationAddress, datasetUtils),
27950
+ operationalAddress: data[form].operationalAddressIsSame === operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME ? mapAddressLabels(data[form].operationalAddress, datasetUtils) : void 0
27833
27951
  }
27834
27952
  };
27835
27953
  case "companyRegistrationDocument":
@@ -27872,24 +27990,23 @@ async function submitDocuments({
27872
27990
  await documentUtils.uploadDocuments(formattedDocument, legalEntity.id);
27873
27991
  formattedDocument.forEach((doc) => {
27874
27992
  var _a;
27875
- userEvents.addEvent(BusinessDetailsEvents.DOCUMENTS_SAVED, {
27876
- segmentation: {
27877
- ...baseTrackingPayload,
27878
- documentType: doc.type,
27879
- fileExtention: ((_a = doc.attachments) == null ? void 0 : _a.map((item) => getFileExtention(item.pageName))) ?? []
27880
- }
27993
+ userEvents.addEvent("Success", {
27994
+ ...baseTrackingPayload,
27995
+ actionLevel: "task",
27996
+ actionType: "upload",
27997
+ documentType: doc.type,
27998
+ fileExtention: ((_a = doc.attachments) == null ? void 0 : _a.map((item) => getFileExtention(item.pageName))) ?? []
27881
27999
  });
27882
28000
  });
27883
28001
  }
27884
28002
  } catch (err) {
27885
28003
  logger2.error(err);
27886
- userEvents.addEvent(BusinessDetailsEvents.DOCUMENTS_ERROR, {
27887
- segmentation: {
27888
- ...baseTrackingPayload,
27889
- errorCode: err.errorCode,
27890
- errorMessage: err.title ?? err.message,
27891
- errorType: "BE"
27892
- }
28004
+ userEvents.addEvent("Encountered error", {
28005
+ ...baseTrackingPayload,
28006
+ actionLevel: "task",
28007
+ actionType: "upload",
28008
+ returnType: err.errorCode,
28009
+ returnValue: err.title ?? err.message
27893
28010
  });
27894
28011
  }
27895
28012
  }
@@ -27913,6 +28030,9 @@ async function submit({
27913
28030
  const logger2 = createLogger("submitBusinessDetails");
27914
28031
  setLoadingStatus("loading");
27915
28032
  const trackingPayload = {
28033
+ ...baseTrackingPayload,
28034
+ actionLevel: "task",
28035
+ actionType: "submit",
27916
28036
  companyStructure: ((_a = data.companyStructure) == null ? void 0 : _a.entityType) ?? null,
27917
28037
  countryOfRegistration: ((_b = data.basicInformation) == null ? void 0 : _b.country) ?? null,
27918
28038
  legalEntityName: ((_c = data.additionalInformation) == null ? void 0 : _c.legalCompanyName) ?? null,
@@ -27929,12 +28049,7 @@ async function submit({
27929
28049
  )
27930
28050
  };
27931
28051
  try {
27932
- userEvents.addEvent(BusinessDetailsEvents.TASK_SUBMIT, {
27933
- segmentation: {
27934
- ...baseTrackingPayload,
27935
- ...trackingPayload
27936
- }
27937
- });
28052
+ userEvents.addEvent("Clicked button", trackingPayload);
27938
28053
  await Promise.all([
27939
28054
  handleUpdateLegalEntity(drop("type").from(legalEntity), legalEntityResponse.id),
27940
28055
  submitDocuments({
@@ -27949,14 +28064,7 @@ async function submit({
27949
28064
  forms
27950
28065
  })
27951
28066
  ]);
27952
- userEvents.addEvent(BusinessDetailsEvents.TASK_SAVED, {
27953
- segmentation: {
27954
- ...baseTrackingPayload,
27955
- legalEntityId: legalEntity.id,
27956
- legalEntityType: legalEntity.type,
27957
- ...trackingPayload
27958
- }
27959
- });
28067
+ userEvents.addEvent("Success", trackingPayload);
27960
28068
  clearToasts();
27961
28069
  onExternalSubmit == null ? void 0 : onExternalSubmit(data);
27962
28070
  } catch (err) {
@@ -27978,13 +28086,10 @@ async function submit({
27978
28086
  showToast({ label: i18n.get("failedToUpdateDetails"), type: "error" });
27979
28087
  }
27980
28088
  logger2.error(err);
27981
- userEvents.addEvent(BusinessDetailsEvents.TASK_ERROR, {
27982
- segmentation: {
27983
- ...baseTrackingPayload,
27984
- errorCode: err.errorCode,
27985
- errorMessage: err.title,
27986
- errorType: "BE"
27987
- }
28089
+ userEvents.addEvent("Encountered error", {
28090
+ ...trackingPayload,
28091
+ returnType: err == null ? void 0 : err.errorCode,
28092
+ returnValue: (err == null ? void 0 : err.title) || "backend"
27988
28093
  });
27989
28094
  } finally {
27990
28095
  setLoadingStatus("success");
@@ -28026,14 +28131,15 @@ function BusinessDetailsDropinComponent({
28026
28131
  onChange == null ? void 0 : onChange(currentState);
28027
28132
  }, [currentState, onChange]);
28028
28133
  useEffect(() => {
28029
- userEvents.addPageView("Business details dropin");
28030
- userEvents.addEvent(BusinessDetailsEvents.TASK_START, {
28031
- segmentation: getBaseTrackingPayload({
28134
+ userEvents.addEvent("Landed on page", {
28135
+ ...getBaseTrackingPayload({
28032
28136
  trackingConfig,
28033
28137
  parentLegalEntity,
28034
28138
  legalEntity: legalEntityResponse,
28035
28139
  task: taskType
28036
- })
28140
+ }),
28141
+ actionLevel: "task",
28142
+ actionType: "start"
28037
28143
  });
28038
28144
  }, []);
28039
28145
  const formRef = useRef(null);
@@ -28588,9 +28694,10 @@ function CompanyDropinComponent({
28588
28694
  task: taskType
28589
28695
  });
28590
28696
  useEffect(() => {
28591
- userEvents.addPageView("Company dropin");
28592
- userEvents.addEvent("Started company task", {
28593
- segmentation: baseTrackingPayload
28697
+ userEvents.addEvent("Landed on page", {
28698
+ ...baseTrackingPayload,
28699
+ actionLevel: "task",
28700
+ actionType: "start"
28594
28701
  });
28595
28702
  }, []);
28596
28703
  const getConfigurationData = useCallback(
@@ -28672,12 +28779,12 @@ function CompanyDropinComponent({
28672
28779
  if (formattedDocument) {
28673
28780
  await documentUtils.uploadDocuments(formattedDocument, legalEntity.id);
28674
28781
  formattedDocument.forEach((doc) => {
28675
- userEvents.addEvent("Saved document", {
28676
- segmentation: {
28677
- ...baseTrackingPayload,
28678
- documentType: doc.type,
28679
- fileExtention: doc.attachments.map((item) => getFileExtention(item.pageName))
28680
- }
28782
+ userEvents.addEvent("Success", {
28783
+ ...baseTrackingPayload,
28784
+ actionLevel: "task",
28785
+ actionType: "save",
28786
+ documentType: doc.type,
28787
+ fileExtention: doc.attachments.map((item) => getFileExtention(item.pageName))
28681
28788
  });
28682
28789
  });
28683
28790
  }
@@ -28710,9 +28817,11 @@ function CompanyDropinComponent({
28710
28817
  let legalEntity = mapCompanyToLegalEntity(filteredData);
28711
28818
  setLoadingStatus("loading");
28712
28819
  const companyTrackingPayload = {
28820
+ actionLevel: "task",
28821
+ actionType: "submit",
28713
28822
  companyStructure: dataSubmitted.companyType.entityType,
28714
28823
  countryOfRegistration: dataSubmitted.companyNameAndCountry.country,
28715
- legalEntityName: dataSubmitted.companyNameAndCountry.legalCompanyName,
28824
+ entityName: dataSubmitted.companyNameAndCountry.legalCompanyName,
28716
28825
  usedAdditionalAddress: dataSubmitted.companyRegistrationAddress.operationalAddressIsSame === operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME
28717
28826
  };
28718
28827
  legalEntity.entityAssociations = filterOutUnwantedAssociationsIfRootLE(
@@ -28724,11 +28833,9 @@ function CompanyDropinComponent({
28724
28833
  delete legalEntity.organization.countryOfGoverningLaw;
28725
28834
  }
28726
28835
  try {
28727
- userEvents.addEvent("Provided company details", {
28728
- segmentation: {
28729
- ...baseTrackingPayload,
28730
- ...companyTrackingPayload
28731
- }
28836
+ userEvents.addEvent("Clicked button", {
28837
+ ...baseTrackingPayload,
28838
+ ...companyTrackingPayload
28732
28839
  });
28733
28840
  if (!(legalEntityResponse == null ? void 0 : legalEntityResponse.id)) {
28734
28841
  legalEntity = await handleCreateLegalEntity(legalEntity);
@@ -28739,13 +28846,11 @@ function CompanyDropinComponent({
28739
28846
  );
28740
28847
  }
28741
28848
  setAccountHolder(accountHolder);
28742
- userEvents.addEvent("Saved company details", {
28743
- segmentation: {
28744
- ...baseTrackingPayload,
28745
- legalEntityId: legalEntity.id,
28746
- legalEntityType: legalEntity.type,
28747
- ...companyTrackingPayload
28748
- }
28849
+ userEvents.addEvent("Success", {
28850
+ ...baseTrackingPayload,
28851
+ ...companyTrackingPayload,
28852
+ legalEntityId: legalEntity.id,
28853
+ entityType: legalEntity.type
28749
28854
  });
28750
28855
  await submitDocuments2({ forms, legalEntity, dataSubmitted });
28751
28856
  await attachAssociationToParentLegalEntity({ legalEntity });
@@ -28767,13 +28872,12 @@ function CompanyDropinComponent({
28767
28872
  showToast({ label: i18n.get("failedToUpdateDetails"), type: "error" });
28768
28873
  }
28769
28874
  setLoadingStatus("success");
28770
- userEvents.addEvent("Encountered error company details", {
28771
- segmentation: {
28772
- ...baseTrackingPayload,
28773
- errorCode: e.errorCode,
28774
- errorMessage: e.title,
28775
- errorType: "BE"
28776
- }
28875
+ userEvents.addEvent("Encountered error", {
28876
+ ...baseTrackingPayload,
28877
+ actionLevel: "task",
28878
+ actionType: "submit",
28879
+ returnType: e.errorCode,
28880
+ returnValue: e.title
28777
28881
  });
28778
28882
  }
28779
28883
  };
@@ -29461,7 +29565,12 @@ const getTrustMembers = (trustLE, rootLegalEntity, exemptSettlorLE) => {
29461
29565
  ];
29462
29566
  };
29463
29567
  const combineRootLegalEntityWithEntityAssociations = (rootLegalEntity, entityAssociations) => {
29464
- const roles = entityAssociations.map((entityAssociation) => entityAssociation.type).filter((role) => role === TrustMemberTypes.SETTLOR || role === TrustMemberTypes.PROTECTOR);
29568
+ const allowedRolesForRootLegalEntity = [
29569
+ TrustMemberTypes.SETTLOR,
29570
+ TrustMemberTypes.PROTECTOR,
29571
+ TrustMemberTypes.DEFINED_BENEFICIARY
29572
+ ];
29573
+ const roles = entityAssociations.map((entityAssociation) => entityAssociation.type).filter((role) => allowedRolesForRootLegalEntity.includes(role));
29465
29574
  return {
29466
29575
  trustMemberType: "rootTrustee",
29467
29576
  roles: [...roles, TrustMemberTypes.TRUSTEE],
@@ -29761,8 +29870,7 @@ const BusinessTypeSelection = ({
29761
29870
  accountHolder,
29762
29871
  onComplete,
29763
29872
  onBack,
29764
- handleUpdateLegalEntity,
29765
- baseTrackingPayload
29873
+ handleUpdateLegalEntity
29766
29874
  }) => {
29767
29875
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
29768
29876
  const { i18n } = useI18nContext();
@@ -29825,25 +29933,16 @@ const BusinessTypeSelection = ({
29825
29933
  )
29826
29934
  );
29827
29935
  }, [data.businessType, data.legalArrangement, currentStep]);
29936
+ const baseTrackingPayload = getBaseTrackingPayload({
29937
+ legalEntity: legalEntityResponse,
29938
+ task: TaskTypes.BUSINESS_TYPE_SELECTION
29939
+ });
29828
29940
  useEffect(() => {
29829
- userEvents.addPageView("Entity Selection");
29830
- const startDropOffTrackingEvent = () => {
29831
- userEvents.addEvent("Started legal entity selection", {
29832
- segmentation: baseTrackingPayload
29833
- });
29834
- };
29835
- const stopDropOffTrackingEvent = () => {
29836
- userEvents.addEvent("Drop off at legal entity selection", {
29837
- segmentation: baseTrackingPayload
29838
- });
29839
- };
29840
- startDropOffTrackingEvent();
29841
- window.addEventListener("focus", startDropOffTrackingEvent);
29842
- window.addEventListener("blur", stopDropOffTrackingEvent);
29843
- return () => {
29844
- window.removeEventListener("focus", startDropOffTrackingEvent);
29845
- window.removeEventListener("blur", stopDropOffTrackingEvent);
29846
- };
29941
+ userEvents.addEvent("Landed on page", {
29942
+ ...baseTrackingPayload,
29943
+ actionLevel: "task",
29944
+ actionType: "start"
29945
+ });
29847
29946
  }, []);
29848
29947
  const handleNextClick = async () => {
29849
29948
  var _a2;
@@ -29875,21 +29974,20 @@ const BusinessTypeSelection = ({
29875
29974
  return;
29876
29975
  }
29877
29976
  await updateLegalEntityAndSelectAccountHolder();
29878
- userEvents.addEvent("Saved legal entity selection", {
29879
- segmentation: baseTrackingPayload
29880
- });
29881
29977
  } else {
29882
29978
  onComplete(newAccountHolder);
29883
29979
  }
29884
29980
  if (isLegalArrangementChanging) {
29885
29981
  await updateLegalEntityAndSelectAccountHolder();
29886
- userEvents.addEvent("Saved legal entity selection", {
29887
- segmentation: baseTrackingPayload
29888
- });
29889
29982
  }
29890
29983
  }
29891
29984
  };
29892
29985
  const updateLegalEntityAndSelectAccountHolder = async () => {
29986
+ const trackingPayload = {
29987
+ ...baseTrackingPayload,
29988
+ actionLevel: "task",
29989
+ actionType: "submit"
29990
+ };
29893
29991
  try {
29894
29992
  if (isLegalEntityTypeChanging) {
29895
29993
  setLoadingStatus("loading");
@@ -29897,8 +29995,17 @@ const BusinessTypeSelection = ({
29897
29995
  type: targetLegalEntityType
29898
29996
  };
29899
29997
  await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity(updateLegalEntityPayload, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
29998
+ userEvents.addEvent("Success", trackingPayload);
29900
29999
  }
29901
30000
  if (targetLegalEntityType === LegalEntityType.INDIVIDUAL) {
30001
+ if (hasSolePropInLegalEntity(legalEntityResponse)) {
30002
+ setLoadingStatus("loading");
30003
+ const updateLegalEntityPayload = {
30004
+ entityAssociations: []
30005
+ };
30006
+ await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity(updateLegalEntityPayload, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
30007
+ userEvents.addEvent("Success", trackingPayload);
30008
+ }
29902
30009
  return;
29903
30010
  }
29904
30011
  const targetOrganizationType = determineOrganizationTypeToUpdate(
@@ -29915,6 +30022,7 @@ const BusinessTypeSelection = ({
29915
30022
  },
29916
30023
  legalEntityResponse == null ? void 0 : legalEntityResponse.id
29917
30024
  ));
30025
+ userEvents.addEvent("Success", trackingPayload);
29918
30026
  }
29919
30027
  } catch (e) {
29920
30028
  showToast({ label: i18n.get("failedToUpdateDetails"), type: "error" });
@@ -30509,6 +30617,7 @@ const DecisionMakersComponent = ({
30509
30617
  const decisionMakers = getOwnDecisionMakers(legalEntityResponse);
30510
30618
  const registeredCountry = (_b = (_a = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _a.registeredAddress) == null ? void 0 : _b.country;
30511
30619
  const availableDecisionMakers = getAvailableDecisionMakerRoleTypes(registeredCountry);
30620
+ const homeButtonLabel = i18n.get("saveAndGoToOverview");
30512
30621
  const { remediationMessages } = useDataMissingRemediations({
30513
30622
  legalEntityId: legalEntityResponse.id,
30514
30623
  problems: capabilityProblems
@@ -30549,13 +30658,13 @@ const DecisionMakersComponent = ({
30549
30658
  };
30550
30659
  const editDecisionMaker = (decisionMaker) => {
30551
30660
  onNavigateToIndividual(decisionMaker.reference);
30552
- userEvents.addEvent("Edited decision maker", {
30553
- segmentation: {
30554
- ...baseTrackingPayload,
30555
- legalEntityId: decisionMaker.reference,
30556
- legalEntityType: decisionMaker.legalEntityType,
30557
- roles: decisionMaker.types
30558
- }
30661
+ userEvents.addEvent("Clicked button", {
30662
+ ...baseTrackingPayload,
30663
+ actionLevel: "task",
30664
+ actionType: "edit",
30665
+ legalEntityId: decisionMaker.reference,
30666
+ entityType: decisionMaker.legalEntityType,
30667
+ roles: decisionMaker.types
30559
30668
  });
30560
30669
  };
30561
30670
  const deleteDecisionMaker = async (decisionMaker) => {
@@ -30570,14 +30679,14 @@ const DecisionMakersComponent = ({
30570
30679
  const remainingDecisionMakers = decisionMakers.filter(
30571
30680
  (curr) => curr.legalEntityId !== decisionMaker.reference
30572
30681
  );
30573
- userEvents.addEvent("Removed decision maker", {
30574
- segmentation: {
30575
- ...baseTrackingPayload,
30576
- legalEntityId: decisionMaker.reference,
30577
- legalEntityType: decisionMaker.legalEntityType,
30578
- roles: decisionMaker.types,
30579
- remainingDecisionMakers
30580
- }
30682
+ userEvents.addEvent("Clicked button", {
30683
+ ...baseTrackingPayload,
30684
+ actionLevel: "task",
30685
+ actionType: "remove",
30686
+ legalEntityId: decisionMaker.reference,
30687
+ entityType: decisionMaker.legalEntityType,
30688
+ roles: decisionMaker.types,
30689
+ remainingDecisionMakers
30581
30690
  });
30582
30691
  showToast({ type: "success", label: i18n.get("successFullyRemovedDecisionMaker") });
30583
30692
  } catch (e) {
@@ -30624,7 +30733,8 @@ const DecisionMakersComponent = ({
30624
30733
  roleType
30625
30734
  )) }),
30626
30735
  titleId: "whatIsTheDifferenceBetweenTheseRoles",
30627
- contentId: "differenceBetweenAnOwnerControllingPersonAndSignatory"
30736
+ contentId: "differenceBetweenAnOwnerControllingPersonAndSignatory",
30737
+ baseTrackingPayload
30628
30738
  }
30629
30739
  ),
30630
30740
  showWarning && /* @__PURE__ */ jsx(
@@ -30668,15 +30778,16 @@ const DecisionMakersComponent = ({
30668
30778
  ActionBar,
30669
30779
  {
30670
30780
  onHome: () => {
30671
- userEvents.addEvent("Saved decision makers list", {
30672
- segmentation: {
30673
- ...baseTrackingPayload,
30674
- noOfDecisionMakers: decisionMakers.length
30675
- }
30781
+ userEvents.addEvent("Clicked button", {
30782
+ ...baseTrackingPayload,
30783
+ actionLevel: "task",
30784
+ actionType: "back",
30785
+ label: homeButtonLabel,
30786
+ noOfDecisionMakers: decisionMakers.length
30676
30787
  });
30677
30788
  navigateBackToTaskList();
30678
30789
  },
30679
- homeButtonLabel: i18n.get("saveAndGoToOverview")
30790
+ homeButtonLabel
30680
30791
  }
30681
30792
  )
30682
30793
  ] })
@@ -30735,22 +30846,6 @@ const introductionScreensByLegalEntityType = {
30735
30846
  IntroductionScreens.EPILOGUE
30736
30847
  ]
30737
30848
  };
30738
- var IntroductionScreenEvent = /* @__PURE__ */ ((IntroductionScreenEvent2) => {
30739
- IntroductionScreenEvent2["EMPTY"] = "Introduction_Empty";
30740
- IntroductionScreenEvent2["START_FLOW"] = "Introduction_StartFlow";
30741
- IntroductionScreenEvent2["START_SCREEN"] = "Introduction_StartScreen";
30742
- IntroductionScreenEvent2["STOP_SCREEN"] = "Introduction_StopScreen";
30743
- IntroductionScreenEvent2["STOP_FLOW"] = "Introduction_StopFlow";
30744
- IntroductionScreenEvent2["NEXT"] = "Introduction_Next";
30745
- IntroductionScreenEvent2["BACK"] = "Introduction_Back";
30746
- IntroductionScreenEvent2["SKIP"] = "Introduction_Skip";
30747
- return IntroductionScreenEvent2;
30748
- })(IntroductionScreenEvent || {});
30749
- var IntroductionScreenTiming = /* @__PURE__ */ ((IntroductionScreenTiming2) => {
30750
- IntroductionScreenTiming2["VIEW_FLOW"] = "Introduction_ViewFlow";
30751
- IntroductionScreenTiming2["VIEW_SCREEN"] = "Introduction_ViewScreen";
30752
- return IntroductionScreenTiming2;
30753
- })(IntroductionScreenTiming || {});
30754
30849
  const useLegalEntityType = ({
30755
30850
  legalEntity
30756
30851
  }) => {
@@ -30863,28 +30958,33 @@ const Introduction = ({
30863
30958
  const { i18n } = useI18nContext();
30864
30959
  const introductionScreens = useIntroductionScreens({ legalEntity, tasks });
30865
30960
  const [activeIndex, setActiveIndex] = useState(0);
30866
- const eventSegmentationDefaults = getBaseTrackingPayload({
30961
+ const baseTrackingPayload = getBaseTrackingPayload({
30867
30962
  trackingConfig: { topLevelLegalEntity: legalEntity },
30868
30963
  legalEntity,
30869
30964
  task: TaskTypes.INTRODUCTION
30870
30965
  });
30871
- const eventDetails = {
30872
- segmentation: {
30873
- ...eventSegmentationDefaults,
30874
- page: (introductionScreens == null ? void 0 : introductionScreens.length) ? introductionScreens[activeIndex] : null
30875
- }
30966
+ const pageEventDetails = {
30967
+ ...baseTrackingPayload,
30968
+ actionLevel: "page",
30969
+ page: (introductionScreens == null ? void 0 : introductionScreens.length) ? introductionScreens[activeIndex] : void 0
30876
30970
  };
30877
30971
  useEffect(() => {
30878
- if (!(introductionScreens == null ? void 0 : introductionScreens.length)) {
30879
- userEvents.addEvent(IntroductionScreenEvent.EMPTY, {
30880
- segmentation: eventSegmentationDefaults
30972
+ if (introductionScreens == null ? void 0 : introductionScreens.length) {
30973
+ userEvents.addEvent("Landed on page", {
30974
+ ...baseTrackingPayload,
30975
+ actionLevel: "task",
30976
+ actionType: "start"
30881
30977
  });
30882
- onExitIntroduction();
30883
30978
  } else {
30884
- userEvents.startEvent(IntroductionScreenTiming.VIEW_FLOW);
30885
- userEvents.addEvent(IntroductionScreenEvent.START_FLOW, eventDetails);
30979
+ onExitIntroduction();
30886
30980
  }
30887
30981
  }, [introductionScreens]);
30982
+ const buttonLabels = {
30983
+ skip: i18n.get("goToOverviewFromIntroduction"),
30984
+ back: i18n.get("back"),
30985
+ next: i18n.get("next"),
30986
+ start: i18n.get("start")
30987
+ };
30888
30988
  return (introductionScreens == null ? void 0 : introductionScreens.length) ? /* @__PURE__ */ jsxs("div", { className: "adyen-kyc-introduction", children: [
30889
30989
  /* @__PURE__ */ jsx(
30890
30990
  StepProgressIndicator,
@@ -30896,9 +30996,13 @@ const Introduction = ({
30896
30996
  /* @__PURE__ */ jsx("div", { className: "adyen-kyc-introduction__skip", children: /* @__PURE__ */ jsx(
30897
30997
  Button,
30898
30998
  {
30899
- label: i18n.get("goToOverviewFromIntroduction"),
30999
+ label: buttonLabels.skip,
30900
31000
  onClick: () => {
30901
- userEvents.addEvent(IntroductionScreenEvent.SKIP, eventDetails);
31001
+ userEvents.addEvent("Clicked button", {
31002
+ ...pageEventDetails,
31003
+ actionType: "skip",
31004
+ label: buttonLabels.skip
31005
+ });
30902
31006
  onExitIntroduction();
30903
31007
  },
30904
31008
  showAsLink: true,
@@ -30919,14 +31023,14 @@ const Introduction = ({
30919
31023
  Button,
30920
31024
  {
30921
31025
  disabled: activeIndex === 0,
30922
- label: "Back",
31026
+ label: buttonLabels.back,
30923
31027
  onClick: () => {
30924
- userEvents.addEvent(IntroductionScreenEvent.BACK, eventDetails);
30925
- userEvents.addEvent(IntroductionScreenEvent.STOP_SCREEN, eventDetails);
30926
- userEvents.endEvent(IntroductionScreenTiming.VIEW_SCREEN, eventDetails);
31028
+ userEvents.addEvent("Clicked button", {
31029
+ ...pageEventDetails,
31030
+ actionType: "back",
31031
+ label: buttonLabels.back
31032
+ });
30927
31033
  setActiveIndex((currentValue) => currentValue - 1);
30928
- userEvents.startEvent(IntroductionScreenTiming.VIEW_SCREEN);
30929
- userEvents.addEvent(IntroductionScreenEvent.START_SCREEN, eventDetails);
30930
31034
  },
30931
31035
  secondary: true,
30932
31036
  type: "button"
@@ -30935,12 +31039,14 @@ const Introduction = ({
30935
31039
  activeIndex + 1 === introductionScreens.length ? /* @__PURE__ */ jsx(
30936
31040
  Button,
30937
31041
  {
30938
- label: "Start",
31042
+ label: buttonLabels.start,
30939
31043
  onClick: () => {
30940
- userEvents.addEvent(IntroductionScreenEvent.STOP_SCREEN, eventDetails);
30941
- userEvents.addEvent(IntroductionScreenEvent.STOP_FLOW, eventDetails);
30942
- userEvents.endEvent(IntroductionScreenTiming.VIEW_SCREEN, eventDetails);
30943
- userEvents.endEvent(IntroductionScreenTiming.VIEW_FLOW, eventDetails);
31044
+ userEvents.addEvent("Success", {
31045
+ ...baseTrackingPayload,
31046
+ actionLevel: "task",
31047
+ actionType: "start",
31048
+ label: buttonLabels.start
31049
+ });
30944
31050
  onExitIntroduction();
30945
31051
  },
30946
31052
  type: "button"
@@ -30948,14 +31054,14 @@ const Introduction = ({
30948
31054
  ) : /* @__PURE__ */ jsx(
30949
31055
  Button,
30950
31056
  {
30951
- label: "Next",
31057
+ label: buttonLabels.next,
30952
31058
  onClick: () => {
30953
- userEvents.addEvent(IntroductionScreenEvent.NEXT, eventDetails);
30954
- userEvents.addEvent(IntroductionScreenEvent.STOP_SCREEN, eventDetails);
30955
- userEvents.endEvent(IntroductionScreenTiming.VIEW_SCREEN, eventDetails);
31059
+ userEvents.addEvent("Clicked button", {
31060
+ ...pageEventDetails,
31061
+ actionType: "next",
31062
+ label: buttonLabels.next
31063
+ });
30956
31064
  setActiveIndex((currentValue) => currentValue + 1);
30957
- userEvents.startEvent(IntroductionScreenTiming.VIEW_SCREEN);
30958
- userEvents.addEvent(IntroductionScreenEvent.START_SCREEN, eventDetails);
30959
31065
  },
30960
31066
  type: "button"
30961
31067
  }
@@ -31565,13 +31671,14 @@ function TaskListComponent({
31565
31671
  const companyTaskDescriptionKey = isReview ? "businessAccountDetailsDescriptionReview" : "businessAccountDetailsDescription";
31566
31672
  const payoutTaskDescriptionKey = isReview ? "payoutAccountsDescriptionReview" : "payoutAccountsDescription";
31567
31673
  const onEditBusinessSetupClick = () => {
31568
- const baseTrackingPayload = getBaseTrackingPayload({
31569
- trackingConfig,
31570
- legalEntity: legalEntityResponse,
31571
- task: tasks[tasks.length - 1]
31572
- });
31573
- userEvents.addEvent("Clicked back to legal entity selection", {
31574
- segmentation: baseTrackingPayload
31674
+ userEvents.addEvent("Clicked button", {
31675
+ ...getBaseTrackingPayload({
31676
+ trackingConfig,
31677
+ legalEntity: legalEntityResponse,
31678
+ task: TaskTypes.TASKS_OVERVIEW
31679
+ }),
31680
+ actionLevel: "task",
31681
+ actionType: "edit"
31575
31682
  });
31576
31683
  onNavigateToTask(TaskTypes.BUSINESS_TYPE_SELECTION);
31577
31684
  };
@@ -32089,7 +32196,8 @@ const TrustMembersOverview = ({
32089
32196
  label
32090
32197
  )) }),
32091
32198
  titleId: "whatIsTheDifferenceBetweenTheseRoles",
32092
- contentId: "differenceBetweenTrustMemberRoles"
32199
+ contentId: "differenceBetweenTrustMemberRoles",
32200
+ baseTrackingPayload: { task: TaskTypes.TRUST_MEMBER_OVERVIEW }
32093
32201
  }
32094
32202
  ),
32095
32203
  /* @__PURE__ */ jsx(CardGroup, { children: trustMembers.map((trustMember) => {
@@ -32345,9 +32453,10 @@ function IndividualDropinComponent({
32345
32453
  task: taskType
32346
32454
  });
32347
32455
  useEffect(() => {
32348
- userEvents.addPageView("Individual dropin");
32349
- userEvents.addEvent("Started individual task", {
32350
- segmentation: { ...baseTrackingPayload }
32456
+ userEvents.addEvent("Landed on page", {
32457
+ ...baseTrackingPayload,
32458
+ actionLevel: "task",
32459
+ actionType: "start"
32351
32460
  });
32352
32461
  }, []);
32353
32462
  const getConfigurationData = useCallback(
@@ -32477,27 +32586,27 @@ function IndividualDropinComponent({
32477
32586
  throw new Error("Provide handler to create legalEntity");
32478
32587
  }
32479
32588
  updatedLegalEntity = await handleCreateLegalEntity(legalEntity);
32480
- userEvents.addEvent("Added decision maker", {
32481
- segmentation: {
32482
- ...baseTrackingPayload,
32483
- legalEntityId: updatedLegalEntity.id,
32484
- legalEntityType: updatedLegalEntity.type,
32485
- countryOfRegistration: ((_a2 = dataSubmitted.personalDetails) == null ? void 0 : _a2.residencyCountry) || null,
32486
- roles: ((_b2 = dataSubmitted.personalDetails) == null ? void 0 : _b2.role) || null
32487
- }
32589
+ userEvents.addEvent("Success", {
32590
+ ...baseTrackingPayload,
32591
+ actionLevel: "task",
32592
+ actionType: "submit",
32593
+ legalEntityId: updatedLegalEntity.id,
32594
+ entityType: updatedLegalEntity.type,
32595
+ countryOfRegistration: ((_a2 = dataSubmitted.personalDetails) == null ? void 0 : _a2.residencyCountry) || null,
32596
+ roles: ((_b2 = dataSubmitted.personalDetails) == null ? void 0 : _b2.role) || null
32488
32597
  });
32489
32598
  } else {
32490
32599
  updatedLegalEntity = await handleUpdateLegalEntity(drop("type").from(legalEntity), leId);
32491
- }
32492
- userEvents.addEvent("Saved individual details", {
32493
- segmentation: {
32600
+ userEvents.addEvent("Success", {
32494
32601
  ...baseTrackingPayload,
32602
+ actionLevel: "task",
32603
+ actionType: "submit",
32495
32604
  legalEntityId: updatedLegalEntity.id,
32496
- legalEntityType: updatedLegalEntity.type,
32605
+ entityType: updatedLegalEntity.type,
32497
32606
  countryOfRegistration: ((_c2 = dataSubmitted.personalDetails) == null ? void 0 : _c2.residencyCountry) || null,
32498
32607
  idDocumentType: idDocumentType || null
32499
- }
32500
- });
32608
+ });
32609
+ }
32501
32610
  return updatedLegalEntity;
32502
32611
  };
32503
32612
  const handleInstantIdVerificationStartCheck = async (onfidoResponse, legalEntityId) => {
@@ -32530,12 +32639,12 @@ function IndividualDropinComponent({
32530
32639
  );
32531
32640
  uploadedDocuments == null ? void 0 : uploadedDocuments.forEach((doc) => {
32532
32641
  var _a3;
32533
- userEvents.addEvent("Saved document", {
32534
- segmentation: {
32535
- ...baseTrackingPayload,
32536
- documentType: doc.type,
32537
- fileExtention: ((_a3 = doc == null ? void 0 : doc.attachments) == null ? void 0 : _a3.map((item) => getFileExtention(item.pageName))) ?? null
32538
- }
32642
+ userEvents.addEvent("Success", {
32643
+ ...baseTrackingPayload,
32644
+ actionLevel: "task",
32645
+ actionType: "upload",
32646
+ documentType: doc.type,
32647
+ fileExtention: ((_a3 = doc == null ? void 0 : doc.attachments) == null ? void 0 : _a3.map((item) => getFileExtention(item.pageName))) ?? null
32539
32648
  });
32540
32649
  });
32541
32650
  }
@@ -32602,12 +32711,12 @@ function IndividualDropinComponent({
32602
32711
  return ((_a3 = dataSubmitted == null ? void 0 : dataSubmitted.idDocument) == null ? void 0 : _a3.idDocumentType) === id;
32603
32712
  }
32604
32713
  )) == null ? void 0 : _a2.id;
32605
- userEvents.addEvent("Provided individual details", {
32606
- segmentation: {
32607
- ...baseTrackingPayload,
32608
- countryOfRegistration: ((_b2 = dataSubmitted == null ? void 0 : dataSubmitted.personalDetails) == null ? void 0 : _b2.residencyCountry) || null,
32609
- idDocumentType: idDocumentType || null
32610
- }
32714
+ userEvents.addEvent("Clicked button", {
32715
+ ...baseTrackingPayload,
32716
+ actionLevel: "task",
32717
+ actionType: "submit",
32718
+ countryOfRegistration: ((_b2 = dataSubmitted == null ? void 0 : dataSubmitted.personalDetails) == null ? void 0 : _b2.residencyCountry) || null,
32719
+ idDocumentType: idDocumentType || null
32611
32720
  });
32612
32721
  legalEntity.entityAssociations = filterOutUnwantedAssociationsIfRootLE(
32613
32722
  taskType,
@@ -32646,13 +32755,12 @@ function IndividualDropinComponent({
32646
32755
  showToast({ label: i18n.get("failedToUpdateDetails"), type: "error" });
32647
32756
  }
32648
32757
  setLoadingStatus("success");
32649
- userEvents.addEvent("Encountered error individual details", {
32650
- segmentation: {
32651
- ...baseTrackingPayload,
32652
- errorCode: e.errorCode,
32653
- errorMessage: e.title,
32654
- errorType: "BE"
32655
- }
32758
+ userEvents.addEvent("Encountered error", {
32759
+ ...baseTrackingPayload,
32760
+ actionLevel: "task",
32761
+ actionType: "submit",
32762
+ returnType: e.errorCode,
32763
+ returnValue: e.title
32656
32764
  });
32657
32765
  }
32658
32766
  };
@@ -33043,9 +33151,10 @@ function PayoutDetailsDropinComponent({
33043
33151
  task: taskType
33044
33152
  });
33045
33153
  useEffect(() => {
33046
- userEvents.addPageView("Payout dropin");
33047
- userEvents.addEvent("Started payout task", {
33048
- segmentation: { ...baseTrackingPayload }
33154
+ userEvents.addEvent("Landed on page", {
33155
+ ...baseTrackingPayload,
33156
+ actionLevel: "task",
33157
+ actionType: "start"
33049
33158
  });
33050
33159
  }, []);
33051
33160
  const { getConfigurationData, provider } = useBankConfigurationHandlers({
@@ -33171,12 +33280,12 @@ function PayoutDetailsDropinComponent({
33171
33280
  );
33172
33281
  documents2.forEach((document2) => {
33173
33282
  var _a2;
33174
- userEvents.addEvent("Saved document", {
33175
- segmentation: {
33176
- ...baseTrackingPayload,
33177
- documentType: document2.type,
33178
- fileExtention: ((_a2 = document2.attachments) == null ? void 0 : _a2.map((item) => getFileExtention(item.pageName))) ?? null
33179
- }
33283
+ userEvents.addEvent("Success", {
33284
+ ...baseTrackingPayload,
33285
+ actionLevel: "task",
33286
+ actionType: "upload",
33287
+ documentType: document2.type,
33288
+ fileExtention: ((_a2 = document2.attachments) == null ? void 0 : _a2.map((item) => getFileExtention(item.pageName))) ?? null
33180
33289
  });
33181
33290
  });
33182
33291
  } catch (e) {
@@ -33208,15 +33317,15 @@ function PayoutDetailsDropinComponent({
33208
33317
  existingPayoutDetails == null ? void 0 : existingPayoutDetails.payoutAccountDetails
33209
33318
  );
33210
33319
  }
33211
- const event = {
33212
- segmentation: {
33213
- ...baseTrackingPayload,
33214
- documentType: DocumentType.BANK_STATEMENT,
33215
- bankCountry: (payoutVerificationMethod == null ? void 0 : payoutVerificationMethod.bankCountry) ?? defaultPayoutCountry,
33216
- bankCurrency: (payoutAccountDetails == null ? void 0 : payoutAccountDetails.currency) ?? null
33217
- }
33320
+ const baseTracking = {
33321
+ ...baseTrackingPayload,
33322
+ actionLevel: "task",
33323
+ actionType: "submit",
33324
+ documentType: DocumentType.BANK_STATEMENT,
33325
+ bankCountry: (payoutVerificationMethod == null ? void 0 : payoutVerificationMethod.bankCountry) ?? defaultPayoutCountry,
33326
+ bankCurrency: (payoutAccountDetails == null ? void 0 : payoutAccountDetails.currency) ?? null
33218
33327
  };
33219
- userEvents.addEvent("Provided payout details", event);
33328
+ userEvents.addEvent("Clicked button", baseTracking);
33220
33329
  let transferInstrument2 = mapPayoutAccountToTransferInstrument({
33221
33330
  data: dataSubmitted,
33222
33331
  legalEntity: legalEntityResponse
@@ -33232,7 +33341,7 @@ function PayoutDetailsDropinComponent({
33232
33341
  transferInstrumentId
33233
33342
  );
33234
33343
  }
33235
- userEvents.addEvent("Saved payout details", event);
33344
+ userEvents.addEvent("Success", baseTracking);
33236
33345
  try {
33237
33346
  await submitDocuments2({ forms, transferInstrument: transferInstrument2, dataSubmitted });
33238
33347
  setLoadingStatus("success");
@@ -33261,13 +33370,10 @@ function PayoutDetailsDropinComponent({
33261
33370
  showToast({ label: i18n.get("failedToUpdateDetails"), type: "error" });
33262
33371
  }
33263
33372
  setLoadingStatus("success");
33264
- userEvents.addEvent("Encountered error payout details", {
33265
- segmentation: {
33266
- ...baseTrackingPayload,
33267
- errorCode: e.errorCode,
33268
- errorMessage: e.title,
33269
- errorType: "BE"
33270
- }
33373
+ userEvents.addEvent("Encountered error", {
33374
+ ...baseTracking,
33375
+ returnType: (e == null ? void 0 : e.errorCode) || "backend",
33376
+ returnValue: (e == null ? void 0 : e.title) || (e == null ? void 0 : e.message)
33271
33377
  });
33272
33378
  }
33273
33379
  };
@@ -33460,6 +33566,8 @@ function PciDropinComponent({
33460
33566
  });
33461
33567
  const [loadingStatus, setLoadingStatus] = useState();
33462
33568
  const hasExpired = useHasExpired();
33569
+ const signButtonLabel = i18n.get("sign");
33570
+ const homeButtonLabel = i18n.get("goToOverview");
33463
33571
  const { handleChangeFor, triggerValidation, data, valid, isValid, errors } = useForm({
33464
33572
  schema: PciFields,
33465
33573
  rules: pciValidationRules
@@ -33486,7 +33594,13 @@ function PciDropinComponent({
33486
33594
  ];
33487
33595
  const handleSignClick = async () => {
33488
33596
  if (loadingStatus === "loading") return;
33489
- userEvents.addEvent("Clicked PCI signing", { segmentation: { ...baseTrackingPayload } });
33597
+ const baseTracking = {
33598
+ ...baseTrackingPayload,
33599
+ actionLevel: "task",
33600
+ actionType: "sign",
33601
+ label: signButtonLabel
33602
+ };
33603
+ userEvents.addEvent("Clicked button", baseTracking);
33490
33604
  triggerValidation();
33491
33605
  if (isValid) {
33492
33606
  try {
@@ -33494,40 +33608,47 @@ function PciDropinComponent({
33494
33608
  await handleSign(legalEntityResponse.id, { signedBy: data.signer, pciTemplateReferences });
33495
33609
  setLoadingStatus("success");
33496
33610
  showToast({ label: i18n.get("pciSignedSuccessfully"), type: "success" });
33497
- userEvents.addEvent("Succeeded PCI signing", { segmentation: { ...baseTrackingPayload } });
33611
+ userEvents.addEvent("Success", baseTracking);
33498
33612
  goHome();
33499
- } catch {
33613
+ } catch (e) {
33500
33614
  setLoadingStatus("success");
33501
33615
  showToast({ label: i18n.get("pciSignFailed"), type: "error" });
33502
- userEvents.addEvent("Failed PCI signing", { segmentation: { ...baseTrackingPayload } });
33616
+ userEvents.addEvent("Encountered error", {
33617
+ ...baseTracking,
33618
+ returnType: (e == null ? void 0 : e.errorCode) || "backend",
33619
+ returnValue: (e == null ? void 0 : e.title) ?? (e == null ? void 0 : e.message)
33620
+ });
33503
33621
  }
33504
33622
  } else {
33505
- userEvents.addEvent("Encountered PCI validation error", {
33506
- segmentation: {
33507
- ...baseTrackingPayload,
33508
- fields: Object.entries(valid).filter(([, value]) => !value).map(([key]) => key)
33509
- }
33623
+ userEvents.addEvent("Encountered error", {
33624
+ ...baseTracking,
33625
+ returnType: "validation",
33626
+ returnValue: Object.entries(valid).filter(([, value]) => !value).map(([key]) => key)
33510
33627
  });
33511
33628
  }
33512
33629
  };
33513
33630
  const goHome = () => {
33514
- userEvents.addEvent("Returned to task overview from PCI", {
33515
- segmentation: { ...baseTrackingPayload }
33631
+ userEvents.addEvent("Clicked button", {
33632
+ ...baseTrackingPayload,
33633
+ actionLevel: "task",
33634
+ actionType: "back",
33635
+ label: homeButtonLabel
33516
33636
  });
33517
33637
  handleHomeClick();
33518
33638
  };
33519
33639
  const handleExpandSection = (title) => {
33520
- userEvents.addEvent("Expanded PCI section", {
33521
- segmentation: {
33522
- ...baseTrackingPayload,
33523
- statementExtended: title
33524
- }
33640
+ userEvents.addEvent("Clicked accordion", {
33641
+ ...baseTrackingPayload,
33642
+ actionLevel: "task",
33643
+ actionType: "open",
33644
+ label: title
33525
33645
  });
33526
33646
  };
33527
33647
  useEffect(() => {
33528
- userEvents.addPageView("PCI dropin");
33529
- userEvents.addEvent("Started PCI task", {
33530
- segmentation: { ...baseTrackingPayload }
33648
+ userEvents.addEvent("Landed on page", {
33649
+ ...baseTrackingPayload,
33650
+ actionLevel: "task",
33651
+ actionType: "start"
33531
33652
  });
33532
33653
  }, []);
33533
33654
  const acceptPciLabel = /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -33586,9 +33707,9 @@ function PciDropinComponent({
33586
33707
  ActionBar,
33587
33708
  {
33588
33709
  onHome: goHome,
33589
- homeButtonLabel: i18n.get("goToOverview"),
33710
+ homeButtonLabel,
33590
33711
  onNext: handleSignClick,
33591
- nextButtonLabel: i18n.get("sign")
33712
+ nextButtonLabel: signButtonLabel
33592
33713
  }
33593
33714
  );
33594
33715
  return /* @__PURE__ */ jsx(DropinLayout, { content, footer });
@@ -34466,6 +34587,8 @@ function ServiceAgreementDropinComponent({
34466
34587
  const [activeForm, setActiveForm] = useState(forms[activeFormIndex]);
34467
34588
  const canSign = (serviceAgreementTypes == null ? void 0 : serviceAgreementTypes.includes(activeForm == null ? void 0 : activeForm.serviceAgreementType)) && !(activeForm == null ? void 0 : activeForm.acceptanceId);
34468
34589
  const showSignedAlert = !!(activeForm == null ? void 0 : activeForm.acceptanceId);
34590
+ const homeButtonLabel = i18n.get("goToOverview");
34591
+ const nextButtonLabel = i18n.get(canSign ? "sign" : "next");
34469
34592
  const handleServiceAgreementIsNotAvailableInThatLanguage = useCallback(() => {
34470
34593
  showToast({
34471
34594
  label: i18n.get("failedToGetServiceAgreementInSelectedLanguageFallbackToEn"),
@@ -34506,7 +34629,12 @@ function ServiceAgreementDropinComponent({
34506
34629
  };
34507
34630
  const signers = getSigners();
34508
34631
  const handleSignClick = async () => {
34509
- userEvents.addEvent("Clicked ToS signing", { segmentation: { ...baseTrackingPayload } });
34632
+ const baseTracking = {
34633
+ ...baseTrackingPayload,
34634
+ actionLevel: "task",
34635
+ actionType: "sign"
34636
+ };
34637
+ userEvents.addEvent("Clicked button", { ...baseTracking, label: nextButtonLabel });
34510
34638
  triggerValidation();
34511
34639
  if (loadingStatus === "loading" || !serviceAgreement || !data.signer) return;
34512
34640
  if (isValid) {
@@ -34518,35 +34646,41 @@ function ServiceAgreementDropinComponent({
34518
34646
  label: i18n.get("serviceAgreementSignedSuccessfully"),
34519
34647
  type: "success"
34520
34648
  });
34521
- userEvents.addEvent("Succeeded ToS signing", { segmentation: { ...baseTrackingPayload } });
34649
+ userEvents.addEvent("Success", baseTracking);
34522
34650
  data.acceptServiceAgreement = false;
34523
34651
  data.signer = void 0;
34524
- } catch {
34652
+ } catch (e) {
34525
34653
  setLoadingStatus("success");
34526
34654
  showToast({ label: i18n.get("serviceAgreementSignFailed"), type: "error" });
34527
- userEvents.addEvent("Failed ToS signing", { segmentation: { ...baseTrackingPayload } });
34655
+ userEvents.addEvent("Encountered error", {
34656
+ ...baseTracking,
34657
+ returnType: (e == null ? void 0 : e.errorCode) || "backend",
34658
+ returnValue: (e == null ? void 0 : e.title) ?? (e == null ? void 0 : e.message)
34659
+ });
34528
34660
  }
34529
34661
  } else {
34530
- userEvents.addEvent("Encountered ToS validation error", {
34531
- segmentation: {
34532
- ...baseTrackingPayload,
34533
- fields: Object.entries(valid).filter(([, value]) => !value).map(([key]) => key)
34534
- }
34662
+ userEvents.addEvent("Encountered error", {
34663
+ ...baseTracking,
34664
+ returnType: "validation",
34665
+ returnValue: Object.entries(valid).filter(([, value]) => !value).map(([key]) => key)
34535
34666
  });
34536
34667
  }
34537
34668
  };
34538
34669
  const goHome = () => {
34539
- userEvents.addEvent("Returned to task overview from ToS", {
34540
- segmentation: { ...baseTrackingPayload }
34670
+ userEvents.addEvent("Clicked button", {
34671
+ ...baseTrackingPayload,
34672
+ actionLevel: "task",
34673
+ actionType: "back",
34674
+ label: homeButtonLabel
34541
34675
  });
34542
34676
  handleHomeClick();
34543
34677
  };
34544
34678
  const handleExpandSection = (title) => {
34545
- userEvents.addEvent("Expanded ToS section", {
34546
- segmentation: {
34547
- ...baseTrackingPayload,
34548
- statementExtended: title
34549
- }
34679
+ userEvents.addEvent("Clicked accordion", {
34680
+ ...baseTrackingPayload,
34681
+ actionLevel: "task",
34682
+ actionType: "open",
34683
+ label: title
34550
34684
  });
34551
34685
  };
34552
34686
  useEffect(() => {
@@ -34554,9 +34688,10 @@ function ServiceAgreementDropinComponent({
34554
34688
  gotoForm(serviceAgreementAcceptanceInfos.length - 1);
34555
34689
  }, [serviceAgreementAcceptanceInfos]);
34556
34690
  useEffect(() => {
34557
- userEvents.addPageView("ToS dropin");
34558
- userEvents.addEvent("Started ToS task", {
34559
- segmentation: { ...baseTrackingPayload }
34691
+ userEvents.addEvent("Landed on page", {
34692
+ ...baseTrackingPayload,
34693
+ actionLevel: "task",
34694
+ actionType: "start"
34560
34695
  });
34561
34696
  const initialFormIndex = forms.length === signedForms.length ? 0 : signedForms.length;
34562
34697
  gotoForm(initialFormIndex);
@@ -34745,9 +34880,9 @@ function ServiceAgreementDropinComponent({
34745
34880
  ActionBar,
34746
34881
  {
34747
34882
  onHome: goHome,
34748
- homeButtonLabel: i18n.get("goToOverview"),
34883
+ homeButtonLabel,
34749
34884
  onNext: canSign ? handleSignClick : () => gotoForm(activeFormIndex + 1),
34750
- nextButtonLabel: i18n.get(canSign ? "sign" : "next"),
34885
+ nextButtonLabel,
34751
34886
  nextButtonDisabled: forms.length === 0 || !canSign && activeFormIndex === forms.length - 1,
34752
34887
  onBack: () => gotoForm(activeFormIndex - 1),
34753
34888
  hideBackButton: activeFormIndex === 0,
@@ -35106,7 +35241,11 @@ function SolePropDropinComponent({
35106
35241
  );
35107
35242
  }
35108
35243
  const COUNTRIES_THAT_USE_REGISTRATION_NUMBER = [CountryCodes.NewZealand];
35109
- const rules = ({ data, country }) => ({
35244
+ const rules = ({
35245
+ data,
35246
+ country,
35247
+ isExperimentEnabled = () => false
35248
+ }) => ({
35110
35249
  countryUsesTaxId: () => {
35111
35250
  if (country !== CountryCodes.NewZealand && COUNTRIES_THAT_USE_TAX_ID_INSTEAD_OF_VAT.includes(country)) {
35112
35251
  return "REQUIRED";
@@ -35122,6 +35261,11 @@ const rules = ({ data, country }) => ({
35122
35261
  if (((_a = data == null ? void 0 : data.trustRegistrationDetails) == null ? void 0 : _a.trustType) === TrustTypes.CHARITABLE_TRUST) {
35123
35262
  return "REQUIRED";
35124
35263
  }
35264
+ },
35265
+ isLemApiVersionV4Enabled: () => {
35266
+ if (isExperimentEnabled("EnableLemApiVersionV4")) {
35267
+ return "REQUIRED";
35268
+ }
35125
35269
  }
35126
35270
  });
35127
35271
  const parseConfiguration$1 = ({ matchingScenario, country }) => parseTrustScenarios(matchingScenario == null ? void 0 : matchingScenario[LegalEntityType.TRUST], country);
@@ -35761,6 +35905,13 @@ function DropinComposerComponent({
35761
35905
  const refreshLegalEntity = useCallback(async () => {
35762
35906
  const legalEntity = await retrieveLegalEntity();
35763
35907
  updateLegalEntityAndCapabilityProblems(legalEntity);
35908
+ if (legalEntity) {
35909
+ userEvents.updateBaseTrackingPayload({
35910
+ legalEntityId: legalEntity.id,
35911
+ capabilities: Object.keys(legalEntity.capabilities),
35912
+ countryCode: getLegalEntityCountry(legalEntity)
35913
+ });
35914
+ }
35764
35915
  return legalEntity;
35765
35916
  }, [retrieveLegalEntity, updateLegalEntityAndCapabilityProblems]);
35766
35917
  const deleteTransferInstrument = async (id) => {
@@ -36030,13 +36181,6 @@ function DropinComposerComponent({
36030
36181
  await componentOnSubmit(data, backSteps);
36031
36182
  };
36032
36183
  const onPciDownload = async () => {
36033
- const baseTrackingPayload = getBaseTrackingPayload({
36034
- trackingConfig: {
36035
- topLevelLegalEntity: legalEntityResponse
36036
- },
36037
- legalEntity: rootLegalEntity,
36038
- task: TaskTypes.PCI_DSS
36039
- });
36040
36184
  try {
36041
36185
  const response = await (args == null ? void 0 : args.handleGetPciQuestionnaires(rootLegalEntity.id));
36042
36186
  await Promise.all(
@@ -36051,13 +36195,30 @@ function DropinComposerComponent({
36051
36195
  } catch (e) {
36052
36196
  showToast({ label: i18n.get("failedToDownloadPci"), type: "error" });
36053
36197
  } finally {
36054
- userEvents.addEvent("Downloaded signed PCI form", {
36055
- segmentation: { ...baseTrackingPayload }
36198
+ userEvents.addEvent("Clicked button", {
36199
+ ...getBaseTrackingPayload({
36200
+ trackingConfig: {
36201
+ topLevelLegalEntity: legalEntityResponse
36202
+ },
36203
+ legalEntity: rootLegalEntity,
36204
+ task: TaskTypes.PCI_DSS
36205
+ }),
36206
+ actionLevel: "task",
36207
+ actionType: "download"
36056
36208
  });
36057
36209
  }
36058
36210
  };
36059
36211
  useEffect(() => {
36060
- userEvents.addPageView("Task list");
36212
+ userEvents.addEvent("Landed on page", {
36213
+ ...getBaseTrackingPayload({
36214
+ trackingConfig: {
36215
+ topLevelLegalEntity: rootLegalEntity
36216
+ },
36217
+ task: TaskTypes.TASKS_OVERVIEW
36218
+ }),
36219
+ actionLevel: "journey",
36220
+ actionType: "start"
36221
+ });
36061
36222
  }, []);
36062
36223
  useLayoutEffect(() => {
36063
36224
  const fetchConfiguration = async () => {
@@ -36148,8 +36309,7 @@ function DropinComposerComponent({
36148
36309
  await refreshLegalEntity();
36149
36310
  navigateTo("default");
36150
36311
  },
36151
- onBack: previousTask ? navigateBack : void 0,
36152
- trackingConfig: { topLevelLegalEntity: legalEntityResponse }
36312
+ onBack: previousTask ? navigateBack : void 0
36153
36313
  }
36154
36314
  ) });
36155
36315
  case TaskTypes.SINGPASS_SELECTION:
@@ -39066,15 +39226,13 @@ const pushEvents = async (loadingContext, sessionId, event) => httpPost(
39066
39226
  },
39067
39227
  event
39068
39228
  );
39069
- const convertToEmbeddedEvent = (eventQueueItem) => {
39070
- const [eventType, event] = eventQueueItem;
39071
- const isObject = typeof event === "object";
39072
- const eventName = isObject ? event.key : event;
39073
- const eventData = isObject ? event.segmentation : {};
39229
+ const convertToEmbeddedEvent = (eventQueueItem, sessionData) => {
39230
+ const { type, name, properties } = eventQueueItem;
39074
39231
  return {
39075
- eventType,
39076
- eventName,
39077
- eventData: eventData ?? {}
39232
+ eventName: name,
39233
+ eventType: type,
39234
+ eventData: properties || {},
39235
+ ...sessionData
39078
39236
  };
39079
39237
  };
39080
39238
  const useAnalytics = async ({
@@ -39086,30 +39244,33 @@ const useAnalytics = async ({
39086
39244
  const { i18n } = useI18nContext();
39087
39245
  const { isEmbeddedDropin, loadingContext: base } = useAuthContext();
39088
39246
  const loadingContext = `${base}api/${COMPONENTS_API_VERSION}/`;
39089
- if (isEmbeddedDropin) {
39090
- try {
39091
- const sessionResponse = await getAnalyticsSession(loadingContext, {
39092
- sdkVersion,
39093
- componentName,
39094
- userAgent: navigator.userAgent,
39095
- legalEntityId
39096
- });
39097
- if (!(sessionResponse == null ? void 0 : sessionResponse.id)) {
39098
- throw Error("Analytics session Id not received");
39247
+ (async () => {
39248
+ if (isEmbeddedDropin) {
39249
+ try {
39250
+ const sessionData = {
39251
+ sdkVersion,
39252
+ componentName,
39253
+ userAgent: navigator.userAgent,
39254
+ legalEntityId
39255
+ };
39256
+ const sessionResponse = await getAnalyticsSession(loadingContext, sessionData);
39257
+ if (!(sessionResponse == null ? void 0 : sessionResponse.id)) {
39258
+ throw Error("Analytics session Id not received");
39259
+ }
39260
+ userEvents.subscribe((data) => {
39261
+ const eventItem = convertToEmbeddedEvent(data, sessionData);
39262
+ if (eventItem.eventData) {
39263
+ eventItem.eventData.locale = i18n.locale;
39264
+ }
39265
+ pushEvents(loadingContext, sessionResponse.id, eventItem);
39266
+ });
39267
+ } catch (e) {
39268
+ console.error("Failed to initiate analytics for component", e);
39099
39269
  }
39100
- userEvents.subscribe((data) => {
39101
- const eventItem = convertToEmbeddedEvent(data);
39102
- if (eventItem.eventData) {
39103
- eventItem.eventData.locale = i18n.locale;
39104
- }
39105
- pushEvents(loadingContext, sessionResponse.id, eventItem);
39106
- });
39107
- } catch (e) {
39108
- console.error("Failed to initiate analytics for component", e);
39270
+ } else if (onUserEvent) {
39271
+ userEvents.subscribe(onUserEvent);
39109
39272
  }
39110
- } else if (onUserEvent) {
39111
- userEvents.subscribe(onUserEvent);
39112
- }
39273
+ })();
39113
39274
  };
39114
39275
  const logger$8 = createLogger("loadCountries");
39115
39276
  const countriesImports = /* @__PURE__ */ Object.assign({ "./de-DE.json": () => import("./de-DE-Cx8Uim1K.js"), "./el-GR.json": () => import("./el-GR-B7_JR3z5.js"), "./en-US.json": () => import("./en-US-CkdCbOCX.js"), "./es-ES.json": () => import("./es-ES-NBv3HHhn.js"), "./fr-FR.json": () => import("./fr-FR-DdSVMVsp.js"), "./it-IT.json": () => import("./it-IT-Bwdk3zuj.js"), "./ja-JP.json": () => import("./ja-JP-Bsvzm8zu.js"), "./nl-NL.json": () => import("./nl-NL-DofKaNkk.js"), "./pt-PT.json": () => import("./pt-PT-DFEvMD1M.js"), "./ru-RU.json": () => import("./ru-RU-PiM0ZI5h.js"), "./sv-SE.json": () => import("./sv-SE-C0GoLwTg.js"), "./zh-CN.json": () => import("./zh-CN-DJs6Hct-.js"), "./zh-TW.json": () => import("./zh-TW-BWhLbns8.js") });
@@ -39405,7 +39566,7 @@ const ConfigurationApiProvider = ({
39405
39566
  }) => {
39406
39567
  const authContext = useAuthContext();
39407
39568
  const { isEmbeddedDropin, loadingContext } = authContext;
39408
- const sdkVersion = "2.59.11";
39569
+ const sdkVersion = "2.60.0";
39409
39570
  useAnalytics({
39410
39571
  onUserEvent,
39411
39572
  legalEntityId: rootLegalEntityId,
@@ -40078,7 +40239,7 @@ const DebugModal = ({ rootLegalEntityId, onExit, getRootLegalEntity }) => {
40078
40239
  };
40079
40240
  const copyToClipboard = async () => {
40080
40241
  const toCopy = {
40081
- sdkVersion: "2.59.11",
40242
+ sdkVersion: "2.60.0",
40082
40243
  experiments: Object.fromEntries(allExperimentsWithValues),
40083
40244
  settings: Object.fromEntries(allSettingsWithValues)
40084
40245
  };
@@ -40143,7 +40304,7 @@ const DebugModal = ({ rootLegalEntityId, onExit, getRootLegalEntity }) => {
40143
40304
  /* @__PURE__ */ jsx("div", { className: "adyen-kyc-debug-modal__meta", children: /* @__PURE__ */ jsx("table", { children: /* @__PURE__ */ jsxs("tbody", { children: [
40144
40305
  /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsxs("td", { children: [
40145
40306
  /* @__PURE__ */ jsx("span", { className: "adyen-kyc-debug-modal__table-key", children: "SDK version" }),
40146
- /* @__PURE__ */ jsx(Tag, { variant: "green", className: "adyen-kyc-tag--large", children: "2.59.11" })
40307
+ /* @__PURE__ */ jsx(Tag, { variant: "green", className: "adyen-kyc-tag--large", children: "2.60.0" })
40147
40308
  ] }) }),
40148
40309
  /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsxs("td", { children: [
40149
40310
  /* @__PURE__ */ jsx("span", { className: "adyen-kyc-debug-modal__table-key", children: "rootLegalEntityId" }),
@@ -40263,6 +40424,20 @@ const getRootLegalEntityId = (componentProps) => {
40263
40424
  if ("legalEntityResponse" in componentProps) return componentProps.legalEntityResponse.id;
40264
40425
  throw new Error("You must provide either `legalEntityId` or `legalEntityResponse`");
40265
40426
  };
40427
+ const getBaseTracking = (componentProps) => {
40428
+ if ("legalEntityResponse" in componentProps) {
40429
+ const { legalEntityResponse } = componentProps;
40430
+ return {
40431
+ entityType: legalEntityResponse.type,
40432
+ legalEntityId: legalEntityResponse.id,
40433
+ capabilities: Object.keys(legalEntityResponse.capabilities || {}),
40434
+ countryCode: getLegalEntityCountry(legalEntityResponse)
40435
+ };
40436
+ }
40437
+ return {
40438
+ legalEntityId: componentProps.legalEntityId
40439
+ };
40440
+ };
40266
40441
  class UIElement extends BaseElement {
40267
40442
  constructor() {
40268
40443
  super(...arguments);
@@ -40271,6 +40446,10 @@ class UIElement extends BaseElement {
40271
40446
  const rootLegalEntityId = getRootLegalEntityId(
40272
40447
  this.props.componentProps
40273
40448
  );
40449
+ const baseTracking = getBaseTracking(
40450
+ this.props.componentProps
40451
+ );
40452
+ userEvents.updateBaseTrackingPayload(baseTracking);
40274
40453
  return /* @__PURE__ */ jsx(SettingsProvider, { settings: this.props.settings, children: /* @__PURE__ */ jsx(
40275
40454
  AuthProvider,
40276
40455
  {