@player-ui/common-types-plugin 0.13.0-next.1 → 0.13.0-next.2
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.
|
@@ -5986,13 +5986,13 @@ var CommonTypesPlugin = function() {
|
|
|
5986
5986
|
this.isTransitioning = false;
|
|
5987
5987
|
this.hooks = {
|
|
5988
5988
|
beforeStart: new SyncBailHook(),
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5989
|
+
onStart: new SyncHook(),
|
|
5990
|
+
onEnd: new SyncHook(),
|
|
5991
|
+
skipTransition: new SyncBailHook(),
|
|
5992
|
+
beforeTransition: new SyncWaterfallHook(),
|
|
5993
|
+
resolveTransitionNode: new SyncWaterfallHook(),
|
|
5994
|
+
transition: new SyncHook(),
|
|
5995
|
+
afterTransition: new SyncHook()
|
|
5996
5996
|
};
|
|
5997
5997
|
this.id = id;
|
|
5998
5998
|
this.flow = flow;
|
|
@@ -7751,95 +7751,41 @@ var CommonTypesPlugin = function() {
|
|
|
7751
7751
|
validationController.reset();
|
|
7752
7752
|
}
|
|
7753
7753
|
});
|
|
7754
|
-
flow.hooks.afterTransition.tap("player", function(flowInstance) {
|
|
7754
|
+
flow.hooks.afterTransition.tap("player-action-states", function(flowInstance) {
|
|
7755
7755
|
var _flowInstance_currentState;
|
|
7756
7756
|
var value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
|
|
7757
|
-
if (value && value.state_type === "
|
|
7757
|
+
if (value && value.state_type === "ASYNC_ACTION") {
|
|
7758
7758
|
var exp = value.exp;
|
|
7759
|
-
|
|
7760
|
-
|
|
7759
|
+
try {
|
|
7760
|
+
var result = expressionEvaluator.evaluateAsync(exp);
|
|
7761
|
+
if (isPromiseLike(result)) {
|
|
7762
|
+
if (value.await) {
|
|
7763
|
+
queueMicrotask(function() {
|
|
7764
|
+
result.then(function(r) {
|
|
7765
|
+
return flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(r));
|
|
7766
|
+
}).catch(flowResultDeferred.reject);
|
|
7767
|
+
});
|
|
7768
|
+
} else {
|
|
7769
|
+
_this.logger.warn("Unawaited promise used as return value in in non-async context, transitioning with '*' value");
|
|
7770
|
+
flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
|
|
7771
|
+
}
|
|
7772
|
+
} else {
|
|
7773
|
+
_this.logger.warn("Non async expression used in async action node");
|
|
7774
|
+
flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
|
|
7775
|
+
}
|
|
7776
|
+
} catch (e) {
|
|
7777
|
+
flowResultDeferred.reject(e);
|
|
7778
|
+
}
|
|
7779
|
+
} else if (value && value.state_type === "ACTION") {
|
|
7780
|
+
var exp1 = value.exp;
|
|
7781
|
+
var result1 = expressionEvaluator.evaluate(exp1);
|
|
7782
|
+
if (isPromiseLike(result1)) {
|
|
7761
7783
|
_this.logger.warn("Async expression used as return value in in non-async context, transitioning with '*' value");
|
|
7762
7784
|
}
|
|
7763
|
-
flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(
|
|
7785
|
+
flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result1));
|
|
7764
7786
|
}
|
|
7765
7787
|
expressionEvaluator.reset();
|
|
7766
7788
|
});
|
|
7767
|
-
var _this1 = _this;
|
|
7768
|
-
flow.hooks.afterTransition.tap("player", function() {
|
|
7769
|
-
var _ref = _async_to_generator(function(flowInstance) {
|
|
7770
|
-
var _flowInstance_currentState, value, exp, result, e;
|
|
7771
|
-
return _ts_generator(this, function(_state) {
|
|
7772
|
-
switch(_state.label){
|
|
7773
|
-
case 0:
|
|
7774
|
-
value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
|
|
7775
|
-
if (!(value && value.state_type === "ASYNC_ACTION")) return [
|
|
7776
|
-
3,
|
|
7777
|
-
8
|
|
7778
|
-
];
|
|
7779
|
-
exp = value.exp;
|
|
7780
|
-
_state.label = 1;
|
|
7781
|
-
case 1:
|
|
7782
|
-
_state.trys.push([
|
|
7783
|
-
1,
|
|
7784
|
-
7,
|
|
7785
|
-
,
|
|
7786
|
-
8
|
|
7787
|
-
]);
|
|
7788
|
-
result = expressionEvaluator.evaluateAsync(exp);
|
|
7789
|
-
if (!isPromiseLike(result)) return [
|
|
7790
|
-
3,
|
|
7791
|
-
5
|
|
7792
|
-
];
|
|
7793
|
-
if (!value.await) return [
|
|
7794
|
-
3,
|
|
7795
|
-
3
|
|
7796
|
-
];
|
|
7797
|
-
return [
|
|
7798
|
-
4,
|
|
7799
|
-
result
|
|
7800
|
-
];
|
|
7801
|
-
case 2:
|
|
7802
|
-
result = _state.sent();
|
|
7803
|
-
return [
|
|
7804
|
-
3,
|
|
7805
|
-
4
|
|
7806
|
-
];
|
|
7807
|
-
case 3:
|
|
7808
|
-
_this1.logger.warn("Unawaited promise used as return value in in non-async context, transitioning with '*' value");
|
|
7809
|
-
_state.label = 4;
|
|
7810
|
-
case 4:
|
|
7811
|
-
return [
|
|
7812
|
-
3,
|
|
7813
|
-
6
|
|
7814
|
-
];
|
|
7815
|
-
case 5:
|
|
7816
|
-
_this1.logger.warn("Non async expression used in async action node");
|
|
7817
|
-
_state.label = 6;
|
|
7818
|
-
case 6:
|
|
7819
|
-
flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
|
|
7820
|
-
return [
|
|
7821
|
-
3,
|
|
7822
|
-
8
|
|
7823
|
-
];
|
|
7824
|
-
case 7:
|
|
7825
|
-
e = _state.sent();
|
|
7826
|
-
flowResultDeferred.reject(e);
|
|
7827
|
-
return [
|
|
7828
|
-
3,
|
|
7829
|
-
8
|
|
7830
|
-
];
|
|
7831
|
-
case 8:
|
|
7832
|
-
expressionEvaluator.reset();
|
|
7833
|
-
return [
|
|
7834
|
-
2
|
|
7835
|
-
];
|
|
7836
|
-
}
|
|
7837
|
-
});
|
|
7838
|
-
});
|
|
7839
|
-
return function(flowInstance) {
|
|
7840
|
-
return _ref.apply(this, arguments);
|
|
7841
|
-
};
|
|
7842
|
-
}());
|
|
7843
7789
|
});
|
|
7844
7790
|
this.hooks.dataController.call(dataController);
|
|
7845
7791
|
validationController.setOptions({
|