@xibosignage/xibo-layout-renderer 1.0.24 → 1.0.25

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.
@@ -196,6 +196,7 @@ type IXlrEvents = {
196
196
  overlayEnd: (overlay: ILayout) => void;
197
197
  commandCodeReceived: (commandCode: string) => void;
198
198
  commandStringReceived: (commandString: string) => void;
199
+ navLayout: (layoutCode: string, url: string) => void;
199
200
  };
200
201
  interface IXlrPlayback {
201
202
  currentLayout: ILayout | undefined;
@@ -454,6 +455,7 @@ type InputLayoutType = {
454
455
  getXlf?(): string;
455
456
  duration?: number;
456
457
  isOverlay?: boolean;
458
+ shareOfVoice?: number;
457
459
  };
458
460
  type OptionsType = {
459
461
  xlfUrl: string;
@@ -831,31 +831,37 @@ var OverlayLayoutManager = /*#__PURE__*/function () {
831
831
  case 0:
832
832
  _context2.next = 2;
833
833
  return Promise.all(list.map( /*#__PURE__*/function () {
834
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(item) {
835
- var inputOverlay, overlayLayout, $overlay;
834
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(item, index) {
835
+ var _item$index;
836
+ var inputOverlay, overlayLayout, $overlay, _overlayLayout$zIndex;
836
837
  return _regeneratorRuntime().wrap(function _callee$(_context) {
837
838
  while (1) switch (_context.prev = _context.next) {
838
839
  case 0:
839
840
  inputOverlay = {};
840
841
  inputOverlay = _objectSpread2(_objectSpread2({}, inputOverlay), item);
841
- inputOverlay.index = item.index;
842
+ inputOverlay.index = (_item$index = item.index) !== null && _item$index !== void 0 ? _item$index : index;
842
843
  _context.next = 5;
843
844
  return _this.parent.prepareLayoutXlf(_objectSpread2(_objectSpread2({}, initialLayout), inputOverlay));
844
845
  case 5:
845
846
  overlayLayout = _context.sent;
847
+ console.debug('<> XLR.debug OverlayLayoutManager::parseOverlays prepared overlay layout', {
848
+ overlayLayout: overlayLayout,
849
+ inputOverlay: inputOverlay
850
+ });
846
851
  // Hide all overlays first
847
852
  $overlay = document.querySelector("#".concat(overlayLayout.containerName, "[data-sequence=\"").concat(overlayLayout.index, "\"]"));
848
853
  if ($overlay !== null) {
849
- $overlay.style.setProperty('display', 'none');
854
+ $overlay.style.setProperty('visibility', 'hidden');
855
+ $overlay.style.setProperty('z-index', "".concat((_overlayLayout$zIndex = overlayLayout.zIndex) !== null && _overlayLayout$zIndex !== void 0 ? _overlayLayout$zIndex : -999));
850
856
  }
851
857
  return _context.abrupt("return", overlayLayout);
852
- case 9:
858
+ case 10:
853
859
  case "end":
854
860
  return _context.stop();
855
861
  }
856
862
  }, _callee);
857
863
  }));
858
- return function (_x2) {
864
+ return function (_x2, _x3) {
859
865
  return _ref.apply(this, arguments);
860
866
  };
861
867
  }()));
@@ -984,7 +990,7 @@ var OverlayLayoutManager = /*#__PURE__*/function () {
984
990
  }
985
991
  }, _callee3, this, [[12, 21, 24, 27]]);
986
992
  }));
