@player-ui/external-state-plugin 1.0.2--canary.900.39222 → 1.0.2--canary.900.39588
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.
|
@@ -4593,6 +4593,12 @@ var ExternalStatePlugin = function() {
|
|
|
4593
4593
|
this.shadowModelPaths = removeBindingAndChildrenFromMap(this.shadowModelPaths, binding);
|
|
4594
4594
|
return next === null || next === void 0 ? void 0 : next.delete(binding, options);
|
|
4595
4595
|
}
|
|
4596
|
+
},
|
|
4597
|
+
{
|
|
4598
|
+
/** Clears any invalid values staged in the shadow model */ key: "reset",
|
|
4599
|
+
value: function reset() {
|
|
4600
|
+
this.shadowModelPaths.clear();
|
|
4601
|
+
}
|
|
4596
4602
|
}
|
|
4597
4603
|
]);
|
|
4598
4604
|
return ValidationMiddleware;
|
|
@@ -5446,6 +5452,47 @@ var ExternalStatePlugin = function() {
|
|
|
5446
5452
|
/** Return the middleware for the data-model to stop propagation of invalid data */ key: "getDataMiddleware",
|
|
5447
5453
|
value: function getDataMiddleware() {
|
|
5448
5454
|
var _this = this;
|
|
5455
|
+
var validationMiddleware = new ValidationMiddleware(function(binding) {
|
|
5456
|
+
var _strongValidation_get;
|
|
5457
|
+
if (!_this.options) {
|
|
5458
|
+
return;
|
|
5459
|
+
}
|
|
5460
|
+
_this.updateValidationsForBinding(binding, "change", _this.options);
|
|
5461
|
+
var strongValidation = _this.getValidationForBinding(binding);
|
|
5462
|
+
if ((strongValidation === null || strongValidation === void 0 ? void 0 : (_strongValidation_get = strongValidation.get()) === null || _strongValidation_get === void 0 ? void 0 : _strongValidation_get.severity) === "error") {
|
|
5463
|
+
return strongValidation.get();
|
|
5464
|
+
}
|
|
5465
|
+
var newInvalidBindings = /* @__PURE__ */ new Set();
|
|
5466
|
+
_this.validations.forEach(function(weakValidation, strongBinding) {
|
|
5467
|
+
var _weakValidation_get;
|
|
5468
|
+
if (caresAboutDataChanges(/* @__PURE__ */ new Set([
|
|
5469
|
+
binding
|
|
5470
|
+
]), weakValidation.weakBindings) && (weakValidation === null || weakValidation === void 0 ? void 0 : (_weakValidation_get = weakValidation.get()) === null || _weakValidation_get === void 0 ? void 0 : _weakValidation_get.severity) === "error") {
|
|
5471
|
+
weakValidation === null || weakValidation === void 0 ? void 0 : weakValidation.weakBindings.forEach(function(weakBinding) {
|
|
5472
|
+
if (weakBinding === strongBinding) {
|
|
5473
|
+
newInvalidBindings.add({
|
|
5474
|
+
binding: weakBinding,
|
|
5475
|
+
isStrong: true
|
|
5476
|
+
});
|
|
5477
|
+
} else {
|
|
5478
|
+
newInvalidBindings.add({
|
|
5479
|
+
binding: weakBinding,
|
|
5480
|
+
isStrong: false
|
|
5481
|
+
});
|
|
5482
|
+
}
|
|
5483
|
+
});
|
|
5484
|
+
}
|
|
5485
|
+
});
|
|
5486
|
+
if (newInvalidBindings.size > 0) {
|
|
5487
|
+
return newInvalidBindings;
|
|
5488
|
+
}
|
|
5489
|
+
}, {
|
|
5490
|
+
logger: new ProxyLogger(function() {
|
|
5491
|
+
var _this_options;
|
|
5492
|
+
return (_this_options = _this.options) === null || _this_options === void 0 ? void 0 : _this_options.logger;
|
|
5493
|
+
})
|
|
5494
|
+
});
|
|
5495
|
+
this.validationMiddleware = validationMiddleware;
|
|
5449
5496
|
return [
|
|
5450
5497
|
{
|
|
5451
5498
|
set: function(transaction, options, next) {
|
|
@@ -5460,46 +5507,7 @@ var ExternalStatePlugin = function() {
|
|
|
5460
5507
|
return next === null || next === void 0 ? void 0 : next.delete(binding, options);
|
|
5461
5508
|
}
|
|
5462
5509
|
},
|
|
5463
|
-
|
|
5464
|
-
var _strongValidation_get;
|
|
5465
|
-
if (!_this.options) {
|
|
5466
|
-
return;
|
|
5467
|
-
}
|
|
5468
|
-
_this.updateValidationsForBinding(binding, "change", _this.options);
|
|
5469
|
-
var strongValidation = _this.getValidationForBinding(binding);
|
|
5470
|
-
if ((strongValidation === null || strongValidation === void 0 ? void 0 : (_strongValidation_get = strongValidation.get()) === null || _strongValidation_get === void 0 ? void 0 : _strongValidation_get.severity) === "error") {
|
|
5471
|
-
return strongValidation.get();
|
|
5472
|
-
}
|
|
5473
|
-
var newInvalidBindings = /* @__PURE__ */ new Set();
|
|
5474
|
-
_this.validations.forEach(function(weakValidation, strongBinding) {
|
|
5475
|
-
var _weakValidation_get;
|
|
5476
|
-
if (caresAboutDataChanges(/* @__PURE__ */ new Set([
|
|
5477
|
-
binding
|
|
5478
|
-
]), weakValidation.weakBindings) && (weakValidation === null || weakValidation === void 0 ? void 0 : (_weakValidation_get = weakValidation.get()) === null || _weakValidation_get === void 0 ? void 0 : _weakValidation_get.severity) === "error") {
|
|
5479
|
-
weakValidation === null || weakValidation === void 0 ? void 0 : weakValidation.weakBindings.forEach(function(weakBinding) {
|
|
5480
|
-
if (weakBinding === strongBinding) {
|
|
5481
|
-
newInvalidBindings.add({
|
|
5482
|
-
binding: weakBinding,
|
|
5483
|
-
isStrong: true
|
|
5484
|
-
});
|
|
5485
|
-
} else {
|
|
5486
|
-
newInvalidBindings.add({
|
|
5487
|
-
binding: weakBinding,
|
|
5488
|
-
isStrong: false
|
|
5489
|
-
});
|
|
5490
|
-
}
|
|
5491
|
-
});
|
|
5492
|
-
}
|
|
5493
|
-
});
|
|
5494
|
-
if (newInvalidBindings.size > 0) {
|
|
5495
|
-
return newInvalidBindings;
|
|
5496
|
-
}
|
|
5497
|
-
}, {
|
|
5498
|
-
logger: new ProxyLogger(function() {
|
|
5499
|
-
var _this_options;
|
|
5500
|
-
return (_this_options = _this.options) === null || _this_options === void 0 ? void 0 : _this_options.logger;
|
|
5501
|
-
})
|
|
5502
|
-
})
|
|
5510
|
+
validationMiddleware
|
|
5503
5511
|
];
|
|
5504
5512
|
}
|
|
5505
5513
|
},
|
|
@@ -5535,15 +5543,17 @@ var ExternalStatePlugin = function() {
|
|
|
5535
5543
|
{
|
|
5536
5544
|
key: "reset",
|
|
5537
5545
|
value: function reset() {
|
|
5546
|
+
var _this_validationMiddleware;
|
|
5538
5547
|
this.validations.clear();
|
|
5539
5548
|
this.tracker = void 0;
|
|
5549
|
+
(_this_validationMiddleware = this.validationMiddleware) === null || _this_validationMiddleware === void 0 ? void 0 : _this_validationMiddleware.reset();
|
|
5540
5550
|
}
|
|
5541
5551
|
},
|
|
5542
5552
|
{
|
|
5543
5553
|
key: "onView",
|
|
5544
5554
|
value: function onView(view) {
|
|
5545
5555
|
var _this = this;
|
|
5546
|
-
this.
|
|
5556
|
+
this.reset();
|
|
5547
5557
|
if (!this.options) {
|
|
5548
5558
|
return;
|
|
5549
5559
|
}
|
|
@@ -7840,8 +7850,8 @@ var ExternalStatePlugin = function() {
|
|
|
7840
7850
|
ref: Symbol("not-started"),
|
|
7841
7851
|
status: "not-started"
|
|
7842
7852
|
};
|
|
7843
|
-
var PLAYER_VERSION = true ? "1.0.2--canary.900.
|
|
7844
|
-
var COMMIT = true ? "
|
|
7853
|
+
var PLAYER_VERSION = true ? "1.0.2--canary.900.39588" : "unknown";
|
|
7854
|
+
var COMMIT = true ? "89cc9313afbc3814bdb0eb4cd578bf07ef07ff92" : "unknown";
|
|
7845
7855
|
var _Player = /*#__PURE__*/ function() {
|
|
7846
7856
|
function _Player2(config) {
|
|
7847
7857
|
var _this = this;
|
|
@@ -7863,7 +7873,8 @@ var ExternalStatePlugin = function() {
|
|
|
7863
7873
|
state: new SyncHook(),
|
|
7864
7874
|
onStart: new SyncHook(),
|
|
7865
7875
|
onEnd: new SyncHook(),
|
|
7866
|
-
resolveFlowContent: new SyncWaterfallHook()
|
|
7876
|
+
resolveFlowContent: new SyncWaterfallHook(),
|
|
7877
|
+
transformContent: new SyncBailHook()
|
|
7867
7878
|
};
|
|
7868
7879
|
if (config === null || config === void 0 ? void 0 : config.logger) {
|
|
7869
7880
|
this.logger.addHandler(config.logger);
|
|
@@ -7877,6 +7888,9 @@ var ExternalStatePlugin = function() {
|
|
|
7877
7888
|
(_this_config_plugins = this.config.plugins) === null || _this_config_plugins === void 0 ? void 0 : _this_config_plugins.forEach(function(plugin) {
|
|
7878
7889
|
plugin.apply(_this);
|
|
7879
7890
|
});
|
|
7891
|
+
this.hooks.transformContent.tap("player", function(payload, meta) {
|
|
7892
|
+
return meta.format === "player" ? payload : void 0;
|
|
7893
|
+
});
|
|
7880
7894
|
}
|
|
7881
7895
|
_create_class(_Player2, [
|
|
7882
7896
|
{
|
|
@@ -8183,14 +8197,22 @@ var ExternalStatePlugin = function() {
|
|
|
8183
8197
|
},
|
|
8184
8198
|
{
|
|
8185
8199
|
key: "start",
|
|
8186
|
-
value: function start(payload) {
|
|
8200
|
+
value: function start(payload, options) {
|
|
8187
8201
|
return _async_to_generator(function() {
|
|
8188
|
-
var _this,
|
|
8202
|
+
var _this, _options_format, meta, flow, _flow_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
|
|
8189
8203
|
return _ts_generator(this, function(_state) {
|
|
8190
8204
|
switch(_state.label){
|
|
8191
8205
|
case 0:
|
|
8192
8206
|
_this = this;
|
|
8193
|
-
|
|
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");
|
|
8194
8216
|
maybeUpdateState = function(newState) {
|
|
8195
8217
|
if (_this.state.ref !== ref) {
|
|
8196
8218
|
_this.logger.warn("Received update for a flow that's not the current one");
|
|
@@ -8211,7 +8233,7 @@ var ExternalStatePlugin = function() {
|
|
|
8211
8233
|
,
|
|
8212
8234
|
4
|
|
8213
8235
|
]);
|
|
8214
|
-
_this_setupFlow = this.setupFlow(
|
|
8236
|
+
_this_setupFlow = this.setupFlow(flow), state = _this_setupFlow.state, start = _this_setupFlow.start;
|
|
8215
8237
|
this.setState(_object_spread({
|
|
8216
8238
|
ref: ref
|
|
8217
8239
|
}, state));
|
|
@@ -8246,7 +8268,7 @@ var ExternalStatePlugin = function() {
|
|
|
8246
8268
|
errorState = {
|
|
8247
8269
|
status: "error",
|
|
8248
8270
|
ref: ref,
|
|
8249
|
-
flow:
|
|
8271
|
+
flow: flow,
|
|
8250
8272
|
error: error
|
|
8251
8273
|
};
|
|
8252
8274
|
maybeUpdateState(errorState);
|