@adyen/kyc-components 2.34.1 → 2.35.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.
@@ -2712,7 +2712,6 @@ var SettingNames = /* @__PURE__ */ ((SettingNames2) => {
2712
2712
  SettingNames2["AllowIntraRegionCrossBorderPayout"] = "allowIntraRegionCrossBorderPayout";
2713
2713
  SettingNames2["AllowLegalEntityTypeChange"] = "changeLegalEntityType";
2714
2714
  SettingNames2["AllowPrefilledCountryEdit"] = "editPrefilledCountry";
2715
- SettingNames2["LimitToOneTransferInstrument"] = "limitToOneTransferInstrument";
2716
2715
  SettingNames2["RequirePciSignEcommerce"] = "requirePciSignEcommerce";
2717
2716
  SettingNames2["RequirePciSignPos"] = "requirePciSignPos";
2718
2717
  SettingNames2["RequirePciSignEcomMoto"] = "requirePciSignEcomMoto";
@@ -2721,6 +2720,7 @@ var SettingNames = /* @__PURE__ */ ((SettingNames2) => {
2721
2720
  SettingNames2["HideOnboardingIntroductionOrganization"] = "hideOnboardingIntroductionOrganization";
2722
2721
  SettingNames2["HideOnboardingIntroductionTrust"] = "hideOnboardingIntroductionTrust";
2723
2722
  SettingNames2["HideOnboardingIntroductionSoleProprietor"] = "hideOnboardingIntroductionSoleProprietor";
2723
+ SettingNames2["TransferInstrumentLimit"] = "transferInstrumentLimit";
2724
2724
  SettingNames2["ViewOnboardingGuidance"] = "viewOnboardingGuidance";
2725
2725
  return SettingNames2;
2726
2726
  })(SettingNames || {});
@@ -8173,13 +8173,16 @@ var Placement = /* @__PURE__ */ ((Placement2) => {
8173
8173
  function CollapsibleContainer({
8174
8174
  children,
8175
8175
  collapsed = false,
8176
- animationDuration
8176
+ animationDuration = 0
8177
8177
  }) {
8178
8178
  const collapsibleContainerEl = useRef(null);
8179
8179
  const [height, setHeight] = useState(collapsed ? 0 : void 0);
8180
8180
  useEffect(() => {
8181
8181
  var _a;
8182
8182
  setHeight(collapsed ? 0 : (_a = collapsibleContainerEl.current) == null ? void 0 : _a.scrollHeight);
8183
+ setTimeout(() => {
8184
+ setHeight(collapsed ? 0 : "auto");
8185
+ }, animationDuration * 1e3);
8183
8186
  }, [collapsed]);
8184
8187
  return jsx("div", {
8185
8188
  className: "adyen-collapsible-container",
@@ -8187,7 +8190,7 @@ function CollapsibleContainer({
8187
8190
  ref: collapsibleContainerEl,
8188
8191
  style: {
8189
8192
  height,
8190
- transitionDuration: animationDuration
8193
+ transitionDuration: `${animationDuration}s`
8191
8194
  },
8192
8195
  children
8193
8196
  });
@@ -8279,7 +8282,7 @@ function AccordionItem({
8279
8282
  }) : null]
8280
8283
  }), jsx(CollapsibleContainer, {
8281
8284
  collapsed: !isOpen,
8282
- animationDuration: "0.1s",
8285
+ animationDuration: 0.1,
8283
8286
  children: jsx("div", {
8284
8287
  className: "adl-accordion__content",
8285
8288
  children
@@ -10550,7 +10553,8 @@ function AccountHolder(props) {
10550
10553
  const defaultData = {
10551
10554
  accountHolder: isDefaultOptionAvailable ? (_a = props.data) == null ? void 0 : _a.accountHolder : void 0
10552
10555
  };
10553
- if (isExperimentEnabled("EnableNewEntryFlow") && defaultData) {
10556
+ const isNewEntryFlowEnabled = isExperimentEnabled("EnableNewEntryFlow");
10557
+ if (isNewEntryFlowEnabled && defaultData) {
10554
10558
  defaultData.accountHolder = accountHolder2 || defaultData.accountHolder;
10555
10559
  }
10556
10560
  const {
@@ -10589,6 +10593,9 @@ function AccountHolder(props) {
10589
10593
  label: questionLabel,
10590
10594
  errorMessage: formUtils.getErrorMessage("accountHolder", errors, fieldProblems),
10591
10595
  isValid: valid.accountHolder,
10596
+ className: cx({
10597
+ "adl-u-display-none": isNewEntryFlowEnabled
10598
+ }),
10592
10599
  classNameModifiers: ["account-holder"],
10593
10600
  children: (childProps) => jsx(Select, {
10594
10601
  ...childProps,
@@ -17350,7 +17357,7 @@ function PersonalDetailsComponent(props) {
17350
17357
  "aria-label": formUtils.getLabel("jobTitle"),
17351
17358
  "aria-invalid": !valid.birthDate
17352
17359
  })
17353
- }), !isNewEntryFlowEnabled && formUtils.isRequiredField("accountHolder") && data.residencyCountry && jsx(AccountHolder, {
17360
+ }), formUtils.isRequiredField("accountHolder") && data.residencyCountry && jsx(AccountHolder, {
17354
17361
  ...accountHolderProps,
17355
17362
  country: data.residencyCountry,
17356
17363
  dataStoreId: PERSONAL_DETAILS,
@@ -25426,7 +25433,7 @@ const CompanyStructureValidation = {
25426
25433
  };
25427
25434
  const COMPANY_STRUCTURE_FORM_ID = "companyStructure";
25428
25435
  const companyStructureFields = ["entityType"];
25429
- function CompanyStructure({
25436
+ function CompanyStructureComponent({
25430
25437
  data,
25431
25438
  labels: labels2,
25432
25439
  heading,
@@ -25440,6 +25447,7 @@ function CompanyStructure({
25440
25447
  const {
25441
25448
  i18n
25442
25449
  } = useI18nContext();
25450
+ const isNewEntryFlowEnabled = useEnableNewEntryFlow();
25443
25451
  const {
25444
25452
  updateStateSlice
25445
25453
  } = useGlobalDataSlice(COMPANY_STRUCTURE_FORM_ID);
@@ -25482,6 +25490,7 @@ function CompanyStructure({
25482
25490
  fieldProblems: formFieldProblems
25483
25491
  });
25484
25492
  }, [formSchema, formData, formErrors, formValid, formFieldProblems, updateStateSlice]);
25493
+ const companyTypeOptions = isNewEntryFlowEnabled ? companyTypes.filter((companyType2) => companyType2.id !== CompanyTypesValue.INCORPORATED_PARTNERSHIP && companyType2.id !== CompanyTypesValue.INCORPORATED_ASSOCIATION) : companyTypes;
25485
25494
  return jsxs("form", {
25486
25495
  children: [jsx(FormHeader, {
25487
25496
  heading,
@@ -25502,8 +25511,8 @@ function CompanyStructure({
25502
25511
  "aria-label": formUtils.getLabel("entityType", "whatTypeOfCompanyDoYouHave"),
25503
25512
  "aria-invalid": !formValid.entityType,
25504
25513
  name: "entityType",
25505
- items: companyTypes,
25506
- selected: companyTypes.find((type) => type.id === (formData == null ? void 0 : formData.entityType)),
25514
+ items: companyTypeOptions,
25515
+ selected: companyTypeOptions.find((type) => type.id === (formData == null ? void 0 : formData.entityType)),
25507
25516
  readonly: disabled,
25508
25517
  isItemDisabled: () => disabled,
25509
25518
  onSelect: (item) => handleChangeFor("entityType")(item.id)
@@ -25511,7 +25520,6 @@ function CompanyStructure({
25511
25520
  })]
25512
25521
  });
25513
25522
  }
25514
- const CompanyStructureComponent = memo(CompanyStructure, (prevProps, nextProps) => objectsDeepEqual(prevProps.data, nextProps.data) && objectsDeepEqual(prevProps.labels, nextProps.labels) && objectsDeepEqual(prevProps.heading, nextProps.heading) && objectsDeepEqual(prevProps.description, nextProps.description) && objectsDeepEqual(prevProps.formVerificationErrors, nextProps.formVerificationErrors) && objectsDeepEqual(prevProps.fieldValidationErrors, nextProps.fieldValidationErrors) && objectsDeepEqual(prevProps.requiredFields, nextProps.requiredFields) && prevProps.kompanyVerifiedData === nextProps.kompanyVerifiedData);
25515
25523
  const forms = {
25516
25524
  companyBasics: {
25517
25525
  formId: "companyBasics",
@@ -28527,7 +28535,7 @@ function TaskListComponent({
28527
28535
  const {
28528
28536
  isExperimentEnabled
28529
28537
  } = useExperimentsContext();
28530
- const limitToOneTransferInstrument = useSetting("limitToOneTransferInstrument");
28538
+ const transferInstrumentLimit = useSetting("transferInstrumentLimit");
28531
28539
  const isEnableNewEntryFlowEnabled = useEnableNewEntryFlow();
28532
28540
  const canSeeIntroduction = useCanSeeIntroduction({
28533
28541
  legalEntity: legalEntityResponse
@@ -28675,7 +28683,7 @@ function TaskListComponent({
28675
28683
  capabilityProblems,
28676
28684
  onNavigateToTask: () => handleOnNavigateToTaskPayout(transferInstrument.id),
28677
28685
  onTransferInstrumentDelete: () => onTransferInstrumentDelete(transferInstrument.id)
28678
- }, transferInstrument.id)), !limitToOneTransferInstrument || transferInstruments.length < 1 ? jsxs(Card, {
28686
+ }, transferInstrument.id)), !transferInstrumentLimit || transferInstruments.length < transferInstrumentLimit ? jsxs(Card, {
28679
28687
  stateful: true,
28680
28688
  onClick: () => handleOnNavigateToTaskPayout(),
28681
28689
  className: "adyen-task adl-add-payout",
@@ -31662,6 +31670,31 @@ function TrustDropinComponent({
31662
31670
  const requiredForms = getRequiredForms(trustForms, derivedProps == null ? void 0 : derivedProps.requiredFields, derivedProps == null ? void 0 : derivedProps.optionalFields);
31663
31671
  return addValidityToForms(requiredForms, formValidity, problems);
31664
31672
  }, [derivedProps, formValidity, problems]);
31673
+ useEffect(() => {
31674
+ var _a2;
31675
+ const documentIds = ((_a2 = legalEntityResponse == null ? void 0 : legalEntityResponse.documentDetails) == null ? void 0 : _a2.map((documentReference) => documentReference.id)) || [];
31676
+ try {
31677
+ if (documentIds.length) {
31678
+ documentUtils.fetchDocuments(documentIds, legalEntityResponse.id).then(() => {
31679
+ const mappedDocuments = mapApiDocumentToTrustDocument(legalEntityResponse.id);
31680
+ setData({
31681
+ ...data,
31682
+ ...mappedDocuments
31683
+ });
31684
+ }).catch(() => {
31685
+ showToast({
31686
+ label: i18n.get("failedToFetchRelevantDocuments"),
31687
+ type: ToastType.ERROR
31688
+ });
31689
+ });
31690
+ }
31691
+ } catch (e) {
31692
+ showToast({
31693
+ label: i18n.get("failedToFetchRelevantDocuments"),
31694
+ type: ToastType.ERROR
31695
+ });
31696
+ }
31697
+ }, []);
31665
31698
  const onSubmit = async () => {
31666
31699
  setLoadingStatus("loading");
31667
31700
  const trustDetails2 = mapTrustToLegalEntity(data);
@@ -33096,6 +33129,16 @@ const getAddress = async (context, addressId) => {
33096
33129
  }
33097
33130
  });
33098
33131
  };
33132
+ const getAnalyticsSession = async (loadingContext, data) => httpPost({
33133
+ loadingContext,
33134
+ errorLevel: "warn",
33135
+ errorMessage: `Failed to get analytics sessionId`,
33136
+ path: `analytics/ui`,
33137
+ authentication: "jwt",
33138
+ headers: {
33139
+ "Content-Type": "application/json"
33140
+ }
33141
+ }, data);
33099
33142
  const getIdverificationToken = async (context, request) => {
33100
33143
  const {
33101
33144
  loadingContext,
@@ -33166,6 +33209,16 @@ const idVerificationStartcheck = async (context, request) => {
33166
33209
  }
33167
33210
  }, request);
33168
33211
  };
33212
+ const pushEvents = async (loadingContext, sessionId, event) => httpPost({
33213
+ loadingContext,
33214
+ errorLevel: "warn",
33215
+ errorMessage: `Failed to push events`,
33216
+ path: `analytics/ui/${sessionId}`,
33217
+ authentication: "jwt",
33218
+ headers: {
33219
+ "Content-Type": "application/json"
33220
+ }
33221
+ }, event);
33169
33222
  const searchAddress = async (context, address2) => {
33170
33223
  const {
33171
33224
  loadingContext,
@@ -33225,7 +33278,9 @@ const useComponentApi = (rootLegalEntityId) => {
33225
33278
  getIdVerificationToken: async (legalEntityId, data) => getIdverificationToken(baseRequestContext, data),
33226
33279
  idVerificationStartCheck: async (legalEntityId, data) => idVerificationStartcheck(baseRequestContext, data),
33227
33280
  getOnboardingStatus: async () => getOnboardingStatus(baseRequestContext),
33228
- generateOnboardingLink: async (config) => generateOnboardingLink(baseRequestContext, config)
33281
+ generateOnboardingLink: async (config) => generateOnboardingLink(baseRequestContext, config),
33282
+ getAnalyticsSession: async (data) => getAnalyticsSession(loadingContext, data),
33283
+ pushEvents: async (sessionId, event) => pushEvents(loadingContext, sessionId, event)
33229
33284
  };
33230
33285
  }, [base, rootLegalEntityId]);
33231
33286
  };
@@ -33610,6 +33665,46 @@ const AuthProvider = ({
33610
33665
  children
33611
33666
  });
33612
33667
  };
33668
+ const convertToEmbeddedEvent = (eventQueueItem) => {
33669
+ const [eventType, event] = eventQueueItem;
33670
+ const hasEventData = typeof event === "object";
33671
+ const eventName = hasEventData ? event.key : event;
33672
+ return {
33673
+ eventType,
33674
+ eventName,
33675
+ ...hasEventData && {
33676
+ eventData: event.segmentation
33677
+ }
33678
+ };
33679
+ };
33680
+ const useAnalytics = async ({
33681
+ onUserEvent,
33682
+ isEmbeddedDropin,
33683
+ legalEntityId,
33684
+ sdkVersion,
33685
+ componentName
33686
+ }) => {
33687
+ const {
33688
+ getAnalyticsSession: getAnalyticsSession2,
33689
+ pushEvents: pushEvents2
33690
+ } = useComponentApi(legalEntityId);
33691
+ if (isEmbeddedDropin) {
33692
+ const {
33693
+ id: sessionId
33694
+ } = await getAnalyticsSession2({
33695
+ sdkVersion,
33696
+ componentName,
33697
+ userAgent: navigator.userAgent,
33698
+ legalEntityId
33699
+ });
33700
+ userEvents.subscribe((data) => {
33701
+ const eventItem = convertToEmbeddedEvent(data);
33702
+ pushEvents2(sessionId, eventItem);
33703
+ });
33704
+ } else if (onUserEvent) {
33705
+ userEvents.subscribe(onUserEvent);
33706
+ }
33707
+ };
33613
33708
  let isDocumentGuidanceLoaded = false;
33614
33709
  const getIconContainer = () => {
33615
33710
  const container = document.createElement("div");
@@ -33900,19 +33995,37 @@ const getKycExternalApi = ({
33900
33995
  });
33901
33996
  const ConfigurationApiProvider = ({
33902
33997
  children,
33903
- rootLegalEntityId
33998
+ onUserEvent,
33999
+ rootLegalEntityId,
34000
+ componentName
33904
34001
  }) => {
33905
34002
  const authContext = useAuthContext();
33906
- const contextValue = useMemo(() => authContext.isEmbeddedDropin ? getEmbeddedApi({
33907
- base: authContext.loadingContext,
34003
+ const {
34004
+ isEmbeddedDropin,
34005
+ loadingContext
34006
+ } = authContext;
34007
+ const sdkVersion = "2.35.0";
34008
+ useAnalytics({
34009
+ onUserEvent,
34010
+ isEmbeddedDropin,
34011
+ legalEntityId: rootLegalEntityId,
34012
+ sdkVersion,
34013
+ componentName
34014
+ });
34015
+ const contextValue = useMemo(() => isEmbeddedDropin ? getEmbeddedApi({
34016
+ base: loadingContext,
33908
34017
  rootLegalEntityId
33909
34018
  }) : getKycExternalApi({
33910
- loadingContext: authContext.loadingContext,
34019
+ loadingContext,
33911
34020
  clientKey: authContext.clientKey
33912
34021
  }), [authContext, rootLegalEntityId]);
33913
- return jsx(ConfigurationApiContext.Provider, {
34022
+ return jsxs(ConfigurationApiContext.Provider, {
33914
34023
  value: contextValue,
33915
- children
34024
+ children: [jsx("span", {
34025
+ className: "adyen-kyc__sdk-version",
34026
+ hidden: true,
34027
+ children: sdkVersion
34028
+ }), children]
33916
34029
  });
33917
34030
  };
33918
34031
  const logger$2 = createLogger("CoreProvider");
@@ -34055,7 +34168,7 @@ const settingsDefaults = {
34055
34168
  hideOnboardingIntroductionTrust: true,
34056
34169
  hideOnboardingIntroductionSoleProprietor: true,
34057
34170
  viewOnboardingGuidance: false,
34058
- limitToOneTransferInstrument: false
34171
+ transferInstrumentLimit: 0
34059
34172
  };
34060
34173
  function SettingsProvider({
34061
34174
  children,
@@ -34365,8 +34478,8 @@ const getRootLegalEntityId = (componentProps) => {
34365
34478
  throw new Error("You must provide either `legalEntityId` or `legalEntityResponse`");
34366
34479
  };
34367
34480
  class UIElement extends BaseElement {
34368
- constructor(props) {
34369
- super(props);
34481
+ constructor() {
34482
+ super(...arguments);
34370
34483
  this.render = () => {
34371
34484
  var _a;
34372
34485
  const Component = this.props.component;
@@ -34379,6 +34492,8 @@ class UIElement extends BaseElement {
34379
34492
  loadingContext: this.props.loadingContext,
34380
34493
  children: jsx(ConfigurationApiProvider, {
34381
34494
  rootLegalEntityId: getRootLegalEntityId(this.props.componentProps),
34495
+ onUserEvent: this.props.onUserEvent,
34496
+ componentName: this.props.componentName,
34382
34497
  children: jsx(CoreProvider, {
34383
34498
  contextCountry: this.props.contextCountry,
34384
34499
  enableNewEntryFlowExperiment: (_a = this.props.experiments) == null ? void 0 : _a.EnableNewEntryFlow,
@@ -34407,8 +34522,6 @@ class UIElement extends BaseElement {
34407
34522
  })
34408
34523
  });
34409
34524
  };
34410
- if (props.onUserEvent)
34411
- userEvents.subscribe(props.onUserEvent);
34412
34525
  }
34413
34526
  }
34414
34527
  const normalizeEnvironment = (env) => env.endsWith("/") ? env : `${env}/`;
@@ -35214,7 +35327,8 @@ class Core {
35214
35327
  const uiElement = new UIElement({
35215
35328
  ...mergedOptions,
35216
35329
  component,
35217
- componentProps: mergedOptions
35330
+ componentProps: mergedOptions,
35331
+ componentName
35218
35332
  });
35219
35333
  this.components.push(uiElement);
35220
35334
  return uiElement;
@@ -11,7 +11,7 @@ export declare abstract class BaseElement<P extends BaseElementProps> {
11
11
  _component?: JSX.Element;
12
12
  eventEmitter: EventEmitter;
13
13
  private readonly _parentInstance?;
14
- protected constructor(props: P);
14
+ constructor(props: P);
15
15
  abstract render(): JSX.Element;
16
16
  /**
17
17
  * Mounts an element into the dom
@@ -3,6 +3,4 @@ import { CompanySearchSchema } from '../../CompanySearch/types';
3
3
  import { CompanyStructureProps, CompanyStructureSchema } from '../types';
4
4
  export declare const COMPANY_STRUCTURE_FORM_ID: keyof CompanySearchSchema;
5
5
  export declare const companyStructureFields: Array<keyof CompanyStructureSchema>;
6
- declare function CompanyStructure({ data, labels, heading, description, formVerificationErrors, fieldValidationErrors, requiredFields, kompanyVerifiedData, }: CompanyStructureProps): import("preact/compat").JSX.Element;
7
- export declare const CompanyStructureComponent: typeof CompanyStructure;
8
- export {};
6
+ export declare function CompanyStructureComponent({ data, labels, heading, description, formVerificationErrors, fieldValidationErrors, requiredFields, kompanyVerifiedData, }: CompanyStructureProps): import("preact").JSX.Element;
@@ -7,15 +7,16 @@ import { SettingsProps } from '../core/Context/SettingsContext/types';
7
7
  import { UserEventCallback } from '../core/user-events';
8
8
  import { BaseElement, BaseElementProps } from './BaseElement';
9
9
  import EventEmitter from './EventEmitter';
10
+ import { ComponentMap } from './index';
10
11
  export interface BasicComponentProps {
11
12
  eventEmitter?: EventEmitter;
12
13
  }
13
14
  export interface UIElementProps<ComponentProps extends BasicComponentProps> extends BaseElementProps, CoreProviderProps, AuthProviderProps, I18nProviderProps, SettingsProps, ExperimentsProps {
14
15
  onUserEvent?: UserEventCallback;
15
16
  component: (props: ComponentProps) => JSX.Element;
17
+ componentName: keyof ComponentMap;
16
18
  componentProps: ComponentProps;
17
19
  }
18
20
  export declare class UIElement<ComponentProps extends BasicComponentProps = BasicComponentProps> extends BaseElement<UIElementProps<ComponentProps>> {
19
- constructor(props: UIElementProps<ComponentProps>);
20
21
  render: () => JSX.Element;
21
22
  }
@@ -2,5 +2,5 @@ import { ComponentChildren } from 'preact';
2
2
  export interface CollapsibleContainerProps {
3
3
  children: ComponentChildren;
4
4
  collapsed?: boolean;
5
- animationDuration?: string;
5
+ animationDuration?: number;
6
6
  }
@@ -1,7 +1,11 @@
1
1
  import { ComponentChildren } from 'preact';
2
+ import { ComponentMap } from '../../../components';
3
+ import { UserEventCallback } from '../../user-events';
2
4
  interface ConfigurationApiContextProviderProps {
3
5
  children: ComponentChildren;
6
+ onUserEvent?: UserEventCallback;
4
7
  rootLegalEntityId: string;
8
+ componentName: keyof ComponentMap;
5
9
  }
6
- export declare const ConfigurationApiProvider: ({ children, rootLegalEntityId, }: ConfigurationApiContextProviderProps) => import("preact").JSX.Element;
10
+ export declare const ConfigurationApiProvider: ({ children, onUserEvent, rootLegalEntityId, componentName, }: ConfigurationApiContextProviderProps) => import("preact").JSX.Element;
7
11
  export {};
@@ -10,7 +10,6 @@ export declare enum SettingNames {
10
10
  AllowIntraRegionCrossBorderPayout = "allowIntraRegionCrossBorderPayout",
11
11
  AllowLegalEntityTypeChange = "changeLegalEntityType",
12
12
  AllowPrefilledCountryEdit = "editPrefilledCountry",
13
- LimitToOneTransferInstrument = "limitToOneTransferInstrument",
14
13
  RequirePciSignEcommerce = "requirePciSignEcommerce",
15
14
  RequirePciSignPos = "requirePciSignPos",
16
15
  RequirePciSignEcomMoto = "requirePciSignEcomMoto",
@@ -19,6 +18,7 @@ export declare enum SettingNames {
19
18
  HideOnboardingIntroductionOrganization = "hideOnboardingIntroductionOrganization",
20
19
  HideOnboardingIntroductionTrust = "hideOnboardingIntroductionTrust",
21
20
  HideOnboardingIntroductionSoleProprietor = "hideOnboardingIntroductionSoleProprietor",
21
+ TransferInstrumentLimit = "transferInstrumentLimit",
22
22
  ViewOnboardingGuidance = "viewOnboardingGuidance"
23
23
  }
24
24
  export type SettingName = `${SettingNames}`;
@@ -37,7 +37,7 @@ export interface Settings {
37
37
  hideOnboardingIntroductionTrust: boolean;
38
38
  hideOnboardingIntroductionSoleProprietor: boolean;
39
39
  viewOnboardingGuidance: boolean;
40
- limitToOneTransferInstrument: boolean;
40
+ transferInstrumentLimit: number;
41
41
  }
42
42
  export type ProvidedSettings = Partial<Settings>;
43
43
  type BooleanSettingName = {
@@ -1,2 +1,2 @@
1
1
  import { Settings } from './types';
2
- export declare const useSetting: <S extends "acceptedCountries" | "allowBankAccountFormatSelection" | "allowIntraRegionCrossBorderPayout" | "changeLegalEntityType" | "editPrefilledCountry" | "limitToOneTransferInstrument" | "requirePciSignEcommerce" | "requirePciSignPos" | "requirePciSignEcomMoto" | "requirePciSignPosMoto" | "hideOnboardingIntroductionIndividual" | "hideOnboardingIntroductionOrganization" | "hideOnboardingIntroductionTrust" | "hideOnboardingIntroductionSoleProprietor" | "viewOnboardingGuidance">(settingName: S) => Settings[S];
2
+ export declare const useSetting: <S extends "acceptedCountries" | "allowBankAccountFormatSelection" | "allowIntraRegionCrossBorderPayout" | "changeLegalEntityType" | "editPrefilledCountry" | "requirePciSignEcommerce" | "requirePciSignPos" | "requirePciSignEcomMoto" | "requirePciSignPosMoto" | "hideOnboardingIntroductionIndividual" | "hideOnboardingIntroductionOrganization" | "hideOnboardingIntroductionTrust" | "hideOnboardingIntroductionSoleProprietor" | "transferInstrumentLimit" | "viewOnboardingGuidance">(settingName: S) => Settings[S];
@@ -1,4 +1,4 @@
1
1
  import { ComponentOptions } from '../../components';
2
2
  import { CoreOptions } from '../types';
3
3
  export declare const validateCoreOptions: (coreOptions: CoreOptions) => void;
4
- export declare const validateForComponent: <Name extends "payoutAccount" | "pci" | "taskList" | "individualDropin" | "companyDropin" | "companySearchDropin" | "trustDropin" | "soleProprietorDropin" | "createTransferInstrumentComponent" | "createIndividualComponent" | "onboardingRedirectComponent">(componentName: Name, options: ComponentOptions<Name>) => void;
4
+ export declare const validateForComponent: <Name extends "payoutAccount" | "pci" | "individualDropin" | "companyDropin" | "companySearchDropin" | "taskList" | "trustDropin" | "soleProprietorDropin" | "createTransferInstrumentComponent" | "createIndividualComponent" | "onboardingRedirectComponent">(componentName: Name, options: ComponentOptions<Name>) => void;
@@ -0,0 +1,2 @@
1
+ import { EmbeddedAnalyticsSessionRequest, EmbeddedAnalyticsSessionResponse } from '../../models/api/analytics';
2
+ export declare const getAnalyticsSession: (loadingContext: string, data: EmbeddedAnalyticsSessionRequest) => Promise<EmbeddedAnalyticsSessionResponse>;
@@ -0,0 +1,2 @@
1
+ import { EmbeddedEventItem } from '../../user-events';
2
+ export declare const pushEvents: (loadingContext: string, sessionId: string, event: EmbeddedEventItem) => Promise<void>;
@@ -8,7 +8,7 @@ export declare class Core {
8
8
  };
9
9
  components: UIElement[];
10
10
  constructor(coreOptions: CoreOptions);
11
- create: <Name extends "payoutAccount" | "pci" | "taskList" | "individualDropin" | "companyDropin" | "companySearchDropin" | "trustDropin" | "soleProprietorDropin" | "createTransferInstrumentComponent" | "createIndividualComponent" | "onboardingRedirectComponent">(componentName: Name, componentOptions: ComponentOptions<Name>) => UIElement;
11
+ create: <Name extends "payoutAccount" | "pci" | "individualDropin" | "companyDropin" | "companySearchDropin" | "taskList" | "trustDropin" | "soleProprietorDropin" | "createTransferInstrumentComponent" | "createIndividualComponent" | "onboardingRedirectComponent">(componentName: Name, componentOptions: ComponentOptions<Name>) => UIElement;
12
12
  /**
13
13
  * Updates global configurations, resets the internal state and remounts each element.
14
14
  * @param options - props to update
@@ -0,0 +1,11 @@
1
+ import { ComponentMap } from '../../components';
2
+ import { EmbeddedEventItem, EventQueueItem, UserEventCallback } from '../user-events';
3
+ export type useAnalyticsProps = {
4
+ isEmbeddedDropin: boolean;
5
+ legalEntityId: string;
6
+ onUserEvent?: UserEventCallback;
7
+ sdkVersion: string;
8
+ componentName: keyof ComponentMap;
9
+ };
10
+ export declare const convertToEmbeddedEvent: (eventQueueItem: EventQueueItem) => EmbeddedEventItem;
11
+ export declare const useAnalytics: ({ onUserEvent, isEmbeddedDropin, legalEntityId, sdkVersion, componentName, }: useAnalyticsProps) => Promise<void>;
@@ -1,5 +1,7 @@
1
1
  import { DropinAPIHandlers } from '../../components/Dropins/types';
2
+ import { EmbeddedAnalyticsSessionRequest, EmbeddedAnalyticsSessionResponse } from '../models/api/analytics';
2
3
  import { BankVerificationErrorResponse, CreateTrustedTransferInstrumentResponse } from '../models/api/trusted-transferInstrument';
4
+ import { EmbeddedEventItem } from '../user-events';
3
5
  export type ComponentApi = {
4
6
  getLegalEntity: Required<DropinAPIHandlers>['handleGetLegalEntity'];
5
7
  updateLegalEntity: Required<DropinAPIHandlers>['handleUpdateLegalEntity'];
@@ -19,6 +21,8 @@ export type ComponentApi = {
19
21
  handleBankVerificationError: (errorCode: string, errorMessage: string, state: string, metadata?: Map<string, string>) => Promise<BankVerificationErrorResponse>;
20
22
  getOnboardingStatus: Required<DropinAPIHandlers>['handleGetOnboardingStatus'];
21
23
  generateOnboardingLink: Required<DropinAPIHandlers>['handleGenerateOnboardingLink'];
24
+ getAnalyticsSession(data: EmbeddedAnalyticsSessionRequest): Promise<EmbeddedAnalyticsSessionResponse>;
25
+ pushEvents(sessionId: string, event: EmbeddedEventItem): Promise<void>;
22
26
  };
23
27
  export declare const COMPONENTS_API_VERSION = "v1";
24
28
  /**
@@ -0,0 +1,9 @@
1
+ export interface EmbeddedAnalyticsSessionRequest {
2
+ sdkVersion: string;
3
+ componentName: string;
4
+ userAgent: string;
5
+ legalEntityId: string;
6
+ }
7
+ export interface EmbeddedAnalyticsSessionResponse {
8
+ id: string;
9
+ }
@@ -1,10 +1,4 @@
1
1
  export interface UserEvent {
2
- /** How many times has the event occurred */
3
- count?: number;
4
- /** Duration of the event */
5
- dur?: number;
6
- /** Sum to report with the event */
7
- sum?: number;
8
2
  /** Object with segments should be a flat object (arbitrary key/value pairs for event data) */
9
3
  segmentation?: {
10
4
  [key: string]: string | number | boolean | any[] | null;
@@ -13,9 +7,14 @@ export interface UserEvent {
13
7
  type UserEventWithKey = UserEvent & {
14
8
  key: string;
15
9
  };
16
- type EventType = 'track_pageview' | 'add_event' | 'start_event' | 'end_event';
17
- type EventQueueItem = [EventType, string | UserEventWithKey];
10
+ export type EventType = 'track_pageview' | 'add_event' | 'start_event' | 'end_event';
11
+ export type EventQueueItem = [EventType, string | UserEventWithKey];
18
12
  export type UserEventCallback = (eventQueueItem: EventQueueItem) => void;
13
+ export type EmbeddedEventItem = {
14
+ eventType: EventType;
15
+ eventName: string;
16
+ eventData?: UserEvent;
17
+ };
19
18
  declare class UserEvents {
20
19
  private readonly queue;
21
20
  private readonly subscriptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adyen/kyc-components",
3
- "version": "2.34.1",
3
+ "version": "2.35.0",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "files": [