@adyen/kyc-components 2.61.2 → 2.62.1

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);
@@ -5655,7 +5664,7 @@ const businessRegistrationNumberMasks = {
5655
5664
  },
5656
5665
  [CountryCodes.Luxembourg]: {
5657
5666
  default: {
5658
- mask: makeMask(...alphaInputs(1), ...numericInputs(5), ...numericInputs(2, true)),
5667
+ mask: makeMask(...alphaInputs(1), ...numericInputs(9, true)),
5659
5668
  transformOnType: uppercase
5660
5669
  }
5661
5670
  },
@@ -6439,7 +6448,7 @@ const businessRegistrationNumberPatterns = {
6439
6448
  [CountryCodes.Latvia]: { default: /^\d{11}$/ },
6440
6449
  [CountryCodes.Liechtenstein]: { default: /FL-[0-9]{4}[.][0-9]{3}[.][0-9]{3}-[0-9]$/ },
6441
6450
  [CountryCodes.Lithuania]: { default: /^\d{6,9}$/ },
6442
- [CountryCodes.Luxembourg]: { default: /^[a-zA-Z]\d{5,7}$/ },
6451
+ [CountryCodes.Luxembourg]: { default: /^[a-zA-Z]\d{1,9}$/ },
6443
6452
  [CountryCodes.Malaysia]: { default: /^[A-Za-z0-9]{7,8}$|^[A-Za-z0-9]{12}$/ },
6444
6453
  [CountryCodes.Malta]: { default: /^C\s?\d{4,6}$/ },
6445
6454
  [CountryCodes.Monaco]: {
@@ -6985,10 +6994,8 @@ const defaultFieldConfig$9 = {
6985
6994
  businessRegistrationNumberPatterns[CountryCodes.Luxembourg].default
6986
6995
  ),
6987
6996
  guidanceText: {
6988
- key: "enter1LetterAndThenXToYDigitsForExample",
6997
+ key: "enter1LetterAndThenNDigitsForExample",
6989
6998
  values: {
6990
- minDigits: "5",
6991
- maxDigits: "7",
6992
6999
  example: "C127766"
6993
7000
  }
6994
7001
  }
@@ -11314,10 +11321,6 @@ function Dropzone(props) {
11314
11321
  ] });
11315
11322
  }
11316
11323
  const logger$z = createLogger("TextArea");