987
- function prepareOverlayLayouts(_x3, _x4) {
993
+ function prepareOverlayLayouts(_x4, _x5) {
988
994
  return _prepareOverlayLayouts.apply(this, arguments);
989
995
  }
990
996
  return prepareOverlayLayouts;
@@ -995,7 +1001,8 @@ var OverlayLayoutManager = /*#__PURE__*/function () {
995
1001
  var _this$parent$currentL;
996
1002
  if (this.overlays.length === 0) return;
997
1003
  if (this.parent && (_this$parent$currentL = this.parent.currentLayout) !== null && _this$parent$currentL !== void 0 && _this$parent$currentL.isInterrupt()) {
998
- this.container.style.setProperty('display', 'none');
1004
+ this.container.style.setProperty('visibility', 'hidden');
1005
+ this.container.style.setProperty('z-index', '-999');
999
1006
  return;
1000
1007
  }
1001
1008
  this.overlays.forEach(function (overlay) {
@@ -1013,21 +1020,25 @@ var OverlayLayoutManager = /*#__PURE__*/function () {
1013
1020
  while (1) switch (_context5.prev = _context5.next) {
1014
1021
  case 0:
1015
1022
  overlayHtml = document.querySelector("#".concat(overlay.containerName, "[data-sequence=\"").concat(overlay.index, "\"]"));
1023
+ console.debug('<> XLR.debug OverlayLayoutManager::stopOverlays', {
1024
+ overlay: overlay,
1025
+ overlayHtml: overlayHtml
1026
+ });
1016
1027
  if (!(overlayHtml !== null)) {
1017
- _context5.next = 5;
1028
+ _context5.next = 6;
1018
1029
  break;
1019
1030
  }
1020
- _context5.next = 4;
1031
+ _context5.next = 5;
1021
1032
  return overlay.finishAllRegions();
1022
- case 4:
1023
- overlay.emitter.emit('end', overlay);
1024
1033
  case 5:
1034
+ overlay.emitter.emit('end', overlay);
1035
+ case 6:
1025
1036
  case "end":
1026
1037
  return _context5.stop();
1027
1038
  }
1028
1039
  }, _callee4);
1029
1040
  }));
1030
- return function (_x5) {
1041
+ return function (_x6) {
1031
1042
  return _ref2.apply(this, arguments);
1032
1043
  };
1033
1044
  }());
@@ -73803,6 +73814,13 @@ function _playerReportFault() {
73803
73814
  }));
73804
73815
  return _playerReportFault.apply(this, arguments);
73805
73816
  }
73817
+ function setLayoutIndex(layout, layoutIndex) {
73818
+ if (!layout || layout.id === null) {
73819
+ return;
73820
+ }
73821
+ layout.index = layoutIndex;
73822
+ return layout;
73823
+ }
73806
73824
 
73807
73825
  const urlAlphabet =
73808
73826
  'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
