@signageos/front-display 11.3.2 → 12.0.0

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.
package/dist/bundle.js CHANGED
@@ -94,7 +94,8 @@
94
94
  /***/ (function(module, exports, __webpack_require__) {
95
95
 
96
96
  var map = {
97
- "./env.{amy}.json": "./config/env.{amy}.json"
97
+ "./env.{amy}.json": "./config/env.{amy}.json",
98
+ "./env.{production}.json": "./config/env.{production}.json"
98
99
  };
99
100
 
100
101
 
@@ -130,6 +131,17 @@ module.exports = JSON.parse("{\"NODE_ENV\":\"dev\",\"base_url\":\"https://platfo
130
131
 
131
132
  /***/ }),
132
133
 
134
+ /***/ "./config/env.{production}.json":
135
+ /*!**************************************!*\
136
+ !*** ./config/env.{production}.json ***!
137
+ \**************************************/
138
+ /*! exports provided: NODE_ENV, base_url, socket_uri, static_base_url, upload_base_url, check_interval_ms, weinre_server_url, synchronizer_server_url, subscription_type, http_auth_public_key, raven_dsn, raven_enabled, default */
139
+ /***/ (function(module) {
140
+
141
+ module.exports = JSON.parse("{\"NODE_ENV\":\"production\",\"base_url\":\"https://platform.signageos.io\",\"socket_uri\":\"https://platform.signageos.io\",\"static_base_url\":\"https://static.signageos.io\",\"upload_base_url\":\"https://upload1.signageos.io\",\"check_interval_ms\":\"60000\",\"weinre_server_url\":\"https://weinre.signageos.io\",\"synchronizer_server_url\":\"https://applet-synchronizer.signageos.io\",\"subscription_type\":\"platform\",\"http_auth_public_key\":\"-----BEGIN PUBLIC KEY-----MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzDtIKaR8+ecjt4oe/mogSbm31QZPMf+/euSt0iVwThlUCeTtBG3FHA/dJoNvkH2MPnWtUrvQrm2cYJl190ce2JipP2lf0L/bHyXmOJE8gcxUyHz5iRBhW5yfro4WluDXEXIa/PunhieaNqSoOZat5HfCZfPkYAlAX1CmTlJ+l+OkmbTloOdmWNj4m9oGmrQh+zivyC3ClynyjKGm+Yg2pIKx/18wE3zG9wd7Xcg8mf1Y4OLD/nLyRZCJVDMb0KoCUqqIZOjcQ9OqzXhJqlTeVC1EROqi8q1LnMXChbqR6cVLm2qh2W2JSuOvF2yhfmkEQ0/pErpKNq+nYXa9yNPAfQIDAQAB-----END PUBLIC KEY-----\",\"raven_dsn\":\"https://974c184f29284d2ca7bb93e664e63b63:3a1ef58b75ca45aa8248baf4d0bd13be@sentry.io/150270\",\"raven_enabled\":\"1\"}");
142
+
143
+ /***/ }),
144
+
133
145
  /***/ "./config/parameters.ts":
134
146
  /*!******************************!*\
135
147
  !*** ./config/parameters.ts ***!
@@ -4589,24 +4601,6 @@ exports.StreamDisconnected = 'Stream.Disconnected';
4589
4601
 
4590
4602
  /***/ }),
4591
4603
 
4592
- /***/ "./node_modules/@signageos/actions/dist/Sync/syncActions.js":
4593
- /*!******************************************************************!*\
4594
- !*** ./node_modules/@signageos/actions/dist/Sync/syncActions.js ***!
4595
- \******************************************************************/
4596
- /*! no static exports found */
4597
- /***/ (function(module, exports, __webpack_require__) {
4598
-
4599
- "use strict";
4600
-
4601
-
4602
- Object.defineProperty(exports, "__esModule", {
4603
- value: true
4604
- });
4605
- exports.SetValue = void 0;
4606
- exports.SetValue = 'Sync.SetValue';
4607
-
4608
- /***/ }),
4609
-
4610
4604
  /***/ "./node_modules/@signageos/actions/dist/SystemLog/systemLogActions.js":
4611
4605
  /*!****************************************************************************!*\
4612
4606
  !*** ./node_modules/@signageos/actions/dist/SystemLog/systemLogActions.js ***!
@@ -5004,7 +4998,7 @@ var __generator = this && this.__generator || function (thisArg, body) {
5004
4998
  }
5005
4999
  function step(op) {
5006
5000
  if (f) throw new TypeError("Generator is already executing.");
5007
- while (_) {
5001
+ while (g && (g = 0, op[0] && (_ = 0)), _) {
5008
5002
  try {
5009
5003
  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;
5010
5004
  if (y = 0, t) op = [op[0] & 2, t.value];
@@ -5730,7 +5724,7 @@ var __generator = this && this.__generator || function (thisArg, body) {
5730
5724
  }
5731
5725
  function step(op) {
5732
5726
  if (f) throw new TypeError("Generator is already executing.");
5733
- while (_) {
5727
+ while (g && (g = 0, op[0] && (_ = 0)), _) {
5734
5728
  try {
5735
5729
  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;
5736
5730
  if (y = 0, t) op = [op[0] & 2, t.value];
@@ -5844,11 +5838,26 @@ Object.defineProperty(exports, "__esModule", {
5844
5838
  value: true
5845
5839
  });
5846
5840
  function wait(timeout) {
5847
- return new Promise(function (resolve) {
5848
- return setTimeout(function () {
5849
- return resolve();
5841
+ var timer = undefined;
5842
+ var rejectCallback = null;
5843
+ var promise = new Promise(function (resolve, reject) {
5844
+ rejectCallback = reject;
5845
+ timer = setTimeout(function () {
5846
+ rejectCallback = null;
5847
+ resolve();
5850
5848
  }, timeout);
5851
5849
  });
5850
+ promise.cancel = function () {
5851
+ if (timer) {
5852
+ clearTimeout(timer);
5853
+ timer = undefined;
5854
+ if (rejectCallback) {
5855
+ rejectCallback(new Error('Wait cancelled'));
5856
+ }
5857
+ rejectCallback = null;
5858
+ }
5859
+ };
5860
+ return promise;
5852
5861
  }
5853
5862
  exports["default"] = wait;
5854
5863
 
@@ -6063,7 +6072,7 @@ var __generator = this && this.__generator || function (thisArg, body) {
6063
6072
  }
6064
6073
  function step(op) {
6065
6074
  if (f) throw new TypeError("Generator is already executing.");
6066
- while (_) {
6075
+ while (g && (g = 0, op[0] && (_ = 0)), _) {
6067
6076
  try {
6068
6077
  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;
6069
6078
  if (y = 0, t) op = [op[0] & 2, t.value];
@@ -6461,6 +6470,407 @@ exports.createAutoReconnectingSocket = createAutoReconnectingSocket;
6461
6470
 
6462
6471
  /***/ }),
6463
6472
 
6473
+ /***/ "./node_modules/@signageos/lib/es6/Lock/lockedDecorator.js":
6474
+ /*!*****************************************************************!*\
6475
+ !*** ./node_modules/@signageos/lib/es6/Lock/lockedDecorator.js ***!
6476
+ \*****************************************************************/
6477
+ /*! no static exports found */
6478
+ /***/ (function(module, exports, __webpack_require__) {
6479
+
6480
+ "use strict";
6481
+
6482
+
6483
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
6484
+ function adopt(value) {
6485
+ return value instanceof P ? value : new P(function (resolve) {
6486
+ resolve(value);
6487
+ });
6488
+ }
6489
+ return new (P || (P = Promise))(function (resolve, reject) {
6490
+ function fulfilled(value) {
6491
+ try {
6492
+ step(generator.next(value));
6493
+ } catch (e) {
6494
+ reject(e);
6495
+ }
6496
+ }
6497
+ function rejected(value) {
6498
+ try {
6499
+ step(generator["throw"](value));
6500
+ } catch (e) {
6501
+ reject(e);
6502
+ }
6503
+ }
6504
+ function step(result) {
6505
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
6506
+ }
6507
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
6508
+ });
6509
+ };
6510
+ Object.defineProperty(exports, "__esModule", {
6511
+ value: true
6512
+ });
6513
+ exports.locked = void 0;
6514
+ var AsyncLock = __webpack_require__(/*! async-lock */ "./node_modules/@signageos/lib/node_modules/async-lock/index.js");
6515
+ var util = __webpack_require__(/*! util */ "./node_modules/util/util.js");
6516
+ var globalAsyncLock = new AsyncLock();
6517
+ var asyncLocksMap = new WeakMap();
6518
+ function acquireAsyncLock(options, instance) {
6519
+ if ((options === null || options === void 0 ? void 0 : options.scope) === undefined || (options === null || options === void 0 ? void 0 : options.scope) === 'global') {
6520
+ return globalAsyncLock;
6521
+ } else if ((options === null || options === void 0 ? void 0 : options.scope) === 'instance') {
6522
+ if (asyncLocksMap.has(instance)) {
6523
+ var lock = asyncLocksMap.get(instance);
6524
+ lock.countRunning++;
6525
+ return lock.asyncLock;
6526
+ } else {
6527
+ var asyncLock = new AsyncLock();
6528
+ asyncLocksMap.set(instance, {
6529
+ countRunning: 1,
6530
+ asyncLock: asyncLock
6531
+ });
6532
+ return asyncLock;
6533
+ }
6534
+ }
6535
+ throw new Error("Invalid option scope=".concat(options === null || options === void 0 ? void 0 : options.scope));
6536
+ }
6537
+ function releaseAsyncLock(options, instance) {
6538
+ if ((options === null || options === void 0 ? void 0 : options.scope) === 'instance') {
6539
+ var lock = asyncLocksMap.get(instance);
6540
+ lock.countRunning--;
6541
+ if (lock.countRunning === 0) {
6542
+ asyncLocksMap["delete"](instance);
6543
+ }
6544
+ }
6545
+ }
6546
+ function locked(keyInitiator, options) {
6547
+ return function (_target, _propertyKey, descriptor) {
6548
+ var originalMethod = descriptor.value;
6549
+ descriptor.value = function () {
6550
+ var _this = this;
6551
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
6552
+ args[_key] = arguments[_key];
6553
+ }
6554
+ var key = typeof keyInitiator === 'function' ? keyInitiator.call.apply(keyInitiator, [this].concat(args)) : keyInitiator;
6555
+ var currentAsyncLock = acquireAsyncLock(options, this);
6556
+ return currentAsyncLock.acquire(key, function () {
6557
+ return __awaiter(_this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
6558
+ var returnValuePromise;
6559
+ return regeneratorRuntime.wrap(function _callee$(_context) {
6560
+ while (1) {
6561
+ switch (_context.prev = _context.next) {
6562
+ case 0:
6563
+ returnValuePromise = originalMethod.apply(this, args);
6564
+ if (returnValuePromise instanceof Promise) {
6565
+ _context.next = 3;
6566
+ break;
6567
+ }
6568
+ throw new Error("Synchronous methods must return Promise instance. But ".concat(util.inspect(returnValuePromise), " given."));
6569
+ case 3:
6570
+ _context.next = 5;
6571
+ return returnValuePromise;
6572
+ case 5:
6573
+ return _context.abrupt("return", _context.sent);
6574
+ case 6:
6575
+ case "end":
6576
+ return _context.stop();
6577
+ }
6578
+ }
6579
+ }, _callee, this);
6580
+ }));
6581
+ }, options)["finally"](function () {
6582
+ return releaseAsyncLock(options, _this);
6583
+ });
6584
+ };
6585
+ };
6586
+ }
6587
+ exports.locked = locked;
6588
+
6589
+ /***/ }),
6590
+
6591
+ /***/ "./node_modules/@signageos/lib/node_modules/async-lock/index.js":
6592
+ /*!**********************************************************************!*\
6593
+ !*** ./node_modules/@signageos/lib/node_modules/async-lock/index.js ***!
6594
+ \**********************************************************************/
6595
+ /*! no static exports found */
6596
+ /***/ (function(module, exports, __webpack_require__) {
6597
+
6598
+ "use strict";
6599
+
6600
+ module.exports = __webpack_require__(/*! ./lib */ "./node_modules/@signageos/lib/node_modules/async-lock/lib/index.js");
6601
+
6602
+
6603
+ /***/ }),
6604
+
6605
+ /***/ "./node_modules/@signageos/lib/node_modules/async-lock/lib/index.js":
6606
+ /*!**************************************************************************!*\
6607
+ !*** ./node_modules/@signageos/lib/node_modules/async-lock/lib/index.js ***!
6608
+ \**************************************************************************/
6609
+ /*! no static exports found */
6610
+ /***/ (function(module, exports, __webpack_require__) {
6611
+
6612
+ "use strict";
6613
+ /* WEBPACK VAR INJECTION */(function(process) {
6614
+
6615
+ var AsyncLock = function (opts) {
6616
+ opts = opts || {};
6617
+
6618
+ this.Promise = opts.Promise || Promise;
6619
+
6620
+ // format: {key : [fn, fn]}
6621
+ // queues[key] = null indicates no job running for key
6622
+ this.queues = {};
6623
+
6624
+ // domain of current running func {key : fn}
6625
+ this.domains = {};
6626
+
6627
+ // lock is reentrant for same domain
6628
+ this.domainReentrant = opts.domainReentrant || false;
6629
+
6630
+ this.timeout = opts.timeout || AsyncLock.DEFAULT_TIMEOUT;
6631
+ this.maxPending = opts.maxPending || AsyncLock.DEFAULT_MAX_PENDING;
6632
+ };
6633
+
6634
+ AsyncLock.DEFAULT_TIMEOUT = 0; //Never
6635
+ AsyncLock.DEFAULT_MAX_PENDING = 1000;
6636
+
6637
+ /**
6638
+ * Acquire Locks
6639
+ *
6640
+ * @param {String|Array} key resource key or keys to lock
6641
+ * @param {function} fn async function
6642
+ * @param {function} cb callback function, otherwise will return a promise
6643
+ * @param {Object} opts options
6644
+ */
6645
+ AsyncLock.prototype.acquire = function (key, fn, cb, opts) {
6646
+ if (Array.isArray(key)) {
6647
+ return this._acquireBatch(key, fn, cb, opts);
6648
+ }
6649
+
6650
+ if (typeof (fn) !== 'function') {
6651
+ throw new Error('You must pass a function to execute');
6652
+ }
6653
+
6654
+ // faux-deferred promise using new Promise() (as Promise.defer is deprecated)
6655
+ var deferredResolve = null;
6656
+ var deferredReject = null;
6657
+ var deferred = null;
6658
+
6659
+ if (typeof (cb) !== 'function') {
6660
+ opts = cb;
6661
+ cb = null;
6662
+
6663
+ // will return a promise
6664
+ deferred = new this.Promise((resolve, reject) => {
6665
+ deferredResolve = resolve;
6666
+ deferredReject = reject;
6667
+ });
6668
+ }
6669
+
6670
+ opts = opts || {};
6671
+
6672
+ var resolved = false;
6673
+ var timer = null;
6674
+ var self = this;
6675
+
6676
+ var done = function (locked, err, ret) {
6677
+ if (locked) {
6678
+ if (self.queues[key].length === 0) {
6679
+ delete self.queues[key];
6680
+ }
6681
+ delete self.domains[key];
6682
+ }
6683
+
6684
+ if (!resolved) {
6685
+ if (!deferred) {
6686
+ if (typeof (cb) === 'function') {
6687
+ cb(err, ret);
6688
+ }
6689
+ }
6690
+ else {
6691
+ //promise mode
6692
+ if (err) {
6693
+ deferredReject(err);
6694
+ }
6695
+ else {
6696
+ deferredResolve(ret);
6697
+ }
6698
+ }
6699
+ resolved = true;
6700
+ }
6701
+
6702
+ if (locked) {
6703
+ //run next func
6704
+ if (!!self.queues[key] && self.queues[key].length > 0) {
6705
+ self.queues[key].shift()();
6706
+ }
6707
+ }
6708
+ };
6709
+
6710
+ var exec = function (locked) {
6711
+ if (resolved) { // may due to timed out
6712
+ return done(locked);
6713
+ }
6714
+
6715
+ if (timer) {
6716
+ clearTimeout(timer);
6717
+ timer = null;
6718
+ }
6719
+
6720
+ if (locked) {
6721
+ self.domains[key] = process.domain;
6722
+ }
6723
+
6724
+ // Callback mode
6725
+ if (fn.length === 1) {
6726
+ var called = false;
6727
+ fn(function (err, ret) {
6728
+ if (!called) {
6729
+ called = true;
6730
+ done(locked, err, ret);
6731
+ }
6732
+ });
6733
+ }
6734
+ else {
6735
+ // Promise mode
6736
+ self._promiseTry(function () {
6737
+ return fn();
6738
+ })
6739
+ .then(function(ret){
6740
+ done(locked, undefined, ret);
6741
+ }, function(error){
6742
+ done(locked, error);
6743
+ });
6744
+ }
6745
+ };
6746
+ if (!!process.domain) {
6747
+ exec = process.domain.bind(exec);
6748
+ }
6749
+
6750
+ if (!self.queues[key]) {
6751
+ self.queues[key] = [];
6752
+ exec(true);
6753
+ }
6754
+ else if (self.domainReentrant && !!process.domain && process.domain === self.domains[key]) {
6755
+ // If code is in the same domain of current running task, run it directly
6756
+ // Since lock is re-enterable
6757
+ exec(false);
6758
+ }
6759
+ else if (self.queues[key].length >= self.maxPending) {
6760
+ done(false, new Error('Too much pending tasks'));
6761
+ }
6762
+ else {
6763
+ var taskFn = function () {
6764
+ exec(true);
6765
+ };
6766
+ if (opts.skipQueue) {
6767
+ self.queues[key].unshift(taskFn);
6768
+ } else {
6769
+ self.queues[key].push(taskFn);
6770
+ }
6771
+
6772
+ var timeout = opts.timeout || self.timeout;
6773
+ if (timeout) {
6774
+ timer = setTimeout(function () {
6775
+ timer = null;
6776
+ done(false, new Error('async-lock timed out'));
6777
+ }, timeout);
6778
+ }
6779
+ }
6780
+
6781
+ if (deferred) {
6782
+ return deferred;
6783
+ }
6784
+ };
6785
+
6786
+ /*
6787
+ * Below is how this function works:
6788
+ *
6789
+ * Equivalent code:
6790
+ * self.acquire(key1, function(cb){
6791
+ * self.acquire(key2, function(cb){
6792
+ * self.acquire(key3, fn, cb);
6793
+ * }, cb);
6794
+ * }, cb);
6795
+ *
6796
+ * Equivalent code:
6797
+ * var fn3 = getFn(key3, fn);
6798
+ * var fn2 = getFn(key2, fn3);
6799
+ * var fn1 = getFn(key1, fn2);
6800
+ * fn1(cb);
6801
+ */
6802
+ AsyncLock.prototype._acquireBatch = function (keys, fn, cb, opts) {
6803
+ if (typeof (cb) !== 'function') {
6804
+ opts = cb;
6805
+ cb = null;
6806
+ }
6807
+
6808
+ var self = this;
6809
+ var getFn = function (key, fn) {
6810
+ return function (cb) {
6811
+ self.acquire(key, fn, cb, opts);
6812
+ };
6813
+ };
6814
+
6815
+ var fnx = fn;
6816
+ keys.reverse().forEach(function (key) {
6817
+ fnx = getFn(key, fnx);
6818
+ });
6819
+
6820
+ if (typeof (cb) === 'function') {
6821
+ fnx(cb);
6822
+ }
6823
+ else {
6824
+ return new this.Promise((resolve, reject) => {
6825
+ // check for promise mode in case keys is empty array
6826
+ if (fnx.length === 1) {
6827
+ fnx(function (err, ret) {
6828
+ if (err) {
6829
+ reject(err);
6830
+ }
6831
+ else {
6832
+ resolve(ret);
6833
+ }
6834
+ });
6835
+ } else {
6836
+ resolve(fnx());
6837
+ }
6838
+ });
6839
+ }
6840
+ };
6841
+
6842
+ /*
6843
+ * Whether there is any running or pending asyncFunc
6844
+ *
6845
+ * @param {String} key
6846
+ */
6847
+ AsyncLock.prototype.isBusy = function (key) {
6848
+ if (!key) {
6849
+ return Object.keys(this.queues).length > 0;
6850
+ }
6851
+ else {
6852
+ return !!this.queues[key];
6853
+ }
6854
+ };
6855
+
6856
+ /**
6857
+ * Promise.try() implementation to become independent of Q-specific methods
6858
+ */
6859
+ AsyncLock.prototype._promiseTry = function(fn) {
6860
+ try {
6861
+ return this.Promise.resolve(fn());
6862
+ } catch (e) {
6863
+ return this.Promise.reject(e);
6864
+ }
6865
+ };
6866
+
6867
+ module.exports = AsyncLock;
6868
+
6869
+
6870
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../process/browser.js */ "./node_modules/process/browser.js")))
6871
+
6872
+ /***/ }),
6873
+
6464
6874
  /***/ "./node_modules/@signageos/lib/node_modules/moment-timezone/data/packed/latest.json":