11317
- const debouncedInputEvent = debounce$2(
11318
- (properties) => userEvents.addFieldEvent("Interacted with form field", properties),
11319
- 500
11320
- );
11321
11324
  function TextArea(props) {
11322
11325
  const { classNameModifiers, uniqueId, ...passedProps } = props;
11323
11326
  const {
@@ -23969,9 +23972,9 @@ function Summary({
23969
23972
  icon: "edit",
23970
23973
  onClick: () => {
23971
23974
  trackNavigation2({
23972
- fromForm: "summary",
23975
+ actionType: "edit",
23973
23976
  toForm: formName,
23974
- component: "Pencil icon"
23977
+ label: "Pencil icon"
23975
23978
  });
23976
23979
  editForm(formId);
23977
23980
  },
@@ -24049,18 +24052,18 @@ function Summary({
24049
24052
  ] });
24050
24053
  }
24051
24054
  const trackNavigation = ({
24052
- fromForm,
24055
+ actionType,
24053
24056
  toForm,
24054
- component,
24057
+ label,
24058
+ returnValue,
24055
24059
  baseTrackingPayload
24056
24060
  }) => {
24057
- userEvents.addEvent("Clicked button", {
24058
- ...baseTrackingPayload,
24059
- actionLevel: "page",
24060
- actionType: "navigate",
24061
- page: fromForm,
24062
- label: component,
24063
- toPage: toForm
24061
+ userEvents.addPageEvent("Clicked button", {
24062
+ actionType,
24063
+ toPage: toForm,
24064
+ label,
24065
+ returnValue,
24066
+ ...baseTrackingPayload
24064
24067
  });
24065
24068
  };
24066
24069
  const useHideButton = (condition, setHideState) => {
@@ -24117,7 +24120,7 @@ const useFormComposer = ({
24117
24120
  );
24118
24121
  }, [forms]);
24119
24122
  useEffect(() => {
24120
- userEvents.updateSharedEventProperties({ page: activeForm.formHeading || activeForm.formId });
24123
+ userEvents.updateSharedEventProperties({ page: activeForm.formName });
24121
24124
  }, [activeForm]);
24122
24125
  useEffect(() => {
24123
24126
  if (hasAlreadyNavigatedForm) return;
@@ -24126,14 +24129,6 @@ const useFormComposer = ({
24126
24129
  setActiveForm(openingStep);
24127
24130
  }
24128
24131
  }, [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
24132
  const gotoFormByFormIndex = (nextFormIndex) => {
24138
24133
  if (formRef == null ? void 0 : formRef.current.verifyForm) {
24139
24134
  formRef.current.verifyForm(activeForm.formId).then((isVerified) => {
@@ -24161,6 +24156,12 @@ const useFormComposer = ({
24161
24156
  }
24162
24157
  if (!activeForm.isValid) {
24163
24158
  validateCurrentForm();
24159
+ trackNavigation({
24160
+ actionType: "next",
24161
+ label: "next",
24162
+ returnValue: "validation error",
24163
+ baseTrackingPayload
24164
+ });
24164
24165
  return;
24165
24166
  }
24166
24167
  if (isFinalStep) {
@@ -24168,27 +24169,25 @@ const useFormComposer = ({
24168
24169
  return;
24169
24170
  }
24170
24171
  setShouldValidate(false);
24171
- const toFormIndex = forms.findIndex((form) => form.formId === activeForm.formId) + 1;
24172
+ const toFormIndex = currentStep + 1;
24172
24173
  gotoFormByFormIndex(toFormIndex);
24173
24174
  trackNavigation({
24174
- fromForm: activeForm.formName,
24175
+ actionType: "next",
24175
24176
  toForm: forms[toFormIndex].formName,
24176
- component: "ActionBar",
24177
+ label: "next",
24178
+ returnValue: "success",
24177
24179
  baseTrackingPayload
24178
24180
  });
24179
- trackSectionCompletion(activeForm.formName);
24180
24181
  };
24181
24182
  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];
24183
+ if (currentStep > 0) {
24184
+ const toForm = forms[currentStep - 1];
24186
24185
  setActiveForm(toForm);
24187
24186
  setHasAlreadyNavigatedForm(true);
24188
24187
  trackNavigation({
24189
- fromForm: fromForm.formName,
24188
+ actionType: "back",
24190
24189
  toForm: toForm.formName,
24191
- component: "ActionBar",
24190
+ label: "back",
24192
24191
  baseTrackingPayload
24193
24192
  });
24194
24193
  }
@@ -27664,9 +27663,10 @@ function FormNavigation({
27664
27663
  if (form.formId === activeForm.formId) return;
27665
27664
  gotoForm(getFormIndex(form));
27666
27665
  trackNavigation2({
27667
- fromForm: form.formName,
27668
- toForm: activeForm.formName,
27669
- component: "FormNavigation"
27666
+ actionType: "navigate",
27667
+ toForm: form.formName,
27668
+ label: form.formName,
27669
+ returnValue: "success"
27670
27670
  });
27671
27671
  };
27672
27672
  const getNavigateHandler = (form, activeForm2) => {
@@ -27675,7 +27675,15 @@ function FormNavigation({
27675
27675
  if (allPriorFormsValid || !validateForm) {
27676
27676
  return goToForm(form);
27677
27677
  }
27678
- return activeForm2.isValid ? void 0 : validateForm;
27678
+ return activeForm2.isValid ? void 0 : () => {
27679
+ trackNavigation2({
27680
+ actionType: "navigate",
27681
+ toForm: form.formName,
27682
+ label: form.formName,
27683
+ returnValue: "validation error"
27684
+ });
27685
+ validateForm();
27686
+ };
27679
27687
  };
27680
27688
  return /* @__PURE__ */ jsxs("div", { className: cx("adyen-kyc-form-navigation", className), children: [
27681
27689
  /* @__PURE__ */ jsx("div", { className: "adyen-kyc-form-navigation__header", children: i18n.get(taskName) }),
@@ -27753,15 +27761,9 @@ const FormWrapper = ({
27753
27761
  );
27754
27762
  const showTaxExemptedLegalCaption = showExtraTaxExemptionReasons && ((_a = summaryData.companyRegistrationDetails) == null ? void 0 : _a.vatAbsenceReason) && ["companyDetails", "businessDetails"].includes(taskName);
27755
27763
  const handleTrackNavigation = useCallback(
27756
- ({
27757
- fromForm,
27758
- toForm,
27759
- component
27760
- }) => {
27764
+ (props) => {
27761
27765
  trackNavigation({
27762
- fromForm,
27763
- toForm,
27764
- component,
27766
+ ...props,
27765
27767
  baseTrackingPayload
27766
27768
  });
27767
27769
  },
@@ -28631,9 +28633,10 @@ function BusinessDetailsDropinComponent({
28631
28633
  case "basicInformation":
28632
28634
  if (((_b2 = currentState.validityByForm) == null ? void 0 : _b2.basicInformation) && !isBusinessSelection && !verifiedBusiness) {
28633
28635
  trackNavigation({
28634
- fromForm: activeForm.formName,
28636
+ actionType: "next",
28635
28637
  toForm: toFormName || "home",
28636
- component: "next"
28638
+ label: "next",
28639
+ returnValue: "success"
28637
28640
  });
28638
28641
  findBusiness(currentState.data.basicInformation);
28639
28642
  setShowBusinessSelection(true);
@@ -28648,7 +28651,6 @@ function BusinessDetailsDropinComponent({
28648
28651
  handleNextClick,
28649
28652
  forms,
28650
28653
  activeForm.formId,
28651
- activeForm.formName,
28652
28654
  (_e = currentState.validityByForm) == null ? void 0 : _e.basicInformation,
28653
28655
  currentState.data.basicInformation,
28654
28656
  isBusinessSelection,
@@ -28660,9 +28662,9 @@ function BusinessDetailsDropinComponent({
28660
28662
  switch (activeForm.formId) {
28661
28663
  case "basicInformation": {
28662
28664
  trackNavigation({
28663
- fromForm: activeForm.formName,
28665
+ actionType: "back",
28664
28666
  toForm: "basicDetails",
28665
- component: "back"
28667
+ label: "back"
28666
28668
  });
28667
28669
  return showBusinessSelection ? setShowBusinessSelection(false) : void 0;
28668
28670
  }
@@ -28688,8 +28690,6 @@ function BusinessDetailsDropinComponent({
28688
28690
  }
28689
28691
  }, [
28690
28692
  activeForm.formId,
28691
- activeForm.formName,
28692
- i18n,
28693
28693
  country,
28694
28694
  handleBackClick,
28695
28695
  searching,
@@ -28699,9 +28699,9 @@ function BusinessDetailsDropinComponent({
28699
28699
  ]);
28700
28700
  const homeClick = () => {
28701
28701
  trackNavigation({
28702
- fromForm: activeForm.formName,
28702
+ actionType: "save",
28703
28703
  toForm: "home",
28704
- component: "home"
28704
+ label: "home"
28705
28705
  });
28706
28706
  handleHomeClick == null ? void 0 : handleHomeClick();
28707
28707
  };
@@ -30121,6 +30121,10 @@ const BusinessTypeSelection = ({
30121
30121
  if (loadingStatus === "loading") return;
30122
30122
  triggerValidation();
30123
30123
  if (isValid) {
30124
+ userEvents.addEvent("Clicked button", {
30125
+ actionLevel: "task",
30126
+ actionType: "next"
30127
+ });
30124
30128
  if (((_a2 = data.businessType) == null ? void 0 : _a2.id) === "legalArrangement") {
30125
30129
  if (currentStep !== 1) {
30126
30130
  setCurrentStep(
@@ -30811,13 +30815,19 @@ const DecisionMakersComponent = ({
30811
30815
  }, {});
30812
30816
  const uniqueDecisionMakers = mappedDecisionMakers ? Object.values(mappedDecisionMakers) : [];
30813
30817
  const showWarning = Boolean(remediationMessages.DECISION_MAKER && uniqueDecisionMakers.length);
30818
+ useEffect(() => {
30819
+ userEvents.addEvent("Landed on page", {
30820
+ actionLevel: "task",
30821
+ actionType: "start"
30822
+ });
30823
+ }, []);
30814
30824
  useEffect(() => {
30815
30825
  if (showWarning) {
30816
30826
  userEvents.addEvent("Encountered error", {
30817
30827
  task: TaskTypes.DECISION_MAKER_OVERVIEW,
30818
30828
  actionLevel: "task",
30819
30829
  actionType: "alert",
30820
- label: "missingDecisionMaker"
30830
+ label: remediationMessages.DECISION_MAKER
30821
30831
  });
30822
30832
  }
30823
30833
  }, [remediationMessages.DECISION_MAKER, showWarning]);
@@ -31138,15 +31148,16 @@ const Introduction = ({
31138
31148
  page: (introductionScreens == null ? void 0 : introductionScreens.length) ? introductionScreens[activeIndex] : void 0
31139
31149
  };
31140
31150
  useEffect(() => {
31141
- if (introductionScreens == null ? void 0 : introductionScreens.length) {
31142
- userEvents.addEvent("Landed on page", {
31143
- actionLevel: "task",
31144
- actionType: "start"
31145
- });
31146
- } else {
31151
+ userEvents.addEvent("Landed on page", {
31152
+ actionLevel: "task",
31153
+ actionType: "start"
31154
+ });
31155
+ }, []);
31156
+ useEffect(() => {
31157
+ if (!(introductionScreens == null ? void 0 : introductionScreens.length)) {
31147
31158
  onExitIntroduction();
31148
31159
  }
31149
- }, [introductionScreens]);
31160
+ }, [introductionScreens, onExitIntroduction]);
31150
31161
  const translationKeys = {
31151
31162
  skip: "goToOverviewFromIntroduction",
31152
31163
  back: "back",
@@ -31211,7 +31222,7 @@ const Introduction = ({
31211
31222
  onClick: () => {
31212
31223
  userEvents.addEvent("Success", {
31213
31224
  actionLevel: "task",
31214
- actionType: "start",
31225
+ actionType: "submit",
31215
31226
  label: translationKeys.start
31216
31227
  });
31217
31228
  onExitIntroduction();
@@ -31639,6 +31650,7 @@ const hasPayoutAccount = (legalEntityResponse) => {
31639
31650
  return Boolean((_a = legalEntityResponse.transferInstruments) == null ? void 0 : _a.length);
31640
31651
  };
31641
31652
  const TaskListItem = ({
31653
+ titleKey,
31642
31654
  title,
31643
31655
  icon,
31644
31656
  status,
@@ -31655,18 +31667,31 @@ const TaskListItem = ({
31655
31667
  removeEntity,
31656
31668
  isRemoveDisabled = false,
31657
31669
  handleIsRemoveDisabled,
31658
- testId
31670
+ testId,
31671
+ enableTracking = true
31659
31672
  }) => {
31673
+ const { i18n } = useI18nContext();
31660
31674
  const shouldShowErrorAlert = showErrorAlerts === "always" || showErrorAlerts === "onErrorStatus" && status === TaskStatus.ERROR;
31661
31675
  const [isStatusRemoving, setIsStatusRemoving] = useState(false);
31676
+ const handleNavigateToTask = () => {
31677
+ if (enableTracking) {
31678
+ userEvents.addEvent("Clicked button", {
31679
+ actionLevel: "journey",
31680
+ actionType: "open",
31681
+ task: void 0,
31682
+ label: titleKey
31683
+ });
31684
+ }
31685
+ onNavigateToTask == null ? void 0 : onNavigateToTask();
31686
+ };
31662
31687
  return /* @__PURE__ */ jsx(
31663
31688
  Card,
31664
31689
  {
31665
31690
  stateful: onNavigateToTask && !loading && !disabled,
31666
31691
  warning: showWarningAlert,
31667
31692
  warningMessage,
31668
- onClick: loading ? void 0 : onNavigateToTask,
31669
- onKeyDown: handleKeys(["Enter"], onNavigateToTask ?? noop),
31693
+ onClick: loading ? void 0 : handleNavigateToTask,
31694
+ onKeyDown: handleKeys(["Enter"], handleNavigateToTask ?? noop),
31670
31695
  className: "adyen-task",
31671
31696
  disabled,
31672
31697
  children: /* @__PURE__ */ jsxs(
@@ -31680,7 +31705,7 @@ const TaskListItem = ({
31680
31705
  /* @__PURE__ */ jsxs("div", { className: "adyen-task-item__header", children: [
31681
31706
  /* @__PURE__ */ jsxs("div", { className: "adyen-task-item__heading", children: [
31682
31707
  /* @__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 }) })
31708
+ /* @__PURE__ */ jsx("div", { className: "adyen-task-item__body", children: /* @__PURE__ */ jsx("span", { className: "adyen-task-item__title", children: title || i18n.get(titleKey) }) })
31684
31709
  ] }),
31685
31710
  info && /* @__PURE__ */ jsxs("div", { className: "adyen-task-item__info", children: [
31686
31711
  /* @__PURE__ */ jsx(Icon, { name: "info-circle" }),
@@ -31739,6 +31764,7 @@ const PayoutAccountTaskListItem = ({
31739
31764
  disabled: isInstantVerificationAccount && status === TaskStatus.PROCESSING,
31740
31765
  onNavigateToTask: isInstantVerificationAccount ? void 0 : onNavigateToTask,
31741
31766
  icon: "payout",
31767
+ titleKey: "bankAccountNumber",
31742
31768
  title: obscuredAccountNumber,
31743
31769
  status,
31744
31770
  problems: (_a = capabilityProblems == null ? void 0 : capabilityProblems.BankAccount) == null ? void 0 : _a[account.id],
@@ -31850,7 +31876,7 @@ function TaskListComponent({
31850
31876
  task: TaskTypes.TASKS_OVERVIEW,
31851
31877
  actionLevel: "task",
31852
31878
  actionType: "alert",
31853
- label: "missingDecisionMaker"
31879
+ label: remediationMessages.DECISION_MAKER
31854
31880
  });
31855
31881
  }
31856
31882
  }, [showDecisionMakersWarning]);
@@ -31897,7 +31923,7 @@ function TaskListComponent({
31897
31923
  {
31898
31924
  onNavigateToTask: handleOnNavigateToTaskIndividual,
31899
31925
  icon: "decision-maker",
31900
- title: hasTrust ? i18n.get("trusteePersonalDetails") : i18n.get("personalDetails"),
31926
+ titleKey: hasTrust ? "trusteePersonalDetails" : "personalDetails",
31901
31927
  status: getTaskStatus(
31902
31928
  EntityType.LEGAL_ENTITY,
31903
31929
  capabilityProblems,
@@ -31912,7 +31938,7 @@ function TaskListComponent({
31912
31938
  {
31913
31939
  onNavigateToTask: handleOnNavigateToTaskLegalRepresentative,
31914
31940
  icon: "decision-maker",
31915
- title: i18n.get("legalRepresentative"),
31941
+ titleKey: "legalRepresentative",
31916
31942
  status: legalRepresentative ? getTaskStatus(
31917
31943
  EntityType.LEGAL_ENTITY,
31918
31944
  capabilityProblems,
@@ -31926,9 +31952,7 @@ function TaskListComponent({
31926
31952
  {
31927
31953
  onNavigateToTask: handleOnNavigateToSoleProp,
31928
31954
  icon: "company",
31929
- title: i18n.get(
31930
- canChangeEntityType ? "soleProprietorshipDetails" : "soleProprietorDetails"
31931
- ),
31955
+ titleKey: canChangeEntityType ? "soleProprietorshipDetails" : "soleProprietorDetails",
31932
31956
  status: getTaskStatus(
31933
31957
  EntityType.LEGAL_ENTITY,
31934
31958
  capabilityProblems,
@@ -31944,7 +31968,7 @@ function TaskListComponent({
31944
31968
  testId: TaskTypes.COMPANY,
31945
31969
  onNavigateToTask: handleOnNavigateToTaskCompany,
31946
31970
  icon: "company",
31947
- title: hasTrust ? i18n.get("companyTrusteeDetails") : i18n.get("companyDetails"),
31971
+ titleKey: hasTrust ? "companyTrusteeDetails" : "companyDetails",
31948
31972
  status: getTaskStatus(
31949
31973
  EntityType.LEGAL_ENTITY,
31950
31974
  capabilityProblems,
@@ -31960,7 +31984,7 @@ function TaskListComponent({
31960
31984
  testId: TaskTypes.BUSINESS_DETAILS,
31961
31985
  onNavigateToTask: handleOnNavigateToTaskBusinessDetails,
31962
31986
  icon: "company",
31963
- title: hasTrust ? i18n.get("businessTrusteeDetails") : i18n.get("businessDetails"),
31987
+ titleKey: hasTrust ? "businessTrusteeDetails" : "businessDetails",
31964
31988
  status: getTaskStatus(
31965
31989
  EntityType.LEGAL_ENTITY,
31966
31990
  capabilityProblems,
@@ -31975,7 +31999,7 @@ function TaskListComponent({
31975
31999
  {
31976
32000
  onNavigateToTask: handleOnNavigateToTaskDecisionMaker,
31977
32001
  icon: "decision-maker",
31978
- title: i18n.get("decisionMakers"),
32002
+ titleKey: "decisionMakers",
31979
32003
  status: hasMinRequiredDecisionMakerCount(legalEntityResponse) ? getTaskStatus(
31980
32004
  EntityType.LEGAL_ENTITY,
31981
32005
  capabilityProblems,
@@ -31995,7 +32019,7 @@ function TaskListComponent({
31995
32019
  {
31996
32020
  onNavigateToTask: handleOnNavigateToTaskTrust,
31997
32021
  icon: "trust",
31998
- title: i18n.get("trustDetails"),
32022
+ titleKey: "trustDetails",
31999
32023
  status: getTaskStatus(
32000
32024
  EntityType.LEGAL_ENTITY,
32001
32025
  capabilityProblems,
@@ -32010,7 +32034,7 @@ function TaskListComponent({
32010
32034
  {
32011
32035
  onNavigateToTask: handleOnNavigateToTaskTrustMember,
32012
32036
  icon: "decision-maker",
32013
- title: i18n.get("trustMembers"),
32037
+ titleKey: "trustMembers",
32014
32038
  status: hasRequiredTrustMemberCount2 ? getTaskStatus(
32015
32039
  EntityType.LEGAL_ENTITY,
32016
32040
  capabilityProblems,
@@ -32058,7 +32082,7 @@ function TaskListComponent({
32058
32082
  {
32059
32083
  onNavigateToTask: () => handleOnNavigateToTaskPayout(),
32060
32084
  icon: "payout",
32061
- title: canChangeEntityType ? i18n.get("bankAccountDetails") : i18n.get(hasPayinTaskNotPayout ? "payinDetails" : "payoutDetails"),
32085
+ titleKey: canChangeEntityType ? "bankAccountDetails" : hasPayinTaskNotPayout ? "payinDetails" : "payoutDetails",
32062
32086
  status: hasPayoutAccount(legalEntityResponse) ? getTaskStatus(
32063
32087
  EntityType.BANK_ACCOUNT,
32064
32088
  capabilityProblems,
@@ -32077,7 +32101,7 @@ function TaskListComponent({
32077
32101
  {
32078
32102
  onNavigateToTask: handleOnNavigateToServiceAgreement,
32079
32103
  icon: "contract",
32080
- title: i18n.get("signServiceAgreement"),
32104
+ titleKey: "signServiceAgreement",
32081
32105
  disabled: areServiceAgreementTasksDisabled,
32082
32106
  status: (serviceAgreementTypes == null ? void 0 : serviceAgreementTypes.length) ? TaskStatus.SIGN : TaskStatus.SIGNED,
32083
32107
  info: areServiceAgreementTasksDisabled ? i18n.get("requiresSignatory") : null
@@ -32088,7 +32112,7 @@ function TaskListComponent({
32088
32112
  {
32089
32113
  onNavigateToTask: handleOnNavigateToPci,
32090
32114
  icon: "pci",
32091
- title: i18n.get("pciDssQuestionnaire"),
32115
+ titleKey: "pciDssQuestionnaire",
32092
32116
  status: canDownloadPci ? TaskStatus.DOWNLOAD : TaskStatus.SIGN,
32093
32117
  statusLabel: canDownloadPci && i18n.get("downloadACopy"),
32094
32118
  downloadHandler: onPciDownload,
@@ -32102,7 +32126,7 @@ function TaskListComponent({
32102
32126
  {
32103
32127
  onNavigateToTask: handleOnNavigateToTaskReview,
32104
32128
  icon: "review",
32105
- title: i18n.get("submitReviewOfYourData"),
32129
+ titleKey: "submitReviewOfYourData",
32106
32130
  status: TaskStatus.SUBMIT,
32107
32131
  problems: (_m = capabilityProblems == null ? void 0 : capabilityProblems.LegalEntity) == null ? void 0 : _m[legalEntityResponse.id],
32108
32132
  showErrorAlerts: "always"
@@ -33613,6 +33637,10 @@ function PayoutDetailsDropinComponent({
33613
33637
  if (trustedTransferInstrumentId) {
33614
33638
  externalOnSubmit == null ? void 0 : externalOnSubmit({ ...data, id: trustedTransferInstrumentId });
33615
33639
  }
33640
+ userEvents.addEvent("Success", {
33641
+ actionLevel: "task",
33642
+ actionType: "submit"
33643
+ });
33616
33644
  navigateBackToTaskList == null ? void 0 : navigateBackToTaskList();
33617
33645
  }
33618
33646
  });
@@ -36064,7 +36092,6 @@ function DropinComposerComponent({
36064
36092
  updateLegalEntityAndCapabilityProblems(legalEntity);
36065
36093
  if (legalEntity) {
36066
36094
  userEvents.updateBaseTrackingPayload({
36067
- legalEntityId: legalEntity.id,
36068
36095
  entityType: legalEntity.type,
36069
36096
  capabilities: Object.keys(legalEntity.capabilities),
36070
36097
  countryCode: getLegalEntityCountry(legalEntity)
@@ -36366,6 +36393,9 @@ function DropinComposerComponent({
36366
36393
  actionType: "start"
36367
36394
  });
36368
36395
  }, []);
36396
+ useEffect(() => {
36397
+ userEvents.updateBaseTrackingPayload({ task: currentTask });
36398
+ }, [currentTask]);
36369
36399
  useLayoutEffect(() => {
36370
36400
  const fetchConfiguration = async () => {
36371
36401
  const data = await getConfiguration2({
@@ -39680,7 +39710,7 @@ const ConfigurationApiProvider = ({
39680
39710
  }) => {
39681
39711
  const authContext = useAuthContext();
39682
39712
  const { isEmbeddedDropin, loadingContext } = authContext;
39683
- const sdkVersion = "2.61.2";
39713
+ const sdkVersion = "2.62.1";
39684
39714
  useAnalytics({
39685
39715
  onUserEvent,
39686
39716
  legalEntityId: rootLegalEntityId,
@@ -40353,7 +40383,7 @@ const DebugModal = ({ rootLegalEntityId, onExit, getRootLegalEntity }) => {
40353
40383
  };
40354
40384
  const copyToClipboard = async () => {
40355
40385
  const toCopy = {
40356
- sdkVersion: "2.61.2",
40386
+ sdkVersion: "2.62.1",
40357
40387
  experiments: Object.fromEntries(allExperimentsWithValues),
40358
40388
  settings: Object.fromEntries(allSettingsWithValues)
40359
40389
  };
@@ -40418,7 +40448,7 @@ const DebugModal = ({ rootLegalEntityId, onExit, getRootLegalEntity }) => {
40418
40448
  /* @__PURE__ */ jsx("div", { className: "adyen-kyc-debug-modal__meta", children: /* @__PURE__ */ jsx("table", { children: /* @__PURE__ */ jsxs("tbody", { children: [
40419
40449
  /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsxs("td", { children: [
40420
40450
  /* @__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" })
40451
+ /* @__PURE__ */ jsx(Tag, { variant: "green", className: "adyen-kyc-tag--large", children: "2.62.1" })
40422
40452
  ] }) }),
40423
40453
  /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsxs("td", { children: [
40424
40454
  /* @__PURE__ */ jsx("span", { className: "adyen-kyc-debug-modal__table-key", children: "rootLegalEntityId" }),
@@ -40543,14 +40573,11 @@ const getBaseTracking = (componentProps) => {
40543
40573
  const { legalEntityResponse } = componentProps;
40544
40574
  return {
40545
40575
  entityType: legalEntityResponse.type,
40546
- legalEntityId: legalEntityResponse.id,
40547
40576
  capabilities: Object.keys(legalEntityResponse.capabilities || {}),
40548
40577
  countryCode: getLegalEntityCountry(legalEntityResponse)
40549
40578
  };
40550
40579
  }
40551
- return {
40552
- legalEntityId: componentProps.legalEntityId
40553
- };
40580
+ return {};
40554
40581
  };
40555
40582
  class UIElement extends BaseElement {
40556
40583
  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.1",
4
4
  "keywords": [
5
5
  "adyen",
6
6
  "adyen-kyc",