@player-ui/player 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.
@@ -8505,8 +8505,8 @@ var Player = function() {
8505
8505
  status: "not-started"
8506
8506
  };
8507
8507
  // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/player.ts
8508
- var PLAYER_VERSION = true ? "1.1.0-next.2" : "unknown";
8509
- var COMMIT = true ? "233ef9fa2145aa08b23ffbb50bb105689adf830f" : "unknown";
8508
+ var PLAYER_VERSION = true ? "1.1.0-next.3" : "unknown";
8509
+ var COMMIT = true ? "234b74972b29ff0fa11655411dc3cd9d8a98de2a" : "unknown";
8510
8510
  var _Player = /*#__PURE__*/ function() {
8511
8511
  function _Player(config) {
8512
8512
  var _this = this;
@@ -8528,7 +8528,8 @@ var Player = function() {
8528
8528
  state: new SyncHook(),
8529
8529
  onStart: new SyncHook(),
8530
8530
  onEnd: new SyncHook(),
8531
- resolveFlowContent: new SyncWaterfallHook()
8531
+ resolveFlowContent: new SyncWaterfallHook(),
8532
+ transformContent: new SyncBailHook()
8532
8533
  };
8533
8534
  if (config === null || config === void 0 ? void 0 : config.logger) {
8534
8535
  this.logger.addHandler(config.logger);
@@ -8542,6 +8543,9 @@ var Player = function() {
8542
8543
  (_this_config_plugins = this.config.plugins) === null || _this_config_plugins === void 0 ? void 0 : _this_config_plugins.forEach(function(plugin) {
8543
8544
  plugin.apply(_this);
8544
8545
  });
8546
+ this.hooks.transformContent.tap("player", function(payload, meta) {
8547
+ return meta.format === "player" ? payload : void 0;
8548
+ });
8545
8549
  }
8546
8550
  _create_class(_Player, [
8547
8551
  {
@@ -8848,14 +8852,22 @@ var Player = function() {
8848
8852
  },
8849
8853
  {
8850
8854
  key: "start",
8851
- value: function start(payload) {
8855
+ value: function start(payload, options) {
8852
8856
  return _async_to_generator(function() {
8853
- var _this, _payload_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
8857
+ var _this, _options_format, meta, flow, _flow_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
8854
8858
  return _ts_generator(this, function(_state) {
8855
8859
  switch(_state.label){
8856
8860
  case 0:
8857
8861
  _this = this;
8858
- ref = Symbol((_payload_id = payload === null || payload === void 0 ? void 0 : payload.id) !== null && _payload_id !== void 0 ? _payload_id : "payload");
8862
+ meta = {
8863
+ format: (_options_format = options === null || options === void 0 ? void 0 : options.format) !== null && _options_format !== void 0 ? _options_format : "player",
8864
+ version: options === null || options === void 0 ? void 0 : options.version
8865
+ };
8866
+ flow = this.hooks.transformContent.call(payload, meta);
8867
+ if (!flow) {
8868
+ throw new Error('Player.start received content with format "'.concat(meta.format, '" that no plugin transformed into a Flow.'));
8869
+ }
8870
+ ref = Symbol((_flow_id = flow.id) !== null && _flow_id !== void 0 ? _flow_id : "payload");
8859
8871
  maybeUpdateState = function(newState) {
8860
8872
  if (_this.state.ref !== ref) {
8861
8873
  _this.logger.warn("Received update for a flow that's not the current one");
@@ -8876,7 +8888,7 @@ var Player = function() {
8876
8888
  ,
8877
8889
  4
8878
8890
  ]);
8879
- _this_setupFlow = this.setupFlow(payload), state = _this_setupFlow.state, start = _this_setupFlow.start;
8891
+ _this_setupFlow = this.setupFlow(flow), state = _this_setupFlow.state, start = _this_setupFlow.start;
8880
8892
  this.setState(_object_spread({
8881
8893
  ref: ref
8882
8894
  }, state));
@@ -8911,7 +8923,7 @@ var Player = function() {
8911
8923
  errorState = {
8912
8924
  status: "error",
8913
8925
  ref: ref,
8914
- flow: payload,
8926
+ flow: flow,
8915
8927
  error: error
8916
8928
  };
8917
8929
  maybeUpdateState(errorState);