@player-ui/stage-revert-data-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.
@@ -5872,13 +5872,13 @@ var StageRevertDataPlugin = function() {
5872
5872
  this.isTransitioning = false;
5873
5873
  this.hooks = {
5874
5874
  beforeStart: new SyncBailHook(),
5875
- /** A callback when the onStart node was present */ onStart: new SyncHook(),
5876
- /** A callback when the onEnd node was present */ onEnd: new SyncHook(),
5877
- /** A hook to intercept and block a transition */ skipTransition: new SyncBailHook(),
5878
- /** A chance to manipulate the flow-node used to calculate the given transition used */ beforeTransition: new SyncWaterfallHook(),
5879
- /** A chance to manipulate the flow-node calculated after a transition */ resolveTransitionNode: new SyncWaterfallHook(),
5880
- /** A callback when a transition from 1 state to another was made */ transition: new SyncHook(),
5881
- /** A callback to run actions after a transition occurs */ afterTransition: new SyncHook()
5875
+ onStart: new SyncHook(),
5876
+ onEnd: new SyncHook(),
5877
+ skipTransition: new SyncBailHook(),
5878
+ beforeTransition: new SyncWaterfallHook(),
5879
+ resolveTransitionNode: new SyncWaterfallHook(),
5880
+ transition: new SyncHook(),
5881
+ afterTransition: new SyncHook()
5882
5882
  };
5883
5883
  this.id = id;
5884
5884
  this.flow = flow;
@@ -7637,95 +7637,41 @@ var StageRevertDataPlugin = function() {
7637
7637
  validationController.reset();
7638
7638
  }
7639
7639
  });
7640
- flow.hooks.afterTransition.tap("player", function(flowInstance) {
7640
+ flow.hooks.afterTransition.tap("player-action-states", function(flowInstance) {
7641
7641
  var _flowInstance_currentState;
7642
7642
  var value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
7643
- if (value && value.state_type === "ACTION") {
7643
+ if (value && value.state_type === "ASYNC_ACTION") {
7644
7644
  var exp = value.exp;
7645
- var result = expressionEvaluator.evaluate(exp);
7646
- if (isPromiseLike(result)) {
7645
+ try {
7646
+ var result = expressionEvaluator.evaluateAsync(exp);
7647
+ if (isPromiseLike(result)) {
7648
+ if (value.await) {
7649
+ queueMicrotask(function() {
7650
+ result.then(function(r) {
7651
+ return flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(r));
7652
+ }).catch(flowResultDeferred.reject);
7653
+ });
7654
+ } else {
7655
+ _this.logger.warn("Unawaited promise used as return value in in non-async context, transitioning with '*' value");
7656
+ flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
7657
+ }
7658
+ } else {
7659
+ _this.logger.warn("Non async expression used in async action node");
7660
+ flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
7661
+ }
7662
+ } catch (e) {
7663
+ flowResultDeferred.reject(e);
7664
+ }
7665
+ } else if (value && value.state_type === "ACTION") {
7666
+ var exp1 = value.exp;
7667
+ var result1 = expressionEvaluator.evaluate(exp1);
7668
+ if (isPromiseLike(result1)) {
7647
7669
  _this.logger.warn("Async expression used as return value in in non-async context, transitioning with '*' value");
7648
7670
  }
7649
- flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
7671
+ flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result1));
7650
7672
  }
7651
7673
  expressionEvaluator.reset();
7652
7674
  });
7653
- var _this1 = _this;
7654
- flow.hooks.afterTransition.tap("player", function() {
7655
- var _ref = _async_to_generator(function(flowInstance) {
7656
- var _flowInstance_currentState, value, exp, result, e;
7657
- return _ts_generator(this, function(_state) {
7658
- switch(_state.label){
7659
- case 0:
7660
- value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
7661
- if (!(value && value.state_type === "ASYNC_ACTION")) return [
7662
- 3,
7663
- 8
7664
- ];
7665
- exp = value.exp;
7666
- _state.label = 1;
7667
- case 1:
7668
- _state.trys.push([
7669
- 1,
7670
- 7,
7671
- ,
7672
- 8
7673
- ]);
7674
- result = expressionEvaluator.evaluateAsync(exp);
7675
- if (!isPromiseLike(result)) return [
7676
- 3,
7677
- 5
7678
- ];
7679
- if (!value.await) return [
7680
- 3,
7681
- 3
7682
- ];
7683
- return [
7684
- 4,
7685
- result
7686
- ];
7687
- case 2:
7688
- result = _state.sent();
7689
- return [
7690
- 3,
7691
- 4
7692
- ];
7693
- case 3:
7694
- _this1.logger.warn("Unawaited promise used as return value in in non-async context, transitioning with '*' value");
7695
- _state.label = 4;
7696
- case 4:
7697
- return [
7698
- 3,
7699
- 6
7700
- ];
7701
- case 5:
7702
- _this1.logger.warn("Non async expression used in async action node");
7703
- _state.label = 6;
7704
- case 6:
7705
- flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
7706
- return [
7707
- 3,
7708
- 8
7709
- ];
7710
- case 7:
7711
- e = _state.sent();
7712
- flowResultDeferred.reject(e);
7713
- return [
7714
- 3,
7715
- 8
7716
- ];
7717
- case 8:
7718
- expressionEvaluator.reset();
7719
- return [
7720
- 2
7721
- ];
7722
- }
7723
- });
7724
- });
7725
- return function(flowInstance) {
7726
- return _ref.apply(this, arguments);
7727
- };
7728
- }());
7729
7675
  });
7730
7676
  this.hooks.dataController.call(dataController);
7731
7677
  validationController.setOptions({