@player-ui/reference-assets-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.
@@ -8391,8 +8391,8 @@ var ReferenceAssetsPlugin = function() {
8391
8391
  ref: Symbol("not-started"),
8392
8392
  status: "not-started"
8393
8393
  };
8394
- var PLAYER_VERSION = true ? "1.1.0-next.2" : "unknown";
8395
- var COMMIT = true ? "233ef9fa2145aa08b23ffbb50bb105689adf830f" : "unknown";
8394
+ var PLAYER_VERSION = true ? "1.1.0-next.4" : "unknown";
8395
+ var COMMIT = true ? "c00a0bc3257d918e21b7244a770ae462017f0fae" : "unknown";
8396
8396
  var _Player = /*#__PURE__*/ function() {
8397
8397
  function _Player2(config) {
8398
8398
  var _this = this;
@@ -8414,7 +8414,8 @@ var ReferenceAssetsPlugin = function() {
8414
8414
  state: new SyncHook(),
8415
8415
  onStart: new SyncHook(),
8416
8416
  onEnd: new SyncHook(),
8417
- resolveFlowContent: new SyncWaterfallHook()
8417
+ resolveFlowContent: new SyncWaterfallHook(),
8418
+ transformContent: new SyncBailHook()
8418
8419
  };
8419
8420
  if (config === null || config === void 0 ? void 0 : config.logger) {
8420
8421
  this.logger.addHandler(config.logger);
@@ -8428,6 +8429,9 @@ var ReferenceAssetsPlugin = function() {
8428
8429
  (_this_config_plugins = this.config.plugins) === null || _this_config_plugins === void 0 ? void 0 : _this_config_plugins.forEach(function(plugin) {
8429
8430
  plugin.apply(_this);
8430
8431
  });
8432
+ this.hooks.transformContent.tap("player", function(payload, meta) {
8433
+ return meta.format === "player" ? payload : void 0;
8434
+ });
8431
8435
  }
8432
8436
  _create_class(_Player2, [
8433
8437
  {
@@ -8734,14 +8738,22 @@ var ReferenceAssetsPlugin = function() {
8734
8738
  },
8735
8739
  {
8736
8740
  key: "start",
8737
- value: function start(payload) {
8741
+ value: function start(payload, options) {
8738
8742
  return _async_to_generator(function() {
8739
- var _this, _payload_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
8743
+ var _this, _options_format, meta, flow, _flow_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
8740
8744
  return _ts_generator(this, function(_state) {
8741
8745
  switch(_state.label){
8742
8746
  case 0:
8743
8747
  _this = this;
8744
- ref = Symbol((_payload_id = payload === null || payload === void 0 ? void 0 : payload.id) !== null && _payload_id !== void 0 ? _payload_id : "payload");
8748
+ meta = {
8749
+ format: (_options_format = options === null || options === void 0 ? void 0 : options.format) !== null && _options_format !== void 0 ? _options_format : "player",
8750
+ version: options === null || options === void 0 ? void 0 : options.version
8751
+ };
8752
+ flow = this.hooks.transformContent.call(payload, meta);
8753
+ if (!flow) {
8754
+ throw new Error('Player.start received content with format "'.concat(meta.format, '" that no plugin transformed into a Flow.'));
8755
+ }
8756
+ ref = Symbol((_flow_id = flow.id) !== null && _flow_id !== void 0 ? _flow_id : "payload");
8745
8757
  maybeUpdateState = function(newState) {
8746
8758
  if (_this.state.ref !== ref) {
8747
8759
  _this.logger.warn("Received update for a flow that's not the current one");
@@ -8762,7 +8774,7 @@ var ReferenceAssetsPlugin = function() {
8762
8774
  ,
8763
8775
  4
8764
8776
  ]);
8765
- _this_setupFlow = this.setupFlow(payload), state = _this_setupFlow.state, start = _this_setupFlow.start;
8777
+ _this_setupFlow = this.setupFlow(flow), state = _this_setupFlow.state, start = _this_setupFlow.start;
8766
8778
  this.setState(_object_spread({
8767
8779
  ref: ref
8768
8780
  }, state));
@@ -8797,7 +8809,7 @@ var ReferenceAssetsPlugin = function() {
8797
8809
  errorState = {
8798
8810
  status: "error",
8799
8811
  ref: ref,
8800
- flow: payload,
8812
+ flow: flow,
8801
8813
  error: error
8802
8814
  };
8803
8815
  maybeUpdateState(errorState);