@wise/dynamic-flow-client 3.34.3 → 3.34.4
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.js +15 -8
- package/build/main.min.js +1 -1
- package/build/main.mjs +15 -8
- package/package.json +3 -3
package/build/main.js
CHANGED
|
@@ -11458,13 +11458,20 @@ function useDynamicFlowCore(props) {
|
|
|
11458
11458
|
void onAction(__spreadValues({ method: "GET" }, initialAction));
|
|
11459
11459
|
}
|
|
11460
11460
|
if (initialStep && !initialAction) {
|
|
11461
|
-
|
|
11461
|
+
createStep(initialStep, null);
|
|
11462
11462
|
trackCoreEvent("Step Shown", { isFirstStep: true });
|
|
11463
11463
|
}
|
|
11464
11464
|
}, []);
|
|
11465
|
+
const createStep = (0, import_react3.useCallback)((newStep, etag) => {
|
|
11466
|
+
initialiseWithStep(newStep, etag, null);
|
|
11467
|
+
}, []);
|
|
11468
|
+
const updateStep = (0, import_react3.useCallback)((newStep, etag) => {
|
|
11469
|
+
var _a2, _b;
|
|
11470
|
+
initialiseWithStep(newStep, etag, (_b = (_a2 = stepComponentRef.current) == null ? void 0 : _a2.getLocalValue()) != null ? _b : null);
|
|
11471
|
+
}, []);
|
|
11465
11472
|
const initialiseWithStep = (0, import_react3.useCallback)(
|
|
11466
|
-
(newStep, etag) => {
|
|
11467
|
-
var _a2
|
|
11473
|
+
(newStep, etag, localValue) => {
|
|
11474
|
+
var _a2;
|
|
11468
11475
|
(_a2 = stepComponentRef.current) == null ? void 0 : _a2.stop();
|
|
11469
11476
|
stepRef.current = newStep;
|
|
11470
11477
|
etagRef.current = etag;
|
|
@@ -11487,7 +11494,7 @@ function useDynamicFlowCore(props) {
|
|
|
11487
11494
|
};
|
|
11488
11495
|
try {
|
|
11489
11496
|
const newStepComponent = mapStepToComponent({
|
|
11490
|
-
stepLocalValue:
|
|
11497
|
+
stepLocalValue: localValue,
|
|
11491
11498
|
step: newStep,
|
|
11492
11499
|
displayStepTitle,
|
|
11493
11500
|
loadingState: "idle",
|
|
@@ -11572,7 +11579,7 @@ function useDynamicFlowCore(props) {
|
|
|
11572
11579
|
}
|
|
11573
11580
|
case "replace-step": {
|
|
11574
11581
|
const isFirstStep = stepRef.current === null;
|
|
11575
|
-
|
|
11582
|
+
createStep(command.step, command.etag);
|
|
11576
11583
|
trackCoreEvent("Step Shown", { isFirstStep });
|
|
11577
11584
|
break;
|
|
11578
11585
|
}
|
|
@@ -11580,7 +11587,7 @@ function useDynamicFlowCore(props) {
|
|
|
11580
11587
|
const genericErrorMessage = getErrorMessageFunctions().genericErrorWithRetry();
|
|
11581
11588
|
const { errors = { error: genericErrorMessage } } = command.body;
|
|
11582
11589
|
if (stepRef.current) {
|
|
11583
|
-
|
|
11590
|
+
updateStep(
|
|
11584
11591
|
__spreadProps(__spreadValues({}, stepRef.current), {
|
|
11585
11592
|
// the existing step
|
|
11586
11593
|
errors,
|
|
@@ -11628,7 +11635,7 @@ function useDynamicFlowCore(props) {
|
|
|
11628
11635
|
case "refresh-step":
|
|
11629
11636
|
{
|
|
11630
11637
|
const errors = errorsOverride != null ? errorsOverride : command.step.errors;
|
|
11631
|
-
|
|
11638
|
+
updateStep(__spreadProps(__spreadValues({}, command.step), { errors }), command.etag);
|
|
11632
11639
|
}
|
|
11633
11640
|
break;
|
|
11634
11641
|
case "error": {
|
|
@@ -11661,7 +11668,7 @@ function useDynamicFlowCore(props) {
|
|
|
11661
11668
|
});
|
|
11662
11669
|
switch (command.type) {
|
|
11663
11670
|
case "replace-step":
|
|
11664
|
-
|
|
11671
|
+
createStep(command.step, command.etag);
|
|
11665
11672
|
return true;
|
|
11666
11673
|
case "action":
|
|
11667
11674
|
void onAction(command.action);
|