6465
6875
  /*!******************************************************************************************!*\
6466
6876
  !*** ./node_modules/@signageos/lib/node_modules/moment-timezone/data/packed/latest.json ***!
@@ -143231,6 +143641,636 @@ function config(name) {
143231
143641
 
143232
143642
  /***/ }),
143233
143643
 
143644
+ /***/ "./node_modules/util/support/isBufferBrowser.js":
143645
+ /*!******************************************************!*\
143646
+ !*** ./node_modules/util/support/isBufferBrowser.js ***!
143647
+ \******************************************************/
143648
+ /*! no static exports found */
143649
+ /***/ (function(module, exports) {
143650
+
143651
+ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
143652
+ module.exports = function isBuffer(arg) {
143653
+ return arg && _typeof(arg) === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.readUInt8 === 'function';
143654
+ };
143655
+
143656
+ /***/ }),
143657
+
143658
+ /***/ "./node_modules/util/util.js":
143659
+ /*!***********************************!*\
143660
+ !*** ./node_modules/util/util.js ***!
143661
+ \***********************************/
143662
+ /*! no static exports found */
143663
+ /***/ (function(module, exports, __webpack_require__) {
143664
+
143665
+ /* WEBPACK VAR INJECTION */(function(process) {function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
143666
+ // Copyright Joyent, Inc. and other Node contributors.
143667
+ //
143668
+ // Permission is hereby granted, free of charge, to any person obtaining a
143669
+ // copy of this software and associated documentation files (the
143670
+ // "Software"), to deal in the Software without restriction, including
143671
+ // without limitation the rights to use, copy, modify, merge, publish,
143672
+ // distribute, sublicense, and/or sell copies of the Software, and to permit
143673
+ // persons to whom the Software is furnished to do so, subject to the
143674
+ // following conditions:
143675
+ //
143676
+ // The above copyright notice and this permission notice shall be included
143677
+ // in all copies or substantial portions of the Software.
143678
+ //
143679
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
143680
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
143681
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
143682
+ // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
143683
+ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
143684
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
143685
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
143686
+
143687
+ var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(obj) {
143688
+ var keys = Object.keys(obj);
143689
+ var descriptors = {};
143690
+ for (var i = 0; i < keys.length; i++) {
143691
+ descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);
143692
+ }
143693
+ return descriptors;
143694
+ };
143695
+ var formatRegExp = /%[sdj%]/g;
143696
+ exports.format = function (f) {
143697
+ if (!isString(f)) {
143698
+ var objects = [];
143699
+ for (var i = 0; i < arguments.length; i++) {
143700
+ objects.push(inspect(arguments[i]));
143701
+ }
143702
+ return objects.join(' ');
143703
+ }
143704
+ var i = 1;
143705
+ var args = arguments;
143706
+ var len = args.length;
143707
+ var str = String(f).replace(formatRegExp, function (x) {
143708
+ if (x === '%%') return '%';
143709
+ if (i >= len) return x;
143710
+ switch (x) {
143711
+ case '%s':
143712
+ return String(args[i++]);
143713
+ case '%d':
143714
+ return Number(args[i++]);
143715
+ case '%j':
143716
+ try {
143717
+ return JSON.stringify(args[i++]);
143718
+ } catch (_) {
143719
+ return '[Circular]';
143720
+ }
143721
+ default:
143722
+ return x;
143723
+ }
143724
+ });
143725
+ for (var x = args[i]; i < len; x = args[++i]) {
143726
+ if (isNull(x) || !isObject(x)) {
143727
+ str += ' ' + x;
143728
+ } else {
143729
+ str += ' ' + inspect(x);
143730
+ }
143731
+ }
143732
+ return str;
143733
+ };
143734
+
143735
+ // Mark that a method should not be used.
143736
+ // Returns a modified function which warns once by default.
143737
+ // If --no-deprecation is set, then it is a no-op.
143738
+ exports.deprecate = function (fn, msg) {
143739
+ if (typeof process !== 'undefined' && process.noDeprecation === true) {
143740
+ return fn;
143741
+ }
143742
+
143743
+ // Allow for deprecating things in the process of starting up.
143744
+ if (typeof process === 'undefined') {
143745
+ return function () {
143746
+ return exports.deprecate(fn, msg).apply(this, arguments);
143747
+ };
143748
+ }
143749
+ var warned = false;
143750
+ function deprecated() {
143751
+ if (!warned) {
143752
+ if (process.throwDeprecation) {
143753
+ throw new Error(msg);
143754
+ } else if (process.traceDeprecation) {
143755
+ console.trace(msg);
143756
+ } else {
143757
+ console.error(msg);
143758
+ }
143759
+ warned = true;
143760
+ }
143761
+ return fn.apply(this, arguments);
143762
+ }
143763
+ return deprecated;
143764
+ };
143765
+ var debugs = {};
143766
+ var debugEnviron;
143767
+ exports.debuglog = function (set) {
143768
+ if (isUndefined(debugEnviron)) debugEnviron = process.env.NODE_DEBUG || '';
143769
+ set = set.toUpperCase();
143770
+ if (!debugs[set]) {
143771
+ if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
143772
+ var pid = process.pid;
143773
+ debugs[set] = function () {
143774
+ var msg = exports.format.apply(exports, arguments);
143775
+ console.error('%s %d: %s', set, pid, msg);
143776
+ };
143777
+ } else {
143778
+ debugs[set] = function () {};
143779
+ }
143780
+ }
143781
+ return debugs[set];
143782
+ };
143783
+
143784
+ /**
143785
+ * Echos the value of a value. Trys to print the value out
143786
+ * in the best way possible given the different types.
143787
+ *
143788
+ * @param {Object} obj The object to print out.
143789
+ * @param {Object} opts Optional options object that alters the output.
143790
+ */
143791
+ /* legacy: obj, showHidden, depth, colors*/
143792
+ function inspect(obj, opts) {
143793
+ // default options
143794
+ var ctx = {
143795
+ seen: [],
143796
+ stylize: stylizeNoColor
143797
+ };
143798
+ // legacy...
143799
+ if (arguments.length >= 3) ctx.depth = arguments[2];
143800
+ if (arguments.length >= 4) ctx.colors = arguments[3];
143801
+ if (isBoolean(opts)) {
143802
+ // legacy...
143803
+ ctx.showHidden = opts;
143804
+ } else if (opts) {
143805
+ // got an "options" object
143806
+ exports._extend(ctx, opts);
143807
+ }
143808
+ // set default options
143809
+ if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
143810
+ if (isUndefined(ctx.depth)) ctx.depth = 2;
143811
+ if (isUndefined(ctx.colors)) ctx.colors = false;
143812
+ if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
143813
+ if (ctx.colors) ctx.stylize = stylizeWithColor;
143814
+ return formatValue(ctx, obj, ctx.depth);
143815
+ }
143816
+ exports.inspect = inspect;
143817
+
143818
+ // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
143819
+ inspect.colors = {
143820
+ 'bold': [1, 22],
143821
+ 'italic': [3, 23],
143822
+ 'underline': [4, 24],
143823
+ 'inverse': [7, 27],
143824
+ 'white': [37, 39],
143825
+ 'grey': [90, 39],
143826
+ 'black': [30, 39],
143827
+ 'blue': [34, 39],
143828
+ 'cyan': [36, 39],
143829
+ 'green': [32, 39],
143830
+ 'magenta': [35, 39],
143831
+ 'red': [31, 39],
143832
+ 'yellow': [33, 39]
143833
+ };
143834
+
143835
+ // Don't use 'blue' not visible on cmd.exe
143836
+ inspect.styles = {
143837
+ 'special': 'cyan',
143838
+ 'number': 'yellow',
143839
+ 'boolean': 'yellow',
143840
+ 'undefined': 'grey',
143841
+ 'null': 'bold',
143842
+ 'string': 'green',
143843
+ 'date': 'magenta',
143844
+ // "name": intentionally not styling
143845
+ 'regexp': 'red'
143846
+ };
143847
+ function stylizeWithColor(str, styleType) {
143848
+ var style = inspect.styles[styleType];
143849
+ if (style) {
143850
+ return "\x1B[" + inspect.colors[style][0] + 'm' + str + "\x1B[" + inspect.colors[style][1] + 'm';
143851
+ } else {
143852
+ return str;
143853
+ }
143854
+ }
143855
+ function stylizeNoColor(str, styleType) {
143856
+ return str;
143857
+ }
143858
+ function arrayToHash(array) {
143859
+ var hash = {};
143860
+ array.forEach(function (val, idx) {
143861
+ hash[val] = true;
143862
+ });
143863
+ return hash;
143864
+ }
143865
+ function formatValue(ctx, value, recurseTimes) {
143866
+ // Provide a hook for user-specified inspect functions.
143867
+ // Check that value is an object with an inspect function on it
143868
+ if (ctx.customInspect && value && isFunction(value.inspect) &&
143869
+ // Filter out the util module, it's inspect function is special
143870
+ value.inspect !== exports.inspect &&
143871
+ // Also filter out any prototype objects using the circular check.
143872
+ !(value.constructor && value.constructor.prototype === value)) {
143873
+ var ret = value.inspect(recurseTimes, ctx);
143874
+ if (!isString(ret)) {
143875
+ ret = formatValue(ctx, ret, recurseTimes);
143876
+ }
143877
+ return ret;
143878
+ }
143879
+
143880
+ // Primitive types cannot have properties
143881
+ var primitive = formatPrimitive(ctx, value);
143882
+ if (primitive) {
143883
+ return primitive;
143884
+ }
143885
+
143886
+ // Look up the keys of the object.
143887
+ var keys = Object.keys(value);
143888
+ var visibleKeys = arrayToHash(keys);
143889
+ if (ctx.showHidden) {
143890
+ keys = Object.getOwnPropertyNames(value);
143891
+ }
143892
+
143893
+ // IE doesn't make error fields non-enumerable
143894
+ // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
143895
+ if (isError(value) && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
143896
+ return formatError(value);
143897
+ }
143898
+
143899
+ // Some type of object without properties can be shortcutted.
143900
+ if (keys.length === 0) {
143901
+ if (isFunction(value)) {
143902
+ var name = value.name ? ': ' + value.name : '';
143903
+ return ctx.stylize('[Function' + name + ']', 'special');
143904
+ }
143905
+ if (isRegExp(value)) {
143906
+ return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
143907
+ }
143908
+ if (isDate(value)) {
143909
+ return ctx.stylize(Date.prototype.toString.call(value), 'date');
143910
+ }
143911
+ if (isError(value)) {
143912
+ return formatError(value);
143913
+ }
143914
+ }
143915
+ var base = '',
143916
+ array = false,
143917
+ braces = ['{', '}'];
143918
+
143919
+ // Make Array say that they are Array
143920
+ if (isArray(value)) {
143921
+ array = true;
143922
+ braces = ['[', ']'];
143923
+ }
143924
+
143925
+ // Make functions say that they are functions
143926
+ if (isFunction(value)) {
143927
+ var n = value.name ? ': ' + value.name : '';
143928
+ base = ' [Function' + n + ']';
143929
+ }
143930
+
143931
+ // Make RegExps say that they are RegExps
143932
+ if (isRegExp(value)) {
143933
+ base = ' ' + RegExp.prototype.toString.call(value);
143934
+ }
143935
+
143936
+ // Make dates with properties first say the date
143937
+ if (isDate(value)) {
143938
+ base = ' ' + Date.prototype.toUTCString.call(value);
143939
+ }
143940
+
143941
+ // Make error with message first say the error
143942
+ if (isError(value)) {
143943
+ base = ' ' + formatError(value);
143944
+ }
143945
+ if (keys.length === 0 && (!array || value.length == 0)) {
143946
+ return braces[0] + base + braces[1];
143947
+ }
143948
+ if (recurseTimes < 0) {
143949
+ if (isRegExp(value)) {
143950
+ return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
143951
+ } else {
143952
+ return ctx.stylize('[Object]', 'special');
143953
+ }
143954
+ }
143955
+ ctx.seen.push(value);
143956
+ var output;
143957
+ if (array) {
143958
+ output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
143959
+ } else {
143960
+ output = keys.map(function (key) {
143961
+ return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
143962
+ });
143963
+ }
143964
+ ctx.seen.pop();
143965
+ return reduceToSingleString(output, base, braces);
143966
+ }
143967
+ function formatPrimitive(ctx, value) {
143968
+ if (isUndefined(value)) return ctx.stylize('undefined', 'undefined');
143969
+ if (isString(value)) {
143970
+ var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '').replace(/'/g, "\\'").replace(/\\"/g, '"') + '\'';
143971
+ return ctx.stylize(simple, 'string');
143972
+ }
143973
+ if (isNumber(value)) return ctx.stylize('' + value, 'number');
143974
+ if (isBoolean(value)) return ctx.stylize('' + value, 'boolean');
143975
+ // For some reason typeof null is "object", so special case here.
143976
+ if (isNull(value)) return ctx.stylize('null', 'null');
143977
+ }
143978
+ function formatError(value) {
143979
+ return '[' + Error.prototype.toString.call(value) + ']';
143980
+ }
143981
+ function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
143982
+ var output = [];
143983
+ for (var i = 0, l = value.length; i < l; ++i) {
143984
+ if (hasOwnProperty(value, String(i))) {
143985
+ output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true));
143986
+ } else {
143987
+ output.push('');
143988
+ }
143989
+ }
143990
+ keys.forEach(function (key) {
143991
+ if (!key.match(/^\d+$/)) {
143992
+ output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true));
143993
+ }
143994
+ });
143995
+ return output;
143996
+ }
143997
+ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
143998
+ var name, str, desc;
143999
+ desc = Object.getOwnPropertyDescriptor(value, key) || {
144000
+ value: value[key]
144001
+ };
144002
+ if (desc.get) {
144003
+ if (desc.set) {
144004
+ str = ctx.stylize('[Getter/Setter]', 'special');
144005
+ } else {
144006
+ str = ctx.stylize('[Getter]', 'special');
144007
+ }
144008
+ } else {
144009
+ if (desc.set) {
144010
+ str = ctx.stylize('[Setter]', 'special');
144011
+ }
144012
+ }
144013
+ if (!hasOwnProperty(visibleKeys, key)) {
144014
+ name = '[' + key + ']';
144015
+ }
144016
+ if (!str) {
144017
+ if (ctx.seen.indexOf(desc.value) < 0) {
144018
+ if (isNull(recurseTimes)) {
144019
+ str = formatValue(ctx, desc.value, null);
144020
+ } else {
144021
+ str = formatValue(ctx, desc.value, recurseTimes - 1);
144022
+ }
144023
+ if (str.indexOf('\n') > -1) {
144024
+ if (array) {
144025
+ str = str.split('\n').map(function (line) {
144026
+ return ' ' + line;
144027
+ }).join('\n').substr(2);
144028
+ } else {
144029
+ str = '\n' + str.split('\n').map(function (line) {
144030
+ return ' ' + line;
144031
+ }).join('\n');
144032
+ }
144033
+ }
144034
+ } else {
144035
+ str = ctx.stylize('[Circular]', 'special');
144036
+ }
144037
+ }
144038
+ if (isUndefined(name)) {
144039
+ if (array && key.match(/^\d+$/)) {
144040
+ return str;
144041
+ }
144042
+ name = JSON.stringify('' + key);
144043
+ if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
144044
+ name = name.substr(1, name.length - 2);
144045
+ name = ctx.stylize(name, 'name');
144046
+ } else {
144047
+ name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
144048
+ name = ctx.stylize(name, 'string');
144049
+ }
144050
+ }
144051
+ return name + ': ' + str;
144052
+ }
144053
+ function reduceToSingleString(output, base, braces) {
144054
+ var numLinesEst = 0;
144055
+ var length = output.reduce(function (prev, cur) {
144056
+ numLinesEst++;
144057
+ if (cur.indexOf('\n') >= 0) numLinesEst++;
144058
+ return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
144059
+ }, 0);
144060
+ if (length > 60) {
144061
+ return braces[0] + (base === '' ? '' : base + '\n ') + ' ' + output.join(',\n ') + ' ' + braces[1];
144062
+ }
144063
+ return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
144064
+ }
144065
+
144066
+ // NOTE: These type checking functions intentionally don't use `instanceof`
144067
+ // because it is fragile and can be easily faked with `Object.create()`.
144068
+ function isArray(ar) {
144069
+ return Array.isArray(ar);
144070
+ }
144071
+ exports.isArray = isArray;
144072
+ function isBoolean(arg) {
144073
+ return typeof arg === 'boolean';
144074
+ }
144075
+ exports.isBoolean = isBoolean;
144076
+ function isNull(arg) {
144077
+ return arg === null;
144078
+ }
144079
+ exports.isNull = isNull;
144080
+ function isNullOrUndefined(arg) {
144081
+ return arg == null;
144082
+ }
144083
+ exports.isNullOrUndefined = isNullOrUndefined;
144084
+ function isNumber(arg) {
144085
+ return typeof arg === 'number';
144086
+ }
144087
+ exports.isNumber = isNumber;
144088
+ function isString(arg) {
144089
+ return typeof arg === 'string';
144090
+ }
144091
+ exports.isString = isString;
144092
+ function isSymbol(arg) {
144093
+ return _typeof(arg) === 'symbol';
144094
+ }
144095
+ exports.isSymbol = isSymbol;
144096
+ function isUndefined(arg) {
144097
+ return arg === void 0;
144098
+ }
144099
+ exports.isUndefined = isUndefined;
144100
+ function isRegExp(re) {
144101
+ return isObject(re) && objectToString(re) === '[object RegExp]';
144102
+ }
144103
+ exports.isRegExp = isRegExp;
144104
+ function isObject(arg) {
144105
+ return _typeof(arg) === 'object' && arg !== null;
144106
+ }
144107
+ exports.isObject = isObject;
144108
+ function isDate(d) {
144109
+ return isObject(d) && objectToString(d) === '[object Date]';
144110
+ }
144111
+ exports.isDate = isDate;
144112
+ function isError(e) {
144113
+ return isObject(e) && (objectToString(e) === '[object Error]' || e instanceof Error);
144114
+ }
144115
+ exports.isError = isError;
144116
+ function isFunction(arg) {
144117
+ return typeof arg === 'function';
144118
+ }
144119
+ exports.isFunction = isFunction;
144120
+ function isPrimitive(arg) {
144121
+ return arg === null || typeof arg === 'boolean' || typeof arg === 'number' || typeof arg === 'string' || _typeof(arg) === 'symbol' ||
144122
+ // ES6 symbol
144123
+ typeof arg === 'undefined';
144124
+ }
144125
+ exports.isPrimitive = isPrimitive;
144126
+ exports.isBuffer = __webpack_require__(/*! ./support/isBuffer */ "./node_modules/util/support/isBufferBrowser.js");
144127
+ function objectToString(o) {
144128
+ return Object.prototype.toString.call(o);
144129
+ }
144130
+ function pad(n) {
144131
+ return n < 10 ? '0' + n.toString(10) : n.toString(10);
144132
+ }
144133
+ var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
144134
+
144135
+ // 26 Feb 16:19:34
144136
+ function timestamp() {
144137
+ var d = new Date();
144138
+ var time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(':');
144139
+ return [d.getDate(), months[d.getMonth()], time].join(' ');
144140
+ }
144141
+
144142
+ // log is just a thin wrapper to console.log that prepends a timestamp
144143
+ exports.log = function () {
144144
+ console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
144145
+ };
144146
+
144147
+ /**
144148
+ * Inherit the prototype methods from one constructor into another.
144149
+ *
144150
+ * The Function.prototype.inherits from lang.js rewritten as a standalone
144151
+ * function (not on Function.prototype). NOTE: If this file is to be loaded
144152
+ * during bootstrapping this function needs to be rewritten using some native
144153
+ * functions as prototype setup using normal JavaScript does not work as
144154
+ * expected during bootstrapping (see mirror.js in r114903).
144155
+ *
144156
+ * @param {function} ctor Constructor function which needs to inherit the
144157
+ * prototype.
144158
+ * @param {function} superCtor Constructor function to inherit prototype from.
144159
+ */
144160
+ exports.inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js");
144161
+ exports._extend = function (origin, add) {
144162
+ // Don't do anything if add isn't an object
144163
+ if (!add || !isObject(add)) return origin;
144164
+ var keys = Object.keys(add);
144165
+ var i = keys.length;
144166
+ while (i--) {
144167
+ origin[keys[i]] = add[keys[i]];
144168
+ }
144169
+ return origin;
144170
+ };
144171
+ function hasOwnProperty(obj, prop) {
144172
+ return Object.prototype.hasOwnProperty.call(obj, prop);
144173
+ }
144174
+ var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;
144175
+ exports.promisify = function promisify(original) {
144176
+ if (typeof original !== 'function') throw new TypeError('The "original" argument must be of type Function');
144177
+ if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
144178
+ var fn = original[kCustomPromisifiedSymbol];
144179
+ if (typeof fn !== 'function') {
144180
+ throw new TypeError('The "util.promisify.custom" argument must be of type Function');
144181
+ }
144182
+ Object.defineProperty(fn, kCustomPromisifiedSymbol, {
144183
+ value: fn,
144184
+ enumerable: false,
144185
+ writable: false,
144186
+ configurable: true
144187
+ });
144188
+ return fn;
144189
+ }
144190
+ function fn() {
144191
+ var promiseResolve, promiseReject;
144192
+ var promise = new Promise(function (resolve, reject) {
144193
+ promiseResolve = resolve;
144194
+ promiseReject = reject;
144195
+ });
144196
+ var args = [];
144197
+ for (var i = 0; i < arguments.length; i++) {
144198
+ args.push(arguments[i]);
144199
+ }
144200
+ args.push(function (err, value) {
144201
+ if (err) {
144202
+ promiseReject(err);
144203
+ } else {
144204
+ promiseResolve(value);
144205
+ }
144206
+ });
144207
+ try {
144208
+ original.apply(this, args);
144209
+ } catch (err) {
144210
+ promiseReject(err);
144211
+ }
144212
+ return promise;
144213
+ }
144214
+ Object.setPrototypeOf(fn, Object.getPrototypeOf(original));
144215
+ if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {
144216
+ value: fn,
144217
+ enumerable: false,
144218
+ writable: false,
144219
+ configurable: true
144220
+ });
144221
+ return Object.defineProperties(fn, getOwnPropertyDescriptors(original));
144222
+ };
144223
+ exports.promisify.custom = kCustomPromisifiedSymbol;
144224
+ function callbackifyOnRejected(reason, cb) {
144225
+ // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).
144226
+ // Because `null` is a special error value in callbacks which means "no error
144227
+ // occurred", we error-wrap so the callback consumer can distinguish between
144228
+ // "the promise rejected with null" or "the promise fulfilled with undefined".
144229
+ if (!reason) {
144230
+ var newReason = new Error('Promise was rejected with a falsy value');
144231
+ newReason.reason = reason;
144232
+ reason = newReason;
144233
+ }
144234
+ return cb(reason);
144235
+ }
144236
+ function callbackify(original) {
144237
+ if (typeof original !== 'function') {
144238
+ throw new TypeError('The "original" argument must be of type Function');
144239
+ }
144240
+
144241
+ // We DO NOT return the promise as it gives the user a false sense that
144242
+ // the promise is actually somehow related to the callback's execution
144243
+ // and that the callback throwing will reject the promise.
144244
+ function callbackified() {
144245
+ var args = [];
144246
+ for (var i = 0; i < arguments.length; i++) {
144247
+ args.push(arguments[i]);
144248
+ }
144249
+ var maybeCb = args.pop();
144250
+ if (typeof maybeCb !== 'function') {
144251
+ throw new TypeError('The last argument must be of type Function');
144252
+ }
144253
+ var self = this;
144254
+ var cb = function cb() {
144255
+ return maybeCb.apply(self, arguments);
144256
+ };
144257
+ // In true node style we process the callback on `nextTick` with all the
144258
+ // implications (stack, `uncaughtException`, `async_hooks`)
144259
+ original.apply(this, args).then(function (ret) {
144260
+ process.nextTick(cb, null, ret);
144261
+ }, function (rej) {
144262
+ process.nextTick(callbackifyOnRejected, rej, cb);
144263
+ });
144264
+ }
144265
+ Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));
144266
+ Object.defineProperties(callbackified, getOwnPropertyDescriptors(original));
144267
+ return callbackified;
144268
+ }
144269
+ exports.callbackify = callbackify;
144270
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../process/browser.js */ "./node_modules/process/browser.js")))
144271
+
144272
+ /***/ }),
144273
+
143234
144274
  /***/ "./node_modules/vm-browserify/index.js":
