@player-ui/markdown-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.
@@ -10204,13 +10204,13 @@ var MarkdownPlugin = function() {
10204
10204
  this.isTransitioning = false;
10205
10205
  this.hooks = {
10206
10206
  beforeStart: new SyncBailHook(),
10207
- /** A callback when the onStart node was present */ onStart: new SyncHook(),
10208
- /** A callback when the onEnd node was present */ onEnd: new SyncHook(),
10209
- /** A hook to intercept and block a transition */ skipTransition: new SyncBailHook(),
10210
- /** A chance to manipulate the flow-node used to calculate the given transition used */ beforeTransition: new SyncWaterfallHook(),
10211
- /** A chance to manipulate the flow-node calculated after a transition */ resolveTransitionNode: new SyncWaterfallHook(),
10212
- /** A callback when a transition from 1 state to another was made */ transition: new SyncHook(),
10213
- /** A callback to run actions after a transition occurs */ afterTransition: new SyncHook()
10207
+ onStart: new SyncHook(),
10208
+ onEnd: new SyncHook(),
10209
+ skipTransition: new SyncBailHook(),
10210
+ beforeTransition: new SyncWaterfallHook(),
10211
+ resolveTransitionNode: new SyncWaterfallHook(),
10212
+ transition: new SyncHook(),
10213
+ afterTransition: new SyncHook()
10214
10214
  };
10215
10215
  this.id = id;
10216
10216
  this.flow = flow3;
@@ -11969,95 +11969,41 @@ var MarkdownPlugin = function() {
11969
11969
  validationController.reset();
11970
11970
  }
11971
11971
  });
11972
- flow3.hooks.afterTransition.tap("player", function(flowInstance) {
11972
+ flow3.hooks.afterTransition.tap("player-action-states", function(flowInstance) {
11973
11973
  var _flowInstance_currentState;
11974
11974
  var value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
11975
- if (value && value.state_type === "ACTION") {
11975
+ if (value && value.state_type === "ASYNC_ACTION") {
11976
11976
  var exp = value.exp;
11977
- var result = expressionEvaluator.evaluate(exp);
11978
- if (isPromiseLike(result)) {
11977
+ try {
11978
+ var result = expressionEvaluator.evaluateAsync(exp);
11979
+ if (isPromiseLike(result)) {
11980
+ if (value.await) {
11981
+ queueMicrotask(function() {
11982
+ result.then(function(r) {
11983
+ return flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(r));
11984
+ }).catch(flowResultDeferred.reject);
11985
+ });
11986
+ } else {
11987
+ _this.logger.warn("Unawaited promise used as return value in in non-async context, transitioning with '*' value");
11988
+ flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
11989
+ }
11990
+ } else {
11991
+ _this.logger.warn("Non async expression used in async action node");
11992
+ flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
11993
+ }
11994
+ } catch (e) {
11995
+ flowResultDeferred.reject(e);
11996
+ }
11997
+ } else if (value && value.state_type === "ACTION") {
11998
+ var exp1 = value.exp;
11999
+ var result1 = expressionEvaluator.evaluate(exp1);
12000
+ if (isPromiseLike(result1)) {
11979
12001
  _this.logger.warn("Async expression used as return value in in non-async context, transitioning with '*' value");
11980
12002
  }
11981
- flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
12003
+ flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result1));
11982
12004
  }
11983
12005
  expressionEvaluator.reset();
11984
12006
  });
11985
- var _this1 = _this;
11986
- flow3.hooks.afterTransition.tap("player", function() {
11987
- var _ref = _async_to_generator(function(flowInstance) {
11988
- var _flowInstance_currentState, value, exp, result, e;
11989
- return _ts_generator(this, function(_state) {
11990
- switch(_state.label){
11991
- case 0:
11992
- value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
11993
- if (!(value && value.state_type === "ASYNC_ACTION")) return [
11994
- 3,
11995
- 8
11996
- ];
11997
- exp = value.exp;
11998
- _state.label = 1;
11999
- case 1:
12000
- _state.trys.push([
12001
- 1,
12002
- 7,
12003
- ,
12004
- 8
12005
- ]);
12006
- result = expressionEvaluator.evaluateAsync(exp);
12007
- if (!isPromiseLike(result)) return [
12008
- 3,
12009
- 5
12010
- ];
12011
- if (!value.await) return [
12012
- 3,
12013
- 3
12014
- ];
12015
- return [
12016
- 4,
12017
- result
12018
- ];
12019
- case 2:
12020
- result = _state.sent();
12021
- return [
12022
- 3,
12023
- 4
12024
- ];
12025
- case 3:
12026
- _this1.logger.warn("Unawaited promise used as return value in in non-async context, transitioning with '*' value");
12027
- _state.label = 4;
12028
- case 4:
12029
- return [
12030
- 3,
12031
- 6
12032
- ];
12033
- case 5:
12034
- _this1.logger.warn("Non async expression used in async action node");
12035
- _state.label = 6;
12036
- case 6:
12037
- flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
12038
- return [
12039
- 3,
12040
- 8
12041
- ];
12042
- case 7:
12043
- e = _state.sent();
12044
- flowResultDeferred.reject(e);
12045
- return [
12046
- 3,
12047
- 8
12048
- ];
12049
- case 8:
12050
- expressionEvaluator.reset();
12051
- return [
12052
- 2
12053
- ];
12054
- }
12055
- });
12056
- });
12057
- return function(flowInstance) {
12058
- return _ref.apply(this, arguments);
12059
- };
12060
- }());
12061
12007
  });
12062
12008
  this.hooks.dataController.call(dataController);
12063
12009
  validationController.setOptions({