@adyen/kyc-components 2.61.2 → 2.62.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.
@@ -24,7 +24,6 @@ class UserEvents {
24
24
  subCategory: "hosted onboarding",
25
25
  countryCode: void 0,
26
26
  capabilities: void 0,
27
- legalEntityId: void 0,
28
27
  task: void 0
29
28
  };
30
29
  this.sharedEventProperties = {};
@@ -47,11 +46,14 @@ class UserEvents {
47
46
  this.notifySubscribers();
48
47
  }
49
48
  /**
50
- * 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
49
+ * Adds an event with context specific to page-related events
51
50
  */
52
- startEvent(eventName) {
53
- this.add({ type: "start_event", name: eventName });
54
- this.notifySubscribers();
51
+ addPageEvent(eventName, properties) {
52
+ this.addEvent(eventName, {
53
+ actionLevel: "page",
54
+ page: this.sharedEventProperties.page,
55
+ ...properties
56
+ });
55
57
  }
56
58
  /**
57
59
  * Adds an event with context specific to field-related events
@@ -63,6 +65,13 @@ class UserEvents {
63
65
  ...properties
64
66
  });
65
67
  }
68
+ /**
69
+ * 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
70
+ */
71
+ startEvent(eventName) {
72
+ this.add({ type: "start_event", name: eventName });
73
+ this.notifySubscribers();
74
+ }
66
75
  /**
67
76
  * Subscribes a callback to analytics events. It gets called every time
68
77
  * one of the above public methods get called, and the event data is passed back as an array.
@@ -110,7 +119,7 @@ const getAssociatedLeAnalyticsPayload = ({
110
119
  associatedLegalEntityOrgType: associatedLegalEntityOrg == null ? void 0 : associatedLegalEntityOrg.type
111
120
  } : {}
112
121
  });
113
- const debouncedInputEvent$1 = debounce$1(
122
+ const debouncedInputEvent = debounce$1(
114
123
  (properties) => userEvents.addFieldEvent("Interacted with form field", properties),
115
124
  500
116
125
  );
@@ -4398,7 +4407,7 @@ const Select = ({
4398
4407
  (e) => {
4399
4408
  const { value } = e.target;
4400
4409
  if (enableTracking) {
4401
- debouncedInputEvent$1({ actionType: "input", field: name });
4410
+ debouncedInputEvent({ actionType: "input", field: name });
4402
4411
  }
4403
4412
  if (isSearch && value.length > 2) {
4404
4413
  debouncedOnSearch(value);
@@ -5014,7 +5023,7 @@ const InputBase = forwardRef((props, ref) => {
5014
5023
  const handleInput = (e) => {
5015
5024
  var _a;
5016
5025
  if (enableTracking) {
5017
- debouncedInputEvent$1({ actionType: "input", field: name });
5026
+ debouncedInputEvent({ actionType: "input", field: name });
5018
5027
  }
5019
5028
  e.target.value = convertFullToHalf(e.target.value);
5020
5029
  (_a = props.onInput) == null ? void 0 : _a.call(props, e);
@@ -11314,10 +11323,6 @@ function Dropzone(props) {
11314
11323
  ] });
11315
11324
  }
11316
11325
  const logger$z = createLogger("TextArea");
11317
- const debouncedInputEvent = debounce$2(
11318
- (properties) => userEvents.addFieldEvent("Interacted with form field", properties),
11319
- 500
11320
- );
11321
11326
  function TextArea(props) {
11322
11327
  const { classNameModifiers, uniqueId, ...passedProps } = props;
11323
11328
  const {
@@ -23969,9 +23974,9 @@ function Summary({
23969
23974
  icon: "edit",
23970
23975
  onClick: () => {
23971
23976
  trackNavigation2({
23972
- fromForm: "summary",
23977
+ actionType: "edit",
23973
23978
  toForm: formName,
23974
- component: "Pencil icon"
23979
+ label: "Pencil icon"
23975
23980
  });
23976
23981
  editForm(formId);
23977
23982
  },
@@ -24049,18 +24054,18 @@ function Summary({
24049
24054
  ] });
24050
24055
  }
24051
24056
  const trackNavigation = ({
24052
- fromForm,
24057
+ actionType,
24053
24058
  toForm,
24054
- component,
24059
+ label,
24060
+ returnValue,
24055
24061
  baseTrackingPayload
24056
24062
  }) => {
24057
- userEvents.addEvent("Clicked button", {
24058
- ...baseTrackingPayload,
24059
- actionLevel: "page",
24060
- actionType: "navigate",
24061
- page: fromForm,
24062
- label: component,
24063
- toPage: toForm
24063
+ userEvents.addPageEvent("Clicked button", {
24064
+ actionType,
24065
+ toPage: toForm,
24066
+ label,
24067
+ returnValue,
24068
+ ...baseTrackingPayload
24064
24069
  });
24065
24070
  };
24066
24071
  const useHideButton = (condition, setHideState) => {
@@ -24117,7 +24122,7 @@ const useFormComposer = ({
24117
24122
  );
24118
24123
  }, [forms]);
24119
24124
  useEffect(() => {
24120
- userEvents.updateSharedEventProperties({ page: activeForm.formHeading || activeForm.formId });
24125
+ userEvents.updateSharedEventProperties({ page: activeForm.formName });
24121
24126
  }, [activeForm]);
24122
24127
  useEffect(() => {
24123
24128
  if (hasAlreadyNavigatedForm) return;
@@ -24126,14 +24131,6 @@ const useFormComposer = ({
24126
24131
  setActiveForm(openingStep);
24127
24132
  }
24128
24133
  }, [activeForm, forms, problems == null ? void 0 : problems.remediationActions, hasAlreadyNavigatedForm]);
24129
- const trackSectionCompletion = (formName) => {
24130
- userEvents.addEvent("Success", {
24131
- ...baseTrackingPayload,
24132
- actionLevel: "page",
24133
- actionType: "next",
24134
- page: formName
24135
- });
24136
- };
24137
24134
  const gotoFormByFormIndex = (nextFormIndex) => {
24138
24135
  if (formRef == null ? void 0 : formRef.current.verifyForm) {
24139
24136
  formRef.current.verifyForm(activeForm.formId).then((isVerified) => {
@@ -24161,6 +24158,12 @@ const useFormComposer = ({
24161
24158
  }
24162
24159
  if (!activeForm.isValid) {
24163
24160
  validateCurrentForm();
24161
+ trackNavigation({
24162
+ actionType: "next",
24163
+ label: "next",
24164
+ returnValue: "validation error",
24165
+ baseTrackingPayload
24166
+ });
24164
24167
  return;
24165
24168
  }
24166
24169
  if (isFinalStep) {
@@ -24168,27 +24171,25 @@ const useFormComposer = ({
24168
24171
  return;
24169
24172
  }
24170
24173
  setShouldValidate(false);
24171
- const toFormIndex = forms.findIndex((form) => form.formId === activeForm.formId) + 1;
24174
+ const toFormIndex = currentStep + 1;
24172
24175
  gotoFormByFormIndex(toFormIndex);
24173
24176
  trackNavigation({
24174
- fromForm: activeForm.formName,
24177
+ actionType: "next",
24175
24178
  toForm: forms[toFormIndex].formName,
24176
- component: "ActionBar",
24179
+ label: "next",
24180
+ returnValue: "success",
24177
24181
  baseTrackingPayload
24178
24182
  });
24179
- trackSectionCompletion(activeForm.formName);
24180
24183
  };
24181
24184
  const handleBackClick = () => {
24182
- const currentFormIndex = forms.findIndex((form) => form.formId === activeForm.formId);
24183
- if (currentFormIndex) {
24184
- const fromForm = forms[currentFormIndex];
24185
- const toForm = forms[currentFormIndex - 1];
24185
+ if (currentStep > 0) {
24186
+ const toForm = forms[currentStep - 1];
24186
24187
  setActiveForm(toForm);
24187
24188
  setHasAlreadyNavigatedForm(true);
24188
24189
  trackNavigation({
24189
- fromForm: fromForm.formName,
24190
+ actionType: "back",
24190
24191
  toForm: toForm.formName,
24191
- component: "ActionBar",
24192
+ label: "back",
24192
24193
  baseTrackingPayload
24193
24194
  });
24194
24195
  }
@@ -27664,9 +27665,10 @@ function FormNavigation({
27664
27665
  if (form.formId === activeForm.formId) return;
27665
27666
  gotoForm(getFormIndex(form));
27666
27667
  trackNavigation2({
27667
- fromForm: form.formName,
27668
- toForm: activeForm.formName,
27669
- component: "FormNavigation"
27668
+ actionType: "navigate",
27669
+ toForm: form.formName,
27670
+ label: form.formName,
27671
+ returnValue: "success"
27670
27672
  });
27671
27673
  };
27672
27674
  const getNavigateHandler = (form, activeForm2) => {
@@ -27675,7 +27677,15 @@ function FormNavigation({
27675
27677
  if (allPriorFormsValid || !validateForm) {
27676
27678
  return goToForm(form);
27677
27679
  }
27678
- return activeForm2.isValid ? void 0 : validateForm;
27680
+ return activeForm2.isValid ? void 0 : () => {
27681
+ trackNavigation2({
27682
+ actionType: "navigate",
27683
+ toForm: form.formName,
27684
+ label: form.formName,
27685
+ returnValue: "validation error"
27686
+ });
27687
+ validateForm();
27688
+ };
27679
27689
  };
27680
27690
  return /* @__PURE__ */ jsxs("div", { className: cx("adyen-kyc-form-navigation", className), children: [
27681
27691
  /* @__PURE__ */ jsx("div", { className: "adyen-kyc-form-navigation__header", children: i18n.get(taskName) }),
@@ -27753,15 +27763,9 @@ const FormWrapper = ({
27753
27763
  );
27754
27764
  const showTaxExemptedLegalCaption = showExtraTaxExemptionReasons && ((_a = summaryData.companyRegistrationDetails) == null ? void 0 : _a.vatAbsenceReason) && ["companyDetails", "businessDetails"].includes(taskName);
27755
27765
  const handleTrackNavigation = useCallback(
27756
- ({
27757
- fromForm,
27758
- toForm,
27759
- component
27760
- }) => {
27766
+ (props) => {
27761
27767
  trackNavigation({
27762
- fromForm,
27763
- toForm,
27764
- component,
27768
+ ...props,
27765
27769
  baseTrackingPayload
27766
27770
  });
27767
27771
  },
@@ -28631,9 +28635,10 @@ function BusinessDetailsDropinComponent({
28631
28635
  case "basicInformation":
28632
28636
  if (((_b2 = currentState.validityByForm) == null ? void 0 : _b2.basicInformation) && !isBusinessSelection && !verifiedBusiness) {
28633
28637
  trackNavigation({
28634
- fromForm: activeForm.formName,
28638
+ actionType: "next",
28635
28639
  toForm: toFormName || "home",
28636
- component: "next"
28640
+ label: "next",
28641
+ returnValue: "success"
28637
28642
  });
28638
28643
  findBusiness(currentState.data.basicInformation);
28639
28644
  setShowBusinessSelection(true);
@@ -28648,7 +28653,6 @@ function BusinessDetailsDropinComponent({
28648
28653
  handleNextClick,
28649
28654
  forms,
28650
28655
  activeForm.formId,
28651
- activeForm.formName,
28652
28656
  (_e = currentState.validityByForm) == null ? void 0 : _e.basicInformation,
28653
28657
  currentState.data.basicInformation,
28654
28658
  isBusinessSelection,
@@ -28660,9 +28664,9 @@ function BusinessDetailsDropinComponent({
28660
28664
  switch (activeForm.formId) {
28661
28665
  case "basicInformation": {
28662
28666
  trackNavigation({
28663
- fromForm: activeForm.formName,
28667
+ actionType: "back",
28664
28668
  toForm: "basicDetails",
28665
- component: "back"
28669
+ label: "back"
28666
28670
  });
28667
28671
  return showBusinessSelection ? setShowBusinessSelection(false) : void 0;
28668
28672
  }
@@ -28688,8 +28692,6 @@ function BusinessDetailsDropinComponent({
28688
28692
  }
28689
28693
  }, [
28690
28694
  activeForm.formId,
28691
- activeForm.formName,
28692
- i18n,
28693
28695
  country,
28694
28696
  handleBackClick,
28695
28697
  searching,
@@ -28699,9 +28701,9 @@ function BusinessDetailsDropinComponent({
28699
28701
  ]);
28700
28702
  const homeClick = () => {
28701
28703
  trackNavigation({
28702
- fromForm: activeForm.formName,
28704
+ actionType: "save",
28703
28705
  toForm: "home",
28704
- component: "home"
28706
+ label: "home"
28705
28707
  });
28706
28708
  handleHomeClick == null ? void 0 : handleHomeClick();
28707
28709
  };
@@ -30121,6 +30123,10 @@ const BusinessTypeSelection = ({
30121
30123
  if (loadingStatus === "loading") return;
30122
30124
  triggerValidation();
30123
30125
  if (isValid) {
30126
+ userEvents.addEvent("Clicked button", {
30127
+ actionLevel: "task",
30128
+ actionType: "next"
30129
+ });
30124
30130
  if (((_a2 = data.businessType) == null ? void 0 : _a2.id) === "legalArrangement") {
30125
30131
  if (currentStep !== 1) {
30126
30132
  setCurrentStep(
@@ -30811,13 +30817,19 @@ const DecisionMakersComponent = ({
30811
30817
  }, {});
30812
30818
  const uniqueDecisionMakers = mappedDecisionMakers ? Object.values(mappedDecisionMakers) : [];
30813
30819
  const showWarning = Boolean(remediationMessages.DECISION_MAKER && uniqueDecisionMakers.length);
30820
+ useEffect(() => {
30821
+ userEvents.addEvent("Landed on page", {
30822
+ actionLevel: "task",
30823
+ actionType: "start"
30824
+ });
30825
+ }, []);
30814
30826
  useEffect(() => {
30815
30827
  if (showWarning) {
30816
30828
  userEvents.addEvent("Encountered error", {
30817
30829
  task: TaskTypes.DECISION_MAKER_OVERVIEW,
30818
30830
  actionLevel: "task",
30819
30831
  actionType: "alert",
30820
- label: "missingDecisionMaker"
30832
+ label: remediationMessages.DECISION_MAKER
30821
30833
  });
30822
30834
  }
30823
30835
  }, [remediationMessages.DECISION_MAKER, showWarning]);
@@ -31138,15 +31150,16 @@ const Introduction = ({
31138
31150
  page: (introductionScreens == null ? void 0 : introductionScreens.length) ? introductionScreens[activeIndex] : void 0
31139
31151
  };
31140
31152
  useEffect(() => {
31141
- if (introductionScreens == null ? void 0 : introductionScreens.length) {
31142
- userEvents.addEvent("Landed on page", {
31143
- actionLevel: "task",
31144
- actionType: "start"
31145
- });
31146
- } else {
31153
+ userEvents.addEvent("Landed on page", {
31154
+ actionLevel: "task",
31155
+ actionType: "start"
31156
+ });
31157
+ }, []);
31158
+ useEffect(() => {
31159
+ if (!(introductionScreens == null ? void 0 : introductionScreens.length)) {
31147
31160
  onExitIntroduction();
31148
31161
  }
31149
- }, [introductionScreens]);
31162
+ }, [introductionScreens, onExitIntroduction]);
31150
31163
  const translationKeys = {
31151
31164
  skip: "goToOverviewFromIntroduction",
31152
31165
  back: "back",
@@ -31211,7 +31224,7 @@ const Introduction = ({
31211
31224
  onClick: () => {
31212
31225
  userEvents.addEvent("Success", {
31213
31226
  actionLevel: "task",
31214
- actionType: "start",
31227
+ actionType: "submit",
31215
31228
  label: translationKeys.start
31216
31229
  });
31217
31230
  onExitIntroduction();
@@ -31639,6 +31652,7 @@ const hasPayoutAccount = (legalEntityResponse) => {
31639
31652
  return Boolean((_a = legalEntityResponse.transferInstruments) == null ? void 0 : _a.length);
31640
31653
  };
31641
31654
  const TaskListItem = ({
31655
+ titleKey,
31642
31656
  title,
31643
31657
  icon,
31644
31658
  status,
@@ -31655,18 +31669,31 @@ const TaskListItem = ({
31655
31669
  removeEntity,
31656
31670
  isRemoveDisabled = false,
31657
31671
  handleIsRemoveDisabled,
31658
- testId
31672
+ testId,
31673
+ enableTracking = true
31659
31674
  }) => {
31675
+ const { i18n } = useI18nContext();
31660
31676
  const shouldShowErrorAlert = showErrorAlerts === "always" || showErrorAlerts === "onErrorStatus" && status === TaskStatus.ERROR;
31661
31677
  const [isStatusRemoving, setIsStatusRemoving] = useState(false);
31678
+ const handleNavigateToTask = () => {
31679
+ if (enableTracking) {
31680
+ userEvents.addEvent("Clicked button", {
31681
+ actionLevel: "journey",
31682
+ actionType: "open",
31683
+ task: void 0,
31684
+ label: titleKey
31685
+ });
31686
+ }
31687
+ onNavigateToTask == null ? void 0 : onNavigateToTask();
31688
+ };
31662
31689
  return /* @__PURE__ */ jsx(
31663
31690
  Card,
31664
31691
  {
31665
31692
  stateful: onNavigateToTask && !loading && !disabled,
31666
31693
  warning: showWarningAlert,
31667
31694
  warningMessage,
31668
- onClick: loading ? void 0 : onNavigateToTask,
31669
- onKeyDown: handleKeys(["Enter"], onNavigateToTask ?? noop),
31695
+ onClick: loading ? void 0 : handleNavigateToTask,
31696
+ onKeyDown: handleKeys(["Enter"], handleNavigateToTask ?? noop),
31670
31697
  className: "adyen-task",
31671
31698
  disabled,
31672
31699
  children: /* @__PURE__ */ jsxs(
@@ -31680,7 +31707,7 @@ const TaskListItem = ({
31680
31707
  /* @__PURE__ */ jsxs("div", { className: "adyen-task-item__header", children: [
31681
31708
  /* @__PURE__ */ jsxs("div", { className: "adyen-task-item__heading", children: [
31682
31709
  /* @__PURE__ */ jsx("span", { className: "adyen-task-item__icon-wrapper", children: /* @__PURE__ */ jsx(Icon, { name: icon }) }),
31683
- /* @__PURE__ */ jsx("div", { className: "adyen-task-item__body", children: /* @__PURE__ */ jsx("span", { className: "adyen-task-item__title", children: title }) })
31710
+ /* @__PURE__ */ jsx("div", { className: "adyen-task-item__body", children: /* @__PURE__ */ jsx("span", { className: "adyen-task-item__title", children: title || i18n.get(titleKey) }) })
31684
31711
  ] }),
31685
31712
  info && /* @__PURE__ */ jsxs("div", { className: "adyen-task-item__info", children: [
31686
31713
  /* @__PURE__ */ jsx(Icon, { name: "info-circle" }),
@@ -31739,6 +31766,7 @@ const PayoutAccountTaskListItem = ({
31739
31766
  disabled: isInstantVerificationAccount && status === TaskStatus.PROCESSING,
31740
31767
  onNavigateToTask: isInstantVerificationAccount ? void 0 : onNavigateToTask,
31741
31768
  icon: "payout",
31769
+ titleKey: "bankAccountNumber",
31742
31770
  title: obscuredAccountNumber,
31743
31771
  status,
31744
31772
  problems: (_a = capabilityProblems == null ? void 0 : capabilityProblems.BankAccount) == null ? void 0 : _a[account.id],
@@ -31850,7 +31878,7 @@ function TaskListComponent({
31850
31878
  task: TaskTypes.TASKS_OVERVIEW,
31851
31879
  actionLevel: "task",
31852
31880
  actionType: "alert",
31853
- label: "missingDecisionMaker"
31881
+ label: remediationMessages.DECISION_MAKER
31854
31882
  });
31855
31883
  }
31856
31884
  }, [showDecisionMakersWarning]);
@@ -31897,7 +31925,7 @@ function TaskListComponent({
31897
31925
  {
31898
31926
  onNavigateToTask: handleOnNavigateToTaskIndividual,
31899
31927
  icon: "decision-maker",
31900
- title: hasTrust ? i18n.get("trusteePersonalDetails") : i18n.get("personalDetails"),
31928
+ titleKey: hasTrust ? "trusteePersonalDetails" : "personalDetails",
31901
31929
  status: getTaskStatus(
31902
31930
  EntityType.LEGAL_ENTITY,
31903
31931
  capabilityProblems,
@@ -31912,7 +31940,7 @@ function TaskListComponent({
31912
31940
  {
31913
31941
  onNavigateToTask: handleOnNavigateToTaskLegalRepresentative,
31914
31942
  icon: "decision-maker",
31915
- title: i18n.get("legalRepresentative"),
31943
+ titleKey: "legalRepresentative",
31916
31944
  status: legalRepresentative ? getTaskStatus(
31917
31945
  EntityType.LEGAL_ENTITY,
31918
31946
  capabilityProblems,
@@ -31926,9 +31954,7 @@ function TaskListComponent({
31926
31954
  {
31927
31955
  onNavigateToTask: handleOnNavigateToSoleProp,
31928
31956
  icon: "company",
31929
- title: i18n.get(
31930
- canChangeEntityType ? "soleProprietorshipDetails" : "soleProprietorDetails"
31931
- ),
31957
+ titleKey: canChangeEntityType ? "soleProprietorshipDetails" : "soleProprietorDetails",
31932
31958
  status: getTaskStatus(
31933
31959
  EntityType.LEGAL_ENTITY,
31934
31960
  capabilityProblems,
@@ -31944,7 +31970,7 @@ function TaskListComponent({
31944
31970
  testId: TaskTypes.COMPANY,
31945
31971
  onNavigateToTask: handleOnNavigateToTaskCompany,
31946
31972
  icon: "company",
31947
- title: hasTrust ? i18n.get("companyTrusteeDetails") : i18n.get("companyDetails"),
31973
+ titleKey: hasTrust ? "companyTrusteeDetails" : "companyDetails",
31948
31974
  status: getTaskStatus(
31949
31975
  EntityType.LEGAL_ENTITY,
31950
31976
  capabilityProblems,
@@ -31960,7 +31986,7 @@ function TaskListComponent({
31960
31986
  testId: TaskTypes.BUSINESS_DETAILS,
31961
31987
  onNavigateToTask: handleOnNavigateToTaskBusinessDetails,
31962
31988
  icon: "company",
31963
- title: hasTrust ? i18n.get("businessTrusteeDetails") : i18n.get("businessDetails"),
31989
+ titleKey: hasTrust ? "businessTrusteeDetails" : "businessDetails",
31964
31990
  status: getTaskStatus(
31965
31991
  EntityType.LEGAL_ENTITY,
31966
31992
  capabilityProblems,
@@ -31975,7 +32001,7 @@ function TaskListComponent({
31975
32001
  {
31976
32002
  onNavigateToTask: handleOnNavigateToTaskDecisionMaker,
31977
32003
  icon: "decision-maker",
31978
- title: i18n.get("decisionMakers"),
32004
+ titleKey: "decisionMakers",
31979
32005
  status: hasMinRequiredDecisionMakerCount(legalEntityResponse) ? getTaskStatus(
31980
32006
  EntityType.LEGAL_ENTITY,
31981
32007
  capabilityProblems,
@@ -31995,7 +32021,7 @@ function TaskListComponent({
31995
32021
  {
31996
32022
  onNavigateToTask: handleOnNavigateToTaskTrust,
31997
32023
  icon: "trust",
31998
- title: i18n.get("trustDetails"),
32024
+ titleKey: "trustDetails",
31999
32025
  status: getTaskStatus(
32000
32026
  EntityType.LEGAL_ENTITY,
32001
32027
  capabilityProblems,
@@ -32010,7 +32036,7 @@ function TaskListComponent({
32010
32036
  {
32011
32037
  onNavigateToTask: handleOnNavigateToTaskTrustMember,
32012
32038
  icon: "decision-maker",
32013
- title: i18n.get("trustMembers"),
32039
+ titleKey: "trustMembers",
32014
32040
  status: hasRequiredTrustMemberCount2 ? getTaskStatus(
32015
32041
  EntityType.LEGAL_ENTITY,
32016
32042
  capabilityProblems,
@@ -32058,7 +32084,7 @@ function TaskListComponent({
32058
32084
  {
32059
32085
  onNavigateToTask: () => handleOnNavigateToTaskPayout(),
32060
32086
  icon: "payout",
32061
- title: canChangeEntityType ? i18n.get("bankAccountDetails") : i18n.get(hasPayinTaskNotPayout ? "payinDetails" : "payoutDetails"),
32087
+ titleKey: canChangeEntityType ? "bankAccountDetails" : hasPayinTaskNotPayout ? "payinDetails" : "payoutDetails",
32062
32088
  status: hasPayoutAccount(legalEntityResponse) ? getTaskStatus(
32063
32089
  EntityType.BANK_ACCOUNT,
32064
32090
  capabilityProblems,
@@ -32077,7 +32103,7 @@ function TaskListComponent({
32077
32103
  {
32078
32104
  onNavigateToTask: handleOnNavigateToServiceAgreement,
32079
32105
  icon: "contract",
32080
- title: i18n.get("signServiceAgreement"),
32106
+ titleKey: "signServiceAgreement",
32081
32107
  disabled: areServiceAgreementTasksDisabled,
32082
32108
  status: (serviceAgreementTypes == null ? void 0 : serviceAgreementTypes.length) ? TaskStatus.SIGN : TaskStatus.SIGNED,
32083
32109
  info: areServiceAgreementTasksDisabled ? i18n.get("requiresSignatory") : null
@@ -32088,7 +32114,7 @@ function TaskListComponent({
32088
32114
  {
32089
32115
  onNavigateToTask: handleOnNavigateToPci,
32090
32116
  icon: "pci",
32091
- title: i18n.get("pciDssQuestionnaire"),
32117
+ titleKey: "pciDssQuestionnaire",
32092
32118
  status: canDownloadPci ? TaskStatus.DOWNLOAD : TaskStatus.SIGN,
32093
32119
  statusLabel: canDownloadPci && i18n.get("downloadACopy"),
32094
32120
  downloadHandler: onPciDownload,
@@ -32102,7 +32128,7 @@ function TaskListComponent({
32102
32128
  {
32103
32129
  onNavigateToTask: handleOnNavigateToTaskReview,
32104
32130
  icon: "review",
32105
- title: i18n.get("submitReviewOfYourData"),
32131
+ titleKey: "submitReviewOfYourData",
32106
32132
  status: TaskStatus.SUBMIT,
32107
32133
  problems: (_m = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _m[legalEntityResponse.id],
32108
32134
  showErrorAlerts: "always"
@@ -33613,6 +33639,10 @@ function PayoutDetailsDropinComponent({
33613
33639
  if (trustedTransferInstrumentId) {
33614
33640
  externalOnSubmit == null ? void 0 : externalOnSubmit({ ...data, id: trustedTransferInstrumentId });
33615
33641
  }
33642
+ userEvents.addEvent("Success", {
33643
+ actionLevel: "task",
33644
+ actionType: "submit"
33645
+ });
33616
33646
  navigateBackToTaskList == null ? void 0 : navigateBackToTaskList();
33617
33647
  }
33618
33648
  });
@@ -36064,7 +36094,6 @@ function DropinComposerComponent({
36064
36094
  updateLegalEntityAndCapabilityProblems(legalEntity);
36065
36095
  if (legalEntity) {
36066
36096
  userEvents.updateBaseTrackingPayload({
36067
- legalEntityId: legalEntity.id,
36068
36097
  entityType: legalEntity.type,
36069
36098
  capabilities: Object.keys(legalEntity.capabilities),
36070
36099
  countryCode: getLegalEntityCountry(legalEntity)
@@ -36366,6 +36395,9 @@ function DropinComposerComponent({
36366
36395
  actionType: "start"
36367
36396
  });
36368
36397
  }, []);
36398
+ useEffect(() => {
36399
+ userEvents.updateBaseTrackingPayload({ task: currentTask });
36400
+ }, [currentTask]);
36369
36401
  useLayoutEffect(() => {
36370
36402
  const fetchConfiguration = async () => {
36371
36403
  const data = await getConfiguration2({
@@ -39680,7 +39712,7 @@ const ConfigurationApiProvider = ({
39680
39712
  }) => {
39681
39713
  const authContext = useAuthContext();
39682
39714
  const { isEmbeddedDropin, loadingContext } = authContext;
39683
- const sdkVersion = "2.61.2";
39715
+ const sdkVersion = "2.62.0";
39684
39716
  useAnalytics({
39685
39717
  onUserEvent,
39686
39718
  legalEntityId: rootLegalEntityId,
@@ -40353,7 +40385,7 @@ const DebugModal = ({ rootLegalEntityId, onExit, getRootLegalEntity }) => {
40353
40385
  };
40354
40386
  const copyToClipboard = async () => {
40355
40387
  const toCopy = {
40356
- sdkVersion: "2.61.2",
40388
+ sdkVersion: "2.62.0",
40357
40389
  experiments: Object.fromEntries(allExperimentsWithValues),
40358
40390
  settings: Object.fromEntries(allSettingsWithValues)
40359
40391
  };
@@ -40418,7 +40450,7 @@ const DebugModal = ({ rootLegalEntityId, onExit, getRootLegalEntity }) => {
40418
40450
  /* @__PURE__ */ jsx("div", { className: "adyen-kyc-debug-modal__meta", children: /* @__PURE__ */ jsx("table", { children: /* @__PURE__ */ jsxs("tbody", { children: [
40419
40451
  /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsxs("td", { children: [
40420
40452
  /* @__PURE__ */ jsx("span", { className: "adyen-kyc-debug-modal__table-key", children: "SDK version" }),
40421
- /* @__PURE__ */ jsx(Tag, { variant: "green", className: "adyen-kyc-tag--large", children: "2.61.2" })
40453
+ /* @__PURE__ */ jsx(Tag, { variant: "green", className: "adyen-kyc-tag--large", children: "2.62.0" })
40422
40454
  ] }) }),
40423
40455
  /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsxs("td", { children: [
40424
40456
  /* @__PURE__ */ jsx("span", { className: "adyen-kyc-debug-modal__table-key", children: "rootLegalEntityId" }),
@@ -40543,14 +40575,11 @@ const getBaseTracking = (componentProps) => {
40543
40575
  const { legalEntityResponse } = componentProps;
40544
40576
  return {
40545
40577
  entityType: legalEntityResponse.type,
40546
- legalEntityId: legalEntityResponse.id,
40547
40578
  capabilities: Object.keys(legalEntityResponse.capabilities || {}),
40548
40579
  countryCode: getLegalEntityCountry(legalEntityResponse)
40549
40580
  };
40550
40581
  }
40551
- return {
40552
- legalEntityId: componentProps.legalEntityId
40553
- };
40582
+ return {};
40554
40583
  };
40555
40584
  class UIElement extends BaseElement {
40556
40585
  constructor() {
@@ -2,6 +2,7 @@ import type { EntityProblems } from '../../../core/models/errors/entity-problems
2
2
  import type { FormVerificationErrors } from '../../../core/models/errors/form-verification-errors';
3
3
  import type { FormModelWithValidity } from '../../../core/models/form';
4
4
  import type { TranslationKey } from '../../../language/types';
5
+ import type { TrackNavigationProps } from '../../../utils/trackNavigation';
5
6
  export interface FormNavigationProps {
6
7
  forms: FormModelWithValidity[];
7
8
  activeForm: FormModelWithValidity;
@@ -13,11 +14,7 @@ export interface FormNavigationProps {
13
14
  verificationErrors?: {
14
15
  [formId: string]: FormVerificationErrors;
15
16
  };
16
- trackNavigation?: (props: {
17
- fromForm: TranslationKey;
18
- toForm: TranslationKey;
19
- component: string;
20
- }) => void;
17
+ trackNavigation?: (props: TrackNavigationProps) => void;
21
18
  }
22
19
  export interface FormNavigationItemProps {
23
20
  form: FormModelWithValidity;
@@ -1,4 +1,4 @@
1
1
  import '../TaskListItem.scss';
2
2
  import type { TaskListItemProps } from '../types';
3
- declare const TaskListItem: ({ title, icon, status, statusLabel, onNavigateToTask, disabled, problems, downloadHandler, info, loading, showErrorAlerts, showWarningAlert, warningMessage, removeEntity, isRemoveDisabled, handleIsRemoveDisabled, testId, }: TaskListItemProps) => import("preact").JSX.Element;
3
+ declare const TaskListItem: ({ titleKey, title, icon, status, statusLabel, onNavigateToTask, disabled, problems, downloadHandler, info, loading, showErrorAlerts, showWarningAlert, warningMessage, removeEntity, isRemoveDisabled, handleIsRemoveDisabled, testId, enableTracking, }: TaskListItemProps) => import("preact").JSX.Element;
4
4
  export default TaskListItem;
@@ -4,6 +4,7 @@ import type { PciStatus } from '../../core/models/api/contracts';
4
4
  import type { ExistingLegalEntity } from '../../core/models/api/legal-entity';
5
5
  import type { CapabilityProblems } from '../../core/models/errors/capability-problems';
6
6
  import type { EntityProblems } from '../../core/models/errors/entity-problems';
7
+ import type { TranslationKey } from '../../language/types';
7
8
  import type { ServiceAgreementAcceptanceInfo, ServiceAgreementType } from '../Dropins/ServiceAgreementDropinComponent/types';
8
9
  import type { IconName } from '../internal/Icon/Icon';
9
10
  import type { ActionsMenuOption } from '../internal/Menu/ActionsMenu';
@@ -74,7 +75,8 @@ export interface TaskListGroupProps {
74
75
  }
75
76
  export interface TaskListItemProps extends TaskStatusProps {
76
77
  icon: IconName;
77
- title: string;
78
+ titleKey: TranslationKey;
79
+ title?: string;
78
80
  statusLabel?: string;
79
81
  disabled?: boolean;
80
82
  problems?: EntityProblems;
@@ -89,4 +91,5 @@ export interface TaskListItemProps extends TaskStatusProps {
89
91
  isRemoveDisabled?: boolean;
90
92
  handleIsRemoveDisabled?: Dispatch<StateUpdater<boolean>>;
91
93
  testId?: string;
94
+ enableTracking?: boolean;
92
95
  }
@@ -1,12 +1,8 @@
1
1
  import type { EntityProblems } from '../../../core/models/errors/entity-problems';
2
2
  import type { FormModel } from '../../../core/models/form';
3
- import type { TranslationKey } from '../../../language/types';
3
+ import type { TrackNavigationProps } from '../../../utils/trackNavigation';
4
4
  export interface SummaryProps<Schema> {
5
- trackNavigation?: (props: {
6
- fromForm: TranslationKey;
7
- toForm: TranslationKey;
8
- component: string;
9
- }) => void;
5
+ trackNavigation?: (props: TrackNavigationProps) => void;
10
6
  data: Schema;
11
7
  forms: FormModel[];
12
8
  omittedKeys?: string[];
@@ -9,7 +9,7 @@ type ActionLevel = 'journey' | 'task' | 'page' | 'field';
9
9
  /**
10
10
  * The type of action associated with the event
11
11
  */
12
- type ActionType = 'start' | 'submit' | 'save' | 'add' | 'edit' | 'remove' | 'open' | 'close' | 'next' | 'back' | 'skip' | 'download' | 'upload' | 'sign' | 'navigate' | 'blur' | 'input' | 'focus' | 'change' | 'select' | 'alert';
12
+ export type ActionType = 'start' | 'submit' | 'save' | 'add' | 'edit' | 'remove' | 'open' | 'close' | 'next' | 'back' | 'skip' | 'download' | 'upload' | 'sign' | 'navigate' | 'blur' | 'input' | 'focus' | 'change' | 'select' | 'alert';
13
13
  /**
14
14
  * The base event properties that are sent with every event
15
15
  */
@@ -18,7 +18,6 @@ type BaseEventProperties = {
18
18
  subCategory: 'hosted onboarding';
19
19
  countryCode?: string;
20
20
  capabilities?: string[];
21
- legalEntityId?: string;
22
21
  entityType?: LegalEntityType;
23
22
  task?: TaskTypes;
24
23
  };
@@ -66,13 +65,19 @@ declare class UserEvents {
66
65
  */
67
66
  addEvent(eventName: EventName, properties: AdditionalEventProperties): void;
68
67
  /**
69
- * 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
68
+ * Adds an event with context specific to page-related events
70
69
  */
71
- startEvent(eventName: EventName): void;
70
+ addPageEvent(eventName: EventName, properties: SetOptional<AdditionalEventProperties, 'actionLevel'>): void;
72
71
  /**
73
72
  * Adds an event with context specific to field-related events
74
73
  */
75
- addFieldEvent(eventName: EventName, properties: SetOptional<AdditionalEventProperties, 'actionLevel'>): void;
74
+ addFieldEvent(eventName: EventName, properties: SetOptional<AdditionalEventProperties, 'actionLevel'> & {
75
+ field?: string;
76
+ }): void;
77
+ /**
78
+ * 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
79
+ */
80
+ startEvent(eventName: EventName): void;
76
81
  /**
77
82
  * Subscribes a callback to analytics events. It gets called every time
78
83
  * one of the above public methods get called, and the event data is passed back as an array.
@@ -1,8 +1,10 @@
1
- import type { BaseTrackingPayload } from '../core/analytics';
1
+ import type { ActionType, AdditionalEventProperties } from '../core/user-events';
2
2
  import type { TranslationKey } from '../language/types';
3
- export declare const trackNavigation: ({ fromForm, toForm, component, baseTrackingPayload, }: {
4
- fromForm: TranslationKey;
5
- toForm: TranslationKey;
6
- component: string;
7
- baseTrackingPayload?: BaseTrackingPayload;
8
- }) => void;
3
+ export interface TrackNavigationProps {
4
+ actionType: ActionType;
5
+ toForm?: TranslationKey;
6
+ label: string;
7
+ returnValue?: 'success' | 'validation error';
8
+ baseTrackingPayload?: Partial<AdditionalEventProperties>;
9
+ }
10
+ export declare const trackNavigation: ({ actionType, toForm, label, returnValue, baseTrackingPayload, }: TrackNavigationProps) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adyen/kyc-components",
3
- "version": "2.61.2",
3
+ "version": "2.62.0",
4
4
  "keywords": [
5
5
  "adyen",
6
6
  "adyen-kyc",