143235
144275
  /*!*********************************************!*\
143236
144276
  !*** ./node_modules/vm-browserify/index.js ***!
@@ -149544,7 +150584,7 @@ var mod = /*#__PURE__*/Object.freeze({
149544
150584
  /*! exports provided: name, version, main, files, scripts, husky, lint-staged, repository, devDependencies, dependencies, optionalDependencies, engines, engine-strict, publishConfig, author, license, default */
149545
150585
  /***/ (function(module) {
149546
150586
 
149547
- module.exports = JSON.parse("{\"name\":\"@signageos/front-display\",\"version\":\"11.3.2\",\"main\":\"dist/bundle.js\",\"files\":[\"dist\",\"README.md\",\"CHANGELOG.md\",\"package.json\"],\"scripts\":{\"build\":\"check-engine && npm run build-webworker && npm run build-client && npm run build-es6\",\"build-client\":\"webpack --config=webpack.config.ts\",\"build-webworker\":\"webpack --config=webpack.webworker.config.ts\",\"build-es6\":\"tsc -p tsconfig.es6.json && node tools/copy-es6.js\",\"develop\":\"check-engine && webpack-dev-server --mode development --config=webpack.config.ts\",\"docker\":\"docker run -it --rm -v $PWD:/src -w /src -e NPM_AUTH_TOKEN=$NPM_AUTH_TOKEN -e NPM_REGISTRY_URL=$NPM_REGISTRY_URL -e NPM_REGISTRY_HOST=$NPM_REGISTRY_HOST 172396373649.dkr.ecr.eu-central-1.amazonaws.com/signageos/docker-node:16-alpine-build bash\",\"prebuild\":\"mkdir -p dist && rm -rf dist/* es6/* && npm rebuild @serialport/bindings\",\"prepare\":\"npm run prebuild && npm run build\",\"test\":\"check-engine && env NODE_ENV=test ISOMORPHIC_TARGET=node mocha --opts mocha.opts\",\"test-browser\":\"check-engine && karma start\",\"lint\":\"npm run lint-client && npm run lint-webworker\",\"lint-client\":\"tslint --config node_modules/@signageos/codestyle/tslint.json --type-check --project tsconfig.json\",\"lint-webworker\":\"tslint --config node_modules/@signageos/codestyle/tslint.json --type-check --project tsconfig.webworker.json\",\"lint-fix\":\"tslint --config node_modules/@signageos/codestyle/tslint.json --fix {src,test}/**/*.{ts,tsx}\",\"escheck\":\"es-check --module es5 dist/*.js\",\"check\":\"npm run depcheck && npx --userconfig ./.npmrc @signageos/lib check-deps '.+' 'html2canvas|weinre|extract-text-webpack-plugin'\",\"depcheck\":\"depcheck --config .depcheckrc.json\"},\"husky\":{\"hooks\":{\"pre-commit\":\"lint-staged\"}},\"lint-staged\":{\"src/**/*.{tsx,ts,js,jsx}\":[\"npm run lint-fix\",\"git add\"]},\"repository\":{\"url\":\"git@gitlab.com:signageos/front-display\",\"type\":\"git\"},\"devDependencies\":{\"@babel/core\":\"7.6.0\",\"@babel/preset-env\":\"7.6.0\",\"@serialport/binding-mock\":\"9.2.4\",\"@signageos/codestyle\":\"0.0.22\",\"@signageos/front-osd\":\"0.5.3\",\"@types/async-lock\":\"0.0.19\",\"@types/classnames\":\"2.2.3\",\"@types/cron\":\"1.3.0\",\"@types/debug\":\"4.1.5\",\"@types/faker\":\"4.1.1\",\"@types/filesystem\":\"0.0.29\",\"@types/html2canvas\":\"0.5.35\",\"@types/is-online\":\"8.1.0\",\"@types/js-cookie\":\"2.0.28\",\"@types/jsdom\":\"11.0.6\",\"@types/jsrsasign\":\"8.0.7\",\"@types/lodash\":\"4.14.116\",\"@types/mocha\":\"2.2.41\",\"@types/node\":\"16.18.3\",\"@types/node-fetch\":\"2.5.7\",\"@types/parse5\":\"4.0.0\",\"@types/promise.allsettled\":\"1.0.1\",\"@types/react\":\"16.8.23\",\"@types/react-dom\":\"16.8.5\",\"@types/react-redux\":\"4.4.45\",\"@types/serialport\":\"8.0.2\",\"@types/serviceworker\":\"0.0.55\",\"@types/should\":\"13.0.0\",\"@types/should-sinon\":\"0.0.5\",\"@types/sinon\":\"10.0.11\",\"@types/socket.io\":\"1.4.31\",\"@types/socket.io-client\":\"1.4.32\",\"@types/webpack\":\"4.41.25\",\"babel-loader\":\"8.0.6\",\"babel-polyfill\":\"6.26.4\",\"check-engine\":\"1.10.1\",\"copy-webpack-plugin\":\"4.6.0\",\"css-loader\":\"0.23.1\",\"debug\":\"4.1.1\",\"depcheck\":\"1.4.3\",\"es-check\":\"5.1.0\",\"exports-loader\":\"0.7.0\",\"extract-text-webpack-plugin\":\"4.0.0-beta.0\",\"fake-indexeddb\":\"4.0.0\",\"form-data\":\"4.0.0\",\"fs-extra\":\"5.0.0\",\"glob\":\"7.1.4\",\"jsdom\":\"12.0.0\",\"karma\":\"6.4.1\",\"karma-chrome-launcher\":\"3.1.1\",\"karma-mocha\":\"2.0.1\",\"karma-webpack\":\"4.0.2\",\"memfs\":\"3.2.2\",\"mocha\":\"3.0.2\",\"prettier\":\"2.7.1\",\"raven-js\":\"3.16.0\",\"sass\":\"1.56.0\",\"sass-loader\":\"10.3.1\",\"should-sinon\":\"0.0.6\",\"sinon\":\"13.0.1\",\"socket.io\":\"1.7.4\",\"style-loader\":\"0.13.2\",\"svg-react-loader\":\"0.4.6\",\"ts-loader\":\"8.4.0\",\"ts-node\":\"3.1.0\",\"tslint\":\"6.1.3\",\"typescript\":\"4.8.4\",\"webpack\":\"4.39.3\",\"webpack-cli\":\"3.3.7\",\"webpack-dev-server\":\"3.11.2\",\"whatwg-fetch\":\"3.0.0\"},\"dependencies\":{},\"optionalDependencies\":{\"node-fetch\":\"2.6.1\",\"serialport\":\"9.2.8\"},\"engines\":{\"node\":\">=16.0.0\",\"npm\":\">=8.0.0\"},\"engine-strict\":false,\"publishConfig\":{\"registry\":\"https://registry.npmjs.org/\",\"access\":\"public\"},\"author\":\"Michael Zabka <zabka.michael@gmail.com>\",\"license\":\"MIT\"}");
150587
+ module.exports = JSON.parse("{\"name\":\"@signageos/front-display\",\"version\":\"12.0.0\",\"main\":\"dist/bundle.js\",\"files\":[\"dist\",\"README.md\",\"CHANGELOG.md\",\"package.json\"],\"scripts\":{\"build\":\"check-engine && npm run build-webworker && npm run build-client && npm run build-es6\",\"build-client\":\"webpack --config=webpack.config.ts\",\"build-webworker\":\"webpack --config=webpack.webworker.config.ts\",\"build-es6\":\"tsc -p tsconfig.es6.json && node tools/copy-es6.js\",\"develop\":\"check-engine && webpack-dev-server --mode development --config=webpack.config.ts\",\"docker\":\"docker run -it --rm -v $PWD:/src -w /src -e NPM_AUTH_TOKEN=$NPM_AUTH_TOKEN -e NPM_REGISTRY_URL=$NPM_REGISTRY_URL -e NPM_REGISTRY_HOST=$NPM_REGISTRY_HOST 172396373649.dkr.ecr.eu-central-1.amazonaws.com/signageos/docker-node:16-alpine-build bash\",\"prebuild\":\"mkdir -p dist && rm -rf dist/* es6/* && npm rebuild @serialport/bindings\",\"prepare\":\"npm run prebuild && npm run build\",\"test\":\"check-engine && env NODE_ENV=test ISOMORPHIC_TARGET=node mocha --opts mocha.opts\",\"test-browser\":\"check-engine && karma start\",\"lint\":\"npm run lint-client && npm run lint-webworker\",\"lint-client\":\"tslint --config node_modules/@signageos/codestyle/tslint.json --type-check --project tsconfig.json\",\"lint-webworker\":\"tslint --config node_modules/@signageos/codestyle/tslint.json --type-check --project tsconfig.webworker.json\",\"lint-fix\":\"tslint --config node_modules/@signageos/codestyle/tslint.json --fix {src,test}/**/*.{ts,tsx}\",\"escheck\":\"es-check --module es5 dist/*.js\",\"check\":\"npm run depcheck && npx --userconfig ./.npmrc @signageos/lib check-deps '.+' 'html2canvas|weinre|extract-text-webpack-plugin'\",\"depcheck\":\"depcheck --config .depcheckrc.json\"},\"husky\":{\"hooks\":{\"pre-commit\":\"lint-staged\"}},\"lint-staged\":{\"src/**/*.{tsx,ts,js,jsx}\":[\"npm run lint-fix\",\"git add\"]},\"repository\":{\"url\":\"git@gitlab.com:signageos/front-display\",\"type\":\"git\"},\"devDependencies\":{\"@babel/core\":\"7.6.0\",\"@babel/preset-env\":\"7.6.0\",\"@serialport/binding-mock\":\"9.2.4\",\"@signageos/codestyle\":\"0.0.22\",\"@signageos/front-osd\":\"0.5.3\",\"@types/async-lock\":\"0.0.19\",\"@types/classnames\":\"2.2.3\",\"@types/cron\":\"1.3.0\",\"@types/debug\":\"4.1.5\",\"@types/faker\":\"4.1.1\",\"@types/filesystem\":\"0.0.29\",\"@types/html2canvas\":\"0.5.35\",\"@types/is-online\":\"8.1.0\",\"@types/js-cookie\":\"2.0.28\",\"@types/jsdom\":\"11.0.6\",\"@types/jsrsasign\":\"8.0.7\",\"@types/lodash\":\"4.14.116\",\"@types/mocha\":\"2.2.41\",\"@types/node\":\"16.18.3\",\"@types/node-fetch\":\"2.5.7\",\"@types/parse5\":\"4.0.0\",\"@types/promise.allsettled\":\"1.0.1\",\"@types/react\":\"16.8.23\",\"@types/react-dom\":\"16.8.5\",\"@types/react-redux\":\"4.4.45\",\"@types/serialport\":\"8.0.2\",\"@types/serviceworker\":\"0.0.55\",\"@types/should\":\"13.0.0\",\"@types/should-sinon\":\"0.0.5\",\"@types/sinon\":\"10.0.11\",\"@types/socket.io\":\"1.4.31\",\"@types/socket.io-client\":\"1.4.32\",\"@types/webpack\":\"4.41.25\",\"babel-loader\":\"8.0.6\",\"babel-polyfill\":\"6.26.4\",\"check-engine\":\"1.10.1\",\"copy-webpack-plugin\":\"4.6.0\",\"css-loader\":\"0.23.1\",\"debug\":\"4.1.1\",\"depcheck\":\"1.4.3\",\"es-check\":\"5.1.0\",\"exports-loader\":\"0.7.0\",\"extract-text-webpack-plugin\":\"4.0.0-beta.0\",\"fake-indexeddb\":\"4.0.0\",\"form-data\":\"4.0.0\",\"fs-extra\":\"5.0.0\",\"glob\":\"7.1.4\",\"jsdom\":\"12.0.0\",\"karma\":\"6.4.1\",\"karma-chrome-launcher\":\"3.1.1\",\"karma-mocha\":\"2.0.1\",\"karma-webpack\":\"4.0.2\",\"memfs\":\"3.2.2\",\"mocha\":\"3.0.2\",\"prettier\":\"2.7.1\",\"raven-js\":\"3.16.0\",\"sass\":\"1.56.0\",\"sass-loader\":\"10.3.1\",\"should-sinon\":\"0.0.6\",\"sinon\":\"13.0.1\",\"socket.io\":\"1.7.4\",\"style-loader\":\"0.13.2\",\"svg-react-loader\":\"0.4.6\",\"ts-loader\":\"8.4.0\",\"ts-node\":\"3.1.0\",\"tslint\":\"6.1.3\",\"typescript\":\"4.8.4\",\"webpack\":\"4.39.3\",\"webpack-cli\":\"3.3.7\",\"webpack-dev-server\":\"3.11.2\",\"whatwg-fetch\":\"3.0.0\"},\"dependencies\":{},\"optionalDependencies\":{\"node-fetch\":\"2.6.1\",\"serialport\":\"9.2.8\"},\"engines\":{\"node\":\">=16.0.0\",\"npm\":\">=8.0.0\"},\"engine-strict\":false,\"publishConfig\":{\"registry\":\"https://registry.npmjs.org/\",\"access\":\"public\"},\"author\":\"Michael Zabka <zabka.michael@gmail.com>\",\"license\":\"MIT\"}");
149548
150588
 
149549
150589
  /***/ }),
149550
150590
 
@@ -158675,9 +159715,10 @@ var ErrorCodes;
158675
159715
  ErrorCodes["NATIVE_CACHE_ALREADY_SAVING_CONTENT"] = "41001";
158676
159716
  ErrorCodes["SYNCHRONIZER_CONNECT_ERROR"] = "51101";
158677
159717
  ErrorCodes["SYNCHRONIZER_CLOSE_ERROR"] = "51102";
158678
- ErrorCodes["SYNCHRONIZER_INIT_ERROR"] = "51103";
159718
+ ErrorCodes["SYNCHRONIZER_JOIN_GROUP_ERROR"] = "51103";
158679
159719
  ErrorCodes["SYNCHRONIZER_WAIT_ERROR"] = "51104";
158680
- ErrorCodes["SYNCHRONIZER_SET_VALUE_ERROR"] = "51105";
159720
+ ErrorCodes["SYNCHRONIZER_BROADCAST_VALUE_ERROR"] = "51105";
159721
+ ErrorCodes["SYNCHRONIZER_LEAVE_GROUP_ERROR"] = "51106";
158681
159722
  ErrorCodes["STREAM_STOP_ERROR"] = "51301";
158682
159723
  ErrorCodes["STREAM_PREPARE_ERROR"] = "51302";
158683
159724
  ErrorCodes["VIDEO_PLAY_ERROR"] = "51501";
@@ -160887,6 +161928,67 @@ exports["default"] = pingHandler;
160887
161928
 
160888
161929
  /***/ }),
160889
161930
 
161931
+ /***/ "./src/Front/Applet/Main/refreshHandler.ts":
161932
+ /*!*************************************************!*\
161933
+ !*** ./src/Front/Applet/Main/refreshHandler.ts ***!
161934
+ \*************************************************/
161935
+ /*! no static exports found */
161936
+ /***/ (function(module, exports, __webpack_require__) {
161937
+
161938
+ "use strict";
161939
+
161940
+
161941
+ var _marked = /*#__PURE__*/regeneratorRuntime.mark(handleAppletRefreshMessage),
161942
+ _marked2 = /*#__PURE__*/regeneratorRuntime.mark(appletRefreshHandler);
161943
+ Object.defineProperty(exports, "__esModule", {
161944
+ value: true
161945
+ });
161946
+ var devicePowerActionSagas_1 = __webpack_require__(/*! ../../Device/Power/devicePowerActionSagas */ "./src/Front/Device/Power/devicePowerActionSagas.ts");
161947
+ var appletRefreshMessage = "hug.applet.refresh";
161948
+ function handleAppletRefreshMessage(messageTypePrefix, data) {
161949
+ return regeneratorRuntime.wrap(function handleAppletRefreshMessage$(_context) {
161950
+ while (1) {
161951
+ switch (_context.prev = _context.next) {
161952
+ case 0:
161953
+ _context.t0 = data.type;
161954
+ _context.next = _context.t0 === messageTypePrefix + '.applet_refresh' ? 3 : 6;
161955
+ break;
161956
+ case 3:
161957
+ _context.next = 5;
161958
+ return (0, devicePowerActionSagas_1.performAppletRefresh)();
161959
+ case 5:
161960
+ return _context.abrupt("return", {});
161961
+ case 6:
161962
+ return _context.abrupt("return", null);
161963
+ case 7:
161964
+ case "end":
161965
+ return _context.stop();
161966
+ }
161967
+ }
161968
+ }, _marked);
161969
+ }
161970
+ function appletRefreshHandler(_ref) {
161971
+ var messageTypePrefix, data;
161972
+ return regeneratorRuntime.wrap(function appletRefreshHandler$(_context2) {
161973
+ while (1) {
161974
+ switch (_context2.prev = _context2.next) {
161975
+ case 0:
161976
+ messageTypePrefix = _ref.messageTypePrefix, data = _ref.data;
161977
+ _context2.next = 3;
161978
+ return handleAppletRefreshMessage(messageTypePrefix, data);
161979
+ case 3:
161980
+ return _context2.abrupt("return", _context2.sent);
161981
+ case 4:
161982
+ case "end":
161983
+ return _context2.stop();
161984
+ }
161985
+ }
161986
+ }, _marked2);
161987
+ }
161988
+ exports["default"] = appletRefreshHandler;
161989
+
161990
+ /***/ }),
161991
+
160890
161992
  /***/ "./src/Front/Applet/Management/Network/appletManagementNetworkHandler.ts":
