@adyen/kyc-components 2.60.0 → 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 (39) hide show
  1. package/dist/es/adyen-kyc-components.es.js +501 -391
  2. package/dist/types/components/BasicInformation/types.d.ts +1 -1
  3. package/dist/types/components/BusinessDetails/types.d.ts +1 -1
  4. package/dist/types/components/DecisionMakers/component/DecisionMakersComponent.d.ts +1 -1
  5. package/dist/types/components/Dropins/BusinessDetailsDropin/components/BusinessDetailsDropinComponent.d.ts +1 -1
  6. package/dist/types/components/Dropins/BusinessDetailsDropin/types.d.ts +1 -1
  7. package/dist/types/components/Dropins/CompanyDropin/components/CompanyDropinComponent.d.ts +1 -1
  8. package/dist/types/components/Dropins/FormWrapper/FormWrapper.d.ts +1 -1
  9. package/dist/types/components/Dropins/IndividualDropin/components/IndividualDropinComponent.d.ts +1 -1
  10. package/dist/types/components/Dropins/PayoutDetailsDropin/components/PayoutDetailsDropinComponent.d.ts +1 -1
  11. package/dist/types/components/Dropins/PciDropin/components/PciDropinComponent.d.ts +1 -1
  12. package/dist/types/components/Dropins/ServiceAgreementDropinComponent/components/ServiceAgreementDropinComponent.d.ts +1 -1
  13. package/dist/types/components/Dropins/SolePropDropin/components/SolePropDropinComponent.d.ts +1 -1
  14. package/dist/types/components/Dropins/TrustDropin/components/TrustDropinComponent.d.ts +1 -1
  15. package/dist/types/components/Dropins/types.d.ts +1 -4
  16. package/dist/types/components/EmbeddedDropins/UpdateLegalEntityForHighExposure/UpdateLegalEntityForHighExposure.d.ts +1 -1
  17. package/dist/types/components/Introduction/Introduction.d.ts +1 -1
  18. package/dist/types/components/PersonalDetails/component/IdentityComponent/IdentityAu/component/DriversLicense.d.ts +1 -1
  19. package/dist/types/components/PersonalDetails/component/IdentityComponent/IdentityNZ/component/DriversLicense.d.ts +1 -1
  20. package/dist/types/components/RegistrationAddress/types.d.ts +1 -1
  21. package/dist/types/components/TaskList/component/TaskListComponent.d.ts +1 -1
  22. package/dist/types/components/TaskList/types.d.ts +0 -3
  23. package/dist/types/components/internal/ContextGuidance/types.d.ts +1 -1
  24. package/dist/types/components/internal/FormFields/Checkbox/Checkbox.d.ts +2 -1
  25. package/dist/types/components/internal/FormFields/Dropzone/FilePicker.d.ts +2 -1
  26. package/dist/types/components/internal/FormFields/Dropzone/types.d.ts +2 -0
  27. package/dist/types/components/internal/FormFields/InputBase.d.ts +1 -0
  28. package/dist/types/components/internal/FormFields/RadioGroup/RadioGroup.d.ts +2 -1
  29. package/dist/types/components/internal/FormFields/RadioGroupCard/RadioCardSelect.d.ts +2 -1
  30. package/dist/types/components/internal/FormFields/Select/Select.d.ts +1 -1
  31. package/dist/types/components/internal/FormFields/Select/components/SelectButton.d.ts +1 -1
  32. package/dist/types/components/internal/FormFields/Select/types.d.ts +3 -0
  33. package/dist/types/core/analytics.d.ts +19 -0
  34. package/dist/types/core/hooks/useFormComposer.d.ts +1 -1
  35. package/dist/types/core/models/api/analytics.d.ts +1 -0
  36. package/dist/types/core/user-events.d.ts +36 -8
  37. package/dist/types/core/utils.d.ts +0 -22
  38. package/dist/types/utils/trackNavigation.d.ts +3 -5
  39. 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);
