@adyen/kyc-components 3.32.2 → 3.32.3

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.
@@ -36641,8 +36641,11 @@ const logger$h = createLogger("AcceptTermsOfService");
36641
36641
  function AcceptTermsOfServiceComponent({
36642
36642
  legalEntityId,
36643
36643
  modalView,
36644
+ /* triggered when X button clicked, or at the end, on Finish button click */
36644
36645
  onClose,
36645
- onUnmount
36646
+ onUnmount,
36647
+ /* triggered on every document signed, typically multiple times */
36648
+ onAccept
36646
36649
  }) {
36647
36650
  const {
36648
36651
  isModalView,
@@ -36665,6 +36668,10 @@ function AcceptTermsOfServiceComponent({
36665
36668
  const [legalEntity, setLegalEntity] = useState();
36666
36669
  const [serviceAgreementTypes, setServiceAgreementTypes] = useState([]);
36667
36670
  const [serviceAgreementAcceptanceInfos, setServiceAgreementAcceptanceInfos] = useState([]);
36671
+ const [stepsData, setStepsData] = useState({
36672
+ unAcceptedTermsOfServiceTypes: [],
36673
+ acceptedTermsOfServices: []
36674
+ });
36668
36675
  if (modalView) {
36669
36676
  setIsModalView(true);
36670
36677
  }
@@ -36690,10 +36697,32 @@ function AcceptTermsOfServiceComponent({
36690
36697
  const handleSign = useCallback(
36691
36698
  // @ts-ignore-error:next-line ts does not infer type correctly
36692
36699
  async (...params) => {
36693
- await acceptServiceAgreement2(...params);
36700
+ const serviceAgreement = await acceptServiceAgreement2(...params);
36694
36701
  await Promise.all([fetchLegalEntity(), fetchUnsigned(), fetchSigned()]);
36702
+ const paramAllowList = {
36703
+ type: serviceAgreement.type,
36704
+ acceptedBy: serviceAgreement.acceptedBy,
36705
+ id: serviceAgreement.id,
36706
+ language: serviceAgreement.language,
36707
+ termsOfServiceDocumentId: serviceAgreement.termsOfServiceDocumentId
36708
+ };
36709
+ const {
36710
+ acceptedTermsOfServices
36711
+ } = stepsData;
36712
+ acceptedTermsOfServices.push(paramAllowList);
36713
+ const unAcceptedTermsOfServiceTypes = serviceAgreementTypes;
36714
+ setStepsData({
36715
+ ...stepsData,
36716
+ unAcceptedTermsOfServiceTypes,
36717
+ acceptedTermsOfServices
36718
+ });
36719
+ onAccept == null ? void 0 : onAccept({
36720
+ ...stepsData,
36721
+ unAcceptedTermsOfServiceTypes,
36722
+ acceptedTermsOfServices
36723
+ });
36695
36724
  },
36696
- [acceptServiceAgreement2, fetchLegalEntity, fetchSigned, fetchUnsigned]
36725
+ [acceptServiceAgreement2, fetchLegalEntity, fetchSigned, fetchUnsigned, onAccept, serviceAgreementTypes, stepsData]
36697
36726
  );
36698
36727
  useEffect(() => {
36699
36728
  (async () => {
@@ -40204,7 +40233,7 @@ const ConfigurationApiProvider = ({
40204
40233
  isEmbeddedDropin,
40205
40234
  loadingContext
40206
40235
  } = authContext;
40207
- const sdkVersion = "3.32.2";
40236
+ const sdkVersion = "3.32.3";
40208
40237
  useAnalytics({
40209
40238
  onUserEvent,
40210
40239
  legalEntityId: rootLegalEntityId,
@@ -40891,7 +40920,7 @@ const DebugModal = ({
40891
40920
  };
40892
40921
  const copyToClipboard = async () => {
40893
40922
  const toCopy = {
40894
- sdkVersion: "3.32.2",
40923
+ sdkVersion: "3.32.3",
40895
40924
  experiments: Object.fromEntries(allExperimentsWithValues),
40896
40925
  settings: Object.fromEntries(allSettingsWithValues)
40897
40926
  };
@@ -40930,7 +40959,7 @@ const DebugModal = ({
40930
40959
  children: [jsxs("div", {
40931
40960
  className: "adyen-kyc-debug-modal__meta",
40932
40961
  children: [jsxs("span", {
40933
- children: ["SDK version: ", "3.32.2"]
40962
+ children: ["SDK version: ", "3.32.3"]
40934
40963
  }), jsxs("span", {
40935
40964
  children: ["rootLegalEntityId: ", rootLegalEntityId]
40936
40965
  })]
@@ -1,8 +1,22 @@
1
+ import type { ServiceAgreementType } from '../../Dropins/ServiceAgreementDropinComponent/types';
1
2
  interface AcceptTermsOfServiceProps {
2
3
  legalEntityId: string;
3
4
  modalView?: boolean;
4
5
  onClose?(): void;
5
6
  onUnmount?(): void;
7
+ onAccept?(data: OnAcceptPayload): void;
6
8
  }
7
- export declare function AcceptTermsOfServiceComponent({ legalEntityId, modalView, onClose, onUnmount, }: AcceptTermsOfServiceProps): import("preact").JSX.Element;
9
+ interface OnAcceptPayload {
10
+ unAcceptedTermsOfServiceTypes: string[];
11
+ acceptedTermsOfServices: AcceptedTermsOfService[];
12
+ }
13
+ /** Params of a step we expose to merchants, some that BE returns get left out */
14
+ interface AcceptedTermsOfService {
15
+ acceptedBy: string;
16
+ id: string;
17
+ language: string;
18
+ termsOfServiceDocumentId: string;
19
+ type: ServiceAgreementType;
20
+ }
21
+ export declare function AcceptTermsOfServiceComponent({ legalEntityId, modalView, onClose, onUnmount, onAccept, }: AcceptTermsOfServiceProps): import("preact").JSX.Element;
8
22
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adyen/kyc-components",
3
- "version": "3.32.2",
3
+ "version": "3.32.3",
4
4
  "keywords": [
5
5
  "adyen",
6
6
  "adyen-kyc",