@player-ui/check-path-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.
@@ -5907,13 +5907,13 @@ var CheckPathPlugin = function() {
5907
5907
  this.isTransitioning = false;
5908
5908
  this.hooks = {
5909
5909
  beforeStart: new SyncBailHook(),
5910
- /** A callback when the onStart node was present */ onStart: new SyncHook(),
5911
- /** A callback when the onEnd node was present */ onEnd: new SyncHook(),
5912
- /** A hook to intercept and block a transition */ skipTransition: new SyncBailHook(),
5913
- /** A chance to manipulate the flow-node used to calculate the given transition used */ beforeTransition: new SyncWaterfallHook(),
5914
- /** A chance to manipulate the flow-node calculated after a transition */ resolveTransitionNode: new SyncWaterfallHook(),
5915
- /** A callback when a transition from 1 state to another was made */ transition: new SyncHook(),
5916
- /** A callback to run actions after a transition occurs */ afterTransition: new SyncHook()
5910
+ onStart: new SyncHook(),
5911
+ onEnd: new SyncHook(),
5912
+ skipTransition: new SyncBailHook(),
5913
+ beforeTransition: new SyncWaterfallHook(),
5914
+ resolveTransitionNode: new SyncWaterfallHook(),
5915
+ transition: new SyncHook(),
5916
+ afterTransition: new SyncHook()
5917
5917
  };
5918
5918
  this.id = id;
5919
5919
  this.flow = flow;
@@ -7672,95 +7672,41 @@ var CheckPathPlugin = function() {
7672
7672
  validationController.reset();
7673
7673
  }
7674
7674
  });
7675
- flow.hooks.afterTransition.tap("player", function(flowInstance) {
7675
+ flow.hooks.afterTransition.tap("player-action-states", function(flowInstance) {
7676
7676
  var _flowInstance_currentState;
7677
7677
  var value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
7678
- if (value && value.state_type === "ACTION") {
7678
+ if (value && value.state_type === "ASYNC_ACTION") {
7679
7679
  var exp = value.exp;
7680
- var result = expressionEvaluator.evaluate(exp);
7681
- if (isPromiseLike(result)) {
7680
+ try {
7681
+ var result = expressionEvaluator.evaluateAsync(exp);
7682
+ if (isPromiseLike(result)) {
7683
+ if (value.await) {
7684
+ queueMicrotask(function() {
7685
+ result.then(function(r) {
7686
+ return flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(r));
7687
+ }).catch(flowResultDeferred.reject);
7688
+ });
7689
+ } else {
7690
+ _this.logger.warn("Unawaited promise used as return value in in non-async context, transitioning with '*' value");
7691
+ flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
7692
+ }
7693
+ } else {
7694
+ _this.logger.warn("Non async expression used in async action node");
7695
+ flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
7696
+ }
7697
+ } catch (e) {
7698
+ flowResultDeferred.reject(e);
7699
+ }
7700
+ } else if (value && value.state_type === "ACTION") {
7701
+ var exp1 = value.exp;
7702
+ var result1 = expressionEvaluator.evaluate(exp1);
7703
+ if (isPromiseLike(result1)) {
7682
7704
  _this.logger.warn("Async expression used as return value in in non-async context, transitioning with '*' value");
7683
7705
  }
7684
- flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
7706
+ flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result1));
7685
7707
  }
7686
7708
  expressionEvaluator.reset();
7687
7709
  });
7688
- var _this1 = _this;
7689
- flow.hooks.afterTransition.tap("player", function() {
7690
- var _ref = _async_to_generator(function(flowInstance) {
7691
- var _flowInstance_currentState, value, exp, result, e;
7692
- return _ts_generator(this, function(_state) {
7693
- switch(_state.label){
7694
- case 0:
7695
- value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
7696
- if (!(value && value.state_type === "ASYNC_ACTION")) return [
7697
- 3,
7698
- 8
7699
- ];
7700
- exp = value.exp;
7701
- _state.label = 1;
7702
- case 1:
7703
- _state.trys.push([
7704
- 1,
7705
- 7,
7706
- ,
7707
- 8
7708
- ]);
7709
- result = expressionEvaluator.evaluateAsync(exp);
7710
- if (!isPromiseLike(result)) return [
7711
- 3,
7712
- 5
7713
- ];
7714
- if (!value.await) return [
7715
- 3,
7716
- 3
7717
- ];
7718
- return [
7719
- 4,
7720
- result
7721
- ];
7722
- case 2:
7723
- result = _state.sent();
7724
- return [
7725
- 3,
7726
- 4
7727
- ];
7728
- case 3:
7729
- _this1.logger.warn("Unawaited promise used as return value in in non-async context, transitioning with '*' value");
7730
- _state.label = 4;
7731
- case 4:
7732
- return [
7733
- 3,
7734
- 6
7735
- ];
7736
- case 5:
7737
- _this1.logger.warn("Non async expression used in async action node");
7738
- _state.label = 6;
7739
- case 6:
7740
- flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
7741
- return [
7742
- 3,
7743
- 8
7744
- ];
7745
- case 7:
7746
- e = _state.sent();
7747
- flowResultDeferred.reject(e);
7748
- return [
7749
- 3,
7750
- 8
7751
- ];
7752
- case 8:
7753
- expressionEvaluator.reset();
7754
- return [
7755
- 2
7756
- ];
7757
- }
7758
- });
7759
- });
7760
- return function(flowInstance) {
7761
- return _ref.apply(this, arguments);
7762
- };
7763
- }());
7764
7710
  });
7765
7711
  this.hooks.dataController.call(dataController);
7766
7712
  validationController.setOptions({