@wise/dynamic-flow-client 5.15.0 → 5.15.1
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 +36 -16
- package/build/main.mjs +36 -16
- package/build/tsconfig.types.tsbuildinfo +1 -1
- package/build/types/controller/executeRequest.d.ts +2 -1
- package/build/types/controller/executeRequest.d.ts.map +1 -1
- package/build/types/controller/executeSubmission.d.ts.map +1 -1
- package/build/types/domain/components/RootDomainComponent.d.ts +1 -1
- package/build/types/domain/components/RootDomainComponent.d.ts.map +1 -1
- package/build/types/domain/components/step/StepDomainComponent.d.ts +7 -3
- package/build/types/domain/components/step/StepDomainComponent.d.ts.map +1 -1
- package/build/types/renderers/mappers/rootComponentToProps.d.ts.map +1 -1
- package/package.json +3 -3
package/build/main.js
CHANGED
|
@@ -1000,7 +1000,6 @@ var createRootDomainComponent = (onComponentUpdate, scrollToTop, backConfig, req
|
|
|
1000
1000
|
kind: "step",
|
|
1001
1001
|
uid: "root",
|
|
1002
1002
|
stepComponent: null,
|
|
1003
|
-
subflow: null,
|
|
1004
1003
|
stepStack: [],
|
|
1005
1004
|
backConfig,
|
|
1006
1005
|
requestCache,
|
|
@@ -1067,17 +1066,16 @@ var createRootDomainComponent = (onComponentUpdate, scrollToTop, backConfig, req
|
|
|
1067
1066
|
return (_a = this.stepStack[this.stepStack.length - 1]) != null ? _a : null;
|
|
1068
1067
|
},
|
|
1069
1068
|
addSubflow(subflow) {
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
});
|
|
1069
|
+
var _a;
|
|
1070
|
+
(_a = this.getStep()) == null ? void 0 : _a.addSubflow(subflow);
|
|
1073
1071
|
},
|
|
1074
1072
|
closeSubflow() {
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1073
|
+
var _a;
|
|
1074
|
+
(_a = this.getStep()) == null ? void 0 : _a.closeSubflow();
|
|
1075
|
+
},
|
|
1076
|
+
getSubflow() {
|
|
1077
|
+
var _a, _b;
|
|
1078
|
+
return (_b = (_a = this.getStep()) == null ? void 0 : _a.subflow) != null ? _b : null;
|
|
1081
1079
|
},
|
|
1082
1080
|
start() {
|
|
1083
1081
|
var _a;
|
|
@@ -2608,6 +2606,7 @@ var createStepComponent = (stepProps) => {
|
|
|
2608
2606
|
kind: "step",
|
|
2609
2607
|
modals: [],
|
|
2610
2608
|
requestCache: stepPrefetch.requestCache,
|
|
2609
|
+
subflow: null,
|
|
2611
2610
|
dismissModal() {
|
|
2612
2611
|
var _a2;
|
|
2613
2612
|
(_a2 = this.modals.at(-1)) == null ? void 0 : _a2.close();
|
|
@@ -2653,6 +2652,19 @@ var createStepComponent = (stepProps) => {
|
|
|
2653
2652
|
draft.loadingState = loadingState;
|
|
2654
2653
|
});
|
|
2655
2654
|
},
|
|
2655
|
+
addSubflow(subflow) {
|
|
2656
|
+
this._update((draft) => {
|
|
2657
|
+
draft.subflow = subflow;
|
|
2658
|
+
});
|
|
2659
|
+
},
|
|
2660
|
+
closeSubflow() {
|
|
2661
|
+
if (!this.subflow) {
|
|
2662
|
+
return;
|
|
2663
|
+
}
|
|
2664
|
+
this._update((draft) => {
|
|
2665
|
+
draft.subflow = null;
|
|
2666
|
+
});
|
|
2667
|
+
},
|
|
2656
2668
|
start() {
|
|
2657
2669
|
stepPolling == null ? void 0 : stepPolling.start();
|
|
2658
2670
|
stepRefreshAfter == null ? void 0 : stepRefreshAfter.start();
|
|
@@ -2864,7 +2876,7 @@ var makeSafeHttpClient = (httpClient) => async (...props) => {
|
|
|
2864
2876
|
|
|
2865
2877
|
// src/controller/executeRequest.ts
|
|
2866
2878
|
var executeRequest = async (props) => {
|
|
2867
|
-
const { exit, request, requestCache, httpClient, trackEvent, logEvent } = props;
|
|
2879
|
+
const { isInitial, exit, request, requestCache, httpClient, trackEvent, logEvent } = props;
|
|
2868
2880
|
const { url, method, body } = request;
|
|
2869
2881
|
const response = await getCachedOrFetch(
|
|
2870
2882
|
[
|
|
@@ -2913,18 +2925,24 @@ var executeRequest = async (props) => {
|
|
|
2913
2925
|
}
|
|
2914
2926
|
case "subflow": {
|
|
2915
2927
|
assertSubflowResponseBody(responseBody);
|
|
2916
|
-
return {
|
|
2928
|
+
return !isInitial ? {
|
|
2917
2929
|
type: "behavior",
|
|
2918
2930
|
behavior: __spreadProps(__spreadValues({}, responseBody), {
|
|
2919
2931
|
type: "subflow",
|
|
2920
2932
|
onCompletion: responseBody.onCompletion ? normaliseBehavior(responseBody.onCompletion, []) : void 0,
|
|
2921
2933
|
onError: responseBody.onError ? normaliseBehavior(responseBody.onError, []) : void 0
|
|
2922
2934
|
})
|
|
2935
|
+
} : {
|
|
2936
|
+
type: "error",
|
|
2937
|
+
body: { errors: { error: "Cannot start subflow without a current step" } }
|
|
2923
2938
|
};
|
|
2924
2939
|
}
|
|
2925
2940
|
case "modal": {
|
|
2926
2941
|
assertModalResponseBody(responseBody);
|
|
2927
|
-
return { type: "behavior", behavior: __spreadProps(__spreadValues({}, responseBody), { type: "modal" }) }
|
|
2942
|
+
return !isInitial ? { type: "behavior", behavior: __spreadProps(__spreadValues({}, responseBody), { type: "modal" }) } : {
|
|
2943
|
+
type: "error",
|
|
2944
|
+
body: { errors: { error: "Cannot show modal without a current step" } }
|
|
2945
|
+
};
|
|
2928
2946
|
}
|
|
2929
2947
|
case "no-op": {
|
|
2930
2948
|
return { type: "no-op" };
|
|
@@ -2960,6 +2978,7 @@ var executeSubmission = async (props) => {
|
|
|
2960
2978
|
}
|
|
2961
2979
|
try {
|
|
2962
2980
|
const command = await executeRequest({
|
|
2981
|
+
isInitial,
|
|
2963
2982
|
exit,
|
|
2964
2983
|
request: createRequestFromAction(action, model),
|
|
2965
2984
|
requestCache,
|
|
@@ -6606,7 +6625,7 @@ var executeSubflow = async ({
|
|
|
6606
6625
|
};
|
|
6607
6626
|
const close = () => {
|
|
6608
6627
|
var _a2;
|
|
6609
|
-
if (((_a2 = rootComponent.
|
|
6628
|
+
if (((_a2 = rootComponent.getSubflow()) == null ? void 0 : _a2.uid) === component.uid) {
|
|
6610
6629
|
rootComponent.closeSubflow();
|
|
6611
6630
|
}
|
|
6612
6631
|
};
|
|
@@ -8488,8 +8507,9 @@ var rootComponentToProps = (rootComponent, rendererMapperProps, nativeSubflowHan
|
|
|
8488
8507
|
return componentToRendererProps(child, rendererMapperProps);
|
|
8489
8508
|
})
|
|
8490
8509
|
];
|
|
8491
|
-
const
|
|
8492
|
-
|
|
8510
|
+
const currentStepSubflow = rootComponent.getSubflow();
|
|
8511
|
+
const subflow = currentStepSubflow ? subflowComponentToRendererProps(
|
|
8512
|
+
currentStepSubflow,
|
|
8493
8513
|
rendererMapperProps,
|
|
8494
8514
|
nativeSubflowHandlers
|
|
8495
8515
|
) : void 0;
|
package/build/main.mjs
CHANGED
|
@@ -969,7 +969,6 @@ var createRootDomainComponent = (onComponentUpdate, scrollToTop, backConfig, req
|
|
|
969
969
|
kind: "step",
|
|
970
970
|
uid: "root",
|
|
971
971
|
stepComponent: null,
|
|
972
|
-
subflow: null,
|
|
973
972
|
stepStack: [],
|
|
974
973
|
backConfig,
|
|
975
974
|
requestCache,
|
|
@@ -1036,17 +1035,16 @@ var createRootDomainComponent = (onComponentUpdate, scrollToTop, backConfig, req
|
|
|
1036
1035
|
return (_a = this.stepStack[this.stepStack.length - 1]) != null ? _a : null;
|
|
1037
1036
|
},
|
|
1038
1037
|
addSubflow(subflow) {
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
});
|
|
1038
|
+
var _a;
|
|
1039
|
+
(_a = this.getStep()) == null ? void 0 : _a.addSubflow(subflow);
|
|
1042
1040
|
},
|
|
1043
1041
|
closeSubflow() {
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1042
|
+
var _a;
|
|
1043
|
+
(_a = this.getStep()) == null ? void 0 : _a.closeSubflow();
|
|
1044
|
+
},
|
|
1045
|
+
getSubflow() {
|
|
1046
|
+
var _a, _b;
|
|
1047
|
+
return (_b = (_a = this.getStep()) == null ? void 0 : _a.subflow) != null ? _b : null;
|
|
1050
1048
|
},
|
|
1051
1049
|
start() {
|
|
1052
1050
|
var _a;
|
|
@@ -2577,6 +2575,7 @@ var createStepComponent = (stepProps) => {
|
|
|
2577
2575
|
kind: "step",
|
|
2578
2576
|
modals: [],
|
|
2579
2577
|
requestCache: stepPrefetch.requestCache,
|
|
2578
|
+
subflow: null,
|
|
2580
2579
|
dismissModal() {
|
|
2581
2580
|
var _a2;
|
|
2582
2581
|
(_a2 = this.modals.at(-1)) == null ? void 0 : _a2.close();
|
|
@@ -2622,6 +2621,19 @@ var createStepComponent = (stepProps) => {
|
|
|
2622
2621
|
draft.loadingState = loadingState;
|
|
2623
2622
|
});
|
|
2624
2623
|
},
|
|
2624
|
+
addSubflow(subflow) {
|
|
2625
|
+
this._update((draft) => {
|
|
2626
|
+
draft.subflow = subflow;
|
|
2627
|
+
});
|
|
2628
|
+
},
|
|
2629
|
+
closeSubflow() {
|
|
2630
|
+
if (!this.subflow) {
|
|
2631
|
+
return;
|
|
2632
|
+
}
|
|
2633
|
+
this._update((draft) => {
|
|
2634
|
+
draft.subflow = null;
|
|
2635
|
+
});
|
|
2636
|
+
},
|
|
2625
2637
|
start() {
|
|
2626
2638
|
stepPolling == null ? void 0 : stepPolling.start();
|
|
2627
2639
|
stepRefreshAfter == null ? void 0 : stepRefreshAfter.start();
|
|
@@ -2833,7 +2845,7 @@ var makeSafeHttpClient = (httpClient) => async (...props) => {
|
|
|
2833
2845
|
|
|
2834
2846
|
// src/controller/executeRequest.ts
|
|
2835
2847
|
var executeRequest = async (props) => {
|
|
2836
|
-
const { exit, request, requestCache, httpClient, trackEvent, logEvent } = props;
|
|
2848
|
+
const { isInitial, exit, request, requestCache, httpClient, trackEvent, logEvent } = props;
|
|
2837
2849
|
const { url, method, body } = request;
|
|
2838
2850
|
const response = await getCachedOrFetch(
|
|
2839
2851
|
[
|
|
@@ -2882,18 +2894,24 @@ var executeRequest = async (props) => {
|
|
|
2882
2894
|
}
|
|
2883
2895
|
case "subflow": {
|
|
2884
2896
|
assertSubflowResponseBody(responseBody);
|
|
2885
|
-
return {
|
|
2897
|
+
return !isInitial ? {
|
|
2886
2898
|
type: "behavior",
|
|
2887
2899
|
behavior: __spreadProps(__spreadValues({}, responseBody), {
|
|
2888
2900
|
type: "subflow",
|
|
2889
2901
|
onCompletion: responseBody.onCompletion ? normaliseBehavior(responseBody.onCompletion, []) : void 0,
|
|
2890
2902
|
onError: responseBody.onError ? normaliseBehavior(responseBody.onError, []) : void 0
|
|
2891
2903
|
})
|
|
2904
|
+
} : {
|
|
2905
|
+
type: "error",
|
|
2906
|
+
body: { errors: { error: "Cannot start subflow without a current step" } }
|
|
2892
2907
|
};
|
|
2893
2908
|
}
|
|
2894
2909
|
case "modal": {
|
|
2895
2910
|
assertModalResponseBody(responseBody);
|
|
2896
|
-
return { type: "behavior", behavior: __spreadProps(__spreadValues({}, responseBody), { type: "modal" }) }
|
|
2911
|
+
return !isInitial ? { type: "behavior", behavior: __spreadProps(__spreadValues({}, responseBody), { type: "modal" }) } : {
|
|
2912
|
+
type: "error",
|
|
2913
|
+
body: { errors: { error: "Cannot show modal without a current step" } }
|
|
2914
|
+
};
|
|
2897
2915
|
}
|
|
2898
2916
|
case "no-op": {
|
|
2899
2917
|
return { type: "no-op" };
|
|
@@ -2929,6 +2947,7 @@ var executeSubmission = async (props) => {
|
|
|
2929
2947
|
}
|
|
2930
2948
|
try {
|
|
2931
2949
|
const command = await executeRequest({
|
|
2950
|
+
isInitial,
|
|
2932
2951
|
exit,
|
|
2933
2952
|
request: createRequestFromAction(action, model),
|
|
2934
2953
|
requestCache,
|
|
@@ -6575,7 +6594,7 @@ var executeSubflow = async ({
|
|
|
6575
6594
|
};
|
|
6576
6595
|
const close = () => {
|
|
6577
6596
|
var _a2;
|
|
6578
|
-
if (((_a2 = rootComponent.
|
|
6597
|
+
if (((_a2 = rootComponent.getSubflow()) == null ? void 0 : _a2.uid) === component.uid) {
|
|
6579
6598
|
rootComponent.closeSubflow();
|
|
6580
6599
|
}
|
|
6581
6600
|
};
|
|
@@ -8457,8 +8476,9 @@ var rootComponentToProps = (rootComponent, rendererMapperProps, nativeSubflowHan
|
|
|
8457
8476
|
return componentToRendererProps(child, rendererMapperProps);
|
|
8458
8477
|
})
|
|
8459
8478
|
];
|
|
8460
|
-
const
|
|
8461
|
-
|
|
8479
|
+
const currentStepSubflow = rootComponent.getSubflow();
|
|
8480
|
+
const subflow = currentStepSubflow ? subflowComponentToRendererProps(
|
|
8481
|
+
currentStepSubflow,
|
|
8462
8482
|
rendererMapperProps,
|
|
8463
8483
|
nativeSubflowHandlers
|
|
8464
8484
|
) : void 0;
|