@player-ui/beacon-plugin 0.14.0-next.0 → 0.14.0-next.2

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.
@@ -45,6 +45,10 @@ function _async_to_generator(fn) {
45
45
  });
46
46
  };
47
47
  }
48
+ function _call_super(_this, derived, args) {
49
+ derived = _get_prototype_of(derived);
50
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
51
+ }
48
52
  function _class_call_check(instance, Constructor) {
49
53
  if (!(instance instanceof Constructor)) {
50
54
  throw new TypeError("Cannot call a class as a function");
@@ -283,31 +287,15 @@ function _wrap_native_super(Class) {
283
287
  return _wrap_native_super(Class);
284
288
  }
285
289
  function _is_native_reflect_construct() {
286
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
287
- if (Reflect.construct.sham) return false;
288
- if (typeof Proxy === "function") return true;
289
290
  try {
290
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
291
- return true;
292
- } catch (e) {
293
- return false;
294
- }
295
- }
296
- function _create_super(Derived) {
297
- var hasNativeReflectConstruct = _is_native_reflect_construct();
298
- return function _createSuperInternal() {
299
- var Super = _get_prototype_of(Derived), result;
300
- if (hasNativeReflectConstruct) {
301
- var NewTarget = _get_prototype_of(this).constructor;
302
- result = Reflect.construct(Super, arguments, NewTarget);
303
- } else {
304
- result = Super.apply(this, arguments);
305
- }
306
- return _possible_constructor_return(this, result);
307
- };
291
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
292
+ } catch (_) {}
293
+ return (_is_native_reflect_construct = function() {
294
+ return !!result;
295
+ })();
308
296
  }
309
297
  function _ts_generator(thisArg, body) {
310
- var f, y, t, g, _ = {
298
+ var f, y, t, _ = {
311
299
  label: 0,
312
300
  sent: function() {
313
301
  if (t[0] & 1) throw t[1];
@@ -315,12 +303,8 @@ function _ts_generator(thisArg, body) {
315
303
  },
316
304
  trys: [],
317
305
  ops: []
318
- };
319
- return g = {
320
- next: verb(0),
321
- "throw": verb(1),
322
- "return": verb(2)
323
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
306
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
307
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
324
308
  return this;
325
309
  }), g;
326
310
  function verb(n) {
@@ -333,7 +317,7 @@ function _ts_generator(thisArg, body) {
333
317
  }
334
318
  function step(op) {
335
319
  if (f) throw new TypeError("Generator is already executing.");
336
- while(_)try {
320
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
337
321
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
338
322
  if (y = 0, t) op = [
339
323
  op[0] & 2,
@@ -505,7 +489,7 @@ var BeaconPlugin = function() {
505
489
  };
506
490
  var findInArray = function findInArray(array, key, value) {
507
491
  return array.findIndex(function(obj) {
508
- if (obj && typeof obj === "object") {
492
+ if (obj && (typeof obj === "undefined" ? "undefined" : _type_of(obj)) === "object") {
509
493
  return obj[key] == value;
510
494
  }
511
495
  return false;
@@ -599,7 +583,7 @@ var BeaconPlugin = function() {
599
583
  };
600
584
  };
601
585
  var isExpressionNode = function isExpressionNode(x) {
602
- return typeof x === "object" && x !== null && !Array.isArray(x) && x.__id === ExpNodeOpaqueIdentifier;
586
+ return (typeof x === "undefined" ? "undefined" : _type_of(x)) === "object" && x !== null && !Array.isArray(x) && x.__id === ExpNodeOpaqueIdentifier;
603
587
  };
604
588
  var throwError = function throwError(message, index) {
605
589
  var err = new Error("".concat(message, " at character ").concat(index));
@@ -1187,7 +1171,7 @@ var BeaconPlugin = function() {
1187
1171
  var isPromiseLike = function isPromiseLike(value) {
1188
1172
  var // Check for standard Promise constructor name
1189
1173
  _value_constructor;
1190
- return value != null && typeof value === "object" && typeof value.then === "function" && // Additional safeguards against false positives
1174
+ return value != null && (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && typeof value.then === "function" && // Additional safeguards against false positives
1191
1175
  (_instanceof(value, Promise) || ((_value_constructor = value.constructor) === null || _value_constructor === void 0 ? void 0 : _value_constructor.name) === "Promise" || // Verify it has other Promise-like methods to reduce false positives
1192
1176
  typeof value.catch === "function" && typeof value.finally === "function");
1193
1177
  };
@@ -1202,7 +1186,7 @@ var BeaconPlugin = function() {
1202
1186
  if (isExpressionNode(expr)) {
1203
1187
  return false;
1204
1188
  }
1205
- return typeof expr === "object" && expr !== null && !Array.isArray(expr) && "value" in expr;
1189
+ return (typeof expr === "undefined" ? "undefined" : _type_of(expr)) === "object" && expr !== null && !Array.isArray(expr) && "value" in expr;
1206
1190
  };
1207
1191
  var makePromiseAwareBinaryOp = function makePromiseAwareBinaryOp(operation) {
1208
1192
  return function(a, b, async) {
@@ -1419,7 +1403,7 @@ var BeaconPlugin = function() {
1419
1403
  if (!node) {
1420
1404
  return;
1421
1405
  }
1422
- if ("value" in node && typeof node.value === "object" && typeof ((_node_value = node.value) === null || _node_value === void 0 ? void 0 : _node_value.id) === "string") {
1406
+ if ("value" in node && _type_of(node.value) === "object" && typeof ((_node_value = node.value) === null || _node_value === void 0 ? void 0 : _node_value.id) === "string") {
1423
1407
  return node.value.id;
1424
1408
  }
1425
1409
  };
@@ -1531,7 +1515,7 @@ var BeaconPlugin = function() {
1531
1515
  });
1532
1516
  };
1533
1517
  var __copyProps = function(to, from, except, desc) {
1534
- if (from && typeof from === "object" || typeof from === "function") {
1518
+ if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
1535
1519
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1536
1520
  try {
1537
1521
  var _loop = function() {
@@ -1586,15 +1570,16 @@ var BeaconPlugin = function() {
1586
1570
  exports.toError = exports.NestedError = void 0;
1587
1571
  var NestedError4 = /*#__PURE__*/ function(Error1) {
1588
1572
  _inherits(_NestedError, Error1);
1589
- var _super = _create_super(_NestedError);
1590
1573
  function _NestedError(message) {
1591
1574
  for(var _len = arguments.length, innerErrors = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
1592
1575
  innerErrors[_key - 1] = arguments[_key];
1593
1576
  }
1594
1577
  _class_call_check(this, _NestedError);
1595
1578
  var _this;
1596
- _this = _super.call(this, message);
1597
- var thisErrorReport = _NestedError.getErrorReport(_assert_this_initialized(_this));
1579
+ _this = _call_super(this, _NestedError, [
1580
+ message
1581
+ ]);
1582
+ var thisErrorReport = _NestedError.getErrorReport(_this);
1598
1583
  if (innerErrors.length === 1) {
1599
1584
  var innerError = toError(innerErrors[0]);
1600
1585
  _this.innerErrors = [
@@ -1730,7 +1715,7 @@ var BeaconPlugin = function() {
1730
1715
  return out;
1731
1716
  }
1732
1717
  function isObject(o) {
1733
- return o != null && typeof o === "object";
1718
+ return o != null && (typeof o === "undefined" ? "undefined" : _type_of(o)) === "object";
1734
1719
  }
1735
1720
  function addLast2(array, val) {
1736
1721
  if (Array.isArray(val)) return array.concat(val);
@@ -2073,7 +2058,7 @@ var BeaconPlugin = function() {
2073
2058
  else return 0;
2074
2059
  }
2075
2060
  }();
2076
- if (typeof module === "object") module.exports = SortedArray2;
2061
+ if ((typeof module === "undefined" ? "undefined" : _type_of(module)) === "object") module.exports = SortedArray2;
2077
2062
  if (typeof define === "function" && define.amd) define(function() {
2078
2063
  return SortedArray2;
2079
2064
  });
@@ -2273,10 +2258,9 @@ var BeaconPlugin = function() {
2273
2258
  }();
2274
2259
  var SyncHook = /*#__PURE__*/ function(Hook) {
2275
2260
  _inherits(SyncHook, Hook);
2276
- var _super = _create_super(SyncHook);
2277
2261
  function SyncHook() {
2278
2262
  _class_call_check(this, SyncHook);
2279
- return _super.apply(this, arguments);
2263
+ return _call_super(this, SyncHook, arguments);
2280
2264
  }
2281
2265
  _create_class(SyncHook, [
2282
2266
  {
@@ -2309,10 +2293,9 @@ var BeaconPlugin = function() {
2309
2293
  }(Hook);
2310
2294
  var SyncBailHook = /*#__PURE__*/ function(Hook) {
2311
2295
  _inherits(SyncBailHook, Hook);
2312
- var _super = _create_super(SyncBailHook);
2313
2296
  function SyncBailHook() {
2314
2297
  _class_call_check(this, SyncBailHook);
2315
- return _super.apply(this, arguments);
2298
+ return _call_super(this, SyncBailHook, arguments);
2316
2299
  }
2317
2300
  _create_class(SyncBailHook, [
2318
2301
  {
@@ -2344,10 +2327,9 @@ var BeaconPlugin = function() {
2344
2327
  }(Hook);
2345
2328
  var SyncWaterfallHook = /*#__PURE__*/ function(Hook) {
2346
2329
  _inherits(SyncWaterfallHook, Hook);
2347
- var _super = _create_super(SyncWaterfallHook);
2348
2330
  function SyncWaterfallHook() {
2349
2331
  _class_call_check(this, SyncWaterfallHook);
2350
- return _super.apply(this, arguments);
2332
+ return _call_super(this, SyncWaterfallHook, arguments);
2351
2333
  }
2352
2334
  _create_class(SyncWaterfallHook, [
2353
2335
  {
@@ -2379,10 +2361,9 @@ var BeaconPlugin = function() {
2379
2361
  }(Hook);
2380
2362
  var AsyncSeriesWaterfallHook = /*#__PURE__*/ function(Hook) {
2381
2363
  _inherits(AsyncSeriesWaterfallHook, Hook);
2382
- var _super = _create_super(AsyncSeriesWaterfallHook);
2383
2364
  function AsyncSeriesWaterfallHook() {
2384
2365
  _class_call_check(this, AsyncSeriesWaterfallHook);
2385
- return _super.apply(this, arguments);
2366
+ return _call_super(this, AsyncSeriesWaterfallHook, arguments);
2386
2367
  }
2387
2368
  _create_class(AsyncSeriesWaterfallHook, [
2388
2369
  {
@@ -2391,7 +2372,6 @@ var BeaconPlugin = function() {
2391
2372
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
2392
2373
  args[_key] = arguments[_key];
2393
2374
  }
2394
- var _this = this;
2395
2375
  return _async_to_generator(function() {
2396
2376
  var _this_interceptions, _args, rtn, rest, ctx, tapIndex, tapValue, e;
2397
2377
  return _ts_generator(this, function(_state) {
@@ -2399,7 +2379,7 @@ var BeaconPlugin = function() {
2399
2379
  case 0:
2400
2380
  _args = _to_array(args), rtn = _args[0], rest = _args.slice(1);
2401
2381
  ctx = {};
2402
- (_this_interceptions = _this.interceptions).call.apply(_this_interceptions, [
2382
+ (_this_interceptions = this.interceptions).call.apply(_this_interceptions, [
2403
2383
  ctx
2404
2384
  ].concat(_to_consumable_array(args)));
2405
2385
  _state.label = 1;
@@ -2413,13 +2393,13 @@ var BeaconPlugin = function() {
2413
2393
  tapIndex = 0;
2414
2394
  _state.label = 2;
2415
2395
  case 2:
2416
- if (!(tapIndex < _this.taps.length)) return [
2396
+ if (!(tapIndex < this.taps.length)) return [
2417
2397
  3,
2418
2398
  5
2419
2399
  ];
2420
2400
  return [
2421
2401
  4,
2422
- callTap(_this.taps[tapIndex], [
2402
+ callTap(this.taps[tapIndex], [
2423
2403
  rtn
2424
2404
  ].concat(_to_consumable_array(rest)), ctx)
2425
2405
  ];
@@ -2442,17 +2422,17 @@ var BeaconPlugin = function() {
2442
2422
  ];
2443
2423
  case 6:
2444
2424
  e = _state.sent();
2445
- _this.interceptions.error(e);
2425
+ this.interceptions.error(e);
2446
2426
  throw e;
2447
2427
  case 7:
2448
- _this.interceptions.result(rtn);
2428
+ this.interceptions.result(rtn);
2449
2429
  return [
2450
2430
  2,
2451
2431
  rtn
2452
2432
  ];
2453
2433
  }
2454
2434
  });
2455
- })();
2435
+ }).call(this);
2456
2436
  }
2457
2437
  }
2458
2438
  ]);
@@ -2490,7 +2470,7 @@ var BeaconPlugin = function() {
2490
2470
  for(var _iterator = foo[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2491
2471
  len = _step.value;
2492
2472
  tmp = len;
2493
- if (tmp && typeof tmp === "object") {
2473
+ if (tmp && (typeof tmp === "undefined" ? "undefined" : _type_of(tmp)) === "object") {
2494
2474
  tmp = find(bar, tmp);
2495
2475
  if (!tmp) return false;
2496
2476
  }
@@ -2521,7 +2501,7 @@ var BeaconPlugin = function() {
2521
2501
  for(var _iterator1 = foo[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
2522
2502
  len = _step1.value;
2523
2503
  tmp = len[0];
2524
- if (tmp && typeof tmp === "object") {
2504
+ if (tmp && (typeof tmp === "undefined" ? "undefined" : _type_of(tmp)) === "object") {
2525
2505
  tmp = find(bar, tmp);
2526
2506
  if (!tmp) return false;
2527
2507
  }
@@ -2560,7 +2540,7 @@ var BeaconPlugin = function() {
2560
2540
  }
2561
2541
  return len === -1;
2562
2542
  }
2563
- if (!ctor || typeof foo === "object") {
2543
+ if (!ctor || (typeof foo === "undefined" ? "undefined" : _type_of(foo)) === "object") {
2564
2544
  len = 0;
2565
2545
  for(ctor in foo){
2566
2546
  if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
@@ -2593,7 +2573,7 @@ var BeaconPlugin = function() {
2593
2573
  var nestedPath = _to_consumable_array(path).concat([
2594
2574
  key
2595
2575
  ]);
2596
- if (typeof val === "object") {
2576
+ if ((typeof val === "undefined" ? "undefined" : _type_of(val)) === "object") {
2597
2577
  traverseObj(val, nestedPath, pairs);
2598
2578
  } else {
2599
2579
  pairs.set(nestedPath, val);
@@ -2634,7 +2614,7 @@ var BeaconPlugin = function() {
2634
2614
  {
2635
2615
  /** Add match -> value mapping to the registry */ key: "set",
2636
2616
  value: function set(match, value) {
2637
- var matcher = typeof match === "object" ? createMatcher(match) : createBasicMatcher(match);
2617
+ var matcher = (typeof match === "undefined" ? "undefined" : _type_of(match)) === "object" ? createMatcher(match) : createBasicMatcher(match);
2638
2618
  this.store.insert({
2639
2619
  key: match,
2640
2620
  value: value,
@@ -3174,7 +3154,7 @@ var BeaconPlugin = function() {
3174
3154
  var _this_parseCache_path;
3175
3155
  var ast = (_this_parseCache_path = this.parseCache[path]) !== null && _this_parseCache_path !== void 0 ? _this_parseCache_path : parse(path);
3176
3156
  this.parseCache[path] = ast;
3177
- if (typeof ast !== "object" || !(ast === null || ast === void 0 ? void 0 : ast.status)) {
3157
+ if ((typeof ast === "undefined" ? "undefined" : _type_of(ast)) !== "object" || !(ast === null || ast === void 0 ? void 0 : ast.status)) {
3178
3158
  var _ast_error;
3179
3159
  throw new TypeError('Cannot normalize path "'.concat(path, '": ').concat((_ast_error = ast === null || ast === void 0 ? void 0 : ast.error) !== null && _ast_error !== void 0 ? _ast_error : "Unknown Error."));
3180
3160
  }
@@ -3374,14 +3354,13 @@ var BeaconPlugin = function() {
3374
3354
  }();
3375
3355
  var DependencyModel = /*#__PURE__*/ function(DependencyTracker) {
3376
3356
  _inherits(DependencyModel, DependencyTracker);
3377
- var _super = _create_super(DependencyModel);
3378
3357
  function DependencyModel(rootModel) {
3379
3358
  _class_call_check(this, DependencyModel);
3380
3359
  var _this;
3381
- _this = _super.call(this);
3360
+ _this = _call_super(this, DependencyModel);
3382
3361
  _this.rootModel = rootModel;
3383
- _this.set = _this.set.bind(_assert_this_initialized(_this));
3384
- _this.get = _this.get.bind(_assert_this_initialized(_this));
3362
+ _this.set = _this.set.bind(_this);
3363
+ _this.get = _this.get.bind(_this);
3385
3364
  return _this;
3386
3365
  }
3387
3366
  _create_class(DependencyModel, [
@@ -3925,23 +3904,20 @@ var BeaconPlugin = function() {
3925
3904
  * @experimental These Player APIs are in active development and may change. Use with caution
3926
3905
  */ key: "evaluateAsync",
3927
3906
  value: function evaluateAsync(expr, options) {
3907
+ var _this = this;
3928
3908
  if (Array.isArray(expr)) {
3929
- var _this = this;
3930
- return collateAwaitable(expr.map(function() {
3931
- var _ref = _async_to_generator(function(exp) {
3909
+ return collateAwaitable(expr.map(function(exp) {
3910
+ return _async_to_generator(function() {
3932
3911
  return _ts_generator(this, function(_state) {
3933
3912
  return [
3934
3913
  2,
3935
- _this.evaluate(exp, _object_spread_props(_object_spread({}, options), {
3914
+ this.evaluate(exp, _object_spread_props(_object_spread({}, options), {
3936
3915
  async: true
3937
3916
  }))
3938
3917
  ];
3939
3918
  });
3940
- });
3941
- return function(exp) {
3942
- return _ref.apply(this, arguments);
3943
- };
3944
- }())).awaitableThen(function(values) {
3919
+ }).call(_this);
3920
+ })).awaitableThen(function(values) {
3945
3921
  return values.pop();
3946
3922
  });
3947
3923
  } else {
@@ -4704,7 +4680,7 @@ var BeaconPlugin = function() {
4704
4680
  }
4705
4681
  var parseLocalObject = function(currentValue, objToParse) {
4706
4682
  var path = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
4707
- if (typeof objToParse !== "object" || objToParse === null) {
4683
+ if ((typeof objToParse === "undefined" ? "undefined" : _type_of(objToParse)) !== "object" || objToParse === null) {
4708
4684
  return {
4709
4685
  value: objToParse,
4710
4686
  children: []
@@ -4741,7 +4717,7 @@ var BeaconPlugin = function() {
4741
4717
  if (newChildren) {
4742
4718
  var _children2;
4743
4719
  (_children2 = children2).push.apply(_children2, _to_consumable_array(newChildren));
4744
- } else if (localValue && typeof localValue === "object") {
4720
+ } else if (localValue && (typeof localValue === "undefined" ? "undefined" : _type_of(localValue)) === "object") {
4745
4721
  var _children21;
4746
4722
  var result = parseLocalObject(accumulation.value, localValue, _to_consumable_array(path).concat([
4747
4723
  localKey
@@ -4899,7 +4875,7 @@ var BeaconPlugin = function() {
4899
4875
  Object.keys(clonedNode).forEach(function(key) {
4900
4876
  if (key === "parent") return;
4901
4877
  var value = clonedNode[key];
4902
- if (typeof value === "object" && value !== null) {
4878
+ if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && value !== null) {
4903
4879
  clonedNode[key] = Array.isArray(value) ? _to_consumable_array(value) : _object_spread({}, value);
4904
4880
  }
4905
4881
  });
@@ -5251,7 +5227,7 @@ var BeaconPlugin = function() {
5251
5227
  for(var _iterator = templateSubstitutions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5252
5228
  var _step_value = _step.value, expression = _step_value.expression, value = _step_value.value;
5253
5229
  var flags = "g";
5254
- if (typeof expression === "object") {
5230
+ if ((typeof expression === "undefined" ? "undefined" : _type_of(expression)) === "object") {
5255
5231
  flags = "".concat(expression.flags).concat(expression.global ? "" : "g");
5256
5232
  }
5257
5233
  templateStr = templateStr.replace(new RegExp(expression, flags), value);
@@ -5400,7 +5376,7 @@ var BeaconPlugin = function() {
5400
5376
  var bindingResolveLookup = createPatternMatcher("{{", "}}");
5401
5377
  var expressionResolveLookup = createPatternMatcher("@[", "]@");
5402
5378
  function resolveAllRefs(node, resolveOptions, propertiesToSkip) {
5403
- if (node === null || node === void 0 || typeof node !== "object" && typeof node !== "string") {
5379
+ if (node === null || node === void 0 || (typeof node === "undefined" ? "undefined" : _type_of(node)) !== "object" && typeof node !== "string") {
5404
5380
  return node;
5405
5381
  }
5406
5382
  if (typeof node === "string") {
@@ -5413,7 +5389,7 @@ var BeaconPlugin = function() {
5413
5389
  }
5414
5390
  var val = node[key];
5415
5391
  var newVal = val;
5416
- if (typeof val === "object") {
5392
+ if ((typeof val === "undefined" ? "undefined" : _type_of(val)) === "object") {
5417
5393
  newVal = resolveAllRefs(val, resolveOptions, propertiesToSkip);
5418
5394
  } else if (typeof val === "string") {
5419
5395
  newVal = resolveString(val, resolveOptions);
@@ -5754,7 +5730,7 @@ var BeaconPlugin = function() {
5754
5730
  key: "applyParser",
5755
5731
  value: function applyParser(parser) {
5756
5732
  parser.hooks.parseNode.tap("asset", function(obj, nodeType, options, childOptions) {
5757
- if ((childOptions === null || childOptions === void 0 ? void 0 : childOptions.key) === "asset" && typeof obj === "object") {
5733
+ if ((childOptions === null || childOptions === void 0 ? void 0 : childOptions.key) === "asset" && (typeof obj === "undefined" ? "undefined" : _type_of(obj)) === "object") {
5758
5734
  var assetAST = parser.parseObject(obj, "asset", options);
5759
5735
  if (!assetAST) {
5760
5736
  return [];
@@ -5954,6 +5930,7 @@ var BeaconPlugin = function() {
5954
5930
  }();
5955
5931
  var FlowInstance = /*#__PURE__*/ function() {
5956
5932
  function FlowInstance(id, flow, options) {
5933
+ var _this = this;
5957
5934
  _class_call_check(this, FlowInstance);
5958
5935
  this.isTransitioning = false;
5959
5936
  this.hooks = {
@@ -5970,60 +5947,55 @@ var BeaconPlugin = function() {
5970
5947
  this.flow = flow;
5971
5948
  this.log = options === null || options === void 0 ? void 0 : options.logger;
5972
5949
  this.history = [];
5973
- var _this = this;
5974
- this.hooks.transition.tap("startPromise", function() {
5975
- var _ref = _async_to_generator(function(_oldState, nextState) {
5950
+ this.hooks.transition.tap("startPromise", function(_oldState, nextState) {
5951
+ return _async_to_generator(function() {
5976
5952
  var newState;
5977
5953
  return _ts_generator(this, function(_state) {
5978
5954
  newState = nextState.value;
5979
- if (_this.flowPromise && newState.state_type === "END") {
5980
- _this.flowPromise.resolve(newState);
5955
+ if (this.flowPromise && newState.state_type === "END") {
5956
+ this.flowPromise.resolve(newState);
5981
5957
  }
5982
5958
  return [
5983
5959
  2
5984
5960
  ];
5985
5961
  });
5986
- });
5987
- return function(_oldState, nextState) {
5988
- return _ref.apply(this, arguments);
5989
- };
5990
- }());
5962
+ }).call(_this);
5963
+ });
5991
5964
  }
5992
5965
  _create_class(FlowInstance, [
5993
5966
  {
5994
5967
  key: "start",
5995
5968
  value: /** Start the state machine */ function start() {
5996
- var _this = this;
5997
5969
  return _async_to_generator(function() {
5998
5970
  var _this_log, initialState;
5999
5971
  return _ts_generator(this, function(_state) {
6000
- if (_this.flowPromise) {
5972
+ if (this.flowPromise) {
6001
5973
  ;
6002
- (_this_log = _this.log) === null || _this_log === void 0 ? void 0 : _this_log.warn("Already called start for flow");
5974
+ (_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.warn("Already called start for flow");
6003
5975
  return [
6004
5976
  2,
6005
- _this.flowPromise.promise
5977
+ this.flowPromise.promise
6006
5978
  ];
6007
5979
  }
6008
- _this.flow = _this.hooks.beforeStart.call(_this.flow) || _this.flow;
6009
- if (_this.flow.onStart) {
6010
- _this.hooks.onStart.call(_this.flow.onStart);
5980
+ this.flow = this.hooks.beforeStart.call(this.flow) || this.flow;
5981
+ if (this.flow.onStart) {
5982
+ this.hooks.onStart.call(this.flow.onStart);
6011
5983
  }
6012
- initialState = _this.flow.startState;
5984
+ initialState = this.flow.startState;
6013
5985
  if (!initialState) {
6014
5986
  return [
6015
5987
  2,
6016
5988
  Promise.reject(new Error("No 'startState' defined for flow"))
6017
5989
  ];
6018
5990
  }
6019
- _this.flowPromise = (0, import_p_defer2.default)();
6020
- _this.pushHistory(initialState);
5991
+ this.flowPromise = (0, import_p_defer2.default)();
5992
+ this.pushHistory(initialState);
6021
5993
  return [
6022
5994
  2,
6023
- _this.flowPromise.promise
5995
+ this.flowPromise.promise
6024
5996
  ];
6025
5997
  });
6026
- })();
5998
+ }).call(this);
6027
5999
  }
6028
6000
  },
6029
6001
  {
@@ -6075,7 +6047,7 @@ var BeaconPlugin = function() {
6075
6047
  throw new Error("No flow definition for: ".concat(stateName, " was found."));
6076
6048
  }
6077
6049
  var nextState = this.flow[stateName];
6078
- if (!this.flow[stateName] || typeof nextState !== "object" || !("state_type" in nextState)) {
6050
+ if (!this.flow[stateName] || (typeof nextState === "undefined" ? "undefined" : _type_of(nextState)) !== "object" || !("state_type" in nextState)) {
6079
6051
  var _this_log;
6080
6052
  (_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.error("Flow doesn't contain any states named: ".concat(stateName));
6081
6053
  return;
@@ -6135,30 +6107,30 @@ var BeaconPlugin = function() {
6135
6107
  {
6136
6108
  key: "run",
6137
6109
  value: function run(startState) {
6138
- var _this = this;
6139
6110
  return _async_to_generator(function() {
6140
- var _this_log, startFlow, flow, end, firstItem;
6111
+ var _this, _this_log, startFlow, flow, end, firstItem;
6141
6112
  return _ts_generator(this, function(_state) {
6142
6113
  switch(_state.label){
6143
6114
  case 0:
6144
- if (!Object.prototype.hasOwnProperty.call(_this.navigation, startState)) {
6115
+ _this = this;
6116
+ if (!Object.prototype.hasOwnProperty.call(this.navigation, startState)) {
6145
6117
  return [
6146
6118
  2,
6147
6119
  Promise.reject(new Error("No flow defined for: ".concat(startState)))
6148
6120
  ];
6149
6121
  }
6150
- startFlow = _this.navigation[startState];
6151
- if (startFlow === null || typeof startFlow !== "object") {
6122
+ startFlow = this.navigation[startState];
6123
+ if (startFlow === null || (typeof startFlow === "undefined" ? "undefined" : _type_of(startFlow)) !== "object") {
6152
6124
  return [
6153
6125
  2,
6154
6126
  Promise.reject(new Error("Flow: ".concat(startState, " needs to be an object")))
6155
6127
  ];
6156
6128
  }
6157
- (_this_log = _this.log) === null || _this_log === void 0 ? void 0 : _this_log.debug("Starting flow: ".concat(startState));
6129
+ (_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.debug("Starting flow: ".concat(startState));
6158
6130
  flow = new FlowInstance(startState, startFlow, {
6159
- logger: _this.log
6131
+ logger: this.log
6160
6132
  });
6161
- _this.addNewFlow(flow);
6133
+ this.addNewFlow(flow);
6162
6134
  flow.hooks.afterTransition.tap("flow-controller", function(flowInstance) {
6163
6135
  var _flowInstance_currentState;
6164
6136
  if (((_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value.state_type) === "FLOW") {
@@ -6178,10 +6150,10 @@ var BeaconPlugin = function() {
6178
6150
  ];
6179
6151
  case 1:
6180
6152
  end = _state.sent();
6181
- _this.navStack.pop();
6182
- if (_this.navStack.length > 0) {
6153
+ this.navStack.pop();
6154
+ if (this.navStack.length > 0) {
6183
6155
  firstItem = 0;
6184
- _this.current = _this.navStack[firstItem];
6156
+ this.current = this.navStack[firstItem];
6185
6157
  }
6186
6158
  return [
6187
6159
  2,
@@ -6189,16 +6161,15 @@ var BeaconPlugin = function() {
6189
6161
  ];
6190
6162
  }
6191
6163
  });
6192
- })();
6164
+ }).call(this);
6193
6165
  }
6194
6166
  },
6195
6167
  {
6196
6168
  key: "start",
6197
6169
  value: function start() {
6198
- var _this = this;
6199
6170
  return _async_to_generator(function() {
6200
6171
  return _ts_generator(this, function(_state) {
6201
- if (!_this.navigation.BEGIN) {
6172
+ if (!this.navigation.BEGIN) {
6202
6173
  return [
6203
6174
  2,
6204
6175
  Promise.reject(new Error("Must supply a BEGIN state"))
@@ -6206,10 +6177,10 @@ var BeaconPlugin = function() {
6206
6177
  }
6207
6178
  return [
6208
6179
  2,
6209
- _this.run(_this.navigation.BEGIN)
6180
+ this.run(this.navigation.BEGIN)
6210
6181
  ];
6211
6182
  });
6212
- })();
6183
+ }).call(this);
6213
6184
  }
6214
6185
  }
6215
6186
  ]);
@@ -7316,7 +7287,7 @@ var BeaconPlugin = function() {
7316
7287
  var parentBinding = resolved.parent();
7317
7288
  var property = resolved.key();
7318
7289
  var parentValue = this.get(parentBinding);
7319
- var existedBeforeDelete = typeof parentValue === "object" && parentValue !== null && Object.prototype.hasOwnProperty.call(parentValue, property);
7290
+ var existedBeforeDelete = (typeof parentValue === "undefined" ? "undefined" : _type_of(parentValue)) === "object" && parentValue !== null && Object.prototype.hasOwnProperty.call(parentValue, property);
7320
7291
  this.getModel().delete(resolved, options);
7321
7292
  if (existedBeforeDelete && !this.get(resolved)) {
7322
7293
  this.trash.add(resolved);
@@ -7417,7 +7388,7 @@ var BeaconPlugin = function() {
7417
7388
  var expressionEvaluator;
7418
7389
  var handleEval = function(exp) {
7419
7390
  if (exp) {
7420
- if (typeof exp === "object" && "exp" in exp) {
7391
+ if ((typeof exp === "undefined" ? "undefined" : _type_of(exp)) === "object" && "exp" in exp) {
7421
7392
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(exp.exp);
7422
7393
  } else {
7423
7394
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(exp);
@@ -7678,7 +7649,7 @@ var BeaconPlugin = function() {
7678
7649
  flow.hooks.beforeTransition.tap("player", function(state, transitionVal) {
7679
7650
  var computedTransitionVal = state.transitions[transitionVal] ? transitionVal : "*";
7680
7651
  if (state.onEnd && state.transitions[computedTransitionVal]) {
7681
- if (typeof state.onEnd === "object" && "exp" in state.onEnd) {
7652
+ if (_type_of(state.onEnd) === "object" && "exp" in state.onEnd) {
7682
7653
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(state.onEnd.exp);
7683
7654
  } else {
7684
7655
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(state.onEnd);
@@ -7837,12 +7808,12 @@ var BeaconPlugin = function() {
7837
7808
  {
7838
7809
  key: "start",
7839
7810
  value: function start(payload) {
7840
- var _this = this;
7841
7811
  return _async_to_generator(function() {
7842
- var _payload_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
7812
+ var _this, _payload_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
7843
7813
  return _ts_generator(this, function(_state) {
7844
7814
  switch(_state.label){
7845
7815
  case 0:
7816
+ _this = this;
7846
7817
  ref = Symbol((_payload_id = payload === null || payload === void 0 ? void 0 : payload.id) !== null && _payload_id !== void 0 ? _payload_id : "payload");
7847
7818
  maybeUpdateState = function(newState) {
7848
7819
  if (_this.state.ref !== ref) {
@@ -7852,7 +7823,7 @@ var BeaconPlugin = function() {
7852
7823
  _this.setState(newState);
7853
7824
  return newState;
7854
7825
  };
7855
- _this.setState({
7826
+ this.setState({
7856
7827
  status: "not-started",
7857
7828
  ref: ref
7858
7829
  });
@@ -7864,8 +7835,8 @@ var BeaconPlugin = function() {
7864
7835
  ,
7865
7836
  4
7866
7837
  ]);
7867
- _this_setupFlow = _this.setupFlow(payload), state = _this_setupFlow.state, start = _this_setupFlow.start;
7868
- _this.setState(_object_spread({
7838
+ _this_setupFlow = this.setupFlow(payload), state = _this_setupFlow.state, start = _this_setupFlow.start;
7839
+ this.setState(_object_spread({
7869
7840
  ref: ref
7870
7841
  }, state));
7871
7842
  start();
@@ -7910,7 +7881,7 @@ var BeaconPlugin = function() {
7910
7881
  ];
7911
7882
  }
7912
7883
  });
7913
- })();
7884
+ }).call(this);
7914
7885
  }
7915
7886
  }
7916
7887
  ]);
@@ -8025,51 +7996,53 @@ var BeaconPlugin = function() {
8025
7996
  {
8026
7997
  key: "beacon",
8027
7998
  value: function beacon(event) {
7999
+ var _this = this;
8028
8000
  var action = event.action, element = event.element, asset = event.asset, view = event.view;
8029
8001
  var _this_beaconContext = this.beaconContext, currentView = _this_beaconContext.view;
8030
- var _this = this;
8031
- setTimeout(/*#__PURE__*/ _async_to_generator(function() {
8032
- var _event_asset_metaData, _event_asset, _this_resolveDataRefs, _this1, _this_player, unresolvedData, _this_resolveDataRefs1, data, defaultBeacon, state, hookArgs, beacon, shouldCancel, _this_logger;
8033
- return _ts_generator(this, function(_state) {
8034
- switch(_state.label){
8035
- case 0:
8036
- unresolvedData = (event === null || event === void 0 ? void 0 : event.data) || ((_event_asset = event.asset) === null || _event_asset === void 0 ? void 0 : (_event_asset_metaData = _event_asset.metaData) === null || _event_asset_metaData === void 0 ? void 0 : _event_asset_metaData.beacon);
8037
- data = (_this_resolveDataRefs1 = (_this_resolveDataRefs = (_this1 = _this).resolveDataRefs) === null || _this_resolveDataRefs === void 0 ? void 0 : _this_resolveDataRefs.call(_this1, unresolvedData)) !== null && _this_resolveDataRefs1 !== void 0 ? _this_resolveDataRefs1 : unresolvedData;
8038
- defaultBeacon = {
8039
- action: action,
8040
- element: element,
8041
- data: data,
8042
- assetId: asset === null || asset === void 0 ? void 0 : asset.id,
8043
- viewId: currentView === null || currentView === void 0 ? void 0 : currentView.id
8044
- };
8045
- state = (_this_player = _this.player) === null || _this_player === void 0 ? void 0 : _this_player.getState();
8046
- hookArgs = _object_spread_props(_object_spread({}, event), {
8047
- data: data,
8048
- state: state,
8049
- view: view !== null && view !== void 0 ? view : currentView,
8050
- logger: _this.logger
8051
- });
8052
- return [
8053
- 4,
8054
- _this.hooks.buildBeacon.call(defaultBeacon, hookArgs)
8055
- ];
8056
- case 1:
8057
- beacon = _state.sent() || defaultBeacon;
8058
- if (beacon !== defaultBeacon && _this.resolveDataRefs) {
8059
- beacon = _this.resolveDataRefs(beacon);
8060
- }
8061
- shouldCancel = _this.hooks.cancelBeacon.call(hookArgs) || false;
8062
- if (!shouldCancel) {
8063
- ;
8064
- (_this_logger = _this.logger) === null || _this_logger === void 0 ? void 0 : _this_logger.debug("Sending beacon event", beacon);
8065
- _this.hooks.publishBeacon.call(beacon);
8066
- }
8067
- return [
8068
- 2
8069
- ];
8070
- }
8071
- });
8072
- }), 0);
8002
+ setTimeout(function() {
8003
+ return _async_to_generator(function() {
8004
+ var _event_asset_metaData, _event_asset, _this_resolveDataRefs, _this, _this_player, unresolvedData, _this_resolveDataRefs1, data, defaultBeacon, state, hookArgs, beacon, shouldCancel, _this_logger;
8005
+ return _ts_generator(this, function(_state) {
8006
+ switch(_state.label){
8007
+ case 0:
8008
+ unresolvedData = (event === null || event === void 0 ? void 0 : event.data) || ((_event_asset = event.asset) === null || _event_asset === void 0 ? void 0 : (_event_asset_metaData = _event_asset.metaData) === null || _event_asset_metaData === void 0 ? void 0 : _event_asset_metaData.beacon);
8009
+ data = (_this_resolveDataRefs1 = (_this_resolveDataRefs = (_this = this).resolveDataRefs) === null || _this_resolveDataRefs === void 0 ? void 0 : _this_resolveDataRefs.call(_this, unresolvedData)) !== null && _this_resolveDataRefs1 !== void 0 ? _this_resolveDataRefs1 : unresolvedData;
8010
+ defaultBeacon = {
8011
+ action: action,
8012
+ element: element,
8013
+ data: data,
8014
+ assetId: asset === null || asset === void 0 ? void 0 : asset.id,
8015
+ viewId: currentView === null || currentView === void 0 ? void 0 : currentView.id
8016
+ };
8017
+ state = (_this_player = this.player) === null || _this_player === void 0 ? void 0 : _this_player.getState();
8018
+ hookArgs = _object_spread_props(_object_spread({}, event), {
8019
+ data: data,
8020
+ state: state,
8021
+ view: view !== null && view !== void 0 ? view : currentView,
8022
+ logger: this.logger
8023
+ });
8024
+ return [
8025
+ 4,
8026
+ this.hooks.buildBeacon.call(defaultBeacon, hookArgs)
8027
+ ];
8028
+ case 1:
8029
+ beacon = _state.sent() || defaultBeacon;
8030
+ if (beacon !== defaultBeacon && this.resolveDataRefs) {
8031
+ beacon = this.resolveDataRefs(beacon);
8032
+ }
8033
+ shouldCancel = this.hooks.cancelBeacon.call(hookArgs) || false;
8034
+ if (!shouldCancel) {
8035
+ ;
8036
+ (_this_logger = this.logger) === null || _this_logger === void 0 ? void 0 : _this_logger.debug("Sending beacon event", beacon);
8037
+ this.hooks.publishBeacon.call(beacon);
8038
+ }
8039
+ return [
8040
+ 2
8041
+ ];
8042
+ }
8043
+ });
8044
+ }).call(_this);
8045
+ }, 0);
8073
8046
  }
8074
8047
  }
8075
8048
  ]);