@@ -3639,6 +3743,16 @@ const Field = ({
3639
3743
  passedValue: focused,
3640
3744
  skipUpdate: focused === void 0
3641
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]);
3642
3756
  return /* @__PURE__ */ jsx(
3643
3757
  "div",
3644
3758
  {
@@ -3766,6 +3880,7 @@ function SelectButtonElement({
3766
3880
  return /* @__PURE__ */ jsx("button", { ...props, ref: toggleButtonRef, type: "button" });
3767
3881
  }
3768
3882
  function SelectButton({
3883
+ name,
3769
3884
  active,
3770
3885
  readonly,
3771
3886
  showList,
@@ -3783,14 +3898,25 @@ function SelectButton({
3783
3898
  isMulti,
3784
3899
  id,
3785
3900
  isSearch,
3786
- hideSearchIcon = false,
3787
3901
  loading,
3788
- textFilter
3902
+ hideSearchIcon = false,
3903
+ textFilter,
3904
+ enableTracking = false
3789
3905
  }) {
3790
- 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
+ };
3791
3916
  return /* @__PURE__ */ jsx(
3792
3917
  SelectButtonElement,
3793
3918
  {
3919
+ name,
3794
3920
  "aria-disabled": readonly,
3795
3921
  "aria-expanded": showList,
3796
3922
  "aria-haspopup": "listbox",
@@ -3803,8 +3929,8 @@ function SelectButton({
3803
3929
  "adyen-kyc-dropdown-button-search": isSearch
3804
3930
  }),
3805
3931
  filterable,
3806
- onClick: !readonly ? toggleList : void 0,
3807
- onKeyDown: !readonly ? onButtonKeyDown : void 0,
3932
+ onClick: !readonly ? (e) => handleSelect(e, toggleList) : void 0,
3933
+ onKeyDown: !readonly ? (e) => handleSelect(e, onButtonKeyDown) : void 0,
3808
3934
  role: filterable || isMulti ? "button" : void 0,
3809
3935
  tabIndex: 0,
3810
3936
  title,
@@ -3907,8 +4033,20 @@ function Checkbox({
3907
4033
  helper,
3908
4034
  checked,
3909
4035
  disabled,
4036
+ enableTracking = false,
3910
4037
  ...props
3911
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
+ };
3912
4050
  return /* @__PURE__ */ jsxs("label", { className: "adyen-kyc-checkbox", children: [
3913
4051
  /* @__PURE__ */ jsx(
3914
4052
  "input",
@@ -3925,7 +4063,7 @@ function Checkbox({
3925
4063
  type: "checkbox",
3926
4064
  onClick: (event) => {
3927
4065
  event.stopPropagation();
3928
- onChange(!checked);
4066
+ handleChange(!checked);
3929
4067
  }
3930
4068
  }
3931
4069
  ),
@@ -4137,7 +4275,8 @@ const Select = ({
4137
4275
  getSearchItem,
4138
4276
  searchText,
4139
4277
  onSearchTextChange,
4140
- showSearchList
4278
+ showSearchList,
4279
+ enableTracking = false
4141
4280
  }) => {
4142
4281
  const filterInputRef = useRef(null);
4143
4282
  const selectContainerRef = useRef(null);
@@ -4149,7 +4288,7 @@ const Select = ({
4149
4288
  const active = items.filter((i) => !isMulti ? i.id === selected : selected == null ? void 0 : selected.includes(i.id)) || [];
4150
4289
  const [isShowListAbove, setIsShowListAbove] = useState(false);
4151
4290
  const [scrollParent, setScrollParent] = useState(null);
4152
- const debouncedOnSearch = useCallback(debounce$1(onSearch, 500), [onSearch]);
4291
+ const debouncedOnSearch = useCallback(debounce$2(onSearch, 500), [onSearch]);
4153
4292
  const closeList = () => {
4154
4293
  if (!onSearchTextChange) setTextFilter(null);
4155
4294
  setIsShowList(false);
@@ -4175,17 +4314,28 @@ const Select = ({
4175
4314
  const hideList = () => {
4176
4315
  setIsShowList(false);
4177
4316
  };
4178
- const handleSelect = (selectedItem) => {
4179
- if (readonly) return;
4180
- if (isMulti) {
4181
- const isAlreadySelected = active.find((item) => item.id === selectedItem.id);
4182
- const newActiveItems = isAlreadySelected ? [...active.filter((i) => i.id !== selectedItem.id).map((i) => i.id)] : [...active.map((i) => i.id), selectedItem.id];
4183
- onChange({ target: { value: newActiveItems, name } });
4184
- } else {
4185
- closeList();
4186
- onChange({ target: { value: selectedItem.id, name } });
4187
- }
4188
- };
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
+ );
4189
4339
  const handleButtonKeyDown = (e) => {
4190
4340
  var _a;
4191
4341
  if (e.key === KEYBOARD_KEYS.enter && filterable && isShowList && textFilter) {
@@ -4246,18 +4396,24 @@ const Select = ({
4246
4396
  break;
4247
4397
  }
4248
4398
  };
4249
- const handleTextFilter = (e) => {
4250
- const { value } = e.target;
4251
- if (isSearch && value.length > 2) {
4252
- debouncedOnSearch(value);
4253
- }
4254
- if (onSearchTextChange) {
4255
- onSearchTextChange == null ? void 0 : onSearchTextChange(value);
4256
- setTextFilter(value);
4257
- } else {
4258
- setTextFilter(value.toLowerCase());
4259
- }
4260
- };
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
+ );
4261
4417
  const toggleList = (e) => {
4262
4418
  e.preventDefault();
4263
4419
  if (isShowList) {
@@ -4309,6 +4465,7 @@ const Select = ({
4309
4465
  SelectButton,
4310
4466
  {
4311
4467
  id: uniqueId ?? null,
4468
+ name,
4312
4469
  active,
4313
4470
  filterInputRef,
4314
4471
  filterable,
@@ -4328,7 +4485,8 @@ const Select = ({
4328
4485
  isSearch,
4329
4486
  hideSearchIcon: !!onSearchTextChange,
4330
4487
  loading,
4331
- textFilter
4488
+ textFilter,
4489
+ enableTracking
4332
4490
  }
4333
4491
  ),
4334
4492
  /* @__PURE__ */ jsx(
@@ -4853,15 +5011,24 @@ const useForwardedRef = (forwardedRef) => {
4853
5011
  };
4854
5012
  const convertFullToHalf = (str) => str.replace(/[!-~]/g, (r) => String.fromCharCode(r.charCodeAt(0) - 65248));
4855
5013
  const InputBase = forwardRef((props, ref) => {
4856
- const { classNameModifiers = [], uniqueId, ...passedProps } = props;
4857
- const { isInvalid, isValid, type = "text", disabled } = props;
5014
+ const { classNameModifiers = [], uniqueId, enableTracking = false, ...passedProps } = props;
5015
+ const { isInvalid, isValid, type = "text", disabled, name } = props;
4858
5016
  const handleInput = (e) => {
4859
5017
  var _a;
5018
+ if (enableTracking) {
5019
+ debouncedInputEvent$1({ actionType: "input", field: name });
5020
+ }
4860
5021
  e.target.value = convertFullToHalf(e.target.value);
4861
5022
  (_a = props.onInput) == null ? void 0 : _a.call(props, e);
4862
5023
  };
4863
5024
  const handleBlur = (e) => {
4864
5025
  var _a, _b;
5026
+ if (enableTracking) {
5027
+ userEvents.addFieldEvent("Interacted with form field", {
5028
+ actionType: "blur",
5029
+ field: name
5030
+ });
5031
+ }
4865
5032
  (_a = props.onBlurHandler) == null ? void 0 : _a.call(props, e);
4866
5033
  if (props.trimOnBlur) {
4867
5034
  e.target.value = e.target.value.trim();
@@ -4870,6 +5037,12 @@ const InputBase = forwardRef((props, ref) => {
4870
5037
  };
4871
5038
  const handleFocus = (e) => {
4872
5039
  var _a;
5040
+ if (enableTracking) {
5041
+ userEvents.addFieldEvent("Interacted with form field", {
5042
+ actionType: "focus",
5043
+ field: name
5044
+ });
5045
+ }
4873
5046
  (_a = props.onFocusHandler) == null ? void 0 : _a.call(props, e);
4874
5047
  };
4875
5048
  const inputClassNames = cx(
@@ -4887,6 +5060,7 @@ const InputBase = forwardRef((props, ref) => {
4887
5060
  "input",
4888
5061
  {
4889
5062
  ...passedProps,
5063
+ name,
4890
5064
  "aria-disabled": disabled,
4891
5065
  "aria-invalid": !isValid,
4892
5066
  "aria-required": passedProps.required,
@@ -7594,9 +7768,20 @@ function RadioGroup({
7594
7768
  disabled = false,
7595
7769
  horizontal = false,
7596
7770
  showContentOnlyOnSelected = false,
7597
- className
7771
+ className,
7772
+ enableTracking = false
7598
7773
  }) {
7599
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
+ };
7600
7785
  return /* @__PURE__ */ jsx(
7601
7786
  "div",
7602
7787
  {
@@ -7617,7 +7802,7 @@ function RadioGroup({
7617
7802
  groupName: name,
7618
7803
  checked: isSelected,
7619
7804
  disabled,
7620
- onClick: () => onChange(item.id)
7805
+ onClick: () => handleChange(item.id)
7621
7806
  },
7622
7807
  item.id
7623
7808
  );
@@ -7970,74 +8155,6 @@ function BusinessRegistrationNumberField({
7970
8155
  )
7971
8156
  ] });
7972
8157
  }
7973
- class UserEvents {
7974
- constructor() {
7975
- this.queue = [];
7976
- this.subscriptions = /* @__PURE__ */ new Set();
7977
- this.baseTrackingPayload = {
7978
- category: "onboarding",
7979
- subCategory: "hosted onboarding",
7980
- countryCode: void 0,
7981
- capabilities: void 0,
7982
- legalEntityId: void 0
7983
- };
7984
- }
7985
- add(...args) {
7986
- this.queue.push(...args);
7987
- }
7988
- notifySubscribers() {
7989
- while (this.queue.length > 0) {
7990
- const lastEvent = this.queue.pop();
7991
- this.subscriptions.forEach((callback) => callback(lastEvent));
7992
- }
7993
- }
7994
- /**
7995
- * Adds an analytics event. Optionally can include a payload.
7996
- */
7997
- addEvent(eventName, properties) {
7998
- const completeEvent = { ...this.baseTrackingPayload, ...properties };
7999
- this.add({ type: "add_event", name: eventName, properties: { ...completeEvent } });
8000
- this.notifySubscribers();
8001
- }
8002
- /**
8003
- * Starts a timer for an event to measure the time it takes for an event to occur. Time is ended when `addEvent` is executed with the same key
8004
- */
8005
- startEvent(eventName) {
8006
- this.add({ type: "start_event", name: eventName });
8007
- this.notifySubscribers();
8008
- }
8009
- /**
8010
- * Subscribes a callback to analytics events. It gets called every time
8011
- * one of the above public methods get called, and the event data is passed back as an array.
8012
- * The callback must have a single argument which is an array of [eventName, eventPayload?].
8013
- * @example
8014
- * ```js
8015
- * const callback = ([eventName, eventPayload]) => console.log(eventName, eventPayload);
8016
- * this.subscribe(callback);
8017
- *
8018
- * const exampleEventPayload = { count: 1, segmentation: { foo: 'bar' } };
8019
- * this.addEvent('exampleEventDidOccur', exampleEventPayload);
8020
- *
8021
- * // `callback` will get called with `['exampleEventDidOccur', exampleEventPayload]`
8022
- * ```
8023
- */
8024
- subscribe(callback) {
8025
- this.subscriptions.add(callback);
8026
- }
8027
- /** Sets params that are sent on every event */
8028
- updateBaseTrackingPayload(baseTrackingPayload) {
8029
- this.baseTrackingPayload = { ...this.baseTrackingPayload, ...baseTrackingPayload };
8030
- }
8031
- /**
8032
- * Removes a subscribed callback
8033
- */
8034
- unsubscribe(callback) {
8035
- if (this.subscriptions.has(callback)) {
8036
- this.subscriptions.delete(callback);
8037
- }
8038
- }
8039
- }
8040
- const userEvents = new UserEvents();
8041
8158
  function ContextGuidance({
8042
8159
  page,
8043
8160
  title,
@@ -10895,7 +11012,7 @@ const isExistingFile = (file) => "existing" in file && file.existing;
10895
11012
  const isNewlyUploadedFile = (file) => !isExistingFile(file);
10896
11013
  function DropzoneFile(props) {
10897
11014
  var _a;
10898
- const { file, errorMessage, onDelete } = props;
11015
+ const { label, file, errorMessage, onDelete } = props;
10899
11016
  const { i18n } = useI18nContext();
10900
11017
  let documentIcon;
10901
11018
  const formatSize = (bytes) => {
@@ -10912,6 +11029,15 @@ function DropzoneFile(props) {
10912
11029
  default:
10913
11030
  documentIcon = "document";
10914
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]);
10915
11041
  return /* @__PURE__ */ jsxs(
10916
11042
  "div",
10917
11043
  {
@@ -11024,7 +11150,8 @@ function Dropzone(props) {
11024
11150
  isOptional,
11025
11151
  maxNumberOfFiles = defaultFileValidationOptions.maxNumberOfFiles,
11026
11152
  maxSize = defaultFileValidationOptions.maxSize,
11027
- allowedFileTypes = defaultFileValidationOptions.allowedFileTypes
11153
+ allowedFileTypes = defaultFileValidationOptions.allowedFileTypes,
11154
+ enableTracking = false
11028
11155
  } = props;
11029
11156
  const { i18n } = useI18nContext();
11030
11157
  const fileInput = useRef(null);
@@ -11099,6 +11226,12 @@ function Dropzone(props) {
11099
11226
  };
11100
11227
  const handleFileChange = (e) => updateFiles(e.target);
11101
11228
  const updateFiles = ({ files }) => {
11229
+ if (enableTracking) {
11230
+ userEvents.addFieldEvent("Interacted with form field", {
11231
+ actionType: "change",
11232
+ field: label || "file picker"
11233
+ });
11234
+ }
11102
11235
  const currentFiles = (data == null ? void 0 : data[name]) || [];
11103
11236
  handleChangeFor(name, "input")([...currentFiles, ...files]);
11104
11237
  };
@@ -11134,6 +11267,7 @@ function Dropzone(props) {
11134
11267
  return /* @__PURE__ */ jsx(
11135
11268
  DropzoneFile,
11136
11269
  {
11270
+ label,
11137
11271
  file,
11138
11272
  onDelete: () => handleFileDelete(file),
11139
11273
  errorMessage: (_a2 = errors == null ? void 0 : errors[name]) == null ? void 0 : _a2.errorMessage
@@ -11183,6 +11317,10 @@ function Dropzone(props) {
11183
11317
  ] });
11184
11318
  }
11185
11319
  const logger$z = createLogger("TextArea");
11320
+ const debouncedInputEvent = debounce$2(
11321
+ (properties) => userEvents.addFieldEvent("Interacted with form field", properties),
11322
+ 500
11323
+ );
11186
11324
  function TextArea(props) {
11187
11325
  const { classNameModifiers, uniqueId, ...passedProps } = props;
11188
11326
  const {
@@ -11192,7 +11330,9 @@ function TextArea(props) {
11192
11330
  readonly = null,
11193
11331
  spellCheck,
11194
11332
  disabled,
11195
- maxLength
11333
+ maxLength,
11334
+ enableTracking = false,
11335
+ name
11196
11336
  } = props;
11197
11337
  const { i18n } = useI18nContext();
11198
11338
  const [value, setValue] = useState("");
@@ -11201,12 +11341,24 @@ function TextArea(props) {
11201
11341
  }
11202
11342
  const handleInput = (e) => {
11203
11343
  var _a;
11344
+ if (enableTracking) {
11345
+ debouncedInputEvent({
11346
+ actionType: "input",
11347
+ field: name
11348
+ });
11349
+ }
11204
11350
  e.target.value = convertFullToHalf(e.target.value);
11205
11351
  setValue(e.target.value);
11206
11352
  (_a = props == null ? void 0 : props.onInput) == null ? void 0 : _a.call(props, e);
11207
11353
  };
11208
11354
  const handleBlur = (e) => {
11209
11355
  var _a, _b;
11356
+ if (enableTracking) {
11357
+ userEvents.addFieldEvent("Interacted with form field", {
11358
+ actionType: "blur",
11359
+ field: name
11360
+ });
11361
+ }
11210
11362
  (_a = props == null ? void 0 : props.onBlurHandler) == null ? void 0 : _a.call(props, e);
11211
11363
  if (props.trimOnBlur) {
11212
11364
  e.target.value = e.target.value.trim();
@@ -11215,6 +11367,12 @@ function TextArea(props) {
11215
11367
  };
11216
11368
  const handleFocus = (e) => {
11217
11369
  var _a;
11370
+ if (enableTracking) {
11371
+ userEvents.addFieldEvent("Interacted with form field", {
11372
+ actionType: "focus",
11373
+ field: name
11374
+ });
11375
+ }
11218
11376
  (_a = props == null ? void 0 : props.onFocusHandler) == null ? void 0 : _a.call(props, e);
11219
11377
  };
11220
11378
  const inputClassNames = cx(
@@ -15675,27 +15833,40 @@ const RadioCardSelect = ({
15675
15833
  renderOptionBody,
15676
15834
  renderOptionFooter,
15677
15835
  isOptionDisabled,
15678
- floatingRadio
15679
- }) => /* @__PURE__ */ jsx("div", { className: className ?? "adyen-kyc-radio-group-card", children: options.map((option) => /* @__PURE__ */ jsx(
15680
- RadioCard,
15681
- {
15682
- optionId: optionId(option),
15683
- optionName: optionName(option),
15684
- optionDescription: optionDescription == null ? void 0 : optionDescription(option),
15685
- optionSubtitle: optionSubtitle == null ? void 0 : optionSubtitle(option),
15686
- isInvalid,
15687
- isSelected: selected === option,
15688
- onSelect: () => onSelect(option),
15689
- name,
15690
- classNames: optionClassNames == null ? void 0 : optionClassNames(option),
15691
- icon: renderOptionIcon == null ? void 0 : renderOptionIcon(option),
15692
- body: renderOptionBody == null ? void 0 : renderOptionBody(option),
15693
- footer: renderOptionFooter == null ? void 0 : renderOptionFooter(option),
15694
- disabled: isOptionDisabled == null ? void 0 : isOptionDisabled(option),
15695
- floatingRadio
15696
- },
15697
- optionId(option)
15698
- )) });
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
+ };
15699
15870
  const idVerificationMethodsMetadata = {
15700
15871
  instantVerification: {
15701
15872
  name: "instantVerification",
@@ -15855,47 +16026,6 @@ var TrustedFieldsProvider = /* @__PURE__ */ ((TrustedFieldsProvider2) => {
15855
16026
  TrustedFieldsProvider2["KOMPANY"] = "kompany";
15856
16027
  return TrustedFieldsProvider2;
15857
16028
  })(TrustedFieldsProvider || {});
15858
- function getBaseTrackingPayload({
15859
- trackingConfig = {
15860
- topLevelLegalEntity: {}
15861
- },
15862
- parentLegalEntity,
15863
- legalEntity,
15864
- task
15865
- }) {
15866
- const { topLevelLegalEntity } = trackingConfig;
15867
- const baseTrackingPayload = {
15868
- task,
15869
- entityType: topLevelLegalEntity == null ? void 0 : topLevelLegalEntity.type,
15870
- topLevelLegalEntityId: topLevelLegalEntity == null ? void 0 : topLevelLegalEntity.id,
15871
- topLevelLegalEntityType: topLevelLegalEntity == null ? void 0 : topLevelLegalEntity.type
15872
- };
15873
- if (parentLegalEntity) {
15874
- baseTrackingPayload.parentLegalEntityId = parentLegalEntity.id;
15875
- baseTrackingPayload.parentLegalEntityType = parentLegalEntity.type;
15876
- }
15877
- if (legalEntity) {
15878
- baseTrackingPayload.legalEntityId = legalEntity.id;
15879
- baseTrackingPayload.entityType = legalEntity.type;
15880
- }
15881
- return baseTrackingPayload;
15882
- }
15883
- const removeOldDataBySchema = (dataSubmitted, savedLegalEntityData) => {
15884
- Object.keys(savedLegalEntityData).forEach((formId) => {
15885
- if (savedLegalEntityData[formId]) {
15886
- Object.keys(savedLegalEntityData[formId]).forEach((key) => {
15887
- if (dataSubmitted[formId][key] === void 0) {
15888
- if (Array.isArray(savedLegalEntityData[formId][key])) {
15889
- dataSubmitted[formId][key] = [];
15890
- } else {
15891
- dataSubmitted[formId][key] = "";
15892
- }
15893
- }
15894
- });
15895
- }
15896
- });
15897
- return dataSubmitted;
15898
- };
15899
16029
  const getLegalEntityCountry = (legalEntityResponse) => legalEntityResponse.type === LegalEntityType.INDIVIDUAL ? legalEntityResponse.individual.residentialAddress.country : legalEntityResponse.organization.registeredAddress.country;
15900
16030
  const getAgeToday = (birthdate) => {
15901
16031
  const today = /* @__PURE__ */ new Date();
@@ -18264,11 +18394,9 @@ function PersonalDetailsComponent(props) {
18264
18394
  }
18265
18395
  };
18266
18396
  const alertProps = getAlertProps();
18267
- const baseTrackingPayload = getBaseTrackingPayload({
18268
- trackingConfig: {
18269
- topLevelLegalEntity: props.parentLegalEntity
18270
- },
18271
- task: props.taskType
18397
+ const baseTrackingPayload = getAssociatedLeAnalyticsPayload({
18398
+ task: props.taskType,
18399
+ ...isDecisionMakerTask ? { associatedLegalEntity: props.parentLegalEntity } : {}
18272
18400
  });
18273
18401
  return /* @__PURE__ */ jsxs(LoaderWrapper, { status, formOpacityWhenLoading: 0.3, loaderSize: "large", children: [
18274
18402
  /* @__PURE__ */ jsx(StateContextSetter, { owner: PERSONAL_DETAILS, stateRef }),
@@ -19012,6 +19140,7 @@ function FilePicker({
19012
19140
  multiple = false,
19013
19141
  label,
19014
19142
  iconPrefix = "generic-document",
19143
+ enableTracking = false,
19015
19144
  // file validation options
19016
19145
  allowedFileTypes,
19017
19146
  maxSize,
@@ -19053,6 +19182,12 @@ function FilePicker({
19053
19182
  if (fileInput2.files) addFiles(fileInput2.files);
19054
19183
  };
19055
19184
  const addFiles = (newFiles) => {
19185
+ if (enableTracking) {
19186
+ userEvents.addFieldEvent("Interacted with form field", {
19187
+ actionType: "change",
19188
+ field: label || "dropzone"
19189
+ });
19190
+ }
19056
19191
  setFiles([...newFiles, ...files]);
19057
19192
  };
19058
19193
  const allowedFileTypesString = allowedFileTypes.join(", ");
@@ -19069,6 +19204,7 @@ function FilePicker({
19069
19204
  files.map((file) => /* @__PURE__ */ jsx(
19070
19205
  DropzoneFile,
19071
19206
  {
19207
+ label,
19072
19208
  file,
19073
19209
  onDelete: () => handleFileDelete(file),
19074
19210
  errorMessage,
@@ -21768,12 +21904,6 @@ function PayoutVerificationMethod(props) {
21768
21904
  const { dataset: countries } = useDataset(datasetIdentifier.country);
21769
21905
  const bankCountryName = ((_b = countries.find((country2) => country2.id === data.bankCountry)) == null ? void 0 : _b.name) ?? data.bankCountry;
21770
21906
  const allowedBankCountries = getAllowedBankCountries(country);
21771
- const baseTrackingPayload = getBaseTrackingPayload({
21772
- trackingConfig: {
21773
- topLevelLegalEntity: legalEntityResponse
21774
- },
21775
- task: TaskTypes.PAYOUT
21776
- });
21777
21907
  const countryField = /* @__PURE__ */ jsx(
21778
21908
  CountryField,
21779
21909
  {
@@ -21913,7 +22043,7 @@ function PayoutVerificationMethod(props) {
21913
22043
  /* @__PURE__ */ jsx(Typography, { children: i18n.get("adyenWillOnlyGetTemporaryAccess") }),
21914
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") }) })
21915
22045
  ] }),
21916
- baseTrackingPayload
22046
+ baseTrackingPayload: { task: TaskTypes.PAYOUT }
21917
22047
  }
21918
22048
  ) : void 0
21919
22049
  ] });
@@ -23924,16 +24054,15 @@ const trackNavigation = ({
23924
24054
  fromForm,
23925
24055
  toForm,
23926
24056
  component,
23927
- baseTrackingPayload,
23928
- i18n
24057
+ baseTrackingPayload
23929
24058
  }) => {
23930
24059
  userEvents.addEvent("Clicked button", {
23931
24060
  ...baseTrackingPayload,
23932
24061
  actionLevel: "page",
23933
24062
  actionType: "navigate",
23934
- page: i18n.get(fromForm),
24063
+ page: fromForm,
23935
24064
  label: component,
23936
- toPage: i18n.get(toForm)
24065
+ toPage: toForm
23937
24066
  });
23938
24067
  };
23939
24068
  const useHideButton = (condition, setHideState) => {
@@ -23989,6 +24118,9 @@ const useFormComposer = ({
23989
24118
  (activeForm2) => forms.find(({ formId }) => formId === activeForm2.formId) ?? activeForm2
23990
24119
  );
23991
24120
  }, [forms]);
24121
+ useEffect(() => {
24122
+ userEvents.updateSharedEventProperties({ page: activeForm.formHeading || activeForm.formId });
24123
+ }, [activeForm]);
23992
24124
  useEffect(() => {
23993
24125
  if (hasAlreadyNavigatedForm) return;
23994
24126
  const openingStep = getOpeningStep(forms, problems == null ? void 0 : problems.remediationActions);
@@ -24044,8 +24176,7 @@ const useFormComposer = ({
24044
24176
  fromForm: activeForm.formName,
24045
24177
  toForm: forms[toFormIndex].formName,
24046
24178
  component: "ActionBar",
24047
- baseTrackingPayload,
24048
- i18n
24179
+ baseTrackingPayload
24049
24180
  });
24050
24181
  trackSectionCompletion(activeForm.formName);
24051
24182
  };
@@ -24060,8 +24191,7 @@ const useFormComposer = ({
24060
24191
  fromForm: fromForm.formName,
24061
24192
  toForm: toForm.formName,
24062
24193
  component: "ActionBar",
24063
- baseTrackingPayload,
24064
- i18n
24194
+ baseTrackingPayload
24065
24195
  });
24066
24196
  }
24067
24197
  };
@@ -27624,10 +27754,25 @@ const FormWrapper = ({
27624
27754
  ExperimentNames.ShowExtraTaxExemptionReasons
27625
27755
  );
27626
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
+ );
27627
27772
  const summaryContent = /* @__PURE__ */ jsx("div", { className: "adyen-kyc-form-wrapper", children: /* @__PURE__ */ jsx(
27628
27773
  Summary,
27629
27774
  {
27630
- trackNavigation: (payload) => trackNavigation({ ...payload, i18n, baseTrackingPayload }),
27775
+ trackNavigation: handleTrackNavigation,
27631
27776
  data: summaryData,
27632
27777
  omittedKeys,
27633
27778
  omittedForms,
@@ -27717,7 +27862,7 @@ const FormWrapper = ({
27717
27862
  gotoForm: gotoFormByFormIndex,
27718
27863
  validateForm,
27719
27864
  taskName,
27720
- trackNavigation: ({ fromForm, toForm, component }) => trackNavigation({ fromForm, toForm, component, baseTrackingPayload, i18n }),
27865
+ trackNavigation: handleTrackNavigation,
27721
27866
  verificationErrors: problems == null ? void 0 : problems.verificationErrors
27722
27867
  }
27723
27868
  )
@@ -27747,6 +27892,22 @@ const validateErrorCode = (error, errorCode) => error && "errorCode" in error &&
27747
27892
  const isValidationError = (error) => validateErrorCode(error, API_VALIDATION_ERROR_CODE);
27748
27893
  const isIdDocumentUploadError = (error) => validateErrorCode(error, ID_DOCUMENT_UPLOAD_ERROR_CODE);
27749
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
+ };
27750
27911
  const processValidationErrors = (validationError, dropinTask, keyMappings) => {
27751
27912
  if ((validationError == null ? void 0 : validationError.invalidFields) && (validationError == null ? void 0 : validationError.invalidFields.length) > 0) {
27752
27913
  return validationError == null ? void 0 : validationError.invalidFields.reduce((acc, invalidField) => {
@@ -28101,7 +28262,6 @@ function BusinessDetailsDropinComponent({
28101
28262
  legalEntityResponse,
28102
28263
  isTargetLegalEntityType,
28103
28264
  parentLegalEntity,
28104
- trackingConfig,
28105
28265
  capabilities,
28106
28266
  taskName,
28107
28267
  hideDropinLayout,
@@ -28127,17 +28287,20 @@ function BusinessDetailsDropinComponent({
28127
28287
  const {
28128
28288
  state: { currentState }
28129
28289
  } = useStateContext();
28290
+ const baseTrackingPayload = useMemo(
28291
+ () => getAssociatedLeAnalyticsPayload({
28292
+ task: taskType,
28293
+ associatedLegalEntity: parentLegalEntity
28294
+ }),
28295
+ [parentLegalEntity, taskType]
28296
+ );
28130
28297
  useEffect(() => {
28131
28298
  onChange == null ? void 0 : onChange(currentState);
28132
28299
  }, [currentState, onChange]);
28133
28300
  useEffect(() => {
28301
+ userEvents.updateBaseTrackingPayload({ task: taskType });
28134
28302
  userEvents.addEvent("Landed on page", {
28135
- ...getBaseTrackingPayload({
28136
- trackingConfig,
28137
- parentLegalEntity,
28138
- legalEntity: legalEntityResponse,
28139
- task: taskType
28140
- }),
28303
+ ...baseTrackingPayload,
28141
28304
  actionLevel: "task",
28142
28305
  actionType: "start"
28143
28306
  });
@@ -28183,15 +28346,6 @@ function BusinessDetailsDropinComponent({
28183
28346
  );
28184
28347
  const [showCompanyStructure, setShowCompanyStructure] = useState(currentCountry !== "US");
28185
28348
  const [showBusinessSelection, setShowBusinessSelection] = useState(false);
28186
- const baseTrackingPayload = useMemo(
28187
- () => getBaseTrackingPayload({
28188
- trackingConfig,
28189
- parentLegalEntity,
28190
- legalEntity: legalEntityResponse,
28191
- task: taskType
28192
- }),
28193
- [legalEntityResponse, parentLegalEntity, taskType, trackingConfig]
28194
- );
28195
28349
  const getConfigurationData = useCallback(
28196
28350
  () => getConfiguration2({
28197
28351
  legalEntityType: LegalEntityType.ORGANIZATION,
@@ -28472,11 +28626,17 @@ function BusinessDetailsDropinComponent({
28472
28626
  ]
28473
28627
  );
28474
28628
  const nextClick = useCallback(() => {
28475
- var _a2;
28629
+ var _a2, _b2;
28476
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;
28477
28632
  switch (activeForm.formId) {
28478
28633
  case "basicInformation":
28479
- 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
+ });
28480
28640
  findBusiness(currentState.data.basicInformation);
28481
28641
  setShowBusinessSelection(true);
28482
28642
  break;
@@ -28488,17 +28648,24 @@ function BusinessDetailsDropinComponent({
28488
28648
  }, [
28489
28649
  currentCountry,
28490
28650
  handleNextClick,
28651
+ forms,
28491
28652
  activeForm.formId,
28492
- verifiedBusiness,
28653
+ activeForm.formName,
28493
28654
  (_e = currentState.validityByForm) == null ? void 0 : _e.basicInformation,
28494
28655
  currentState.data.basicInformation,
28495
28656
  isBusinessSelection,
28657
+ verifiedBusiness,
28496
28658
  findBusiness
28497
28659
  ]);
28498
28660
  const backClick = useCallback(() => {
28499
28661
  if (!COUNTRIES_USING_COMPANY_SEARCH.includes(country)) return handleBackClick == null ? void 0 : handleBackClick();
28500
28662
  switch (activeForm.formId) {
28501
28663
  case "basicInformation": {
28664
+ trackNavigation({
28665
+ fromForm: activeForm.formName,
28666
+ toForm: "basicDetails",
28667
+ component: "back"
28668
+ });
28502
28669
  return showBusinessSelection ? setShowBusinessSelection(false) : void 0;
28503
28670
  }
28504
28671
  case "companyStructure": {
@@ -28523,6 +28690,8 @@ function BusinessDetailsDropinComponent({
28523
28690
  }
28524
28691
  }, [
28525
28692
  activeForm.formId,
28693
+ activeForm.formName,
28694
+ i18n,
28526
28695
  country,
28527
28696
  handleBackClick,
28528
28697
  searching,
@@ -28530,6 +28699,14 @@ function BusinessDetailsDropinComponent({
28530
28699
  showBusinessSelection,
28531
28700
  verifiedBusiness
28532
28701
  ]);
28702
+ const homeClick = () => {
28703
+ trackNavigation({
28704
+ fromForm: activeForm.formName,
28705
+ toForm: "home",
28706
+ component: "home"
28707
+ });
28708
+ handleHomeClick == null ? void 0 : handleHomeClick();
28709
+ };
28533
28710
  const proceedToManualDataEntry = useCallback(async () => {
28534
28711
  await clearTrustedBusinessData().then(() => setShowCompanyStructure(true));
28535
28712
  }, [clearTrustedBusinessData]);
@@ -28575,7 +28752,7 @@ function BusinessDetailsDropinComponent({
28575
28752
  backButtonLabel: i18n.get("goBack"),
28576
28753
  handleNextClick: nextClick,
28577
28754
  handleBackClick: backClick,
28578
- handleHomeClick,
28755
+ handleHomeClick: homeClick,
28579
28756
  children: /* @__PURE__ */ jsx(
28580
28757
  BusinessDetailsComponent,
28581
28758
  {
@@ -28654,7 +28831,6 @@ function CompanyDropinComponent({
28654
28831
  capabilities,
28655
28832
  homeButtonLabel,
28656
28833
  taskType = TaskTypes.COMPANY,
28657
- trackingConfig,
28658
28834
  associationDetail,
28659
28835
  parentLegalEntity,
28660
28836
  legalEntityResponse,
@@ -28679,6 +28855,7 @@ function CompanyDropinComponent({
28679
28855
  const { i18n } = useI18nContext();
28680
28856
  const canChangeEntityType = isSettingEnabled(SettingNames.AllowLegalEntityTypeChange);
28681
28857
  const dataFromResponse = mapLegalEntityToCompany(legalEntityResponse);
28858
+ const isTrustMemberCompany = taskType === TaskTypes.TRUST_MEMBER_COMPANY;
28682
28859
  const { getConfiguration: getConfiguration2 } = useConfigurationApi();
28683
28860
  const [data, setData] = useState(dataFromResponse);
28684
28861
  const [problems, setProblems] = useState(propProblems);
@@ -28687,13 +28864,15 @@ function CompanyDropinComponent({
28687
28864
  );
28688
28865
  const [loadingStatus, setLoadingStatus] = useState("success");
28689
28866
  const formRef = useRef(null);
28690
- const baseTrackingPayload = getBaseTrackingPayload({
28691
- trackingConfig,
28692
- parentLegalEntity,
28693
- legalEntity: legalEntityResponse,
28694
- task: taskType
28867
+ const baseTrackingPayload = getAssociatedLeAnalyticsPayload({
28868
+ task: taskType,
28869
+ ...isTrustMemberCompany ? {
28870
+ associatedLegalEntity: legalEntityResponse,
28871
+ associatedLegalEntityOrg: parentLegalEntity
28872
+ } : {}
28695
28873
  });
28696
28874
  useEffect(() => {
28875
+ userEvents.updateBaseTrackingPayload({ task: taskType });
28697
28876
  userEvents.addEvent("Landed on page", {
28698
28877
  ...baseTrackingPayload,
28699
28878
  actionLevel: "task",
@@ -28791,7 +28970,7 @@ function CompanyDropinComponent({
28791
28970
  };
28792
28971
  const attachAssociationToParentLegalEntity = async ({ legalEntity }) => {
28793
28972
  var _a2;
28794
- if (taskType === TaskTypes.TRUST_MEMBER_COMPANY) {
28973
+ if (isTrustMemberCompany) {
28795
28974
  const existingEntityAssociations = getOwnEntityAssociations(parentLegalEntity);
28796
28975
  const existingRoles = (_a2 = existingEntityAssociations == null ? void 0 : existingEntityAssociations.filter((ea) => ea.legalEntityId === parentLegalEntity.id)) == null ? void 0 : _a2.map(({ type }) => type);
28797
28976
  const newRoles = associationDetail == null ? void 0 : associationDetail.roles;
@@ -29933,13 +30112,8 @@ const BusinessTypeSelection = ({
29933
30112
  )
29934
30113
  );
29935
30114
  }, [data.businessType, data.legalArrangement, currentStep]);
29936
- const baseTrackingPayload = getBaseTrackingPayload({
29937
- legalEntity: legalEntityResponse,
29938
- task: TaskTypes.BUSINESS_TYPE_SELECTION
29939
- });
29940
30115
  useEffect(() => {
29941
30116
  userEvents.addEvent("Landed on page", {
29942
- ...baseTrackingPayload,
29943
30117
  actionLevel: "task",
29944
30118
  actionType: "start"
29945
30119
  });
@@ -29984,7 +30158,6 @@ const BusinessTypeSelection = ({
29984
30158
  };
29985
30159
  const updateLegalEntityAndSelectAccountHolder = async () => {
29986
30160
  const trackingPayload = {
29987
- ...baseTrackingPayload,
29988
30161
  actionLevel: "task",
29989
30162
  actionType: "submit"
29990
30163
  };
@@ -30599,8 +30772,6 @@ const EntityGuidanceStatus = ({
30599
30772
  ] });
30600
30773
  };
30601
30774
  const DecisionMakersComponent = ({
30602
- trackingConfig,
30603
- parentLegalEntity,
30604
30775
  legalEntityResponse,
30605
30776
  capabilityProblems,
30606
30777
  onNavigateToIndividual,
@@ -30640,17 +30811,27 @@ const DecisionMakersComponent = ({
30640
30811
  }, {});
30641
30812
  const uniqueDecisionMakers = mappedDecisionMakers ? Object.values(mappedDecisionMakers) : [];
30642
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]);
30643
30824
  const uniqueDecisionMakersPerType = (roleType) => uniqueDecisionMakers.filter(({ types }) => types.includes(roleType)).length;
30644
30825
  const allowedDecisionMakerTypes = getAllowedDecisionMakerRoles(
30645
30826
  legalEntityResponse,
30646
30827
  TaskTypes.DECISION_MAKER
30647
30828
  );
30648
30829
  const haveMaxDecisionMakers = allowedDecisionMakerTypes.length === 0;
30649
- const baseTrackingPayload = getBaseTrackingPayload({
30650
- trackingConfig,
30651
- parentLegalEntity,
30652
- legalEntity: legalEntityResponse,
30653
- 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
30654
30835
  });
30655
30836
  const addDecisionMakerOnClick = (e) => {
30656
30837
  e.stopPropagation();
@@ -30659,12 +30840,9 @@ const DecisionMakersComponent = ({
30659
30840
  const editDecisionMaker = (decisionMaker) => {
30660
30841
  onNavigateToIndividual(decisionMaker.reference);
30661
30842
  userEvents.addEvent("Clicked button", {
30662
- ...baseTrackingPayload,
30843
+ ...getDecisionMakerTrackingParams(decisionMaker),
30663
30844
  actionLevel: "task",
30664
- actionType: "edit",
30665
- legalEntityId: decisionMaker.reference,
30666
- entityType: decisionMaker.legalEntityType,
30667
- roles: decisionMaker.types
30845
+ actionType: "edit"
30668
30846
  });
30669
30847
  };
30670
30848
  const deleteDecisionMaker = async (decisionMaker) => {
@@ -30680,12 +30858,9 @@ const DecisionMakersComponent = ({
30680
30858
  (curr) => curr.legalEntityId !== decisionMaker.reference
30681
30859
  );
30682
30860
  userEvents.addEvent("Clicked button", {
30683
- ...baseTrackingPayload,
30861
+ ...getDecisionMakerTrackingParams(decisionMaker),
30684
30862
  actionLevel: "task",
30685
30863
  actionType: "remove",
30686
- legalEntityId: decisionMaker.reference,
30687
- entityType: decisionMaker.legalEntityType,
30688
- roles: decisionMaker.types,
30689
30864
  remainingDecisionMakers
30690
30865
  });
30691
30866
  showToast({ type: "success", label: i18n.get("successFullyRemovedDecisionMaker") });
@@ -30734,7 +30909,7 @@ const DecisionMakersComponent = ({
30734
30909
  )) }),
30735
30910
  titleId: "whatIsTheDifferenceBetweenTheseRoles",
30736
30911
  contentId: "differenceBetweenAnOwnerControllingPersonAndSignatory",
30737
- baseTrackingPayload
30912
+ baseTrackingPayload: { task: TaskTypes.DECISION_MAKER_OVERVIEW }
30738
30913
  }
30739
30914
  ),
30740
30915
  showWarning && /* @__PURE__ */ jsx(
@@ -30779,7 +30954,7 @@ const DecisionMakersComponent = ({
30779
30954
  {
30780
30955
  onHome: () => {
30781
30956
  userEvents.addEvent("Clicked button", {
30782
- ...baseTrackingPayload,
30957
+ task: TaskTypes.DECISION_MAKER_OVERVIEW,
30783
30958
  actionLevel: "task",
30784
30959
  actionType: "back",
30785
30960
  label: homeButtonLabel,
@@ -30958,20 +31133,13 @@ const Introduction = ({
30958
31133
  const { i18n } = useI18nContext();
30959
31134
  const introductionScreens = useIntroductionScreens({ legalEntity, tasks });
30960
31135
  const [activeIndex, setActiveIndex] = useState(0);
30961
- const baseTrackingPayload = getBaseTrackingPayload({
30962
- trackingConfig: { topLevelLegalEntity: legalEntity },
30963
- legalEntity,
30964
- task: TaskTypes.INTRODUCTION
30965
- });
30966
31136
  const pageEventDetails = {
30967
- ...baseTrackingPayload,
30968
31137
  actionLevel: "page",
30969
31138
  page: (introductionScreens == null ? void 0 : introductionScreens.length) ? introductionScreens[activeIndex] : void 0
30970
31139
  };
30971
31140
  useEffect(() => {
30972
31141
  if (introductionScreens == null ? void 0 : introductionScreens.length) {
30973
31142
  userEvents.addEvent("Landed on page", {
30974
- ...baseTrackingPayload,
30975
31143
  actionLevel: "task",
30976
31144
  actionType: "start"
30977
31145
  });
@@ -31042,7 +31210,6 @@ const Introduction = ({
31042
31210
  label: buttonLabels.start,
31043
31211
  onClick: () => {
31044
31212
  userEvents.addEvent("Success", {
31045
- ...baseTrackingPayload,
31046
31213
  actionLevel: "task",
31047
31214
  actionType: "start",
31048
31215
  label: buttonLabels.start
@@ -31597,7 +31764,6 @@ const LEGAL_ENTITY_BASE_TASKS = [
31597
31764
  const CONTRACT_TASKS = [TaskTypes.SERVICE_AGREEMENT, TaskTypes.PCI_DSS];
31598
31765
  function TaskListComponent({
31599
31766
  tasks,
31600
- trackingConfig,
31601
31767
  onNavigateToTask,
31602
31768
  legalEntityResponse,
31603
31769
  capabilityProblems,
@@ -31672,16 +31838,22 @@ function TaskListComponent({
31672
31838
  const payoutTaskDescriptionKey = isReview ? "payoutAccountsDescriptionReview" : "payoutAccountsDescription";
31673
31839
  const onEditBusinessSetupClick = () => {
31674
31840
  userEvents.addEvent("Clicked button", {
31675
- ...getBaseTrackingPayload({
31676
- trackingConfig,
31677
- legalEntity: legalEntityResponse,
31678
- task: TaskTypes.TASKS_OVERVIEW
31679
- }),
31841
+ task: TaskTypes.TASKS_OVERVIEW,
31680
31842
  actionLevel: "task",
31681
31843
  actionType: "edit"
31682
31844
  });
31683
31845
  onNavigateToTask(TaskTypes.BUSINESS_TYPE_SELECTION);
31684
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]);
31685
31857
  return /* @__PURE__ */ jsxs("div", { className: "adyen-task-list__container", children: [
31686
31858
  canSeeIntroduction && /* @__PURE__ */ jsx("div", { className: "adyen-task-list__nav", children: /* @__PURE__ */ jsx(
31687
31859
  Button,
@@ -32388,7 +32560,6 @@ function IndividualDropinComponent({
32388
32560
  handleGetIdVerificationStartCheck,
32389
32561
  handleOpenSingpassAuthorizationLink,
32390
32562
  taskType = TaskTypes.INDIVIDUAL,
32391
- trackingConfig,
32392
32563
  parentLegalEntity,
32393
32564
  legalEntityResponse,
32394
32565
  taskName,
@@ -32446,13 +32617,18 @@ function IndividualDropinComponent({
32446
32617
  accountHolder,
32447
32618
  handleOpenSingpassAuthorizationLink
32448
32619
  });
32449
- const baseTrackingPayload = getBaseTrackingPayload({
32450
- trackingConfig,
32451
- parentLegalEntity,
32452
- legalEntity: legalEntityResponse,
32453
- 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
+ }
32454
32629
  });
32455
32630
  useEffect(() => {
32631
+ userEvents.updateBaseTrackingPayload({ task: taskType });
32456
32632
  userEvents.addEvent("Landed on page", {
32457
32633
  ...baseTrackingPayload,
32458
32634
  actionLevel: "task",
@@ -33074,7 +33250,6 @@ function PayoutDetailsDropinComponent({
33074
33250
  handleGetBankVerificationVendors,
33075
33251
  legalEntityResponse,
33076
33252
  associatedLegalArrangement,
33077
- trackingConfig,
33078
33253
  accountHolder,
33079
33254
  problems: propProblems,
33080
33255
  onSubmit: externalOnSubmit,
@@ -33146,13 +33321,9 @@ function PayoutDetailsDropinComponent({
33146
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)
33147
33322
  );
33148
33323
  const existingBankAccountFormat = transferInstrument ? ((_d = existingPayoutDetails == null ? void 0 : existingPayoutDetails.payoutAccountDetails) == null ? void 0 : _d.iban) ? "iban" : "local" : void 0;
33149
- const baseTrackingPayload = getBaseTrackingPayload({
33150
- trackingConfig,
33151
- task: taskType
33152
- });
33153
33324
  useEffect(() => {
33325
+ userEvents.updateBaseTrackingPayload({ task: taskType });
33154
33326
  userEvents.addEvent("Landed on page", {
33155
- ...baseTrackingPayload,
33156
33327
  actionLevel: "task",
33157
33328
  actionType: "start"
33158
33329
  });
@@ -33281,7 +33452,6 @@ function PayoutDetailsDropinComponent({
33281
33452
  documents2.forEach((document2) => {
33282
33453
  var _a2;
33283
33454
  userEvents.addEvent("Success", {
33284
- ...baseTrackingPayload,
33285
33455
  actionLevel: "task",
33286
33456
  actionType: "upload",
33287
33457
  documentType: document2.type,
@@ -33318,7 +33488,6 @@ function PayoutDetailsDropinComponent({
33318
33488
  );
33319
33489
  }
33320
33490
  const baseTracking = {
33321
- ...baseTrackingPayload,
33322
33491
  actionLevel: "task",
33323
33492
  actionType: "submit",
33324
33493
  documentType: DocumentType.BANK_STATEMENT,
@@ -33434,7 +33603,7 @@ function PayoutDetailsDropinComponent({
33434
33603
  nextButtonLabel
33435
33604
  } = useFormComposer({
33436
33605
  problems,
33437
- baseTrackingPayload,
33606
+ baseTrackingPayload: {},
33438
33607
  forms,
33439
33608
  submitButtonLabel,
33440
33609
  externalBackClick,
@@ -33475,7 +33644,7 @@ function PayoutDetailsDropinComponent({
33475
33644
  loadingStatus,
33476
33645
  forms,
33477
33646
  onSubmit,
33478
- baseTrackingPayload,
33647
+ baseTrackingPayload: {},
33479
33648
  gotoFormByFormIndex,
33480
33649
  nextButtonLabel,
33481
33650
  homeButtonLabel,
@@ -33553,17 +33722,11 @@ function PciDropinComponent({
33553
33722
  pciTemplateResponse,
33554
33723
  handleHomeClick,
33555
33724
  handleSign,
33556
- taskType = TaskTypes.PCI_DSS,
33557
- trackingConfig
33725
+ taskType = TaskTypes.PCI_DSS
33558
33726
  }) {
33559
33727
  var _a, _b, _c, _d;
33560
33728
  const { i18n } = useI18nContext();
33561
33729
  const { showToast } = useToastContext();
33562
- const baseTrackingPayload = getBaseTrackingPayload({
33563
- trackingConfig,
33564
- legalEntity: legalEntityResponse,
33565
- task: taskType
33566
- });
33567
33730
  const [loadingStatus, setLoadingStatus] = useState();
33568
33731
  const hasExpired = useHasExpired();
33569
33732
  const signButtonLabel = i18n.get("sign");
@@ -33595,7 +33758,6 @@ function PciDropinComponent({
33595
33758
  const handleSignClick = async () => {
33596
33759
  if (loadingStatus === "loading") return;
33597
33760
  const baseTracking = {
33598
- ...baseTrackingPayload,
33599
33761
  actionLevel: "task",
33600
33762
  actionType: "sign",
33601
33763
  label: signButtonLabel
@@ -33629,7 +33791,6 @@ function PciDropinComponent({
33629
33791
  };
33630
33792
  const goHome = () => {
33631
33793
  userEvents.addEvent("Clicked button", {
33632
- ...baseTrackingPayload,
33633
33794
  actionLevel: "task",
33634
33795
  actionType: "back",
33635
33796
  label: homeButtonLabel
@@ -33638,15 +33799,14 @@ function PciDropinComponent({
33638
33799
  };
33639
33800
  const handleExpandSection = (title) => {
33640
33801
  userEvents.addEvent("Clicked accordion", {
33641
- ...baseTrackingPayload,
33642
33802
  actionLevel: "task",
33643
33803
  actionType: "open",
33644
33804
  label: title
33645
33805
  });
33646
33806
  };
33647
33807
  useEffect(() => {
33808
+ userEvents.updateBaseTrackingPayload({ task: taskType });
33648
33809
  userEvents.addEvent("Landed on page", {
33649
- ...baseTrackingPayload,
33650
33810
  actionLevel: "task",
33651
33811
  actionType: "start"
33652
33812
  });
@@ -34551,21 +34711,14 @@ function ServiceAgreementDropinComponent({
34551
34711
  handleHomeClick,
34552
34712
  handleAddSigner,
34553
34713
  handleSign,
34554
- taskType,
34555
34714
  serviceAgreementTypes,
34556
- serviceAgreementAcceptanceInfos,
34557
- trackingConfig
34715
+ serviceAgreementAcceptanceInfos
34558
34716
  }) {
34559
34717
  var _a, _b;
34560
34718
  const { i18n } = useI18nContext();
34561
34719
  const { showToast } = useToastContext();
34562
34720
  const { isExperimentEnabled } = useExperimentsContext();
34563
34721
  const isAgeVerificationEnabled = isExperimentEnabled("EnableAgeVerification");
34564
- const baseTrackingPayload = getBaseTrackingPayload({
34565
- trackingConfig,
34566
- legalEntity: legalEntityResponse,
34567
- task: taskType
34568
- });
34569
34722
  const [loadingStatus, setLoadingStatus] = useState();
34570
34723
  const signedForms = serviceAgreementAcceptanceInfos.map((serviceAgreementAcceptanceInfo) => ({
34571
34724
  formId: serviceAgreementAcceptanceInfo.id,
@@ -34630,7 +34783,6 @@ function ServiceAgreementDropinComponent({
34630
34783
  const signers = getSigners();
34631
34784
  const handleSignClick = async () => {
34632
34785
  const baseTracking = {
34633
- ...baseTrackingPayload,
34634
34786
  actionLevel: "task",
34635
34787
  actionType: "sign"
34636
34788
  };
@@ -34668,7 +34820,6 @@ function ServiceAgreementDropinComponent({
34668
34820
  };
34669
34821
  const goHome = () => {
34670
34822
  userEvents.addEvent("Clicked button", {
34671
- ...baseTrackingPayload,
34672
34823
  actionLevel: "task",
34673
34824
  actionType: "back",
34674
34825
  label: homeButtonLabel
@@ -34677,7 +34828,6 @@ function ServiceAgreementDropinComponent({
34677
34828
  };
34678
34829
  const handleExpandSection = (title) => {
34679
34830
  userEvents.addEvent("Clicked accordion", {
34680
- ...baseTrackingPayload,
34681
34831
  actionLevel: "task",
34682
34832
  actionType: "open",
34683
34833
  label: title
@@ -34689,7 +34839,6 @@ function ServiceAgreementDropinComponent({
34689
34839
  }, [serviceAgreementAcceptanceInfos]);
34690
34840
  useEffect(() => {
34691
34841
  userEvents.addEvent("Landed on page", {
34692
- ...baseTrackingPayload,
34693
34842
  actionLevel: "task",
34694
34843
  actionType: "start"
34695
34844
  });
@@ -34958,7 +35107,6 @@ function SolePropDropinComponent({
34958
35107
  onSubmit: onExternalSubmit,
34959
35108
  onChange,
34960
35109
  taskType,
34961
- trackingConfig,
34962
35110
  handleHomeClick,
34963
35111
  handleCreateDocument,
34964
35112
  handleGetDocument,
@@ -34992,11 +35140,9 @@ function SolePropDropinComponent({
34992
35140
  const dataFromResponse = getDataWithDefaultAddress(legalEntityResponse, parentLegalEntity);
34993
35141
  const [data, setData] = useState(dataFromResponse);
34994
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;
34995
- const baseTrackingPayload = getBaseTrackingPayload({
34996
- trackingConfig,
34997
- parentLegalEntity,
34998
- legalEntity: legalEntityResponse,
34999
- task: taskType
35143
+ const baseTrackingPayload = getAssociatedLeAnalyticsPayload({
35144
+ task: taskType,
35145
+ associatedLegalEntity: legalEntityResponse
35000
35146
  });
35001
35147
  const getConfigurationData = useCallback(
35002
35148
  () => getConfiguration2({
@@ -35075,6 +35221,7 @@ function SolePropDropinComponent({
35075
35221
  };
35076
35222
  useEffect(() => {
35077
35223
  var _a2;
35224
+ userEvents.updateBaseTrackingPayload({ task: taskType });
35078
35225
  const documentIds = ((_a2 = legalEntityResponse == null ? void 0 : legalEntityResponse.documentDetails) == null ? void 0 : _a2.map((documentReference) => documentReference.id)) || [];
35079
35226
  try {
35080
35227
  if (documentIds.length) {
@@ -35281,7 +35428,6 @@ function TrustDropinComponent({
35281
35428
  handleUpdateDocument,
35282
35429
  handleAddressSearch,
35283
35430
  handleFindAddress,
35284
- trackingConfig,
35285
35431
  taskType,
35286
35432
  problems: problemsProp,
35287
35433
  onSubmit: externalOnSubmit,
@@ -35360,6 +35506,7 @@ function TrustDropinComponent({
35360
35506
  }, [derivedProps, formValidity, problems]);
35361
35507
  useEffect(() => {
35362
35508
  var _a2;
35509
+ userEvents.updateBaseTrackingPayload({ task: taskType });
35363
35510
  const documentIds = ((_a2 = legalEntityResponse == null ? void 0 : legalEntityResponse.documentDetails) == null ? void 0 : _a2.map((documentReference) => documentReference.id)) || [];
35364
35511
  try {
35365
35512
  if (documentIds.length) {
@@ -35501,11 +35648,9 @@ function TrustDropinComponent({
35501
35648
  const value = getProp(data2, detail);
35502
35649
  return !isEmpty$1(value);
35503
35650
  });
35504
- const baseTrackingPayload = getBaseTrackingPayload({
35505
- trackingConfig,
35506
- parentLegalEntity,
35507
- legalEntity: legalEntityResponse,
35508
- task: taskType
35651
+ const baseTrackingPayload = getAssociatedLeAnalyticsPayload({
35652
+ task: taskType,
35653
+ associatedLegalEntity: legalEntityResponse
35509
35654
  });
35510
35655
  const {
35511
35656
  handleNextClick,
@@ -35592,6 +35737,13 @@ const useNavigation = ({
35592
35737
  const shouldShowSingpassSelection = isEligibleForSingpass && !hasSeenSingpassSelection;
35593
35738
  const [taskHistory, setTaskHistory] = useState(["default"]);
35594
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
+ );
35595
35747
  const navigateTo = useCallback(
35596
35748
  (task, deletePreviousHistory = false) => {
35597
35749
  const pushNewTask = () => setTaskHistory((taskHistory2) => deletePreviousHistory ? [task] : [...taskHistory2, task]);
@@ -35599,10 +35751,10 @@ const useNavigation = ({
35599
35751
  setTimeout(pushNewTask);
35600
35752
  } else {
35601
35753
  pushNewTask();
35602
- onNavigate == null ? void 0 : onNavigate(task);
35754
+ handleNavigation(task);
35603
35755
  }
35604
35756
  },
35605
- [onNavigate]
35757
+ [handleNavigation]
35606
35758
  );
35607
35759
  const navigateBack = useCallback(
35608
35760
  (stepCount = 1) => {
@@ -35613,13 +35765,14 @@ const useNavigation = ({
35613
35765
  }
35614
35766
  if (prevTask === TaskTypes.TASKS_OVERVIEW) {
35615
35767
  setTaskHistory([TaskTypes.TASKS_OVERVIEW]);
35616
- onNavigate == null ? void 0 : onNavigate(TaskTypes.TASKS_OVERVIEW);
35768
+ handleNavigation == null ? void 0 : handleNavigation(TaskTypes.TASKS_OVERVIEW);
35617
35769
  return;
35618
35770
  }
35619
35771
  setTaskHistory(taskHistory.slice(0, -1 * stepCount));
35620
- onNavigate == null ? void 0 : onNavigate(prevTask);
35772
+ handleNavigation == null ? void 0 : handleNavigation(prevTask);
35773
+ userEvents.updateBaseTrackingPayload({ task: prevTask });
35621
35774
  },
35622
- [taskHistory, onNavigate]
35775
+ [taskHistory, handleNavigation]
35623
35776
  );
35624
35777
  useEffect(() => {
35625
35778
  if (!window.history.state) window.history.pushState({}, "");
@@ -35908,6 +36061,7 @@ function DropinComposerComponent({
35908
36061
  if (legalEntity) {
35909
36062
  userEvents.updateBaseTrackingPayload({
35910
36063
  legalEntityId: legalEntity.id,
36064
+ entityType: legalEntity.type,
35911
36065
  capabilities: Object.keys(legalEntity.capabilities),
35912
36066
  countryCode: getLegalEntityCountry(legalEntity)
35913
36067
  });
@@ -36196,13 +36350,7 @@ function DropinComposerComponent({
36196
36350
  showToast({ label: i18n.get("failedToDownloadPci"), type: "error" });
36197
36351
  } finally {
36198
36352
  userEvents.addEvent("Clicked button", {
36199
- ...getBaseTrackingPayload({
36200
- trackingConfig: {
36201
- topLevelLegalEntity: legalEntityResponse
36202
- },
36203
- legalEntity: rootLegalEntity,
36204
- task: TaskTypes.PCI_DSS
36205
- }),
36353
+ task: TaskTypes.PCI_DSS,
36206
36354
  actionLevel: "task",
36207
36355
  actionType: "download"
36208
36356
  });
@@ -36210,12 +36358,6 @@ function DropinComposerComponent({
36210
36358
  };
36211
36359
  useEffect(() => {
36212
36360
  userEvents.addEvent("Landed on page", {
36213
- ...getBaseTrackingPayload({
36214
- trackingConfig: {
36215
- topLevelLegalEntity: rootLegalEntity
36216
- },
36217
- task: TaskTypes.TASKS_OVERVIEW
36218
- }),
36219
36361
  actionLevel: "journey",
36220
36362
  actionType: "start"
36221
36363
  });
@@ -36339,7 +36481,6 @@ function DropinComposerComponent({
36339
36481
  return /* @__PURE__ */ jsx(
36340
36482
  TaskListComponent,
36341
36483
  {
36342
- trackingConfig: { topLevelLegalEntity: legalEntityResponse },
36343
36484
  onNavigateToTask,
36344
36485
  tasks,
36345
36486
  legalEntityResponse: rootLegalEntity,
@@ -36358,9 +36499,6 @@ function DropinComposerComponent({
36358
36499
  return /* @__PURE__ */ jsx(
36359
36500
  DecisionMakersComponent,
36360
36501
  {
36361
- trackingConfig: {
36362
- topLevelLegalEntity: legalEntityResponse
36363
- },
36364
36502
  parentLegalEntity: associatedLegalEntityParent,
36365
36503
  legalEntityResponse: rootLegalEntity,
36366
36504
  onNavigateToIndividual: (legalEntityId) => onNavigateToDecisionMakerIndividual(TaskTypes.DECISION_MAKER, legalEntityId),
@@ -36375,9 +36513,6 @@ function DropinComposerComponent({
36375
36513
  return /* @__PURE__ */ jsx(
36376
36514
  IndividualDropinComponent,
36377
36515
  {
36378
- trackingConfig: {
36379
- topLevelLegalEntity: legalEntityResponse
36380
- },
36381
36516
  taskType: TaskTypes.INDIVIDUAL,
36382
36517
  taskName: hasTrust ? "individualTrusteeDetails" : "individualDetails",
36383
36518
  parentLegalEntity: null,
@@ -36422,9 +36557,6 @@ function DropinComposerComponent({
36422
36557
  return /* @__PURE__ */ jsx(
36423
36558
  IndividualDropinComponent,
36424
36559
  {
36425
- trackingConfig: {
36426
- topLevelLegalEntity: legalEntityResponse
36427
- },
36428
36560
  taskType: TaskTypes.DECISION_MAKER,
36429
36561
  parentLegalEntity: associatedLegalEntityParent,
36430
36562
  legalEntityResponse: associatedLegalEntity,
@@ -36454,9 +36586,6 @@ function DropinComposerComponent({
36454
36586
  return /* @__PURE__ */ jsx(
36455
36587
  IndividualDropinComponent,
36456
36588
  {
36457
- trackingConfig: {
36458
- topLevelLegalEntity: legalEntityResponse
36459
- },
36460
36589
  taskType: TaskTypes.TRUST_MEMBER_COMPANY_OWNER,
36461
36590
  parentLegalEntity: associatedLegalEntityParent,
36462
36591
  legalEntityResponse: associatedLegalEntity,
@@ -36485,9 +36614,6 @@ function DropinComposerComponent({
36485
36614
  return /* @__PURE__ */ jsx(
36486
36615
  IndividualDropinComponent,
36487
36616
  {
36488
- trackingConfig: {
36489
- topLevelLegalEntity: legalEntityResponse
36490
- },
36491
36617
  taskType: TaskTypes.TRUST_MEMBER_INDIVIDUAL,
36492
36618
  parentLegalEntity: associatedLegalArrangement,
36493
36619
  legalEntityResponse: associatedLegalEntity,
@@ -36516,9 +36642,6 @@ function DropinComposerComponent({
36516
36642
  CompanyDropinComponent,
36517
36643
  {
36518
36644
  ...args,
36519
- trackingConfig: {
36520
- topLevelLegalEntity: legalEntityResponse
36521
- },
36522
36645
  taskType: TaskTypes.COMPANY,
36523
36646
  taskName: hasTrust ? "companyTrusteeDetails" : "companyDetails",
36524
36647
  legalEntityResponse: rootLegalEntity,
@@ -36545,9 +36668,6 @@ function DropinComposerComponent({
36545
36668
  BusinessDetailsDropinComponent,
36546
36669
  {
36547
36670
  ...args,
36548
- trackingConfig: {
36549
- topLevelLegalEntity: legalEntityResponse
36550
- },
36551
36671
  taskType: TaskTypes.BUSINESS_DETAILS,
36552
36672
  taskName: hasTrust ? "businessTrusteeDetails" : "businessDetails",
36553
36673
  legalEntityResponse: rootLegalEntity,
@@ -36583,9 +36703,6 @@ function DropinComposerComponent({
36583
36703
  CompanyDropinComponent,
36584
36704
  {
36585
36705
  ...args,
36586
- trackingConfig: {
36587
- topLevelLegalEntity: legalEntityResponse
36588
- },
36589
36706
  taskType: TaskTypes.TRUST_MEMBER_COMPANY,
36590
36707
  parentLegalEntity: associatedLegalArrangement,
36591
36708
  legalEntityResponse: associatedLegalEntity,
@@ -36606,7 +36723,6 @@ function DropinComposerComponent({
36606
36723
  return /* @__PURE__ */ jsx(
36607
36724
  PayoutDetailsDropinComponent,
36608
36725
  {
36609
- trackingConfig: { topLevelLegalEntity: legalEntityResponse },
36610
36726
  taskType: currentTask,
36611
36727
  taskName: currentTask === TaskTypes.PAYIN ? "payinDetails" : "payoutDetails",
36612
36728
  problems: (_f = capabilityProblems == null ? void 0 : capabilityProblems.BankAccount) == null ? void 0 : _f[transferInstrument == null ? void 0 : transferInstrument.id],
@@ -36635,9 +36751,6 @@ function DropinComposerComponent({
36635
36751
  TrustDropinComponent,
36636
36752
  {
36637
36753
  ...args,
36638
- trackingConfig: {
36639
- topLevelLegalEntity: legalEntityResponse
36640
- },
36641
36754
  taskType: TaskTypes.TRUST,
36642
36755
  problems: (_g = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _g[associatedLegalArrangement == null ? void 0 : associatedLegalArrangement.id],
36643
36756
  parentLegalEntity: rootLegalEntity,
@@ -36700,7 +36813,6 @@ function DropinComposerComponent({
36700
36813
  {
36701
36814
  legalEntityResponse: rootLegalEntity,
36702
36815
  pciTemplateResponse,
36703
- trackingConfig: { topLevelLegalEntity: legalEntityResponse },
36704
36816
  taskType: TaskTypes.PCI_DSS,
36705
36817
  handleHomeClick: navigateBack,
36706
36818
  handleSign: async (...params) => {
@@ -36733,7 +36845,6 @@ function DropinComposerComponent({
36733
36845
  ServiceAgreementDropinComponent,
36734
36846
  {
36735
36847
  legalEntityResponse: rootLegalEntity,
36736
- trackingConfig: { topLevelLegalEntity: legalEntityResponse },
36737
36848
  taskType: TaskTypes.SERVICE_AGREEMENT,
36738
36849
  serviceAgreementTypes,
36739
36850
  serviceAgreementAcceptanceInfos: serviceAgreementAcceptanceInfosWithNames,
@@ -36771,9 +36882,6 @@ function DropinComposerComponent({
36771
36882
  return /* @__PURE__ */ jsx(
36772
36883
  IndividualDropinComponent,
36773
36884
  {
36774
- trackingConfig: {
36775
- topLevelLegalEntity: legalEntityResponse
36776
- },
36777
36885
  taskName: "legalRepresentative",
36778
36886
  taskType: TaskTypes.LEGAL_REPRESENTATIVE_DETAILS,
36779
36887
  parentLegalEntity: rootLegalEntity,
@@ -38807,7 +38915,6 @@ function UpdateLegalEntityForHighExposure({
38807
38915
  parentLegalEntity,
38808
38916
  capabilities,
38809
38917
  country,
38810
- trackingConfig,
38811
38918
  problems: problemsProp,
38812
38919
  onSubmit: externalOnSubmit,
38813
38920
  onChange,
@@ -38941,10 +39048,8 @@ function UpdateLegalEntityForHighExposure({
38941
39048
  const value = getProp(data2, detail);
38942
39049
  return !isEmpty$1(value);
38943
39050
  });
38944
- const baseTrackingPayload = getBaseTrackingPayload({
38945
- trackingConfig,
38946
- parentLegalEntity,
38947
- legalEntity
39051
+ const baseTrackingPayload = getAssociatedLeAnalyticsPayload({
39052
+ associatedLegalEntity: parentLegalEntity
38948
39053
  });
38949
39054
  const {
38950
39055
  handleNextClick,
@@ -39244,33 +39349,38 @@ const useAnalytics = async ({
39244
39349
  const { i18n } = useI18nContext();
39245
39350
  const { isEmbeddedDropin, loadingContext: base } = useAuthContext();
39246
39351
  const loadingContext = `${base}api/${COMPONENTS_API_VERSION}/`;
39247
- (async () => {
39248
- if (isEmbeddedDropin) {
39249
- try {
39250
- const sessionData = {
39251
- sdkVersion,
39252
- componentName,
39253
- userAgent: navigator.userAgent,
39254
- legalEntityId
39255
- };
39256
- const sessionResponse = await getAnalyticsSession(loadingContext, sessionData);
39257
- if (!(sessionResponse == null ? void 0 : sessionResponse.id)) {
39258
- throw Error("Analytics session Id not received");
39352
+ useEffect(() => {
39353
+ (async () => {
39354
+ const sessionData = {
39355
+ sdkVersion,
39356
+ componentName,
39357
+ userAgent: navigator.userAgent,
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);
39259
39373
  }
39374
+ } else if (onUserEvent) {
39260
39375
  userEvents.subscribe((data) => {
39261
- const eventItem = convertToEmbeddedEvent(data, sessionData);
39262
- if (eventItem.eventData) {
39263
- eventItem.eventData.locale = i18n.locale;
39264
- }
39265
- pushEvents(loadingContext, sessionResponse.id, eventItem);
39376
+ onUserEvent({
39377
+ ...data,
39378
+ properties: { ...data.properties || {}, ...sessionData }
39379
+ });
39266
39380
  });
39267
- } catch (e) {
39268
- console.error("Failed to initiate analytics for component", e);
39269
39381
  }
39270
- } else if (onUserEvent) {
39271
- userEvents.subscribe(onUserEvent);
39272
- }
39273
- })();
39382
+ })();
39383
+ }, []);
39274
39384
  };
39275
39385
  const logger$8 = createLogger("loadCountries");
39276
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") });
@@ -39566,7 +39676,7 @@ const ConfigurationApiProvider = ({
39566
39676
  }) => {
39567
39677
  const authContext = useAuthContext();
39568
39678
  const { isEmbeddedDropin, loadingContext } = authContext;
39569
- const sdkVersion = "2.60.0";
39679
+ const sdkVersion = "2.61.0";
39570
39680
  useAnalytics({
39571
39681
  onUserEvent,
39572
39682
  legalEntityId: rootLegalEntityId,
@@ -40239,7 +40349,7 @@ const DebugModal = ({ rootLegalEntityId, onExit, getRootLegalEntity }) => {
40239
40349
  };
40240
40350
  const copyToClipboard = async () => {
40241
40351
  const toCopy = {
40242
- sdkVersion: "2.60.0",
40352
+ sdkVersion: "2.61.0",
40243
40353
  experiments: Object.fromEntries(allExperimentsWithValues),
40244
40354
  settings: Object.fromEntries(allSettingsWithValues)
40245
40355
  };
@@ -40304,7 +40414,7 @@ const DebugModal = ({ rootLegalEntityId, onExit, getRootLegalEntity }) => {
40304
40414
  /* @__PURE__ */ jsx("div", { className: "adyen-kyc-debug-modal__meta", children: /* @__PURE__ */ jsx("table", { children: /* @__PURE__ */ jsxs("tbody", { children: [
40305
40415
  /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsxs("td", { children: [
40306
40416
  /* @__PURE__ */ jsx("span", { className: "adyen-kyc-debug-modal__table-key", children: "SDK version" }),
40307
- /* @__PURE__ */ jsx(Tag, { variant: "green", className: "adyen-kyc-tag--large", children: "2.60.0" })
40417
+ /* @__PURE__ */ jsx(Tag, { variant: "green", className: "adyen-kyc-tag--large", children: "2.61.0" })
40308
40418
  ] }) }),
40309
40419
  /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsxs("td", { children: [
40310
40420
  /* @__PURE__ */ jsx("span", { className: "adyen-kyc-debug-modal__table-key", children: "rootLegalEntityId" }),