@adyen/kyc-components 3.0.0-beta.15 → 3.0.0-beta.16
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.
|
@@ -28407,20 +28407,22 @@ const useComponentApi = (rootLegalEntityId) => {
|
|
|
28407
28407
|
};
|
|
28408
28408
|
const DEFAULT_POLLING_INTERVAL = 3e3;
|
|
28409
28409
|
const DEFAULT_POLLING_INTERVAL_RETRY_COUNT = 3;
|
|
28410
|
-
function useInterval(callback,
|
|
28410
|
+
function useInterval(callback, initialDelay = DEFAULT_POLLING_INTERVAL) {
|
|
28411
28411
|
const savedCallback = useRef(null);
|
|
28412
28412
|
const [timeoutId, setTimeoutId] = useState();
|
|
28413
|
-
|
|
28413
|
+
const [delayValue, setDelayValue] = useState(initialDelay || DEFAULT_POLLING_INTERVAL);
|
|
28414
28414
|
let retryCount = 0;
|
|
28415
28415
|
useEffect(() => {
|
|
28416
28416
|
savedCallback.current = callback;
|
|
28417
28417
|
const delayGenerator = () => {
|
|
28418
|
+
let delay = delayValue;
|
|
28418
28419
|
if (retryCount < DEFAULT_POLLING_INTERVAL_RETRY_COUNT) {
|
|
28419
28420
|
retryCount += 1;
|
|
28420
28421
|
} else {
|
|
28421
|
-
|
|
28422
|
+
delay = delayValue >= 9e3 ? delay = initialDelay : delayValue + 1e3;
|
|
28423
|
+
setDelayValue(delay);
|
|
28422
28424
|
}
|
|
28423
|
-
return
|
|
28425
|
+
return delay;
|
|
28424
28426
|
};
|
|
28425
28427
|
const handleTick = () => {
|
|
28426
28428
|
if (savedCallback.current !== null) {
|
|
@@ -28435,13 +28437,11 @@ function useInterval(callback, clearInterval2 = false, initialDelay = DEFAULT_PO
|
|
|
28435
28437
|
setTimeoutId(timeoutId2);
|
|
28436
28438
|
};
|
|
28437
28439
|
randomTick();
|
|
28438
|
-
|
|
28439
|
-
|
|
28440
|
-
|
|
28441
|
-
|
|
28442
|
-
|
|
28443
|
-
};
|
|
28444
|
-
}, [initialDelay, clearInterval2]);
|
|
28440
|
+
}, [initialDelay]);
|
|
28441
|
+
useEffect(() => () => {
|
|
28442
|
+
clearTimeout(timeoutId);
|
|
28443
|
+
}, [timeoutId]);
|
|
28444
|
+
return timeoutId;
|
|
28445
28445
|
}
|
|
28446
28446
|
function AddTransferInstrument({
|
|
28447
28447
|
onAdd
|
|
@@ -28519,7 +28519,6 @@ const statusDescription = {
|
|
|
28519
28519
|
function ManageTransferInstrumentOverviewItem({
|
|
28520
28520
|
transferInstrumentReference,
|
|
28521
28521
|
transferInstrument,
|
|
28522
|
-
onAdd,
|
|
28523
28522
|
onEdit,
|
|
28524
28523
|
onOpen,
|
|
28525
28524
|
onRemove,
|
|
@@ -28566,7 +28565,8 @@ function ManageTransferInstrumentOverviewItem({
|
|
|
28566
28565
|
subTitle,
|
|
28567
28566
|
onOpen: () => onOpen(transferInstrumentReference.transferInstrument.id),
|
|
28568
28567
|
children: [!transferInstrument ? jsx(LoaderWrapper, {
|
|
28569
|
-
className: "adyen-kyc-manage-ti-overview-item__loader"
|
|
28568
|
+
className: "adyen-kyc-manage-ti-overview-item__loader",
|
|
28569
|
+
status: "loading"
|
|
28570
28570
|
}) : jsx(ManageTransferInstrumentOverviewItemSummary, {
|
|
28571
28571
|
transferInstrument,
|
|
28572
28572
|
accountHolderName,
|
|
@@ -28614,11 +28614,10 @@ function ManageTransferInstrumentOverview({
|
|
|
28614
28614
|
logger$6.error(e);
|
|
28615
28615
|
}
|
|
28616
28616
|
};
|
|
28617
|
-
const transferInstrumentListEle = transferInstrumentReferences.map((transferInstrumentRef
|
|
28617
|
+
const transferInstrumentListEle = transferInstrumentReferences.map((transferInstrumentRef) => jsx(ManageTransferInstrumentOverviewItem, {
|
|
28618
28618
|
accountHolderName,
|
|
28619
28619
|
transferInstrument: transferInstrumentsMap[transferInstrumentRef.transferInstrument.id],
|
|
28620
28620
|
transferInstrumentReference: transferInstrumentRef,
|
|
28621
|
-
onAdd,
|
|
28622
28621
|
onEdit,
|
|
28623
28622
|
onRemove: onRemoveTransferinstrument,
|
|
28624
28623
|
onOpen: onShowBankDetails
|
|
@@ -28661,10 +28660,10 @@ function ManageTransferInstrumentComponent({
|
|
|
28661
28660
|
const transferInstrumentRefs = await getTransferInstruments2();
|
|
28662
28661
|
setTransferInstruments(transferInstrumentRefs);
|
|
28663
28662
|
};
|
|
28664
|
-
const
|
|
28663
|
+
const hasOnlyVerifiedTransferInstruments = transferInstruments == null ? void 0 : transferInstruments.every(({
|
|
28665
28664
|
status
|
|
28666
|
-
}) => status
|
|
28667
|
-
useInterval(refreshTransferInstruments
|
|
28665
|
+
}) => status === "FINISHED");
|
|
28666
|
+
const timeoutId = useInterval(refreshTransferInstruments);
|
|
28668
28667
|
const init2 = useCallback(async () => {
|
|
28669
28668
|
const [transferInstrumentRefs, legalEntity] = await Promise.all([getTransferInstruments2(), getLegalEntity2(legalEntityId)]);
|
|
28670
28669
|
const accountHolder2 = getPayoutAccountHolderName(legalEntity, i18n);
|
|
@@ -28677,9 +28676,14 @@ function ManageTransferInstrumentComponent({
|
|
|
28677
28676
|
setLoadingStatus("success");
|
|
28678
28677
|
});
|
|
28679
28678
|
}, [init2, setLocale, eventEmitter]);
|
|
28680
|
-
|
|
28679
|
+
useEffect(() => {
|
|
28680
|
+
if (transferInstruments.length && hasOnlyVerifiedTransferInstruments) {
|
|
28681
|
+
clearTimeout(timeoutId);
|
|
28682
|
+
}
|
|
28683
|
+
}, [hasOnlyVerifiedTransferInstruments, timeoutId, transferInstruments]);
|
|
28684
|
+
const onRemove = (transferInstrumentId) => {
|
|
28681
28685
|
refreshTransferInstruments().catch(logger$5.error);
|
|
28682
|
-
onRemoveSuccess == null ? void 0 : onRemoveSuccess(
|
|
28686
|
+
onRemoveSuccess == null ? void 0 : onRemoveSuccess(transferInstrumentId, legalEntityId);
|
|
28683
28687
|
};
|
|
28684
28688
|
const render2 = () => {
|
|
28685
28689
|
if (loadingStatus === "loading") {
|
|
@@ -28748,6 +28752,7 @@ function TransferInstrumentComponent({
|
|
|
28748
28752
|
} = useComponentApi(legalEntityId);
|
|
28749
28753
|
const [legalEntity, setLegalEntity] = useState();
|
|
28750
28754
|
const [transferInstrument, setTransferInstrument] = useState();
|
|
28755
|
+
const [loadingStatus, setLoadingStatus] = useState("success");
|
|
28751
28756
|
const fetchLegalEntity = useCallback(async () => {
|
|
28752
28757
|
const le = await getLegalEntity2(legalEntityId);
|
|
28753
28758
|
setLegalEntity(le);
|
|
@@ -28755,14 +28760,19 @@ function TransferInstrumentComponent({
|
|
|
28755
28760
|
}, [getLegalEntity2, legalEntityId]);
|
|
28756
28761
|
useEffect(() => {
|
|
28757
28762
|
(async () => {
|
|
28763
|
+
setLoadingStatus("loading");
|
|
28758
28764
|
await fetchLegalEntity();
|
|
28759
28765
|
if (transferInstrumentId) {
|
|
28760
28766
|
const ti = await getTransferInstrument2(transferInstrumentId);
|
|
28761
28767
|
setTransferInstrument(ti);
|
|
28762
28768
|
}
|
|
28763
|
-
})().catch(logger$4.error)
|
|
28764
|
-
|
|
28765
|
-
|
|
28769
|
+
})().catch(logger$4.error).finally(() => {
|
|
28770
|
+
setLoadingStatus("success");
|
|
28771
|
+
});
|
|
28772
|
+
}, [transferInstrumentId, fetchLegalEntity, getTransferInstrument2]);
|
|
28773
|
+
return loadingStatus === "loading" || !legalEntity ? jsx(Loader, {
|
|
28774
|
+
size: "medium"
|
|
28775
|
+
}) : jsx(PayoutDetailsDropinComponent, {
|
|
28766
28776
|
eventEmitter: eventEmitter ?? new EventEmitter(),
|
|
28767
28777
|
transferInstrument,
|
|
28768
28778
|
setTransferInstrument,
|
|
@@ -28782,7 +28792,7 @@ function TransferInstrumentComponent({
|
|
|
28782
28792
|
createTrustedTransferInstrument: createTrustedTransferInstrument2,
|
|
28783
28793
|
handleBankVerificationError: handleBankVerificationError2,
|
|
28784
28794
|
taskType: TaskTypes.PAYOUT
|
|
28785
|
-
})
|
|
28795
|
+
});
|
|
28786
28796
|
}
|
|
28787
28797
|
const componentsMap = {
|
|
28788
28798
|
individualDropin: IndividualDropinComponent,
|
|
@@ -5,9 +5,8 @@ export interface ManageTransferInstrumentOverviewItemProps {
|
|
|
5
5
|
accountHolderName: string;
|
|
6
6
|
transferInstrumentReference: TransferInstrumentReference;
|
|
7
7
|
transferInstrument: ExistingTransferInstrument | undefined;
|
|
8
|
-
onAdd: () => void;
|
|
9
8
|
onEdit: (transferInstrumentId: ExistingTransferInstrument['id']) => void;
|
|
10
9
|
onOpen: (transferInstrumentId: ExistingTransferInstrument['id']) => void;
|
|
11
10
|
onRemove: (transferInstrumentId: ExistingTransferInstrument['id']) => Promise<void>;
|
|
12
11
|
}
|
|
13
|
-
export declare function ManageTransferInstrumentOverviewItem({ transferInstrumentReference, transferInstrument,
|
|
12
|
+
export declare function ManageTransferInstrumentOverviewItem({ transferInstrumentReference, transferInstrument, onEdit, onOpen, onRemove, accountHolderName, }: ManageTransferInstrumentOverviewItemProps): import("preact").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
type IntervalFunction = () => unknown | void;
|
|
2
|
-
export declare function useInterval(callback: IntervalFunction,
|
|
3
|
+
export declare function useInterval(callback: IntervalFunction, initialDelay?: number): NodeJS.Timeout;
|
|
3
4
|
export {};
|