160891
161993
  /*!*******************************************************************************!*\
160892
161994
  !*** ./src/Front/Applet/Management/Network/appletManagementNetworkHandler.ts ***!
@@ -162192,13 +163294,14 @@ var VideoOrientation_1 = __webpack_require__(/*! @signageos/common-types/dist/De
162192
163294
  var processCallback_1 = __webpack_require__(/*! ../../../Util/processCallback */ "./src/Util/processCallback.ts");
162193
163295
  var debug = Debug('@signageos/front-display:Front:Applet:Management:appletManagementHandler');
162194
163296
  var PREFIX = 'management';
163297
+ var DEBUG_PREFIX = 'debug';
162195
163298
  function handleManagementMessage(messageTypePrefix, data, managementDriver, frontDriver, propertyStorage, applicationVersion) {
162196
163299
  return regeneratorRuntime.wrap(function handleManagementMessage$(_context) {
162197
163300
  while (1) {
162198
163301
  switch (_context.prev = _context.next) {
162199
163302
  case 0:
162200
163303
  _context.t0 = data.type;
162201
- _context.next = _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".supports") ? 3 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".initialize") ? 6 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_application_type") ? 9 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".app_upgrade") ? 12 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_application_version") ? 15 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_model") ? 18 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_serial_number") ? 21 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_battery_status") ? 24 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_current_temperature") ? 27 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_brand") ? 30 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".upload_screenshot") ? 33 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".firmware_upgrade") ? 36 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_firmware_version") ? 39 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_firmware_type") ? 42 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_volume") ? 45 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".set_volume") ? 48 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".set_screen_brightness") ? 51 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_screen_brightness") ? 54 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".install_package") ? 57 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".reboot_system") ? 60 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".restart_app") ? 63 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".power_on_display") ? 66 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".power_off_display") ? 69 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_is_display_power_on") ? 72 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".resize_screen") ? 75 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_screen_orientation") ? 78 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_timers") ? 81 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".set_timer") ? 84 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".set_remote_control_enabled") ? 87 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_is_remote_control_enabled") ? 90 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_current_time_with_timezone") ? 93 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".set_current_time_with_timezone") ? 96 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".set_ntp_time_with_timezone") ? 99 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".set_debug") ? 102 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".is_enabled") ? 105 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".reset_settings") ? 108 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".factory_reset") ? 111 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".set_pin_code") ? 114 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_pin_code") ? 116 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".peer_recovery_is_enabled") ? 119 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".set_peer_recovery") ? 122 : 125;
163304
+ _context.next = _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".supports") ? 3 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".initialize") ? 6 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_application_type") ? 9 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".app_upgrade") ? 12 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_application_version") ? 15 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_model") ? 18 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_serial_number") ? 21 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_battery_status") ? 24 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_current_temperature") ? 27 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_brand") ? 30 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".upload_screenshot") ? 33 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".firmware_upgrade") ? 36 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_firmware_version") ? 39 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_firmware_type") ? 42 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_volume") ? 45 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".set_volume") ? 48 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".set_screen_brightness") ? 51 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_screen_brightness") ? 54 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".install_package") ? 57 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".reboot_system") ? 60 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".restart_app") ? 63 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".power_on_display") ? 66 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".power_off_display") ? 69 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_is_display_power_on") ? 72 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".resize_screen") ? 75 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_screen_orientation") ? 78 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_timers") ? 81 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".set_timer") ? 84 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".set_remote_control_enabled") ? 87 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_is_remote_control_enabled") ? 90 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_current_time_with_timezone") ? 93 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".set_current_time_with_timezone") ? 96 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".set_ntp_time_with_timezone") ? 99 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".set_debug") ? 102 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".is_enabled") ? 105 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".reset_settings") ? 108 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".factory_reset") ? 111 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".set_pin_code") ? 114 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".get_pin_code") ? 116 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".peer_recovery_is_enabled") ? 119 : _context.t0 === "".concat(messageTypePrefix, ".").concat(PREFIX, ".set_peer_recovery") ? 122 : _context.t0 === "".concat(messageTypePrefix, ".").concat(DEBUG_PREFIX, ".is_remote_enabled") ? 125 : 128;
162202
163305
  break;
162203
163306
  case 3:
162204
163307
  _context.next = 5;
@@ -162407,8 +163510,13 @@ function handleManagementMessage(messageTypePrefix, data, managementDriver, fron
162407
163510
  case 124:
162408
163511
  return _context.abrupt("return", _context.sent);
162409
163512
  case 125:
163513
+ _context.next = 127;
163514
+ return handleRemoteDebug(propertyStorage);
163515
+ case 127:
163516
+ return _context.abrupt("return", _context.sent);
163517
+ case 128:
162410
163518
  return _context.abrupt("return", null);
162411
- case 126:
163519
+ case 129:
162412
163520
  case "end":
162413
163521
  return _context.stop();
162414
163522
  }
@@ -163426,23 +164534,45 @@ function handleSetPeerRecovery(data, managementDriver) {
163426
164534
  }, _callee37);
163427
164535
  }));
163428
164536
  }
164537
+ function handleRemoteDebug(propertyStorage) {
164538
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee38() {
164539
+ var isEnabled;
164540
+ return regeneratorRuntime.wrap(function _callee38$(_context42) {
164541
+ while (1) {
164542
+ switch (_context42.prev = _context42.next) {
164543
+ case 0:
164544
+ _context42.next = 2;
164545
+ return propertyStorage.getValueOrDefault(Property_1["default"].DEBUG_WEINRE_ENABLED, false);
164546
+ case 2:
164547
+ isEnabled = _context42.sent;
164548
+ return _context42.abrupt("return", {
164549
+ isEnabled: isEnabled
164550
+ });
164551
+ case 4:
164552
+ case "end":
164553
+ return _context42.stop();
164554
+ }
164555
+ }
164556
+ }, _callee38);
164557
+ }));
164558
+ }
163429
164559
  function managementHandler(_ref2) {
163430
164560
  var messageTypePrefix, data, managementDriver, nativeDriver, applicationVersion, propertyStorage;
163431
- return regeneratorRuntime.wrap(function managementHandler$(_context42) {
164561
+ return regeneratorRuntime.wrap(function managementHandler$(_context43) {
163432
164562
  while (1) {
163433
- switch (_context42.prev = _context42.next) {
164563
+ switch (_context43.prev = _context43.next) {
163434
164564
  case 0:
163435
164565
  messageTypePrefix = _ref2.messageTypePrefix, data = _ref2.data, managementDriver = _ref2.managementDriver, nativeDriver = _ref2.nativeDriver, applicationVersion = _ref2.applicationVersion;
163436
164566
  propertyStorage = (0, propertyStorage_1["default"])(function () {
163437
164567
  return nativeDriver;
163438
164568
  });
163439
- _context42.next = 4;
164569
+ _context43.next = 4;
163440
164570
  return handleManagementMessage(messageTypePrefix, data, managementDriver, nativeDriver, propertyStorage, applicationVersion);
163441
164571
  case 4:
163442
- return _context42.abrupt("return", _context42.sent);
164572
+ return _context43.abrupt("return", _context43.sent);
163443
164573
  case 5:
163444
164574
  case "end":
163445
- return _context42.stop();
164575
+ return _context43.stop();
163446
164576
  }
163447
164577
  }
163448
164578
  }, _marked5);
@@ -164800,469 +165930,25 @@ function createMessage(messageTypePrefix, type, action) {
164800
165930
 
164801
165931
  /***/ }),
164802
165932
 
164803
- /***/ "./src/Front/Applet/Sync/SocketSynchronizer.ts":
164804
- /*!*****************************************************!*\
164805
- !*** ./src/Front/Applet/Sync/SocketSynchronizer.ts ***!
164806
- \*****************************************************/
165933
+ /***/ "./src/Front/Applet/Sync/ISyncConnectMessage.ts":
165934
+ /*!******************************************************!*\
165935
+ !*** ./src/Front/Applet/Sync/ISyncConnectMessage.ts ***!
165936
+ \******************************************************/
164807
165937
  /*! no static exports found */
164808
165938
  /***/ (function(module, exports, __webpack_require__) {
164809
165939
 
164810
165940
  "use strict";
164811
165941
 
164812
165942
 
164813
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
164814
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
164815
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
164816
- var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
164817
- function adopt(value) {
164818
- return value instanceof P ? value : new P(function (resolve) {
164819
- resolve(value);
164820
- });
164821
- }
164822
- return new (P || (P = Promise))(function (resolve, reject) {
164823
- function fulfilled(value) {
164824
- try {
164825
- step(generator.next(value));
164826
- } catch (e) {
164827
- reject(e);
164828
- }
164829
- }
164830
- function rejected(value) {
164831
- try {
164832
- step(generator["throw"](value));
164833
- } catch (e) {
164834
- reject(e);
164835
- }
164836
- }
164837
- function step(result) {
164838
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
164839
- }
164840
- step((generator = generator.apply(thisArg, _arguments || [])).next());
164841
- });
164842
- };
164843
165943
  Object.defineProperty(exports, "__esModule", {
164844
165944
  value: true
164845
165945
  });
164846
- var events_1 = __webpack_require__(/*! events */ "./node_modules/events/events.js");
164847
- var Debug = __webpack_require__(/*! debug */ "./node_modules/debug/src/browser.js");
164848
- var debug = Debug('@signageos/front-display:Front:Applet:Sync:SocketSynchronizer');
164849
- /**
164850
- * API to synchronize content with other devices in the network.
164851
- * When online
164852
- * - If everything is fine and device is always online, the logic is simple - initialize group on the server to determine,
164853
- * which devices belong together and whenever wait() is called, wait until all other devices are waiting too
164854
- * and resolve it on all simultaniously.
164855
- * When offline
164856
- * - If the device goes offline in any point in the process, it silently switches to offline mode, which means that
164857
- * the SocketSynchronizer is itself acting like a mock server and simply validates and confirms all the requests to
164858
- * the API immediately to maintain smooth and seamless operation.
164859
- * - SocketSynchronizer also buffers all the initialized groups while offline and when it goes back online, it dumps the buffer
164860
- * to the server to synchronize the internal state.
164861
- */
164862
- var SocketSynchronizer = /*#__PURE__*/function () {
164863
- function SocketSynchronizer(getNativeDriver, createSocket, defaultServerUri) {
164864
- _classCallCheck(this, SocketSynchronizer);
164865
- this.getNativeDriver = getNativeDriver;
164866
- this.createSocket = createSocket;
164867
- this.defaultServerUri = defaultServerUri;
164868
- this.connected = false;
164869
- this.groups = {};
164870
- }
164871
- _createClass(SocketSynchronizer, [{
164872
- key: "connect",
164873
- value: function connect(serverUri) {
164874
- return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
164875
- return regeneratorRuntime.wrap(function _callee$(_context) {
164876
- while (1) {
164877
- switch (_context.prev = _context.next) {
164878
- case 0:
164879
- if (!this.socket) {
164880
- _context.next = 3;
164881
- break;
164882
- }
164883
- _context.next = 3;
164884
- return this.close();
164885
- case 3:
164886
- this.initSocket(serverUri || this.defaultServerUri);
164887
- case 4:
164888
- case "end":
164889
- return _context.stop();
164890
- }
164891
- }
164892
- }, _callee, this);
164893
- }));
164894
- }
164895
- }, {
164896
- key: "close",
164897
- value: function close() {
164898
- return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
164899
- var _this = this;
164900
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
164901
- while (1) {
164902
- switch (_context2.prev = _context2.next) {
164903
- case 0:
164904
- if (this.socket) {
164905
- _context2.next = 2;
164906
- break;
164907
- }
164908
- throw new Error('Can\'t close when not connected');
164909
- case 2:
164910
- this.socket.close();
164911
- this.socket = undefined;
164912
- this.connected = false;
164913
- Object.keys(this.groups).forEach(function (key) {
164914
- _this.groups[key].eventEmitter.emit('close');
164915
- });
164916
- this.groups = {};
164917
- case 7:
164918
- case "end":
164919
- return _context2.stop();
164920
- }
164921
- }
164922
- }, _callee2, this);
164923
- }));
164924
- }
164925
- }, {
164926
- key: "init",
164927
- value: function init(groupName, deviceIdentification) {
164928
- return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
164929
- var deviceId, group;
164930
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
164931
- while (1) {
164932
- switch (_context3.prev = _context3.next) {
164933
- case 0:
164934
- if (this.socket) {
164935
- _context3.next = 2;
164936
- break;
164937
- }
164938
- throw new Error('Not connected. Call connect() first.');
164939
- case 2:
164940
- deviceId = deviceIdentification !== undefined ? deviceIdentification : Math.random().toString(32);
164941
- if (!this.connected) {
164942
- _context3.next = 9;
164943
- break;
164944
- }
164945
- _context3.next = 6;
164946
- return this.callOnlineInit(groupName, deviceId);
164947
- case 6:
164948
- group = _context3.sent;
164949
- _context3.next = 10;
164950
- break;
164951
- case 9:
164952
- group = this.callOfflineInit(groupName, deviceId);
164953
- case 10:
164954
- return _context3.abrupt("return", group.eventEmitter);
164955
- case 11:
164956
- case "end":
164957
- return _context3.stop();
164958
- }
164959
- }
164960
- }, _callee3, this);
164961
- }));
164962
- }
164963
- }, {
164964
- key: "isConnected",
164965
- value: function isConnected() {
164966
- return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
164967
- return regeneratorRuntime.wrap(function _callee4$(_context4) {
164968
- while (1) {
164969
- switch (_context4.prev = _context4.next) {
164970
- case 0:
164971
- return _context4.abrupt("return", !!this.socket);
164972
- case 1:
164973
- case "end":
164974
- return _context4.stop();
164975
- }
164976
- }
164977
- }, _callee4, this);
164978
- }));
164979
- }
164980
- }, {
164981
- key: "wait",
164982
- value: function wait(groupName, data, timeout) {
164983
- return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
164984
- return regeneratorRuntime.wrap(function _callee5$(_context5) {
164985
- while (1) {
164986
- switch (_context5.prev = _context5.next) {
164987
- case 0:
164988
- if (this.socket) {
164989
- _context5.next = 2;
164990
- break;
164991
- }
164992
- throw new Error('Not connected. Call connect() first.');
164993
- case 2:
164994
- if (!(typeof timeout !== 'undefined' && timeout <= 0)) {
164995
- _context5.next = 4;
164996
- break;
164997
- }
164998
- throw new Error('Timeout must be greater than 0');
164999
- case 4:
165000
- if (!this.connected) {
165001
- _context5.next = 10;
165002
- break;
165003
- }
165004
- _context5.next = 7;
165005
- return this.callOnlineWait(groupName, data, timeout);
165006
- case 7:
165007
- return _context5.abrupt("return", _context5.sent);
165008
- case 10:
165009
- return _context5.abrupt("return", this.callOfflineWait(groupName, data));
165010
- case 11:
165011
- case "end":
165012
- return _context5.stop();
165013
- }
165014
- }
165015
- }, _callee5, this);
165016
- }));
165017
- }
165018
- }, {
165019
- key: "setValue",
165020
- value: function setValue(groupName, key, value) {
165021
- return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
165022
- return regeneratorRuntime.wrap(function _callee6$(_context6) {
165023
- while (1) {
165024
- switch (_context6.prev = _context6.next) {
165025
- case 0:
165026
- if (this.socket) {
165027
- _context6.next = 2;
165028
- break;
165029
- }
165030
- throw new Error('Not connected. Call connect() first.');
165031
- case 2:
165032
- if (this.groups[groupName]) {
165033
- _context6.next = 4;
165034
- break;
165035
- }
165036
- throw new Error('Group ' + groupName + ' wasn\'t initialized');
165037
- case 4:
165038
- this.socket.emit('request_set_value', {
165039
- groupName: groupName,
165040
- key: key,
165041
- value: value
165042
- });
165043
- // if not connected, emit the value back to oneself
165044
- if (!this.connected) {
165045
- this.emitValue(groupName, key, value);
165046
- }
165047
- case 6:
165048
- case "end":
165049
- return _context6.stop();
165050
- }
165051
- }
165052
- }, _callee6, this);
165053
- }));
165054
- }
165055
- }, {
165056
- key: "initSocket",
165057
- value: function initSocket(serverUri) {
165058
- var _this2 = this;
165059
- this.socket = this.createSocket(serverUri);
165060
- this.socket.on('connect', function () {
165061
- return __awaiter(_this2, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee7() {
165062
- var _i, _Object$keys, groupName;
165063
- return regeneratorRuntime.wrap(function _callee7$(_context7) {
165064
- while (1) {
165065
- switch (_context7.prev = _context7.next) {
165066
- case 0:
165067
- this.connected = true;
165068
- // flush all offline groups to the server
165069
- _i = 0, _Object$keys = Object.keys(this.groups);
165070
- case 2:
165071
- if (!(_i < _Object$keys.length)) {
165072
- _context7.next = 16;
165073
- break;
165074
- }
165075
- groupName = _Object$keys[_i];
165076
- if (!(this.groups[groupName].isOnline === false)) {
165077
- _context7.next = 13;
165078
- break;
165079
- }
165080
- _context7.prev = 5;
165081
- _context7.next = 8;
165082
- return this.callOnlineInit(groupName, this.groups[groupName].deviceIdentification);
165083
- case 8:
165084
- _context7.next = 13;
165085
- break;
165086
- case 10:
165087
- _context7.prev = 10;
165088
- _context7.t0 = _context7["catch"](5);
165089
- console.error('flush offline initialized group to the server', groupName, _context7.t0);
165090
- case 13:
165091
- _i++;
165092
- _context7.next = 2;
165093
- break;
165094
- case 16:
165095
- case "end":
165096
- return _context7.stop();
165097
- }
165098
- }
165099
- }, _callee7, this, [[5, 10]]);
165100
- }));
165101
- });
165102
- this.socket.on('disconnect', function () {
165103
- _this2.connected = false;
165104
- // when device disconnects, all initialized groups are now offline and has to be flushed to the server on reconnection
165105
- for (var _i2 = 0, _Object$keys2 = Object.keys(_this2.groups); _i2 < _Object$keys2.length; _i2++) {
165106
- var groupName = _Object$keys2[_i2];
165107
- _this2.groups[groupName].isOnline = false;
165108
- }
165109
- });
165110
- this.socket.on('set_value', function (groupName, key, value) {
165111
- if (_this2.groups[groupName]) {
165112
- _this2.groups[groupName].eventEmitter.emit('set_value', key, value);
165113
- }
165114
- });
165115
- this.socket.on('device_status', function (connectedPeers, groupName) {
165116
- if (_this2.groups[groupName]) {
165117
- _this2.groups[groupName].eventEmitter.emit('device_status', connectedPeers, groupName);
165118
- }
165119
- });
165120
- }
165121
- }, {
165122
- key: "callOnlineInit",
165123
- value: function callOnlineInit(groupName, deviceIdentification) {
165124
- return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee8() {
165125
- var _this3 = this;
165126
- var nativeDriver, deviceUid, eventEmitter;
165127
- return regeneratorRuntime.wrap(function _callee8$(_context8) {
165128
- while (1) {
165129
- switch (_context8.prev = _context8.next) {
165130
- case 0:
165131
- nativeDriver = this.getNativeDriver();
165132
- _context8.next = 3;
165133
- return nativeDriver.getDeviceUid();
165134
- case 3:
165135
- deviceUid = _context8.sent;
165136
- eventEmitter = this.groups[groupName] ? this.groups[groupName].eventEmitter : new events_1.EventEmitter();
165137
- _context8.next = 7;
165138
- return new Promise(function (resolve, reject) {
165139
- _this3.socket.emit('join_group', {
165140
- deviceUid: deviceUid,
165141
- groupName: groupName,
165142
- deviceIdentification: deviceIdentification
165143
- }, function (error) {
165144
- if (error) {
165145
- reject(error);
165146
- } else {
165147
- resolve();
165148
- }
165149
- });
165150
- });
165151
- case 7:
165152
- this.groups[groupName] = {
165153
- isOnline: true,
165154
- eventEmitter: eventEmitter
165155
- };
165156
- return _context8.abrupt("return", this.groups[groupName]);
165157
- case 9:
165158
- case "end":
165159
- return _context8.stop();
165160
- }
165161
- }
165162
- }, _callee8, this);
165163
- }));
165164
- }
165165
- }, {
165166
- key: "callOfflineInit",
165167
- value: function callOfflineInit(groupName, deviceIdentification) {
165168
- this.groups[groupName] = {
165169
- isOnline: false,
165170
- eventEmitter: this.groups[groupName] ? this.groups[groupName].eventEmitter : new events_1.EventEmitter(),
165171
- deviceIdentification: deviceIdentification
165172
- };
165173
- return this.groups[groupName];
165174
- }
165175
- }, {
165176
- key: "callOnlineWait",
165177
- value: function callOnlineWait(groupName, data, timeout) {
165178
- return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee9() {
165179
- var _this4 = this;
165180
- return regeneratorRuntime.wrap(function _callee9$(_context9) {
165181
- while (1) {
165182
- switch (_context9.prev = _context9.next) {
165183
- case 0:
165184
- _context9.next = 2;
165185
- return new Promise(function (resolve, reject) {
165186
- var _syncConfirmedListener;
165187
- var _disconnectListener;
165188
- var timeoutHandler;
165189
- _syncConfirmedListener = function syncConfirmedListener(confirmedGroupName, confirmData) {
165190
- if (confirmedGroupName === groupName) {
165191
- if (typeof timeoutHandler !== 'undefined') {
165192
- clearTimeout(timeoutHandler);
165193
- }
165194
- _this4.socket.off('disconnect', _disconnectListener);
165195
- _this4.socket.off('sync_confirmed', _syncConfirmedListener);
165196
- resolve(confirmData);
165197
- }
165198
- };
165199
- _disconnectListener = function disconnectListener() {
165200
- if (typeof timeoutHandler !== 'undefined') {
165201
- clearTimeout(timeoutHandler);
165202
- }
165203
- _this4.socket.off('disconnect', _disconnectListener);
165204
- _this4.socket.off('sync_confirmed', _syncConfirmedListener);
165205
- // if it goes offline, it should automatically confirm all waits as if nothing happened
165206
- try {
165207
- var confirmData = _this4.callOfflineWait(groupName, data);
165208
- resolve(confirmData);
165209
- } catch (error) {
165210
- reject(error);
165211
- }
165212
- };
165213
- _this4.socket.on('sync_confirmed', _syncConfirmedListener);
165214
- _this4.socket.on('disconnect', _disconnectListener);
165215
- _this4.socket.emit('sync_request', {
165216
- groupName: groupName,
165217
- data: data
165218
- }, function (error) {
165219
- if (error) {
165220
- _this4.socket.off('disconnect', _disconnectListener);
165221
- _this4.socket.off('sync_confirmed', _syncConfirmedListener);
165222
- reject(error);
165223
- }
165224
- });
165225
- if (typeof timeout !== 'undefined') {
165226
- timeoutHandler = setTimeout(function () {
165227
- _syncConfirmedListener(groupName, data);
165228
- _this4.socket.emit('sync_request_cancel', {
165229
- groupName: groupName
165230
- });
165231
- }, timeout);
165232
- }
165233
- });
165234
- case 2:
165235
- return _context9.abrupt("return", _context9.sent);
165236
- case 3:
165237
- case "end":
165238
- return _context9.stop();
165239
- }
165240
- }
165241
- }, _callee9);
165242
- }));
165243
- }
165244
- }, {
165245
- key: "callOfflineWait",
165246
- value: function callOfflineWait(groupName, data) {
165247
- if (typeof this.groups[groupName] === 'undefined') {
165248
- throw new Error('Group ' + groupName + 'wasn\'t initialized');
165249
- } else {
165250
- debug('offline wait confirmed for group ' + groupName);
165251
- return data;
165252
- }
165253
- }
165254
- }, {
165255
- key: "emitValue",
165256
- value: function emitValue(groupName, key, value) {
165257
- if (!this.groups[groupName]) {
165258
- throw new Error('Group ' + groupName + 'wasn\'t initialized');
165259
- }
165260
- this.groups[groupName].eventEmitter.emit('set_value', key, value);
165261
- }
165262
- }]);
165263
- return SocketSynchronizer;
165264
- }();
165265
- exports["default"] = SocketSynchronizer;
165946
+ exports.SyncEngine = void 0;
165947
+ var SyncEngine;
165948
+ (function (SyncEngine) {
165949
+ SyncEngine["SyncServer"] = "sync-server";
165950
+ SyncEngine["Udp"] = "udp";
165951
+ })(SyncEngine = exports.SyncEngine || (exports.SyncEngine = {}));
165266
165952
 
