@player-ui/check-path-plugin 1.1.0-next.2 → 1.1.0-next.4

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.
@@ -7875,8 +7875,8 @@ var CheckPathPlugin = function() {
7875
7875
  ref: Symbol("not-started"),
7876
7876
  status: "not-started"
7877
7877
  };
7878
- var PLAYER_VERSION = true ? "1.1.0-next.2" : "unknown";
7879
- var COMMIT = true ? "233ef9fa2145aa08b23ffbb50bb105689adf830f" : "unknown";
7878
+ var PLAYER_VERSION = true ? "1.1.0-next.4" : "unknown";
7879
+ var COMMIT = true ? "c00a0bc3257d918e21b7244a770ae462017f0fae" : "unknown";
7880
7880
  var _Player = /*#__PURE__*/ function() {
7881
7881
  function _Player2(config) {
7882
7882
  var _this = this;
@@ -7898,7 +7898,8 @@ var CheckPathPlugin = function() {
7898
7898
  state: new SyncHook(),
7899
7899
  onStart: new SyncHook(),
7900
7900
  onEnd: new SyncHook(),
7901
- resolveFlowContent: new SyncWaterfallHook()
7901
+ resolveFlowContent: new SyncWaterfallHook(),
7902
+ transformContent: new SyncBailHook()
7902
7903
  };
7903
7904
  if (config === null || config === void 0 ? void 0 : config.logger) {
7904
7905
  this.logger.addHandler(config.logger);
@@ -7912,6 +7913,9 @@ var CheckPathPlugin = function() {
7912
7913
  (_this_config_plugins = this.config.plugins) === null || _this_config_plugins === void 0 ? void 0 : _this_config_plugins.forEach(function(plugin) {
7913
7914
  plugin.apply(_this);
7914
7915
  });
7916
+ this.hooks.transformContent.tap("player", function(payload, meta) {
7917
+ return meta.format === "player" ? payload : void 0;
7918
+ });
7915
7919
  }
7916
7920
  _create_class(_Player2, [
7917
7921
  {
@@ -8218,14 +8222,22 @@ var CheckPathPlugin = function() {
8218
8222
  },
8219
8223
  {
8220
8224
  key: "start",
8221
- value: function start(payload) {
8225
+ value: function start(payload, options) {
8222
8226
  return _async_to_generator(function() {
8223
- var _this, _payload_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
8227
+ var _this, _options_format, meta, flow, _flow_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
8224
8228
  return _ts_generator(this, function(_state) {
8225
8229
  switch(_state.label){
8226
8230
  case 0:
8227
8231
  _this = this;
8228
- ref = Symbol((_payload_id = payload === null || payload === void 0 ? void 0 : payload.id) !== null && _payload_id !== void 0 ? _payload_id : "payload");
8232
+ meta = {
8233
+ format: (_options_format = options === null || options === void 0 ? void 0 : options.format) !== null && _options_format !== void 0 ? _options_format : "player",
8234
+ version: options === null || options === void 0 ? void 0 : options.version
8235
+ };
8236
+ flow = this.hooks.transformContent.call(payload, meta);
8237
+ if (!flow) {
8238
+ throw new Error('Player.start received content with format "'.concat(meta.format, '" that no plugin transformed into a Flow.'));
8239
+ }
8240
+ ref = Symbol((_flow_id = flow.id) !== null && _flow_id !== void 0 ? _flow_id : "payload");
8229
8241
  maybeUpdateState = function(newState) {
8230
8242
  if (_this.state.ref !== ref) {
8231
8243
  _this.logger.warn("Received update for a flow that's not the current one");
@@ -8246,7 +8258,7 @@ var CheckPathPlugin = function() {
8246
8258
  ,
8247
8259
  4
8248
8260
  ]);
8249
- _this_setupFlow = this.setupFlow(payload), state = _this_setupFlow.state, start = _this_setupFlow.start;
8261
+ _this_setupFlow = this.setupFlow(flow), state = _this_setupFlow.state, start = _this_setupFlow.start;
8250
8262
  this.setState(_object_spread({
8251
8263
  ref: ref
8252
8264
  }, state));
@@ -8281,7 +8293,7 @@ var CheckPathPlugin = function() {
8281
8293
  errorState = {
8282
8294
  status: "error",
8283
8295
  ref: ref,
8284
- flow: payload,
8296
+ flow: flow,
8285
8297
  error: error
8286
8298
  };
8287
8299
  maybeUpdateState(errorState);