@player-ui/markdown-plugin 1.1.0-next.2 → 1.1.0-next.3

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.
@@ -12206,8 +12206,8 @@ var MarkdownPlugin = function() {
12206
12206
  ref: Symbol("not-started"),
12207
12207
  status: "not-started"
12208
12208
  };
12209
- var PLAYER_VERSION = true ? "1.1.0-next.2" : "unknown";
12210
- var COMMIT = true ? "233ef9fa2145aa08b23ffbb50bb105689adf830f" : "unknown";
12209
+ var PLAYER_VERSION = true ? "1.1.0-next.3" : "unknown";
12210
+ var COMMIT = true ? "234b74972b29ff0fa11655411dc3cd9d8a98de2a" : "unknown";
12211
12211
  var _Player = /*#__PURE__*/ function() {
12212
12212
  function _Player2(config) {
12213
12213
  var _this = this;
@@ -12229,7 +12229,8 @@ var MarkdownPlugin = function() {
12229
12229
  state: new SyncHook(),
12230
12230
  onStart: new SyncHook(),
12231
12231
  onEnd: new SyncHook(),
12232
- resolveFlowContent: new SyncWaterfallHook()
12232
+ resolveFlowContent: new SyncWaterfallHook(),
12233
+ transformContent: new SyncBailHook()
12233
12234
  };
12234
12235
  if (config === null || config === void 0 ? void 0 : config.logger) {
12235
12236
  this.logger.addHandler(config.logger);
@@ -12243,6 +12244,9 @@ var MarkdownPlugin = function() {
12243
12244
  (_this_config_plugins = this.config.plugins) === null || _this_config_plugins === void 0 ? void 0 : _this_config_plugins.forEach(function(plugin) {
12244
12245
  plugin.apply(_this);
12245
12246
  });
12247
+ this.hooks.transformContent.tap("player", function(payload, meta) {
12248
+ return meta.format === "player" ? payload : void 0;
12249
+ });
12246
12250
  }
12247
12251
  _create_class(_Player2, [
12248
12252
  {
@@ -12549,14 +12553,22 @@ var MarkdownPlugin = function() {
12549
12553
  },
12550
12554
  {
12551
12555
  key: "start",
12552
- value: function start(payload) {
12556
+ value: function start(payload, options) {
12553
12557
  return _async_to_generator(function() {
12554
- var _this, _payload_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
12558
+ var _this, _options_format, meta, flow3, _flow3_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
12555
12559
  return _ts_generator(this, function(_state) {
12556
12560
  switch(_state.label){
12557
12561
  case 0:
12558
12562
  _this = this;
12559
- ref = Symbol((_payload_id = payload === null || payload === void 0 ? void 0 : payload.id) !== null && _payload_id !== void 0 ? _payload_id : "payload");
12563
+ meta = {
12564
+ format: (_options_format = options === null || options === void 0 ? void 0 : options.format) !== null && _options_format !== void 0 ? _options_format : "player",
12565
+ version: options === null || options === void 0 ? void 0 : options.version
12566
+ };
12567
+ flow3 = this.hooks.transformContent.call(payload, meta);
12568
+ if (!flow3) {
12569
+ throw new Error('Player.start received content with format "'.concat(meta.format, '" that no plugin transformed into a Flow.'));
12570
+ }
12571
+ ref = Symbol((_flow3_id = flow3.id) !== null && _flow3_id !== void 0 ? _flow3_id : "payload");
12560
12572
  maybeUpdateState = function(newState) {
12561
12573
  if (_this.state.ref !== ref) {
12562
12574
  _this.logger.warn("Received update for a flow that's not the current one");
@@ -12577,7 +12589,7 @@ var MarkdownPlugin = function() {
12577
12589
  ,
12578
12590
  4
12579
12591
  ]);
12580
- _this_setupFlow = this.setupFlow(payload), state = _this_setupFlow.state, start = _this_setupFlow.start;
12592
+ _this_setupFlow = this.setupFlow(flow3), state = _this_setupFlow.state, start = _this_setupFlow.start;
12581
12593
  this.setState(_object_spread({
12582
12594
  ref: ref
12583
12595
  }, state));
@@ -12612,7 +12624,7 @@ var MarkdownPlugin = function() {
12612
12624
  errorState = {
12613
12625
  status: "error",
12614
12626
  ref: ref,
12615
- flow: payload,
12627
+ flow: flow3,
12616
12628
  error: error
12617
12629
  };
12618
12630
  maybeUpdateState(errorState);