165267
165953
  /***/ }),
165268
165954
 
@@ -165279,27 +165965,25 @@ exports["default"] = SocketSynchronizer;
165279
165965
  var _marked = /*#__PURE__*/regeneratorRuntime.mark(handleSyncMessage),
165280
165966
  _marked2 = /*#__PURE__*/regeneratorRuntime.mark(handleSyncConnect),
165281
165967
  _marked3 = /*#__PURE__*/regeneratorRuntime.mark(handleSyncClose),
165282
- _marked4 = /*#__PURE__*/regeneratorRuntime.mark(handleSyncInit),
165283
- _marked5 = /*#__PURE__*/regeneratorRuntime.mark(handleSyncWait),
165284
- _marked6 = /*#__PURE__*/regeneratorRuntime.mark(handleSyncSetValue),
165285
- _marked7 = /*#__PURE__*/regeneratorRuntime.mark(syncHandler);
165968
+ _marked4 = /*#__PURE__*/regeneratorRuntime.mark(handleSyncJoinGroup),
165969
+ _marked5 = /*#__PURE__*/regeneratorRuntime.mark(handleSyncLeaveGroup),
165970
+ _marked6 = /*#__PURE__*/regeneratorRuntime.mark(handleSyncWait),
165971
+ _marked7 = /*#__PURE__*/regeneratorRuntime.mark(handleBroadcastValue),
165972
+ _marked8 = /*#__PURE__*/regeneratorRuntime.mark(syncHandler);
165286
165973
  Object.defineProperty(exports, "__esModule", {
165287
165974
  value: true
165288
165975
  });
165289
- exports.handleSyncMessage = exports.DeviceStatusAction = void 0;
165290
- var effects_1 = __webpack_require__(/*! redux-saga/effects */ "./node_modules/redux-saga/dist/redux-saga-effects-npm-proxy.esm.js");
165291
- var syncActions_1 = __webpack_require__(/*! @signageos/actions/dist/Sync/syncActions */ "./node_modules/@signageos/actions/dist/Sync/syncActions.js");
165292
- var channels_1 = __webpack_require__(/*! ../../../ReduxSaga/channels */ "./src/ReduxSaga/channels.ts");
165976
+ exports.handleSyncMessage = void 0;
165293
165977
  var InternalSynchronizerError_1 = __webpack_require__(/*! ../Error/InternalSynchronizerError */ "./src/Front/Applet/Error/InternalSynchronizerError.ts");
165294
165978
  var ErrorCodes_1 = __webpack_require__(/*! ../Error/ErrorCodes */ "./src/Front/Applet/Error/ErrorCodes.ts");
