@adyen/kyc-components 3.8.1 → 3.9.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.
@@ -2750,7 +2750,6 @@ var SettingNames = /* @__PURE__ */ ((SettingNames2) => {
2750
2750
  SettingNames2["AllowIntraRegionCrossBorderPayout"] = "allowIntraRegionCrossBorderPayout";
2751
2751
  SettingNames2["AllowLegalEntityTypeChange"] = "changeLegalEntityType";
2752
2752
  SettingNames2["AllowPrefilledCountryEdit"] = "editPrefilledCountry";
2753
- SettingNames2["LimitToOneTransferInstrument"] = "limitToOneTransferInstrument";
2754
2753
  SettingNames2["RequirePciSignEcommerce"] = "requirePciSignEcommerce";
2755
2754
  SettingNames2["RequirePciSignPos"] = "requirePciSignPos";
2756
2755
  SettingNames2["RequirePciSignEcomMoto"] = "requirePciSignEcomMoto";
@@ -2759,6 +2758,7 @@ var SettingNames = /* @__PURE__ */ ((SettingNames2) => {
2759
2758
  SettingNames2["HideOnboardingIntroductionOrganization"] = "hideOnboardingIntroductionOrganization";
2760
2759
  SettingNames2["HideOnboardingIntroductionTrust"] = "hideOnboardingIntroductionTrust";
2761
2760
  SettingNames2["HideOnboardingIntroductionSoleProprietor"] = "hideOnboardingIntroductionSoleProprietor";
2761
+ SettingNames2["TransferInstrumentLimit"] = "transferInstrumentLimit";
2762
2762
  SettingNames2["ViewOnboardingGuidance"] = "viewOnboardingGuidance";
2763
2763
  return SettingNames2;
2764
2764
  })(SettingNames || {});
@@ -8222,13 +8222,16 @@ var Placement = /* @__PURE__ */ ((Placement2) => {
8222
8222
  function CollapsibleContainer({
8223
8223
  children,
8224
8224
  collapsed = false,
8225
- animationDuration
8225
+ animationDuration = 0
8226
8226
  }) {
8227
8227
  const collapsibleContainerEl = useRef(null);
8228
8228
  const [height, setHeight] = useState(collapsed ? 0 : void 0);
8229
8229
  useEffect(() => {
8230
8230
  var _a;
8231
8231
  setHeight(collapsed ? 0 : (_a = collapsibleContainerEl.current) == null ? void 0 : _a.scrollHeight);
8232
+ setTimeout(() => {
8233
+ setHeight(collapsed ? 0 : "auto");
8234
+ }, animationDuration * 1e3);
8232
8235
  }, [collapsed]);
8233
8236
  return jsx("div", {
8234
8237
  className: "adyen-collapsible-container",
@@ -8236,7 +8239,7 @@ function CollapsibleContainer({
8236
8239
  ref: collapsibleContainerEl,
8237
8240
  style: {
8238
8241
  height,
8239
- transitionDuration: animationDuration
8242
+ transitionDuration: `${animationDuration}s`
8240
8243
  },
8241
8244
  children
8242
8245
  });
@@ -8335,7 +8338,7 @@ function AccordionItem({
8335
8338
  }) : null]
8336
8339
  }), jsx(CollapsibleContainer, {
8337
8340
  collapsed: !isOpen,
8338
- animationDuration: "0.1s",
8341
+ animationDuration: 0.1,
8339
8342
  children: jsx("div", {
8340
8343
  className: "adl-accordion__content",
8341
8344
  children
@@ -10606,7 +10609,8 @@ function AccountHolder(props) {
10606
10609
  const defaultData = {
10607
10610
  accountHolder: isDefaultOptionAvailable ? (_a = props.data) == null ? void 0 : _a.accountHolder : void 0
10608
10611
  };
10609
- if (isExperimentEnabled("EnableNewEntryFlow") && defaultData) {
10612
+ const isNewEntryFlowEnabled = isExperimentEnabled("EnableNewEntryFlow");
10613
+ if (isNewEntryFlowEnabled && defaultData) {
10610
10614
  defaultData.accountHolder = accountHolder2 || defaultData.accountHolder;
10611
10615
  }
10612
10616
  const {
@@ -10645,6 +10649,9 @@ function AccountHolder(props) {
10645
10649
  label: questionLabel,
10646
10650
  errorMessage: formUtils.getErrorMessage("accountHolder", errors, fieldProblems),
10647
10651
  isValid: valid.accountHolder,
10652
+ className: cx({
10653
+ "adl-u-display-none": isNewEntryFlowEnabled
10654
+ }),
10648
10655
  classNameModifiers: ["account-holder"],
10649
10656
  children: (childProps) => jsx(Select, {
10650
10657
  ...childProps,
@@ -17497,7 +17504,7 @@ function PersonalDetailsComponent(props) {
17497
17504
  "aria-label": formUtils.getLabel("jobTitle"),
17498
17505
  "aria-invalid": !valid.birthDate
17499
17506
  })
17500
- }), !isNewEntryFlowEnabled && formUtils.isRequiredField("accountHolder") && data.residencyCountry && jsx(AccountHolder, {
17507
+ }), formUtils.isRequiredField("accountHolder") && data.residencyCountry && jsx(AccountHolder, {
17501
17508
  ...accountHolderProps,
17502
17509
  country: data.residencyCountry,
17503
17510
  dataStoreId: PERSONAL_DETAILS,
@@ -25695,7 +25702,7 @@ const CompanyStructureValidation = {
25695
25702
  };
25696
25703
  const COMPANY_STRUCTURE_FORM_ID = "companyStructure";
25697
25704
  const companyStructureFields = ["entityType"];
25698
- function CompanyStructure({
25705
+ function CompanyStructureComponent({
25699
25706
  data,
25700
25707
  labels: labels2,
25701
25708
  heading,
@@ -25709,6 +25716,7 @@ function CompanyStructure({
25709
25716
  const {
25710
25717
  i18n
25711
25718
  } = useI18nContext();
25719
+ const isNewEntryFlowEnabled = useEnableNewEntryFlow();
25712
25720
  const {
25713
25721
  updateStateSlice
25714
25722
  } = useGlobalDataSlice(COMPANY_STRUCTURE_FORM_ID);
@@ -25751,6 +25759,7 @@ function CompanyStructure({
25751
25759
  fieldProblems: formFieldProblems
25752
25760
  });
25753
25761
  }, [formSchema, formData, formErrors, formValid, formFieldProblems, updateStateSlice]);
25762
+ const companyTypeOptions = isNewEntryFlowEnabled ? companyTypes.filter((companyType2) => companyType2.id !== CompanyTypesValue.INCORPORATED_PARTNERSHIP && companyType2.id !== CompanyTypesValue.INCORPORATED_ASSOCIATION) : companyTypes;
25754
25763
  return jsxs("form", {
25755
25764
  children: [jsx(FormHeader, {
25756
25765
  heading,
@@ -25771,8 +25780,8 @@ function CompanyStructure({
25771
25780
  "aria-label": formUtils.getLabel("entityType", "whatTypeOfCompanyDoYouHave"),
25772
25781
  "aria-invalid": !formValid.entityType,
25773
25782
  name: "entityType",
25774
- items: companyTypes,
25775
- selected: companyTypes.find((type) => type.id === (formData == null ? void 0 : formData.entityType)),
25783
+ items: companyTypeOptions,
25784
+ selected: companyTypeOptions.find((type) => type.id === (formData == null ? void 0 : formData.entityType)),
25776
25785
  readonly: disabled,
25777
25786
  isItemDisabled: () => disabled,
25778
25787
  onSelect: (item) => handleChangeFor("entityType")(item.id)
@@ -25780,7 +25789,6 @@ function CompanyStructure({
25780
25789
  })]
25781
25790
  });
25782
25791
  }
25783
- 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);
25784
25792
  const forms = {
25785
25793
  companyBasics: {
25786
25794
  formId: "companyBasics",
@@ -28816,7 +28824,7 @@ function TaskListComponent({
28816
28824
  const {
28817
28825
  isExperimentEnabled
28818
28826
  } = useExperimentsContext();
28819
- const limitToOneTransferInstrument = useSetting("limitToOneTransferInstrument");
28827
+ const transferInstrumentLimit = useSetting("transferInstrumentLimit");
28820
28828
  const isEnableNewEntryFlowEnabled = useEnableNewEntryFlow();
28821
28829
  const canSeeIntroduction = useCanSeeIntroduction({
28822
28830
  legalEntity: legalEntityResponse
@@ -28964,7 +28972,7 @@ function TaskListComponent({
28964
28972
  capabilityProblems,
28965
28973
  onNavigateToTask: () => handleOnNavigateToTaskPayout(transferInstrument.id),
28966
28974
  onTransferInstrumentDelete: () => onTransferInstrumentDelete(transferInstrument.id)
28967
- }, transferInstrument.id)), !limitToOneTransferInstrument || transferInstruments.length < 1 ? jsxs(Card, {
28975
+ }, transferInstrument.id)), !transferInstrumentLimit || transferInstruments.length < transferInstrumentLimit ? jsxs(Card, {
28968
28976
  stateful: true,
28969
28977
  onClick: () => handleOnNavigateToTaskPayout(),
28970
28978
  className: "adyen-task adl-add-payout",
@@ -31945,6 +31953,31 @@ function TrustDropinComponent({
31945
31953
  const requiredForms = getRequiredForms(trustForms, derivedProps == null ? void 0 : derivedProps.requiredFields, derivedProps == null ? void 0 : derivedProps.optionalFields);
31946
31954
  return addValidityToForms(requiredForms, formValidity, problems);
31947
31955
  }, [derivedProps, formValidity, problems]);
31956
+ useEffect(() => {
31957
+ var _a2;
31958
+ const documentIds = ((_a2 = legalEntityResponse == null ? void 0 : legalEntityResponse.documentDetails) == null ? void 0 : _a2.map((documentReference) => documentReference.id)) || [];
31959
+ try {
31960
+ if (documentIds.length) {
31961
+ documentUtils.fetchDocuments(documentIds, legalEntityResponse.id).then(() => {
31962
+ const mappedDocuments = mapApiDocumentToTrustDocument(legalEntityResponse.id);
31963
+ setData({
31964
+ ...data,
31965
+ ...mappedDocuments
31966
+ });
31967
+ }).catch(() => {
31968
+ showToast({
31969
+ label: i18n.get("failedToFetchRelevantDocuments"),
31970
+ type: ToastType.ERROR
31971
+ });
31972
+ });
31973
+ }
31974
+ } catch (e) {
31975
+ showToast({
31976
+ label: i18n.get("failedToFetchRelevantDocuments"),
31977
+ type: ToastType.ERROR
31978
+ });
31979
+ }
31980
+ }, []);
31948
31981
  const onSubmit = async () => {
31949
31982
  setLoadingStatus("loading");
31950
31983
  const trustDetails2 = mapTrustToLegalEntity(data);
@@ -33411,6 +33444,16 @@ const getAddress = async (context, addressId) => {
33411
33444
  }
33412
33445
  });
33413
33446
  };
33447
+ const getAnalyticsSession = async (loadingContext, data) => httpPost({
33448
+ loadingContext,
33449
+ errorLevel: "warn",
33450
+ errorMessage: `Failed to get analytics sessionId`,
33451
+ path: `analytics/ui`,
33452
+ authentication: "jwt",
33453
+ headers: {
33454
+ "Content-Type": "application/json"
33455
+ }
33456
+ }, data);
33414
33457
  const getIdverificationToken = async (context, request) => {
33415
33458
  const {
33416
33459
  loadingContext,
@@ -33481,6 +33524,16 @@ const idVerificationStartcheck = async (context, request) => {
33481
33524
  }
33482
33525
  }, request);
33483
33526
  };
33527
+ const pushEvents = async (loadingContext, sessionId, event) => httpPost({
33528
+ loadingContext,
33529
+ errorLevel: "warn",
33530
+ errorMessage: `Failed to push events`,
33531
+ path: `analytics/ui/${sessionId}`,
33532
+ authentication: "jwt",
33533
+ headers: {
33534
+ "Content-Type": "application/json"
33535
+ }
33536
+ }, event);
33484
33537
  const searchAddress = async (context, address2) => {
33485
33538
  const {
33486
33539
  loadingContext,
@@ -33542,7 +33595,9 @@ const useComponentApi = (rootLegalEntityId) => {
33542
33595
  idVerificationStartCheck: async (legalEntityId, data) => idVerificationStartcheck(baseRequestContext, data),
33543
33596
  getTransferInstruments: async () => getTransferInstruments(baseRequestContext),
33544
33597
  getOnboardingStatus: async () => getOnboardingStatus(baseRequestContext),
33545
- generateOnboardingLink: async (config) => generateOnboardingLink(baseRequestContext, config)
33598
+ generateOnboardingLink: async (config) => generateOnboardingLink(baseRequestContext, config),
33599
+ getAnalyticsSession: async (data) => getAnalyticsSession(loadingContext, data),
33600
+ pushEvents: async (sessionId, event) => pushEvents(loadingContext, sessionId, event)
33546
33601
  };
33547
33602
  }, [base, rootLegalEntityId]);
33548
33603
  };
@@ -34237,6 +34292,46 @@ const AuthProvider = ({
34237
34292
  children
34238
34293
  });
34239
34294
  };
34295
+ const convertToEmbeddedEvent = (eventQueueItem) => {
34296
+ const [eventType, event] = eventQueueItem;
34297
+ const hasEventData = typeof event === "object";
34298
+ const eventName = hasEventData ? event.key : event;
34299
+ return {
34300
+ eventType,
34301
+ eventName,
34302
+ ...hasEventData && {
34303
+ eventData: event.segmentation
34304
+ }
34305
+ };
34306
+ };
34307
+ const useAnalytics = async ({
34308
+ onUserEvent,
34309
+ isEmbeddedDropin,
34310
+ legalEntityId,
34311
+ sdkVersion,
34312
+ componentName
34313
+ }) => {
34314
+ const {
34315
+ getAnalyticsSession: getAnalyticsSession2,
34316
+ pushEvents: pushEvents2
34317
+ } = useComponentApi(legalEntityId);
34318
+ if (isEmbeddedDropin) {
34319
+ const {
34320
+ id: sessionId
34321
+ } = await getAnalyticsSession2({
34322
+ sdkVersion,
34323
+ componentName,
34324
+ userAgent: navigator.userAgent,
34325
+ legalEntityId
34326
+ });
34327
+ userEvents.subscribe((data) => {
34328
+ const eventItem = convertToEmbeddedEvent(data);
34329
+ pushEvents2(sessionId, eventItem);
34330
+ });
34331
+ } else if (onUserEvent) {
34332
+ userEvents.subscribe(onUserEvent);
34333
+ }
34334
+ };
34240
34335
  let isDocumentGuidanceLoaded = false;
34241
34336
  const getIconContainer = () => {
34242
34337
  const container = document.createElement("div");
@@ -34568,19 +34663,37 @@ const getKycExternalApi = ({
34568
34663
  });
34569
34664
  const ConfigurationApiProvider = ({
34570
34665
  children,
34571
- rootLegalEntityId
34666
+ onUserEvent,
34667
+ rootLegalEntityId,
34668
+ componentName
34572
34669
  }) => {
34573
34670
  const authContext = useAuthContext();
34574
- const contextValue = useMemo(() => authContext.isEmbeddedDropin ? getEmbeddedApi({
34575
- base: authContext.loadingContext,
34671
+ const {
34672
+ isEmbeddedDropin,
34673
+ loadingContext
34674
+ } = authContext;
34675
+ const sdkVersion = "3.9.0";
34676
+ useAnalytics({
34677
+ onUserEvent,
34678
+ isEmbeddedDropin,
34679
+ legalEntityId: rootLegalEntityId,
34680
+ sdkVersion,
34681
+ componentName
34682
+ });
34683
+ const contextValue = useMemo(() => isEmbeddedDropin ? getEmbeddedApi({
34684
+ base: loadingContext,
34576
34685
  rootLegalEntityId
34577
34686
  }) : getKycExternalApi({
34578
- loadingContext: authContext.loadingContext,
34687
+ loadingContext,
34579
34688
  clientKey: authContext.clientKey
34580
34689
  }), [authContext, rootLegalEntityId]);
34581
- return jsx(ConfigurationApiContext.Provider, {
34690
+ return jsxs(ConfigurationApiContext.Provider, {
34582
34691
  value: contextValue,
34583
- children
34692
+ children: [jsx("span", {
34693
+ className: "adyen-kyc__sdk-version",
34694
+ hidden: true,
34695
+ children: sdkVersion
34696
+ }), children]
34584
34697
  });
34585
34698
  };
34586
34699
  const logger$2 = createLogger("CoreProvider");
@@ -34723,7 +34836,7 @@ const settingsDefaults = {
34723
34836
  hideOnboardingIntroductionTrust: true,
34724
34837
  hideOnboardingIntroductionSoleProprietor: true,
34725
34838
  viewOnboardingGuidance: false,
34726
- limitToOneTransferInstrument: false
34839
+ transferInstrumentLimit: 0
34727
34840
  };
34728
34841
  function SettingsProvider({
34729
34842
  children,
@@ -35033,8 +35146,8 @@ const getRootLegalEntityId = (componentProps) => {
35033
35146
  throw new Error("You must provide either `legalEntityId` or `legalEntityResponse`");
35034
35147
  };
35035
35148
  class UIElement extends BaseElement {
35036
- constructor(props) {
35037
- super(props);
35149
+ constructor() {
35150
+ super(...arguments);
35038
35151
  this.render = () => {
35039
35152
  var _a;
35040
35153
  const Component = this.props.component;
@@ -35047,6 +35160,8 @@ class UIElement extends BaseElement {
35047
35160
  loadingContext: this.props.loadingContext,
35048
35161
  children: jsx(ConfigurationApiProvider, {
35049
35162
  rootLegalEntityId: getRootLegalEntityId(this.props.componentProps),
35163
+ onUserEvent: this.props.onUserEvent,
35164
+ componentName: this.props.componentName,
35050
35165
  children: jsx(CoreProvider, {
35051
35166
  contextCountry: this.props.contextCountry,
35052
35167
  enableNewEntryFlowExperiment: (_a = this.props.experiments) == null ? void 0 : _a.EnableNewEntryFlow,
@@ -35075,8 +35190,6 @@ class UIElement extends BaseElement {
35075
35190
  })
35076
35191
  });
35077
35192
  };
35078
- if (props.onUserEvent)
35079
- userEvents.subscribe(props.onUserEvent);
35080
35193
  }
35081
35194
  }
35082
35195
  const normalizeEnvironment = (env) => env.endsWith("/") ? env : `${env}/`;
@@ -35889,7 +36002,8 @@ class Core {
35889
36002
  const uiElement = new UIElement({
35890
36003
  ...mergedOptions,
35891
36004
  component,
35892
- componentProps: mergedOptions
36005
+ componentProps: mergedOptions,
36006
+ componentName
35893
36007
  });
35894
36008
  this.components.push(uiElement);
35895
36009
  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" | "manageTransferInstrumentComponent" | "onboardingRedirectComponent">(componentName: Name, options: ComponentOptions<Name>) => void;
4
+ export declare const validateForComponent: <Name extends "payoutAccount" | "pci" | "individualDropin" | "companyDropin" | "companySearchDropin" | "taskList" | "trustDropin" | "soleProprietorDropin" | "createTransferInstrumentComponent" | "createIndividualComponent" | "manageTransferInstrumentComponent" | "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" | "manageTransferInstrumentComponent" | "onboardingRedirectComponent">(componentName: Name, componentOptions: ComponentOptions<Name>) => UIElement;
11
+ create: <Name extends "payoutAccount" | "pci" | "individualDropin" | "companyDropin" | "companySearchDropin" | "taskList" | "trustDropin" | "soleProprietorDropin" | "createTransferInstrumentComponent" | "createIndividualComponent" | "manageTransferInstrumentComponent" | "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,6 +1,8 @@
1
1
  import { DropinAPIHandlers } from '../../components/Dropins/types';
2
+ import { EmbeddedAnalyticsSessionRequest, EmbeddedAnalyticsSessionResponse } from '../models/api/analytics';
2
3
  import { TransferInstrumentReference } from '../models/api/transfer-instrument-reference';
3
4
  import { BankVerificationErrorResponse, CreateTrustedTransferInstrumentResponse } from '../models/api/trusted-transferInstrument';
5
+ import { EmbeddedEventItem } from '../user-events';
4
6
  export type ComponentApi = {
5
7
  getLegalEntity: Required<DropinAPIHandlers>['handleGetLegalEntity'];
6
8
  updateLegalEntity: Required<DropinAPIHandlers>['handleUpdateLegalEntity'];
@@ -22,6 +24,8 @@ export type ComponentApi = {
22
24
  getTransferInstruments(): Promise<TransferInstrumentReference[]>;
23
25
  getOnboardingStatus: Required<DropinAPIHandlers>['handleGetOnboardingStatus'];
24
26
  generateOnboardingLink: Required<DropinAPIHandlers>['handleGenerateOnboardingLink'];
27
+ getAnalyticsSession(data: EmbeddedAnalyticsSessionRequest): Promise<EmbeddedAnalyticsSessionResponse>;
28
+ pushEvents(sessionId: string, event: EmbeddedEventItem): Promise<void>;
25
29
  };
26
30
  export declare const COMPONENTS_API_VERSION = "v1";
27
31
  /**
@@ -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": "3.8.1",
3
+ "version": "3.9.0",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "files": [