@adyen/kyc-components 2.59.11 → 2.61.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 (56) hide show
  1. package/dist/es/adyen-kyc-components.es.js +1123 -834
  2. package/dist/style.css +2 -2
  3. package/dist/types/components/BasicInformation/types.d.ts +1 -1
  4. package/dist/types/components/BusinessDetails/types.d.ts +1 -1
  5. package/dist/types/components/BusinessTypeSelection/component/BusinessTypeSelection.d.ts +1 -1
  6. package/dist/types/components/Company/component/CompanyComponent.d.ts +1 -1
  7. package/dist/types/components/CompanyRegistrationDetails/types.d.ts +2 -1
  8. package/dist/types/components/DecisionMakers/component/DecisionMakersComponent.d.ts +1 -1
  9. package/dist/types/components/Dropins/BusinessDetailsDropin/components/BusinessDetailsDropinComponent.d.ts +1 -1
  10. package/dist/types/components/Dropins/BusinessDetailsDropin/types.d.ts +1 -14
  11. package/dist/types/components/Dropins/BusinessDetailsDropin/utils.d.ts +1 -2
  12. package/dist/types/components/Dropins/CompanyDropin/components/CompanyDropinComponent.d.ts +1 -1
  13. package/dist/types/components/Dropins/FormNavigation/types.d.ts +3 -3
  14. package/dist/types/components/Dropins/FormWrapper/FormWrapper.d.ts +1 -1
  15. package/dist/types/components/Dropins/IndividualDropin/components/IndividualDropinComponent.d.ts +1 -1
  16. package/dist/types/components/Dropins/PayoutDetailsDropin/components/PayoutDetailsDropinComponent.d.ts +1 -1
  17. package/dist/types/components/Dropins/PciDropin/components/PciDropinComponent.d.ts +1 -1
  18. package/dist/types/components/Dropins/ServiceAgreementDropinComponent/components/ServiceAgreementDropinComponent.d.ts +1 -1
  19. package/dist/types/components/Dropins/SolePropDropin/components/SolePropDropinComponent.d.ts +1 -1
  20. package/dist/types/components/Dropins/TrustDropin/components/TrustDropinComponent.d.ts +1 -1
  21. package/dist/types/components/Dropins/types.d.ts +1 -4
  22. package/dist/types/components/EmbeddedDropins/UpdateLegalEntityForHighExposure/UpdateLegalEntityForHighExposure.d.ts +1 -1
  23. package/dist/types/components/Introduction/Introduction.d.ts +1 -1
  24. package/dist/types/components/Introduction/constants.d.ts +0 -14
  25. package/dist/types/components/PersonalDetails/component/IdentityComponent/IdentityAu/component/DriversLicense.d.ts +3 -1
  26. package/dist/types/components/PersonalDetails/component/IdentityComponent/IdentityNZ/component/DriversLicense.d.ts +3 -1
  27. package/dist/types/components/RegistrationAddress/types.d.ts +2 -0
  28. package/dist/types/components/SoleProp/component/SolePropComponent.d.ts +1 -1
  29. package/dist/types/components/TaskList/component/TaskListComponent.d.ts +1 -1
  30. package/dist/types/components/TaskList/types.d.ts +0 -3
  31. package/dist/types/components/TrustRegistrationDetails/types.d.ts +2 -1
  32. package/dist/types/components/UIElement/UIElement.d.ts +1 -1
  33. package/dist/types/components/internal/ContextGuidance/ContextGuidance.d.ts +1 -1
  34. package/dist/types/components/internal/ContextGuidance/types.d.ts +2 -0
  35. package/dist/types/components/internal/DBANameField/DBANameField.d.ts +1 -1
  36. package/dist/types/components/internal/DBANameField/types.d.ts +4 -1
  37. package/dist/types/components/internal/FormFields/Checkbox/Checkbox.d.ts +2 -1
  38. package/dist/types/components/internal/FormFields/Dropzone/FilePicker.d.ts +2 -1
  39. package/dist/types/components/internal/FormFields/Dropzone/types.d.ts +2 -0
  40. package/dist/types/components/internal/FormFields/InputBase.d.ts +1 -0
  41. package/dist/types/components/internal/FormFields/RadioGroup/RadioGroup.d.ts +2 -1
  42. package/dist/types/components/internal/FormFields/RadioGroupCard/RadioCardSelect.d.ts +2 -1
  43. package/dist/types/components/internal/FormFields/Select/Select.d.ts +1 -1
  44. package/dist/types/components/internal/FormFields/Select/components/SelectButton.d.ts +1 -1
  45. package/dist/types/components/internal/FormFields/Select/types.d.ts +3 -0
  46. package/dist/types/components/internal/Summary/types.d.ts +3 -2
  47. package/dist/types/core/Context/ExperimentContext/types.d.ts +3 -2
  48. package/dist/types/core/analytics.d.ts +19 -0
  49. package/dist/types/core/hooks/useAnalytics.d.ts +4 -3
  50. package/dist/types/core/hooks/useFormComposer.d.ts +1 -1
  51. package/dist/types/core/models/api/analytics.d.ts +1 -0
  52. package/dist/types/core/user-events.d.ts +65 -21
  53. package/dist/types/core/utils.d.ts +0 -23
  54. package/dist/types/utils/mapping/componentApiMapping.d.ts +11 -4
  55. package/dist/types/utils/trackNavigation.d.ts +6 -8
  56. package/package.json +1 -1
@@ -1,16 +1,120 @@
1
1
  import { jsx, jsxs, Fragment } from "preact/jsx-runtime";
2
2
  import { useContext, useState, useCallback, useEffect, useMemo, useReducer, useId, useRef, useLayoutEffect } from "preact/hooks";
3
+ import { debounce as debounce$1 } from "lodash-es";
3
4
  import { createContext, isValidElement, createElement, render } from "preact";
4
5
  import DOMPurify from "isomorphic-dompurify";
5
6
  import cx from "classnames";
6
7
  import { lazy, Suspense, forwardRef, memo, useMemo as useMemo$1 } from "preact/compat";
7
- import debounce$1 from "lodash-es/debounce";
8
+ import debounce$2 from "lodash-es/debounce";
8
9
  import isISIN from "validator/es/lib/isISIN.js";
9
10
  import { Onfido } from "onfido-sdk-ui";
10
11
  import OpenBankingSDK from "@adyen/openbankingsdk";
11
12
  import { jsxs as jsxs$1, jsx as jsx$1 } from "preact/compat/jsx-runtime";
12
13
  import "@adyen/adyen-document-viewer/dist/adyen-document-viewer.min.css";
13
14
  import AdyenDocumentViewer from "@adyen/adyen-document-viewer";
15
+ class UserEvents {
16
+ constructor() {
17
+ this.queue = [];
18
+ this.subscriptions = /* @__PURE__ */ new Set();
19
+ this.updateSharedEventProperties = (props) => {
20
+ this.sharedEventProperties = { ...this.sharedEventProperties, ...props };
21
+ };
22
+ this.baseTrackingPayload = {
23
+ category: "onboarding",
24
+ subCategory: "hosted onboarding",
25
+ countryCode: void 0,
26
+ capabilities: void 0,
27
+ legalEntityId: void 0,
28
+ task: void 0
29
+ };
30
+ this.sharedEventProperties = {};
31
+ }
32
+ add(...args) {
33
+ this.queue.push(...args);
34
+ }
35
+ notifySubscribers() {
36
+ while (this.queue.length > 0) {
37
+ const lastEvent = this.queue.pop();
38
+ this.subscriptions.forEach((callback) => callback(lastEvent));
39
+ }
40
+ }
41
+ /**
42
+ * Adds an analytics event.
43
+ */
44
+ addEvent(eventName, properties) {
45
+ const completeEvent = { ...this.baseTrackingPayload, ...properties };
46
+ this.add({ type: "add_event", name: eventName, properties: { ...completeEvent } });
47
+ console.log("addevent", "name", eventName, completeEvent);
48
+ this.notifySubscribers();
49
+ }
50
+ /**
51
+ * 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
52
+ */
53
+ startEvent(eventName) {
54
+ this.add({ type: "start_event", name: eventName });
55
+ this.notifySubscribers();
56
+ }
57
+ /**
58
+ * Adds an event with context specific to field-related events
59
+ */
60
+ addFieldEvent(eventName, properties) {
61
+ this.addEvent(eventName, {
62
+ actionLevel: "field",
63
+ page: this.sharedEventProperties.page,
64
+ ...properties
65
+ });
66
+ }
67
+ /**
68
+ * Subscribes a callback to analytics events. It gets called every time
69
+ * one of the above public methods get called, and the event data is passed back as an array.
70
+ * The callback must have a single argument which is an array of [eventName, eventPayload?].
71
+ * @example
72
+ * ```js
73
+ * const callback = ([eventName, eventPayload]) => console.log(eventName, eventPayload);
74
+ * this.subscribe(callback);
75
+ *
76
+ * const exampleEventPayload = { count: 1, segmentation: { foo: 'bar' } };
77
+ * this.addEvent('exampleEventDidOccur', exampleEventPayload);
78
+ *
79
+ * // `callback` will get called with `['exampleEventDidOccur', exampleEventPayload]`
80
+ * ```
81
+ */
82
+ subscribe(callback) {
83
+ this.subscriptions.add(callback);
84
+ }
85
+ /** Sets params that are sent on every event */
86
+ updateBaseTrackingPayload(baseTrackingPayload) {
87
+ this.baseTrackingPayload = { ...this.baseTrackingPayload, ...baseTrackingPayload };
88
+ }
89
+ /**
90
+ * Removes a subscribed callback
91
+ */
92
+ unsubscribe(callback) {
93
+ if (this.subscriptions.has(callback)) {
94
+ this.subscriptions.delete(callback);
95
+ }
96
+ }
97
+ }
98
+ const userEvents = new UserEvents();
99
+ const getAssociatedLeAnalyticsPayload = ({
100
+ task,
101
+ associatedLegalEntity,
102
+ associatedLegalEntityOrg
103
+ }) => ({
104
+ task,
105
+ ...associatedLegalEntity ? {
106
+ associatedLegalEntityId: associatedLegalEntity == null ? void 0 : associatedLegalEntity.id,
107
+ associatedLegalEntityType: associatedLegalEntity == null ? void 0 : associatedLegalEntity.type
108
+ } : {},
109
+ ...associatedLegalEntityOrg ? {
110
+ associatedLegalEntityOrgId: associatedLegalEntityOrg == null ? void 0 : associatedLegalEntityOrg.id,
111
+ associatedLegalEntityOrgType: associatedLegalEntityOrg == null ? void 0 : associatedLegalEntityOrg.type
112
+ } : {}
113
+ });
114
+ const debouncedInputEvent$1 = debounce$1(
115
+ (properties) => userEvents.addFieldEvent("Interacted with form field", properties),
116
+ 500
117
+ );
14
118
  const ConfigurationApiContext = createContext(void 0);
