@player-ui/external-state-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.
|
@@ -7850,8 +7850,8 @@ var ExternalStatePlugin = function() {
|
|
|
7850
7850
|
ref: Symbol("not-started"),
|
|
7851
7851
|
status: "not-started"
|
|
7852
7852
|
};
|
|
7853
|
-
var PLAYER_VERSION = true ? "1.1.0-next.
|
|
7854
|
-
var COMMIT = true ? "
|
|
7853
|
+
var PLAYER_VERSION = true ? "1.1.0-next.3" : "unknown";
|
|
7854
|
+
var COMMIT = true ? "234b74972b29ff0fa11655411dc3cd9d8a98de2a" : "unknown";
|
|
7855
7855
|
var _Player = /*#__PURE__*/ function() {
|
|
7856
7856
|
function _Player2(config) {
|
|
7857
7857
|
var _this = this;
|
|
@@ -7873,7 +7873,8 @@ var ExternalStatePlugin = function() {
|
|
|
7873
7873
|
state: new SyncHook(),
|
|
7874
7874
|
onStart: new SyncHook(),
|
|
7875
7875
|
onEnd: new SyncHook(),
|
|
7876
|
-
resolveFlowContent: new SyncWaterfallHook()
|
|
7876
|
+
resolveFlowContent: new SyncWaterfallHook(),
|
|
7877
|
+
transformContent: new SyncBailHook()
|
|
7877
7878
|
};
|
|
7878
7879
|
if (config === null || config === void 0 ? void 0 : config.logger) {
|
|
7879
7880
|
this.logger.addHandler(config.logger);
|
|
@@ -7887,6 +7888,9 @@ var ExternalStatePlugin = function() {
|
|
|
7887
7888
|
(_this_config_plugins = this.config.plugins) === null || _this_config_plugins === void 0 ? void 0 : _this_config_plugins.forEach(function(plugin) {
|
|
7888
7889
|
plugin.apply(_this);
|
|
7889
7890
|
});
|
|
7891
|
+
this.hooks.transformContent.tap("player", function(payload, meta) {
|
|
7892
|
+
return meta.format === "player" ? payload : void 0;
|
|
7893
|
+
});
|
|
7890
7894
|
}
|
|
7891
7895
|
_create_class(_Player2, [
|
|
7892
7896
|
{
|
|
@@ -8193,14 +8197,22 @@ var ExternalStatePlugin = function() {
|
|
|
8193
8197
|
},
|
|
8194
8198
|
{
|
|
8195
8199
|
key: "start",
|
|
8196
|
-
value: function start(payload) {
|
|
8200
|
+
value: function start(payload, options) {
|
|
8197
8201
|
return _async_to_generator(function() {
|
|
8198
|
-
var _this,
|
|
8202
|
+
var _this, _options_format, meta, flow, _flow_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
|
|
8199
8203
|
return _ts_generator(this, function(_state) {
|
|
8200
8204
|
switch(_state.label){
|
|
8201
8205
|
case 0:
|
|
8202
8206
|
_this = this;
|
|
8203
|
-
|
|
8207
|
+
meta = {
|
|
8208
|
+
format: (_options_format = options === null || options === void 0 ? void 0 : options.format) !== null && _options_format !== void 0 ? _options_format : "player",
|
|
8209
|
+
version: options === null || options === void 0 ? void 0 : options.version
|
|
8210
|
+
};
|
|
8211
|
+
flow = this.hooks.transformContent.call(payload, meta);
|
|
8212
|
+
if (!flow) {
|
|
8213
|
+
throw new Error('Player.start received content with format "'.concat(meta.format, '" that no plugin transformed into a Flow.'));
|
|
8214
|
+
}
|
|
8215
|
+
ref = Symbol((_flow_id = flow.id) !== null && _flow_id !== void 0 ? _flow_id : "payload");
|
|
8204
8216
|
maybeUpdateState = function(newState) {
|
|
8205
8217
|
if (_this.state.ref !== ref) {
|
|
8206
8218
|
_this.logger.warn("Received update for a flow that's not the current one");
|
|
@@ -8221,7 +8233,7 @@ var ExternalStatePlugin = function() {
|
|
|
8221
8233
|
,
|
|
8222
8234
|
4
|
|
8223
8235
|
]);
|
|
8224
|
-
_this_setupFlow = this.setupFlow(
|
|
8236
|
+
_this_setupFlow = this.setupFlow(flow), state = _this_setupFlow.state, start = _this_setupFlow.start;
|
|
8225
8237
|
this.setState(_object_spread({
|
|
8226
8238
|
ref: ref
|
|
8227
8239
|
}, state));
|
|
@@ -8256,7 +8268,7 @@ var ExternalStatePlugin = function() {
|
|
|
8256
8268
|
errorState = {
|
|
8257
8269
|
status: "error",
|
|
8258
8270
|
ref: ref,
|
|
8259
|
-
flow:
|
|
8271
|
+
flow: flow,
|
|
8260
8272
|
error: error
|
|
8261
8273
|
};
|
|
8262
8274
|
maybeUpdateState(errorState);
|