@player-ui/beacon-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.
|
@@ -5956,13 +5956,13 @@ var BeaconPlugin = function() {
|
|
|
5956
5956
|
this.isTransitioning = false;
|
|
5957
5957
|
this.hooks = {
|
|
5958
5958
|
beforeStart: new SyncBailHook(),
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5959
|
+
onStart: new SyncHook(),
|
|
5960
|
+
onEnd: new SyncHook(),
|
|
5961
|
+
skipTransition: new SyncBailHook(),
|
|
5962
|
+
beforeTransition: new SyncWaterfallHook(),
|
|
5963
|
+
resolveTransitionNode: new SyncWaterfallHook(),
|
|
5964
|
+
transition: new SyncHook(),
|
|
5965
|
+
afterTransition: new SyncHook()
|
|
5966
5966
|
};
|
|
5967
5967
|
this.id = id;
|
|
5968
5968
|
this.flow = flow;
|
|
@@ -7721,95 +7721,41 @@ var BeaconPlugin = function() {
|
|
|
7721
7721
|
validationController.reset();
|
|
7722
7722
|
}
|
|
7723
7723
|
});
|
|
7724
|
-
flow.hooks.afterTransition.tap("player", function(flowInstance) {
|
|
7724
|
+
flow.hooks.afterTransition.tap("player-action-states", function(flowInstance) {
|
|
7725
7725
|
var _flowInstance_currentState;
|
|
7726
7726
|
var value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
|
|
7727
|
-
if (value && value.state_type === "
|
|
7727
|
+
if (value && value.state_type === "ASYNC_ACTION") {
|
|
7728
7728
|
var exp = value.exp;
|
|
7729
|
-
|
|
7730
|
-
|
|
7729
|
+
try {
|
|
7730
|
+
var result = expressionEvaluator.evaluateAsync(exp);
|
|
7731
|
+
if (isPromiseLike(result)) {
|
|
7732
|
+
if (value.await) {
|
|
7733
|
+
queueMicrotask(function() {
|
|
7734
|
+
result.then(function(r) {
|
|
7735
|
+
return flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(r));
|
|
7736
|
+
}).catch(flowResultDeferred.reject);
|
|
7737
|
+
});
|
|
7738
|
+
} else {
|
|
7739
|
+
_this.logger.warn("Unawaited promise used as return value in in non-async context, transitioning with '*' value");
|
|
7740
|
+
flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
|
|
7741
|
+
}
|
|
7742
|
+
} else {
|
|
7743
|
+
_this.logger.warn("Non async expression used in async action node");
|
|
7744
|
+
flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
|
|
7745
|
+
}
|
|
7746
|
+
} catch (e) {
|
|
7747
|
+
flowResultDeferred.reject(e);
|
|
7748
|
+
}
|
|
7749
|
+
} else if (value && value.state_type === "ACTION") {
|
|
7750
|
+
var exp1 = value.exp;
|
|
7751
|
+
var result1 = expressionEvaluator.evaluate(exp1);
|
|
7752
|
+
if (isPromiseLike(result1)) {
|
|
7731
7753
|
_this.logger.warn("Async expression used as return value in in non-async context, transitioning with '*' value");
|
|
7732
7754
|
}
|
|
7733
|
-
flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(
|
|
7755
|
+
flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result1));
|
|
7734
7756
|
}
|
|
7735
7757
|
expressionEvaluator.reset();
|
|
7736
7758
|
});
|
|
7737
|
-
var _this1 = _this;
|
|
7738
|
-
flow.hooks.afterTransition.tap("player", function() {
|
|
7739
|
-
var _ref = _async_to_generator(function(flowInstance) {
|
|
7740
|
-
var _flowInstance_currentState, value, exp, result, e;
|
|
7741
|
-
return _ts_generator(this, function(_state) {
|
|
7742
|
-
switch(_state.label){
|
|
7743
|
-
case 0:
|
|
7744
|
-
value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
|
|
7745
|
-
if (!(value && value.state_type === "ASYNC_ACTION")) return [
|
|
7746
|
-
3,
|
|
7747
|
-
8
|
|
7748
|
-
];
|
|
7749
|
-
exp = value.exp;
|
|
7750
|
-
_state.label = 1;
|
|
7751
|
-
case 1:
|
|
7752
|
-
_state.trys.push([
|
|
7753
|
-
1,
|
|
7754
|
-
7,
|
|
7755
|
-
,
|
|
7756
|
-
8
|
|
7757
|
-
]);
|
|
7758
|
-
result = expressionEvaluator.evaluateAsync(exp);
|
|
7759
|
-
if (!isPromiseLike(result)) return [
|
|
7760
|
-
3,
|
|
7761
|
-
5
|
|
7762
|
-
];
|
|
7763
|
-
if (!value.await) return [
|
|
7764
|
-
3,
|
|
7765
|
-
3
|
|
7766
|
-
];
|
|
7767
|
-
return [
|
|
7768
|
-
4,
|
|
7769
|
-
result
|
|
7770
|
-
];
|
|
7771
|
-
case 2:
|
|
7772
|
-
result = _state.sent();
|
|
7773
|
-
return [
|
|
7774
|
-
3,
|
|
7775
|
-
4
|
|
7776
|
-
];
|
|
7777
|
-
case 3:
|
|
7778
|
-
_this1.logger.warn("Unawaited promise used as return value in in non-async context, transitioning with '*' value");
|
|
7779
|
-
_state.label = 4;
|
|
7780
|
-
case 4:
|
|
7781
|
-
return [
|
|
7782
|
-
3,
|
|
7783
|
-
6
|
|
7784
|
-
];
|
|
7785
|
-
case 5:
|
|
7786
|
-
_this1.logger.warn("Non async expression used in async action node");
|
|
7787
|
-
_state.label = 6;
|
|
7788
|
-
case 6:
|
|
7789
|
-
flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
|
|
7790
|
-
return [
|
|
7791
|
-
3,
|
|
7792
|
-
8
|
|
7793
|
-
];
|
|
7794
|
-
case 7:
|
|
7795
|
-
e = _state.sent();
|
|
7796
|
-
flowResultDeferred.reject(e);
|
|
7797
|
-
return [
|
|
7798
|
-
3,
|
|
7799
|
-
8
|
|
7800
|
-
];
|
|
7801
|
-
case 8:
|
|
7802
|
-
expressionEvaluator.reset();
|
|
7803
|
-
return [
|
|
7804
|
-
2
|
|
7805
|
-
];
|
|
7806
|
-
}
|
|
7807
|
-
});
|
|
7808
|
-
});
|
|
7809
|
-
return function(flowInstance) {
|
|
7810
|
-
return _ref.apply(this, arguments);
|
|
7811
|
-
};
|
|
7812
|
-
}());
|
|
7813
7759
|
});
|
|
7814
7760
|
this.hooks.dataController.call(dataController);
|
|
7815
7761
|
validationController.setOptions({
|