@player-ui/async-node-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.
|
@@ -8072,8 +8072,8 @@ var AsyncNodePlugin = function() {
|
|
|
8072
8072
|
ref: Symbol("not-started"),
|
|
8073
8073
|
status: "not-started"
|
|
8074
8074
|
};
|
|
8075
|
-
var PLAYER_VERSION = true ? "1.1.0-next.
|
|
8076
|
-
var COMMIT = true ? "
|
|
8075
|
+
var PLAYER_VERSION = true ? "1.1.0-next.4" : "unknown";
|
|
8076
|
+
var COMMIT = true ? "c00a0bc3257d918e21b7244a770ae462017f0fae" : "unknown";
|
|
8077
8077
|
var _Player = /*#__PURE__*/ function() {
|
|
8078
8078
|
function _Player2(config) {
|
|
8079
8079
|
var _this = this;
|
|
@@ -8095,7 +8095,8 @@ var AsyncNodePlugin = function() {
|
|
|
8095
8095
|
state: new SyncHook(),
|
|
8096
8096
|
onStart: new SyncHook(),
|
|
8097
8097
|
onEnd: new SyncHook(),
|
|
8098
|
-
resolveFlowContent: new SyncWaterfallHook()
|
|
8098
|
+
resolveFlowContent: new SyncWaterfallHook(),
|
|
8099
|
+
transformContent: new SyncBailHook()
|
|
8099
8100
|
};
|
|
8100
8101
|
if (config === null || config === void 0 ? void 0 : config.logger) {
|
|
8101
8102
|
this.logger.addHandler(config.logger);
|
|
@@ -8109,6 +8110,9 @@ var AsyncNodePlugin = function() {
|
|
|
8109
8110
|
(_this_config_plugins = this.config.plugins) === null || _this_config_plugins === void 0 ? void 0 : _this_config_plugins.forEach(function(plugin) {
|
|
8110
8111
|
plugin.apply(_this);
|
|
8111
8112
|
});
|
|
8113
|
+
this.hooks.transformContent.tap("player", function(payload, meta) {
|
|
8114
|
+
return meta.format === "player" ? payload : void 0;
|
|
8115
|
+
});
|
|
8112
8116
|
}
|
|
8113
8117
|
_create_class(_Player2, [
|
|
8114
8118
|
{
|
|
@@ -8415,14 +8419,22 @@ var AsyncNodePlugin = function() {
|
|
|
8415
8419
|
},
|
|
8416
8420
|
{
|
|
8417
8421
|
key: "start",
|
|
8418
|
-
value: function start(payload) {
|
|
8422
|
+
value: function start(payload, options) {
|
|
8419
8423
|
return _async_to_generator(function() {
|
|
8420
|
-
var _this,
|
|
8424
|
+
var _this, _options_format, meta, flow, _flow_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
|
|
8421
8425
|
return _ts_generator(this, function(_state) {
|
|
8422
8426
|
switch(_state.label){
|
|
8423
8427
|
case 0:
|
|
8424
8428
|
_this = this;
|
|
8425
|
-
|
|
8429
|
+
meta = {
|
|
8430
|
+
format: (_options_format = options === null || options === void 0 ? void 0 : options.format) !== null && _options_format !== void 0 ? _options_format : "player",
|
|
8431
|
+
version: options === null || options === void 0 ? void 0 : options.version
|
|
8432
|
+
};
|
|
8433
|
+
flow = this.hooks.transformContent.call(payload, meta);
|
|
8434
|
+
if (!flow) {
|
|
8435
|
+
throw new Error('Player.start received content with format "'.concat(meta.format, '" that no plugin transformed into a Flow.'));
|
|
8436
|
+
}
|
|
8437
|
+
ref = Symbol((_flow_id = flow.id) !== null && _flow_id !== void 0 ? _flow_id : "payload");
|
|
8426
8438
|
maybeUpdateState = function(newState) {
|
|
8427
8439
|
if (_this.state.ref !== ref) {
|
|
8428
8440
|
_this.logger.warn("Received update for a flow that's not the current one");
|
|
@@ -8443,7 +8455,7 @@ var AsyncNodePlugin = function() {
|
|
|
8443
8455
|
,
|
|
8444
8456
|
4
|
|
8445
8457
|
]);
|
|
8446
|
-
_this_setupFlow = this.setupFlow(
|
|
8458
|
+
_this_setupFlow = this.setupFlow(flow), state = _this_setupFlow.state, start = _this_setupFlow.start;
|
|
8447
8459
|
this.setState(_object_spread({
|
|
8448
8460
|
ref: ref
|
|
8449
8461
|
}, state));
|
|
@@ -8478,7 +8490,7 @@ var AsyncNodePlugin = function() {
|
|
|
8478
8490
|
errorState = {
|
|
8479
8491
|
status: "error",
|
|
8480
8492
|
ref: ref,
|
|
8481
|
-
flow:
|
|
8493
|
+
flow: flow,
|
|
8482
8494
|
error: error
|
|
8483
8495
|
};
|
|
8484
8496
|
maybeUpdateState(errorState);
|