@@ -74978,10 +74996,16 @@ var ActionController = /*#__PURE__*/function () {
74978
74996
  }, {
74979
74997
  key: "openLayoutInNewTab",
74980
74998
  value: function openLayoutInNewTab(layoutCode, options) {
74981
- if (confirm(this.translations.navigateToLayout.replace('[layoutTag]', layoutCode))) {
74982
- var url = options.layoutPreviewUrl.replace('[layoutCode]', layoutCode) + '?findByCode=1';
74983
- window.open(url, '_blank');
74984
- }
74999
+ var url = options.layoutPreviewUrl.replace('[layoutCode]', layoutCode) + '?findByCode=1';
75000
+ // Send a postMessage to the parent frame so the CMS can handle the confirmation
75001
+ // and navigation (confirm() is blocked in sandboxed iframes without allow-modals).
75002
+ window.parent.postMessage({
75003
+ type: 'xlr:navLayout',
75004
+ layoutCode: layoutCode,
75005
+ url: url
75006
+ }, '*');
75007
+ // Also emit via the XLR event system for non-iframe consumers.
75008
+ this.parent.xlr.emitter.emit('navLayout', layoutCode, url);
74985
75009
  }
74986
75010
  }, {
74987
75011
  key: "openLayoutInPlayer",
@@ -75398,8 +75422,11 @@ var Layout = /*#__PURE__*/function () {
75398
75422
  layout.state = ELayoutState.PLAYED;
75399
75423
  }
75400
75424
  layout.done = true;
75401
- console.debug({
75402
- $layout: $layout
75425
+ console.debug('>>> XLR.debug Layout end emitted > Layout ID > ', {
75426
+ $layout: $layout,
75427
+ layoutId: layout.id,
75428
+ isOverlay: layout.isOverlay,
75429
+ isInterrupt: layout.isInterrupt()
75403
75430
  });
75404
75431
  if ($layout !== null) {
75405
75432
  $layout.style.setProperty('visibility', 'hidden');
@@ -76134,12 +76161,12 @@ function XiboLayoutRenderer(inputLayouts, overlays, options) {
76134
76161
  $splashScreen === null || $splashScreen === void 0 || $splashScreen.hide();
76135
76162
  }
76136
76163
  if (!xlr.currentLayout.done) {
76137
- console.log('>>>> XLR.debug XLR::playSchedules > Running currentLayout', xlr.currentLayout);
76138
- xlr.currentLayout.run();
76139
76164
  // Hide overlays when current layout is interrupt
76140
76165
  if (xlr.currentLayout.isInterrupt()) {
76141
76166
  xlrObject.overlayLayoutManager.stopOverlays();
76142
76167
  }
76168
+ console.log('>>>> XLR.debug XLR::playSchedules > Running currentLayout', xlr.currentLayout);
76169
+ xlr.currentLayout.run();
76143
76170
  }
76144
76171
  } else {
76145
76172
  // Show splash screen
@@ -76487,8 +76514,10 @@ function XiboLayoutRenderer(inputLayouts, overlays, options) {
76487
76514
  var tempNextLayoutIndex = getLayoutIndexByLayoutId(this.inputLayouts, this.nextLayout.layoutId);
76488
76515
  _currentLayoutIndex = tempNextLayoutIndex !== null && tempNextLayoutIndex !== void 0 ? tempNextLayoutIndex : 0;
76489
76516
  _currentLayout = this.getLayout(this.inputLayouts[tempNextLayoutIndex !== null && tempNextLayoutIndex !== void 0 ? tempNextLayoutIndex : 0]);
76517
+ _currentLayout = setLayoutIndex(_currentLayout, _currentLayoutIndex);
76490
76518
  } else {
76491
76519
  _currentLayout = this.getLayout(this.inputLayouts[0]);
76520
+ _currentLayout = setLayoutIndex(_currentLayout, 0);
76492
76521
  }
76493
76522
  if (this.inputLayouts.length > 1) {
76494
76523
  if (_currentLayoutIndex + 1 > this.inputLayouts.length - 1) {
@@ -76497,6 +76526,7 @@ function XiboLayoutRenderer(inputLayouts, overlays, options) {
76497
76526
  _nextLayoutIndex = _currentLayoutIndex + 1;
76498
76527
  }
76499
76528
  _nextLayout = this.getLayout(this.inputLayouts[_nextLayoutIndex]);
76529
+ _nextLayout = setLayoutIndex(_nextLayout, _nextLayoutIndex);
76500
76530
  } else {
76501
76531
  _nextLayout = _currentLayout;
76502
76532
  }
@@ -76509,20 +76539,25 @@ function XiboLayoutRenderer(inputLayouts, overlays, options) {
76509
76539
  if (_currentLayout) {
76510
76540
  _currentLayoutIndex = _currentLayout.index;
76511
76541
  }
76542
+ _currentLayout = setLayoutIndex(_currentLayout, _currentLayoutIndex);
76512
76543
  _nextLayoutIndex = 0;
76513
76544
  _nextLayout = this.getLayout(this.inputLayouts[_nextLayoutIndex]);
76545
+ _nextLayout = setLayoutIndex(_nextLayout, _nextLayoutIndex);
76514
76546
  }
76515
76547
  } else {
76516
76548
  _currentLayoutIndex = this.nextLayout.index > this.inputLayouts.length - 1 ? 0 : this.nextLayout.index;
76517
76549
  _currentLayout = this.getLayout(this.inputLayouts[_currentLayoutIndex]);
76550
+ _currentLayout = setLayoutIndex(_currentLayout, _currentLayoutIndex);
76518
76551
  _nextLayoutIndex = _currentLayoutIndex + 1 > this.inputLayouts.length - 1 ? 0 : _currentLayoutIndex + 1;
76519
76552
  _nextLayout = this.getLayout(this.inputLayouts[_nextLayoutIndex]);
76553
+ _nextLayout = setLayoutIndex(_nextLayout, _nextLayoutIndex);
76520
76554
  }
76521
76555
  } else {
76522
76556
  _currentLayout = this.nextLayout;
76523
76557
  _currentLayoutIndex = _currentLayout.index;
76524
76558
  _nextLayoutIndex = (_currentLayoutIndex + 1) % this.inputLayouts.length;
76525
76559
  _nextLayout = this.getLayout(this.inputLayouts[_nextLayoutIndex]);
76560
+ _nextLayout = setLayoutIndex(_nextLayout, _nextLayoutIndex);
76526
76561
  }
76527
76562
  }
76528
76563
  }
@@ -76530,17 +76565,22 @@ function XiboLayoutRenderer(inputLayouts, overlays, options) {
76530
76565
  // Initial run: set both currentLayout and nextLayout
76531
76566
  if (hasLayout) {
76532
76567
  _currentLayout = this.getLayout(this.inputLayouts[_currentLayoutIndex]);
76568
+ _currentLayout = setLayoutIndex(_currentLayout, _currentLayoutIndex);
76533
76569
  if (this.inputLayouts.length > 1) {
76534
76570
  _nextLayout = this.getLayout(this.inputLayouts[_nextLayoutIndex]);
76571
+ _nextLayout = setLayoutIndex(_nextLayout, _nextLayoutIndex);
76535
76572
  } else {
76536
76573
  _nextLayout = this.getLayout(this.inputLayouts[0]);
76574
+ _nextLayout = setLayoutIndex(_nextLayout, 0);
76537
76575
  }
76538
76576
  }
76539
76577
  }
76540
76578
  if (_currentLayout === undefined && _nextLayout === undefined) {
76541
76579
  if (_hasDefaultOnly) {
76542
76580
  _currentLayout = this.getLayout(this.inputLayouts[0]);
76581
+ _currentLayout = setLayoutIndex(_currentLayout, 0);
76543
76582
  _nextLayout = this.getLayout(this.inputLayouts[0]);
76583
+ _nextLayout = setLayoutIndex(_nextLayout, 0);
76544
76584
  }
76545
76585
  }
76546
76586
  if (_currentLayout !== undefined && _nextLayout !== undefined) {
@@ -76574,6 +76614,11 @@ function XiboLayoutRenderer(inputLayouts, overlays, options) {
76574
76614
  activeLayout = _objectSpread2({}, this.uniqueLayouts[inputLayout.layoutId]);
76575
76615
  }
76576
76616
  _layout = _objectSpread2(_objectSpread2({}, _layout), activeLayout);
76617
+ console.debug('XLR::getLayout > activeLayout from uniqueLayouts', {
76618
+ activeLayout: activeLayout,
76619
+ inputLayout: inputLayout,
76620
+ uniqueLayouts: this.uniqueLayouts
76621
+ });
76577
76622
  // Must set index/sequence from schedule loop
76578
76623
  _layout.index = activeLayout.index;
76579
76624
  }
@@ -76786,7 +76831,7 @@ function XiboLayoutRenderer(inputLayouts, overlays, options) {
76786
76831
  _nextLayout = nextLayout;
76787
76832
  case 2:
76788
76833
  if (!(_nextLayout && _nextLayout.xlfString === '')) {
76789
- _context16.next = 16;
76834
+ _context16.next = 17;
76790
76835
  break;
76791
76836
  }
76792
76837
  // Remove skipped layout
@@ -76798,25 +76843,26 @@ function XiboLayoutRenderer(inputLayouts, overlays, options) {
76798
76843
  _context16.next = 7;
76799
76844
  break;
76800
76845
  }
76801
- return _context16.abrupt("break", 16);
76846
+ return _context16.abrupt("break", 17);
76802
76847
  case 7:
76803
76848
  inputLayout = self.inputLayouts[nextIndex];
76804
76849
  if (inputLayout) {
76805
76850
  _context16.next = 10;
76806
76851
  break;
76807
76852
  }
76808
- return _context16.abrupt("break", 16);
76853
+ return _context16.abrupt("break", 17);
76809
76854
  case 10:
76810
76855
  nextLayoutObj = self.getLayout(inputLayout);
76811
- _context16.next = 13;
76856
+ nextLayoutObj = setLayoutIndex(nextLayoutObj, nextIndex);
76857
+ _context16.next = 14;
76812
76858
  return self.prepareLayoutXlf(nextLayoutObj);
76813
- case 13:
76859
+ case 14:
76814
76860
  _nextLayout = _context16.sent;
76815
76861
  _context16.next = 2;
76816
76862
  break;
76817
- case 16:
76818
- return _context16.abrupt("return", _nextLayout);
76819
76863
  case 17:
76864
+ return _context16.abrupt("return", _nextLayout);
76865
+ case 18:
76820
76866
  case "end":
76821
76867
  return _context16.stop();
76822
76868
  }