@player-ui/beacon-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.
|
@@ -7922,8 +7922,8 @@ var BeaconPlugin = function() {
|
|
|
7922
7922
|
ref: Symbol("not-started"),
|
|
7923
7923
|
status: "not-started"
|
|
7924
7924
|
};
|
|
7925
|
-
var PLAYER_VERSION = true ? "1.1.0-next.
|
|
7926
|
-
var COMMIT = true ? "
|
|
7925
|
+
var PLAYER_VERSION = true ? "1.1.0-next.3" : "unknown";
|
|
7926
|
+
var COMMIT = true ? "234b74972b29ff0fa11655411dc3cd9d8a98de2a" : "unknown";
|
|
7927
7927
|
var _Player = /*#__PURE__*/ function() {
|
|
7928
7928
|
function _Player2(config) {
|
|
7929
7929
|
var _this = this;
|
|
@@ -7945,7 +7945,8 @@ var BeaconPlugin = function() {
|
|
|
7945
7945
|
state: new SyncHook(),
|
|
7946
7946
|
onStart: new SyncHook(),
|
|
7947
7947
|
onEnd: new SyncHook(),
|
|
7948
|
-
resolveFlowContent: new SyncWaterfallHook()
|
|
7948
|
+
resolveFlowContent: new SyncWaterfallHook(),
|
|
7949
|
+
transformContent: new SyncBailHook()
|
|
7949
7950
|
};
|
|
7950
7951
|
if (config === null || config === void 0 ? void 0 : config.logger) {
|
|
7951
7952
|
this.logger.addHandler(config.logger);
|
|
@@ -7959,6 +7960,9 @@ var BeaconPlugin = function() {
|
|
|
7959
7960
|
(_this_config_plugins = this.config.plugins) === null || _this_config_plugins === void 0 ? void 0 : _this_config_plugins.forEach(function(plugin) {
|
|
7960
7961
|
plugin.apply(_this);
|
|
7961
7962
|
});
|
|
7963
|
+
this.hooks.transformContent.tap("player", function(payload, meta) {
|
|
7964
|
+
return meta.format === "player" ? payload : void 0;
|
|
7965
|
+
});
|
|
7962
7966
|
}
|
|
7963
7967
|
_create_class(_Player2, [
|
|
7964
7968
|
{
|
|
@@ -8265,14 +8269,22 @@ var BeaconPlugin = function() {
|
|
|
8265
8269
|
},
|
|
8266
8270
|
{
|
|
8267
8271
|
key: "start",
|
|
8268
|
-
value: function start(payload) {
|
|
8272
|
+
value: function start(payload, options) {
|
|
8269
8273
|
return _async_to_generator(function() {
|
|
8270
|
-
var _this,
|
|
8274
|
+
var _this, _options_format, meta, flow, _flow_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
|
|
8271
8275
|
return _ts_generator(this, function(_state) {
|
|
8272
8276
|
switch(_state.label){
|
|
8273
8277
|
case 0:
|
|
8274
8278
|
_this = this;
|
|
8275
|
-
|
|
8279
|
+
meta = {
|
|
8280
|
+
format: (_options_format = options === null || options === void 0 ? void 0 : options.format) !== null && _options_format !== void 0 ? _options_format : "player",
|
|
8281
|
+
version: options === null || options === void 0 ? void 0 : options.version
|
|
8282
|
+
};
|
|
8283
|
+
flow = this.hooks.transformContent.call(payload, meta);
|
|
8284
|
+
if (!flow) {
|
|
8285
|
+
throw new Error('Player.start received content with format "'.concat(meta.format, '" that no plugin transformed into a Flow.'));
|
|
8286
|
+
}
|
|
8287
|
+
ref = Symbol((_flow_id = flow.id) !== null && _flow_id !== void 0 ? _flow_id : "payload");
|
|
8276
8288
|
maybeUpdateState = function(newState) {
|
|
8277
8289
|
if (_this.state.ref !== ref) {
|
|
8278
8290
|
_this.logger.warn("Received update for a flow that's not the current one");
|
|
@@ -8293,7 +8305,7 @@ var BeaconPlugin = function() {
|
|
|
8293
8305
|
,
|
|
8294
8306
|
4
|
|
8295
8307
|
]);
|
|
8296
|
-
_this_setupFlow = this.setupFlow(
|
|
8308
|
+
_this_setupFlow = this.setupFlow(flow), state = _this_setupFlow.state, start = _this_setupFlow.start;
|
|
8297
8309
|
this.setState(_object_spread({
|
|
8298
8310
|
ref: ref
|
|
8299
8311
|
}, state));
|
|
@@ -8328,7 +8340,7 @@ var BeaconPlugin = function() {
|
|
|
8328
8340
|
errorState = {
|
|
8329
8341
|
status: "error",
|
|
8330
8342
|
ref: ref,
|
|
8331
|
-
flow:
|
|
8343
|
+
flow: flow,
|
|
8332
8344
|
error: error
|
|
8333
8345
|
};
|
|
8334
8346
|
maybeUpdateState(errorState);
|