15
119
  const useConfigurationApi = () => {
16
120
  const configurationApi = useContext(ConfigurationApiContext);
@@ -1257,6 +1361,7 @@ const defaultTrans = {
1257
1361
  sortCode: "Sort code",
1258
1362
  ssn: "SSN",
1259
1363
  stamregister: "Stamregister erhverv (SE-nummer)",
1364
+ start: "Start",
1260
1365
  startANewSessionFromTheSamePlaceYouOriginallyAccessed: "Start a new session from the same place you originally accessed this page.",
1261
1366
  startTypingTheAddress: "Start typing the address",
1262
1367
  state: "State",
@@ -2853,12 +2958,13 @@ var ExperimentNames = /* @__PURE__ */ ((ExperimentNames2) => {
2853
2958
  ExperimentNames2["HidePciTask"] = "HidePciTask";
2854
2959
  ExperimentNames2["EnableAgeVerification"] = "EnableAgeVerification";
2855
2960
  ExperimentNames2["PreserveMismatchedInitialValues"] = "PreserveMismatchedInitialValues";
2856
- ExperimentNames2["StrictNameAndAddressValidationV4"] = "StrictNameAndAddressValidationV4";
2857
2961
  ExperimentNames2["EnableNationalitySGHK"] = "EnableNationalitySGHK";
2858
2962
  ExperimentNames2["EnableAUGovernmentalOrganizationSkipRegistrationNumber"] = "EnableAUGovernmentalOrganizationSkipRegistrationNumber";
2859
2963
  ExperimentNames2["EnableMinimalRegistrationNumberValidationForAuIncorporatedAssociation"] = "EnableMinimalRegistrationNumberValidationForAuIncorporatedAssociation";
2860
- ExperimentNames2["EnableFinancialInformationComponentV4"] = "EnableFinancialInformationComponentV4";
2861
2964
  ExperimentNames2["EnablePreferInstantVerificationFlow"] = "EnablePreferInstantVerificationFlow";
2965
+ ExperimentNames2["EnableFinancialInformationComponentV4"] = "EnableFinancialInformationComponentV4";
2966
+ ExperimentNames2["StrictNameAndAddressValidationV4"] = "StrictNameAndAddressValidationV4";
2967
+ ExperimentNames2["EnableLemApiVersionV4"] = "EnableLemApiVersionV4";
2862
2968
  ExperimentNames2["EnablePhoneFieldScenario"] = "EnablePhoneFieldScenario";
2863
2969
  return ExperimentNames2;
2864
2970
  })(ExperimentNames || {});
@@ -3637,6 +3743,16 @@ const Field = ({
3637
3743
  passedValue: focused,
3638
3744
  skipUpdate: focused === void 0
3639
3745
  });
3746
+ useEffect(() => {
3747
+ if (!errorMessage) return;
3748
+ const returnValue = typeof errorMessage === "string" && errorMessage || "invalid";
3749
+ userEvents.addFieldEvent("Encountered error", {
3750
+ actionType: "input",
3751
+ field: label,
3752
+ returnType: "validation",
3753
+ returnValue
3754
+ });
3755
+ }, [label, errorMessage]);
3640
3756
  return /* @__PURE__ */ jsx(
3641
3757
  "div",
3642
3758
  {
@@ -3764,6 +3880,7 @@ function SelectButtonElement({
3764
3880
  return /* @__PURE__ */ jsx("button", { ...props, ref: toggleButtonRef, type: "button" });
3765
3881
  }
3766
3882
  function SelectButton({
3883
+ name,
3767
3884
  active,
3768
3885
  readonly,
3769
3886
  showList,
@@ -3781,14 +3898,25 @@ function SelectButton({
3781
3898
  isMulti,
3782
3899
  id,
3783
3900
  isSearch,
3784
- hideSearchIcon = false,
3785
3901
  loading,
3786
- textFilter
3902
+ hideSearchIcon = false,
3903
+ textFilter,
3904
+ enableTracking = false
3787
3905
  }) {
3788
- const title = (active == null ? void 0 : active.length) ? active.map(({ name }) => name).join(",") : placeholder;
3906
+ const title = (active == null ? void 0 : active.length) ? active.map(({ name: name2 }) => name2).join(",") : placeholder;
3907
+ const handleSelect = (e, callback) => {
3908
+ if (enableTracking) {
3909
+ userEvents.addFieldEvent("Interacted with form field", {
3910
+ actionType: "focus",
3911
+ field: name
3912
+ });
3913
+ }
3914
+ callback(e);
3915
+ };
3789
3916
  return /* @__PURE__ */ jsx(
3790
3917
  SelectButtonElement,
3791
3918
  {
3919
+ name,
3792
3920
  "aria-disabled": readonly,
3793
3921
  "aria-expanded": showList,
3794
3922
  "aria-haspopup": "listbox",
@@ -3801,8 +3929,8 @@ function SelectButton({
3801
3929
  "adyen-kyc-dropdown-button-search": isSearch
3802
3930
  }),
3803
3931
  filterable,
3804
- onClick: !readonly ? toggleList : void 0,
3805
- onKeyDown: !readonly ? onButtonKeyDown : void 0,
3932
+ onClick: !readonly ? (e) => handleSelect(e, toggleList) : void 0,
3933
+ onKeyDown: !readonly ? (e) => handleSelect(e, onButtonKeyDown) : void 0,
3806
3934
  role: filterable || isMulti ? "button" : void 0,
3807
3935
  tabIndex: 0,
3808
3936
  title,
@@ -3905,8 +4033,20 @@ function Checkbox({
3905
4033
  helper,
3906
4034
  checked,
3907
4035
  disabled,
4036
+ enableTracking = false,
3908
4037
  ...props
3909
4038
  }) {
4039
+ const field = typeof label === "string" ? label : props.name;
4040
+ const handleChange = (newValue) => {
4041
+ if (enableTracking) {
4042
+ userEvents.addFieldEvent("Interacted with form field", {
4043
+ actionType: "input",
4044
+ field,
4045
+ returnValue: String(newValue)
4046
+ });
4047
+ }
4048
+ onChange(newValue);
4049
+ };
3910
4050
  return /* @__PURE__ */ jsxs("label", { className: "adyen-kyc-checkbox", children: [
3911
4051
  /* @__PURE__ */ jsx(
3912
4052
  "input",
@@ -3923,7 +4063,7 @@ function Checkbox({
3923
4063
  type: "checkbox",
3924
4064
  onClick: (event) => {
3925
4065
  event.stopPropagation();
3926
- onChange(!checked);
4066
+ handleChange(!checked);
3927
4067
  }
3928
4068
  }
3929
4069
  ),
@@ -4135,7 +4275,8 @@ const Select = ({
4135
4275
  getSearchItem,
4136
4276
  searchText,
4137
4277
  onSearchTextChange,
4138
- showSearchList
4278
+ showSearchList,
4279
+ enableTracking = false
4139
4280
  }) => {
4140
4281
  const filterInputRef = useRef(null);
4141
4282
  const selectContainerRef = useRef(null);
@@ -4147,7 +4288,7 @@ const Select = ({
4147
4288
  const active = items.filter((i) => !isMulti ? i.id === selected : selected == null ? void 0 : selected.includes(i.id)) || [];
4148
4289
  const [isShowListAbove, setIsShowListAbove] = useState(false);
4149
4290
  const [scrollParent, setScrollParent] = useState(null);
4150
- const debouncedOnSearch = useCallback(debounce$1(onSearch, 500), [onSearch]);
4291
+ const debouncedOnSearch = useCallback(debounce$2(onSearch, 500), [onSearch]);
4151
4292
  const closeList = () => {
4152
4293
  if (!onSearchTextChange) setTextFilter(null);
4153
4294
  setIsShowList(false);
@@ -4173,17 +4314,28 @@ const Select = ({
4173
4314
  const hideList = () => {
4174
4315
  setIsShowList(false);
4175
4316
  };
4176
- const handleSelect = (selectedItem) => {
4177
- if (readonly) return;
4178
- if (isMulti) {
4179
- const isAlreadySelected = active.find((item) => item.id === selectedItem.id);
4180
- const newActiveItems = isAlreadySelected ? [...active.filter((i) => i.id !== selectedItem.id).map((i) => i.id)] : [...active.map((i) => i.id), selectedItem.id];
4181
- onChange({ target: { value: newActiveItems, name } });
4182
- } else {
4183
- closeList();
4184
- onChange({ target: { value: selectedItem.id, name } });
4185
- }
4186
- };
4317
+ const handleSelect = useCallback(
4318
+ (selectedItem) => {
4319
+ if (readonly) return;
4320
+ if (isMulti) {
4321
+ const isAlreadySelected = active.find((item) => item.id === selectedItem.id);
4322
+ const newActiveItems = isAlreadySelected ? [...active.filter((i) => i.id !== selectedItem.id).map((i) => i.id)] : [...active.map((i) => i.id), selectedItem.id];
4323
+ onChange({ target: { value: newActiveItems, name } });
4324
+ } else {
4325
+ const handleOnChange = onChange;
4326
+ closeList();
4327
+ handleOnChange({ target: { value: selectedItem.id, name } });
4328
+ }
4329
+ if (enableTracking) {
4330
+ userEvents.addFieldEvent("Interacted with form field", {
4331
+ actionType: "select",
4332
+ field: name
4333
+ });
4334
+ }
4335
+ if (showSearchList) setIsShowList(showSearchList);
4336
+ },
4337
+ [active, closeList, isMulti, name, onChange, readonly, showSearchList, enableTracking]
4338
+ );
4187
4339
  const handleButtonKeyDown = (e) => {
4188
4340
  var _a;
4189
4341
  if (e.key === KEYBOARD_KEYS.enter && filterable && isShowList && textFilter) {
@@ -4244,18 +4396,24 @@ const Select = ({
4244
4396
  break;
4245
4397
  }
4246
4398
  };
4247
- const handleTextFilter = (e) => {
4248
- const { value } = e.target;
4249
- if (isSearch && value.length > 2) {
4250
- debouncedOnSearch(value);
4251
- }
4252
- if (onSearchTextChange) {
4253
- onSearchTextChange == null ? void 0 : onSearchTextChange(value);
4254
- setTextFilter(value);
4255
- } else {
4256
- setTextFilter(value.toLowerCase());
4257
- }
4258
- };
4399
+ const handleTextFilter = useCallback(
4400
+ (e) => {
4401
+ const { value } = e.target;
4402
+ if (enableTracking) {
4403
+ debouncedInputEvent$1({ actionType: "input", field: name });
4404
+ }
4405
+ if (isSearch && value.length > 2) {
4406
+ debouncedOnSearch(value);
4407
+ }
4408
+ if (onSearchTextChange) {
4409
+ onSearchTextChange == null ? void 0 : onSearchTextChange(value);
4410
+ setTextFilter(value);
4411
+ } else {
4412
+ setTextFilter(value.toLowerCase());
4413
+ }
4414
+ },
4415
+ [debouncedOnSearch, isSearch, onSearchTextChange, enableTracking, name]
4416
+ );
4259
4417
  const toggleList = (e) => {
4260
4418
  e.preventDefault();
4261
4419
  if (isShowList) {
@@ -4307,6 +4465,7 @@ const Select = ({
4307
4465
  SelectButton,
4308
4466
  {
4309
4467
  id: uniqueId ?? null,
4468
+ name,
4310
4469
  active,
4311
4470
  filterInputRef,
4312
4471
  filterable,
@@ -4326,7 +4485,8 @@ const Select = ({
4326
4485
  isSearch,
4327
4486
  hideSearchIcon: !!onSearchTextChange,
4328
4487
  loading,
4329
- textFilter
4488
+ textFilter,
4489
+ enableTracking
4330
4490
  }
4331
4491
  ),
4332
4492
  /* @__PURE__ */ jsx(
@@ -4851,15 +5011,24 @@ const useForwardedRef = (forwardedRef) => {
4851
5011
  };
4852
5012
  const convertFullToHalf = (str) => str.replace(/[!-~]/g, (r) => String.fromCharCode(r.charCodeAt(0) - 65248));
4853
5013
  const InputBase = forwardRef((props, ref) => {
4854
- const { classNameModifiers = [], uniqueId, ...passedProps } = props;
4855
- const { isInvalid, isValid, type = "text", disabled } = props;
5014
+ const { classNameModifiers = [], uniqueId, enableTracking = false, ...passedProps } = props;
5015
+ const { isInvalid, isValid, type = "text", disabled, name } = props;
4856
5016
  const handleInput = (e) => {
4857
5017
  var _a;
5018
+ if (enableTracking) {
5019
+ debouncedInputEvent$1({ actionType: "input", field: name });
5020
+ }
4858
5021
  e.target.value = convertFullToHalf(e.target.value);
4859
5022
  (_a = props.onInput) == null ? void 0 : _a.call(props, e);
4860
5023
  };
4861
5024
  const handleBlur = (e) => {
4862
5025
  var _a, _b;
5026
+ if (enableTracking) {
5027
+ userEvents.addFieldEvent("Interacted with form field", {
5028
+ actionType: "blur",
5029
+ field: name
5030
+ });
5031
+ }
4863
5032
  (_a = props.onBlurHandler) == null ? void 0 : _a.call(props, e);
4864
5033
  if (props.trimOnBlur) {
4865
5034
  e.target.value = e.target.value.trim();
@@ -4868,6 +5037,12 @@ const InputBase = forwardRef((props, ref) => {
4868
5037
  };
4869
5038
  const handleFocus = (e) => {
4870
5039
  var _a;
5040
+ if (enableTracking) {
5041
+ userEvents.addFieldEvent("Interacted with form field", {
5042
+ actionType: "focus",
5043
+ field: name
5044
+ });
5045
+ }
4871
5046
  (_a = props.onFocusHandler) == null ? void 0 : _a.call(props, e);
4872
5047
  };
4873
5048
  const inputClassNames = cx(
@@ -4885,6 +5060,7 @@ const InputBase = forwardRef((props, ref) => {
4885
5060
  "input",
4886
5061
  {
4887
5062
  ...passedProps,
5063
+ name,
4888
5064
  "aria-disabled": disabled,
4889
5065
  "aria-invalid": !isValid,
4890
5066
  "aria-required": passedProps.required,
@@ -7592,9 +7768,20 @@ function RadioGroup({
7592
7768
  disabled = false,
7593
7769
  horizontal = false,
7594
7770
  showContentOnlyOnSelected = false,
7595
- className
7771
+ className,
7772
+ enableTracking = false
7596
7773
  }) {
7597
7774
  const { i18n } = useI18nContext();
7775
+ const handleChange = (id) => {
7776
+ if (enableTracking) {
7777
+ userEvents.addFieldEvent("Interacted with form field", {
7778
+ actionType: "input",
7779
+ field: name,
7780
+ returnValue: value
7781
+ });
7782
+ }
7783
+ onChange(id);
7784
+ };
7598
7785
  return /* @__PURE__ */ jsx(
7599
7786
  "div",
7600
7787
  {
@@ -7615,7 +7802,7 @@ function RadioGroup({
7615
7802
  groupName: name,
7616
7803
  checked: isSelected,
7617
7804
  disabled,
7618
- onClick: () => onChange(item.id)
7805
+ onClick: () => handleChange(item.id)
7619
7806
  },
7620
7807
  item.id
7621
7808
  );
@@ -7968,88 +8155,23 @@ function BusinessRegistrationNumberField({
7968
8155
  )
7969
8156
  ] });
7970
8157
  }
7971
- class UserEvents {
7972
- constructor() {
7973
- this.queue = [];
7974
- this.subscriptions = /* @__PURE__ */ new Set();
7975
- }
7976
- add(...args) {
7977
- this.queue.push(...args);
7978
- }
7979
- notifySubscribers() {
7980
- while (this.queue.length > 0) {
7981
- const lastEvent = this.queue.pop();
7982
- this.subscriptions.forEach((callback) => callback(lastEvent));
7983
- }
7984
- }
7985
- /**
7986
- * Adds an analytics event. Optionally can include a payload.
7987
- */
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]);
7998
- this.notifySubscribers();
7999
- }
8000
- /**
8001
- * Starts a new event which is expected to be ended with `endEvent` eventually
8002
- */
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]);
8012
- this.notifySubscribers();
8013
- }
8014
- /**
8015
- * Subscribes a callback to analytics events. It gets called every time
8016
- * one of the above public methods get called, and the event data is passed back as an array.
8017
- * The callback must have a single argument which is an array of [eventName, eventPayload?].
8018
- * @example
8019
- * ```js
8020
- * const callback = ([eventName, eventPayload]) => console.log(eventName, eventPayload);
8021
- * this.subscribe(callback);
8022
- *
8023
- * const exampleEventPayload = { count: 1, segmentation: { foo: 'bar' } };
8024
- * this.addEvent('exampleEventDidOccur', exampleEventPayload);
8025
- *
8026
- * // `callback` will get called with `['exampleEventDidOccur', exampleEventPayload]`
8027
- * ```
8028
- */
8029
- subscribe(callback) {
8030
- this.subscriptions.add(callback);
8031
- }
8032
- /**
8033
- * Removes a subscribed callback
8034
- */
8035
- unsubscribe(callback) {
8036
- if (this.subscriptions.has(callback)) {
8037
- this.subscriptions.delete(callback);
8038
- }
8039
- }
8040
- }
8041
- const userEvents = new UserEvents();
8042
8158
  function ContextGuidance({
8043
8159
  page,
8044
8160
  title,
8045
8161
  content,
8046
8162
  titleId,
8047
- contentId
8163
+ contentId,
8164
+ baseTrackingPayload
8048
8165
  }) {
8049
8166
  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 }
8167
+ userEvents.addEvent("Clicked accordion", {
8168
+ ...baseTrackingPayload,
8169
+ actionType: status,
8170
+ actionLevel: "field",
8171
+ field: "context guidance",
8172
+ page,
8173
+ label: titleId,
8174
+ content: contentId
8053
8175
  });
8054
8176
  };
8055
8177
  return /* @__PURE__ */ jsx(Alert, { title, type: "collapsible", variant: "info", onToggle: onGuidanceToggle, children: content });
@@ -8130,6 +8252,96 @@ const dateOfIncorporationFieldMetadata = {
8130
8252
  }
8131
8253
  ]
8132
8254
  };
8255
+ const DBA_NAME_FIELD = ["hasDba", "dbaName"];
8256
+ function DBANameField({
8257
+ data,
8258
+ valid,
8259
+ errors,
8260
+ labels: labels2,
8261
+ legalCompanyName,
8262
+ helperText,
8263
+ readonly,
8264
+ handleChangeFor,
8265
+ setErrors
8266
+ }) {
8267
+ const { i18n } = useI18nContext();
8268
+ const { isExperimentEnabled } = useExperimentsContext();
8269
+ const isLemApiVersionV4Enabled = isExperimentEnabled(ExperimentNames.EnableLemApiVersionV4);
8270
+ const selection = useMemo(() => {
8271
+ if (typeof data.hasDba === "undefined") return;
8272
+ if (!data.hasDba) setErrors == null ? void 0 : setErrors("dbaName", null);
8273
+ return data.hasDba ? "yes" : "no";
8274
+ }, [data.hasDba, setErrors]);
8275
+ const handleDbaChange = (selectedValue) => {
8276
+ const isYes = selectedValue === "yes";
8277
+ const isNo = selectedValue === "no";
8278
+ handleChangeFor("hasDba")(isYes);
8279
+ if (isLemApiVersionV4Enabled) {
8280
+ handleChangeFor("doingBusinessAbsent")(isNo);
8281
+ if (isNo) {
8282
+ handleChangeFor("dbaName")(legalCompanyName);
8283
+ }
8284
+ }
8285
+ };
8286
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
8287
+ /* @__PURE__ */ jsx(
8288
+ Field,
8289
+ {
8290
+ name: "hasDba",
8291
+ label: labels2.hasDba ?? i18n.get("hasDba"),
8292
+ helper: (helperText == null ? void 0 : helperText.hasDba) ?? i18n.get("hasDba__helperText"),
8293
+ isValid: valid.hasDba,
8294
+ errorMessage: errors.hasDba,
8295
+ children: (childProps) => /* @__PURE__ */ jsx(
8296
+ RadioGroup,
8297
+ {
8298
+ ...childProps,
8299
+ name: "hasDba",
8300
+ items: [
8301
+ { id: "yes", name: "yes" },
8302
+ { id: "no", name: "no" }
8303
+ ],
8304
+ value: selection,
8305
+ onChange: handleDbaChange,
8306
+ horizontal: true
8307
+ }
8308
+ )
8309
+ }
8310
+ ),
8311
+ data.hasDba && /* @__PURE__ */ jsx(
8312
+ Field,
8313
+ {
8314
+ name: "dbaName",
8315
+ label: labels2.dbaName ?? i18n.get("dbaName"),
8316
+ errorMessage: errors.dbaName,
8317
+ isValid: valid.dbaName,
8318
+ classNameModifiers: ["dbaName"],
8319
+ children: (childProps) => /* @__PURE__ */ jsx(
8320
+ InputText,
8321
+ {
8322
+ ...childProps,
8323
+ "aria-required": true,
8324
+ "aria-label": labels2.dbaName ?? i18n.get("dbaName"),
8325
+ "aria-invalid": !valid.dbaName,
8326
+ name: "dbaName",
8327
+ value: data.dbaName,
8328
+ readonly,
8329
+ classNameModifiers: ["dbaName"],
8330
+ onInput: handleChangeFor("dbaName", "input"),
8331
+ onBlur: handleChangeFor("dbaName", "blur")
8332
+ }
8333
+ )
8334
+ }
8335
+ )
8336
+ ] });
8337
+ }
8338
+ const hasDbaFieldMetadata = {
8339
+ validators: [validateNotEmptyOnBlur]
8340
+ };
8341
+ const dbaNameFieldMetadata = {
8342
+ label: "dbaName",
8343
+ validators: [validateNotEmptyOnBlur]
8344
+ };
8133
8345
  const inferCompanyRegistrationNumberType = (registrationNumber, country, companyType) => {
8134
8346
  const optionsForCountry = companyRegistrationNumberOptions[country];
8135
8347
  const metadataFn = defaultFieldConfig$9[country];
@@ -9865,6 +10077,46 @@ function VatNumberField({
9865
10077
  )
9866
10078
  ] });
9867
10079
  }
10080
+ var TaskTypes = /* @__PURE__ */ ((TaskTypes2) => {
10081
+ TaskTypes2["BUSINESS_TYPE_SELECTION"] = "BUSINESS_TYPE_SELECTION";
10082
+ TaskTypes2["INTRODUCTION"] = "INTRODUCTION";
10083
+ TaskTypes2["TASKS_OVERVIEW"] = "TASKS_OVERVIEW";
10084
+ TaskTypes2["REVIEW"] = "REVIEW";
10085
+ TaskTypes2["INDIVIDUAL"] = "INDIVIDUAL";
10086
+ TaskTypes2["COMPANY"] = "COMPANY";
10087
+ TaskTypes2["BUSINESS_DETAILS"] = "BUSINESS_DETAILS";
10088
+ TaskTypes2["PAYOUT"] = "PAYOUT";
10089
+ TaskTypes2["PAYIN"] = "PAYIN";
10090
+ TaskTypes2["SERVICE_AGREEMENT"] = "SERVICE_AGREEMENT";
10091
+ TaskTypes2["PCI_DSS"] = "PCI_DSS";
10092
+ TaskTypes2["DECISION_MAKER"] = "DECISION_MAKER";
10093
+ TaskTypes2["DECISION_MAKER_OVERVIEW"] = "DECISION_MAKER_OVERVIEW";
10094
+ TaskTypes2["TRUST"] = "TRUST";
10095
+ TaskTypes2["TRUST_MEMBER_OVERVIEW"] = "TRUST_MEMBER";
10096
+ TaskTypes2["TRUST_MEMBER_INDIVIDUAL"] = "TRUST_MEMBER_INDIVIDUAL";
10097
+ TaskTypes2["TRUST_MEMBER_COMPANY"] = "TRUST_MEMBER_COMPANY";
10098
+ TaskTypes2["TRUST_MEMBER_ROLE_AND_TYPE"] = "TRUST_MEMBER_ROLE_AND_TYPE";
10099
+ TaskTypes2["TRUST_MEMBER_COMPANY_OWNER"] = "TRUST_MEMBER_COMPANY_OWNER";
10100
+ TaskTypes2["SOLE_PROPRIETOR_COMPANY"] = "SOLE_PROPRIETOR_COMPANY";
10101
+ TaskTypes2["LEGAL_ENTITY_TYPE_SWITCHER"] = "LEGAL_ENTITY_TYPE_SWITCHER";
10102
+ TaskTypes2["CAPABILITY_REJECTED"] = "CAPABILITY_REJECTED";
10103
+ TaskTypes2["SINGPASS_SELECTION"] = "SINGPASS_SELECTION";
10104
+ TaskTypes2["LEGAL_REPRESENTATIVE_DETAILS"] = "LEGAL_REPRESENTATIVE_DETAILS";
10105
+ return TaskTypes2;
10106
+ })(TaskTypes || {});
10107
+ var TaskStatus = /* @__PURE__ */ ((TaskStatus2) => {
10108
+ TaskStatus2[TaskStatus2["EMPTY"] = 0] = "EMPTY";
10109
+ TaskStatus2[TaskStatus2["FINISHED"] = 1] = "FINISHED";
10110
+ TaskStatus2[TaskStatus2["PROCESSING"] = 2] = "PROCESSING";
10111
+ TaskStatus2[TaskStatus2["DETAILS_REQUIRED"] = 3] = "DETAILS_REQUIRED";
10112
+ TaskStatus2[TaskStatus2["SIGN"] = 4] = "SIGN";
10113
+ TaskStatus2[TaskStatus2["DOWNLOAD"] = 5] = "DOWNLOAD";
10114
+ TaskStatus2[TaskStatus2["ERROR"] = 6] = "ERROR";
10115
+ TaskStatus2[TaskStatus2["SIGNED"] = 7] = "SIGNED";
10116
+ TaskStatus2[TaskStatus2["SUBMIT"] = 8] = "SUBMIT";
10117
+ TaskStatus2[TaskStatus2["REMOVING"] = 9] = "REMOVING";
10118
+ return TaskStatus2;
10119
+ })(TaskStatus || {});
9868
10120
  const FLOWS_THAT_HIDE_REGISTRATION_NUMBER = [
9869
10121
  { companyType: [CompanyTypesValue.SOLE_PROPRIETORSHIP], country: CountryCodes.Gibraltar },
9870
10122
  { companyType: [CompanyTypesValue.SOLE_PROPRIETORSHIP], country: CountryCodes.Guernsey },
@@ -9875,6 +10127,7 @@ const FLOWS_THAT_HIDE_REGISTRATION_NUMBER = [
9875
10127
  ];
9876
10128
  const companyRegistrationDetailsFields = [
9877
10129
  ...TRADING_NAME_FIELD,
10130
+ ...DBA_NAME_FIELD,
9878
10131
  ...BUSINESS_REGISTRATION_NUMBER_FIELD,
9879
10132
  ...STOCK_EXCHANGE_MIC_FIELD,
9880
10133
  ...STOCK_ISIN_FIELD,
@@ -9889,6 +10142,7 @@ function CompanyRegistrationDetailsComponent(props) {
9889
10142
  const COMPANY_REGISTRATION_DETAILS = mergedProps.id ?? "companyRegistrationDetails";
9890
10143
  const { i18n } = useI18nContext();
9891
10144
  const { isExperimentEnabled } = useExperimentsContext();
10145
+ const isLemApiVersionV4Enabled = isExperimentEnabled(ExperimentNames.EnableLemApiVersionV4);
9892
10146
  const { companyNameAndCountry } = useGlobalData();
9893
10147
  const { updateStateSlice } = useGlobalDataSlice(COMPANY_REGISTRATION_DETAILS);
9894
10148
  const country = (companyNameAndCountry == null ? void 0 : companyNameAndCountry.country) ?? mergedProps.country;
@@ -9923,6 +10177,16 @@ function CompanyRegistrationDetailsComponent(props) {
9923
10177
  tradingNameFieldMetadata,
9924
10178
  mergedProps
9925
10179
  );
10180
+ mergedProps = mergeFieldMetadataIntoProps(
10181
+ "hasDba",
10182
+ hasDbaFieldMetadata,
10183
+ mergedProps
10184
+ );
10185
+ mergedProps = mergeFieldMetadataIntoProps(
10186
+ "dbaName",
10187
+ dbaNameFieldMetadata,
10188
+ mergedProps
10189
+ );
9926
10190
  mergedProps = mergeFieldMetadataIntoProps(
9927
10191
  "stockExchangeMIC",
9928
10192
  stockExchangeMICFieldMetadata,
@@ -9983,6 +10247,9 @@ function CompanyRegistrationDetailsComponent(props) {
9983
10247
  if (currentData.sameNameAsLegalName) {
9984
10248
  fieldsToRemove.push("tradingName");
9985
10249
  }
10250
+ if (!currentData.hasDba) {
10251
+ fieldsToRemove.push("dbaName");
10252
+ }
9986
10253
  if (currentData.exemptedFromVat) {
9987
10254
  fieldsToRemove.push("vatNumber");
9988
10255
  } else {
@@ -10005,7 +10272,7 @@ function CompanyRegistrationDetailsComponent(props) {
10005
10272
  },
10006
10273
  [requiredFields]
10007
10274
  );
10008
- const { schema, data, valid, errors, fieldProblems, handleChangeFor } = useForm({
10275
+ const { schema, data, valid, errors, fieldProblems, handleChangeFor, setErrors } = useForm({
10009
10276
  ...mergedProps,
10010
10277
  schema: getFormSchema2,
10011
10278
  defaultData: mergedProps.data,
@@ -10040,11 +10307,12 @@ function CompanyRegistrationDetailsComponent(props) {
10040
10307
  title: i18n.get("whyDoINeedToFillInThisInformation"),
10041
10308
  content: i18n.get("reasonForFillingCompanyRegistrationDetails"),
10042
10309
  titleId: "whyDoINeedToFillInThisInformation",
10043
- contentId: "reasonForFillingCompanyRegistrationDetails"
10310
+ contentId: "reasonForFillingCompanyRegistrationDetails",
10311
+ baseTrackingPayload: { task: TaskTypes.COMPANY }
10044
10312
  }
10045
10313
  ),
10046
10314
  /* @__PURE__ */ jsxs("fieldset", { form: COMPANY_REGISTRATION_DETAILS, children: [
10047
- formUtils.isRequiredField("tradingName") && /* @__PURE__ */ jsx("div", { className: "adyen-kyc-field-wrapper", children: /* @__PURE__ */ jsx(
10315
+ !isLemApiVersionV4Enabled && formUtils.isRequiredField("tradingName") && /* @__PURE__ */ jsx("div", { className: "adyen-kyc-field-wrapper", children: /* @__PURE__ */ jsx(
10048
10316
  TradingNameField,
10049
10317
  {
10050
10318
  data: formUtils.getFieldData(data, TRADING_NAME_FIELD),
@@ -10056,6 +10324,21 @@ function CompanyRegistrationDetailsComponent(props) {
10056
10324
  legalCompanyName
10057
10325
  }
10058
10326
  ) }),
10327
+ isLemApiVersionV4Enabled && formUtils.isRequiredField("dbaName") && /* @__PURE__ */ jsx("div", { className: "adyen-kyc-field-wrapper", children: /* @__PURE__ */ jsx(
10328
+ DBANameField,
10329
+ {
10330
+ data: formUtils.getFieldData(data, DBA_NAME_FIELD),
10331
+ valid: formUtils.getFieldValid(valid, DBA_NAME_FIELD),
10332
+ errors: formUtils.getFieldErrors(errors, fieldProblems, DBA_NAME_FIELD),
10333
+ labels: formUtils.getFieldLabels(DBA_NAME_FIELD, {
10334
+ hasDba: "hasDba"
10335
+ }),
10336
+ legalCompanyName,
10337
+ readonly: formUtils.isReadOnly("dbaName"),
10338
+ handleChangeFor,
10339
+ setErrors
10340
+ }
10341
+ ) }),
10059
10342
  formUtils.isRequiredField("stockExchangeMIC") && /* @__PURE__ */ jsx("div", { className: "adyen-kyc-field-wrapper", children: /* @__PURE__ */ jsx(
10060
10343
  StockExchangeMICField,
10061
10344
  {
@@ -10212,7 +10495,9 @@ const companyBase = {
10212
10495
  stockExchangeMIC: { rule: "ifPubliclyTradedCompany" },
10213
10496
  stockISIN: { rule: "ifPubliclyTradedCompany" },
10214
10497
  stockTickerSymbol: { rule: "ifPubliclyTradedCompany" },
10215
- tradingName: { rule: "REQUIRED" },
10498
+ tradingName: { rule: "isLemApiVersionV4Disabled" },
10499
+ dbaName: { rule: "isLemApiVersionV4Enabled" },
10500
+ hasDba: { rule: "isLemApiVersionV4Enabled" },
10216
10501
  dateOfIncorporation: { rule: "countryRequiresDateOfIncorporationForCompanies" },
10217
10502
  exemptedFromRegistrationNumber: { rule: "companyRegistrationNumberExemptionAllowed" },
10218
10503
  registrationNumber: { rule: "countryRequiresRegistrationNumberForCompanies" },
@@ -10227,6 +10512,7 @@ const businessDetailsBase = {
10227
10512
  hasDba: { rule: "REQUIRED" },
10228
10513
  dbaName: { rule: "REQUIRED" },
10229
10514
  registrationAddress: { rule: "REQUIRED" },
10515
+ operationalAddressIsSame: { rule: "REQUIRED" },
10230
10516
  /* Base optional fields */
10231
10517
  operationalAddress: { rule: "OPTIONAL" },
10232
10518
  /* Fields with custom country specific rules */
@@ -10726,7 +11012,7 @@ const isExistingFile = (file) => "existing" in file && file.existing;
10726
11012
  const isNewlyUploadedFile = (file) => !isExistingFile(file);
10727
11013
  function DropzoneFile(props) {
10728
11014
  var _a;
10729
- const { file, errorMessage, onDelete } = props;
11015
+ const { label, file, errorMessage, onDelete } = props;
10730
11016
  const { i18n } = useI18nContext();
10731
11017
  let documentIcon;
10732
11018
  const formatSize = (bytes) => {
@@ -10743,6 +11029,15 @@ function DropzoneFile(props) {
10743
11029
  default:
10744
11030
  documentIcon = "document";
10745
11031
  }
11032
+ useEffect(() => {
11033
+ if (!errorMessage) return;
11034
+ userEvents.addFieldEvent("Encountered error", {
11035
+ actionType: "change",
11036
+ field: label || "dropzone",
11037
+ returnType: "validation",
11038
+ returnValue: errorMessage
11039
+ });
11040
+ }, [label, errorMessage]);
10746
11041
  return /* @__PURE__ */ jsxs(
10747
11042
  "div",
10748
11043
  {
@@ -10855,7 +11150,8 @@ function Dropzone(props) {
10855
11150
  isOptional,
10856
11151
  maxNumberOfFiles = defaultFileValidationOptions.maxNumberOfFiles,
10857
11152
  maxSize = defaultFileValidationOptions.maxSize,
10858
- allowedFileTypes = defaultFileValidationOptions.allowedFileTypes
11153
+ allowedFileTypes = defaultFileValidationOptions.allowedFileTypes,
11154
+ enableTracking = false
10859
11155
  } = props;
10860
11156
  const { i18n } = useI18nContext();
10861
11157
  const fileInput = useRef(null);
@@ -10930,6 +11226,12 @@ function Dropzone(props) {
10930
11226
  };
10931
11227
  const handleFileChange = (e) => updateFiles(e.target);
10932
11228
  const updateFiles = ({ files }) => {
11229
+ if (enableTracking) {
11230
+ userEvents.addFieldEvent("Interacted with form field", {
11231
+ actionType: "change",
11232
+ field: label || "file picker"
11233
+ });
11234
+ }
10933
11235
  const currentFiles = (data == null ? void 0 : data[name]) || [];
10934
11236
  handleChangeFor(name, "input")([...currentFiles, ...files]);
10935
11237
  };
@@ -10965,6 +11267,7 @@ function Dropzone(props) {
10965
11267
  return /* @__PURE__ */ jsx(
10966
11268
  DropzoneFile,
10967
11269
  {
11270
+ label,
10968
11271
  file,
10969
11272
  onDelete: () => handleFileDelete(file),
10970
11273
  errorMessage: (_a2 = errors == null ? void 0 : errors[name]) == null ? void 0 : _a2.errorMessage
@@ -11014,6 +11317,10 @@ function Dropzone(props) {
11014
11317
  ] });
11015
11318
  }
11016
11319
  const logger$z = createLogger("TextArea");
11320
+ const debouncedInputEvent = debounce$2(
11321
+ (properties) => userEvents.addFieldEvent("Interacted with form field", properties),
11322
+ 500
11323
+ );
11017
11324
  function TextArea(props) {
11018
11325
  const { classNameModifiers, uniqueId, ...passedProps } = props;
11019
11326
  const {
@@ -11023,7 +11330,9 @@ function TextArea(props) {
11023
11330
  readonly = null,
11024
11331
  spellCheck,
11025
11332
  disabled,
11026
- maxLength
11333
+ maxLength,
11334
+ enableTracking = false,
11335
+ name
11027
11336
  } = props;
11028
11337
  const { i18n } = useI18nContext();
11029
11338
  const [value, setValue] = useState("");
@@ -11032,12 +11341,24 @@ function TextArea(props) {
11032
11341
  }
11033
11342
  const handleInput = (e) => {
11034
11343
  var _a;
11344
+ if (enableTracking) {
11345
+ debouncedInputEvent({
11346
+ actionType: "input",
11347
+ field: name
11348
+ });
11349
+ }
11035
11350
  e.target.value = convertFullToHalf(e.target.value);
11036
11351
  setValue(e.target.value);
11037
11352
  (_a = props == null ? void 0 : props.onInput) == null ? void 0 : _a.call(props, e);
11038
11353
  };
11039
11354
  const handleBlur = (e) => {
11040
11355
  var _a, _b;
11356
+ if (enableTracking) {
11357
+ userEvents.addFieldEvent("Interacted with form field", {
11358
+ actionType: "blur",
11359
+ field: name
11360
+ });
11361
+ }
11041
11362
  (_a = props == null ? void 0 : props.onBlurHandler) == null ? void 0 : _a.call(props, e);
11042
11363
  if (props.trimOnBlur) {
11043
11364
  e.target.value = e.target.value.trim();
@@ -11046,6 +11367,12 @@ function TextArea(props) {
11046
11367
  };
11047
11368
  const handleFocus = (e) => {
11048
11369
  var _a;
11370
+ if (enableTracking) {
11371
+ userEvents.addFieldEvent("Interacted with form field", {
11372
+ actionType: "focus",
11373
+ field: name
11374
+ });
11375
+ }
11049
11376
  (_a = props == null ? void 0 : props.onFocusHandler) == null ? void 0 : _a.call(props, e);
11050
11377
  };
11051
11378
  const inputClassNames = cx(
@@ -13066,9 +13393,13 @@ function AddressComponent({
13066
13393
  shouldValidate
13067
13394
  });
13068
13395
  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]) ?? " ")),
13396
+ () => {
13397
+ if (verifiedAddress) {
13398
+ entriesOf(verifiedAddress).forEach(([key, value]) => {
13399
+ if (formData[key] !== value) handleChangeFor(key, "input")(value);
13400
+ });
13401
+ }
13402
+ },
13072
13403
  // eslint-disable-next-line react-hooks/exhaustive-deps
13073
13404
  [verifiedAddress]
13074
13405
  );
@@ -13128,9 +13459,9 @@ function AddressComponent({
13128
13459
  fieldName
13129
13460
  );
13130
13461
  };
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) {
13462
+ if (condensed && (formData == null ? void 0 : formData.country)) {
13463
+ const condensedFields = CONDENSED_ADDRESS_FIELDS[formData.country] ?? [];
13464
+ switch (formData == null ? void 0 : formData.country) {
13134
13465
  case "US":
13135
13466
  return /* @__PURE__ */ jsxs("fieldset", { className: "adyen-kyc-address", children: [
13136
13467
  formSchema.filter((field) => !condensedFields.includes(field)).map((filteredField) => createFieldComponent(filteredField)),
@@ -13198,7 +13529,8 @@ function RegistrationAddressComponent(props) {
13198
13529
  handleFindAddress,
13199
13530
  country,
13200
13531
  data,
13201
- validators: validators2
13532
+ validators: validators2,
13533
+ baseTrackingPayload
13202
13534
  } = props;
13203
13535
  const {
13204
13536
  requiredFields: registrationAddressRequiredFields,
@@ -13288,7 +13620,8 @@ function RegistrationAddressComponent(props) {
13288
13620
  titleId: "whyDoINeedToFillInThisInformation",
13289
13621
  contentId: "reasonForFillingCompanyAddressDetails",
13290
13622
  title: i18n.get("whyDoINeedToFillInThisInformation"),
13291
- content: i18n.get("reasonForFillingCompanyAddressDetails")
13623
+ content: i18n.get("reasonForFillingCompanyAddressDetails"),
13624
+ baseTrackingPayload
13292
13625
  }
13293
13626
  ),
13294
13627
  /* @__PURE__ */ jsx(
@@ -13714,7 +14047,8 @@ function CompanyComponent(props) {
13714
14047
  country: props.country,
13715
14048
  problems: props.problems,
13716
14049
  handleAddressSearch: props.handleAddressSearch,
13717
- handleFindAddress: props.handleFindAddress
14050
+ handleFindAddress: props.handleFindAddress,
14051
+ baseTrackingPayload: { task: TaskTypes.COMPANY }
13718
14052
  }
13719
14053
  )
13720
14054
  }
@@ -13946,46 +14280,6 @@ const fileToBase64 = (file) => new Promise((resolve, reject) => {
13946
14280
  reader.onerror = (error) => reject(error);
13947
14281
  });
13948
14282
  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
14283
  const COUNTRIES_THAT_DONT_REQUIRE_SOLE_PROP_REGISTRATION = [
13990
14284
  CountryCodes.Australia,
13991
14285
  CountryCodes.Gibraltar,
@@ -14183,6 +14477,16 @@ const rules$3 = ({
14183
14477
  if (isExperimentEnabled("EnableFinancialInformationComponentV4") && COUNTRIES_REQUIRING_FINANCIAL_INFORMATION.includes(country)) {
14184
14478
  return "REQUIRED";
14185
14479
  }
14480
+ },
14481
+ isLemApiVersionV4Enabled: () => {
14482
+ if (isExperimentEnabled("EnableLemApiVersionV4")) {
14483
+ return "REQUIRED";
14484
+ }
14485
+ },
14486
+ isLemApiVersionV4Disabled: () => {
14487
+ if (!isExperimentEnabled("EnableLemApiVersionV4")) {
14488
+ return "REQUIRED";
14489
+ }
14186
14490
  }
14187
14491
  });
14188
14492
  var LegalEntityType = /* @__PURE__ */ ((LegalEntityType2) => {
@@ -14294,6 +14598,7 @@ const businessDetailsBaseMapping = {
14294
14598
  "additionalInformation.legalCompanyName": "organization.legalName",
14295
14599
  "additionalInformation.legalFormDescription": "organization.legalFormDescription",
14296
14600
  "additionalInformation.dbaName": "organization.doingBusinessAs",
14601
+ "additionalInformation.doingBusinessAbsent": "organization.doingBusinessAbsent",
14297
14602
  "additionalInformation.registrationNumber": "organization.registrationNumber",
14298
14603
  "additionalInformation.taxInformation": "organization.taxInformation",
14299
14604
  "additionalInformation.vatNumber": "organization.vatNumber",
@@ -14321,6 +14626,8 @@ const companyBaseMapping = {
14321
14626
  "companyNameAndCountry.countryOfGoverningLaw": "organization.countryOfGoverningLaw",
14322
14627
  "companyType.entityType": "organization.type",
14323
14628
  "companyRegistrationDetails.tradingName": "organization.doingBusinessAs",
14629
+ "companyRegistrationDetails.dbaName": "organization.doingBusinessAs",
14630
+ "companyRegistrationDetails.doingBusinessAbsent": "organization.doingBusinessAbsent",
14324
14631
  "companyRegistrationDetails.registrationNumber": "organization.registrationNumber",
14325
14632
  "companyRegistrationDetails.taxInformation": "organization.taxInformation",
14326
14633
  "companyRegistrationDetails.vatNumber": "organization.vatNumber",
@@ -14345,6 +14652,8 @@ const companyBaseMapping = {
14345
14652
  const trustBaseMapping = {
14346
14653
  "trustRegistrationDetails.trustType": "trust.type",
14347
14654
  "trustRegistrationDetails.legalName": "trust.name",
14655
+ "trustRegistrationDetails.dbaName": "trust.doingBusinessAs",
14656
+ "trustRegistrationDetails.doingBusinessAbsent": "trust.doingBusinessAbsent",
14348
14657
  "trustRegistrationDetails.country": "trust.countryOfGoverningLaw",
14349
14658
  "trustRegistrationDetails.registrationNumber": "trust.registrationNumber",
14350
14659
  "trustRegistrationAddress.registrationAddress.city": "trust.registeredAddress.city",
@@ -14364,6 +14673,8 @@ const solePropBaseMapping = {
14364
14673
  "solePropNameAndCountry.country": "soleProprietorship.countryOfGoverningLaw",
14365
14674
  "solePropNameAndCountry.legalCompanyName": "soleProprietorship.name",
14366
14675
  "solePropRegistrationDetails.tradingName": "soleProprietorship.doingBusinessAs",
14676
+ "solePropRegistrationDetails.dbaName": "soleProprietorship.doingBusinessAs",
14677
+ "solePropRegistrationDetails.doingBusinessAbsent": "soleProprietorship.doingBusinessAbsent",
14367
14678
  "solePropRegistrationDetails.vatNumber": "soleProprietorship.vatNumber",
14368
14679
  "solePropRegistrationDetails.vatAbsenceReason": "soleProprietorship.vatAbsenceReason",
14369
14680
  "solePropRegistrationDetails.exemptedFromTax": "soleProprietorship.taxAbsent",
@@ -15522,27 +15833,40 @@ const RadioCardSelect = ({
15522
15833
  renderOptionBody,
15523
15834
  renderOptionFooter,
15524
15835
  isOptionDisabled,
15525
- floatingRadio
15526
- }) => /* @__PURE__ */ jsx("div", { className: className ?? "adyen-kyc-radio-group-card", children: options.map((option) => /* @__PURE__ */ jsx(
15527
- RadioCard,
15528
- {
15529
- optionId: optionId(option),
15530
- optionName: optionName(option),
15531
- optionDescription: optionDescription == null ? void 0 : optionDescription(option),
15532
- optionSubtitle: optionSubtitle == null ? void 0 : optionSubtitle(option),
15533
- isInvalid,
15534
- isSelected: selected === option,
15535
- onSelect: () => onSelect(option),
15536
- name,
15537
- classNames: optionClassNames == null ? void 0 : optionClassNames(option),
15538
- icon: renderOptionIcon == null ? void 0 : renderOptionIcon(option),
15539
- body: renderOptionBody == null ? void 0 : renderOptionBody(option),
15540
- footer: renderOptionFooter == null ? void 0 : renderOptionFooter(option),
15541
- disabled: isOptionDisabled == null ? void 0 : isOptionDisabled(option),
15542
- floatingRadio
15543
- },
15544
- optionId(option)
15545
- )) });
15836
+ floatingRadio,
15837
+ enableTracking = false
15838
+ }) => {
15839
+ const handleSelect = (option) => {
15840
+ if (enableTracking) {
15841
+ userEvents.addFieldEvent("Interacted with form field", {
15842
+ actionType: "input",
15843
+ field: name,
15844
+ returnValue: typeof option === "string" ? option : void 0
15845
+ });
15846
+ }
15847
+ onSelect(option);
15848
+ };
15849
+ return /* @__PURE__ */ jsx("div", { className: className ?? "adyen-kyc-radio-group-card", children: options.map((option) => /* @__PURE__ */ jsx(
15850
+ RadioCard,
15851
+ {
15852
+ optionId: optionId(option),
15853
+ optionName: optionName(option),
15854
+ optionDescription: optionDescription == null ? void 0 : optionDescription(option),
15855
+ optionSubtitle: optionSubtitle == null ? void 0 : optionSubtitle(option),
15856
+ isInvalid,
15857
+ isSelected: selected === option,
15858
+ onSelect: () => handleSelect(option),
15859
+ name,
15860
+ classNames: optionClassNames == null ? void 0 : optionClassNames(option),
15861
+ icon: renderOptionIcon == null ? void 0 : renderOptionIcon(option),
15862
+ body: renderOptionBody == null ? void 0 : renderOptionBody(option),
15863
+ footer: renderOptionFooter == null ? void 0 : renderOptionFooter(option),
15864
+ disabled: isOptionDisabled == null ? void 0 : isOptionDisabled(option),
15865
+ floatingRadio
15866
+ },
15867
+ optionId(option)
15868
+ )) });
15869
+ };
15546
15870
  const idVerificationMethodsMetadata = {
15547
15871
  instantVerification: {
15548
15872
  name: "instantVerification",
@@ -15680,7 +16004,8 @@ function IdVerificationMethodComponent(props) {
15680
16004
  /* @__PURE__ */ jsx(Link, { href: "https://www.adyen.com/policies-and-disclaimer/privacy-policy", external: true, children: i18n.get("learnMore") })
15681
16005
  ] }),
15682
16006
  titleId: "howVerificationWithOnfidoWork",
15683
- contentId: "howVerificationWithOnfidoWorkContent"
16007
+ contentId: "howVerificationWithOnfidoWorkContent",
16008
+ baseTrackingPayload: { task: TaskTypes.INDIVIDUAL }
15684
16009
  }
15685
16010
  ),
15686
16011
  (countryOfResidence === CountryCodes.PuertoRico || countryOfResidence === CountryCodes.UnitedStates) && data.idVerificationMethod === "instantVerification" && /* @__PURE__ */ jsx(
@@ -16742,6 +17067,8 @@ const trustBase = {
16742
17067
  legalName: {
16743
17068
  rule: "REQUIRED"
16744
17069
  },
17070
+ dbaName: { rule: "isLemApiVersionV4Enabled" },
17071
+ hasDba: { rule: "isLemApiVersionV4Enabled" },
16745
17072
  country: {
16746
17073
  rule: "REQUIRED"
16747
17074
  },
@@ -17282,7 +17609,8 @@ const DriversLicense$1 = ({
17282
17609
  formUtils,
17283
17610
  isValid,
17284
17611
  errorMessages,
17285
- shouldValidate
17612
+ shouldValidate,
17613
+ baseTrackingPayload
17286
17614
  }) => {
17287
17615
  const { i18n } = useI18nContext();
17288
17616
  const { dataset: auStates } = useDataset(datasetIdentifier.state("AU"));
@@ -17362,7 +17690,8 @@ const DriversLicense$1 = ({
17362
17690
  /* @__PURE__ */ jsx(Link, { href: "https://www.usi.gov.au/about/forms-id/drivers-licence", children: i18n.get("iStillCantFindIt") })
17363
17691
  ] }),
17364
17692
  titleId: "whereCanIFindTheseNumbersOnMyDriversLicense",
17365
- contentId: "whereToFindNumbersOnDriversLicense"
17693
+ contentId: "whereToFindNumbersOnDriversLicense",
17694
+ baseTrackingPayload
17366
17695
  }
17367
17696
  )
17368
17697
  ] });
@@ -17498,7 +17827,8 @@ function IdentityAuComponent({
17498
17827
  ),
17499
17828
  issuerState: formUtils.getErrorMessage("issuerState", errors, fieldProblems)
17500
17829
  },
17501
- shouldValidate
17830
+ shouldValidate,
17831
+ baseTrackingPayload: { task: TaskTypes.INDIVIDUAL }
17502
17832
  }
17503
17833
  ) : void 0
17504
17834
  ] });
@@ -17615,7 +17945,8 @@ const DriversLicense = ({
17615
17945
  formUtils,
17616
17946
  isValid,
17617
17947
  errorMessages,
17618
- shouldValidate
17948
+ shouldValidate,
17949
+ baseTrackingPayload
17619
17950
  }) => {
17620
17951
  const { i18n } = useI18nContext();
17621
17952
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -17674,7 +18005,8 @@ const DriversLicense = ({
17674
18005
  /* @__PURE__ */ jsx(Link, { href: "https://www.nzta.govt.nz/driver-licences/getting-a-licence/your-driver-licence-explained/", children: i18n.get("iStillCantFindIt") })
17675
18006
  ] }),
17676
18007
  titleId: "whereCanIFindTheseNumbersOnMyDriversLicense",
17677
- contentId: "whereToFindNumbersOnDriversLicense"
18008
+ contentId: "whereToFindNumbersOnDriversLicense",
18009
+ baseTrackingPayload
17678
18010
  }
17679
18011
  )
17680
18012
  ] });
@@ -17838,7 +18170,8 @@ function IdentityNZComponent({
17838
18170
  fieldProblems
17839
18171
  )
17840
18172
  },
17841
- shouldValidate
18173
+ shouldValidate,
18174
+ baseTrackingPayload: { task: TaskTypes.INDIVIDUAL }
17842
18175
  }
17843
18176
  ) : void 0
17844
18177
  ] });
@@ -18061,6 +18394,10 @@ function PersonalDetailsComponent(props) {
18061
18394
  }
18062
18395
  };
18063
18396
  const alertProps = getAlertProps();
18397
+ const baseTrackingPayload = getAssociatedLeAnalyticsPayload({
18398
+ task: props.taskType,
18399
+ ...isDecisionMakerTask ? { associatedLegalEntity: props.parentLegalEntity } : {}
18400
+ });
18064
18401
  return /* @__PURE__ */ jsxs(LoaderWrapper, { status, formOpacityWhenLoading: 0.3, loaderSize: "large", children: [
18065
18402
  /* @__PURE__ */ jsx(StateContextSetter, { owner: PERSONAL_DETAILS, stateRef }),
18066
18403
  /* @__PURE__ */ jsx(StateContextWatcher, { owner: PERSONAL_DETAILS, onChange: handleStateChange }),
@@ -18096,7 +18433,8 @@ function PersonalDetailsComponent(props) {
18096
18433
  title: i18n.get("whyDoINeedToFillInThisInformation"),
18097
18434
  content: i18n.get("reasonForFillingIndividualPersonalDetails"),
18098
18435
  titleId: "whyDoINeedToFillInThisInformation",
18099
- contentId: "reasonForFillingIndividualPersonalDetails"
18436
+ contentId: "reasonForFillingIndividualPersonalDetails",
18437
+ baseTrackingPayload
18100
18438
  }
18101
18439
  ),
18102
18440
  isDecisionMakerTask && props.trustedFieldsProvider === TrustedFieldsProvider.SINGPASS && props.readOnlyFields && /* @__PURE__ */ jsx(Typography, { color: "secondary", variant: "caption", children: i18n.get(
@@ -18608,7 +18946,8 @@ function IndividualComponent(props) {
18608
18946
  title: i18n.get("whyDoINeedToFillInThisInformation"),
18609
18947
  content: i18n.get("reasonForFillingIndividualAddressDetails"),
18610
18948
  titleId: "whyDoINeedToFillInThisInformation",
18611
- contentId: "reasonForFillingIndividualAddressDetails"
18949
+ contentId: "reasonForFillingIndividualAddressDetails",
18950
+ baseTrackingPayload: { task: taskType }
18612
18951
  }
18613
18952
  ),
18614
18953
  /* @__PURE__ */ jsx(
@@ -18616,7 +18955,10 @@ function IndividualComponent(props) {
18616
18955
  {
18617
18956
  ...addressFormProps,
18618
18957
  id: addressFormID,
18619
- data: { ...addressFormProps == null ? void 0 : addressFormProps.data, country: (_a2 = data == null ? void 0 : data.personalDetails) == null ? void 0 : _a2.residencyCountry },
18958
+ data: {
18959
+ ...addressFormProps == null ? void 0 : addressFormProps.data,
18960
+ country: country ?? ((_a2 = addressFormProps == null ? void 0 : addressFormProps.data) == null ? void 0 : _a2.country)
18961
+ },
18620
18962
  requiredFields: addressSchema,
18621
18963
  optionalFields: ["otherAddressInformation"],
18622
18964
  trustedFields: trustedFields == null ? void 0 : trustedFields.address,
@@ -18798,6 +19140,7 @@ function FilePicker({
18798
19140
  multiple = false,
18799
19141
  label,
18800
19142
  iconPrefix = "generic-document",
19143
+ enableTracking = false,
18801
19144
  // file validation options
18802
19145
  allowedFileTypes,
18803
19146
  maxSize,
@@ -18839,6 +19182,12 @@ function FilePicker({
18839
19182
  if (fileInput2.files) addFiles(fileInput2.files);
18840
19183
  };
18841
19184
  const addFiles = (newFiles) => {
19185
+ if (enableTracking) {
19186
+ userEvents.addFieldEvent("Interacted with form field", {
19187
+ actionType: "change",
19188
+ field: label || "dropzone"
19189
+ });
19190
+ }
18842
19191
  setFiles([...newFiles, ...files]);
18843
19192
  };
18844
19193
  const allowedFileTypesString = allowedFileTypes.join(", ");
@@ -18855,6 +19204,7 @@ function FilePicker({
18855
19204
  files.map((file) => /* @__PURE__ */ jsx(
18856
19205
  DropzoneFile,
18857
19206
  {
19207
+ label,
18858
19208
  file,
18859
19209
  onDelete: () => handleFileDelete(file),
18860
19210
  errorMessage,
@@ -21692,7 +22042,8 @@ function PayoutVerificationMethod(props) {
21692
22042
  ] }),
21693
22043
  /* @__PURE__ */ jsx(Typography, { children: i18n.get("adyenWillOnlyGetTemporaryAccess") }),
21694
22044
  /* @__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
- ] })
22045
+ ] }),
22046
+ baseTrackingPayload: { task: TaskTypes.PAYOUT }
21696
22047
  }
21697
22048
  ) : void 0
21698
22049
  ] });
@@ -22062,7 +22413,8 @@ function SolePropComponent(props) {
22062
22413
  country: props.country,
22063
22414
  problems: props == null ? void 0 : props.problems,
22064
22415
  handleAddressSearch: props.handleAddressSearch,
22065
- handleFindAddress: props.handleFindAddress
22416
+ handleFindAddress: props.handleFindAddress,
22417
+ baseTrackingPayload: { task: TaskTypes.SOLE_PROPRIETOR_COMPANY }
22066
22418
  }
22067
22419
  )
22068
22420
  }
@@ -22744,6 +23096,7 @@ const trustRegistrationDetailsValidationsV4 = {
22744
23096
  };
22745
23097
  const trustRegistrationDetailsFields = [
22746
23098
  "legalName",
23099
+ ...DBA_NAME_FIELD,
22747
23100
  "country",
22748
23101
  "trustType",
22749
23102
  "objectOfTrust",
@@ -22758,6 +23111,7 @@ function TrustRegistrationDetailsComponent(props) {
22758
23111
  const isStrictNameAndAddressValidationEnabled = isExperimentEnabled(
22759
23112
  ExperimentNames.StrictNameAndAddressValidationV4
22760
23113
  );
23114
+ const isLemApiVersionV4Enabled = isExperimentEnabled(ExperimentNames.EnableLemApiVersionV4);
22761
23115
  const TRUST_REGISTRATION_DETAILS = props.id || trustForms.trustRegistrationDetails.formId;
22762
23116
  const stateRef = useRef({ setState: null });
22763
23117
  const requiredFieldsByTask = trustRegistrationDetailsFields;
@@ -22767,7 +23121,7 @@ function TrustRegistrationDetailsComponent(props) {
22767
23121
  field
22768
23122
  )
22769
23123
  );
22770
- const { handleChangeFor, data, valid, errors, setData, fieldProblems } = useForm({
23124
+ const { handleChangeFor, data, valid, errors, setData, fieldProblems, setErrors } = useForm({
22771
23125
  ...props,
22772
23126
  schema: directChildFields,
22773
23127
  defaultData: { ...props.data, country },
@@ -22863,6 +23217,21 @@ function TrustRegistrationDetailsComponent(props) {
22863
23217
  )
22864
23218
  }
22865
23219
  ),
23220
+ isLemApiVersionV4Enabled && formUtils.isRequiredField("dbaName") && /* @__PURE__ */ jsx("div", { className: "adyen-kyc-field-wrapper", children: /* @__PURE__ */ jsx(
23221
+ DBANameField,
23222
+ {
23223
+ data: formUtils.getFieldData(data, DBA_NAME_FIELD),
23224
+ valid: formUtils.getFieldValid(valid, DBA_NAME_FIELD),
23225
+ errors: formUtils.getFieldErrors(errors, fieldProblems, DBA_NAME_FIELD),
23226
+ labels: formUtils.getFieldLabels(DBA_NAME_FIELD, {
23227
+ hasDba: "hasDba"
23228
+ }),
23229
+ legalCompanyName: data.legalName,
23230
+ readonly: formUtils.isReadOnly("dbaName"),
23231
+ handleChangeFor,
23232
+ setErrors
23233
+ }
23234
+ ) }),
22866
23235
  formUtils.isRequiredField("trustType") && /* @__PURE__ */ jsx(
22867
23236
  Field,
22868
23237
  {
@@ -22992,7 +23361,8 @@ function TrustComponent(props) {
22992
23361
  problems: props == null ? void 0 : props.problems,
22993
23362
  labels: { operationalAddressIsSame: "isTrustOperationAddressSame" },
22994
23363
  handleAddressSearch: props.handleAddressSearch,
22995
- handleFindAddress: props.handleFindAddress
23364
+ handleFindAddress: props.handleFindAddress,
23365
+ baseTrackingPayload: { task: TaskTypes.TRUST }
22996
23366
  }
22997
23367
  )
22998
23368
  }
@@ -23601,8 +23971,8 @@ function Summary({
23601
23971
  icon: "edit",
23602
23972
  onClick: () => {
23603
23973
  trackNavigation2({
23604
- fromForm: { formName: "summary", formId: "summary" },
23605
- toForm: { formId, formName },
23974
+ fromForm: "summary",
23975
+ toForm: formName,
23606
23976
  component: "Pencil icon"
23607
23977
  });
23608
23978
  editForm(formId);
@@ -23684,18 +24054,15 @@ const trackNavigation = ({
23684
24054
  fromForm,
23685
24055
  toForm,
23686
24056
  component,
23687
- baseTrackingPayload,
23688
- i18n
24057
+ baseTrackingPayload
23689
24058
  }) => {
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
- }
24059
+ userEvents.addEvent("Clicked button", {
24060
+ ...baseTrackingPayload,
24061
+ actionLevel: "page",
24062
+ actionType: "navigate",
24063
+ page: fromForm,
24064
+ label: component,
24065
+ toPage: toForm
23699
24066
  });
23700
24067
  };
23701
24068
  const useHideButton = (condition, setHideState) => {
@@ -23751,6 +24118,9 @@ const useFormComposer = ({
23751
24118
  (activeForm2) => forms.find(({ formId }) => formId === activeForm2.formId) ?? activeForm2
23752
24119
  );
23753
24120
  }, [forms]);
24121
+ useEffect(() => {
24122
+ userEvents.updateSharedEventProperties({ page: activeForm.formHeading || activeForm.formId });
24123
+ }, [activeForm]);
23754
24124
  useEffect(() => {
23755
24125
  if (hasAlreadyNavigatedForm) return;
23756
24126
  const openingStep = getOpeningStep(forms, problems == null ? void 0 : problems.remediationActions);
@@ -23758,12 +24128,12 @@ const useFormComposer = ({
23758
24128
  setActiveForm(openingStep);
23759
24129
  }
23760
24130
  }, [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
- }
24131
+ const trackSectionCompletion = (formName) => {
24132
+ userEvents.addEvent("Success", {
24133
+ ...baseTrackingPayload,
24134
+ actionLevel: "page",
24135
+ actionType: "next",
24136
+ page: i18n.get(formName)
23767
24137
  });
23768
24138
  };
23769
24139
  const gotoFormByFormIndex = (nextFormIndex) => {
@@ -23802,15 +24172,13 @@ const useFormComposer = ({
23802
24172
  setShouldValidate(false);
23803
24173
  const toFormIndex = forms.findIndex((form) => form.formId === activeForm.formId) + 1;
23804
24174
  gotoFormByFormIndex(toFormIndex);
23805
- const toForm = forms[toFormIndex];
23806
24175
  trackNavigation({
23807
- fromForm: activeForm,
23808
- toForm,
24176
+ fromForm: activeForm.formName,
24177
+ toForm: forms[toFormIndex].formName,
23809
24178
  component: "ActionBar",
23810
- baseTrackingPayload,
23811
- i18n
24179
+ baseTrackingPayload
23812
24180
  });
23813
- trackSectionCompletion(activeForm);
24181
+ trackSectionCompletion(activeForm.formName);
23814
24182
  };
23815
24183
  const handleBackClick = () => {
23816
24184
  const currentFormIndex = forms.findIndex((form) => form.formId === activeForm.formId);
@@ -23819,7 +24187,12 @@ const useFormComposer = ({
23819
24187
  const toForm = forms[currentFormIndex - 1];
23820
24188
  setActiveForm(toForm);
23821
24189
  setHasAlreadyNavigatedForm(true);
23822
- trackNavigation({ fromForm, toForm, component: "ActionBar", baseTrackingPayload, i18n });
24190
+ trackNavigation({
24191
+ fromForm: fromForm.formName,
24192
+ toForm: toForm.formName,
24193
+ component: "ActionBar",
24194
+ baseTrackingPayload
24195
+ });
23823
24196
  }
23824
24197
  };
23825
24198
  const nextButtonLabel = isFinalStep ? i18n.get(submitButtonLabel ?? "submit") : i18n.get("next");
@@ -24146,7 +24519,9 @@ const solePropBase = {
24146
24519
  stockExchangeMIC: { rule: "ifPubliclyTradedCompany" },
24147
24520
  stockISIN: { rule: "ifPubliclyTradedCompany" },
24148
24521
  stockTickerSymbol: { rule: "ifPubliclyTradedCompany" },
24149
- tradingName: { rule: "REQUIRED" },
24522
+ tradingName: { rule: "isLemApiVersionV4Disabled" },
24523
+ dbaName: { rule: "isLemApiVersionV4Enabled" },
24524
+ hasDba: { rule: "isLemApiVersionV4Enabled" },
24150
24525
  dateOfIncorporation: { rule: "countryRequiresDateOfIncorporationForCompanies" },
24151
24526
  exemptedFromRegistrationNumber: { rule: "countryHasRegistrationExemptionsForSomeSoleProps" },
24152
24527
  registrationNumber: { rule: "countryRequiresRegistrationNumberForSoleProps" },
@@ -24339,16 +24714,10 @@ function getPropsFromConfigurations(scenarioConfiguration, forms, remediationAct
24339
24714
  }
24340
24715
  case TrustedFieldsProvider.SINGPASS: {
24341
24716
  if (legalEntityType === "organization") {
24342
- const orgFields = trusted.fields.filter(
24343
- (field) => (field == null ? void 0 : field.split(".")[0]) === "organization"
24344
- );
24345
- return [...acc, ...orgFields.map((tf) => businessDetailsApiKeyMapping[tf])];
24717
+ return [...acc, ...trusted.fields.map((tf) => businessDetailsApiKeyMapping[tf])];
24346
24718
  }
24347
24719
  if (legalEntityType === "individual") {
24348
- const individualFields = trusted.fields.filter(
24349
- (field) => (field == null ? void 0 : field.split(".")[0]) === "individual"
24350
- );
24351
- return [...acc, ...individualFields.map((tf) => individualApiKeyMapping[tf])];
24720
+ return [...acc, ...trusted.fields.map((tf) => individualApiKeyMapping[tf])];
24352
24721
  }
24353
24722
  return acc;
24354
24723
  }
@@ -24477,47 +24846,6 @@ const isFieldRequiredToRemediateDataMissingError = (formId, field, dataMissingEr
24477
24846
  const getFormTrustedFields = (formId, trustedFields) => trustedFields.filter((field) => field.split(".")[0] === formId).map(
24478
24847
  (field) => field.split(".").filter((item) => formId !== item).join(".")
24479
24848
  );
24480
- function getBaseTrackingPayload({
24481
- trackingConfig = {
24482
- topLevelLegalEntity: {}
24483
- },
24484
- parentLegalEntity,
24485
- legalEntity,
24486
- task
24487
- }) {
24488
- const { topLevelLegalEntity } = trackingConfig;
24489
- const baseTrackingPayload = {
24490
- task,
24491
- flow: topLevelLegalEntity == null ? void 0 : topLevelLegalEntity.type,
24492
- topLevelLegalEntityId: topLevelLegalEntity.id,
24493
- topLevelLegalEntityType: topLevelLegalEntity.type
24494
- };
24495
- if (parentLegalEntity) {
24496
- baseTrackingPayload.parentLegalEntityId = parentLegalEntity.id;
24497
- baseTrackingPayload.parentLegalEntityType = parentLegalEntity.type;
24498
- }
24499
- if (legalEntity) {
24500
- baseTrackingPayload.legalEntityId = legalEntity.id;
24501
- baseTrackingPayload.legalEntityType = legalEntity.type;
24502
- }
24503
- return baseTrackingPayload;
24504
- }
24505
- const removeOldDataBySchema = (dataSubmitted, savedLegalEntityData) => {
24506
- Object.keys(savedLegalEntityData).forEach((formId) => {
24507
- if (savedLegalEntityData[formId]) {
24508
- Object.keys(savedLegalEntityData[formId]).forEach((key) => {
24509
- if (dataSubmitted[formId][key] === void 0) {
24510
- if (Array.isArray(savedLegalEntityData[formId][key])) {
24511
- dataSubmitted[formId][key] = [];
24512
- } else {
24513
- dataSubmitted[formId][key] = "";
24514
- }
24515
- }
24516
- });
24517
- }
24518
- });
24519
- return dataSubmitted;
24520
- };
24521
24849
  const getRequiredForms = (forms, requiredFields, optionalFields) => {
24522
24850
  const requiredForms = Object.values(forms).filter(({ formId }) => {
24523
24851
  if (requiredFields || optionalFields) {
@@ -24585,82 +24913,6 @@ const getFieldsWithExistingData = (legalEntity, isExperimentEnabled) => {
24585
24913
  }
24586
24914
  return nonDocumentFields;
24587
24915
  };
24588
- const DBA_NAME_FIELD = ["hasDba", "dbaName"];
24589
- function DBANameField({
24590
- data,
24591
- valid,
24592
- errors,
24593
- labels: labels2,
24594
- helperText,
24595
- readonly,
24596
- handleChangeFor,
24597
- setErrors
24598
- }) {
24599
- const { i18n } = useI18nContext();
24600
- const selection = useMemo(() => {
24601
- if (typeof data.hasDba === "undefined") return;
24602
- if (!data.hasDba) setErrors == null ? void 0 : setErrors("dbaName", null);
24603
- return data.hasDba ? "yes" : "no";
24604
- }, [data.hasDba, setErrors]);
24605
- return /* @__PURE__ */ jsxs(Fragment, { children: [
24606
- /* @__PURE__ */ jsx(
24607
- Field,
24608
- {
24609
- name: "hasDba",
24610
- label: labels2.hasDba ?? i18n.get("hasDba"),
24611
- helper: (helperText == null ? void 0 : helperText.hasDba) ?? i18n.get("hasDba__helperText"),
24612
- isValid: valid.hasDba,
24613
- errorMessage: errors.hasDba,
24614
- children: (childProps) => /* @__PURE__ */ jsx(
24615
- RadioGroup,
24616
- {
24617
- ...childProps,
24618
- name: "hasDba",
24619
- items: [
24620
- { id: "yes", name: "yes" },
24621
- { id: "no", name: "no" }
24622
- ],
24623
- value: selection,
24624
- onChange: (newValue) => handleChangeFor("hasDba")(newValue === "yes"),
24625
- horizontal: true
24626
- }
24627
- )
24628
- }
24629
- ),
24630
- data.hasDba && /* @__PURE__ */ jsx(
24631
- Field,
24632
- {
24633
- name: "dbaName",
24634
- label: labels2.dbaName ?? i18n.get("dbaName"),
24635
- errorMessage: errors.dbaName,
24636
- isValid: valid.dbaName,
24637
- classNameModifiers: ["dbaName"],
24638
- children: (childProps) => /* @__PURE__ */ jsx(
24639
- InputText,
24640
- {
24641
- ...childProps,
24642
- "aria-required": true,
24643
- "aria-label": labels2.dbaName ?? i18n.get("dbaName"),
24644
- "aria-invalid": !valid.dbaName,
24645
- name: "dbaName",
24646
- value: data.dbaName,
24647
- readonly,
24648
- classNameModifiers: ["dbaName"],
24649
- onInput: handleChangeFor("dbaName", "input"),
24650
- onBlur: handleChangeFor("dbaName", "blur")
24651
- }
24652
- )
24653
- }
24654
- )
24655
- ] });
24656
- }
24657
- const hasDbaFieldMetadata = {
24658
- validators: [validateNotEmptyOnBlur]
24659
- };
24660
- const dbaNameFieldMetadata = {
24661
- label: "dbaName",
24662
- validators: [validateNotEmptyOnBlur]
24663
- };
24664
24916
  const getNestedTrustedFields = (field, data, trustedFields) => {
24665
24917
  if (trustedFields && (data == null ? void 0 : data[field]) && typeof data[field] === "object") {
24666
24918
  return trustedFields.reduce((fields, trustedField) => {
@@ -24819,7 +25071,7 @@ function AdditionalInformationComponent({
24819
25071
  handleAddressSearch,
24820
25072
  handleFindAddress
24821
25073
  }) {
24822
- var _a, _b, _c, _d, _e;
25074
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
24823
25075
  const { basicInformation } = useGlobalData();
24824
25076
  const { updateStateSlice } = useGlobalDataSlice(ADDITIONAL_INFORMATION_FORM_ID);
24825
25077
  const { i18n } = useI18nContext();
@@ -25016,7 +25268,6 @@ function AdditionalInformationComponent({
25016
25268
  fieldProblems: formFieldProblems,
25017
25269
  handleChangeFor,
25018
25270
  resetToDefaultData,
25019
- setData,
25020
25271
  setErrors,
25021
25272
  setValid
25022
25273
  } = useForm({
@@ -25084,7 +25335,6 @@ function AdditionalInformationComponent({
25084
25335
  operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME
25085
25336
  );
25086
25337
  setValid("operationalAddress", true);
25087
- setData("operationalAddress", mergedDefaultData == null ? void 0 : mergedDefaultData.operationalAddress);
25088
25338
  } else {
25089
25339
  handleChangeFor("operationalAddressIsSame")(
25090
25340
  operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME
@@ -25328,9 +25578,11 @@ function AdditionalInformationComponent({
25328
25578
  {
25329
25579
  id: ADDITIONAL_INFORMATION_FORM_ID,
25330
25580
  addressType: "registrationAddress",
25331
- data: { ...mergedDefaultData == null ? void 0 : mergedDefaultData.registrationAddress, country },
25332
- labels: getAddressSchemaLabelsByCountry(country),
25333
- countryCode: country,
25581
+ data: {
25582
+ ...mergedDefaultData == null ? void 0 : mergedDefaultData.registrationAddress,
25583
+ country: country ?? ((_f = mergedDefaultData == null ? void 0 : mergedDefaultData.registrationAddress) == null ? void 0 : _f.country)
25584
+ },
25585
+ labels: getAddressSchemaLabelsByCountry(((_g = data == null ? void 0 : data.registrationAddress) == null ? void 0 : _g.country) ?? country),
25334
25586
  requiredFields: addressSchema,
25335
25587
  shouldValidate,
25336
25588
  hideCountry: true,
@@ -25378,9 +25630,11 @@ function AdditionalInformationComponent({
25378
25630
  {
25379
25631
  id: ADDITIONAL_INFORMATION_FORM_ID,
25380
25632
  addressType: "operationalAddress",
25381
- data: { ...mergedDefaultData == null ? void 0 : mergedDefaultData.operationalAddress, country },
25382
- labels: getAddressSchemaLabelsByCountry(country),
25383
- countryCode: country,
25633
+ data: {
25634
+ ...mergedDefaultData == null ? void 0 : mergedDefaultData.operationalAddress,
25635
+ country: ((_h = mergedDefaultData == null ? void 0 : mergedDefaultData.operationalAddress) == null ? void 0 : _h.country) ?? country
25636
+ },
25637
+ labels: getAddressSchemaLabelsByCountry(((_i = data == null ? void 0 : data.operationalAddress) == null ? void 0 : _i.country) ?? country),
25384
25638
  requiredFields: addressSchema,
25385
25639
  shouldValidate,
25386
25640
  hideCountry: true,
@@ -26324,11 +26578,14 @@ const mapBasicInformation = (data) => {
26324
26578
  }, {});
26325
26579
  };
26326
26580
  const mapAdditionalInformation = (data, legalEntity) => {
26327
- var _a, _b, _c, _d, _e;
26581
+ var _a, _b, _c, _d, _e, _f, _g;
26328
26582
  if (!data) return;
26329
26583
  const dbaName = ((_a = legalEntity.organization) == null ? void 0 : _a.doingBusinessAs) ? ((_b = legalEntity.organization) == null ? void 0 : _b.doingBusinessAs) !== ((_c = legalEntity.organization) == null ? void 0 : _c.legalName) ? { hasDba: true } : { hasDba: false } : {};
26330
26584
  const currentCountry = (_d = legalEntity.organization) == null ? void 0 : _d.registeredAddress.country;
26331
- const operationalAddressIsSame = ((_e = legalEntity.organization) == null ? void 0 : _e.principalPlaceOfBusiness) ? operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME : operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME;
26585
+ const operationalAddressIsSame = ((_e = legalEntity.organization) == null ? void 0 : _e.principalPlaceOfBusiness) && !objectsDeepEqual(
26586
+ (_f = legalEntity.organization) == null ? void 0 : _f.principalPlaceOfBusiness,
26587
+ (_g = legalEntity.organization) == null ? void 0 : _g.registeredAddress
26588
+ ) ? operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME : operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME;
26332
26589
  return entriesOf(data).reduce(
26333
26590
  (acc, [field]) => {
26334
26591
  if (!COUNTRIES_USING_COMPANY_SEARCH.includes(currentCountry)) {
@@ -27408,7 +27665,11 @@ function FormNavigation({
27408
27665
  const goToForm = (form) => () => {
27409
27666
  if (form.formId === activeForm.formId) return;
27410
27667
  gotoForm(getFormIndex(form));
27411
- trackNavigation2({ fromForm: form, toForm: activeForm, component: "FormNavigation" });
27668
+ trackNavigation2({
27669
+ fromForm: form.formName,
27670
+ toForm: activeForm.formName,
27671
+ component: "FormNavigation"
27672
+ });
27412
27673
  };
27413
27674
  const getNavigateHandler = (form, activeForm2) => {
27414
27675
  const priorForms = forms.slice(0, getFormIndex(form));
@@ -27493,10 +27754,25 @@ const FormWrapper = ({
27493
27754
  ExperimentNames.ShowExtraTaxExemptionReasons
27494
27755
  );
27495
27756
  const showTaxExemptedLegalCaption = showExtraTaxExemptionReasons && ((_a = summaryData.companyRegistrationDetails) == null ? void 0 : _a.vatAbsenceReason) && ["companyDetails", "businessDetails"].includes(taskName);
27757
+ const handleTrackNavigation = useCallback(
27758
+ ({
27759
+ fromForm,
27760
+ toForm,
27761
+ component
27762
+ }) => {
27763
+ trackNavigation({
27764
+ fromForm,
27765
+ toForm,
27766
+ component,
27767
+ baseTrackingPayload
27768
+ });
27769
+ },
27770
+ [baseTrackingPayload]
27771
+ );
27496
27772
  const summaryContent = /* @__PURE__ */ jsx("div", { className: "adyen-kyc-form-wrapper", children: /* @__PURE__ */ jsx(
27497
27773
  Summary,
27498
27774
  {
27499
- trackNavigation: (payload) => trackNavigation({ ...payload, i18n, baseTrackingPayload }),
27775
+ trackNavigation: handleTrackNavigation,
27500
27776
  data: summaryData,
27501
27777
  omittedKeys,
27502
27778
  omittedForms,
@@ -27586,7 +27862,7 @@ const FormWrapper = ({
27586
27862
  gotoForm: gotoFormByFormIndex,
27587
27863
  validateForm,
27588
27864
  taskName,
27589
- trackNavigation: ({ fromForm, toForm, component }) => trackNavigation({ fromForm, toForm, component, baseTrackingPayload, i18n }),
27865
+ trackNavigation: handleTrackNavigation,
27590
27866
  verificationErrors: problems == null ? void 0 : problems.verificationErrors
27591
27867
  }
27592
27868
  )
@@ -27608,20 +27884,6 @@ const FormWrapper = ({
27608
27884
  }
27609
27885
  );
27610
27886
  };
27611
- var BusinessDetailsEvents = /* @__PURE__ */ ((BusinessDetailsEvents2) => {
27612
- BusinessDetailsEvents2["TASK_START"] = "BusinessDetails_TaskStarted";
27613
- BusinessDetailsEvents2["TASK_SUBMIT"] = "BusinessDetails_TaskSubmitted";
27614
- BusinessDetailsEvents2["TASK_SAVED"] = "BusinessDetails_TaskSaved";
27615
- BusinessDetailsEvents2["TASK_ERROR"] = "BusinessDetails_TaskError";
27616
- BusinessDetailsEvents2["DOCUMENTS_SAVED"] = "BusinessDetails_DocumentsSaved";
27617
- BusinessDetailsEvents2["DOCUMENTS_ERROR"] = "BusinessDetails_DocumentsError";
27618
- BusinessDetailsEvents2["NO_SEARCH_RESULTS"] = "BusinessDetails_NoSearchResults";
27619
- BusinessDetailsEvents2["TIN_MATCH"] = "BusinessDetails_TinMatch";
27620
- BusinessDetailsEvents2["TIN_NO_MATCH"] = "BusinessDetails_TinNoMatch";
27621
- BusinessDetailsEvents2["SELECTION_RESET"] = "BusinessDetails_CompanySelectionReset";
27622
- BusinessDetailsEvents2["SELECTION_ERROR"] = "BusinessDetails_CompanySelectionError";
27623
- return BusinessDetailsEvents2;
27624
- })(BusinessDetailsEvents || {});
27625
27887
  const isMaintenanceModeError = (error) => error && "messageCode" in error && error.messageCode === "maintenanceMode";
27626
27888
  const API_VALIDATION_ERROR_CODE = "30_102";
27627
27889
  const ID_DOCUMENT_UPLOAD_ERROR_CODE = "30_105";
@@ -27630,6 +27892,22 @@ const validateErrorCode = (error, errorCode) => error && "errorCode" in error &&
27630
27892
  const isValidationError = (error) => validateErrorCode(error, API_VALIDATION_ERROR_CODE);
27631
27893
  const isIdDocumentUploadError = (error) => validateErrorCode(error, ID_DOCUMENT_UPLOAD_ERROR_CODE);
27632
27894
  const isBankStatementUploadError = (error) => validateErrorCode(error, BANK_STATEMENT_UPLOAD_ERROR_CODE);
27895
+ const removeOldDataBySchema = (dataSubmitted, savedLegalEntityData) => {
27896
+ Object.keys(savedLegalEntityData).forEach((formId) => {
27897
+ if (savedLegalEntityData[formId]) {
27898
+ Object.keys(savedLegalEntityData[formId]).forEach((key) => {
27899
+ if (dataSubmitted[formId][key] === void 0) {
27900
+ if (Array.isArray(savedLegalEntityData[formId][key])) {
27901
+ dataSubmitted[formId][key] = [];
27902
+ } else {
27903
+ dataSubmitted[formId][key] = "";
27904
+ }
27905
+ }
27906
+ });
27907
+ }
27908
+ });
27909
+ return dataSubmitted;
27910
+ };
27633
27911
  const processValidationErrors = (validationError, dropinTask, keyMappings) => {
27634
27912
  if ((validationError == null ? void 0 : validationError.invalidFields) && (validationError == null ? void 0 : validationError.invalidFields.length) > 0) {
27635
27913
  return validationError == null ? void 0 : validationError.invalidFields.reduce((acc, invalidField) => {
@@ -27684,7 +27962,7 @@ const mapBusinessDetailsDocumentToApiDocument = async (data, entityId) => {
27684
27962
  return documents.filter(Boolean);
27685
27963
  };
27686
27964
  const mapBusinessDetailsSchemaToLegalEntity = (data) => {
27687
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
27965
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
27688
27966
  const requestObj = {
27689
27967
  ...formatObject(data, businessDetailsApiKeyMapping)
27690
27968
  };
@@ -27709,9 +27987,12 @@ const mapBusinessDetailsSchemaToLegalEntity = (data) => {
27709
27987
  if (dbaName) {
27710
27988
  requestObj.organization.doingBusinessAs = dbaName;
27711
27989
  }
27990
+ if (((_o = data.additionalInformation) == null ? void 0 : _o.operationalAddressIsSame) === operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME && requestObj.organization.principalPlaceOfBusiness) {
27991
+ requestObj.organization.principalPlaceOfBusiness = requestObj.organization.registeredAddress;
27992
+ }
27712
27993
  }
27713
27994
  requestObj.type = LegalEntityType.ORGANIZATION;
27714
- if (((_o = requestObj.organization) == null ? void 0 : _o.registeredAddress.country) === "US") {
27995
+ if (((_p = requestObj.organization) == null ? void 0 : _p.registeredAddress.country) === "US") {
27715
27996
  delete requestObj.organization.registrationNumber;
27716
27997
  }
27717
27998
  return requestObj;
@@ -27754,7 +28035,7 @@ const formatBasicInformation = (data, labels2, datasetUtils, companyType) => {
27754
28035
  [registrationNumberLabel]: data.registrationNumber
27755
28036
  };
27756
28037
  };
27757
- const formatAdditionalInformation = (data, labels2, country, companyType) => {
28038
+ const formatAdditionalInformation = (data, labels2, country, companyType, i18n) => {
27758
28039
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
27759
28040
  const registrationNumberLabel = resolveFieldMetadata(
27760
28041
  defaultFieldConfig$9[country],
@@ -27779,7 +28060,7 @@ const formatAdditionalInformation = (data, labels2, country, companyType) => {
27779
28060
  [registrationNumberLabel]: data.registrationNumber,
27780
28061
  [taxIdLabel]: (_e = (_d = data.taxInformation) == null ? void 0 : _d.find((taxId) => country === taxId.country)) == null ? void 0 : _e.number,
27781
28062
  [((_f = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _f.vatNumber) ?? "vatNumber"]: data.vatNumber,
27782
- [((_g = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _g.vatAbsenceReason) ?? "vatAbsenceReason"]: data.vatAbsenceReason,
28063
+ [((_g = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _g.vatAbsenceReason) ?? "vatAbsenceReason"]: data.vatAbsenceReason ? i18n.get(data.vatAbsenceReason) : void 0,
27783
28064
  [((_h = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _h.dateOfIncorporation) ?? "dateOfIncorporation"]: data.dateOfIncorporation,
27784
28065
  [((_i = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _i.stockExchangeMIC) ?? "stockExchangeMIC"]: data.stockExchangeMIC,
27785
28066
  [((_j = labels2 == null ? void 0 : labels2.additionalInformation) == null ? void 0 : _j.stockISIN) ?? "stockISIN"]: data.stockISIN,
@@ -27823,13 +28104,11 @@ const formatDataForSummary = (data, forms, labels2, i18n) => {
27823
28104
  data[form],
27824
28105
  labels2,
27825
28106
  (_c = data.basicInformation) == null ? void 0 : _c.country,
27826
- (_d = data.companyStructure) == null ? void 0 : _d.entityType
28107
+ (_d = data.companyStructure) == null ? void 0 : _d.entityType,
28108
+ i18n
27827
28109
  ),
27828
- registrationAddress: mapAddressLabels(
27829
- data[form].registrationAddress,
27830
- datasetUtils
27831
- ),
27832
- operationalAddress: data[form].operationalAddress ? mapAddressLabels(data[form].operationalAddress, datasetUtils) : void 0
28110
+ registrationAddress: mapAddressLabels(data[form].registrationAddress, datasetUtils),
28111
+ operationalAddress: data[form].operationalAddressIsSame === operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME ? mapAddressLabels(data[form].operationalAddress, datasetUtils) : void 0
27833
28112
  }
27834
28113
  };
27835
28114
  case "companyRegistrationDocument":
@@ -27872,24 +28151,23 @@ async function submitDocuments({
27872
28151
  await documentUtils.uploadDocuments(formattedDocument, legalEntity.id);
27873
28152
  formattedDocument.forEach((doc) => {
27874
28153
  var _a;
27875
- userEvents.addEvent(BusinessDetailsEvents.DOCUMENTS_SAVED, {
27876
- segmentation: {
27877
- ...baseTrackingPayload,
27878
- documentType: doc.type,
27879
- fileExtention: ((_a = doc.attachments) == null ? void 0 : _a.map((item) => getFileExtention(item.pageName))) ?? []
27880
- }
28154
+ userEvents.addEvent("Success", {
28155
+ ...baseTrackingPayload,
28156
+ actionLevel: "task",
28157
+ actionType: "upload",
28158
+ documentType: doc.type,
28159
+ fileExtention: ((_a = doc.attachments) == null ? void 0 : _a.map((item) => getFileExtention(item.pageName))) ?? []
27881
28160
  });
27882
28161
  });
27883
28162
  }
27884
28163
  } catch (err) {
27885
28164
  logger2.error(err);
27886
- userEvents.addEvent(BusinessDetailsEvents.DOCUMENTS_ERROR, {
27887
- segmentation: {
27888
- ...baseTrackingPayload,
27889
- errorCode: err.errorCode,
27890
- errorMessage: err.title ?? err.message,
27891
- errorType: "BE"
27892
- }
28165
+ userEvents.addEvent("Encountered error", {
28166
+ ...baseTrackingPayload,
28167
+ actionLevel: "task",
28168
+ actionType: "upload",
28169
+ returnType: err.errorCode,
28170
+ returnValue: err.title ?? err.message
27893
28171
  });
27894
28172
  }
27895
28173
  }
@@ -27913,6 +28191,9 @@ async function submit({
27913
28191
  const logger2 = createLogger("submitBusinessDetails");
27914
28192
  setLoadingStatus("loading");
27915
28193
  const trackingPayload = {
28194
+ ...baseTrackingPayload,
28195
+ actionLevel: "task",
28196
+ actionType: "submit",
27916
28197
  companyStructure: ((_a = data.companyStructure) == null ? void 0 : _a.entityType) ?? null,
27917
28198
  countryOfRegistration: ((_b = data.basicInformation) == null ? void 0 : _b.country) ?? null,
27918
28199
  legalEntityName: ((_c = data.additionalInformation) == null ? void 0 : _c.legalCompanyName) ?? null,
@@ -27929,12 +28210,7 @@ async function submit({
27929
28210
  )
27930
28211
  };
27931
28212
  try {
27932
- userEvents.addEvent(BusinessDetailsEvents.TASK_SUBMIT, {
27933
- segmentation: {
27934
- ...baseTrackingPayload,
27935
- ...trackingPayload
27936
- }
27937
- });
28213
+ userEvents.addEvent("Clicked button", trackingPayload);
27938
28214
  await Promise.all([
27939
28215
  handleUpdateLegalEntity(drop("type").from(legalEntity), legalEntityResponse.id),
27940
28216
  submitDocuments({
@@ -27949,14 +28225,7 @@ async function submit({
27949
28225
  forms
27950
28226
  })
27951
28227
  ]);
27952
- userEvents.addEvent(BusinessDetailsEvents.TASK_SAVED, {
27953
- segmentation: {
27954
- ...baseTrackingPayload,
27955
- legalEntityId: legalEntity.id,
27956
- legalEntityType: legalEntity.type,
27957
- ...trackingPayload
27958
- }
27959
- });
28228
+ userEvents.addEvent("Success", trackingPayload);
27960
28229
  clearToasts();
27961
28230
  onExternalSubmit == null ? void 0 : onExternalSubmit(data);
27962
28231
  } catch (err) {
@@ -27978,13 +28247,10 @@ async function submit({
27978
28247
  showToast({ label: i18n.get("failedToUpdateDetails"), type: "error" });
27979
28248
  }
27980
28249
  logger2.error(err);
27981
- userEvents.addEvent(BusinessDetailsEvents.TASK_ERROR, {
27982
- segmentation: {
27983
- ...baseTrackingPayload,
27984
- errorCode: err.errorCode,
27985
- errorMessage: err.title,
27986
- errorType: "BE"
27987
- }
28250
+ userEvents.addEvent("Encountered error", {
28251
+ ...trackingPayload,
28252
+ returnType: err == null ? void 0 : err.errorCode,
28253
+ returnValue: (err == null ? void 0 : err.title) || "backend"
27988
28254
  });
27989
28255
  } finally {
27990
28256
  setLoadingStatus("success");
@@ -27996,7 +28262,6 @@ function BusinessDetailsDropinComponent({
27996
28262
  legalEntityResponse,
27997
28263
  isTargetLegalEntityType,
27998
28264
  parentLegalEntity,
27999
- trackingConfig,
28000
28265
  capabilities,
28001
28266
  taskName,
28002
28267
  hideDropinLayout,
@@ -28022,18 +28287,22 @@ function BusinessDetailsDropinComponent({
28022
28287
  const {
28023
28288
  state: { currentState }
28024
28289
  } = useStateContext();
28290
+ const baseTrackingPayload = useMemo(
28291
+ () => getAssociatedLeAnalyticsPayload({
28292
+ task: taskType,
28293
+ associatedLegalEntity: parentLegalEntity
28294
+ }),
28295
+ [parentLegalEntity, taskType]
28296
+ );
28025
28297
  useEffect(() => {
28026
28298
  onChange == null ? void 0 : onChange(currentState);
28027
28299
  }, [currentState, onChange]);
28028
28300
  useEffect(() => {
28029
- userEvents.addPageView("Business details dropin");
28030
- userEvents.addEvent(BusinessDetailsEvents.TASK_START, {
28031
- segmentation: getBaseTrackingPayload({
28032
- trackingConfig,
28033
- parentLegalEntity,
28034
- legalEntity: legalEntityResponse,
28035
- task: taskType
28036
- })
28301
+ userEvents.updateBaseTrackingPayload({ task: taskType });
28302
+ userEvents.addEvent("Landed on page", {
28303
+ ...baseTrackingPayload,
28304
+ actionLevel: "task",
28305
+ actionType: "start"
28037
28306
  });
28038
28307
  }, []);
28039
28308
  const formRef = useRef(null);
@@ -28077,15 +28346,6 @@ function BusinessDetailsDropinComponent({
28077
28346
  );
28078
28347
  const [showCompanyStructure, setShowCompanyStructure] = useState(currentCountry !== "US");
28079
28348
  const [showBusinessSelection, setShowBusinessSelection] = useState(false);
28080
- const baseTrackingPayload = useMemo(
28081
- () => getBaseTrackingPayload({
28082
- trackingConfig,
28083
- parentLegalEntity,
28084
- legalEntity: legalEntityResponse,
28085
- task: taskType
28086
- }),
28087
- [legalEntityResponse, parentLegalEntity, taskType, trackingConfig]
28088
- );
28089
28349
  const getConfigurationData = useCallback(
28090
28350
  () => getConfiguration2({
28091
28351
  legalEntityType: LegalEntityType.ORGANIZATION,
@@ -28366,11 +28626,17 @@ function BusinessDetailsDropinComponent({
28366
28626
  ]
28367
28627
  );
28368
28628
  const nextClick = useCallback(() => {
28369
- var _a2;
28629
+ var _a2, _b2;
28370
28630
  if (!COUNTRIES_USING_COMPANY_SEARCH.includes(currentCountry)) return handleNextClick();
28631
+ const toFormName = (_a2 = forms[forms.findIndex((form) => form.formId === activeForm.formId) + 1]) == null ? void 0 : _a2.formName;
28371
28632
  switch (activeForm.formId) {
28372
28633
  case "basicInformation":
28373
- if (((_a2 = currentState.validityByForm) == null ? void 0 : _a2.basicInformation) && !isBusinessSelection && !verifiedBusiness) {
28634
+ if (((_b2 = currentState.validityByForm) == null ? void 0 : _b2.basicInformation) && !isBusinessSelection && !verifiedBusiness) {
28635
+ trackNavigation({
28636
+ fromForm: activeForm.formName,
28637
+ toForm: toFormName || "home",
28638
+ component: "next"
28639
+ });
28374
28640
  findBusiness(currentState.data.basicInformation);
28375
28641
  setShowBusinessSelection(true);
28376
28642
  break;
@@ -28382,17 +28648,24 @@ function BusinessDetailsDropinComponent({
28382
28648
  }, [
28383
28649
  currentCountry,
28384
28650
  handleNextClick,
28651
+ forms,
28385
28652
  activeForm.formId,
28386
- verifiedBusiness,
28653
+ activeForm.formName,
28387
28654
  (_e = currentState.validityByForm) == null ? void 0 : _e.basicInformation,
28388
28655
  currentState.data.basicInformation,
28389
28656
  isBusinessSelection,
28657
+ verifiedBusiness,
28390
28658
  findBusiness
28391
28659
  ]);
28392
28660
  const backClick = useCallback(() => {
28393
28661
  if (!COUNTRIES_USING_COMPANY_SEARCH.includes(country)) return handleBackClick == null ? void 0 : handleBackClick();
28394
28662
  switch (activeForm.formId) {
28395
28663
  case "basicInformation": {
28664
+ trackNavigation({
28665
+ fromForm: activeForm.formName,
28666
+ toForm: "basicDetails",
28667
+ component: "back"
28668
+ });
28396
28669
  return showBusinessSelection ? setShowBusinessSelection(false) : void 0;
28397
28670
  }
28398
28671
  case "companyStructure": {
@@ -28417,6 +28690,8 @@ function BusinessDetailsDropinComponent({
28417
28690
  }
28418
28691
  }, [
28419
28692
  activeForm.formId,
28693
+ activeForm.formName,
28694
+ i18n,
28420
28695
  country,
28421
28696
  handleBackClick,
28422
28697
  searching,
@@ -28424,6 +28699,14 @@ function BusinessDetailsDropinComponent({
28424
28699
  showBusinessSelection,
28425
28700
  verifiedBusiness
28426
28701
  ]);
28702
+ const homeClick = () => {
28703
+ trackNavigation({
28704
+ fromForm: activeForm.formName,
28705
+ toForm: "home",
28706
+ component: "home"
28707
+ });
28708
+ handleHomeClick == null ? void 0 : handleHomeClick();
28709
+ };
28427
28710
  const proceedToManualDataEntry = useCallback(async () => {
28428
28711
  await clearTrustedBusinessData().then(() => setShowCompanyStructure(true));
28429
28712
  }, [clearTrustedBusinessData]);
@@ -28469,7 +28752,7 @@ function BusinessDetailsDropinComponent({
28469
28752
  backButtonLabel: i18n.get("goBack"),
28470
28753
  handleNextClick: nextClick,
28471
28754
  handleBackClick: backClick,
28472
- handleHomeClick,
28755
+ handleHomeClick: homeClick,
28473
28756
  children: /* @__PURE__ */ jsx(
28474
28757
  BusinessDetailsComponent,
28475
28758
  {
@@ -28548,7 +28831,6 @@ function CompanyDropinComponent({
28548
28831
  capabilities,
28549
28832
  homeButtonLabel,
28550
28833
  taskType = TaskTypes.COMPANY,
28551
- trackingConfig,
28552
28834
  associationDetail,
28553
28835
  parentLegalEntity,
28554
28836
  legalEntityResponse,
@@ -28573,6 +28855,7 @@ function CompanyDropinComponent({
28573
28855
  const { i18n } = useI18nContext();
28574
28856
  const canChangeEntityType = isSettingEnabled(SettingNames.AllowLegalEntityTypeChange);
28575
28857
  const dataFromResponse = mapLegalEntityToCompany(legalEntityResponse);
28858
+ const isTrustMemberCompany = taskType === TaskTypes.TRUST_MEMBER_COMPANY;
28576
28859
  const { getConfiguration: getConfiguration2 } = useConfigurationApi();
28577
28860
  const [data, setData] = useState(dataFromResponse);
28578
28861
  const [problems, setProblems] = useState(propProblems);
@@ -28581,16 +28864,19 @@ function CompanyDropinComponent({
28581
28864
  );
28582
28865
  const [loadingStatus, setLoadingStatus] = useState("success");
28583
28866
  const formRef = useRef(null);
28584
- const baseTrackingPayload = getBaseTrackingPayload({
28585
- trackingConfig,
28586
- parentLegalEntity,
28587
- legalEntity: legalEntityResponse,
28588
- task: taskType
28867
+ const baseTrackingPayload = getAssociatedLeAnalyticsPayload({
28868
+ task: taskType,
28869
+ ...isTrustMemberCompany ? {
28870
+ associatedLegalEntity: legalEntityResponse,
28871
+ associatedLegalEntityOrg: parentLegalEntity
28872
+ } : {}
28589
28873
  });
28590
28874
  useEffect(() => {
28591
- userEvents.addPageView("Company dropin");
28592
- userEvents.addEvent("Started company task", {
28593
- segmentation: baseTrackingPayload
28875
+ userEvents.updateBaseTrackingPayload({ task: taskType });
28876
+ userEvents.addEvent("Landed on page", {
28877
+ ...baseTrackingPayload,
28878
+ actionLevel: "task",
28879
+ actionType: "start"
28594
28880
  });
28595
28881
  }, []);
28596
28882
  const getConfigurationData = useCallback(
@@ -28672,19 +28958,19 @@ function CompanyDropinComponent({
28672
28958
  if (formattedDocument) {
28673
28959
  await documentUtils.uploadDocuments(formattedDocument, legalEntity.id);
28674
28960
  formattedDocument.forEach((doc) => {
28675
- userEvents.addEvent("Saved document", {
28676
- segmentation: {
28677
- ...baseTrackingPayload,
28678
- documentType: doc.type,
28679
- fileExtention: doc.attachments.map((item) => getFileExtention(item.pageName))
28680
- }
28961
+ userEvents.addEvent("Success", {
28962
+ ...baseTrackingPayload,
28963
+ actionLevel: "task",
28964
+ actionType: "save",
28965
+ documentType: doc.type,
28966
+ fileExtention: doc.attachments.map((item) => getFileExtention(item.pageName))
28681
28967
  });
28682
28968
  });
28683
28969
  }
28684
28970
  };
28685
28971
  const attachAssociationToParentLegalEntity = async ({ legalEntity }) => {
28686
28972
  var _a2;
28687
- if (taskType === TaskTypes.TRUST_MEMBER_COMPANY) {
28973
+ if (isTrustMemberCompany) {
28688
28974
  const existingEntityAssociations = getOwnEntityAssociations(parentLegalEntity);
28689
28975
  const existingRoles = (_a2 = existingEntityAssociations == null ? void 0 : existingEntityAssociations.filter((ea) => ea.legalEntityId === parentLegalEntity.id)) == null ? void 0 : _a2.map(({ type }) => type);
28690
28976
  const newRoles = associationDetail == null ? void 0 : associationDetail.roles;
@@ -28710,9 +28996,11 @@ function CompanyDropinComponent({
28710
28996
  let legalEntity = mapCompanyToLegalEntity(filteredData);
28711
28997
  setLoadingStatus("loading");
28712
28998
  const companyTrackingPayload = {
28999
+ actionLevel: "task",
29000
+ actionType: "submit",
28713
29001
  companyStructure: dataSubmitted.companyType.entityType,
28714
29002
  countryOfRegistration: dataSubmitted.companyNameAndCountry.country,
28715
- legalEntityName: dataSubmitted.companyNameAndCountry.legalCompanyName,
29003
+ entityName: dataSubmitted.companyNameAndCountry.legalCompanyName,
28716
29004
  usedAdditionalAddress: dataSubmitted.companyRegistrationAddress.operationalAddressIsSame === operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME
28717
29005
  };
28718
29006
  legalEntity.entityAssociations = filterOutUnwantedAssociationsIfRootLE(
@@ -28724,11 +29012,9 @@ function CompanyDropinComponent({
28724
29012
  delete legalEntity.organization.countryOfGoverningLaw;
28725
29013
  }
28726
29014
  try {
28727
- userEvents.addEvent("Provided company details", {
28728
- segmentation: {
28729
- ...baseTrackingPayload,
28730
- ...companyTrackingPayload
28731
- }
29015
+ userEvents.addEvent("Clicked button", {
29016
+ ...baseTrackingPayload,
29017
+ ...companyTrackingPayload
28732
29018
  });
28733
29019
  if (!(legalEntityResponse == null ? void 0 : legalEntityResponse.id)) {
28734
29020
  legalEntity = await handleCreateLegalEntity(legalEntity);
@@ -28739,13 +29025,11 @@ function CompanyDropinComponent({
28739
29025
  );
28740
29026
  }
28741
29027
  setAccountHolder(accountHolder);
28742
- userEvents.addEvent("Saved company details", {
28743
- segmentation: {
28744
- ...baseTrackingPayload,
28745
- legalEntityId: legalEntity.id,
28746
- legalEntityType: legalEntity.type,
28747
- ...companyTrackingPayload
28748
- }
29028
+ userEvents.addEvent("Success", {
29029
+ ...baseTrackingPayload,
29030
+ ...companyTrackingPayload,
29031
+ legalEntityId: legalEntity.id,
29032
+ entityType: legalEntity.type
28749
29033
  });
28750
29034
  await submitDocuments2({ forms, legalEntity, dataSubmitted });
28751
29035
  await attachAssociationToParentLegalEntity({ legalEntity });
@@ -28767,13 +29051,12 @@ function CompanyDropinComponent({
28767
29051
  showToast({ label: i18n.get("failedToUpdateDetails"), type: "error" });
28768
29052
  }
28769
29053
  setLoadingStatus("success");
28770
- userEvents.addEvent("Encountered error company details", {
28771
- segmentation: {
28772
- ...baseTrackingPayload,
28773
- errorCode: e.errorCode,
28774
- errorMessage: e.title,
28775
- errorType: "BE"
28776
- }
29054
+ userEvents.addEvent("Encountered error", {
29055
+ ...baseTrackingPayload,
29056
+ actionLevel: "task",
29057
+ actionType: "submit",
29058
+ returnType: e.errorCode,
29059
+ returnValue: e.title
28777
29060
  });
28778
29061
  }
28779
29062
  };
@@ -29461,7 +29744,12 @@ const getTrustMembers = (trustLE, rootLegalEntity, exemptSettlorLE) => {
29461
29744
  ];
29462
29745
  };
29463
29746
  const combineRootLegalEntityWithEntityAssociations = (rootLegalEntity, entityAssociations) => {
29464
- const roles = entityAssociations.map((entityAssociation) => entityAssociation.type).filter((role) => role === TrustMemberTypes.SETTLOR || role === TrustMemberTypes.PROTECTOR);
29747
+ const allowedRolesForRootLegalEntity = [
29748
+ TrustMemberTypes.SETTLOR,
29749
+ TrustMemberTypes.PROTECTOR,
29750
+ TrustMemberTypes.DEFINED_BENEFICIARY
29751
+ ];
29752
+ const roles = entityAssociations.map((entityAssociation) => entityAssociation.type).filter((role) => allowedRolesForRootLegalEntity.includes(role));
29465
29753
  return {
29466
29754
  trustMemberType: "rootTrustee",
29467
29755
  roles: [...roles, TrustMemberTypes.TRUSTEE],
@@ -29761,8 +30049,7 @@ const BusinessTypeSelection = ({
29761
30049
  accountHolder,
29762
30050
  onComplete,
29763
30051
  onBack,
29764
- handleUpdateLegalEntity,
29765
- baseTrackingPayload
30052
+ handleUpdateLegalEntity
29766
30053
  }) => {
29767
30054
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
29768
30055
  const { i18n } = useI18nContext();
@@ -29826,24 +30113,10 @@ const BusinessTypeSelection = ({
29826
30113
  );
29827
30114
  }, [data.businessType, data.legalArrangement, currentStep]);
29828
30115
  useEffect(() => {
29829
- userEvents.addPageView("Entity Selection");
29830
- const startDropOffTrackingEvent = () => {
29831
- userEvents.addEvent("Started legal entity selection", {
29832
- segmentation: baseTrackingPayload
29833
- });
29834
- };
29835
- const stopDropOffTrackingEvent = () => {
29836
- userEvents.addEvent("Drop off at legal entity selection", {
29837
- segmentation: baseTrackingPayload
29838
- });
29839
- };
29840
- startDropOffTrackingEvent();
29841
- window.addEventListener("focus", startDropOffTrackingEvent);
29842
- window.addEventListener("blur", stopDropOffTrackingEvent);
29843
- return () => {
29844
- window.removeEventListener("focus", startDropOffTrackingEvent);
29845
- window.removeEventListener("blur", stopDropOffTrackingEvent);
29846
- };
30116
+ userEvents.addEvent("Landed on page", {
30117
+ actionLevel: "task",
30118
+ actionType: "start"
30119
+ });
29847
30120
  }, []);
29848
30121
  const handleNextClick = async () => {
29849
30122
  var _a2;
@@ -29875,21 +30148,19 @@ const BusinessTypeSelection = ({
29875
30148
  return;
29876
30149
  }
29877
30150
  await updateLegalEntityAndSelectAccountHolder();
29878
- userEvents.addEvent("Saved legal entity selection", {
29879
- segmentation: baseTrackingPayload
29880
- });
29881
30151
  } else {
29882
30152
  onComplete(newAccountHolder);
29883
30153
  }
29884
30154
  if (isLegalArrangementChanging) {
29885
30155
  await updateLegalEntityAndSelectAccountHolder();
29886
- userEvents.addEvent("Saved legal entity selection", {
29887
- segmentation: baseTrackingPayload
29888
- });
29889
30156
  }
29890
30157
  }
29891
30158
  };
29892
30159
  const updateLegalEntityAndSelectAccountHolder = async () => {
30160
+ const trackingPayload = {
30161
+ actionLevel: "task",
30162
+ actionType: "submit"
30163
+ };
29893
30164
  try {
29894
30165
  if (isLegalEntityTypeChanging) {
29895
30166
  setLoadingStatus("loading");
@@ -29897,8 +30168,17 @@ const BusinessTypeSelection = ({
29897
30168
  type: targetLegalEntityType
29898
30169
  };
29899
30170
  await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity(updateLegalEntityPayload, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
30171
+ userEvents.addEvent("Success", trackingPayload);
29900
30172
  }
29901
30173
  if (targetLegalEntityType === LegalEntityType.INDIVIDUAL) {
30174
+ if (hasSolePropInLegalEntity(legalEntityResponse)) {
30175
+ setLoadingStatus("loading");
30176
+ const updateLegalEntityPayload = {
30177
+ entityAssociations: []
30178
+ };
30179
+ await (handleUpdateLegalEntity == null ? void 0 : handleUpdateLegalEntity(updateLegalEntityPayload, legalEntityResponse == null ? void 0 : legalEntityResponse.id));
30180
+ userEvents.addEvent("Success", trackingPayload);
30181
+ }
29902
30182
  return;
29903
30183
  }
29904
30184
  const targetOrganizationType = determineOrganizationTypeToUpdate(
@@ -29915,6 +30195,7 @@ const BusinessTypeSelection = ({
29915
30195
  },
29916
30196
  legalEntityResponse == null ? void 0 : legalEntityResponse.id
29917
30197
  ));
30198
+ userEvents.addEvent("Success", trackingPayload);
29918
30199
  }
29919
30200
  } catch (e) {
29920
30201
  showToast({ label: i18n.get("failedToUpdateDetails"), type: "error" });
@@ -30491,8 +30772,6 @@ const EntityGuidanceStatus = ({
30491
30772
  ] });
30492
30773
  };
30493
30774
  const DecisionMakersComponent = ({
30494
- trackingConfig,
30495
- parentLegalEntity,
30496
30775
  legalEntityResponse,
30497
30776
  capabilityProblems,
30498
30777
  onNavigateToIndividual,
@@ -30509,6 +30788,7 @@ const DecisionMakersComponent = ({
30509
30788
  const decisionMakers = getOwnDecisionMakers(legalEntityResponse);
30510
30789
  const registeredCountry = (_b = (_a = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _a.registeredAddress) == null ? void 0 : _b.country;
30511
30790
  const availableDecisionMakers = getAvailableDecisionMakerRoleTypes(registeredCountry);
30791
+ const homeButtonLabel = i18n.get("saveAndGoToOverview");
30512
30792
  const { remediationMessages } = useDataMissingRemediations({
30513
30793
  legalEntityId: legalEntityResponse.id,
30514
30794
  problems: capabilityProblems
@@ -30531,17 +30811,27 @@ const DecisionMakersComponent = ({
30531
30811
  }, {});
30532
30812
  const uniqueDecisionMakers = mappedDecisionMakers ? Object.values(mappedDecisionMakers) : [];
30533
30813
  const showWarning = Boolean(remediationMessages.DECISION_MAKER && uniqueDecisionMakers.length);
30814
+ useEffect(() => {
30815
+ if (showWarning) {
30816
+ userEvents.addEvent("Encountered error", {
30817
+ task: TaskTypes.DECISION_MAKER_OVERVIEW,
30818
+ actionLevel: "task",
30819
+ actionType: "alert",
30820
+ label: remediationMessages.DECISION_MAKER
30821
+ });
30822
+ }
30823
+ }, [showWarning]);
30534
30824
  const uniqueDecisionMakersPerType = (roleType) => uniqueDecisionMakers.filter(({ types }) => types.includes(roleType)).length;
30535
30825
  const allowedDecisionMakerTypes = getAllowedDecisionMakerRoles(
30536
30826
  legalEntityResponse,
30537
30827
  TaskTypes.DECISION_MAKER
30538
30828
  );
30539
30829
  const haveMaxDecisionMakers = allowedDecisionMakerTypes.length === 0;
30540
- const baseTrackingPayload = getBaseTrackingPayload({
30541
- trackingConfig,
30542
- parentLegalEntity,
30543
- legalEntity: legalEntityResponse,
30544
- task: TaskTypes.DECISION_MAKER_OVERVIEW
30830
+ const getDecisionMakerTrackingParams = (decisionMaker) => ({
30831
+ task: TaskTypes.DECISION_MAKER_OVERVIEW,
30832
+ associatedLegalEntityId: decisionMaker.reference,
30833
+ associatedLegalEntityType: decisionMaker.legalEntityType,
30834
+ roles: decisionMaker.types
30545
30835
  });
30546
30836
  const addDecisionMakerOnClick = (e) => {
30547
30837
  e.stopPropagation();
@@ -30549,13 +30839,10 @@ const DecisionMakersComponent = ({
30549
30839
  };
30550
30840
  const editDecisionMaker = (decisionMaker) => {
30551
30841
  onNavigateToIndividual(decisionMaker.reference);
30552
- userEvents.addEvent("Edited decision maker", {
30553
- segmentation: {
30554
- ...baseTrackingPayload,
30555
- legalEntityId: decisionMaker.reference,
30556
- legalEntityType: decisionMaker.legalEntityType,
30557
- roles: decisionMaker.types
30558
- }
30842
+ userEvents.addEvent("Clicked button", {
30843
+ ...getDecisionMakerTrackingParams(decisionMaker),
30844
+ actionLevel: "task",
30845
+ actionType: "edit"
30559
30846
  });
30560
30847
  };
30561
30848
  const deleteDecisionMaker = async (decisionMaker) => {
@@ -30570,14 +30857,11 @@ const DecisionMakersComponent = ({
30570
30857
  const remainingDecisionMakers = decisionMakers.filter(
30571
30858
  (curr) => curr.legalEntityId !== decisionMaker.reference
30572
30859
  );
30573
- userEvents.addEvent("Removed decision maker", {
30574
- segmentation: {
30575
- ...baseTrackingPayload,
30576
- legalEntityId: decisionMaker.reference,
30577
- legalEntityType: decisionMaker.legalEntityType,
30578
- roles: decisionMaker.types,
30579
- remainingDecisionMakers
30580
- }
30860
+ userEvents.addEvent("Clicked button", {
30861
+ ...getDecisionMakerTrackingParams(decisionMaker),
30862
+ actionLevel: "task",
30863
+ actionType: "remove",
30864
+ remainingDecisionMakers
30581
30865
  });
30582
30866
  showToast({ type: "success", label: i18n.get("successFullyRemovedDecisionMaker") });
30583
30867
  } catch (e) {
@@ -30624,7 +30908,8 @@ const DecisionMakersComponent = ({
30624
30908
  roleType
30625
30909
  )) }),
30626
30910
  titleId: "whatIsTheDifferenceBetweenTheseRoles",
30627
- contentId: "differenceBetweenAnOwnerControllingPersonAndSignatory"
30911
+ contentId: "differenceBetweenAnOwnerControllingPersonAndSignatory",
30912
+ baseTrackingPayload: { task: TaskTypes.DECISION_MAKER_OVERVIEW }
30628
30913
  }
30629
30914
  ),
30630
30915
  showWarning && /* @__PURE__ */ jsx(
@@ -30668,15 +30953,16 @@ const DecisionMakersComponent = ({
30668
30953
  ActionBar,
30669
30954
  {
30670
30955
  onHome: () => {
30671
- userEvents.addEvent("Saved decision makers list", {
30672
- segmentation: {
30673
- ...baseTrackingPayload,
30674
- noOfDecisionMakers: decisionMakers.length
30675
- }
30956
+ userEvents.addEvent("Clicked button", {
30957
+ task: TaskTypes.DECISION_MAKER_OVERVIEW,
30958
+ actionLevel: "task",
30959
+ actionType: "back",
30960
+ label: homeButtonLabel,
30961
+ noOfDecisionMakers: decisionMakers.length
30676
30962
  });
30677
30963
  navigateBackToTaskList();
30678
30964
  },
30679
- homeButtonLabel: i18n.get("saveAndGoToOverview")
30965
+ homeButtonLabel
30680
30966
  }
30681
30967
  )
30682
30968
  ] })
@@ -30735,22 +31021,6 @@ const introductionScreensByLegalEntityType = {
30735
31021
  IntroductionScreens.EPILOGUE
30736
31022
  ]
30737
31023
  };
30738
- var IntroductionScreenEvent = /* @__PURE__ */ ((IntroductionScreenEvent2) => {
30739
- IntroductionScreenEvent2["EMPTY"] = "Introduction_Empty";
30740
- IntroductionScreenEvent2["START_FLOW"] = "Introduction_StartFlow";
30741
- IntroductionScreenEvent2["START_SCREEN"] = "Introduction_StartScreen";
30742
- IntroductionScreenEvent2["STOP_SCREEN"] = "Introduction_StopScreen";
30743
- IntroductionScreenEvent2["STOP_FLOW"] = "Introduction_StopFlow";
30744
- IntroductionScreenEvent2["NEXT"] = "Introduction_Next";
30745
- IntroductionScreenEvent2["BACK"] = "Introduction_Back";
30746
- IntroductionScreenEvent2["SKIP"] = "Introduction_Skip";
30747
- return IntroductionScreenEvent2;
30748
- })(IntroductionScreenEvent || {});
30749
- var IntroductionScreenTiming = /* @__PURE__ */ ((IntroductionScreenTiming2) => {
30750
- IntroductionScreenTiming2["VIEW_FLOW"] = "Introduction_ViewFlow";
30751
- IntroductionScreenTiming2["VIEW_SCREEN"] = "Introduction_ViewScreen";
30752
- return IntroductionScreenTiming2;
30753
- })(IntroductionScreenTiming || {});
30754
31024
  const useLegalEntityType = ({
30755
31025
  legalEntity
30756
31026
  }) => {
@@ -30863,28 +31133,26 @@ const Introduction = ({
30863
31133
  const { i18n } = useI18nContext();
30864
31134
  const introductionScreens = useIntroductionScreens({ legalEntity, tasks });
30865
31135
  const [activeIndex, setActiveIndex] = useState(0);
30866
- const eventSegmentationDefaults = getBaseTrackingPayload({
30867
- trackingConfig: { topLevelLegalEntity: legalEntity },
30868
- legalEntity,
30869
- task: TaskTypes.INTRODUCTION
30870
- });
30871
- const eventDetails = {
30872
- segmentation: {
30873
- ...eventSegmentationDefaults,
30874
- page: (introductionScreens == null ? void 0 : introductionScreens.length) ? introductionScreens[activeIndex] : null
30875
- }
31136
+ const pageEventDetails = {
31137
+ actionLevel: "page",
31138
+ page: (introductionScreens == null ? void 0 : introductionScreens.length) ? introductionScreens[activeIndex] : void 0
30876
31139
  };
30877
31140
  useEffect(() => {
30878
- if (!(introductionScreens == null ? void 0 : introductionScreens.length)) {
30879
- userEvents.addEvent(IntroductionScreenEvent.EMPTY, {
30880
- segmentation: eventSegmentationDefaults
31141
+ if (introductionScreens == null ? void 0 : introductionScreens.length) {
31142
+ userEvents.addEvent("Landed on page", {
31143
+ actionLevel: "task",
31144
+ actionType: "start"
30881
31145
  });
30882
- onExitIntroduction();
30883
31146
  } else {
30884
- userEvents.startEvent(IntroductionScreenTiming.VIEW_FLOW);
30885
- userEvents.addEvent(IntroductionScreenEvent.START_FLOW, eventDetails);
31147
+ onExitIntroduction();
30886
31148
  }
30887
31149
  }, [introductionScreens]);
31150
+ const buttonLabels = {
31151
+ skip: i18n.get("goToOverviewFromIntroduction"),
31152
+ back: i18n.get("back"),
31153
+ next: i18n.get("next"),
31154
+ start: i18n.get("start")
31155
+ };
30888
31156
  return (introductionScreens == null ? void 0 : introductionScreens.length) ? /* @__PURE__ */ jsxs("div", { className: "adyen-kyc-introduction", children: [
30889
31157
  /* @__PURE__ */ jsx(
30890
31158
  StepProgressIndicator,
@@ -30896,9 +31164,13 @@ const Introduction = ({
30896
31164
  /* @__PURE__ */ jsx("div", { className: "adyen-kyc-introduction__skip", children: /* @__PURE__ */ jsx(
30897
31165
  Button,
30898
31166
  {
30899
- label: i18n.get("goToOverviewFromIntroduction"),
31167
+ label: buttonLabels.skip,
30900
31168
  onClick: () => {
30901
- userEvents.addEvent(IntroductionScreenEvent.SKIP, eventDetails);
31169
+ userEvents.addEvent("Clicked button", {
31170
+ ...pageEventDetails,
31171
+ actionType: "skip",
31172
+ label: buttonLabels.skip
31173
+ });
30902
31174
  onExitIntroduction();
30903
31175
  },
30904
31176
  showAsLink: true,
@@ -30919,14 +31191,14 @@ const Introduction = ({
30919
31191
  Button,
30920
31192
  {
30921
31193
  disabled: activeIndex === 0,
30922
- label: "Back",
31194
+ label: buttonLabels.back,
30923
31195
  onClick: () => {
30924
- userEvents.addEvent(IntroductionScreenEvent.BACK, eventDetails);
30925
- userEvents.addEvent(IntroductionScreenEvent.STOP_SCREEN, eventDetails);
30926
- userEvents.endEvent(IntroductionScreenTiming.VIEW_SCREEN, eventDetails);
31196
+ userEvents.addEvent("Clicked button", {
31197
+ ...pageEventDetails,
31198
+ actionType: "back",
31199
+ label: buttonLabels.back
31200
+ });
30927
31201
  setActiveIndex((currentValue) => currentValue - 1);
30928
- userEvents.startEvent(IntroductionScreenTiming.VIEW_SCREEN);
30929
- userEvents.addEvent(IntroductionScreenEvent.START_SCREEN, eventDetails);
30930
31202
  },
30931
31203
  secondary: true,
30932
31204
  type: "button"
@@ -30935,12 +31207,13 @@ const Introduction = ({
30935
31207
  activeIndex + 1 === introductionScreens.length ? /* @__PURE__ */ jsx(
30936
31208
  Button,
30937
31209
  {
30938
- label: "Start",
31210
+ label: buttonLabels.start,
30939
31211
  onClick: () => {
30940
- userEvents.addEvent(IntroductionScreenEvent.STOP_SCREEN, eventDetails);
30941
- userEvents.addEvent(IntroductionScreenEvent.STOP_FLOW, eventDetails);
30942
- userEvents.endEvent(IntroductionScreenTiming.VIEW_SCREEN, eventDetails);
30943
- userEvents.endEvent(IntroductionScreenTiming.VIEW_FLOW, eventDetails);
31212
+ userEvents.addEvent("Success", {
31213
+ actionLevel: "task",
31214
+ actionType: "start",
31215
+ label: buttonLabels.start
31216
+ });
30944
31217
  onExitIntroduction();
30945
31218
  },
30946
31219
  type: "button"
@@ -30948,14 +31221,14 @@ const Introduction = ({
30948
31221
  ) : /* @__PURE__ */ jsx(
30949
31222
  Button,
30950
31223
  {
30951
- label: "Next",
31224
+ label: buttonLabels.next,
30952
31225
  onClick: () => {
30953
- userEvents.addEvent(IntroductionScreenEvent.NEXT, eventDetails);
30954
- userEvents.addEvent(IntroductionScreenEvent.STOP_SCREEN, eventDetails);
30955
- userEvents.endEvent(IntroductionScreenTiming.VIEW_SCREEN, eventDetails);
31226
+ userEvents.addEvent("Clicked button", {
31227
+ ...pageEventDetails,
31228
+ actionType: "next",
31229
+ label: buttonLabels.next
31230
+ });
30956
31231
  setActiveIndex((currentValue) => currentValue + 1);
30957
- userEvents.startEvent(IntroductionScreenTiming.VIEW_SCREEN);
30958
- userEvents.addEvent(IntroductionScreenEvent.START_SCREEN, eventDetails);
30959
31232
  },
30960
31233
  type: "button"
30961
31234
  }
@@ -31491,7 +31764,6 @@ const LEGAL_ENTITY_BASE_TASKS = [
31491
31764
  const CONTRACT_TASKS = [TaskTypes.SERVICE_AGREEMENT, TaskTypes.PCI_DSS];
31492
31765
  function TaskListComponent({
31493
31766
  tasks,
31494
- trackingConfig,
31495
31767
  onNavigateToTask,
31496
31768
  legalEntityResponse,
31497
31769
  capabilityProblems,
@@ -31565,16 +31837,23 @@ function TaskListComponent({
31565
31837
  const companyTaskDescriptionKey = isReview ? "businessAccountDetailsDescriptionReview" : "businessAccountDetailsDescription";
31566
31838
  const payoutTaskDescriptionKey = isReview ? "payoutAccountsDescriptionReview" : "payoutAccountsDescription";
31567
31839
  const onEditBusinessSetupClick = () => {
31568
- const baseTrackingPayload = getBaseTrackingPayload({
31569
- trackingConfig,
31570
- legalEntity: legalEntityResponse,
31571
- task: tasks[tasks.length - 1]
31572
- });
31573
- userEvents.addEvent("Clicked back to legal entity selection", {
31574
- segmentation: baseTrackingPayload
31840
+ userEvents.addEvent("Clicked button", {
31841
+ task: TaskTypes.TASKS_OVERVIEW,
31842
+ actionLevel: "task",
31843
+ actionType: "edit"
31575
31844
  });
31576
31845
  onNavigateToTask(TaskTypes.BUSINESS_TYPE_SELECTION);
31577
31846
  };
31847
+ useEffect(() => {
31848
+ if (showDecisionMakersWarning) {
31849
+ userEvents.addEvent("Encountered error", {
31850
+ task: TaskTypes.TASKS_OVERVIEW,
31851
+ actionLevel: "task",
31852
+ actionType: "alert",
31853
+ label: remediationMessages.DECISION_MAKER
31854
+ });
31855
+ }
31856
+ }, [showDecisionMakersWarning]);
31578
31857
  return /* @__PURE__ */ jsxs("div", { className: "adyen-task-list__container", children: [
31579
31858
  canSeeIntroduction && /* @__PURE__ */ jsx("div", { className: "adyen-task-list__nav", children: /* @__PURE__ */ jsx(
31580
31859
  Button,
@@ -32089,7 +32368,8 @@ const TrustMembersOverview = ({
32089
32368
  label
32090
32369
  )) }),
32091
32370
  titleId: "whatIsTheDifferenceBetweenTheseRoles",
32092
- contentId: "differenceBetweenTrustMemberRoles"
32371
+ contentId: "differenceBetweenTrustMemberRoles",
32372
+ baseTrackingPayload: { task: TaskTypes.TRUST_MEMBER_OVERVIEW }
32093
32373
  }
32094
32374
  ),
32095
32375
  /* @__PURE__ */ jsx(CardGroup, { children: trustMembers.map((trustMember) => {
@@ -32280,7 +32560,6 @@ function IndividualDropinComponent({
32280
32560
  handleGetIdVerificationStartCheck,
32281
32561
  handleOpenSingpassAuthorizationLink,
32282
32562
  taskType = TaskTypes.INDIVIDUAL,
32283
- trackingConfig,
32284
32563
  parentLegalEntity,
32285
32564
  legalEntityResponse,
32286
32565
  taskName,
@@ -32338,16 +32617,22 @@ function IndividualDropinComponent({
32338
32617
  accountHolder,
32339
32618
  handleOpenSingpassAuthorizationLink
32340
32619
  });
32341
- const baseTrackingPayload = getBaseTrackingPayload({
32342
- trackingConfig,
32343
- parentLegalEntity,
32344
- legalEntity: legalEntityResponse,
32345
- task: taskType
32620
+ const baseTrackingPayload = getAssociatedLeAnalyticsPayload({
32621
+ task: taskType,
32622
+ ...taskType === TaskTypes.INDIVIDUAL ? {} : taskType === TaskTypes.TRUST_MEMBER_COMPANY_OWNER ? {
32623
+ associatedLegalEntity: legalEntityResponse,
32624
+ associatedLegalEntityOrg: parentLegalEntity
32625
+ } : {
32626
+ // i.e. legal arrangement, decision maker, or trust member individual
32627
+ associatedLegalEntity: legalEntityResponse
32628
+ }
32346
32629
  });
32347
32630
  useEffect(() => {
32348
- userEvents.addPageView("Individual dropin");
32349
- userEvents.addEvent("Started individual task", {
32350
- segmentation: { ...baseTrackingPayload }
32631
+ userEvents.updateBaseTrackingPayload({ task: taskType });
32632
+ userEvents.addEvent("Landed on page", {
32633
+ ...baseTrackingPayload,
32634
+ actionLevel: "task",
32635
+ actionType: "start"
32351
32636
  });
32352
32637
  }, []);
32353
32638
  const getConfigurationData = useCallback(
@@ -32477,27 +32762,27 @@ function IndividualDropinComponent({
32477
32762
  throw new Error("Provide handler to create legalEntity");
32478
32763
  }
32479
32764
  updatedLegalEntity = await handleCreateLegalEntity(legalEntity);
32480
- userEvents.addEvent("Added decision maker", {
32481
- segmentation: {
32482
- ...baseTrackingPayload,
32483
- legalEntityId: updatedLegalEntity.id,
32484
- legalEntityType: updatedLegalEntity.type,
32485
- countryOfRegistration: ((_a2 = dataSubmitted.personalDetails) == null ? void 0 : _a2.residencyCountry) || null,
32486
- roles: ((_b2 = dataSubmitted.personalDetails) == null ? void 0 : _b2.role) || null
32487
- }
32765
+ userEvents.addEvent("Success", {
32766
+ ...baseTrackingPayload,
32767
+ actionLevel: "task",
32768
+ actionType: "submit",
32769
+ legalEntityId: updatedLegalEntity.id,
32770
+ entityType: updatedLegalEntity.type,
32771
+ countryOfRegistration: ((_a2 = dataSubmitted.personalDetails) == null ? void 0 : _a2.residencyCountry) || null,
32772
+ roles: ((_b2 = dataSubmitted.personalDetails) == null ? void 0 : _b2.role) || null
32488
32773
  });
32489
32774
  } else {
32490
32775
  updatedLegalEntity = await handleUpdateLegalEntity(drop("type").from(legalEntity), leId);
32491
- }
32492
- userEvents.addEvent("Saved individual details", {
32493
- segmentation: {
32776
+ userEvents.addEvent("Success", {
32494
32777
  ...baseTrackingPayload,
32778
+ actionLevel: "task",
32779
+ actionType: "submit",
32495
32780
  legalEntityId: updatedLegalEntity.id,
32496
- legalEntityType: updatedLegalEntity.type,
32781
+ entityType: updatedLegalEntity.type,
32497
32782
  countryOfRegistration: ((_c2 = dataSubmitted.personalDetails) == null ? void 0 : _c2.residencyCountry) || null,
32498
32783
  idDocumentType: idDocumentType || null
32499
- }
32500
- });
32784
+ });
32785
+ }
32501
32786
  return updatedLegalEntity;
32502
32787
  };
32503
32788
  const handleInstantIdVerificationStartCheck = async (onfidoResponse, legalEntityId) => {
@@ -32530,12 +32815,12 @@ function IndividualDropinComponent({
32530
32815
  );
32531
32816
  uploadedDocuments == null ? void 0 : uploadedDocuments.forEach((doc) => {
32532
32817
  var _a3;
32533
- userEvents.addEvent("Saved document", {
32534
- segmentation: {
32535
- ...baseTrackingPayload,
32536
- documentType: doc.type,
32537
- fileExtention: ((_a3 = doc == null ? void 0 : doc.attachments) == null ? void 0 : _a3.map((item) => getFileExtention(item.pageName))) ?? null
32538
- }
32818
+ userEvents.addEvent("Success", {
32819
+ ...baseTrackingPayload,
32820
+ actionLevel: "task",
32821
+ actionType: "upload",
32822
+ documentType: doc.type,
32823
+ fileExtention: ((_a3 = doc == null ? void 0 : doc.attachments) == null ? void 0 : _a3.map((item) => getFileExtention(item.pageName))) ?? null
32539
32824
  });
32540
32825
  });
32541
32826
  }
@@ -32602,12 +32887,12 @@ function IndividualDropinComponent({
32602
32887
  return ((_a3 = dataSubmitted == null ? void 0 : dataSubmitted.idDocument) == null ? void 0 : _a3.idDocumentType) === id;
32603
32888
  }
32604
32889
  )) == null ? void 0 : _a2.id;
32605
- userEvents.addEvent("Provided individual details", {
32606
- segmentation: {
32607
- ...baseTrackingPayload,
32608
- countryOfRegistration: ((_b2 = dataSubmitted == null ? void 0 : dataSubmitted.personalDetails) == null ? void 0 : _b2.residencyCountry) || null,
32609
- idDocumentType: idDocumentType || null
32610
- }
32890
+ userEvents.addEvent("Clicked button", {
32891
+ ...baseTrackingPayload,
32892
+ actionLevel: "task",
32893
+ actionType: "submit",
32894
+ countryOfRegistration: ((_b2 = dataSubmitted == null ? void 0 : dataSubmitted.personalDetails) == null ? void 0 : _b2.residencyCountry) || null,
32895
+ idDocumentType: idDocumentType || null
32611
32896
  });
32612
32897
  legalEntity.entityAssociations = filterOutUnwantedAssociationsIfRootLE(
32613
32898
  taskType,
@@ -32646,13 +32931,12 @@ function IndividualDropinComponent({
32646
32931
  showToast({ label: i18n.get("failedToUpdateDetails"), type: "error" });
32647
32932
  }
32648
32933
  setLoadingStatus("success");
32649
- userEvents.addEvent("Encountered error individual details", {
32650
- segmentation: {
32651
- ...baseTrackingPayload,
32652
- errorCode: e.errorCode,
32653
- errorMessage: e.title,
32654
- errorType: "BE"
32655
- }
32934
+ userEvents.addEvent("Encountered error", {
32935
+ ...baseTrackingPayload,
32936
+ actionLevel: "task",
32937
+ actionType: "submit",
32938
+ returnType: e.errorCode,
32939
+ returnValue: e.title
32656
32940
  });
32657
32941
  }
32658
32942
  };
@@ -32966,7 +33250,6 @@ function PayoutDetailsDropinComponent({
32966
33250
  handleGetBankVerificationVendors,
32967
33251
  legalEntityResponse,
32968
33252
  associatedLegalArrangement,
32969
- trackingConfig,
32970
33253
  accountHolder,
32971
33254
  problems: propProblems,
32972
33255
  onSubmit: externalOnSubmit,
@@ -33038,14 +33321,11 @@ function PayoutDetailsDropinComponent({
33038
33321
  propProblems || ((transferInstrument == null ? void 0 : transferInstrument.id) ? (_c = (_b = getCapabilityProblems(legalEntityResponse, bankAccountCountry)) == null ? void 0 : _b.BankAccount) == null ? void 0 : _c[transferInstrument.id] : void 0)
33039
33322
  );
33040
33323
  const existingBankAccountFormat = transferInstrument ? ((_d = existingPayoutDetails == null ? void 0 : existingPayoutDetails.payoutAccountDetails) == null ? void 0 : _d.iban) ? "iban" : "local" : void 0;
33041
- const baseTrackingPayload = getBaseTrackingPayload({
33042
- trackingConfig,
33043
- task: taskType
33044
- });
33045
33324
  useEffect(() => {
33046
- userEvents.addPageView("Payout dropin");
33047
- userEvents.addEvent("Started payout task", {
33048
- segmentation: { ...baseTrackingPayload }
33325
+ userEvents.updateBaseTrackingPayload({ task: taskType });
33326
+ userEvents.addEvent("Landed on page", {
33327
+ actionLevel: "task",
33328
+ actionType: "start"
33049
33329
  });
33050
33330
  }, []);
33051
33331
  const { getConfigurationData, provider } = useBankConfigurationHandlers({
@@ -33171,12 +33451,11 @@ function PayoutDetailsDropinComponent({
33171
33451
  );
33172
33452
  documents2.forEach((document2) => {
33173
33453
  var _a2;
33174
- userEvents.addEvent("Saved document", {
33175
- segmentation: {
33176
- ...baseTrackingPayload,
33177
- documentType: document2.type,
33178
- fileExtention: ((_a2 = document2.attachments) == null ? void 0 : _a2.map((item) => getFileExtention(item.pageName))) ?? null
33179
- }
33454
+ userEvents.addEvent("Success", {
33455
+ actionLevel: "task",
33456
+ actionType: "upload",
33457
+ documentType: document2.type,
33458
+ fileExtention: ((_a2 = document2.attachments) == null ? void 0 : _a2.map((item) => getFileExtention(item.pageName))) ?? null
33180
33459
  });
33181
33460
  });
33182
33461
  } catch (e) {
@@ -33208,15 +33487,14 @@ function PayoutDetailsDropinComponent({
33208
33487
  existingPayoutDetails == null ? void 0 : existingPayoutDetails.payoutAccountDetails
33209
33488
  );
33210
33489
  }
33211
- const event = {
33212
- segmentation: {
33213
- ...baseTrackingPayload,
33214
- documentType: DocumentType.BANK_STATEMENT,
33215
- bankCountry: (payoutVerificationMethod == null ? void 0 : payoutVerificationMethod.bankCountry) ?? defaultPayoutCountry,
33216
- bankCurrency: (payoutAccountDetails == null ? void 0 : payoutAccountDetails.currency) ?? null
33217
- }
33490
+ const baseTracking = {
33491
+ actionLevel: "task",
33492
+ actionType: "submit",
33493
+ documentType: DocumentType.BANK_STATEMENT,
33494
+ bankCountry: (payoutVerificationMethod == null ? void 0 : payoutVerificationMethod.bankCountry) ?? defaultPayoutCountry,
33495
+ bankCurrency: (payoutAccountDetails == null ? void 0 : payoutAccountDetails.currency) ?? null
33218
33496
  };
33219
- userEvents.addEvent("Provided payout details", event);
33497
+ userEvents.addEvent("Clicked button", baseTracking);
33220
33498
  let transferInstrument2 = mapPayoutAccountToTransferInstrument({
33221
33499
  data: dataSubmitted,
33222
33500
  legalEntity: legalEntityResponse
@@ -33232,7 +33510,7 @@ function PayoutDetailsDropinComponent({
33232
33510
  transferInstrumentId
33233
33511
  );
33234
33512
  }
33235
- userEvents.addEvent("Saved payout details", event);
33513
+ userEvents.addEvent("Success", baseTracking);
33236
33514
  try {
33237
33515
  await submitDocuments2({ forms, transferInstrument: transferInstrument2, dataSubmitted });
33238
33516
  setLoadingStatus("success");
@@ -33261,13 +33539,10 @@ function PayoutDetailsDropinComponent({
33261
33539
  showToast({ label: i18n.get("failedToUpdateDetails"), type: "error" });
33262
33540
  }
33263
33541
  setLoadingStatus("success");
33264
- userEvents.addEvent("Encountered error payout details", {
33265
- segmentation: {
33266
- ...baseTrackingPayload,
33267
- errorCode: e.errorCode,
33268
- errorMessage: e.title,
33269
- errorType: "BE"
33270
- }
33542
+ userEvents.addEvent("Encountered error", {
33543
+ ...baseTracking,
33544
+ returnType: (e == null ? void 0 : e.errorCode) || "backend",
33545
+ returnValue: (e == null ? void 0 : e.title) || (e == null ? void 0 : e.message)
33271
33546
  });
33272
33547
  }
33273
33548
  };
@@ -33328,7 +33603,7 @@ function PayoutDetailsDropinComponent({
33328
33603
  nextButtonLabel
33329
33604
  } = useFormComposer({
33330
33605
  problems,
33331
- baseTrackingPayload,
33606
+ baseTrackingPayload: {},
33332
33607
  forms,
33333
33608
  submitButtonLabel,
33334
33609
  externalBackClick,
@@ -33369,7 +33644,7 @@ function PayoutDetailsDropinComponent({
33369
33644
  loadingStatus,
33370
33645
  forms,
33371
33646
  onSubmit,
33372
- baseTrackingPayload,
33647
+ baseTrackingPayload: {},
33373
33648
  gotoFormByFormIndex,
33374
33649
  nextButtonLabel,
33375
33650
  homeButtonLabel,
@@ -33447,19 +33722,15 @@ function PciDropinComponent({
33447
33722
  pciTemplateResponse,
33448
33723
  handleHomeClick,
33449
33724
  handleSign,
33450
- taskType = TaskTypes.PCI_DSS,
33451
- trackingConfig
33725
+ taskType = TaskTypes.PCI_DSS
33452
33726
  }) {
33453
33727
  var _a, _b, _c, _d;
33454
33728
  const { i18n } = useI18nContext();
33455
33729
  const { showToast } = useToastContext();
33456
- const baseTrackingPayload = getBaseTrackingPayload({
33457
- trackingConfig,
33458
- legalEntity: legalEntityResponse,
33459
- task: taskType
33460
- });
33461
33730
  const [loadingStatus, setLoadingStatus] = useState();
33462
33731
  const hasExpired = useHasExpired();
33732
+ const signButtonLabel = i18n.get("sign");
33733
+ const homeButtonLabel = i18n.get("goToOverview");
33463
33734
  const { handleChangeFor, triggerValidation, data, valid, isValid, errors } = useForm({
33464
33735
  schema: PciFields,
33465
33736
  rules: pciValidationRules
@@ -33486,7 +33757,12 @@ function PciDropinComponent({
33486
33757
  ];
33487
33758
  const handleSignClick = async () => {
33488
33759
  if (loadingStatus === "loading") return;
33489
- userEvents.addEvent("Clicked PCI signing", { segmentation: { ...baseTrackingPayload } });
33760
+ const baseTracking = {
33761
+ actionLevel: "task",
33762
+ actionType: "sign",
33763
+ label: signButtonLabel
33764
+ };
33765
+ userEvents.addEvent("Clicked button", baseTracking);
33490
33766
  triggerValidation();
33491
33767
  if (isValid) {
33492
33768
  try {
@@ -33494,40 +33770,45 @@ function PciDropinComponent({
33494
33770
  await handleSign(legalEntityResponse.id, { signedBy: data.signer, pciTemplateReferences });
33495
33771
  setLoadingStatus("success");
33496
33772
  showToast({ label: i18n.get("pciSignedSuccessfully"), type: "success" });
33497
- userEvents.addEvent("Succeeded PCI signing", { segmentation: { ...baseTrackingPayload } });
33773
+ userEvents.addEvent("Success", baseTracking);
33498
33774
  goHome();
33499
- } catch {
33775
+ } catch (e) {
33500
33776
  setLoadingStatus("success");
33501
33777
  showToast({ label: i18n.get("pciSignFailed"), type: "error" });
33502
- userEvents.addEvent("Failed PCI signing", { segmentation: { ...baseTrackingPayload } });
33778
+ userEvents.addEvent("Encountered error", {
33779
+ ...baseTracking,
33780
+ returnType: (e == null ? void 0 : e.errorCode) || "backend",
33781
+ returnValue: (e == null ? void 0 : e.title) ?? (e == null ? void 0 : e.message)
33782
+ });
33503
33783
  }
33504
33784
  } else {
33505
- userEvents.addEvent("Encountered PCI validation error", {
33506
- segmentation: {
33507
- ...baseTrackingPayload,
33508
- fields: Object.entries(valid).filter(([, value]) => !value).map(([key]) => key)
33509
- }
33785
+ userEvents.addEvent("Encountered error", {
33786
+ ...baseTracking,
33787
+ returnType: "validation",
33788
+ returnValue: Object.entries(valid).filter(([, value]) => !value).map(([key]) => key)
33510
33789
  });
33511
33790
  }
33512
33791
  };
33513
33792
  const goHome = () => {
33514
- userEvents.addEvent("Returned to task overview from PCI", {
33515
- segmentation: { ...baseTrackingPayload }
33793
+ userEvents.addEvent("Clicked button", {
33794
+ actionLevel: "task",
33795
+ actionType: "back",
33796
+ label: homeButtonLabel
33516
33797
  });
33517
33798
  handleHomeClick();
33518
33799
  };
33519
33800
  const handleExpandSection = (title) => {
33520
- userEvents.addEvent("Expanded PCI section", {
33521
- segmentation: {
33522
- ...baseTrackingPayload,
33523
- statementExtended: title
33524
- }
33801
+ userEvents.addEvent("Clicked accordion", {
33802
+ actionLevel: "task",
33803
+ actionType: "open",
33804
+ label: title
33525
33805
  });
33526
33806
  };
33527
33807
  useEffect(() => {
33528
- userEvents.addPageView("PCI dropin");
33529
- userEvents.addEvent("Started PCI task", {
33530
- segmentation: { ...baseTrackingPayload }
33808
+ userEvents.updateBaseTrackingPayload({ task: taskType });
33809
+ userEvents.addEvent("Landed on page", {
33810
+ actionLevel: "task",
33811
+ actionType: "start"
33531
33812
  });
33532
33813
  }, []);
33533
33814
  const acceptPciLabel = /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -33586,9 +33867,9 @@ function PciDropinComponent({
33586
33867
  ActionBar,
33587
33868
  {
33588
33869
  onHome: goHome,
33589
- homeButtonLabel: i18n.get("goToOverview"),
33870
+ homeButtonLabel,
33590
33871
  onNext: handleSignClick,
33591
- nextButtonLabel: i18n.get("sign")
33872
+ nextButtonLabel: signButtonLabel
33592
33873
  }
33593
33874
  );
33594
33875
  return /* @__PURE__ */ jsx(DropinLayout, { content, footer });
@@ -34430,21 +34711,14 @@ function ServiceAgreementDropinComponent({
34430
34711
  handleHomeClick,
34431
34712
  handleAddSigner,
34432
34713
  handleSign,
34433
- taskType,
34434
34714
  serviceAgreementTypes,
34435
- serviceAgreementAcceptanceInfos,
34436
- trackingConfig
34715
+ serviceAgreementAcceptanceInfos
34437
34716
  }) {
34438
34717
  var _a, _b;
34439
34718
  const { i18n } = useI18nContext();
34440
34719
  const { showToast } = useToastContext();
34441
34720
  const { isExperimentEnabled } = useExperimentsContext();
34442
34721
  const isAgeVerificationEnabled = isExperimentEnabled("EnableAgeVerification");
34443
- const baseTrackingPayload = getBaseTrackingPayload({
34444
- trackingConfig,
34445
- legalEntity: legalEntityResponse,
34446
- task: taskType
34447
- });
34448
34722
  const [loadingStatus, setLoadingStatus] = useState();
34449
34723
  const signedForms = serviceAgreementAcceptanceInfos.map((serviceAgreementAcceptanceInfo) => ({
34450
34724
  formId: serviceAgreementAcceptanceInfo.id,
@@ -34466,6 +34740,8 @@ function ServiceAgreementDropinComponent({
34466
34740
  const [activeForm, setActiveForm] = useState(forms[activeFormIndex]);
34467
34741
  const canSign = (serviceAgreementTypes == null ? void 0 : serviceAgreementTypes.includes(activeForm == null ? void 0 : activeForm.serviceAgreementType)) && !(activeForm == null ? void 0 : activeForm.acceptanceId);
34468
34742
  const showSignedAlert = !!(activeForm == null ? void 0 : activeForm.acceptanceId);
34743
+ const homeButtonLabel = i18n.get("goToOverview");
34744
+ const nextButtonLabel = i18n.get(canSign ? "sign" : "next");
34469
34745
  const handleServiceAgreementIsNotAvailableInThatLanguage = useCallback(() => {
34470
34746
  showToast({
34471
34747
  label: i18n.get("failedToGetServiceAgreementInSelectedLanguageFallbackToEn"),
@@ -34506,7 +34782,11 @@ function ServiceAgreementDropinComponent({
34506
34782
  };
34507
34783
  const signers = getSigners();
34508
34784
  const handleSignClick = async () => {
34509
- userEvents.addEvent("Clicked ToS signing", { segmentation: { ...baseTrackingPayload } });
34785
+ const baseTracking = {
34786
+ actionLevel: "task",
34787
+ actionType: "sign"
34788
+ };
34789
+ userEvents.addEvent("Clicked button", { ...baseTracking, label: nextButtonLabel });
34510
34790
  triggerValidation();
34511
34791
  if (loadingStatus === "loading" || !serviceAgreement || !data.signer) return;
34512
34792
  if (isValid) {
@@ -34518,35 +34798,39 @@ function ServiceAgreementDropinComponent({
34518
34798
  label: i18n.get("serviceAgreementSignedSuccessfully"),
34519
34799
  type: "success"
34520
34800
  });
34521
- userEvents.addEvent("Succeeded ToS signing", { segmentation: { ...baseTrackingPayload } });
34801
+ userEvents.addEvent("Success", baseTracking);
34522
34802
  data.acceptServiceAgreement = false;
34523
34803
  data.signer = void 0;
34524
- } catch {
34804
+ } catch (e) {
34525
34805
  setLoadingStatus("success");
34526
34806
  showToast({ label: i18n.get("serviceAgreementSignFailed"), type: "error" });
34527
- userEvents.addEvent("Failed ToS signing", { segmentation: { ...baseTrackingPayload } });
34807
+ userEvents.addEvent("Encountered error", {
34808
+ ...baseTracking,
34809
+ returnType: (e == null ? void 0 : e.errorCode) || "backend",
34810
+ returnValue: (e == null ? void 0 : e.title) ?? (e == null ? void 0 : e.message)
34811
+ });
34528
34812
  }
34529
34813
  } else {
34530
- userEvents.addEvent("Encountered ToS validation error", {
34531
- segmentation: {
34532
- ...baseTrackingPayload,
34533
- fields: Object.entries(valid).filter(([, value]) => !value).map(([key]) => key)
34534
- }
34814
+ userEvents.addEvent("Encountered error", {
34815
+ ...baseTracking,
34816
+ returnType: "validation",
34817
+ returnValue: Object.entries(valid).filter(([, value]) => !value).map(([key]) => key)
34535
34818
  });
34536
34819
  }
34537
34820
  };
34538
34821
  const goHome = () => {
34539
- userEvents.addEvent("Returned to task overview from ToS", {
34540
- segmentation: { ...baseTrackingPayload }
34822
+ userEvents.addEvent("Clicked button", {
34823
+ actionLevel: "task",
34824
+ actionType: "back",
34825
+ label: homeButtonLabel
34541
34826
  });
34542
34827
  handleHomeClick();
34543
34828
  };
34544
34829
  const handleExpandSection = (title) => {
34545
- userEvents.addEvent("Expanded ToS section", {
34546
- segmentation: {
34547
- ...baseTrackingPayload,
34548
- statementExtended: title
34549
- }
34830
+ userEvents.addEvent("Clicked accordion", {
34831
+ actionLevel: "task",
34832
+ actionType: "open",
34833
+ label: title
34550
34834
  });
34551
34835
  };
34552
34836
  useEffect(() => {
@@ -34554,9 +34838,9 @@ function ServiceAgreementDropinComponent({
34554
34838
  gotoForm(serviceAgreementAcceptanceInfos.length - 1);
34555
34839
  }, [serviceAgreementAcceptanceInfos]);
34556
34840
  useEffect(() => {
34557
- userEvents.addPageView("ToS dropin");
34558
- userEvents.addEvent("Started ToS task", {
34559
- segmentation: { ...baseTrackingPayload }
34841
+ userEvents.addEvent("Landed on page", {
34842
+ actionLevel: "task",
34843
+ actionType: "start"
34560
34844
  });
34561
34845
  const initialFormIndex = forms.length === signedForms.length ? 0 : signedForms.length;
34562
34846
  gotoForm(initialFormIndex);
@@ -34745,9 +35029,9 @@ function ServiceAgreementDropinComponent({
34745
35029
  ActionBar,
34746
35030
  {
34747
35031
  onHome: goHome,
34748
- homeButtonLabel: i18n.get("goToOverview"),
35032
+ homeButtonLabel,
34749
35033
  onNext: canSign ? handleSignClick : () => gotoForm(activeFormIndex + 1),
34750
- nextButtonLabel: i18n.get(canSign ? "sign" : "next"),
35034
+ nextButtonLabel,
34751
35035
  nextButtonDisabled: forms.length === 0 || !canSign && activeFormIndex === forms.length - 1,
34752
35036
  onBack: () => gotoForm(activeFormIndex - 1),
34753
35037
  hideBackButton: activeFormIndex === 0,
@@ -34823,7 +35107,6 @@ function SolePropDropinComponent({
34823
35107
  onSubmit: onExternalSubmit,
34824
35108
  onChange,
34825
35109
  taskType,
34826
- trackingConfig,
34827
35110
  handleHomeClick,
34828
35111
  handleCreateDocument,
34829
35112
  handleGetDocument,
@@ -34857,11 +35140,9 @@ function SolePropDropinComponent({
34857
35140
  const dataFromResponse = getDataWithDefaultAddress(legalEntityResponse, parentLegalEntity);
34858
35141
  const [data, setData] = useState(dataFromResponse);
34859
35142
  const country = ((_b = (_a = currentState.data) == null ? void 0 : _a.solePropNameAndCountry) == null ? void 0 : _b.country) || ((_c = dataFromResponse == null ? void 0 : dataFromResponse.solePropRegistrationAddress) == null ? void 0 : _c.registrationAddress.country) || externalCountry;
34860
- const baseTrackingPayload = getBaseTrackingPayload({
34861
- trackingConfig,
34862
- parentLegalEntity,
34863
- legalEntity: legalEntityResponse,
34864
- task: taskType
35143
+ const baseTrackingPayload = getAssociatedLeAnalyticsPayload({
35144
+ task: taskType,
35145
+ associatedLegalEntity: legalEntityResponse
34865
35146
  });
34866
35147
  const getConfigurationData = useCallback(
34867
35148
  () => getConfiguration2({
@@ -34940,6 +35221,7 @@ function SolePropDropinComponent({
34940
35221
  };
34941
35222
  useEffect(() => {
34942
35223
  var _a2;
35224
+ userEvents.updateBaseTrackingPayload({ task: taskType });
34943
35225
  const documentIds = ((_a2 = legalEntityResponse == null ? void 0 : legalEntityResponse.documentDetails) == null ? void 0 : _a2.map((documentReference) => documentReference.id)) || [];
34944
35226
  try {
34945
35227
  if (documentIds.length) {
@@ -35106,7 +35388,11 @@ function SolePropDropinComponent({
35106
35388
  );
35107
35389
  }
35108
35390
  const COUNTRIES_THAT_USE_REGISTRATION_NUMBER = [CountryCodes.NewZealand];
35109
- const rules = ({ data, country }) => ({
35391
+ const rules = ({
35392
+ data,
35393
+ country,
35394
+ isExperimentEnabled = () => false
35395
+ }) => ({
35110
35396
  countryUsesTaxId: () => {
35111
35397
  if (country !== CountryCodes.NewZealand && COUNTRIES_THAT_USE_TAX_ID_INSTEAD_OF_VAT.includes(country)) {
35112
35398
  return "REQUIRED";
@@ -35122,6 +35408,11 @@ const rules = ({ data, country }) => ({
35122
35408
  if (((_a = data == null ? void 0 : data.trustRegistrationDetails) == null ? void 0 : _a.trustType) === TrustTypes.CHARITABLE_TRUST) {
35123
35409
  return "REQUIRED";
35124
35410
  }
35411
+ },
35412
+ isLemApiVersionV4Enabled: () => {
35413
+ if (isExperimentEnabled("EnableLemApiVersionV4")) {
35414
+ return "REQUIRED";
35415
+ }
35125
35416
  }
35126
35417
  });
35127
35418
  const parseConfiguration$1 = ({ matchingScenario, country }) => parseTrustScenarios(matchingScenario == null ? void 0 : matchingScenario[LegalEntityType.TRUST], country);
@@ -35137,7 +35428,6 @@ function TrustDropinComponent({
35137
35428
  handleUpdateDocument,
35138
35429
  handleAddressSearch,
35139
35430
  handleFindAddress,
35140
- trackingConfig,
35141
35431
  taskType,
35142
35432
  problems: problemsProp,
35143
35433
  onSubmit: externalOnSubmit,
@@ -35216,6 +35506,7 @@ function TrustDropinComponent({
35216
35506
  }, [derivedProps, formValidity, problems]);
35217
35507
  useEffect(() => {
35218
35508
  var _a2;
35509
+ userEvents.updateBaseTrackingPayload({ task: taskType });
35219
35510
  const documentIds = ((_a2 = legalEntityResponse == null ? void 0 : legalEntityResponse.documentDetails) == null ? void 0 : _a2.map((documentReference) => documentReference.id)) || [];
35220
35511
  try {
35221
35512
  if (documentIds.length) {
@@ -35357,11 +35648,9 @@ function TrustDropinComponent({
35357
35648
  const value = getProp(data2, detail);
35358
35649
  return !isEmpty$1(value);
35359
35650
  });
35360
- const baseTrackingPayload = getBaseTrackingPayload({
35361
- trackingConfig,
35362
- parentLegalEntity,
35363
- legalEntity: legalEntityResponse,
35364
- task: taskType
35651
+ const baseTrackingPayload = getAssociatedLeAnalyticsPayload({
35652
+ task: taskType,
35653
+ associatedLegalEntity: legalEntityResponse
35365
35654
  });
35366
35655
  const {
35367
35656
  handleNextClick,
@@ -35448,6 +35737,13 @@ const useNavigation = ({
35448
35737
  const shouldShowSingpassSelection = isEligibleForSingpass && !hasSeenSingpassSelection;
35449
35738
  const [taskHistory, setTaskHistory] = useState(["default"]);
35450
35739
  const actualTasks = taskHistory.filter((task) => task !== "default");
35740
+ const handleNavigation = useCallback(
35741
+ (task) => {
35742
+ userEvents.updateBaseTrackingPayload({ task });
35743
+ onNavigate == null ? void 0 : onNavigate(task);
35744
+ },
35745
+ [onNavigate]
35746
+ );
35451
35747
  const navigateTo = useCallback(
35452
35748
  (task, deletePreviousHistory = false) => {
35453
35749
  const pushNewTask = () => setTaskHistory((taskHistory2) => deletePreviousHistory ? [task] : [...taskHistory2, task]);
@@ -35455,10 +35751,10 @@ const useNavigation = ({
35455
35751
  setTimeout(pushNewTask);
35456
35752
  } else {
35457
35753
  pushNewTask();
35458
- onNavigate == null ? void 0 : onNavigate(task);
35754
+ handleNavigation(task);
35459
35755
  }
35460
35756
  },
35461
- [onNavigate]
35757
+ [handleNavigation]
35462
35758
  );
35463
35759
  const navigateBack = useCallback(
35464
35760
  (stepCount = 1) => {
@@ -35469,13 +35765,14 @@ const useNavigation = ({
35469
35765
  }
35470
35766
  if (prevTask === TaskTypes.TASKS_OVERVIEW) {
35471
35767
  setTaskHistory([TaskTypes.TASKS_OVERVIEW]);
35472
- onNavigate == null ? void 0 : onNavigate(TaskTypes.TASKS_OVERVIEW);
35768
+ handleNavigation == null ? void 0 : handleNavigation(TaskTypes.TASKS_OVERVIEW);
35473
35769
  return;
35474
35770
  }
35475
35771
  setTaskHistory(taskHistory.slice(0, -1 * stepCount));
35476
- onNavigate == null ? void 0 : onNavigate(prevTask);
35772
+ handleNavigation == null ? void 0 : handleNavigation(prevTask);
35773
+ userEvents.updateBaseTrackingPayload({ task: prevTask });
35477
35774
  },
35478
- [taskHistory, onNavigate]
35775
+ [taskHistory, handleNavigation]
35479
35776
  );
35480
35777
  useEffect(() => {
35481
35778
  if (!window.history.state) window.history.pushState({}, "");
@@ -35761,6 +36058,14 @@ function DropinComposerComponent({
35761
36058
  const refreshLegalEntity = useCallback(async () => {
35762
36059
  const legalEntity = await retrieveLegalEntity();
35763
36060
  updateLegalEntityAndCapabilityProblems(legalEntity);
36061
+ if (legalEntity) {
36062
+ userEvents.updateBaseTrackingPayload({
36063
+ legalEntityId: legalEntity.id,
36064
+ entityType: legalEntity.type,
36065
+ capabilities: Object.keys(legalEntity.capabilities),
36066
+ countryCode: getLegalEntityCountry(legalEntity)
36067
+ });
36068
+ }
35764
36069
  return legalEntity;
35765
36070
  }, [retrieveLegalEntity, updateLegalEntityAndCapabilityProblems]);
35766
36071
  const deleteTransferInstrument = async (id) => {
@@ -36030,13 +36335,6 @@ function DropinComposerComponent({
36030
36335
  await componentOnSubmit(data, backSteps);
36031
36336
  };
36032
36337
  const onPciDownload = async () => {
36033
- const baseTrackingPayload = getBaseTrackingPayload({
36034
- trackingConfig: {
36035
- topLevelLegalEntity: legalEntityResponse
36036
- },
36037
- legalEntity: rootLegalEntity,
36038
- task: TaskTypes.PCI_DSS
36039
- });
36040
36338
  try {
36041
36339
  const response = await (args == null ? void 0 : args.handleGetPciQuestionnaires(rootLegalEntity.id));
36042
36340
  await Promise.all(
@@ -36051,13 +36349,18 @@ function DropinComposerComponent({
36051
36349
  } catch (e) {
36052
36350
  showToast({ label: i18n.get("failedToDownloadPci"), type: "error" });
36053
36351
  } finally {
36054
- userEvents.addEvent("Downloaded signed PCI form", {
36055
- segmentation: { ...baseTrackingPayload }
36352
+ userEvents.addEvent("Clicked button", {
36353
+ task: TaskTypes.PCI_DSS,
36354
+ actionLevel: "task",
36355
+ actionType: "download"
36056
36356
  });
36057
36357
  }
36058
36358
  };
36059
36359
  useEffect(() => {
36060
- userEvents.addPageView("Task list");
36360
+ userEvents.addEvent("Landed on page", {
36361
+ actionLevel: "journey",
36362
+ actionType: "start"
36363
+ });
36061
36364
  }, []);
36062
36365
  useLayoutEffect(() => {
36063
36366
  const fetchConfiguration = async () => {
@@ -36148,8 +36451,7 @@ function DropinComposerComponent({
36148
36451
  await refreshLegalEntity();
36149
36452
  navigateTo("default");
36150
36453
  },
36151
- onBack: previousTask ? navigateBack : void 0,
36152
- trackingConfig: { topLevelLegalEntity: legalEntityResponse }
36454
+ onBack: previousTask ? navigateBack : void 0
36153
36455
  }
36154
36456
  ) });
36155
36457
  case TaskTypes.SINGPASS_SELECTION:
@@ -36179,7 +36481,6 @@ function DropinComposerComponent({
36179
36481
  return /* @__PURE__ */ jsx(
36180
36482
  TaskListComponent,
36181
36483
  {
36182
- trackingConfig: { topLevelLegalEntity: legalEntityResponse },
36183
36484
  onNavigateToTask,
36184
36485
  tasks,
36185
36486
  legalEntityResponse: rootLegalEntity,
@@ -36198,9 +36499,6 @@ function DropinComposerComponent({
36198
36499
  return /* @__PURE__ */ jsx(
36199
36500
  DecisionMakersComponent,
36200
36501
  {
36201
- trackingConfig: {
36202
- topLevelLegalEntity: legalEntityResponse
36203
- },
36204
36502
  parentLegalEntity: associatedLegalEntityParent,
36205
36503
  legalEntityResponse: rootLegalEntity,
36206
36504
  onNavigateToIndividual: (legalEntityId) => onNavigateToDecisionMakerIndividual(TaskTypes.DECISION_MAKER, legalEntityId),
@@ -36215,9 +36513,6 @@ function DropinComposerComponent({
36215
36513
  return /* @__PURE__ */ jsx(
36216
36514
  IndividualDropinComponent,
36217
36515
  {
36218
- trackingConfig: {
36219
- topLevelLegalEntity: legalEntityResponse
36220
- },
36221
36516
  taskType: TaskTypes.INDIVIDUAL,
36222
36517
  taskName: hasTrust ? "individualTrusteeDetails" : "individualDetails",
36223
36518
  parentLegalEntity: null,
@@ -36262,9 +36557,6 @@ function DropinComposerComponent({
36262
36557
  return /* @__PURE__ */ jsx(
36263
36558
  IndividualDropinComponent,
36264
36559
  {
36265
- trackingConfig: {
36266
- topLevelLegalEntity: legalEntityResponse
36267
- },
36268
36560
  taskType: TaskTypes.DECISION_MAKER,
36269
36561
  parentLegalEntity: associatedLegalEntityParent,
36270
36562
  legalEntityResponse: associatedLegalEntity,
@@ -36294,9 +36586,6 @@ function DropinComposerComponent({
36294
36586
  return /* @__PURE__ */ jsx(
36295
36587
  IndividualDropinComponent,
36296
36588
  {
36297
- trackingConfig: {
36298
- topLevelLegalEntity: legalEntityResponse
36299
- },
36300
36589
  taskType: TaskTypes.TRUST_MEMBER_COMPANY_OWNER,
36301
36590
  parentLegalEntity: associatedLegalEntityParent,
36302
36591
  legalEntityResponse: associatedLegalEntity,
@@ -36325,9 +36614,6 @@ function DropinComposerComponent({
36325
36614
  return /* @__PURE__ */ jsx(
36326
36615
  IndividualDropinComponent,
36327
36616
  {
36328
- trackingConfig: {
36329
- topLevelLegalEntity: legalEntityResponse
36330
- },
36331
36617
  taskType: TaskTypes.TRUST_MEMBER_INDIVIDUAL,
36332
36618
  parentLegalEntity: associatedLegalArrangement,
36333
36619
  legalEntityResponse: associatedLegalEntity,
@@ -36356,9 +36642,6 @@ function DropinComposerComponent({
36356
36642
  CompanyDropinComponent,
36357
36643
  {
36358
36644
  ...args,
36359
- trackingConfig: {
36360
- topLevelLegalEntity: legalEntityResponse
36361
- },
36362
36645
  taskType: TaskTypes.COMPANY,
36363
36646
  taskName: hasTrust ? "companyTrusteeDetails" : "companyDetails",
36364
36647
  legalEntityResponse: rootLegalEntity,
@@ -36385,9 +36668,6 @@ function DropinComposerComponent({
36385
36668
  BusinessDetailsDropinComponent,
36386
36669
  {
36387
36670
  ...args,
36388
- trackingConfig: {
36389
- topLevelLegalEntity: legalEntityResponse
36390
- },
36391
36671
  taskType: TaskTypes.BUSINESS_DETAILS,
36392
36672
  taskName: hasTrust ? "businessTrusteeDetails" : "businessDetails",
36393
36673
  legalEntityResponse: rootLegalEntity,
@@ -36423,9 +36703,6 @@ function DropinComposerComponent({
36423
36703
  CompanyDropinComponent,
36424
36704
  {
36425
36705
  ...args,
36426
- trackingConfig: {
36427
- topLevelLegalEntity: legalEntityResponse
36428
- },
36429
36706
  taskType: TaskTypes.TRUST_MEMBER_COMPANY,
36430
36707
  parentLegalEntity: associatedLegalArrangement,
36431
36708
  legalEntityResponse: associatedLegalEntity,
@@ -36446,7 +36723,6 @@ function DropinComposerComponent({
36446
36723
  return /* @__PURE__ */ jsx(
36447
36724
  PayoutDetailsDropinComponent,
36448
36725
  {
36449
- trackingConfig: { topLevelLegalEntity: legalEntityResponse },
36450
36726
  taskType: currentTask,
36451
36727
  taskName: currentTask === TaskTypes.PAYIN ? "payinDetails" : "payoutDetails",
36452
36728
  problems: (_f = capabilityProblems == null ? void 0 : capabilityProblems.BankAccount) == null ? void 0 : _f[transferInstrument == null ? void 0 : transferInstrument.id],
@@ -36475,9 +36751,6 @@ function DropinComposerComponent({
36475
36751
  TrustDropinComponent,
36476
36752
  {
36477
36753
  ...args,
36478
- trackingConfig: {
36479
- topLevelLegalEntity: legalEntityResponse
36480
- },
36481
36754
  taskType: TaskTypes.TRUST,
36482
36755
  problems: (_g = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _g[associatedLegalArrangement == null ? void 0 : associatedLegalArrangement.id],
36483
36756
  parentLegalEntity: rootLegalEntity,
@@ -36540,7 +36813,6 @@ function DropinComposerComponent({
36540
36813
  {
36541
36814
  legalEntityResponse: rootLegalEntity,
36542
36815
  pciTemplateResponse,
36543
- trackingConfig: { topLevelLegalEntity: legalEntityResponse },
36544
36816
  taskType: TaskTypes.PCI_DSS,
36545
36817
  handleHomeClick: navigateBack,
36546
36818
  handleSign: async (...params) => {
@@ -36573,7 +36845,6 @@ function DropinComposerComponent({
36573
36845
  ServiceAgreementDropinComponent,
36574
36846
  {
36575
36847
  legalEntityResponse: rootLegalEntity,
36576
- trackingConfig: { topLevelLegalEntity: legalEntityResponse },
36577
36848
  taskType: TaskTypes.SERVICE_AGREEMENT,
36578
36849
  serviceAgreementTypes,
36579
36850
  serviceAgreementAcceptanceInfos: serviceAgreementAcceptanceInfosWithNames,
@@ -36611,9 +36882,6 @@ function DropinComposerComponent({
36611
36882
  return /* @__PURE__ */ jsx(
36612
36883
  IndividualDropinComponent,
36613
36884
  {
36614
- trackingConfig: {
36615
- topLevelLegalEntity: legalEntityResponse
36616
- },
36617
36885
  taskName: "legalRepresentative",
36618
36886
  taskType: TaskTypes.LEGAL_REPRESENTATIVE_DETAILS,
36619
36887
  parentLegalEntity: rootLegalEntity,
@@ -38647,7 +38915,6 @@ function UpdateLegalEntityForHighExposure({
38647
38915
  parentLegalEntity,
38648
38916
  capabilities,
38649
38917
  country,
38650
- trackingConfig,
38651
38918
  problems: problemsProp,
38652
38919
  onSubmit: externalOnSubmit,
38653
38920
  onChange,
@@ -38781,10 +39048,8 @@ function UpdateLegalEntityForHighExposure({
38781
39048
  const value = getProp(data2, detail);
38782
39049
  return !isEmpty$1(value);
38783
39050
  });
38784
- const baseTrackingPayload = getBaseTrackingPayload({
38785
- trackingConfig,
38786
- parentLegalEntity,
38787
- legalEntity
39051
+ const baseTrackingPayload = getAssociatedLeAnalyticsPayload({
39052
+ associatedLegalEntity: parentLegalEntity
38788
39053
  });
38789
39054
  const {
38790
39055
  handleNextClick,
@@ -39066,15 +39331,13 @@ const pushEvents = async (loadingContext, sessionId, event) => httpPost(
39066
39331
  },
39067
39332
  event
39068
39333
  );
39069
- const convertToEmbeddedEvent = (eventQueueItem) => {
39070
- const [eventType, event] = eventQueueItem;
39071
- const isObject = typeof event === "object";
39072
- const eventName = isObject ? event.key : event;
39073
- const eventData = isObject ? event.segmentation : {};
39334
+ const convertToEmbeddedEvent = (eventQueueItem, sessionData) => {
39335
+ const { type, name, properties } = eventQueueItem;
39074
39336
  return {
39075
- eventType,
39076
- eventName,
39077
- eventData: eventData ?? {}
39337
+ eventName: name,
39338
+ eventType: type,
39339
+ eventData: properties || {},
39340
+ ...sessionData
39078
39341
  };
39079
39342
  };
39080
39343
  const useAnalytics = async ({
@@ -39086,30 +39349,38 @@ const useAnalytics = async ({
39086
39349
  const { i18n } = useI18nContext();
39087
39350
  const { isEmbeddedDropin, loadingContext: base } = useAuthContext();
39088
39351
  const loadingContext = `${base}api/${COMPONENTS_API_VERSION}/`;
39089
- if (isEmbeddedDropin) {
39090
- try {
39091
- const sessionResponse = await getAnalyticsSession(loadingContext, {
39352
+ useEffect(() => {
39353
+ (async () => {
39354
+ const sessionData = {
39092
39355
  sdkVersion,
39093
39356
  componentName,
39094
39357
  userAgent: navigator.userAgent,
39095
- legalEntityId
39096
- });
39097
- if (!(sessionResponse == null ? void 0 : sessionResponse.id)) {
39098
- throw Error("Analytics session Id not received");
39099
- }
39100
- userEvents.subscribe((data) => {
39101
- const eventItem = convertToEmbeddedEvent(data);
39102
- if (eventItem.eventData) {
39103
- eventItem.eventData.locale = i18n.locale;
39358
+ legalEntityId,
39359
+ locale: i18n.locale
39360
+ };
39361
+ if (isEmbeddedDropin) {
39362
+ try {
39363
+ const sessionResponse = await getAnalyticsSession(loadingContext, sessionData);
39364
+ if (!(sessionResponse == null ? void 0 : sessionResponse.id)) {
39365
+ throw Error("Analytics session Id not received");
39366
+ }
39367
+ userEvents.subscribe((data) => {
39368
+ const eventItem = convertToEmbeddedEvent(data, sessionData);
39369
+ pushEvents(loadingContext, sessionResponse.id, eventItem);
39370
+ });
39371
+ } catch (e) {
39372
+ console.error("Failed to initiate analytics for component", e);
39104
39373
  }
39105
- pushEvents(loadingContext, sessionResponse.id, eventItem);
39106
- });
39107
- } catch (e) {
39108
- console.error("Failed to initiate analytics for component", e);
39109
- }
39110
- } else if (onUserEvent) {
39111
- userEvents.subscribe(onUserEvent);
39112
- }
39374
+ } else if (onUserEvent) {
39375
+ userEvents.subscribe((data) => {
39376
+ onUserEvent({
39377
+ ...data,
39378
+ properties: { ...data.properties || {}, ...sessionData }
39379
+ });
39380
+ });
39381
+ }
39382
+ })();
39383
+ }, []);
39113
39384
  };
39114
39385
  const logger$8 = createLogger("loadCountries");
39115
39386
  const countriesImports = /* @__PURE__ */ Object.assign({ "./de-DE.json": () => import("./de-DE-Cx8Uim1K.js"), "./el-GR.json": () => import("./el-GR-B7_JR3z5.js"), "./en-US.json": () => import("./en-US-CkdCbOCX.js"), "./es-ES.json": () => import("./es-ES-NBv3HHhn.js"), "./fr-FR.json": () => import("./fr-FR-DdSVMVsp.js"), "./it-IT.json": () => import("./it-IT-Bwdk3zuj.js"), "./ja-JP.json": () => import("./ja-JP-Bsvzm8zu.js"), "./nl-NL.json": () => import("./nl-NL-DofKaNkk.js"), "./pt-PT.json": () => import("./pt-PT-DFEvMD1M.js"), "./ru-RU.json": () => import("./ru-RU-PiM0ZI5h.js"), "./sv-SE.json": () => import("./sv-SE-C0GoLwTg.js"), "./zh-CN.json": () => import("./zh-CN-DJs6Hct-.js"), "./zh-TW.json": () => import("./zh-TW-BWhLbns8.js") });
@@ -39405,7 +39676,7 @@ const ConfigurationApiProvider = ({
39405
39676
  }) => {
39406
39677
  const authContext = useAuthContext();
39407
39678
  const { isEmbeddedDropin, loadingContext } = authContext;
39408
- const sdkVersion = "2.59.11";
39679
+ const sdkVersion = "2.61.0";
39409
39680
  useAnalytics({
39410
39681
  onUserEvent,
39411
39682
  legalEntityId: rootLegalEntityId,
@@ -40078,7 +40349,7 @@ const DebugModal = ({ rootLegalEntityId, onExit, getRootLegalEntity }) => {
40078
40349
  };
40079
40350
  const copyToClipboard = async () => {
40080
40351
  const toCopy = {
40081
- sdkVersion: "2.59.11",
40352
+ sdkVersion: "2.61.0",
40082
40353
  experiments: Object.fromEntries(allExperimentsWithValues),
40083
40354
  settings: Object.fromEntries(allSettingsWithValues)
40084
40355
  };
@@ -40143,7 +40414,7 @@ const DebugModal = ({ rootLegalEntityId, onExit, getRootLegalEntity }) => {
40143
40414
  /* @__PURE__ */ jsx("div", { className: "adyen-kyc-debug-modal__meta", children: /* @__PURE__ */ jsx("table", { children: /* @__PURE__ */ jsxs("tbody", { children: [
40144
40415
  /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsxs("td", { children: [
40145
40416
  /* @__PURE__ */ jsx("span", { className: "adyen-kyc-debug-modal__table-key", children: "SDK version" }),
40146
- /* @__PURE__ */ jsx(Tag, { variant: "green", className: "adyen-kyc-tag--large", children: "2.59.11" })
40417
+ /* @__PURE__ */ jsx(Tag, { variant: "green", className: "adyen-kyc-tag--large", children: "2.61.0" })
40147
40418
  ] }) }),
40148
40419
  /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsxs("td", { children: [
40149
40420
  /* @__PURE__ */ jsx("span", { className: "adyen-kyc-debug-modal__table-key", children: "rootLegalEntityId" }),
@@ -40263,6 +40534,20 @@ const getRootLegalEntityId = (componentProps) => {
40263
40534
  if ("legalEntityResponse" in componentProps) return componentProps.legalEntityResponse.id;
40264
40535
  throw new Error("You must provide either `legalEntityId` or `legalEntityResponse`");
40265
40536
  };
40537
+ const getBaseTracking = (componentProps) => {
40538
+ if ("legalEntityResponse" in componentProps) {
40539
+ const { legalEntityResponse } = componentProps;
40540
+ return {
40541
+ entityType: legalEntityResponse.type,
40542
+ legalEntityId: legalEntityResponse.id,
40543
+ capabilities: Object.keys(legalEntityResponse.capabilities || {}),
40544
+ countryCode: getLegalEntityCountry(legalEntityResponse)
40545
+ };
40546
+ }
40547
+ return {
40548
+ legalEntityId: componentProps.legalEntityId
40549
+ };
40550
+ };
40266
40551
  class UIElement extends BaseElement {
40267
40552
  constructor() {
40268
40553
  super(...arguments);
@@ -40271,6 +40556,10 @@ class UIElement extends BaseElement {
40271
40556
  const rootLegalEntityId = getRootLegalEntityId(
40272
40557
  this.props.componentProps
40273
40558
  );
40559
+ const baseTracking = getBaseTracking(
40560
+ this.props.componentProps
40561
+ );
40562
+ userEvents.updateBaseTrackingPayload(baseTracking);
40274
40563
  return /* @__PURE__ */ jsx(SettingsProvider, { settings: this.props.settings, children: /* @__PURE__ */ jsx(
40275
40564
  AuthProvider,
40276
40565
  {