165295
- exports.DeviceStatusAction = 'Device.Connected.Status';
165979
+ var appletSyncHandler_utils_1 = __webpack_require__(/*! ./appletSyncHandler.utils */ "./src/Front/Applet/Sync/appletSyncHandler.utils.ts");
165296
165980
  function handleSyncMessage(messageTypePrefix, data, _nativeDriver, synchronizer, _appletUid, _timingChecksum) {
165297
165981
  return regeneratorRuntime.wrap(function handleSyncMessage$(_context) {
165298
165982
  while (1) {
165299
165983
  switch (_context.prev = _context.next) {
165300
165984
  case 0:
165301
165985
  _context.t0 = data.type;
165302
- _context.next = _context.t0 === messageTypePrefix + '.sync.connect' ? 3 : _context.t0 === messageTypePrefix + '.sync.close' ? 6 : _context.t0 === messageTypePrefix + '.sync.init' ? 9 : _context.t0 === messageTypePrefix + '.sync.wait' ? 12 : _context.t0 === messageTypePrefix + '.sync.request_set_value' ? 15 : 18;
165986
+ _context.next = _context.t0 === messageTypePrefix + '.sync.connect' ? 3 : _context.t0 === messageTypePrefix + '.sync.close' ? 6 : _context.t0 === messageTypePrefix + '.sync.init' ? 9 : _context.t0 === messageTypePrefix + '.sync.leave_group' ? 12 : _context.t0 === messageTypePrefix + '.sync.wait' ? 15 : _context.t0 === messageTypePrefix + '.sync.request_set_value' ? 18 : 21;
165303
165987
  break;
165304
165988
  case 3:
165305
165989
  _context.next = 5;
@@ -165313,22 +165997,27 @@ function handleSyncMessage(messageTypePrefix, data, _nativeDriver, synchronizer,
165313
165997
  return _context.abrupt("return", _context.sent);
165314
165998
  case 9:
165315
165999
  _context.next = 11;
165316
- return handleSyncInit(data, synchronizer);
166000
+ return handleSyncJoinGroup(data, synchronizer);
165317
166001
  case 11:
165318
166002
  return _context.abrupt("return", _context.sent);
165319
166003
  case 12:
165320
166004
  _context.next = 14;
165321
- return handleSyncWait(data, synchronizer);
166005
+ return handleSyncLeaveGroup(data, synchronizer);
165322
166006
  case 14:
165323
166007
  return _context.abrupt("return", _context.sent);
165324
166008
  case 15:
165325
166009
  _context.next = 17;
165326
- return handleSyncSetValue(data, synchronizer);
166010
+ return handleSyncWait(data, synchronizer);
165327
166011
  case 17:
165328
166012
  return _context.abrupt("return", _context.sent);
165329
166013
  case 18:
166014
+ _context.next = 20;
166015
+ return handleBroadcastValue(data, synchronizer);
166016
+ case 20:
166017
+ return _context.abrupt("return", _context.sent);
166018
+ case 21:
165330
166019
  return _context.abrupt("return", null);
165331
- case 19:
166020
+ case 22:
165332
166021
  case "end":
165333
166022
  return _context.stop();
165334
166023
  }
@@ -165336,20 +166025,23 @@ function handleSyncMessage(messageTypePrefix, data, _nativeDriver, synchronizer,
165336
166025
  }, _marked);
165337
166026
  }
165338
166027
  exports.handleSyncMessage = handleSyncMessage;
165339
- function handleSyncConnect(data, synchronizer) {
166028
+ function handleSyncConnect(_ref, synchronizer) {
166029
+ var serverUri, engine, syncType;
165340
166030
  return regeneratorRuntime.wrap(function handleSyncConnect$(_context2) {
165341
166031
  while (1) {
165342
166032
  switch (_context2.prev = _context2.next) {
165343
166033
  case 0:
165344
- _context2.prev = 0;
165345
- _context2.next = 3;
165346
- return synchronizer.connect(data.serverUri);
165347
- case 3:
165348
- _context2.next = 8;
165349
- break;
166034
+ serverUri = _ref.serverUri, engine = _ref.engine;
166035
+ _context2.prev = 1;
166036
+ syncType = (0, appletSyncHandler_utils_1.appletSyncEngineToSynchronizerSynchronizerType)(engine);
166037
+ _context2.next = 5;
166038
+ return synchronizer.connect(serverUri, syncType);
165350
166039
  case 5:
165351
- _context2.prev = 5;
165352
- _context2.t0 = _context2["catch"](0);
166040
+ _context2.next = 10;
166041
+ break;
166042
+ case 7:
166043
+ _context2.prev = 7;
166044
+ _context2.t0 = _context2["catch"](1);
165353
166045
  throw new InternalSynchronizerError_1["default"]({
165354
166046
  kind: 'internalSynchronizerErrorWithOrigin',
165355
166047
  message: 'Synchronizer couldn\'t connect to the server.',
@@ -165358,14 +166050,14 @@ function handleSyncConnect(data, synchronizer) {
165358
166050
  originStack: _context2.t0.stack,
165359
166051
  originMessage: _context2.t0.message
165360
166052
  });
165361
- case 8:
166053
+ case 10:
165362
166054
  return _context2.abrupt("return", {});
165363
- case 9:
166055
+ case 11:
165364
166056
  case "end":
165365
166057
  return _context2.stop();
165366
166058
  }
165367
166059
  }
165368
- }, _marked2, null, [[0, 5]]);
166060
+ }, _marked2, null, [[1, 7]]);
165369
166061
  }
165370
166062
  function handleSyncClose(synchronizer) {
165371
166063
  return regeneratorRuntime.wrap(function handleSyncClose$(_context3) {
@@ -165398,202 +166090,192 @@ function handleSyncClose(synchronizer) {
165398
166090
  }
165399
166091
  }, _marked3, null, [[0, 5]]);
165400
166092
  }
165401
- function handleSyncInit(data, synchronizer) {
165402
- var eventEmitter, syncValueChannel, closeChannel, syncValuesTask;
165403
- return regeneratorRuntime.wrap(function handleSyncInit$(_context6) {
166093
+ function handleSyncJoinGroup(data, synchronizer) {
166094
+ return regeneratorRuntime.wrap(function handleSyncJoinGroup$(_context4) {
165404
166095
  while (1) {
165405
- switch (_context6.prev = _context6.next) {
166096
+ switch (_context4.prev = _context4.next) {
165406
166097
  case 0:
165407
- _context6.prev = 0;
165408
- _context6.next = 3;
165409
- return synchronizer.init(data.groupName, data.deviceIdentification);
166098
+ _context4.prev = 0;
166099
+ _context4.next = 3;
166100
+ return synchronizer.joinGroup({
166101
+ groupName: data.groupName,
166102
+ deviceIdentification: data.deviceIdentification
166103
+ });
165410
166104
  case 3:
165411
- eventEmitter = _context6.sent;
165412
- _context6.next = 9;
166105
+ _context4.next = 8;
165413
166106
  break;
165414
- case 6:
165415
- _context6.prev = 6;
165416
- _context6.t0 = _context6["catch"](0);
166107
+ case 5:
166108
+ _context4.prev = 5;
166109
+ _context4.t0 = _context4["catch"](0);
165417
166110
  throw new InternalSynchronizerError_1["default"]({
165418
166111
  kind: 'internalSynchronizerErrorWithOrigin',
165419
166112
  message: 'The group initialization failed.',
165420
- code: ErrorCodes_1["default"].SYNCHRONIZER_INIT_ERROR,
165421
- origin: 'close()',
165422
- originStack: _context6.t0.stack,
165423
- originMessage: _context6.t0.message
166113
+ code: ErrorCodes_1["default"].SYNCHRONIZER_JOIN_GROUP_ERROR,
166114
+ origin: 'joinGroup()',
166115
+ originStack: _context4.t0.stack,
166116
+ originMessage: _context4.t0.message
165424
166117
  });
166118
+ case 8:
166119
+ return _context4.abrupt("return", {});
165425
166120
  case 9:
165426
- syncValueChannel = (0, channels_1.createChannel)(function (putEvent) {
165427
- eventEmitter.on('set_value', function (key, value) {
165428
- return putEvent({
165429
- type: syncActions_1.SetValue,
165430
- groupName: data.groupName,
165431
- key: key,
165432
- value: value
165433
- });
165434
- });
165435
- eventEmitter.on('device_status', function (connectedPeers, groupName) {
165436
- return putEvent({
165437
- type: exports.DeviceStatusAction,
165438
- connectedPeers: connectedPeers,
165439
- groupName: groupName
165440
- });
165441
- });
166121
+ case "end":
166122
+ return _context4.stop();
166123
+ }
166124
+ }
166125
+ }, _marked4, null, [[0, 5]]);
166126
+ }
166127
+ function handleSyncLeaveGroup(data, synchronizer) {
166128
+ return regeneratorRuntime.wrap(function handleSyncLeaveGroup$(_context5) {
166129
+ while (1) {
166130
+ switch (_context5.prev = _context5.next) {
166131
+ case 0:
166132
+ _context5.prev = 0;
166133
+ _context5.next = 3;
166134
+ return synchronizer.leaveGroup(data.groupName);
166135
+ case 3:
166136
+ _context5.next = 8;
166137
+ break;
166138
+ case 5:
166139
+ _context5.prev = 5;
166140
+ _context5.t0 = _context5["catch"](0);
166141
+ throw new InternalSynchronizerError_1["default"]({
166142
+ kind: 'internalSynchronizerErrorWithOrigin',
166143
+ message: 'Failed to leave the group.',
166144
+ code: ErrorCodes_1["default"].SYNCHRONIZER_LEAVE_GROUP_ERROR,
166145
+ origin: 'leaveGroup()',
166146
+ originStack: _context5.t0.stack,
166147
+ originMessage: _context5.t0.message
165442
166148
  });
165443
- closeChannel = (0, channels_1.createChannel)(function (putEvent) {
165444
- eventEmitter.on('close', function () {
165445
- return putEvent(true);
165446
- });
165447
- }); // spawn process that will take sync events and create messages for applet from them
165448
- _context6.next = 13;
165449
- return (0, effects_1.spawn)(channels_1.takeEvery, syncValueChannel, /*#__PURE__*/regeneratorRuntime.mark(function _callee(syncMessage) {
165450
- return regeneratorRuntime.wrap(function _callee$(_context4) {
165451
- while (1) {
165452
- switch (_context4.prev = _context4.next) {
165453
- case 0:
165454
- _context4.prev = 0;
165455
- _context4.t0 = syncMessage.type;
165456
- _context4.next = _context4.t0 === syncActions_1.SetValue ? 4 : _context4.t0 === exports.DeviceStatusAction ? 7 : 10;
165457
- break;
165458
- case 4:
165459
- _context4.next = 6;
165460
- return (0, effects_1.put)(syncMessage);
165461
- case 6:
165462
- return _context4.abrupt("break", 10);
165463
- case 7:
165464
- _context4.next = 9;
165465
- return (0, effects_1.put)(syncMessage);
165466
- case 9:
165467
- return _context4.abrupt("break", 10);
165468
- case 10:
165469
- _context4.next = 15;
165470
- break;
165471
- case 12:
165472
- _context4.prev = 12;
165473
- _context4.t1 = _context4["catch"](0);
165474
- console.error('sync set value event sending failed', _context4.t1);
165475
- case 15:
165476
- case "end":
165477
- return _context4.stop();
165478
- }
165479
- }
165480
- }, _callee, null, [[0, 12]]);
165481
- }));
165482
- case 13:
165483
- syncValuesTask = _context6.sent;
165484
- _context6.next = 16;
165485
- return (0, effects_1.spawn)( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
165486
- return regeneratorRuntime.wrap(function _callee2$(_context5) {
165487
- while (1) {
165488
- switch (_context5.prev = _context5.next) {
165489
- case 0:
165490
- _context5.next = 2;
165491
- return (0, effects_1.call)(closeChannel.take);
165492
- case 2:
165493
- _context5.next = 4;
165494
- return (0, effects_1.cancel)(syncValuesTask);
165495
- case 4:
165496
- case "end":
165497
- return _context5.stop();
165498
- }
165499
- }
165500
- }, _callee2);
165501
- }));
165502
- case 16:
165503
- return _context6.abrupt("return", {});
165504
- case 17:
166149
+ case 8:
165505
166150
  case "end":
165506
- return _context6.stop();
166151
+ return _context5.stop();
165507
166152
  }
165508
166153
  }
165509
- }, _marked4, null, [[0, 6]]);
166154
+ }, _marked5, null, [[0, 5]]);
165510
166155
  }
165511
166156
  function handleSyncWait(data, synchronizer) {
165512
166157
  var responseData;
165513
- return regeneratorRuntime.wrap(function handleSyncWait$(_context7) {
166158
+ return regeneratorRuntime.wrap(function handleSyncWait$(_context6) {
165514
166159
  while (1) {
165515
- switch (_context7.prev = _context7.next) {
166160
+ switch (_context6.prev = _context6.next) {
165516
166161
  case 0:
165517
- _context7.prev = 0;
165518
- _context7.next = 3;
165519
- return synchronizer.wait(data.groupName, data.data, data.timeout);
166162
+ _context6.prev = 0;
166163
+ _context6.next = 3;
166164
+ return synchronizer.wait({
166165
+ groupName: data.groupName,
166166
+ data: data.data,
166167
+ timeoutMs: data.timeout
166168
+ });
165520
166169
  case 3:
165521
- responseData = _context7.sent;
165522
- return _context7.abrupt("return", {
166170
+ responseData = _context6.sent;
166171
+ return _context6.abrupt("return", {
165523
166172
  responseData: responseData
165524
166173
  });
165525
166174
  case 7:
165526
- _context7.prev = 7;
165527
- _context7.t0 = _context7["catch"](0);
166175
+ _context6.prev = 7;
166176
+ _context6.t0 = _context6["catch"](0);
165528
166177
  throw new InternalSynchronizerError_1["default"]({
165529
166178
  kind: 'internalSynchronizerErrorWithOrigin',
165530
166179
  message: 'Wait failed for unexpected reason.',
165531
166180
  code: ErrorCodes_1["default"].SYNCHRONIZER_WAIT_ERROR,
165532
166181
  origin: "wait(".concat(data.groupName, ", ").concat(data.data, ", ").concat(data.timeout, ")"),
165533
- originStack: _context7.t0.stack,
165534
- originMessage: _context7.t0.message
166182
+ originStack: _context6.t0.stack,
166183
+ originMessage: _context6.t0.message
165535
166184
  });
165536
166185
  case 10:
165537
166186
  case "end":
165538
- return _context7.stop();
166187
+ return _context6.stop();
165539
166188
  }
165540
166189
  }
165541
- }, _marked5, null, [[0, 7]]);
166190
+ }, _marked6, null, [[0, 7]]);
165542
166191
  }
165543
- function handleSyncSetValue(data, synchronizer) {
165544
- var responseData;
165545
- return regeneratorRuntime.wrap(function handleSyncSetValue$(_context8) {
166192
+ function handleBroadcastValue(data, synchronizer) {
166193
+ return regeneratorRuntime.wrap(function handleBroadcastValue$(_context7) {
165546
166194
  while (1) {
165547
- switch (_context8.prev = _context8.next) {
166195
+ switch (_context7.prev = _context7.next) {
165548
166196
  case 0:
165549
- _context8.prev = 0;
165550
- _context8.next = 3;
165551
- return synchronizer.setValue(data.groupName, data.key, data.value);
165552
- case 3:
165553
- responseData = _context8.sent;
165554
- return _context8.abrupt("return", {
165555
- responseData: responseData
166197
+ _context7.prev = 0;
166198
+ _context7.next = 3;
166199
+ return synchronizer.broadcastValue({
166200
+ groupName: data.groupName,
166201
+ key: data.key,
166202
+ value: data.value
165556
166203
  });
165557
- case 7:
165558
- _context8.prev = 7;
165559
- _context8.t0 = _context8["catch"](0);
166204
+ case 3:
166205
+ return _context7.abrupt("return", {});
166206
+ case 6:
166207
+ _context7.prev = 6;
166208
+ _context7.t0 = _context7["catch"](0);
165560
166209
  throw new InternalSynchronizerError_1["default"]({
165561
166210
  kind: 'internalSynchronizerErrorWithOrigin',
165562
166211
  message: 'Synchronizer couldn\'t set the value.',
165563
- code: ErrorCodes_1["default"].SYNCHRONIZER_SET_VALUE_ERROR,
166212
+ code: ErrorCodes_1["default"].SYNCHRONIZER_BROADCAST_VALUE_ERROR,
165564
166213
  origin: "setValue(".concat(data.groupName, ", ").concat(data.key, ", ").concat(data.value, ")"),
165565
- originStack: _context8.t0.stack,
165566
- originMessage: _context8.t0.message
166214
+ originStack: _context7.t0.stack,
166215
+ originMessage: _context7.t0.message
165567
166216
  });
165568
- case 10:
166217
+ case 9:
165569
166218
  case "end":
165570
- return _context8.stop();
166219
+ return _context7.stop();
165571
166220
  }
165572
166221
  }
165573
- }, _marked6, null, [[0, 7]]);
166222
+ }, _marked7, null, [[0, 6]]);
165574
166223
  }
165575
- function syncHandler(_ref) {
166224
+ function syncHandler(_ref2) {
165576
166225
  var messageTypePrefix, data, nativeDriver, synchronizer, appletUid, timingChecksum;
165577
- return regeneratorRuntime.wrap(function syncHandler$(_context9) {
166226
+ return regeneratorRuntime.wrap(function syncHandler$(_context8) {
165578
166227
  while (1) {
165579
- switch (_context9.prev = _context9.next) {
166228
+ switch (_context8.prev = _context8.next) {
165580
166229
  case 0:
165581
- messageTypePrefix = _ref.messageTypePrefix, data = _ref.data, nativeDriver = _ref.nativeDriver, synchronizer = _ref.synchronizer, appletUid = _ref.appletUid, timingChecksum = _ref.timingChecksum;
165582
- _context9.next = 3;
166230
+ messageTypePrefix = _ref2.messageTypePrefix, data = _ref2.data, nativeDriver = _ref2.nativeDriver, synchronizer = _ref2.synchronizer, appletUid = _ref2.appletUid, timingChecksum = _ref2.timingChecksum;
166231
+ _context8.next = 3;
165583
166232
  return handleSyncMessage(messageTypePrefix, data, nativeDriver, synchronizer, appletUid, timingChecksum);
165584
166233
  case 3:
165585
- return _context9.abrupt("return", _context9.sent);
166234
+ return _context8.abrupt("return", _context8.sent);
165586
166235
  case 4:
165587
166236
  case "end":
165588
- return _context9.stop();
166237
+ return _context8.stop();
165589
166238
  }
165590
166239
  }
165591
- }, _marked7);
166240
+ }, _marked8);
165592
166241
  }
165593
166242
  exports["default"] = syncHandler;
165594
166243
 
165595
166244
  /***/ }),
165596
166245
 
166246
+ /***/ "./src/Front/Applet/Sync/appletSyncHandler.utils.ts":
166247
+ /*!**********************************************************!*\
166248
+ !*** ./src/Front/Applet/Sync/appletSyncHandler.utils.ts ***!
166249
+ \**********************************************************/
166250
+ /*! no static exports found */
166251
+ /***/ (function(module, exports, __webpack_require__) {
166252
+
166253
+ "use strict";
166254
+
166255
+
166256
+ Object.defineProperty(exports, "__esModule", {
166257
+ value: true
166258
+ });
166259
+ exports.appletSyncEngineToSynchronizerSynchronizerType = void 0;
166260
+ var IPolymorphicSynchronizer_1 = __webpack_require__(/*! ../../../Synchronization/IPolymorphicSynchronizer */ "./src/Synchronization/IPolymorphicSynchronizer.ts");
166261
+ var ISyncConnectMessage_1 = __webpack_require__(/*! ./ISyncConnectMessage */ "./src/Front/Applet/Sync/ISyncConnectMessage.ts");
166262
+ function appletSyncEngineToSynchronizerSynchronizerType(engine) {
166263
+ if (engine === undefined) {
166264
+ return undefined;
166265
+ }
166266
+ switch (engine) {
166267
+ case ISyncConnectMessage_1.SyncEngine.SyncServer:
166268
+ return IPolymorphicSynchronizer_1.SynchronizerType.SyncServer;
166269
+ case ISyncConnectMessage_1.SyncEngine.Udp:
166270
+ return IPolymorphicSynchronizer_1.SynchronizerType.Udp;
166271
+ default:
166272
+ throw new Error("Unknown sync engine: " + engine);
166273
+ }
166274
+ }
166275
+ exports.appletSyncEngineToSynchronizerSynchronizerType = appletSyncEngineToSynchronizerSynchronizerType;
166276
+
166277
+ /***/ }),
166278
+
165597
166279
  /***/ "./src/Front/Applet/Sync/appletSyncSagas.ts":
165598
166280
  /*!**************************************************!*\
165599
166281
  !*** ./src/Front/Applet/Sync/appletSyncSagas.ts ***!
@@ -165608,59 +166290,79 @@ var _marked = /*#__PURE__*/regeneratorRuntime.mark(syncEventEmitting);
165608
166290
  Object.defineProperty(exports, "__esModule", {
165609
166291
  value: true
165610
166292
  });
165611
- exports.syncEventEmitting = void 0;
166293
+ exports.syncEventEmitting = exports.BroadcastedValueAction = exports.GroupStatusAction = void 0;
165612
166294
  var effects_1 = __webpack_require__(/*! redux-saga/effects */ "./node_modules/redux-saga/dist/redux-saga-effects-npm-proxy.esm.js");
165613
- var syncActions_1 = __webpack_require__(/*! @signageos/actions/dist/Sync/syncActions */ "./node_modules/@signageos/actions/dist/Sync/syncActions.js");
166295
+ var channels_1 = __webpack_require__(/*! ../../../ReduxSaga/channels */ "./src/ReduxSaga/channels.ts");
165614
166296
  var sendAppletMessage_1 = __webpack_require__(/*! ../sendAppletMessage */ "./src/Front/Applet/sendAppletMessage.ts");
165615
- var appletSyncHandler_1 = __webpack_require__(/*! ./appletSyncHandler */ "./src/Front/Applet/Sync/appletSyncHandler.ts");
165616
- function syncEventEmitting(window, messageTypePrefix, getState) {
165617
- return regeneratorRuntime.wrap(function syncEventEmitting$(_context3) {
166297
+ var ISynchronizer_1 = __webpack_require__(/*! ../../../Synchronization/ISynchronizer */ "./src/Synchronization/ISynchronizer.ts");
166298
+ exports.GroupStatusAction = 'Sync.GroupStatus';
166299
+ exports.BroadcastedValueAction = 'Sync.BroadcastedValue';
166300
+ function syncEventEmitting(window, messageTypePrefix, getState, synchronizer) {
166301
+ var syncValueChannel;
166302
+ return regeneratorRuntime.wrap(function syncEventEmitting$(_context2) {
165618
166303
  while (1) {
165619
- switch (_context3.prev = _context3.next) {
166304
+ switch (_context2.prev = _context2.next) {
165620
166305
  case 0:
165621
- _context3.next = 2;
165622
- return (0, effects_1.takeEvery)(syncActions_1.SetValue, /*#__PURE__*/regeneratorRuntime.mark(function _callee(action) {
166306
+ syncValueChannel = (0, channels_1.createChannel)(function (putEvent) {
166307
+ synchronizer.addListener(ISynchronizer_1.SynchronizerEvent.GroupStatus, function (event) {
166308
+ var action = Object.assign({
166309
+ type: exports.GroupStatusAction
166310
+ }, event);
166311
+ putEvent(action);
166312
+ });
166313
+ synchronizer.addListener(ISynchronizer_1.SynchronizerEvent.BroadcastedValue, function (event) {
166314
+ var action = Object.assign({
166315
+ type: exports.BroadcastedValueAction
166316
+ }, event);
166317
+ putEvent(action);
166318
+ });
166319
+ }); // spawn process that will take sync events and create messages for applet from them
166320
+ _context2.next = 3;
166321
+ return (0, effects_1.spawn)(channels_1.takeEvery, syncValueChannel, /*#__PURE__*/regeneratorRuntime.mark(function _callee(action) {
165623
166322
  return regeneratorRuntime.wrap(function _callee$(_context) {
165624
166323
  while (1) {
165625
166324
  switch (_context.prev = _context.next) {
165626
166325
  case 0:
165627
- _context.next = 2;
166326
+ _context.prev = 0;
166327
+ _context.t0 = action.type;
166328
+ _context.next = _context.t0 === exports.GroupStatusAction ? 4 : _context.t0 === exports.BroadcastedValueAction ? 7 : 10;
166329
+ break;
166330
+ case 4:
166331
+ _context.next = 6;
166332
+ return (0, sendAppletMessage_1.sendMessageToActiveAppletIfExists)(window, getState, {
166333
+ type: messageTypePrefix + '.sync.device_status',
166334
+ connectedPeers: action.connectedPeers,
166335
+ groupName: action.groupName
166336
+ });
166337
+ case 6:
166338
+ return _context.abrupt("break", 10);
166339
+ case 7:
166340
+ _context.next = 9;
165628
166341
  return (0, sendAppletMessage_1.sendMessageToActiveAppletIfExists)(window, getState, {
165629
166342
  type: messageTypePrefix + '.sync.set_value',
165630
166343
  groupName: action.groupName,
165631
166344
  key: action.key,
165632
166345
  value: action.value
165633
166346
  });
165634
- case 2:
166347
+ case 9:
166348
+ return _context.abrupt("break", 10);
166349
+ case 10:
166350
+ _context.next = 15;
166351
+ break;
166352
+ case 12:
166353
+ _context.prev = 12;
166354
+ _context.t1 = _context["catch"](0);
166355
+ console.error('sync set value event sending failed', _context.t1);
166356
+ case 15:
165635
166357
  case "end":
165636
166358
  return _context.stop();
165637
166359
  }
165638
166360
  }
165639
- }, _callee);
165640
- }));
165641
- case 2:
165642
- _context3.next = 4;
165643
- return (0, effects_1.takeEvery)(appletSyncHandler_1.DeviceStatusAction, /*#__PURE__*/regeneratorRuntime.mark(function _callee2(action) {
165644
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
165645
- while (1) {
165646
- switch (_context2.prev = _context2.next) {
165647
- case 0:
165648
- _context2.next = 2;
165649
- return (0, sendAppletMessage_1.sendMessageToActiveAppletIfExists)(window, getState, {
165650
- type: messageTypePrefix + '.sync.device_status',
165651
- connectedPeers: action.connectedPeers,
165652
- groupName: action.groupName
165653
- });
165654
- case 2:
165655
- case "end":
165656
- return _context2.stop();
165657
- }
165658
- }
165659
- }, _callee2);
166361
+ }, _callee, null, [[0, 12]]);
165660
166362
  }));
165661
- case 4:
166363
+ case 3:
165662
166364
  case "end":
165663
- return _context3.stop();
166365
+ return _context2.stop();
165664
166366
  }
165665
166367
  }
165666
166368
  }, _marked);
@@ -165669,31 +166371,6 @@ exports.syncEventEmitting = syncEventEmitting;
165669
166371
 
165670
166372
  /***/ }),
165671
166373
 
165672
- /***/ "./src/Front/Applet/Sync/synchronizerFactory.ts":
165673
- /*!******************************************************!*\
165674
- !*** ./src/Front/Applet/Sync/synchronizerFactory.ts ***!
165675
- \******************************************************/
165676
- /*! no static exports found */
165677
- /***/ (function(module, exports, __webpack_require__) {
165678
-
165679
- "use strict";
165680
-
165681
-
165682
- Object.defineProperty(exports, "__esModule", {
165683
- value: true
165684
- });
165685
- exports.createSocketSynchronizer = void 0;
165686
- var io = __webpack_require__(/*! socket.io-client */ "./node_modules/socket.io-client/lib/index.js");
165687
- var SocketSynchronizer_1 = __webpack_require__(/*! ./SocketSynchronizer */ "./src/Front/Applet/Sync/SocketSynchronizer.ts");
165688
- function createSocketSynchronizer(serverUri, getNativeDriver) {
165689
- return new SocketSynchronizer_1["default"](getNativeDriver, function (ioServerUri) {
165690
- return io(ioServerUri);
165691
- }, serverUri);
165692
- }
165693
- exports.createSocketSynchronizer = createSocketSynchronizer;
165694
-
165695
- /***/ }),
165696
-
165697
166374
  /***/ "./src/Front/Applet/Timing/appletTimingHandler.ts":
165698
166375
  /*!********************************************************!*\
165699
166376
  !*** ./src/Front/Applet/Timing/appletTimingHandler.ts ***!
@@ -167030,6 +167707,7 @@ var appletManagementProxyHandler_1 = __webpack_require__(/*! ./Management/Proxy/
167030
167707
  var appletManagementSystemInfoHandler_1 = __webpack_require__(/*! ./Management/SystemInfo/appletManagementSystemInfoHandler */ "./src/Front/Applet/Management/SystemInfo/appletManagementSystemInfoHandler.ts");
167031
167708
  var appletKeyHandler_1 = __webpack_require__(/*! ./Input/appletKeyHandler */ "./src/Front/Applet/Input/appletKeyHandler.ts");
167032
167709
  var appletOSDHandler_1 = __webpack_require__(/*! ./OSD/appletOSDHandler */ "./src/Front/Applet/OSD/appletOSDHandler.ts");
167710
+ var refreshHandler_1 = __webpack_require__(/*! ./Main/refreshHandler */ "./src/Front/Applet/Main/refreshHandler.ts");
167033
167711
  var debug = Debug('@signageos/front-display:Front:Applet:appletSagas');
167034
167712
  function updateAppletUniqueHash() {
167035
167713
  var activeAppletUniqueHash, lastUpdateActiveAppletBinary;
@@ -167269,7 +167947,7 @@ function handleAppletMessage(messageTypePrefix, data, appletUid, timingChecksum,
167269
167947
  while (1) {
167270
167948
  switch (_context10.prev = _context10.next) {
167271
167949
  case 0:
167272
- handlers = [pingHandler_1["default"], appletVideoHandler_1["default"], appletStreamHandler_1["default"], appletCommandHandler_1["default"], appletHardwareHandler_1["default"], appletHardwareBarcodeScannerHandler_1["default"], appletHardwareSerialPortHandler_1["default"], appletTouchHandler_1["default"], appletOfflineCacheHandler_1["default"], appletBrowserHandler_1["default"], appletTimingHandler_1["default"], appletSyncHandler_1["default"], appletFileSystemHandler_1["default"], appletWifiHandler_1["default"], appletDisplayHandler_1["default"], appletManagementHandler_1["default"], appletManagementNetworkHandler_1["default"], appletMonitorsHandler_1["default"], appletDeviceInfoHandler_1["default"], appletManagementProxyHandler_1["default"], appletManagementSystemInfoHandler_1["default"], appletKeyHandler_1["default"], appletOSDHandler_1["default"]];
167950
+ handlers = [refreshHandler_1["default"], pingHandler_1["default"], appletVideoHandler_1["default"], appletStreamHandler_1["default"], appletCommandHandler_1["default"], appletHardwareHandler_1["default"], appletHardwareBarcodeScannerHandler_1["default"], appletHardwareSerialPortHandler_1["default"], appletTouchHandler_1["default"], appletOfflineCacheHandler_1["default"], appletBrowserHandler_1["default"], appletTimingHandler_1["default"], appletSyncHandler_1["default"], appletFileSystemHandler_1["default"], appletWifiHandler_1["default"], appletDisplayHandler_1["default"], appletManagementHandler_1["default"], appletManagementNetworkHandler_1["default"], appletMonitorsHandler_1["default"], appletDeviceInfoHandler_1["default"], appletManagementProxyHandler_1["default"], appletManagementSystemInfoHandler_1["default"], appletKeyHandler_1["default"], appletOSDHandler_1["default"]];
167273
167951
  debug('Handling applet message', data, appletUid, timingChecksum);
167274
167952
  index = 0;
167275
167953
  case 3:
@@ -169019,11 +169697,12 @@ var _marked = /*#__PURE__*/regeneratorRuntime.mark(devicePerformPowerAction),
169019
169697
  _marked2 = /*#__PURE__*/regeneratorRuntime.mark(devicePerformScheduledPowerAction),
169020
169698
  _marked3 = /*#__PURE__*/regeneratorRuntime.mark(deviceDisplayPowerAction),
169021
169699
  _marked4 = /*#__PURE__*/regeneratorRuntime.mark(deviceAppletDisablingRestoresActiveApplet),
169022
- _marked5 = /*#__PURE__*/regeneratorRuntime.mark(performPowerAction);
169700
+ _marked5 = /*#__PURE__*/regeneratorRuntime.mark(performPowerAction),
169701
+ _marked6 = /*#__PURE__*/regeneratorRuntime.mark(performAppletRefresh);
169023
169702
  Object.defineProperty(exports, "__esModule", {
169024
169703
  value: true
169025
169704
  });
169026
- exports.deviceAppletDisablingRestoresActiveApplet = exports.deviceDisplayPowerAction = exports.devicePerformScheduledPowerAction = exports.devicePerformPowerAction = void 0;
169705
+ exports.performAppletRefresh = exports.deviceAppletDisablingRestoresActiveApplet = exports.deviceDisplayPowerAction = exports.devicePerformScheduledPowerAction = exports.devicePerformPowerAction = void 0;
169027
169706
  var _ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
169028
169707
  var socketActionCreator_1 = __webpack_require__(/*! ../../../Socket/socketActionCreator */ "./src/Socket/socketActionCreator.ts");
169029
169708
  var effects_1 = __webpack_require__(/*! redux-saga/effects */ "./node_modules/redux-saga/dist/redux-saga-effects-npm-proxy.esm.js");
@@ -169368,6 +170047,24 @@ function performPowerAction(getNativeDriver, propertyStorage, offlineCache, powe
169368
170047
  }
169369
170048
  }, _marked5);
169370
170049
  }
170050
+ function performAppletRefresh() {
170051
+ return regeneratorRuntime.wrap(function performAppletRefresh$(_context12) {
170052
+ while (1) {
170053
+ switch (_context12.prev = _context12.next) {
170054
+ case 0:
170055
+ _context12.next = 2;
170056
+ return (0, effects_1.put)({
170057
+ type: devicePowerActions_1.PerformPowerAction,
170058
+ powerType: PowerActionType_1["default"].APPLET_RELOAD
170059
+ });
170060
+ case 2:
170061
+ case "end":
170062
+ return _context12.stop();
170063
+ }
170064
+ }
170065
+ }, _marked6);
170066
+ }
170067
+ exports.performAppletRefresh = performAppletRefresh;
169371
170068
 
169372
170069
  /***/ }),
169373
170070
 
@@ -180334,7 +181031,7 @@ function frontSaga(defaultConfig, _ref, getState, propertyStorage, timerManager,
180334
181031
  return managementDriver.timeManager.getEpochMillis();
180335
181032
  }), (0, socketHealthCheckSagas_1.healthChecking)(), (0, deviceConfigurationSagas_1.updatingConfiguration)(getNativeDriver, getManagementDriver, propertyStorage, defaultConfig, publicKey, 'front'), (0, authenticationSagas_1.autoDeviceAuthentication)(sessionIdKey, getNativeDriver), (0, authenticationSagas_1.storeDeviceSession)(sessionIdKey, getNativeDriver), (0, authenticationSagas_1.fallbackDeviceUidAuthentication)(getNativeDriver), (0, authenticationSagas_1.afterRegistrationDeviceUidAuthentication)(getNativeDriver), (0, deviceSagas_3.fallbackDeviceRegistration)(getNativeDriver, autoVerification),
180336
181033
  // front sagas
180337
- (0, currentTimeSyncSagas_1.startupDeviceDateTimeSettings)(), (0, deviceSagas_2.notifyDeviceSaga)(getManagementDriver), (0, deviceSagas_3.notifyDeviceFrontDisplayVersion)(frontDisplayVersion), (0, deviceSagas_2.notifyDeviceApplicationVersion)(getNativeDriver, applicationVersion), (0, appletTimingControllerSagas_1.controlActiveAppletTiming)(webWorkerFactory, defaultTiming ? [defaultTiming] : undefined), (0, appletSagas_1.bindAppletMessages)(frontAppletPrefix, global, getState, getNativeDriver, getSynchronizer, offlineCache, shortAppletFilesUrl !== null && shortAppletFilesUrl !== void 0 ? shortAppletFilesUrl : false), (0, appletSagas_1.bindAppletIframe)(frontAppletPrefix, global, getState, frontDisplayVersion), (0, appletSagas_1.updateAppletDeviceAuthHash)(frontAppletPrefix, global, getState), (0, appletSagas_1.updateAppletUniqueHash)(), (0, appletVideoSagas_1.activeAppletRestore)(getNativeDriver, getSynchronizer), (0, appletVideoSagas_1.restoreOnAppletChange)(), (0, appletDateTimeSagas_1.currentTimestampEmiting)(global, frontAppletPrefix, getState), (0, appletBrowserSagas_1.browserEventEmitting)(global, frontAppletPrefix, getNativeDriver, getState), (0, appletVideoSagas_1.videoEventEmitting)(global, frontAppletPrefix, getState), (0, appletStreamSagas_1.streamEventEmitting)(global, frontAppletPrefix, getState), (0, appletWifiSagas_1.wifiEventEmitting)(global, frontAppletPrefix, getManagementDriver, getState), (0, appletProximitySensorSagas_1.proximitySensorStatusChangeEmitting)(global, frontAppletPrefix, getManagementDriver, getState), (0, appletSyncSagas_1.syncEventEmitting)(global, frontAppletPrefix, getState), (0, appletKeySagas_1.inputKeysEmitting)(global, frontAppletPrefix, getState), (0, appletFileSystemSagas_1.storageStatusChangeEmitting)(global, frontAppletPrefix, getNativeDriver, getState), (0, deviceAuthenticationSagas_1.startupDeviceAuthHash)(propertyStorage), (0, deviceAuthenticationSagas_1.cacheDeviceAuthHash)(propertyStorage), (0, deviceVerificationSagas_1.deviceVerification)(getNativeDriver), (0, deviceVerificationSagas_2.dispatchVerificationHash)(global), (0, deviceDeprovisionSagas_1.deviceDeprovision)(getNativeDriver, getManagementDriver, responsibilities, sessionIdKey), (0, devicePowerActionSagas_1.deviceDisplayPowerAction)(), (0, devicePowerActionSagas_1.deviceAppletDisablingRestoresActiveApplet)(), (0, deviceSchedulePowerActionSagas_1.deviceSchedulePowerAction)(propertyStorage), (0, devicePowerActionSagas_1.devicePerformScheduledPowerAction)(getNativeDriver, propertyStorage, offlineCache), (0, timerControllerSagas_1.appletTimerChecking)(timerManager), (0, deviceRemoteControlSagas_1.startupDeviceRemoteControlSettingsSaga)(getNativeDriver), (0, keySagas_1.keyUpSaga)(getNativeDriver), (0, keySagas_1.keySequenceSaga)(global), (0, motionSagas_1.motionSequenceSaga)(global), (0, softwareKeyboardSagas_1.bindNumericKeyboardSaga)(), (0, controlEnablingSagas_1.controlEnablingSaga)(), (0, controlEnablingSagas_1.generateControlPinSaga)(), (0, controlEnablingSagas_1.reportDevicePinChangedSaga)(), (0, osdSagas_1.showOSDSaga)(getNativeDriver, propertyStorage), (0, networkSagas_1.networkConnection)(getState, getNativeDriver, getManagementDriver), (0, touchSaga_1.touchSaga)(frontAppletPrefix, getState, getNativeDriver, global), (0, deviceSagas_1.updateTitle)(global), (0, deviceSagas_1.updateDeviceLocation)(propertyStorage), (0, deviceSagas_1.updateOrganizationTags)(propertyStorage), (0, appletCommandDispatchSagas_1.dispatchAppletCommandToApplet)(frontAppletPrefix, global, getState, bundledApplet), (0, deviceDebugSettingsSagas_1.devicePerformDebugSettings)(global, getNativeDriver, propertyStorage, frontAppletPrefix, getState), (0, deviceDebugSettingsSagas_1.readSetDeviceDebugSettings)(global, getNativeDriver, propertyStorage, frontAppletPrefix, getState), (0, devicePowerActionSagas_1.devicePerformPowerAction)(getNativeDriver, propertyStorage, offlineCache), (0, deviceProprietaryTimerSagas_1.syncProprietaryTimerSettingsSaga)(function () {
181034
+ (0, currentTimeSyncSagas_1.startupDeviceDateTimeSettings)(), (0, deviceSagas_2.notifyDeviceSaga)(getManagementDriver), (0, deviceSagas_3.notifyDeviceFrontDisplayVersion)(frontDisplayVersion), (0, deviceSagas_2.notifyDeviceApplicationVersion)(getNativeDriver, applicationVersion), (0, appletTimingControllerSagas_1.controlActiveAppletTiming)(webWorkerFactory, defaultTiming ? [defaultTiming] : undefined), (0, appletSagas_1.bindAppletMessages)(frontAppletPrefix, global, getState, getNativeDriver, getSynchronizer, offlineCache, shortAppletFilesUrl !== null && shortAppletFilesUrl !== void 0 ? shortAppletFilesUrl : false), (0, appletSagas_1.bindAppletIframe)(frontAppletPrefix, global, getState, frontDisplayVersion), (0, appletSagas_1.updateAppletDeviceAuthHash)(frontAppletPrefix, global, getState), (0, appletSagas_1.updateAppletUniqueHash)(), (0, appletVideoSagas_1.activeAppletRestore)(getNativeDriver, getSynchronizer), (0, appletVideoSagas_1.restoreOnAppletChange)(), (0, appletDateTimeSagas_1.currentTimestampEmiting)(global, frontAppletPrefix, getState), (0, appletBrowserSagas_1.browserEventEmitting)(global, frontAppletPrefix, getNativeDriver, getState), (0, appletVideoSagas_1.videoEventEmitting)(global, frontAppletPrefix, getState), (0, appletStreamSagas_1.streamEventEmitting)(global, frontAppletPrefix, getState), (0, appletWifiSagas_1.wifiEventEmitting)(global, frontAppletPrefix, getManagementDriver, getState), (0, appletProximitySensorSagas_1.proximitySensorStatusChangeEmitting)(global, frontAppletPrefix, getManagementDriver, getState), (0, appletSyncSagas_1.syncEventEmitting)(global, frontAppletPrefix, getState, synchronizer), (0, appletKeySagas_1.inputKeysEmitting)(global, frontAppletPrefix, getState), (0, appletFileSystemSagas_1.storageStatusChangeEmitting)(global, frontAppletPrefix, getNativeDriver, getState), (0, deviceAuthenticationSagas_1.startupDeviceAuthHash)(propertyStorage), (0, deviceAuthenticationSagas_1.cacheDeviceAuthHash)(propertyStorage), (0, deviceVerificationSagas_1.deviceVerification)(getNativeDriver), (0, deviceVerificationSagas_2.dispatchVerificationHash)(global), (0, deviceDeprovisionSagas_1.deviceDeprovision)(getNativeDriver, getManagementDriver, responsibilities, sessionIdKey), (0, devicePowerActionSagas_1.deviceDisplayPowerAction)(), (0, devicePowerActionSagas_1.deviceAppletDisablingRestoresActiveApplet)(), (0, deviceSchedulePowerActionSagas_1.deviceSchedulePowerAction)(propertyStorage), (0, devicePowerActionSagas_1.devicePerformScheduledPowerAction)(getNativeDriver, propertyStorage, offlineCache), (0, timerControllerSagas_1.appletTimerChecking)(timerManager), (0, deviceRemoteControlSagas_1.startupDeviceRemoteControlSettingsSaga)(getNativeDriver), (0, keySagas_1.keyUpSaga)(getNativeDriver), (0, keySagas_1.keySequenceSaga)(global), (0, motionSagas_1.motionSequenceSaga)(global), (0, softwareKeyboardSagas_1.bindNumericKeyboardSaga)(), (0, controlEnablingSagas_1.controlEnablingSaga)(), (0, controlEnablingSagas_1.generateControlPinSaga)(), (0, controlEnablingSagas_1.reportDevicePinChangedSaga)(), (0, osdSagas_1.showOSDSaga)(getNativeDriver, propertyStorage), (0, networkSagas_1.networkConnection)(getState, getNativeDriver, getManagementDriver), (0, touchSaga_1.touchSaga)(frontAppletPrefix, getState, getNativeDriver, global), (0, deviceSagas_1.updateTitle)(global), (0, deviceSagas_1.updateDeviceLocation)(propertyStorage), (0, deviceSagas_1.updateOrganizationTags)(propertyStorage), (0, appletCommandDispatchSagas_1.dispatchAppletCommandToApplet)(frontAppletPrefix, global, getState, bundledApplet), (0, deviceDebugSettingsSagas_1.devicePerformDebugSettings)(global, getNativeDriver, propertyStorage, frontAppletPrefix, getState), (0, deviceDebugSettingsSagas_1.readSetDeviceDebugSettings)(global, getNativeDriver, propertyStorage, frontAppletPrefix, getState), (0, devicePowerActionSagas_1.devicePerformPowerAction)(getNativeDriver, propertyStorage, offlineCache), (0, deviceProprietaryTimerSagas_1.syncProprietaryTimerSettingsSaga)(function () {
180338
181035
  return nativeDriver.frontSupports(FrontCapability_1["default"].TIMERS_PROPRIETARY);
180339
181036
  }, proprietaryTimerStorage), (0, testSagas_1.runTestsSaga)([(0, CacheTest_1["default"])(nativeDriver), (0, FileSystemTest_1["default"])(nativeDriver), (0, HTML5Test_1["default"])(dispatch), (0, VideoTest_1["default"])(nativeDriver), (0, WeinreTest_1["default"])(global)].concat(_toConsumableArray(frontExtraTests !== null && frontExtraTests !== void 0 ? frontExtraTests : []))), (0, appletBinarySagas_1.activeAppletBinary)(getState, getNativeDriver), (0, appletTimingCacheSagas_1.loadAppletTimingsDefinition)(propertyStorage), (0, appletTimingCacheSagas_1.saveAppletTimingsDefinition)(propertyStorage), (0, appletTimingCacheSagas_1.deleteAppletTimingsDefinition)(propertyStorage, defaultTiming ? [defaultTiming] : undefined), (0, appletTimingCacheSagas_1.saveAppletBinary)(), (0, appletBinarySagas_1.updateActiveAppletBinaryFile)(shortAppletFilesUrl !== null && shortAppletFilesUrl !== void 0 ? shortAppletFilesUrl : false, offlineCache, defaultTimingData)].concat(_toConsumableArray(logOfflineActions ? [(0, offlineActionsSagas_1.offlineActionsSaga)('front.', getNativeDriver, getManagementDriver)] : []), [(0, commonSystemLogsSagas_1.commonSystemLogsSaga)(), (0, systemLogsSagas_1.systemLogsSaga)(getManagementDriver), (0, debugSagas_1.debugAllActions)()], _toConsumableArray(bundledApplet ? [(0, effects_1.put)({
180340
181037
  type: bundledAppletActions_1.NotifyBundledApplet,
@@ -201381,6 +202078,662 @@ exports["default"] = StreamProtocol;
201381
202078
 
201382
202079
  /***/ }),
201383
202080
 
202081
+ /***/ "./src/Synchronization/IPolymorphicSynchronizer.ts":
202082
+ /*!*********************************************************!*\
202083
+ !*** ./src/Synchronization/IPolymorphicSynchronizer.ts ***!
202084
+ \*********************************************************/
202085
+ /*! no static exports found */
202086
+ /***/ (function(module, exports, __webpack_require__) {
202087
+
202088
+ "use strict";
202089
+
202090
+
202091
+ Object.defineProperty(exports, "__esModule", {
202092
+ value: true
202093
+ });
202094
+ exports.SynchronizerType = void 0;
202095
+ var SynchronizerType;
202096
+ (function (SynchronizerType) {
202097
+ SynchronizerType["SyncServer"] = "sync-server";
202098
+ SynchronizerType["Udp"] = "udp";
202099
+ })(SynchronizerType = exports.SynchronizerType || (exports.SynchronizerType = {}));
202100
+
202101
+ /***/ }),
202102
+
202103
+ /***/ "./src/Synchronization/ISynchronizer.ts":
202104
+ /*!**********************************************!*\
202105
+ !*** ./src/Synchronization/ISynchronizer.ts ***!
202106
+ \**********************************************/
202107
+ /*! no static exports found */
202108
+ /***/ (function(module, exports, __webpack_require__) {
202109
+
202110
+ "use strict";
202111
+
202112
+
202113
+ Object.defineProperty(exports, "__esModule", {
202114
+ value: true
202115
+ });
202116
+ exports.SynchronizerEvent = void 0;
202117
+ var SynchronizerEvent;
202118
+ (function (SynchronizerEvent) {
202119
+ SynchronizerEvent["GroupStatus"] = "group_status";
202120
+ SynchronizerEvent["GroupLeft"] = "group_left";
202121
+ SynchronizerEvent["BroadcastedValue"] = "broadcasted_value";
202122
+ })(SynchronizerEvent = exports.SynchronizerEvent || (exports.SynchronizerEvent = {}));
202123
+
202124
+ /***/ }),
202125
+
202126
+ /***/ "./src/Synchronization/SocketSynchronizer.ts":
202127
+ /*!***************************************************!*\
202128
+ !*** ./src/Synchronization/SocketSynchronizer.ts ***!
202129
+ \***************************************************/
202130
+ /*! no static exports found */
202131
+ /***/ (function(module, exports, __webpack_require__) {
202132
+
202133
+ "use strict";
202134
+
202135
+
202136
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
202137
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
202138
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
202139
+ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
202140
+ var __decorate = this && this.__decorate || function (decorators, target, key, desc) {
202141
+ var c = arguments.length,
202142
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
202143
+ d;
202144
+ if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
202145
+ if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
202146
+ }
202147
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
202148
+ };
202149
+ var __metadata = this && this.__metadata || function (k, v) {
202150
+ if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
202151
+ };
202152
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
202153
+ function adopt(value) {
202154
+ return value instanceof P ? value : new P(function (resolve) {
202155
+ resolve(value);
202156
+ });
202157
+ }
202158
+ return new (P || (P = Promise))(function (resolve, reject) {
202159
+ function fulfilled(value) {
202160
+ try {
202161
+ step(generator.next(value));
202162
+ } catch (e) {
202163
+ reject(e);
202164
+ }
202165
+ }
202166
+ function rejected(value) {
202167
+ try {
202168
+ step(generator["throw"](value));
202169
+ } catch (e) {
202170
+ reject(e);
202171
+ }
202172
+ }
202173
+ function step(result) {
202174
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
202175
+ }
202176
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
202177
+ });
202178
+ };
202179
+ Object.defineProperty(exports, "__esModule", {
202180
+ value: true
202181
+ });
202182
+ var events_1 = __webpack_require__(/*! events */ "./node_modules/events/events.js");
202183
+ var lockedDecorator_1 = __webpack_require__(/*! @signageos/lib/es6/Lock/lockedDecorator */ "./node_modules/@signageos/lib/es6/Lock/lockedDecorator.js");
202184
+ var ISynchronizer_1 = __webpack_require__(/*! ./ISynchronizer */ "./src/Synchronization/ISynchronizer.ts");
202185
+ var Debug = __webpack_require__(/*! debug */ "./node_modules/debug/src/browser.js");
202186
+ var debug = Debug('@signageos/front-display:Front:Applet:Sync:SocketSynchronizer');
202187
+ /**
202188
+ * API to synchronize content with other devices in the network.
202189
+ * When online
202190
+ * - If everything is fine and device is always online, the logic is simple - initialize group on the server to determine,
202191
+ * which devices belong together and whenever wait() is called, wait until all other devices are waiting too
202192
+ * and resolve it on all simultaniously.
202193
+ * When offline
202194
+ * - If the device goes offline in any point in the process, it silently switches to offline mode, which means that
202195
+ * the SocketSynchronizer is itself acting like a mock server and simply validates and confirms all the requests to
202196
+ * the API immediately to maintain smooth and seamless operation.
202197
+ * - SocketSynchronizer also buffers all the initialized groups while offline and when it goes back online, it dumps the buffer
202198
+ * to the server to synchronize the internal state.
202199
+ */
202200
+ var SocketSynchronizer = /*#__PURE__*/function () {
202201
+ function SocketSynchronizer(getNativeDriver, createSocket, defaultServerUri) {
202202
+ _classCallCheck(this, SocketSynchronizer);
202203
+ this.getNativeDriver = getNativeDriver;
202204
+ this.createSocket = createSocket;
202205
+ this.defaultServerUri = defaultServerUri;
202206
+ this.connected = false;
202207
+ this.groups = {};
202208
+ this.emitter = new events_1.EventEmitter();
202209
+ }
202210
+ _createClass(SocketSynchronizer, [{
202211
+ key: "connect",
202212
+ value: function connect(serverUri) {
202213
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
202214
+ return regeneratorRuntime.wrap(function _callee$(_context) {
202215
+ while (1) {
202216
+ switch (_context.prev = _context.next) {
202217
+ case 0:
202218
+ if (!this.socket) {
202219
+ _context.next = 3;
202220
+ break;
202221
+ }
202222
+ _context.next = 3;
202223
+ return this.close();
202224
+ case 3:
202225
+ this.initSocket(serverUri || this.defaultServerUri);
202226
+ case 4:
202227
+ case "end":
202228
+ return _context.stop();
202229
+ }
202230
+ }
202231
+ }, _callee, this);
202232
+ }));
202233
+ }
202234
+ }, {
202235
+ key: "close",
202236
+ value: function close() {
202237
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
202238
+ var _this = this;
202239
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
202240
+ while (1) {
202241
+ switch (_context2.prev = _context2.next) {
202242
+ case 0:
202243
+ if (this.socket) {
202244
+ _context2.next = 2;
202245
+ break;
202246
+ }
202247
+ throw new Error('Can\'t close when not connected');
202248
+ case 2:
202249
+ this.socket.close();
202250
+ this.socket = undefined;
202251
+ this.connected = false;
202252
+ Object.keys(this.groups).forEach(function (groupName) {
202253
+ _this.emitter.emit(ISynchronizer_1.SynchronizerEvent.GroupLeft, groupName);
202254
+ });
202255
+ this.groups = {};
202256
+ case 7:
202257
+ case "end":
202258
+ return _context2.stop();
202259
+ }
202260
+ }
202261
+ }, _callee2, this);
202262
+ }));
202263
+ }
202264
+ }, {
202265
+ key: "joinGroup",
202266
+ value: function joinGroup(_ref) {
202267
+ var groupName = _ref.groupName,
202268
+ deviceIdentification = _ref.deviceIdentification;
202269
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
202270
+ var deviceId;
202271
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
202272
+ while (1) {
202273
+ switch (_context3.prev = _context3.next) {
202274
+ case 0:
202275
+ if (this.socket) {
202276
+ _context3.next = 2;
202277
+ break;
202278
+ }
202279
+ throw new Error('Not connected. Call connect() first.');
202280
+ case 2:
202281
+ deviceId = deviceIdentification !== undefined ? deviceIdentification : Math.random().toString(32);
202282
+ if (!this.connected) {
202283
+ _context3.next = 8;
202284
+ break;
202285
+ }
202286
+ _context3.next = 6;
202287
+ return this.joinGroupOnline(groupName, deviceId);
202288
+ case 6:
202289
+ _context3.next = 9;
202290
+ break;
202291
+ case 8:
202292
+ this.joinGroupOffline(groupName, deviceId);
202293
+ case 9:
202294
+ case "end":
202295
+ return _context3.stop();
202296
+ }
202297
+ }
202298
+ }, _callee3, this);
202299
+ }));
202300
+ }
202301
+ }, {
202302
+ key: "leaveGroup",
202303
+ value: function leaveGroup(groupName) {
202304
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
202305
+ return regeneratorRuntime.wrap(function _callee4$(_context4) {
202306
+ while (1) {
202307
+ switch (_context4.prev = _context4.next) {
202308
+ case 0:
202309
+ if (this.socket) {
202310
+ _context4.next = 2;
202311
+ break;
202312
+ }
202313
+ throw new Error('Not connected. Call connect() first.');
202314
+ case 2:
202315
+ if (this.groups[groupName]) {
202316
+ _context4.next = 4;
202317
+ break;
202318
+ }
202319
+ throw new Error("Group ".concat(groupName, " isn't joined"));
202320
+ case 4:
202321
+ if (!this.connected) {
202322
+ _context4.next = 9;
202323
+ break;
202324
+ }
202325
+ _context4.next = 7;
202326
+ return this.leaveGroupOnline(groupName);
202327
+ case 7:
202328
+ _context4.next = 10;
202329
+ break;
202330
+ case 9:
202331
+ this.leaveGroupOffline(groupName);
202332
+ case 10:
202333
+ case "end":
202334
+ return _context4.stop();
202335
+ }
202336
+ }
202337
+ }, _callee4, this);
202338
+ }));
202339
+ }
202340
+ }, {
202341
+ key: "isConnected",
202342
+ value: function isConnected() {
202343
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
202344
+ return regeneratorRuntime.wrap(function _callee5$(_context5) {
202345
+ while (1) {
202346
+ switch (_context5.prev = _context5.next) {
202347
+ case 0:
202348
+ return _context5.abrupt("return", !!this.socket);
202349
+ case 1:
202350
+ case "end":
202351
+ return _context5.stop();
202352
+ }
202353
+ }
202354
+ }, _callee5, this);
202355
+ }));
202356
+ }
202357
+ }, {
202358
+ key: "wait",
202359
+ value: function wait(_ref2) {
202360
+ var groupName = _ref2.groupName,
202361
+ data = _ref2.data,
202362
+ timeoutMs = _ref2.timeoutMs;
202363
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
202364
+ return regeneratorRuntime.wrap(function _callee6$(_context6) {
202365
+ while (1) {
202366
+ switch (_context6.prev = _context6.next) {
202367
+ case 0:
202368
+ if (this.socket) {
202369
+ _context6.next = 2;
202370
+ break;
202371
+ }
202372
+ throw new Error('Not connected. Call connect() first.');
202373
+ case 2:
202374
+ if (!(typeof timeoutMs !== 'undefined' && timeoutMs <= 0)) {
202375
+ _context6.next = 4;
202376
+ break;
202377
+ }
202378
+ throw new Error('Timeout must be greater than 0');
202379
+ case 4:
202380
+ if (!this.connected) {
202381
+ _context6.next = 10;
202382
+ break;
202383
+ }
202384
+ _context6.next = 7;
202385
+ return this.callOnlineWait(groupName, data, timeoutMs);
202386
+ case 7:
202387
+ return _context6.abrupt("return", _context6.sent);
202388
+ case 10:
202389
+ return _context6.abrupt("return", this.callOfflineWait(groupName, data));
202390
+ case 11:
202391
+ case "end":
202392
+ return _context6.stop();
202393
+ }
202394
+ }
202395
+ }, _callee6, this);
202396
+ }));
202397
+ }
202398
+ }, {
202399
+ key: "broadcastValue",
202400
+ value: function broadcastValue(_ref3) {
202401
+ var groupName = _ref3.groupName,
202402
+ key = _ref3.key,
202403
+ value = _ref3.value;
202404
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee7() {
202405
+ return regeneratorRuntime.wrap(function _callee7$(_context7) {
202406
+ while (1) {
202407
+ switch (_context7.prev = _context7.next) {
202408
+ case 0:
202409
+ if (this.socket) {
202410
+ _context7.next = 2;
202411
+ break;
202412
+ }
202413
+ throw new Error('Not connected. Call connect() first.');
202414
+ case 2:
202415
+ if (this.groups[groupName]) {
202416
+ _context7.next = 4;
202417
+ break;
202418
+ }
202419
+ throw new Error('Group ' + groupName + ' wasn\'t initialized');
202420
+ case 4:
202421
+ this.socket.emit('request_set_value', {
202422
+ groupName: groupName,
202423
+ key: key,
202424
+ value: value
202425
+ });
202426
+ // if not connected, emit the value back to oneself
202427
+ if (!this.connected) {
202428
+ this.emitValue(groupName, key, value);
202429
+ }
202430
+ case 6:
202431
+ case "end":
202432
+ return _context7.stop();
202433
+ }
202434
+ }
202435
+ }, _callee7, this);
202436
+ }));
202437
+ }
202438
+ }, {
202439
+ key: "addListener",
202440
+ value: function addListener(event, listener) {
202441
+ this.emitter.addListener(event, listener);
202442
+ }
202443
+ }, {
202444
+ key: "removeListener",
202445
+ value: function removeListener(event, listener) {
202446
+ this.emitter.removeListener(event, listener);
202447
+ }
202448
+ }, {
202449
+ key: "initSocket",
202450
+ value: function initSocket(serverUri) {
202451
+ var _this2 = this;
202452
+ this.socket = this.createSocket(serverUri);
202453
+ this.socket.on('connect', function () {
202454
+ return __awaiter(_this2, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee8() {
202455
+ var _i, _Object$keys, groupName;
202456
+ return regeneratorRuntime.wrap(function _callee8$(_context8) {
202457
+ while (1) {
202458
+ switch (_context8.prev = _context8.next) {
202459
+ case 0:
202460
+ this.connected = true;
202461
+ // flush all offline groups to the server
202462
+ _i = 0, _Object$keys = Object.keys(this.groups);
202463
+ case 2:
202464
+ if (!(_i < _Object$keys.length)) {
202465
+ _context8.next = 16;
202466
+ break;
202467
+ }
202468
+ groupName = _Object$keys[_i];
202469
+ if (!(this.groups[groupName].isOnline === false)) {
202470
+ _context8.next = 13;
202471
+ break;
202472
+ }
202473
+ _context8.prev = 5;
202474
+ _context8.next = 8;
202475
+ return this.joinGroupOnline(groupName, this.groups[groupName].deviceIdentification);
202476
+ case 8:
202477
+ _context8.next = 13;
202478
+ break;
202479
+ case 10:
202480
+ _context8.prev = 10;
202481
+ _context8.t0 = _context8["catch"](5);
202482
+ console.error('flush offline initialized group to the server', groupName, _context8.t0);
202483
+ case 13:
202484
+ _i++;
202485
+ _context8.next = 2;
202486
+ break;
202487
+ case 16:
202488
+ case "end":
202489
+ return _context8.stop();
202490
+ }
202491
+ }
202492
+ }, _callee8, this, [[5, 10]]);
202493
+ }));
202494
+ });
202495
+ this.socket.on('disconnect', function () {
202496
+ _this2.connected = false;
202497
+ // when device disconnects, all initialized groups are now offline and has to be flushed to the server on reconnection
202498
+ for (var _i2 = 0, _Object$keys2 = Object.keys(_this2.groups); _i2 < _Object$keys2.length; _i2++) {
202499
+ var groupName = _Object$keys2[_i2];
202500
+ _this2.groups[groupName].isOnline = false;
202501
+ }
202502
+ });
202503
+ this.socket.on('set_value', function (groupName, key, value) {
202504
+ if (_this2.groups[groupName]) {
202505
+ var broadcastedValue = {
202506
+ groupName: groupName,
202507
+ key: key,
202508
+ value: value
202509
+ };
202510
+ _this2.emitter.emit(ISynchronizer_1.SynchronizerEvent.BroadcastedValue, broadcastedValue);
202511
+ }
202512
+ });
202513
+ this.socket.on('device_status', function (connectedPeers, groupName) {
202514
+ if (_this2.groups[groupName]) {
202515
+ var groupStatus = {
202516
+ groupName: groupName,
202517
+ connectedPeers: connectedPeers
202518
+ };
202519
+ _this2.emitter.emit(ISynchronizer_1.SynchronizerEvent.GroupStatus, groupStatus);
202520
+ }
202521
+ });
202522
+ }
202523
+ }, {
202524
+ key: "joinGroupOnline",
202525
+ value: function joinGroupOnline(groupName, deviceIdentification) {
202526
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee9() {
202527
+ var _this3 = this;
202528
+ var nativeDriver, deviceUid;
202529
+ return regeneratorRuntime.wrap(function _callee9$(_context9) {
202530
+ while (1) {
202531
+ switch (_context9.prev = _context9.next) {
202532
+ case 0:
202533
+ nativeDriver = this.getNativeDriver();
202534
+ _context9.next = 3;
202535
+ return nativeDriver.getDeviceUid();
202536
+ case 3:
202537
+ deviceUid = _context9.sent;
202538
+ _context9.next = 6;
202539
+ return new Promise(function (resolve, reject) {
202540
+ _this3.socket.emit('join_group', {
202541
+ deviceUid: deviceUid,
202542
+ groupName: groupName,
202543
+ deviceIdentification: deviceIdentification
202544
+ }, function (error) {
202545
+ if (error) {
202546
+ reject(error);
202547
+ } else {
202548
+ resolve();
202549
+ }
202550
+ });
202551
+ });
202552
+ case 6:
202553
+ this.groups[groupName] = {
202554
+ isOnline: true
202555
+ };
202556
+ case 7:
202557
+ case "end":
202558
+ return _context9.stop();
202559
+ }
202560
+ }
202561
+ }, _callee9, this);
202562
+ }));
202563
+ }
202564
+ }, {
202565
+ key: "joinGroupOffline",
202566
+ value: function joinGroupOffline(groupName, deviceIdentification) {
202567
+ this.groups[groupName] = {
202568
+ isOnline: false,
202569
+ deviceIdentification: deviceIdentification
202570
+ };
202571
+ }
202572
+ }, {
202573
+ key: "leaveGroupOnline",
202574
+ value: function leaveGroupOnline(groupName) {
202575
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee10() {
202576
+ var _this4 = this;
202577
+ return regeneratorRuntime.wrap(function _callee10$(_context10) {
202578
+ while (1) {
202579
+ switch (_context10.prev = _context10.next) {
202580
+ case 0:
202581
+ _context10.next = 2;
202582
+ return new Promise(function (resolve, reject) {
202583
+ _this4.socket.emit('leave_group', {
202584
+ groupName: groupName
202585
+ }, function (error) {
202586
+ if (error) {
202587
+ reject(error);
202588
+ } else {
202589
+ resolve();
202590
+ }
202591
+ });
202592
+ });
202593
+ case 2:
202594
+ delete this.groups[groupName];
202595
+ case 3:
202596
+ case "end":
202597
+ return _context10.stop();
202598
+ }
202599
+ }
202600
+ }, _callee10, this);
202601
+ }));
202602
+ }
202603
+ }, {
202604
+ key: "leaveGroupOffline",
202605
+ value: function leaveGroupOffline(groupName) {
202606
+ delete this.groups[groupName];
202607
+ }
202608
+ }, {
202609
+ key: "callOnlineWait",
202610
+ value: function callOnlineWait(groupName, data, timeout) {
202611
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee11() {
202612
+ var _this5 = this;
202613
+ return regeneratorRuntime.wrap(function _callee11$(_context11) {
202614
+ while (1) {
202615
+ switch (_context11.prev = _context11.next) {
202616
+ case 0:
202617
+ _context11.next = 2;
202618
+ return new Promise(function (resolve, reject) {
202619
+ var _syncConfirmedListener;
202620
+ var _disconnectListener;
202621
+ var timeoutHandler;
202622
+ _syncConfirmedListener = function syncConfirmedListener(confirmedGroupName, confirmData) {
202623
+ if (confirmedGroupName === groupName) {
202624
+ if (typeof timeoutHandler !== 'undefined') {
202625
+ clearTimeout(timeoutHandler);
202626
+ }
202627
+ _this5.socket.off('disconnect', _disconnectListener);
202628
+ _this5.socket.off('sync_confirmed', _syncConfirmedListener);
202629
+ resolve(confirmData);
202630
+ }
202631
+ };
202632
+ _disconnectListener = function disconnectListener() {
202633
+ if (typeof timeoutHandler !== 'undefined') {
202634
+ clearTimeout(timeoutHandler);
202635
+ }
202636
+ _this5.socket.off('disconnect', _disconnectListener);
202637
+ _this5.socket.off('sync_confirmed', _syncConfirmedListener);
202638
+ // if it goes offline, it should automatically confirm all waits as if nothing happened
202639
+ try {
202640
+ var confirmData = _this5.callOfflineWait(groupName, data);
202641
+ resolve(confirmData);
202642
+ } catch (error) {
202643
+ reject(error);
202644
+ }
202645
+ };
202646
+ _this5.socket.on('sync_confirmed', _syncConfirmedListener);
202647
+ _this5.socket.on('disconnect', _disconnectListener);
202648
+ _this5.socket.emit('sync_request', {
202649
+ groupName: groupName,
202650
+ data: data
202651
+ }, function (error) {
202652
+ if (error) {
202653
+ _this5.socket.off('disconnect', _disconnectListener);
202654
+ _this5.socket.off('sync_confirmed', _syncConfirmedListener);
202655
+ reject(error);
202656
+ }
202657
+ });
202658
+ if (typeof timeout !== 'undefined') {
202659
+ timeoutHandler = setTimeout(function () {
202660
+ _syncConfirmedListener(groupName, data);
202661
+ _this5.socket.emit('sync_request_cancel', {
202662
+ groupName: groupName
202663
+ });
202664
+ }, timeout);
202665
+ }
202666
+ });
202667
+ case 2:
202668
+ return _context11.abrupt("return", _context11.sent);
202669
+ case 3:
202670
+ case "end":
202671
+ return _context11.stop();
202672
+ }
202673
+ }
202674
+ }, _callee11);
202675
+ }));
202676
+ }
202677
+ }, {
202678
+ key: "callOfflineWait",
202679
+ value: function callOfflineWait(groupName, data) {
202680
+ if (typeof this.groups[groupName] === 'undefined') {
202681
+ throw new Error('Group ' + groupName + 'wasn\'t initialized');
202682
+ } else {
202683
+ debug('offline wait confirmed for group ' + groupName);
202684
+ return data;
202685
+ }
202686
+ }
202687
+ }, {
202688
+ key: "emitValue",
202689
+ value: function emitValue(groupName, key, value) {
202690
+ if (!this.groups[groupName]) {
202691
+ throw new Error('Group ' + groupName + 'wasn\'t initialized');
202692
+ }
202693
+ this.emitter.emit(ISynchronizer_1.SynchronizerEvent.BroadcastedValue, {
202694
+ groupName: groupName,
202695
+ key: key,
202696
+ value: value
202697
+ });
202698
+ }
202699
+ }]);
202700
+ return SocketSynchronizer;
202701
+ }();
202702
+ __decorate([(0, lockedDecorator_1.locked)('group', {
202703
+ scope: 'instance'
202704
+ }), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise)], SocketSynchronizer.prototype, "joinGroup", null);
202705
+ __decorate([(0, lockedDecorator_1.locked)('group', {
202706
+ scope: 'instance'
202707
+ }), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise)], SocketSynchronizer.prototype, "leaveGroup", null);
202708
+ exports["default"] = SocketSynchronizer;
202709
+
202710
+ /***/ }),
202711
+
202712
+ /***/ "./src/Synchronization/socketSynchronizerFactory.ts":
202713
+ /*!**********************************************************!*\
202714
+ !*** ./src/Synchronization/socketSynchronizerFactory.ts ***!
202715
+ \**********************************************************/
202716
+ /*! no static exports found */
202717
+ /***/ (function(module, exports, __webpack_require__) {
202718
+
202719
+ "use strict";
202720
+
202721
+
202722
+ Object.defineProperty(exports, "__esModule", {
202723
+ value: true
202724
+ });
202725
+ exports.createSocketSynchronizer = void 0;
202726
+ var io = __webpack_require__(/*! socket.io-client */ "./node_modules/socket.io-client/lib/index.js");
202727
+ var SocketSynchronizer_1 = __webpack_require__(/*! ./SocketSynchronizer */ "./src/Synchronization/SocketSynchronizer.ts");
202728
+ function createSocketSynchronizer(serverUri, getNativeDriver) {
202729
+ return new SocketSynchronizer_1["default"](getNativeDriver, function (ioServerUri) {
202730
+ return io(ioServerUri);
202731
+ }, serverUri);
202732
+ }
202733
+ exports.createSocketSynchronizer = createSocketSynchronizer;
202734
+
202735
+ /***/ }),
202736
+
201384
202737
  /***/ "./src/SystemInfo/WebBrowserEmulatorSystemInfo.ts":
