@wise/dynamic-flow-client 3.16.7 → 3.17.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.
package/build/main.mjs
CHANGED
|
@@ -6863,10 +6863,11 @@ var getStepPolling = ({
|
|
|
6863
6863
|
onFailure();
|
|
6864
6864
|
}
|
|
6865
6865
|
};
|
|
6866
|
+
poll();
|
|
6866
6867
|
const intervalRef = setInterval(poll, delay * 1e3);
|
|
6867
6868
|
const stop = () => {
|
|
6868
|
-
abortController.abort();
|
|
6869
6869
|
clearTimeout(intervalRef);
|
|
6870
|
+
abortController.abort();
|
|
6870
6871
|
};
|
|
6871
6872
|
return { stop };
|
|
6872
6873
|
};
|
|
@@ -14246,6 +14247,7 @@ function useExternal2(url) {
|
|
|
14246
14247
|
// src/legacy/common/hooks/useExternalStepPolling/useExternalStepPolling.tsx
|
|
14247
14248
|
import { useCallback as useCallback5, useMemo as useMemo11 } from "react";
|
|
14248
14249
|
function useExternalStepPolling(polling, onAction) {
|
|
14250
|
+
var _a, _b;
|
|
14249
14251
|
const httpClient = useHttpClient();
|
|
14250
14252
|
const asyncFn = useMemo11(() => {
|
|
14251
14253
|
if (polling) {
|
|
@@ -14288,7 +14290,7 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
14288
14290
|
);
|
|
14289
14291
|
usePolling({
|
|
14290
14292
|
asyncFn,
|
|
14291
|
-
|
|
14293
|
+
delay: (_b = (_a = polling == null ? void 0 : polling.delay) != null ? _a : polling == null ? void 0 : polling.interval) != null ? _b : 0,
|
|
14292
14294
|
maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
|
|
14293
14295
|
maxConsecutiveFails: (polling == null ? void 0 : polling.maxConsecutiveFails) || 0,
|
|
14294
14296
|
onPollingResponse,
|
|
@@ -18417,7 +18419,7 @@ function hasStringMessage(value) {
|
|
|
18417
18419
|
import { useEffect as useEffect19, useMemo as useMemo19, useRef as useRef5 } from "react";
|
|
18418
18420
|
function usePolling({
|
|
18419
18421
|
asyncFn,
|
|
18420
|
-
|
|
18422
|
+
delay,
|
|
18421
18423
|
maxAttempts,
|
|
18422
18424
|
maxConsecutiveFails,
|
|
18423
18425
|
onPollingResponse,
|
|
@@ -18436,13 +18438,14 @@ function usePolling({
|
|
|
18436
18438
|
[asyncFn, maxAttempts, maxConsecutiveFails]
|
|
18437
18439
|
);
|
|
18438
18440
|
useEffect19(() => {
|
|
18439
|
-
if (
|
|
18441
|
+
if (delay > 0) {
|
|
18442
|
+
poll();
|
|
18440
18443
|
const intervalReference = setInterval(() => {
|
|
18441
18444
|
poll();
|
|
18442
|
-
},
|
|
18445
|
+
}, delay);
|
|
18443
18446
|
return () => clearInterval(intervalReference);
|
|
18444
18447
|
}
|
|
18445
|
-
}, [poll,
|
|
18448
|
+
}, [poll, delay]);
|
|
18446
18449
|
useEffect19(() => {
|
|
18447
18450
|
onPollingResponseReference.current = onPollingResponse;
|
|
18448
18451
|
onFailureReference.current = onFailure;
|
|
@@ -18486,6 +18489,7 @@ var usePrevious = (value) => {
|
|
|
18486
18489
|
// src/legacy/common/hooks/useStepPolling/useStepPolling.tsx
|
|
18487
18490
|
import { useCallback as useCallback8, useMemo as useMemo20 } from "react";
|
|
18488
18491
|
function useStepPolling(polling, onAction) {
|
|
18492
|
+
var _a, _b;
|
|
18489
18493
|
const httpClient = useHttpClient();
|
|
18490
18494
|
const asyncFn = useMemo20(() => {
|
|
18491
18495
|
if (polling) {
|
|
@@ -18512,7 +18516,7 @@ function useStepPolling(polling, onAction) {
|
|
|
18512
18516
|
);
|
|
18513
18517
|
usePolling({
|
|
18514
18518
|
asyncFn,
|
|
18515
|
-
|
|
18519
|
+
delay: 1e3 * ((_b = (_a = polling == null ? void 0 : polling.delay) != null ? _a : polling == null ? void 0 : polling.interval) != null ? _b : 0),
|
|
18516
18520
|
maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
|
|
18517
18521
|
maxConsecutiveFails: 1,
|
|
18518
18522
|
onPollingResponse,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
type PollingOptions<PR> = {
|
|
2
2
|
asyncFn: (() => Promise<PR>) | undefined;
|
|
3
|
-
|
|
3
|
+
delay: number;
|
|
4
4
|
maxAttempts: number;
|
|
5
5
|
maxConsecutiveFails: number;
|
|
6
6
|
onPollingResponse: (pollingResponse: PR) => boolean;
|
|
7
7
|
onFailure: () => void;
|
|
8
8
|
};
|
|
9
|
-
export declare function usePolling<PollingResponse>({ asyncFn,
|
|
9
|
+
export declare function usePolling<PollingResponse>({ asyncFn, delay, maxAttempts, maxConsecutiveFails, onPollingResponse, onFailure, }: PollingOptions<PollingResponse>): void;
|
|
10
10
|
export declare function createPollingClosure<PR>(asyncFn: (() => Promise<PR>) | undefined, maxAttempts: number, maxConsecutiveFails: number, onPollingResponse: (pollingResponse: PR) => boolean, onFailure: () => void): () => void;
|
|
11
11
|
export {};
|