@adyen/kyc-components 2.59.10 → 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 +774 -589
  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" },
@@ -24471,47 +24716,6 @@ const isFieldRequiredToRemediateDataMissingError = (formId, field, dataMissingEr
24471
24716
  const getFormTrustedFields = (formId, trustedFields) => trustedFields.filter((field) => field.split(".")[0] === formId).map(
24472
24717
  (field) => field.split(".").filter((item) => formId !== item).join(".")
24473
24718
  );
24474
- function getBaseTrackingPayload({
24475
- trackingConfig = {
24476
- topLevelLegalEntity: {}
24477
- },
24478
- parentLegalEntity,
24479
- legalEntity,
24480
- task
24481
- }) {
24482
- const { topLevelLegalEntity } = trackingConfig;
24483
- const baseTrackingPayload = {
24484
- task,
24485
- flow: topLevelLegalEntity == null ? void 0 : topLevelLegalEntity.type,
24486
- topLevelLegalEntityId: topLevelLegalEntity.id,
24487
- topLevelLegalEntityType: topLevelLegalEntity.type
24488
- };
24489
- if (parentLegalEntity) {
24490
- baseTrackingPayload.parentLegalEntityId = parentLegalEntity.id;
24491
- baseTrackingPayload.parentLegalEntityType = parentLegalEntity.type;
24492
- }
24493
- if (legalEntity) {
24494
- baseTrackingPayload.legalEntityId = legalEntity.id;
24495
- baseTrackingPayload.legalEntityType = legalEntity.type;
24496
- }
24497
- return baseTrackingPayload;
24498
- }
24499
- const removeOldDataBySchema = (dataSubmitted, savedLegalEntityData) => {
24500
- Object.keys(savedLegalEntityData).forEach((formId) => {
24501
- if (savedLegalEntityData[formId]) {
24502
- Object.keys(savedLegalEntityData[formId]).forEach((key) => {
24503
- if (dataSubmitted[formId][key] === void 0) {
24504
- if (Array.isArray(savedLegalEntityData[formId][key])) {
24505
- dataSubmitted[formId][key] = [];
24506
- } else {
24507
- dataSubmitted[formId][key] = "";
24508
- }
24509
- }
24510
- });
24511
- }
24512
- });
24513
- return dataSubmitted;
24514
- };
24515
24719
  const getRequiredForms = (forms, requiredFields, optionalFields) => {
24516
24720
  const requiredForms = Object.values(forms).filter(({ formId }) => {
24517
24721
  if (requiredFields || optionalFields) {
@@ -24579,82 +24783,6 @@ const getFieldsWithExistingData = (legalEntity, isExperimentEnabled) => {
24579
24783
  }
24580
24784
  return nonDocumentFields;
24581
24785
  };
24582
- const DBA_NAME_FIELD = ["hasDba", "dbaName"];
24583
- function DBANameField({
24584
- data,
24585
- valid,
24586
- errors,
24587
- labels: labels2,
24588
- helperText,
24589
- readonly,
24590
- handleChangeFor,
24591
- setErrors
24592
- }) {
24593
- const { i18n } = useI18nContext();
24594
- const selection = useMemo(() => {
24595
- if (typeof data.hasDba === "undefined") return;
24596
- if (!data.hasDba) setErrors == null ? void 0 : setErrors("dbaName", null);
24597
- return data.hasDba ? "yes" : "no";
24598
- }, [data.hasDba, setErrors]);
24599
- return /* @__PURE__ */ jsxs(Fragment, { children: [
24600
- /* @__PURE__ */ jsx(
24601
- Field,
24602
- {
24603
- name: "hasDba",
24604
- label: labels2.hasDba ?? i18n.get("hasDba"),
24605
- helper: (helperText == null ? void 0 : helperText.hasDba) ?? i18n.get("hasDba__helperText"),
24606
- isValid: valid.hasDba,
24607
- errorMessage: errors.hasDba,
24608
- children: (childProps) => /* @__PURE__ */ jsx(
24609
- RadioGroup,
24610
- {
24611
- ...childProps,
24612
- name: "hasDba",
24613
- items: [
24614
- { id: "yes", name: "yes" },
24615
- { id: "no", name: "no" }
24616
- ],
24617
- value: selection,
24618
- onChange: (newValue) => handleChangeFor("hasDba")(newValue === "yes"),
24619
- horizontal: true
24620
- }
24621
- )
24622
- }
24623
- ),
24624
- data.hasDba && /* @__PURE__ */ jsx(
24625
- Field,
24626
- {
24627
- name: "dbaName",
24628
- label: labels2.dbaName ?? i18n.get("dbaName"),
24629
- errorMessage: errors.dbaName,
24630
- isValid: valid.dbaName,
24631
- classNameModifiers: ["dbaName"],
24632
- children: (childProps) => /* @__PURE__ */ jsx(
24633
- InputText,
24634
- {
24635
- ...childProps,
24636
- "aria-required": true,
24637
- "aria-label": labels2.dbaName ?? i18n.get("dbaName"),
24638
- "aria-invalid": !valid.dbaName,
24639
- name: "dbaName",
24640
- value: data.dbaName,
24641
- readonly,
24642
- classNameModifiers: ["dbaName"],
24643
- onInput: handleChangeFor("dbaName", "input"),
24644
- onBlur: handleChangeFor("dbaName", "blur")
24645
- }
24646
- )
24647
- }
24648
- )
24649
- ] });
24650
- }
24651
- const hasDbaFieldMetadata = {
24652
- validators: [validateNotEmptyOnBlur]
24653
- };
24654
- const dbaNameFieldMetadata = {
24655
- label: "dbaName",
24656
- validators: [validateNotEmptyOnBlur]
24657
- };
24658
24786
  const getNestedTrustedFields = (field, data, trustedFields) => {
24659
24787
  if (trustedFields && (data == null ? void 0 : data[field]) && typeof data[field] === "object") {
24660
24788
  return trustedFields.reduce((fields, trustedField) => {
@@ -24813,7 +24941,7 @@ function AdditionalInformationComponent({
24813
24941
  handleAddressSearch,
24814
24942
  handleFindAddress
24815
24943
  }) {
24816
- var _a, _b, _c, _d, _e;
24944
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
24817
24945
  const { basicInformation } = useGlobalData();
24818
24946
  const { updateStateSlice } = useGlobalDataSlice(ADDITIONAL_INFORMATION_FORM_ID);
24819
24947
  const { i18n } = useI18nContext();
@@ -25010,7 +25138,6 @@ function AdditionalInformationComponent({
25010
25138
  fieldProblems: formFieldProblems,
25011
25139
  handleChangeFor,
25012
25140
  resetToDefaultData,
25013
- setData,
25014
25141
  setErrors,
25015
25142
  setValid
25016
25143
  } = useForm({
@@ -25078,7 +25205,6 @@ function AdditionalInformationComponent({
25078
25205
  operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME
25079
25206
  );
25080
25207
  setValid("operationalAddress", true);
25081
- setData("operationalAddress", mergedDefaultData == null ? void 0 : mergedDefaultData.operationalAddress);
25082
25208
  } else {
25083
25209
  handleChangeFor("operationalAddressIsSame")(
25084
25210
  operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME
@@ -25322,9 +25448,11 @@ function AdditionalInformationComponent({
25322
25448
  {
25323
25449
  id: ADDITIONAL_INFORMATION_FORM_ID,
25324
25450
  addressType: "registrationAddress",
25325
- data: { ...mergedDefaultData == null ? void 0 : mergedDefaultData.registrationAddress, country },
25326
- labels: getAddressSchemaLabelsByCountry(country),
25327
- 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),
25328
25456
  requiredFields: addressSchema,
25329
25457
  shouldValidate,
25330
25458
  hideCountry: true,
@@ -25372,9 +25500,11 @@ function AdditionalInformationComponent({
25372
25500
  {
25373
25501
  id: ADDITIONAL_INFORMATION_FORM_ID,
25374
25502
  addressType: "operationalAddress",
25375
- data: { ...mergedDefaultData == null ? void 0 : mergedDefaultData.operationalAddress, country },
25376
- labels: getAddressSchemaLabelsByCountry(country),
25377
- 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),
25378
25508
  requiredFields: addressSchema,
25379
25509
  shouldValidate,
25380
25510
  hideCountry: true,
@@ -26318,11 +26448,14 @@ const mapBasicInformation = (data) => {
26318
26448
  }, {});
26319
26449
  };
26320
26450
  const mapAdditionalInformation = (data, legalEntity) => {
26321
- var _a, _b, _c, _d, _e;
26451
+ var _a, _b, _c, _d, _e, _f, _g;
26322
26452
  if (!data) return;
26323
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 } : {};
26324
26454
  const currentCountry = (_d = legalEntity.organization) == null ? void 0 : _d.registeredAddress.country;
26325
- 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;
26326
26459
  return entriesOf(data).reduce(
26327
26460
  (acc, [field]) => {
26328
26461
  if (!COUNTRIES_USING_COMPANY_SEARCH.includes(currentCountry)) {
@@ -27402,7 +27535,11 @@ function FormNavigation({
27402
27535
  const goToForm = (form) => () => {
27403
27536
  if (form.formId === activeForm.formId) return;
27404
27537
  gotoForm(getFormIndex(form));
27405
- trackNavigation2({ fromForm: form, toForm: activeForm, component: "FormNavigation" });
27538
+ trackNavigation2({
27539
+ fromForm: form.formName,
27540
+ toForm: activeForm.formName,
27541
+ component: "FormNavigation"
27542
+ });
27406
27543
  };
27407
27544
  const getNavigateHandler = (form, activeForm2) => {
27408
27545
  const priorForms = forms.slice(0, getFormIndex(form));
@@ -27602,20 +27739,6 @@ const FormWrapper = ({
27602
27739
  }
27603
27740
  );
27604
27741
  };
27605
- var BusinessDetailsEvents = /* @__PURE__ */ ((BusinessDetailsEvents2) => {
27606
- BusinessDetailsEvents2["TASK_START"] = "BusinessDetails_TaskStarted";
27607
- BusinessDetailsEvents2["TASK_SUBMIT"] = "BusinessDetails_TaskSubmitted";
27608
- BusinessDetailsEvents2["TASK_SAVED"] = "BusinessDetails_TaskSaved";
27609
- BusinessDetailsEvents2["TASK_ERROR"] = "BusinessDetails_TaskError";
27610
- BusinessDetailsEvents2["DOCUMENTS_SAVED"] = "BusinessDetails_DocumentsSaved";
27611
- BusinessDetailsEvents2["DOCUMENTS_ERROR"] = "BusinessDetails_DocumentsError";
27612
- BusinessDetailsEvents2["NO_SEARCH_RESULTS"] = "BusinessDetails_NoSearchResults";
27613
- BusinessDetailsEvents2["TIN_MATCH"] = "BusinessDetails_TinMatch";
27614
- BusinessDetailsEvents2["TIN_NO_MATCH"] = "BusinessDetails_TinNoMatch";
27615
- BusinessDetailsEvents2["SELECTION_RESET"] = "BusinessDetails_CompanySelectionReset";
27616
- BusinessDetailsEvents2["SELECTION_ERROR"] = "BusinessDetails_CompanySelectionError";
27617
- return BusinessDetailsEvents2;
27618
- })(BusinessDetailsEvents || {});
27619
27742
  const isMaintenanceModeError = (error) => error && "messageCode" in error && error.messageCode === "maintenanceMode";
27620
27743
  const API_VALIDATION_ERROR_CODE = "30_102";
27621
27744
  const ID_DOCUMENT_UPLOAD_ERROR_CODE = "30_105";
@@ -27678,7 +27801,7 @@ const mapBusinessDetailsDocumentToApiDocument = async (data, entityId) => {
27678
27801
  return documents.filter(Boolean);
27679
27802
  };
27680
27803
  const mapBusinessDetailsSchemaToLegalEntity = (data) => {
27681
- 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;
27682
27805
  const requestObj = {
27683
27806
  ...formatObject(data, businessDetailsApiKeyMapping)
27684
27807
  };
@@ -27703,9 +27826,12 @@ const mapBusinessDetailsSchemaToLegalEntity = (data) => {
27703
27826
  if (dbaName) {
27704
27827
  requestObj.organization.doingBusinessAs = dbaName;
27705
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
+ }
27706
27832
  }
27707
27833
  requestObj.type = LegalEntityType.ORGANIZATION;
27708
- if (((_o = requestObj.organization) == null ? void 0 : _o.registeredAddress.country) === "US") {
27834
+ if (((_p = requestObj.organization) == null ? void 0 : _p.registeredAddress.country) === "US") {
27709
27835
  delete requestObj.organization.registrationNumber;
27710
27836
  }
27711
27837
  return requestObj;
@@ -27748,7 +27874,7 @@ const formatBasicInformation = (data, labels2, datasetUtils, companyType) => {
27748
27874
  [registrationNumberLabel]: data.registrationNumber
27749
27875
  };
27750
27876
  };
27751
- const formatAdditionalInformation = (data, labels2, country, companyType) => {
27877
+ const formatAdditionalInformation = (data, labels2, country, companyType, i18n) => {
27752
27878
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
27753
27879
  const registrationNumberLabel = resolveFieldMetadata(
27754
27880
  defaultFieldConfig$9[country],
@@ -27773,7 +27899,7 @@ const formatAdditionalInformation = (data, labels2, country, companyType) => {
27773
27899
  [registrationNumberLabel]: data.registrationNumber,
27774
27900
  [taxIdLabel]: (_e = (_d = data.taxInformation) == null ? void 0 : _d.find((taxId) => country === taxId.country)) == null ? void 0 : _e.number,
27775
27901
  [((_f = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _f.vatNumber) ?? "vatNumber"]: data.vatNumber,
27776
- [((_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,
27777
27903
  [((_h = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _h.dateOfIncorporation) ?? "dateOfIncorporation"]: data.dateOfIncorporation,
27778
27904
  [((_i = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _i.stockExchangeMIC) ?? "stockExchangeMIC"]: data.stockExchangeMIC,
27779
27905
  [((_j = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _j.stockISIN) ?? "stockISIN"]: data.stockISIN,
@@ -27817,13 +27943,11 @@ const formatDataForSummary = (data, forms, labels2, i18n) => {
27817
27943
  data[form],
27818
27944
  labels2,
27819
27945
  (_c = data.basicInformation) == null ? void 0 : _c.country,
27820
- (_d = data.companyStructure) == null ? void 0 : _d.entityType
27821
- ),
27822
- registrationAddress: mapAddressLabels(
27823
- data[form].registrationAddress,
27824
- datasetUtils
27946
+ (_d = data.companyStructure) == null ? void 0 : _d.entityType,
27947
+ i18n
27825
27948
  ),
27826
- 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
27827
27951
  }
27828
27952
  };
27829
27953
  case "companyRegistrationDocument":
@@ -27866,24 +27990,23 @@ async function submitDocuments({
27866
27990
  await documentUtils.uploadDocuments(formattedDocument, legalEntity.id);
27867
27991
  formattedDocument.forEach((doc) => {
27868
27992
  var _a;
27869
- userEvents.addEvent(BusinessDetailsEvents.DOCUMENTS_SAVED, {
27870
- segmentation: {
27871
- ...baseTrackingPayload,
27872
- documentType: doc.type,
27873
- fileExtention: ((_a = doc.attachments) == null ? void 0 : _a.map((item) => getFileExtention(item.pageName))) ?? []
27874
- }
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))) ?? []
27875
27999
  });
27876
28000
  });
27877
28001
  }
27878
28002
  } catch (err) {
27879
28003
  logger2.error(err);
27880
- userEvents.addEvent(BusinessDetailsEvents.DOCUMENTS_ERROR, {
27881
- segmentation: {
27882
- ...baseTrackingPayload,
27883
- errorCode: err.errorCode,
27884
- errorMessage: err.title ?? err.message,
27885
- errorType: "BE"
27886
- }
28004
+ userEvents.addEvent("Encountered error", {
28005
+ ...baseTrackingPayload,
28006
+ actionLevel: "task",
28007
+ actionType: "upload",
28008
+ returnType: err.errorCode,
28009
+ returnValue: err.title ?? err.message
27887
28010
  });
27888
28011
  }
27889
28012
  }
@@ -27907,6 +28030,9 @@ async function submit({
27907
28030
  const logger2 = createLogger("submitBusinessDetails");
27908
28031
  setLoadingStatus("loading");
27909
28032
  const trackingPayload = {
28033
+ ...baseTrackingPayload,
28034
+ actionLevel: "task",
28035
+ actionType: "submit",
27910
28036
  companyStructure: ((_a = data.companyStructure) == null ? void 0 : _a.entityType) ?? null,
27911
28037
  countryOfRegistration: ((_b = data.basicInformation) == null ? void 0 : _b.country) ?? null,
27912
28038
  legalEntityName: ((_c = data.additionalInformation) == null ? void 0 : _c.legalCompanyName) ?? null,
@@ -27923,12 +28049,7 @@ async function submit({
27923
28049
  )
27924
28050
  };
27925
28051
  try {
27926
- userEvents.addEvent(BusinessDetailsEvents.TASK_SUBMIT, {
27927
- segmentation: {
27928
- ...baseTrackingPayload,
27929
- ...trackingPayload
27930
- }
27931
- });
28052
+ userEvents.addEvent("Clicked button", trackingPayload);
27932
28053
  await Promise.all([
27933
28054
  handleUpdateLegalEntity(drop("type").from(legalEntity), legalEntityResponse.id),
27934
28055
  submitDocuments({
@@ -27943,14 +28064,7 @@ async function submit({
27943
28064
  forms
27944
28065
  })
27945
28066
  ]);
27946
- userEvents.addEvent(BusinessDetailsEvents.TASK_SAVED, {
27947
- segmentation: {
27948
- ...baseTrackingPayload,
27949
- legalEntityId: legalEntity.id,
27950
- legalEntityType: legalEntity.type,
27951
- ...trackingPayload
27952
- }
27953
- });
28067
+ userEvents.addEvent("Success", trackingPayload);
27954
28068
  clearToasts();
27955
28069
  onExternalSubmit == null ? void 0 : onExternalSubmit(data);
27956
28070
  } catch (err) {
@@ -27972,13 +28086,10 @@ async function submit({
27972
28086
  showToast({ label: i18n.get("failedToUpdateDetails"), type: "error" });
27973
28087
  }
27974
28088
  logger2.error(err);
27975
- userEvents.addEvent(BusinessDetailsEvents.TASK_ERROR, {
27976
- segmentation: {
27977
- ...baseTrackingPayload,
27978
- errorCode: err.errorCode,
27979
- errorMessage: err.title,
27980
- errorType: "BE"
27981
- }
28089
+ userEvents.addEvent("Encountered error", {
28090
+ ...trackingPayload,
28091
+ returnType: err == null ? void 0 : err.errorCode,
28092
+ returnValue: (err == null ? void 0 : err.title) || "backend"
27982
28093
  });
27983
28094
  } finally {
27984
28095
  setLoadingStatus("success");
@@ -28020,14 +28131,15 @@ function BusinessDetailsDropinComponent({
28020
28131
  onChange == null ? void 0 : onChange(currentState);
28021
28132
  }, [currentState, onChange]);
28022
28133
  useEffect(() => {
28023
- userEvents.addPageView("Business details dropin");
28024
- userEvents.addEvent(BusinessDetailsEvents.TASK_START, {
28025
- segmentation: getBaseTrackingPayload({
28134
+ userEvents.addEvent("Landed on page", {
28135
+ ...getBaseTrackingPayload({
28026
28136
  trackingConfig,
28027
28137
  parentLegalEntity,
28028
28138
  legalEntity: legalEntityResponse,
28029
28139
  task: taskType
28030
- })
28140
+ }),
28141
+ actionLevel: "task",
28142
+ actionType: "start"
28031
28143
  });
28032
28144
  }, []);
28033
28145
  const formRef = useRef(null);
@@ -28582,9 +28694,10 @@ function CompanyDropinComponent({
28582
28694
  task: taskType
28583
28695
  });
28584
28696
  useEffect(() => {
28585
- userEvents.addPageView("Company dropin");
28586
- userEvents.addEvent("Started company task", {
28587
- segmentation: baseTrackingPayload
28697
+ userEvents.addEvent("Landed on page", {
28698
+ ...baseTrackingPayload,
28699
+ actionLevel: "task",
28700
+ actionType: "start"
28588
28701
  });
28589
28702
  }, []);
28590
28703
  const getConfigurationData = useCallback(
@@ -28666,12 +28779,12 @@ function CompanyDropinComponent({
28666
28779
  if (formattedDocument) {
28667
28780
  await documentUtils.uploadDocuments(formattedDocument, legalEntity.id);
28668
28781
  formattedDocument.forEach((doc) => {
28669
- userEvents.addEvent("Saved document", {
28670
- segmentation: {
28671
- ...baseTrackingPayload,
28672
- documentType: doc.type,
28673
- fileExtention: doc.attachments.map((item) => getFileExtention(item.pageName))
28674
- }
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))
28675
28788
  });
28676
28789
  });
28677
28790
  }
@@ -28704,9 +28817,11 @@ function CompanyDropinComponent({
28704
28817
  let legalEntity = mapCompanyToLegalEntity(filteredData);
28705
28818
  setLoadingStatus("loading");
28706
28819
  const companyTrackingPayload = {
28820
+ actionLevel: "task",
28821
+ actionType: "submit",
28707
28822
  companyStructure: dataSubmitted.companyType.entityType,
28708
28823
  countryOfRegistration: dataSubmitted.companyNameAndCountry.country,
28709
- legalEntityName: dataSubmitted.companyNameAndCountry.legalCompanyName,
28824
+ entityName: dataSubmitted.companyNameAndCountry.legalCompanyName,
28710
28825
  usedAdditionalAddress: dataSubmitted.companyRegistrationAddress.operationalAddressIsSame === operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME
28711
28826
  };
28712
28827
  legalEntity.entityAssociations = filterOutUnwantedAssociationsIfRootLE(
@@ -28718,11 +28833,9 @@ function CompanyDropinComponent({
28718
28833
  delete legalEntity.organization.countryOfGoverningLaw;
28719
28834
  }
28720
28835
  try {
28721
- userEvents.addEvent("Provided company details", {
28722
- segmentation: {
28723
- ...baseTrackingPayload,
28724
- ...companyTrackingPayload
28725
- }
28836
+ userEvents.addEvent("Clicked button", {
28837
+ ...baseTrackingPayload,
28838
+ ...companyTrackingPayload
28726
28839
  });
28727
28840
  if (!(legalEntityResponse == null ? void 0 : legalEntityResponse.id)) {
28728
28841
  legalEntity = await handleCreateLegalEntity(legalEntity);
@@ -28733,13 +28846,11 @@ function CompanyDropinComponent({
28733
28846
  );
28734
28847
  }
28735
28848
  setAccountHolder(accountHolder);
28736
- userEvents.addEvent("Saved company details", {
28737
- segmentation: {
28738
- ...baseTrackingPayload,
28739
- legalEntityId: legalEntity.id,
28740
- legalEntityType: legalEntity.type,
28741
- ...companyTrackingPayload
28742
- }
28849
+ userEvents.addEvent("Success", {
28850
+ ...baseTrackingPayload,
28851
+ ...companyTrackingPayload,
28852
+ legalEntityId: legalEntity.id,
28853
+ entityType: legalEntity.type
28743
28854
  });
28744
28855
  await submitDocuments2({ forms, legalEntity, dataSubmitted });
28745
28856
  await attachAssociationToParentLegalEntity({ legalEntity });
@@ -28761,13 +28872,12 @@ function CompanyDropinComponent({
28761
28872
  showToast({ label: i18n.get("failedToUpdateDetails"), type: "error" });
28762
28873
  }
28763
28874
  setLoadingStatus("success");
28764
- userEvents.addEvent("Encountered error company details", {
28765
- segmentation: {
28766
- ...baseTrackingPayload,
28767
- errorCode: e.errorCode,
28768
- errorMessage: e.title,
28769
- errorType: "BE"
28770
- }
28875
+ userEvents.addEvent("Encountered error", {
28876
+ ...baseTrackingPayload,
28877
+ actionLevel: "task",
28878
+ actionType: "submit",
28879
+ returnType: e.errorCode,
28880
+ returnValue: e.title
28771
28881
  });
28772
28882
  }
28773
28883
  };
@@ -29455,7 +29565,12 @@ const getTrustMembers = (trustLE, rootLegalEntity, exemptSettlorLE) => {
29455
29565
  ];
29456
29566
  };
29457
29567
  const combineRootLegalEntityWithEntityAssociations = (rootLegalEntity, entityAssociations) => {
29458
- 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));
29459
29574
  return {
29460
29575
  trustMemberType: "rootTrustee",
29461
29576
  roles: [...roles, TrustMemberTypes.TRUSTEE],
@@ -29755,8 +29870,7 @@ const BusinessTypeSelection = ({
29755
29870
  accountHolder,
29756
29871
  onComplete,
29757
29872
  onBack,
29758
- handleUpdateLegalEntity,
29759
- baseTrackingPayload
29873
+ handleUpdateLegalEntity
29760
29874
  }) => {
29761
29875
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
29762
29876
  const { i18n } = useI18nContext();
@@ -29819,25 +29933,16 @@ const BusinessTypeSelection = ({
29819
29933
  )
29820
29934
  );
29821
29935
  }, [data.businessType, data.legalArrangement, currentStep]);
29936
+ const baseTrackingPayload = getBaseTrackingPayload({
29937
+ legalEntity: legalEntityResponse,
29938
+ task: TaskTypes.BUSINESS_TYPE_SELECTION
29939
+ });
29822
29940
  useEffect(() => {
29823
- userEvents.addPageView("Entity Selection");
29824
- const startDropOffTrackingEvent = () => {
29825
- userEvents.addEvent("Started legal entity selection", {
29826
- segmentation: baseTrackingPayload
29827
- });
29828
- };
29829
- const stopDropOffTrackingEvent = () => {
29830
- userEvents.addEvent("Drop off at legal entity selection", {
29831
- segmentation: baseTrackingPayload
29832
- });
29833
- };
29834
- startDropOffTrackingEvent();
29835
- window.addEventListener("focus", startDropOffTrackingEvent);
29836
- window.addEventListener("blur", stopDropOffTrackingEvent);
29837
- return () => {
29838
- window.removeEventListener("focus", startDropOffTrackingEvent);
29839
- window.removeEventListener("blur", stopDropOffTrackingEvent);
29840
- };
29941
+ userEvents.addEvent("Landed on page", {
29942
+ ...baseTrackingPayload,
29943
+ actionLevel: "task",
29944
+ actionType: "start"
29945
+ });
29841
29946
  }, []);
29842
29947
  const handleNextClick = async () => {
29843
29948
  var _a2;
@@ -29869,21 +29974,20 @@ const BusinessTypeSelection = ({
29869
29974
  return;
29870
29975
  }
29871
29976
  await updateLegalEntityAndSelectAccountHolder();
29872
- userEvents.addEvent("Saved legal entity selection", {
29873
- segmentation: baseTrackingPayload
29874
- });
29875
29977
  } else {
29876
29978
  onComplete(newAccountHolder);
29877
29979
  }
29878
29980
  if (isLegalArrangementChanging) {
29879
29981
  await updateLegalEntityAndSelectAccountHolder();
29880
- userEvents.addEvent("Saved legal entity selection", {
29881
- segmentation: baseTrackingPayload
29882
- });
29883
29982
  }
29884
29983
  }
29885
29984
  };
29886
29985
  const updateLegalEntityAndSelectAccountHolder = async () => {
29986
+ const trackingPayload = {
29987
+ ...baseTrackingPayload,
29988
+ actionLevel: "task",
29989
+ actionType: "submit"
29990
+ };
29887
29991
  try {
29888
29992
  if (isLegalEntityTypeChanging) {
29889
29993
  setLoadingStatus("loading");
@@ -29891,8 +29995,17 @@ const BusinessTypeSelection = ({
29891
29995
  type: targetLegalEntityType
29892
29996
  };
29893
29997
  await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity(updateLegalEntityPayload, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
29998
+ userEvents.addEvent("Success", trackingPayload);
29894
29999
  }
29895
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
+ }
29896
30009
  return;
29897
30010
  }
29898
30011
  const targetOrganizationType = determineOrganizationTypeToUpdate(
@@ -29909,6 +30022,7 @@ const BusinessTypeSelection = ({
29909
30022
  },
29910
30023
  legalEntityResponse == null ? void 0 : legalEntityResponse.id
29911
30024
  ));
30025
+ userEvents.addEvent("Success", trackingPayload);
29912
30026
  }
29913
30027
  } catch (e) {
29914
30028
  showToast({ label: i18n.get("failedToUpdateDetails"), type: "error" });
@@ -30503,6 +30617,7 @@ const DecisionMakersComponent = ({
30503
30617
  const decisionMakers = getOwnDecisionMakers(legalEntityResponse);
30504
30618
  const registeredCountry = (_b = (_a = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _a.registeredAddress) == null ? void 0 : _b.country;
30505
30619
  const availableDecisionMakers = getAvailableDecisionMakerRoleTypes(registeredCountry);
30620
+ const homeButtonLabel = i18n.get("saveAndGoToOverview");
30506
30621
  const { remediationMessages } = useDataMissingRemediations({
30507
30622
  legalEntityId: legalEntityResponse.id,
30508
30623
  problems: capabilityProblems
@@ -30543,13 +30658,13 @@ const DecisionMakersComponent = ({
30543
30658
  };
30544
30659
  const editDecisionMaker = (decisionMaker) => {
30545
30660
  onNavigateToIndividual(decisionMaker.reference);
30546
- userEvents.addEvent("Edited decision maker", {
30547
- segmentation: {
30548
- ...baseTrackingPayload,
30549
- legalEntityId: decisionMaker.reference,
30550
- legalEntityType: decisionMaker.legalEntityType,
30551
- roles: decisionMaker.types
30552
- }
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
30553
30668
  });
30554
30669
  };
30555
30670
  const deleteDecisionMaker = async (decisionMaker) => {
@@ -30564,14 +30679,14 @@ const DecisionMakersComponent = ({
30564
30679
  const remainingDecisionMakers = decisionMakers.filter(
30565
30680
  (curr) => curr.legalEntityId !== decisionMaker.reference
30566
30681
  );
30567
- userEvents.addEvent("Removed decision maker", {
30568
- segmentation: {
30569
- ...baseTrackingPayload,
30570
- legalEntityId: decisionMaker.reference,
30571
- legalEntityType: decisionMaker.legalEntityType,
30572
- roles: decisionMaker.types,
30573
- remainingDecisionMakers
30574
- }
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
30575
30690
  });
30576
30691
  showToast({ type: "success", label: i18n.get("successFullyRemovedDecisionMaker") });
30577
30692
  } catch (e) {
@@ -30618,7 +30733,8 @@ const DecisionMakersComponent = ({
30618
30733
  roleType
30619
30734
  )) }),
30620
30735
  titleId: "whatIsTheDifferenceBetweenTheseRoles",
30621
- contentId: "differenceBetweenAnOwnerControllingPersonAndSignatory"
30736
+ contentId: "differenceBetweenAnOwnerControllingPersonAndSignatory",
30737
+ baseTrackingPayload
30622
30738
  }
30623
30739
  ),
30624
30740
  showWarning && /* @__PURE__ */ jsx(
@@ -30662,15 +30778,16 @@ const DecisionMakersComponent = ({
30662
30778
  ActionBar,
30663
30779
  {
30664
30780
  onHome: () => {
30665
- userEvents.addEvent("Saved decision makers list", {
30666
- segmentation: {
30667
- ...baseTrackingPayload,
30668
- noOfDecisionMakers: decisionMakers.length
30669
- }
30781
+ userEvents.addEvent("Clicked button", {
30782
+ ...baseTrackingPayload,
30783
+ actionLevel: "task",
30784
+ actionType: "back",
30785
+ label: homeButtonLabel,
30786
+ noOfDecisionMakers: decisionMakers.length
30670
30787
  });
30671
30788
  navigateBackToTaskList();
30672
30789
  },
30673
- homeButtonLabel: i18n.get("saveAndGoToOverview")
30790
+ homeButtonLabel
30674
30791
  }
30675
30792
  )
30676
30793
  ] })
@@ -30729,22 +30846,6 @@ const introductionScreensByLegalEntityType = {
30729
30846
  IntroductionScreens.EPILOGUE
30730
30847
  ]
30731
30848
  };
30732
- var IntroductionScreenEvent = /* @__PURE__ */ ((IntroductionScreenEvent2) => {
30733
- IntroductionScreenEvent2["EMPTY"] = "Introduction_Empty";
30734
- IntroductionScreenEvent2["START_FLOW"] = "Introduction_StartFlow";
30735
- IntroductionScreenEvent2["START_SCREEN"] = "Introduction_StartScreen";
30736
- IntroductionScreenEvent2["STOP_SCREEN"] = "Introduction_StopScreen";
30737
- IntroductionScreenEvent2["STOP_FLOW"] = "Introduction_StopFlow";
30738
- IntroductionScreenEvent2["NEXT"] = "Introduction_Next";
30739
- IntroductionScreenEvent2["BACK"] = "Introduction_Back";
30740
- IntroductionScreenEvent2["SKIP"] = "Introduction_Skip";
30741
- return IntroductionScreenEvent2;
30742
- })(IntroductionScreenEvent || {});
30743
- var IntroductionScreenTiming = /* @__PURE__ */ ((IntroductionScreenTiming2) => {
30744
- IntroductionScreenTiming2["VIEW_FLOW"] = "Introduction_ViewFlow";
30745
- IntroductionScreenTiming2["VIEW_SCREEN"] = "Introduction_ViewScreen";
30746
- return IntroductionScreenTiming2;
30747
- })(IntroductionScreenTiming || {});
30748
30849
  const useLegalEntityType = ({
30749
30850
  legalEntity
30750
30851
  }) => {
@@ -30857,28 +30958,33 @@ const Introduction = ({
30857
30958
  const { i18n } = useI18nContext();
30858
30959
  const introductionScreens = useIntroductionScreens({ legalEntity, tasks });
30859
30960
  const [activeIndex, setActiveIndex] = useState(0);
30860
- const eventSegmentationDefaults = getBaseTrackingPayload({
30961
+ const baseTrackingPayload = getBaseTrackingPayload({
30861
30962
  trackingConfig: { topLevelLegalEntity: legalEntity },
30862
30963
  legalEntity,
30863
30964
  task: TaskTypes.INTRODUCTION
30864
30965
  });
30865
- const eventDetails = {
30866
- segmentation: {
30867
- ...eventSegmentationDefaults,
30868
- page: (introductionScreens == null ? void 0 : introductionScreens.length) ? introductionScreens[activeIndex] : null
30869
- }
30966
+ const pageEventDetails = {
30967
+ ...baseTrackingPayload,
30968
+ actionLevel: "page",
30969
+ page: (introductionScreens == null ? void 0 : introductionScreens.length) ? introductionScreens[activeIndex] : void 0
30870
30970
  };
30871
30971
  useEffect(() => {
30872
- if (!(introductionScreens == null ? void 0 : introductionScreens.length)) {
30873
- userEvents.addEvent(IntroductionScreenEvent.EMPTY, {
30874
- segmentation: eventSegmentationDefaults
30972
+ if (introductionScreens == null ? void 0 : introductionScreens.length) {
30973
+ userEvents.addEvent("Landed on page", {
30974
+ ...baseTrackingPayload,
30975
+ actionLevel: "task",
30976
+ actionType: "start"
30875
30977
  });
30876
- onExitIntroduction();
30877
30978
  } else {
30878
- userEvents.startEvent(IntroductionScreenTiming.VIEW_FLOW);
30879
- userEvents.addEvent(IntroductionScreenEvent.START_FLOW, eventDetails);
30979
+ onExitIntroduction();
30880
30980
  }
30881
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
+ };
30882
30988
  return (introductionScreens == null ? void 0 : introductionScreens.length) ? /* @__PURE__ */ jsxs("div", { className: "adyen-kyc-introduction", children: [
30883
30989
  /* @__PURE__ */ jsx(
30884
30990
  StepProgressIndicator,
@@ -30890,9 +30996,13 @@ const Introduction = ({
30890
30996
  /* @__PURE__ */ jsx("div", { className: "adyen-kyc-introduction__skip", children: /* @__PURE__ */ jsx(
30891
30997
  Button,
30892
30998
  {
30893
- label: i18n.get("goToOverviewFromIntroduction"),
30999
+ label: buttonLabels.skip,
30894
31000
  onClick: () => {
30895
- userEvents.addEvent(IntroductionScreenEvent.SKIP, eventDetails);
31001
+ userEvents.addEvent("Clicked button", {
31002
+ ...pageEventDetails,
31003
+ actionType: "skip",
31004
+ label: buttonLabels.skip
31005
+ });
30896
31006
  onExitIntroduction();
30897
31007
  },
30898
31008
  showAsLink: true,
@@ -30913,14 +31023,14 @@ const Introduction = ({
30913
31023
  Button,
30914
31024
  {
30915
31025
  disabled: activeIndex === 0,
30916
- label: "Back",
31026
+ label: buttonLabels.back,
30917
31027
  onClick: () => {
30918
- userEvents.addEvent(IntroductionScreenEvent.BACK, eventDetails);
30919
- userEvents.addEvent(IntroductionScreenEvent.STOP_SCREEN, eventDetails);
30920
- userEvents.endEvent(IntroductionScreenTiming.VIEW_SCREEN, eventDetails);
31028
+ userEvents.addEvent("Clicked button", {
31029
+ ...pageEventDetails,
31030
+ actionType: "back",
31031
+ label: buttonLabels.back
31032
+ });
30921
31033
  setActiveIndex((currentValue) => currentValue - 1);
30922
- userEvents.startEvent(IntroductionScreenTiming.VIEW_SCREEN);
30923
- userEvents.addEvent(IntroductionScreenEvent.START_SCREEN, eventDetails);
30924
31034
  },
30925
31035
  secondary: true,
30926
31036
  type: "button"
@@ -30929,12 +31039,14 @@ const Introduction = ({
30929
31039
  activeIndex + 1 === introductionScreens.length ? /* @__PURE__ */ jsx(
30930
31040
  Button,
30931
31041
  {
30932
- label: "Start",
31042
+ label: buttonLabels.start,
30933
31043
  onClick: () => {
30934
- userEvents.addEvent(IntroductionScreenEvent.STOP_SCREEN, eventDetails);
30935
- userEvents.addEvent(IntroductionScreenEvent.STOP_FLOW, eventDetails);
30936
- userEvents.endEvent(IntroductionScreenTiming.VIEW_SCREEN, eventDetails);
30937
- userEvents.endEvent(IntroductionScreenTiming.VIEW_FLOW, eventDetails);
31044
+ userEvents.addEvent("Success", {
31045
+ ...baseTrackingPayload,
31046
+ actionLevel: "task",
31047
+ actionType: "start",
31048
+ label: buttonLabels.start
31049
+ });
30938
31050
  onExitIntroduction();
30939
31051
  },
30940
31052
  type: "button"
@@ -30942,14 +31054,14 @@ const Introduction = ({
30942
31054
  ) : /* @__PURE__ */ jsx(
30943
31055
  Button,
30944
31056
  {
30945
- label: "Next",
31057
+ label: buttonLabels.next,
30946
31058
  onClick: () => {
30947
- userEvents.addEvent(IntroductionScreenEvent.NEXT, eventDetails);
30948
- userEvents.addEvent(IntroductionScreenEvent.STOP_SCREEN, eventDetails);
30949
- userEvents.endEvent(IntroductionScreenTiming.VIEW_SCREEN, eventDetails);
31059
+ userEvents.addEvent("Clicked button", {
31060
+ ...pageEventDetails,
31061
+ actionType: "next",
31062
+ label: buttonLabels.next
31063
+ });
30950
31064
  setActiveIndex((currentValue) => currentValue + 1);
30951
- userEvents.startEvent(IntroductionScreenTiming.VIEW_SCREEN);
30952
- userEvents.addEvent(IntroductionScreenEvent.START_SCREEN, eventDetails);
30953
31065
  },
30954
31066
  type: "button"
30955
31067
  }
@@ -31559,13 +31671,14 @@ function TaskListComponent({
31559
31671
  const companyTaskDescriptionKey = isReview ? "businessAccountDetailsDescriptionReview" : "businessAccountDetailsDescription";
31560
31672
  const payoutTaskDescriptionKey = isReview ? "payoutAccountsDescriptionReview" : "payoutAccountsDescription";
31561
31673
  const onEditBusinessSetupClick = () => {
31562
- const baseTrackingPayload = getBaseTrackingPayload({
31563
- trackingConfig,
31564
- legalEntity: legalEntityResponse,
31565
- task: tasks[tasks.length - 1]
31566
- });
31567
- userEvents.addEvent("Clicked back to legal entity selection", {
31568
- 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"
31569
31682
  });
31570
31683
  onNavigateToTask(TaskTypes.BUSINESS_TYPE_SELECTION);
31571
31684
  };
@@ -32083,7 +32196,8 @@ const TrustMembersOverview = ({
32083
32196
  label
32084
32197
  )) }),
32085
32198
  titleId: "whatIsTheDifferenceBetweenTheseRoles",
32086
- contentId: "differenceBetweenTrustMemberRoles"
32199
+ contentId: "differenceBetweenTrustMemberRoles",
32200
+ baseTrackingPayload: { task: TaskTypes.TRUST_MEMBER_OVERVIEW }
32087
32201
  }
32088
32202
  ),
32089
32203
  /* @__PURE__ */ jsx(CardGroup, { children: trustMembers.map((trustMember) => {
@@ -32339,9 +32453,10 @@ function IndividualDropinComponent({
32339
32453
  task: taskType
32340
32454
  });
32341
32455
  useEffect(() => {
32342
- userEvents.addPageView("Individual dropin");
32343
- userEvents.addEvent("Started individual task", {
32344
- segmentation: { ...baseTrackingPayload }
32456
+ userEvents.addEvent("Landed on page", {
32457
+ ...baseTrackingPayload,
32458
+ actionLevel: "task",
32459
+ actionType: "start"
32345
32460
  });
32346
32461
  }, []);
32347
32462
  const getConfigurationData = useCallback(
@@ -32471,27 +32586,27 @@ function IndividualDropinComponent({
32471
32586
  throw new Error("Provide handler to create legalEntity");
32472
32587
  }
32473
32588
  updatedLegalEntity = await handleCreateLegalEntity(legalEntity);
32474
- userEvents.addEvent("Added decision maker", {
32475
- segmentation: {
32476
- ...baseTrackingPayload,
32477
- legalEntityId: updatedLegalEntity.id,
32478
- legalEntityType: updatedLegalEntity.type,
32479
- countryOfRegistration: ((_a2 = dataSubmitted.personalDetails) == null ? void 0 : _a2.residencyCountry) || null,
32480
- roles: ((_b2 = dataSubmitted.personalDetails) == null ? void 0 : _b2.role) || null
32481
- }
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
32482
32597
  });
32483
32598
  } else {
32484
32599
  updatedLegalEntity = await handleUpdateLegalEntity(drop("type").from(legalEntity), leId);
32485
- }
32486
- userEvents.addEvent("Saved individual details", {
32487
- segmentation: {
32600
+ userEvents.addEvent("Success", {
32488
32601
  ...baseTrackingPayload,
32602
+ actionLevel: "task",
32603
+ actionType: "submit",
32489
32604
  legalEntityId: updatedLegalEntity.id,
32490
- legalEntityType: updatedLegalEntity.type,
32605
+ entityType: updatedLegalEntity.type,
32491
32606
  countryOfRegistration: ((_c2 = dataSubmitted.personalDetails) == null ? void 0 : _c2.residencyCountry) || null,
32492
32607
  idDocumentType: idDocumentType || null
32493
- }
32494
- });
32608
+ });
32609
+ }
32495
32610
  return updatedLegalEntity;
32496
32611
  };
32497
32612
  const handleInstantIdVerificationStartCheck = async (onfidoResponse, legalEntityId) => {
@@ -32524,12 +32639,12 @@ function IndividualDropinComponent({
32524
32639
  );
32525
32640
  uploadedDocuments == null ? void 0 : uploadedDocuments.forEach((doc) => {
32526
32641
  var _a3;
32527
- userEvents.addEvent("Saved document", {
32528
- segmentation: {
32529
- ...baseTrackingPayload,
32530
- documentType: doc.type,
32531
- fileExtention: ((_a3 = doc == null ? void 0 : doc.attachments) == null ? void 0 : _a3.map((item) => getFileExtention(item.pageName))) ?? null
32532
- }
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
32533
32648
  });
32534
32649
  });
32535
32650
  }
@@ -32596,12 +32711,12 @@ function IndividualDropinComponent({
32596
32711
  return ((_a3 = dataSubmitted == null ? void 0 : dataSubmitted.idDocument) == null ? void 0 : _a3.idDocumentType) === id;
32597
32712
  }
32598
32713
  )) == null ? void 0 : _a2.id;
32599
- userEvents.addEvent("Provided individual details", {
32600
- segmentation: {
32601
- ...baseTrackingPayload,
32602
- countryOfRegistration: ((_b2 = dataSubmitted == null ? void 0 : dataSubmitted.personalDetails) == null ? void 0 : _b2.residencyCountry) || null,
32603
- idDocumentType: idDocumentType || null
32604
- }
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
32605
32720
  });
32606
32721
  legalEntity.entityAssociations = filterOutUnwantedAssociationsIfRootLE(
32607
32722
  taskType,
@@ -32640,13 +32755,12 @@ function IndividualDropinComponent({
32640
32755
  showToast({ label: i18n.get("failedToUpdateDetails"), type: "error" });
32641
32756
  }
32642
32757
  setLoadingStatus("success");
32643
- userEvents.addEvent("Encountered error individual details", {
32644
- segmentation: {
32645
- ...baseTrackingPayload,
32646
- errorCode: e.errorCode,
32647
- errorMessage: e.title,
32648
- errorType: "BE"
32649
- }
32758
+ userEvents.addEvent("Encountered error", {
32759
+ ...baseTrackingPayload,
32760
+ actionLevel: "task",
32761
+ actionType: "submit",
32762
+ returnType: e.errorCode,
32763
+ returnValue: e.title
32650
32764
  });
32651
32765
  }
32652
32766
  };
@@ -33037,9 +33151,10 @@ function PayoutDetailsDropinComponent({
33037
33151
  task: taskType
33038
33152
  });
33039
33153
  useEffect(() => {
33040
- userEvents.addPageView("Payout dropin");
33041
- userEvents.addEvent("Started payout task", {
33042
- segmentation: { ...baseTrackingPayload }
33154
+ userEvents.addEvent("Landed on page", {
33155
+ ...baseTrackingPayload,
33156
+ actionLevel: "task",
33157
+ actionType: "start"
33043
33158
  });
33044
33159
  }, []);
33045
33160
  const { getConfigurationData, provider } = useBankConfigurationHandlers({
@@ -33165,12 +33280,12 @@ function PayoutDetailsDropinComponent({
33165
33280
  );
33166
33281
  documents2.forEach((document2) => {
33167
33282
  var _a2;
33168
- userEvents.addEvent("Saved document", {
33169
- segmentation: {
33170
- ...baseTrackingPayload,
33171
- documentType: document2.type,
33172
- fileExtention: ((_a2 = document2.attachments) == null ? void 0 : _a2.map((item) => getFileExtention(item.pageName))) ?? null
33173
- }
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
33174
33289
  });
33175
33290
  });
33176
33291
  } catch (e) {
@@ -33202,15 +33317,15 @@ function PayoutDetailsDropinComponent({
33202
33317
  existingPayoutDetails == null ? void 0 : existingPayoutDetails.payoutAccountDetails
33203
33318
  );
33204
33319
  }
33205
- const event = {
33206
- segmentation: {
33207
- ...baseTrackingPayload,
33208
- documentType: DocumentType.BANK_STATEMENT,
33209
- bankCountry: (payoutVerificationMethod == null ? void 0 : payoutVerificationMethod.bankCountry) ?? defaultPayoutCountry,
33210
- bankCurrency: (payoutAccountDetails == null ? void 0 : payoutAccountDetails.currency) ?? null
33211
- }
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
33212
33327
  };
33213
- userEvents.addEvent("Provided payout details", event);
33328
+ userEvents.addEvent("Clicked button", baseTracking);
33214
33329
  let transferInstrument2 = mapPayoutAccountToTransferInstrument({
33215
33330
  data: dataSubmitted,
33216
33331
  legalEntity: legalEntityResponse
@@ -33226,7 +33341,7 @@ function PayoutDetailsDropinComponent({
33226
33341
  transferInstrumentId
33227
33342
  );
33228
33343
  }
33229
- userEvents.addEvent("Saved payout details", event);
33344
+ userEvents.addEvent("Success", baseTracking);
33230
33345
  try {
33231
33346
  await submitDocuments2({ forms, transferInstrument: transferInstrument2, dataSubmitted });
33232
33347
  setLoadingStatus("success");
@@ -33255,13 +33370,10 @@ function PayoutDetailsDropinComponent({
33255
33370
  showToast({ label: i18n.get("failedToUpdateDetails"), type: "error" });
33256
33371
  }
33257
33372
  setLoadingStatus("success");
33258
- userEvents.addEvent("Encountered error payout details", {
33259
- segmentation: {
33260
- ...baseTrackingPayload,
33261
- errorCode: e.errorCode,
33262
- errorMessage: e.title,
33263
- errorType: "BE"
33264
- }
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)
33265
33377
  });
33266
33378
  }
33267
33379
  };
@@ -33454,6 +33566,8 @@ function PciDropinComponent({
33454
33566
  });
33455
33567
  const [loadingStatus, setLoadingStatus] = useState();
33456
33568
  const hasExpired = useHasExpired();
33569
+ const signButtonLabel = i18n.get("sign");
33570
+ const homeButtonLabel = i18n.get("goToOverview");
33457
33571
  const { handleChangeFor, triggerValidation, data, valid, isValid, errors } = useForm({
33458
33572
  schema: PciFields,
33459
33573
  rules: pciValidationRules
@@ -33480,7 +33594,13 @@ function PciDropinComponent({
33480
33594
  ];
33481
33595
  const handleSignClick = async () => {
33482
33596
  if (loadingStatus === "loading") return;
33483
- 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);
33484
33604
  triggerValidation();
33485
33605
  if (isValid) {
33486
33606
  try {
@@ -33488,40 +33608,47 @@ function PciDropinComponent({
33488
33608
  await handleSign(legalEntityResponse.id, { signedBy: data.signer, pciTemplateReferences });
33489
33609
  setLoadingStatus("success");
33490
33610
  showToast({ label: i18n.get("pciSignedSuccessfully"), type: "success" });
33491
- userEvents.addEvent("Succeeded PCI signing", { segmentation: { ...baseTrackingPayload } });
33611
+ userEvents.addEvent("Success", baseTracking);
33492
33612
  goHome();
33493
- } catch {
33613
+ } catch (e) {
33494
33614
  setLoadingStatus("success");
33495
33615
  showToast({ label: i18n.get("pciSignFailed"), type: "error" });
33496
- 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
+ });
33497
33621
  }
33498
33622
  } else {
33499
- userEvents.addEvent("Encountered PCI validation error", {
33500
- segmentation: {
33501
- ...baseTrackingPayload,
33502
- fields: Object.entries(valid).filter(([, value]) => !value).map(([key]) => key)
33503
- }
33623
+ userEvents.addEvent("Encountered error", {
33624
+ ...baseTracking,
33625
+ returnType: "validation",
33626
+ returnValue: Object.entries(valid).filter(([, value]) => !value).map(([key]) => key)
33504
33627
  });
33505
33628
  }
33506
33629
  };
33507
33630
  const goHome = () => {
33508
- userEvents.addEvent("Returned to task overview from PCI", {
33509
- segmentation: { ...baseTrackingPayload }
33631
+ userEvents.addEvent("Clicked button", {
33632
+ ...baseTrackingPayload,
33633
+ actionLevel: "task",
33634
+ actionType: "back",
33635
+ label: homeButtonLabel
33510
33636
  });
33511
33637
  handleHomeClick();
33512
33638
  };
33513
33639
  const handleExpandSection = (title) => {
33514
- userEvents.addEvent("Expanded PCI section", {
33515
- segmentation: {
33516
- ...baseTrackingPayload,
33517
- statementExtended: title
33518
- }
33640
+ userEvents.addEvent("Clicked accordion", {
33641
+ ...baseTrackingPayload,
33642
+ actionLevel: "task",
33643
+ actionType: "open",
33644
+ label: title
33519
33645
  });
33520
33646
  };
33521
33647
  useEffect(() => {
33522
- userEvents.addPageView("PCI dropin");
33523
- userEvents.addEvent("Started PCI task", {
33524
- segmentation: { ...baseTrackingPayload }
33648
+ userEvents.addEvent("Landed on page", {
33649
+ ...baseTrackingPayload,
33650
+ actionLevel: "task",
33651
+ actionType: "start"
33525
33652
  });
33526
33653
  }, []);
33527
33654
  const acceptPciLabel = /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -33580,9 +33707,9 @@ function PciDropinComponent({
33580
33707
  ActionBar,
33581
33708
  {
33582
33709
  onHome: goHome,
33583
- homeButtonLabel: i18n.get("goToOverview"),
33710
+ homeButtonLabel,
33584
33711
  onNext: handleSignClick,
33585
- nextButtonLabel: i18n.get("sign")
33712
+ nextButtonLabel: signButtonLabel
33586
33713
  }
33587
33714
  );
33588
33715
  return /* @__PURE__ */ jsx(DropinLayout, { content, footer });
@@ -34460,6 +34587,8 @@ function ServiceAgreementDropinComponent({
34460
34587
  const [activeForm, setActiveForm] = useState(forms[activeFormIndex]);
34461
34588
  const canSign = (serviceAgreementTypes == null ? void 0 : serviceAgreementTypes.includes(activeForm == null ? void 0 : activeForm.serviceAgreementType)) && !(activeForm == null ? void 0 : activeForm.acceptanceId);
34462
34589
  const showSignedAlert = !!(activeForm == null ? void 0 : activeForm.acceptanceId);
34590
+ const homeButtonLabel = i18n.get("goToOverview");
34591
+ const nextButtonLabel = i18n.get(canSign ? "sign" : "next");
34463
34592
  const handleServiceAgreementIsNotAvailableInThatLanguage = useCallback(() => {
34464
34593
  showToast({
34465
34594
  label: i18n.get("failedToGetServiceAgreementInSelectedLanguageFallbackToEn"),
@@ -34500,7 +34629,12 @@ function ServiceAgreementDropinComponent({
34500
34629
  };
34501
34630
  const signers = getSigners();
34502
34631
  const handleSignClick = async () => {
34503
- 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 });
34504
34638
  triggerValidation();
34505
34639
  if (loadingStatus === "loading" || !serviceAgreement || !data.signer) return;
34506
34640
  if (isValid) {
@@ -34512,35 +34646,41 @@ function ServiceAgreementDropinComponent({
34512
34646
  label: i18n.get("serviceAgreementSignedSuccessfully"),
34513
34647
  type: "success"
34514
34648
  });
34515
- userEvents.addEvent("Succeeded ToS signing", { segmentation: { ...baseTrackingPayload } });
34649
+ userEvents.addEvent("Success", baseTracking);
34516
34650
  data.acceptServiceAgreement = false;
34517
34651
  data.signer = void 0;
34518
- } catch {
34652
+ } catch (e) {
34519
34653
  setLoadingStatus("success");
34520
34654
  showToast({ label: i18n.get("serviceAgreementSignFailed"), type: "error" });
34521
- 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
+ });
34522
34660
  }
34523
34661
  } else {
34524
- userEvents.addEvent("Encountered ToS validation error", {
34525
- segmentation: {
34526
- ...baseTrackingPayload,
34527
- fields: Object.entries(valid).filter(([, value]) => !value).map(([key]) => key)
34528
- }
34662
+ userEvents.addEvent("Encountered error", {
34663
+ ...baseTracking,
34664
+ returnType: "validation",
34665
+ returnValue: Object.entries(valid).filter(([, value]) => !value).map(([key]) => key)
34529
34666
  });
34530
34667
  }
34531
34668
  };
34532
34669
  const goHome = () => {
34533
- userEvents.addEvent("Returned to task overview from ToS", {
34534
- segmentation: { ...baseTrackingPayload }
34670
+ userEvents.addEvent("Clicked button", {
34671
+ ...baseTrackingPayload,
34672
+ actionLevel: "task",
34673
+ actionType: "back",
34674
+ label: homeButtonLabel
34535
34675
  });
34536
34676
  handleHomeClick();
34537
34677
  };
34538
34678
  const handleExpandSection = (title) => {
34539
- userEvents.addEvent("Expanded ToS section", {
34540
- segmentation: {
34541
- ...baseTrackingPayload,
34542
- statementExtended: title
34543
- }
34679
+ userEvents.addEvent("Clicked accordion", {
34680
+ ...baseTrackingPayload,
34681
+ actionLevel: "task",
34682
+ actionType: "open",
34683
+ label: title
34544
34684
  });
34545
34685
  };
34546
34686
  useEffect(() => {
@@ -34548,9 +34688,10 @@ function ServiceAgreementDropinComponent({
34548
34688
  gotoForm(serviceAgreementAcceptanceInfos.length - 1);
34549
34689
  }, [serviceAgreementAcceptanceInfos]);
34550
34690
  useEffect(() => {
34551
- userEvents.addPageView("ToS dropin");
34552
- userEvents.addEvent("Started ToS task", {
34553
- segmentation: { ...baseTrackingPayload }
34691
+ userEvents.addEvent("Landed on page", {
34692
+ ...baseTrackingPayload,
34693
+ actionLevel: "task",
34694
+ actionType: "start"
34554
34695
  });
34555
34696
  const initialFormIndex = forms.length === signedForms.length ? 0 : signedForms.length;
34556
34697
  gotoForm(initialFormIndex);
@@ -34739,9 +34880,9 @@ function ServiceAgreementDropinComponent({
34739
34880
  ActionBar,
34740
34881
  {
34741
34882
  onHome: goHome,
34742
- homeButtonLabel: i18n.get("goToOverview"),
34883
+ homeButtonLabel,
34743
34884
  onNext: canSign ? handleSignClick : () => gotoForm(activeFormIndex + 1),
34744
- nextButtonLabel: i18n.get(canSign ? "sign" : "next"),
34885
+ nextButtonLabel,
34745
34886
  nextButtonDisabled: forms.length === 0 || !canSign && activeFormIndex === forms.length - 1,
34746
34887
  onBack: () => gotoForm(activeFormIndex - 1),
34747
34888
  hideBackButton: activeFormIndex === 0,
@@ -35100,7 +35241,11 @@ function SolePropDropinComponent({
35100
35241
  );
35101
35242
  }
35102
35243
  const COUNTRIES_THAT_USE_REGISTRATION_NUMBER = [CountryCodes.NewZealand];
35103
- const rules = ({ data, country }) => ({
35244
+ const rules = ({
35245
+ data,
35246
+ country,
35247
+ isExperimentEnabled = () => false
35248
+ }) => ({
35104
35249
  countryUsesTaxId: () => {
35105
35250
  if (country !== CountryCodes.NewZealand && COUNTRIES_THAT_USE_TAX_ID_INSTEAD_OF_VAT.includes(country)) {
35106
35251
  return "REQUIRED";
@@ -35116,6 +35261,11 @@ const rules = ({ data, country }) => ({
35116
35261
  if (((_a = data == null ? void 0 : data.trustRegistrationDetails) == null ? void 0 : _a.trustType) === TrustTypes.CHARITABLE_TRUST) {
35117
35262
  return "REQUIRED";
35118
35263
  }
35264
+ },
35265
+ isLemApiVersionV4Enabled: () => {
35266
+ if (isExperimentEnabled("EnableLemApiVersionV4")) {
35267
+ return "REQUIRED";
35268
+ }
35119
35269
  }
35120
35270
  });
35121
35271
  const parseConfiguration$1 = ({ matchingScenario, country }) => parseTrustScenarios(matchingScenario == null ? void 0 : matchingScenario[LegalEntityType.TRUST], country);
@@ -35755,6 +35905,13 @@ function DropinComposerComponent({
35755
35905
  const refreshLegalEntity = useCallback(async () => {
35756
35906
  const legalEntity = await retrieveLegalEntity();
35757
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
+ }
35758
35915
  return legalEntity;
35759
35916
  }, [retrieveLegalEntity, updateLegalEntityAndCapabilityProblems]);
35760
35917
  const deleteTransferInstrument = async (id) => {
@@ -36024,13 +36181,6 @@ function DropinComposerComponent({
36024
36181
  await componentOnSubmit(data, backSteps);
36025
36182
  };
36026
36183
  const onPciDownload = async () => {
36027
- const baseTrackingPayload = getBaseTrackingPayload({
36028
- trackingConfig: {
36029
- topLevelLegalEntity: legalEntityResponse
36030
- },
36031
- legalEntity: rootLegalEntity,
36032
- task: TaskTypes.PCI_DSS
36033
- });
36034
36184
  try {
36035
36185
  const response = await (args == null ? void 0 : args.handleGetPciQuestionnaires(rootLegalEntity.id));
36036
36186
  await Promise.all(
@@ -36045,13 +36195,30 @@ function DropinComposerComponent({
36045
36195
  } catch (e) {
36046
36196
  showToast({ label: i18n.get("failedToDownloadPci"), type: "error" });
36047
36197
  } finally {
36048
- userEvents.addEvent("Downloaded signed PCI form", {
36049
- 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"
36050
36208
  });
36051
36209
  }
36052
36210
  };
36053
36211
  useEffect(() => {
36054
- 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
+ });
36055
36222
  }, []);
36056
36223
  useLayoutEffect(() => {
36057
36224
  const fetchConfiguration = async () => {
@@ -36142,8 +36309,7 @@ function DropinComposerComponent({
36142
36309
  await refreshLegalEntity();
36143
36310
  navigateTo("default");
36144
36311
  },
36145
- onBack: previousTask ? navigateBack : void 0,
36146
- trackingConfig: { topLevelLegalEntity: legalEntityResponse }
36312
+ onBack: previousTask ? navigateBack : void 0
36147
36313
  }
36148
36314
  ) });
36149
36315
  case TaskTypes.SINGPASS_SELECTION:
@@ -39060,15 +39226,13 @@ const pushEvents = async (loadingContext, sessionId, event) => httpPost(
39060
39226
  },
39061
39227
  event
39062
39228
  );
39063
- const convertToEmbeddedEvent = (eventQueueItem) => {
39064
- const [eventType, event] = eventQueueItem;
39065
- const isObject = typeof event === "object";
39066
- const eventName = isObject ? event.key : event;
39067
- const eventData = isObject ? event.segmentation : {};
39229
+ const convertToEmbeddedEvent = (eventQueueItem, sessionData) => {
39230
+ const { type, name, properties } = eventQueueItem;
39068
39231
  return {
39069
- eventType,
39070
- eventName,
39071
- eventData: eventData ?? {}
39232
+ eventName: name,
39233
+ eventType: type,
39234
+ eventData: properties || {},
39235
+ ...sessionData
39072
39236
  };
39073
39237
  };
39074
39238
  const useAnalytics = async ({
@@ -39080,30 +39244,33 @@ const useAnalytics = async ({
39080
39244
  const { i18n } = useI18nContext();
39081
39245
  const { isEmbeddedDropin, loadingContext: base } = useAuthContext();
39082
39246
  const loadingContext = `${base}api/${COMPONENTS_API_VERSION}/`;
39083
- if (isEmbeddedDropin) {
39084
- try {
39085
- const sessionResponse = await getAnalyticsSession(loadingContext, {
39086
- sdkVersion,
39087
- componentName,
39088
- userAgent: navigator.userAgent,
39089
- legalEntityId
39090
- });
39091
- if (!(sessionResponse == null ? void 0 : sessionResponse.id)) {
39092
- 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);
39093
39269
  }
39094
- userEvents.subscribe((data) => {
39095
- const eventItem = convertToEmbeddedEvent(data);
39096
- if (eventItem.eventData) {
39097
- eventItem.eventData.locale = i18n.locale;
39098
- }
39099
- pushEvents(loadingContext, sessionResponse.id, eventItem);
39100
- });
39101
- } catch (e) {
39102
- console.error("Failed to initiate analytics for component", e);
39270
+ } else if (onUserEvent) {
39271
+ userEvents.subscribe(onUserEvent);
39103
39272
  }
39104
- } else if (onUserEvent) {
39105
- userEvents.subscribe(onUserEvent);
39106
- }
39273
+ })();
39107
39274
  };
39108
39275
  const logger$8 = createLogger("loadCountries");
39109
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") });
@@ -39399,7 +39566,7 @@ const ConfigurationApiProvider = ({
39399
39566
  }) => {
39400
39567
  const authContext = useAuthContext();
39401
39568
  const { isEmbeddedDropin, loadingContext } = authContext;
39402
- const sdkVersion = "2.59.10";
39569
+ const sdkVersion = "2.60.0";
39403
39570
  useAnalytics({
39404
39571
  onUserEvent,
39405
39572
  legalEntityId: rootLegalEntityId,
@@ -40072,7 +40239,7 @@ const DebugModal = ({ rootLegalEntityId, onExit, getRootLegalEntity }) => {
40072
40239
  };
40073
40240
  const copyToClipboard = async () => {
40074
40241
  const toCopy = {
40075
- sdkVersion: "2.59.10",
40242
+ sdkVersion: "2.60.0",
40076
40243
  experiments: Object.fromEntries(allExperimentsWithValues),
40077
40244
  settings: Object.fromEntries(allSettingsWithValues)
40078
40245
  };
@@ -40137,7 +40304,7 @@ const DebugModal = ({ rootLegalEntityId, onExit, getRootLegalEntity }) => {
40137
40304
  /* @__PURE__ */ jsx("div", { className: "adyen-kyc-debug-modal__meta", children: /* @__PURE__ */ jsx("table", { children: /* @__PURE__ */ jsxs("tbody", { children: [
40138
40305
  /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsxs("td", { children: [
40139
40306
  /* @__PURE__ */ jsx("span", { className: "adyen-kyc-debug-modal__table-key", children: "SDK version" }),
40140
- /* @__PURE__ */ jsx(Tag, { variant: "green", className: "adyen-kyc-tag--large", children: "2.59.10" })
40307
+ /* @__PURE__ */ jsx(Tag, { variant: "green", className: "adyen-kyc-tag--large", children: "2.60.0" })
40141
40308
  ] }) }),
40142
40309
  /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsxs("td", { children: [
40143
40310
  /* @__PURE__ */ jsx("span", { className: "adyen-kyc-debug-modal__table-key", children: "rootLegalEntityId" }),
@@ -40257,6 +40424,20 @@ const getRootLegalEntityId = (componentProps) => {
40257
40424
  if ("legalEntityResponse" in componentProps) return componentProps.legalEntityResponse.id;
40258
40425
  throw new Error("You must provide either `legalEntityId` or `legalEntityResponse`");
40259
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
+ };
40260
40441
  class UIElement extends BaseElement {
40261
40442
  constructor() {
40262
40443
  super(...arguments);
@@ -40265,6 +40446,10 @@ class UIElement extends BaseElement {
40265
40446
  const rootLegalEntityId = getRootLegalEntityId(
40266
40447
  this.props.componentProps
40267
40448
  );
40449
+ const baseTracking = getBaseTracking(
40450
+ this.props.componentProps
40451
+ );
40452
+ userEvents.updateBaseTrackingPayload(baseTracking);
40268
40453
  return /* @__PURE__ */ jsx(SettingsProvider, { settings: this.props.settings, children: /* @__PURE__ */ jsx(
40269
40454
  AuthProvider,
40270
40455
  {