201385
202738
  /*!********************************************************!*\
201386
202739
  !*** ./src/SystemInfo/WebBrowserEmulatorSystemInfo.ts ***!
@@ -205245,7 +206598,7 @@ var Raven = __webpack_require__(/*! raven-js */ "./node_modules/raven-js/src/sin
205245
206598
  var all_1 = __webpack_require__(/*! ./polyfills/all */ "./src/polyfills/all.ts");
205246
206599
  (0, all_1.polyfillAll)();
205247
206600
  var logger_1 = __webpack_require__(/*! ./Logging/logger */ "./src/Logging/logger.ts");
205248
- var synchronizerFactory_1 = __webpack_require__(/*! ./Front/Applet/Sync/synchronizerFactory */ "./src/Front/Applet/Sync/synchronizerFactory.ts");
206601
+ var socketSynchronizerFactory_1 = __webpack_require__(/*! ./Synchronization/socketSynchronizerFactory */ "./src/Synchronization/socketSynchronizerFactory.ts");
205249
206602
  var masterWebWorkerFactory_1 = __webpack_require__(/*! ./WebWorker/masterWebWorkerFactory */ "./src/WebWorker/masterWebWorkerFactory.ts");
205250
206603
  var defaultDriverFactory_1 = __webpack_require__(/*! ./NativeDevice/Default/defaultDriverFactory */ "./src/NativeDevice/Default/defaultDriverFactory.ts");
205251
206604
  var parameters_1 = __webpack_require__(/*! ../config/parameters */ "./config/parameters.ts");
@@ -205278,7 +206631,7 @@ Raven.config(parameters_1.parameters.raven.enabled ? (_a = parameters_1.paramete
205278
206631
  _context.next = 10;
205279
206632
  return nativeDriver.initialize(parameters_1.parameters.url.staticBaseUrl);
205280
206633
  case 10:
205281
- synchronizer = (0, synchronizerFactory_1.createSocketSynchronizer)(parameters_1.parameters.url.synchronizerServerUrl, function () {
206634
+ synchronizer = (0, socketSynchronizerFactory_1.createSocketSynchronizer)(parameters_1.parameters.url.synchronizerServerUrl, function () {
205282
206635
  return nativeDriver;
205283
206636
  });
205284
206637
  _context.prev = 11;