@subiz/widget-v4 4.1.60 → 4.1.61

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.
Files changed (58) hide show
  1. package/app.js +10 -0
  2. package/compiled_src/call/call.js +2 -2
  3. package/compiled_src/chatbox/DropdownSelect.js +2 -2
  4. package/compiled_src/chatbox/ImageAttachments.js +2 -2
  5. package/compiled_src/chatbox/MessageInput.js +2 -2
  6. package/compiled_src/chatbox/Order.js +2 -2
  7. package/compiled_src/chatbox/Rating.js +2 -2
  8. package/compiled_src/chatbox/Widget.js +2 -2
  9. package/compiled_src/contact/contact.js +2 -2
  10. package/compiled_src/lib.js +2 -2
  11. package/compiled_src/notif/notif.js +2 -2
  12. package/compiled_src/order/address_picker.js +2 -2
  13. package/compiled_src/order/order.js +2 -2
  14. package/compiled_src/popup/countdown.js +2 -2
  15. package/compiled_src/popup/popup.js +2 -2
  16. package/compiled_src/store/api.js +2 -2
  17. package/compiled_src/store/api_fake.js +2 -2
  18. package/compiled_src/store/store.js +2 -2
  19. package/dist/178.js +1 -1
  20. package/dist/18d5e97bf55.178.js +1 -0
  21. package/dist/18d5e97bf55.213.js +1 -0
  22. package/dist/18d5e97bf55.335.js +1 -0
  23. package/dist/{18a02a9c54e.362.js → 18d5e97bf55.362.js} +1 -1
  24. package/dist/18d5e97bf55.605.js +1 -0
  25. package/dist/{18a02a9c54e.782.js → 18d5e97bf55.782.js} +1 -1
  26. package/dist/18d5e97bf55.841.js +1 -0
  27. package/dist/18d5e97bf55.app.js +1 -0
  28. package/dist/{18a02a9c54e.index.html → 18d5e97bf55.index.html} +4 -4
  29. package/dist/{18a02a9c54e.library.html → 18d5e97bf55.library.html} +4 -4
  30. package/dist/18d5e97bf55.library.js +1 -0
  31. package/dist/{18a02a9c54e.preview.html → 18d5e97bf55.preview.html} +1 -1
  32. package/dist/18d5e97bf55.preview.js +1 -0
  33. package/dist/18d5e97bf55.screenshoot.js +1 -0
  34. package/dist/18d5e97bf55.webview.js +1 -0
  35. package/dist/213.js +122 -106
  36. package/dist/335.js +27 -27
  37. package/dist/362.js +1 -1
  38. package/dist/605.js +52 -53
  39. package/dist/782.js +1 -1
  40. package/dist/{132.js → 841.js} +657 -644
  41. package/dist/HASH +1 -1
  42. package/dist/malicious-app.js +9 -3
  43. package/dist/screenshoot.html +1 -1
  44. package/dist/screenshoot.js +547 -623
  45. package/package.json +8 -8
  46. package/dist/18a02a9c54e.132.js +0 -1
  47. package/dist/18a02a9c54e.178.js +0 -1
  48. package/dist/18a02a9c54e.213.js +0 -1
  49. package/dist/18a02a9c54e.335.js +0 -1
  50. package/dist/18a02a9c54e.441.js +0 -1
  51. package/dist/18a02a9c54e.605.js +0 -1
  52. package/dist/18a02a9c54e.app.js +0 -1
  53. package/dist/18a02a9c54e.library.js +0 -1
  54. package/dist/18a02a9c54e.preview.js +0 -1
  55. package/dist/18a02a9c54e.screenshoot.js +0 -1
  56. package/dist/18a02a9c54e.webview.js +0 -1
  57. package/dist/441.js +0 -2855
  58. /package/dist/{18a02a9c54e.678.js → 18d5e97bf55.678.js} +0 -0
@@ -366,7 +366,7 @@ module.exports = function (maxBatch, maxDelay, handler) {
366
366
 
367
367
  this.push = function (payload, priority) {
368
368
  return new Promise(function (resolve) {
369
- myBuffers.push({ payload: payload, priority: priority, created: Date.now(), rs: resolve })
369
+ myBuffers.push({payload: payload, priority: priority, created: Date.now(), rs: resolve})
370
370
  myFlush()
371
371
  })
372
372
  }
@@ -380,7 +380,7 @@ module.exports = function (maxBatch, maxDelay, handler) {
380
380
  /***/ 3538:
381
381
  /***/ ((module) => {
382
382
 
383
- function map (collection, predicate) {
383
+ function map(collection, predicate) {
384
384
  if (!collection) return []
385
385
  if (!predicate) {
386
386
  predicate = function (a) {
@@ -408,7 +408,7 @@ function map (collection, predicate) {
408
408
  return out
409
409
  }
410
410
 
411
- module.exports = { map: map }
411
+ module.exports = {map: map}
412
412
 
413
413
 
414
414
  /***/ }),
@@ -435,7 +435,7 @@ module.exports = {
435
435
  /***/ ((module) => {
436
436
 
437
437
  // loop keep calling promise sequenctially until the promise resolve a false value
438
- module.exports = function loop (promise) {
438
+ module.exports = function loop(promise) {
439
439
  var out = promise()
440
440
  if (!out || !out.then) {
441
441
  var saveout = out
@@ -459,7 +459,7 @@ module.exports = function loop (promise) {
459
459
 
460
460
  var co = __webpack_require__(3538)
461
461
 
462
- module.exports = function(collections, func, limit) {
462
+ module.exports = function (collections, func, limit) {
463
463
  if (typeof func === 'number') {
464
464
  // backword compatible
465
465
  let tmp = limit
@@ -467,12 +467,12 @@ module.exports = function(collections, func, limit) {
467
467
  func = tmp
468
468
  }
469
469
 
470
- if (!func) func = function() {}
470
+ if (!func) func = function () {}
471
471
  if (typeof limit !== 'number' || limit <= 0) limit = 1
472
472
 
473
473
  // prepare input map
474
474
  var ins = {} // inputs
475
- co.map(collections, function(i, k) {
475
+ co.map(collections, function (i, k) {
476
476
  ins[k] = i
477
477
  })
478
478
 
@@ -481,14 +481,14 @@ module.exports = function(collections, func, limit) {
481
481
  if (Object.keys(ins).length < limit) limit = Object.keys(ins).length
482
482
 
483
483
  var outs = {} // outputs
484
- return new Promise(function(resolve) {
484
+ return new Promise(function (resolve) {
485
485
  let total = Object.keys(ins).length
486
486
 
487
- var doJob = function() {
487
+ var doJob = function () {
488
488
  var keys = Object.keys(ins)
489
489
  if (keys.length === 0) return
490
490
 
491
- var key = keys.pop()
491
+ var key = keys.shift()
492
492
  var value = ins[key]
493
493
  delete ins[key]
494
494
 
@@ -497,7 +497,7 @@ module.exports = function(collections, func, limit) {
497
497
  // we treat the out put as a promise
498
498
  if (!pro || !pro.then) pro = Promise.resolve(pro)
499
499
 
500
- pro.then(function(ret) {
500
+ pro.then(function (ret) {
501
501
  outs[key] = ret
502
502
  if (Object.keys(outs).length === total) return resolve(co.map(outs))
503
503
  doJob()
@@ -516,7 +516,7 @@ module.exports = function(collections, func, limit) {
516
516
 
517
517
  // sleep won't resolve after a given milliseconds
518
518
  // e.g: await sleep(100)
519
- module.exports = function sleep (ms) {
519
+ module.exports = function sleep(ms) {
520
520
  return new Promise(function (res) {
521
521
  setTimeout(res, ms)
522
522
  })
@@ -525,10 +525,128 @@ module.exports = function sleep (ms) {
525
525
 
526
526
  /***/ }),
527
527
 
528
- /***/ 8454:
529
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
528
+ /***/ 2611:
529
+ /***/ ((module) => {
530
+
531
+ function logError(accid, userid, message, line) {
532
+ // 24-01-11 04:07:05 app ERROR api-8948967b6-qtpfx subiz /app/vendor/github.com/subiz/log/error.go:271 {"id":141534190473829746,"class":500,"code":"locked_account,internal","number":"8f2b97e9","fields":{"ip":"\"171.224.84.93\"","no_report":"true","user_agent":"\"Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36\""}}
533
+ let ts = displayUTCLogTime(new Date())
534
+ let msg = JSON.stringify({
535
+ id: Date.now(),
536
+ class: 400,
537
+ code: 'frontend_error',
538
+ number: line
539
+ .split('')
540
+ .map((c) => c.charCodeAt(0).toString(16).padStart(2, '0'))
541
+ .join(''),
542
+ fields: {
543
+ message: JSON.stringify(message),
544
+ user_id: userid,
545
+ url: JSON.stringify(location.href),
546
+ },
547
+ })
548
+
549
+ xhrsend('POST', 'https://track.subiz.net/collect', `${ts} app ERROR dashboard ${accid} ${line} ${msg}`)
550
+ }
551
+
552
+ function displayUTCLogTime(date) {
553
+ let yyyy = date.getUTCFullYear().toString()
554
+ let yy = yyyy.substr(2, 2)
555
+ let mm = date.getUTCMonth() + 1
556
+ let dd = date.getUTCDate()
557
+ let hh = date.getUTCHours()
558
+ let MM = date.getUTCMinutes()
559
+ let ss = date.getUTCSeconds()
560
+
561
+ return `${yy}-${pad(mm)}-${pad(dd)} ${pad(hh)}:${pad(MM)}:${pad(ss)}`
562
+ }
563
+
564
+ function pad(v) {
565
+ if (v < 10) return `0${v}`
566
+ return `${v}`
567
+ }
568
+
569
+ function dofetch(method, url, body, cb) {
570
+ let headers = {}
571
+ if (body) headers['content-type'] = 'text/plain'
572
+ fetch(url, {method: method, headers: headers, body: body})
573
+ .then((res) => res.text().then((text) => cb && cb(text, res.status)))
574
+ .catch((err) => cb && cb(err, -1))
575
+ }
576
+
577
+ // xhrsend sends an HTTP request
578
+ var xhrsend = function (method, url, body, cb) {
579
+ if (typeof XMLHttpRequest === 'undefined') return dofetch(method, url, body, cb)
580
+ var request = new XMLHttpRequest()
581
+ request.onreadystatechange = function (e) {
582
+ if (request.readyState !== 4) return
583
+ cb && cb(request.responseText, request.status)
584
+ cb = undefined // dont call cb anymore
585
+ }
586
+
587
+ request.onerror = function () {
588
+ cb && cb(request.responseText, -1) // network error
589
+ cb = undefined // dont call cb anymore
590
+ }
591
+
592
+ request.open(method, url)
593
+ if (body) request.setRequestHeader('content-type', 'text/plain')
594
+ request.send(body)
595
+ }
596
+
597
+ // JSON.parse without exeption
598
+ // return undefined when parsing invalid JSON string
599
+ function parseJSON(str) {
600
+ try {
601
+ return JSON.parse(str)
602
+ } catch (e) {}
603
+ }
604
+
605
+ function Pubsub() {
606
+ // holds all subscriptions for all topics
607
+ // example {
608
+ // topic1: [cb1, cb2],
609
+ // topic2: [cb3, cb4],
610
+ // }
611
+ var listeners = {}
612
+
613
+ // emit notifies any callback functions that previously
614
+ // subscribed to the topic (by the on function)
615
+ this.emit = function (topic) {
616
+ // skip the first item in arguments, which is the topic
617
+ var args = []
618
+ for (var i = 1; i < arguments.length; i++) args.push(arguments[i])
619
+
620
+ var cbs = listeners[topic]
621
+ if (!cbs) return
622
+ for (var i = 0; i < cbs.length; i++) cbs[i].apply(undefined, args)
623
+ }
530
624
 
531
- module.exports = __webpack_require__(608)
625
+ // register a callback function for a topic
626
+ // when something is sent to the topic (by the emit function),
627
+ // the callback function will be called
628
+ this.on = function (topic, cb) {
629
+ if (!listeners[topic]) listeners[topic] = []
630
+ listeners[topic].push(cb)
631
+ }
632
+ }
633
+
634
+ function randomString(len, base) {
635
+ var str = ''
636
+ if (!len || len < 1) len = 10
637
+ var asciiKey
638
+ for (var i = 0; i < len; i++) {
639
+ if (base) {
640
+ str += base[Math.floor(Math.random() * base.length)]
641
+ } else {
642
+ asciiKey = Math.floor(Math.random() * 25 + 97)
643
+ str += String.fromCharCode(asciiKey)
644
+ }
645
+ }
646
+ return str
647
+ }
648
+
649
+ module.exports = {xhrsend, parseJSON, Pubsub, randomString, logError}
532
650
 
533
651
 
534
652
  /***/ }),
@@ -537,6 +655,7 @@ module.exports = __webpack_require__(608)
537
655
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
538
656
 
539
657
  var flow = __webpack_require__(3165)
658
+ var {xhrsend, parseJSON, Pubsub} = __webpack_require__(2611)
540
659
 
541
660
  // Conn represents a realtime connection between an user and the realtime
542
661
  // server (https://rt-0.subiz.com)
@@ -750,74 +869,6 @@ function Realtime(apiUrls, credential, callAPI) {
750
869
  reconnect()
751
870
  }
752
871
 
753
- var dofetch = function (method, url, body, cb) {
754
- let headers = {}
755
- if (body) headers['content-type'] = 'text/plain'
756
- fetch(url, {
757
- method: method,
758
- headers: headers,
759
- body: body,
760
- })
761
- .then((res) => res.text().then((text) => cb && cb(text, res.status)))
762
- .catch((err) => cb && cb(err, -1))
763
- }
764
- // xhrsend sends an HTTP request
765
- var xhrsend = function (method, url, body, cb) {
766
- if (typeof XMLHttpRequest === 'undefined') return dofetch(method, url, body, cb)
767
- var request = new XMLHttpRequest()
768
- request.onreadystatechange = function (e) {
769
- if (request.readyState !== 4) return
770
- cb && cb(request.responseText, request.status)
771
- cb = undefined // dont call cb anymore
772
- }
773
-
774
- request.onerror = function () {
775
- cb && cb(request.responseText, -1) // network error
776
- cb = undefined // dont call cb anymore
777
- }
778
-
779
- request.open(method, url)
780
- if (body) request.setRequestHeader('content-type', 'text/plain')
781
- request.send(body)
782
- }
783
-
784
- // JSON.parse without exeption
785
- // return undefined when parsing invalid JSON string
786
- function parseJSON(str) {
787
- try {
788
- return JSON.parse(str)
789
- } catch (e) {}
790
- }
791
-
792
- function Pubsub() {
793
- // holds all subscriptions for all topics
794
- // example {
795
- // topic1: [cb1, cb2],
796
- // topic2: [cb3, cb4],
797
- // }
798
- var listeners = {}
799
-
800
- // emit notifies any callback functions that previously
801
- // subscribed to the topic (by the on function)
802
- this.emit = function (topic) {
803
- // skip the first item in arguments, which is the topic
804
- var args = []
805
- for (var i = 1; i < arguments.length; i++) args.push(arguments[i])
806
-
807
- var cbs = listeners[topic]
808
- if (!cbs) return
809
- for (var i = 0; i < cbs.length; i++) cbs[i].apply(undefined, args)
810
- }
811
-
812
- // register a callback function for a topic
813
- // when something is sent to the topic (by the emit function),
814
- // the callback function will be called
815
- this.on = function (topic, cb) {
816
- if (!listeners[topic]) listeners[topic] = []
817
- listeners[topic].push(cb)
818
- }
819
- }
820
-
821
872
  // calcNextBackoff returns number of seconds we must wait
822
873
  // before sending a next request
823
874
  // the results is determind based on exponential backoff algorithm
@@ -862,7 +913,7 @@ module.exports = Realtime
862
913
 
863
914
  "use strict";
864
915
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
865
- /* harmony export */ "Z": () => (/* binding */ Chain)
916
+ /* harmony export */ Z: () => (/* binding */ Chain)
866
917
  /* harmony export */ });
867
918
  const ChainMaxSize = 50;
868
919
  class Chain {
@@ -934,9 +985,7 @@ class Chain {
934
985
  });
935
986
  return out;
936
987
  }
937
- async fetchMore(chain) {
938
- let limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 20;
939
- let api = arguments.length > 2 ? arguments[2] : undefined;
988
+ async fetchMore(chain, limit = 20, api) {
940
989
  if (this.dead) return {
941
990
  error: 'dead'
942
991
  };
@@ -1094,7 +1143,7 @@ function orderBy(a, k, d) {
1094
1143
 
1095
1144
  "use strict";
1096
1145
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1097
- /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
1146
+ /* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
1098
1147
  /* harmony export */ });
1099
1148
  var localStorageMemory = {};
1100
1149
  var cache = {};
@@ -1129,7 +1178,7 @@ localStorageMemory.clear = function () {
1129
1178
 
1130
1179
  "use strict";
1131
1180
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1132
- /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
1181
+ /* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
1133
1182
  /* harmony export */ });
1134
1183
  let KvMaxSize = 500;
1135
1184
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (class {
@@ -1218,7 +1267,7 @@ let KvMaxSize = 500;
1218
1267
 
1219
1268
  "use strict";
1220
1269
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1221
- /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
1270
+ /* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
1222
1271
  /* harmony export */ });
1223
1272
  let memlocalStorage = (__webpack_require__(9489)/* ["default"] */ .Z);
1224
1273
  let requestIdleCallback = window.requestIdleCallback || (cb => cb());
@@ -1286,11 +1335,11 @@ function toString(obj) {
1286
1335
 
1287
1336
  "use strict";
1288
1337
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1289
- /* harmony export */ "Kd": () => (/* binding */ getLocale),
1290
- /* harmony export */ "Rs": () => (/* binding */ langMessages),
1291
- /* harmony export */ "WW": () => (/* binding */ downloadLanguage),
1292
- /* harmony export */ "u$": () => (/* binding */ Clickaway),
1293
- /* harmony export */ "up": () => (/* binding */ Com)
1338
+ /* harmony export */ Kd: () => (/* binding */ getLocale),
1339
+ /* harmony export */ Rs: () => (/* binding */ langMessages),
1340
+ /* harmony export */ WW: () => (/* binding */ downloadLanguage),
1341
+ /* harmony export */ u$: () => (/* binding */ Clickaway),
1342
+ /* harmony export */ up: () => (/* binding */ Com)
1294
1343
  /* harmony export */ });
1295
1344
  /* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6400);
1296
1345
  /* harmony import */ var _util_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4494);
@@ -1300,7 +1349,7 @@ class Com extends preact__WEBPACK_IMPORTED_MODULE_0__/* .Component */ .wA {
1300
1349
  constructor(props) {
1301
1350
  super(props);
1302
1351
  this._isMounted = true;
1303
- _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"].setTimeout */ .Z.setTimeout(() => {
1352
+ _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.setTimeout(() => {
1304
1353
  if (this.componentWillUnmount) {
1305
1354
  let old = this.componentWillUnmount.bind(this);
1306
1355
  this.componentWillUnmount = () => {
@@ -1339,9 +1388,9 @@ class Clickaway extends Com {
1339
1388
  }
1340
1389
  const getLocale = (plugin, loc) => {
1341
1390
  if (!loc) loc = '';
1342
- let found = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"].find */ .Z.find(plugin.locales, l => l.toLowerCase().trim() === loc.toLowerCase().trim());
1391
+ let found = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.find(plugin.locales, l => l.toLowerCase().trim() === loc.toLowerCase().trim());
1343
1392
  if (found) return found;
1344
- found = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"].find */ .Z.find(plugin.locales, l => {
1393
+ found = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.find(plugin.locales, l => {
1345
1394
  l = l.replace('-', '_').split('_')[0].trim().toLowerCase();
1346
1395
  let compareloc = loc.replace('-', '_').split('_')[0].trim().toLowerCase();
1347
1396
  return l == compareloc;
@@ -1352,7 +1401,7 @@ const getLocale = (plugin, loc) => {
1352
1401
  let langMessages = {};
1353
1402
  let downloadLock = false;
1354
1403
  function downloadLanguage(store, locale, force) {
1355
- if (downloadLock) return new Promise(resolve => _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"].setTimeout */ .Z.setTimeout(() => downloadLanguage(store, locale, force).then(resolve), 100));
1404
+ if (downloadLock) return new Promise(resolve => _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.setTimeout(() => downloadLanguage(store, locale, force).then(resolve), 100));
1356
1405
  downloadLock = true;
1357
1406
  let messages;
1358
1407
  if (locale === 'debug' || langMessages[locale] && !force) {
@@ -1361,7 +1410,7 @@ function downloadLanguage(store, locale, force) {
1361
1410
  }
1362
1411
  return store.getLocaleContent(locale).then(res => {
1363
1412
  downloadLock = false;
1364
- messages = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"].get */ .Z.get(res, 'body.messages', []);
1413
+ messages = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.get(res, 'body.messages', []);
1365
1414
  langMessages[locale] = messages;
1366
1415
  });
1367
1416
  }
@@ -1374,73 +1423,73 @@ function downloadLanguage(store, locale, force) {
1374
1423
  "use strict";
1375
1424
  __webpack_require__.r(__webpack_exports__);
1376
1425
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1377
- /* harmony export */ "DEFVAL": () => (/* binding */ DEFVAL),
1378
- /* harmony export */ "DEF_CHAT_BUTTON_BACKGROUND_IMAGE_URL": () => (/* binding */ DEF_CHAT_BUTTON_BACKGROUND_IMAGE_URL),
1379
- /* harmony export */ "Date": () => (/* binding */ Date),
1380
- /* harmony export */ "XMLHttpRequest": () => (/* binding */ XMLHttpRequest),
1381
- /* harmony export */ "agentsOfConvo": () => (/* binding */ agentsOfConvo),
1382
- /* harmony export */ "checkRunConditions": () => (/* binding */ checkRunConditions),
1383
- /* harmony export */ "clearInterval": () => (/* binding */ clearInterval),
1384
- /* harmony export */ "clearTimeout": () => (/* binding */ clearTimeout),
1385
- /* harmony export */ "cloneDeep": () => (/* binding */ cloneDeep),
1386
- /* harmony export */ "convoOfEv": () => (/* binding */ convoOfEv),
1387
- /* harmony export */ "convoToEv": () => (/* binding */ convoToEv),
1388
- /* harmony export */ "detectLang": () => (/* binding */ detectLang),
1389
- /* harmony export */ "diffDay": () => (/* binding */ diffDay),
1390
- /* harmony export */ "diffYear": () => (/* binding */ diffYear),
1391
- /* harmony export */ "each": () => (/* binding */ each),
1392
- /* harmony export */ "filter": () => (/* binding */ filter),
1393
- /* harmony export */ "find": () => (/* binding */ find),
1394
- /* harmony export */ "formatCurrency": () => (/* binding */ formatCurrency),
1395
- /* harmony export */ "getAgentDisplayName": () => (/* binding */ getAgentDisplayName),
1396
- /* harmony export */ "getDayName": () => (/* binding */ getDayName),
1397
- /* harmony export */ "getMs": () => (/* binding */ getMs),
1398
- /* harmony export */ "getMsgField": () => (/* binding */ getMsgField),
1399
- /* harmony export */ "getUrlParameter": () => (/* binding */ getUrlParameter),
1400
- /* harmony export */ "getUserAttr": () => (/* binding */ getUserAttr),
1401
- /* harmony export */ "includes": () => (/* binding */ includes),
1402
- /* harmony export */ "isConvoSeen": () => (/* binding */ isConvoSeen),
1403
- /* harmony export */ "isEmail": () => (/* binding */ isEmail),
1404
- /* harmony export */ "isNumber": () => (/* binding */ isNumber),
1405
- /* harmony export */ "isPhone": () => (/* binding */ isPhone),
1406
- /* harmony export */ "isURL": () => (/* binding */ isURL),
1407
- /* harmony export */ "isUserBanned": () => (/* binding */ isUserBanned),
1408
- /* harmony export */ "js2css": () => (/* binding */ js2css),
1409
- /* harmony export */ "last": () => (/* binding */ last),
1410
- /* harmony export */ "map": () => (/* binding */ map),
1411
- /* harmony export */ "merge": () => (/* binding */ merge),
1412
- /* harmony export */ "noop": () => (/* binding */ noop),
1413
- /* harmony export */ "norm": () => (/* binding */ norm),
1414
- /* harmony export */ "offsetToMin": () => (/* binding */ offsetToMin),
1415
- /* harmony export */ "orderBy": () => (/* binding */ orderBy),
1416
- /* harmony export */ "orderByF": () => (/* binding */ orderByF),
1417
- /* harmony export */ "parseJSON": () => (/* binding */ parseJSON),
1418
- /* harmony export */ "preloadImg": () => (/* binding */ preloadImg),
1419
- /* harmony export */ "preloadWebfonts": () => (/* binding */ preloadWebfonts),
1420
- /* harmony export */ "randomString": () => (/* binding */ randomString),
1421
- /* harmony export */ "replaceAll": () => (/* binding */ replaceAll),
1422
- /* harmony export */ "replaceCssVariable": () => (/* binding */ replaceCssVariable),
1423
- /* harmony export */ "replaceCssVariablePlugin": () => (/* binding */ replaceCssVariablePlugin),
1424
- /* harmony export */ "requestAnimationFrame": () => (/* binding */ requestAnimationFrame),
1425
- /* harmony export */ "sameDay": () => (/* binding */ sameDay),
1426
- /* harmony export */ "scrollIntoViewIfNeeded": () => (/* binding */ scrollIntoViewIfNeeded),
1427
- /* harmony export */ "setCss": () => (/* binding */ setCss),
1428
- /* harmony export */ "setInterval": () => (/* binding */ setInterval),
1429
- /* harmony export */ "setMsgField": () => (/* binding */ setMsgField),
1430
- /* harmony export */ "setTimeout": () => (/* binding */ setTimeout),
1431
- /* harmony export */ "setUserAttr": () => (/* binding */ setUserAttr),
1432
- /* harmony export */ "shortTime": () => (/* binding */ shortTime),
1433
- /* harmony export */ "size": () => (/* binding */ size),
1434
- /* harmony export */ "sleep": () => (/* binding */ sleep),
1435
- /* harmony export */ "startsWith": () => (/* binding */ startsWith),
1436
- /* harmony export */ "stringify": () => (/* binding */ stringify),
1437
- /* harmony export */ "throttle": () => (/* binding */ throttle),
1438
- /* harmony export */ "tokenize": () => (/* binding */ tokenize),
1439
- /* harmony export */ "trim": () => (/* binding */ trim),
1440
- /* harmony export */ "trimStart": () => (/* binding */ trimStart),
1441
- /* harmony export */ "unicodeToAscii": () => (/* binding */ unicodeToAscii),
1442
- /* harmony export */ "unixSec": () => (/* binding */ unixSec),
1443
- /* harmony export */ "usersOfConvo": () => (/* binding */ usersOfConvo)
1426
+ /* harmony export */ DEFVAL: () => (/* binding */ DEFVAL),
1427
+ /* harmony export */ DEF_CHAT_BUTTON_BACKGROUND_IMAGE_URL: () => (/* binding */ DEF_CHAT_BUTTON_BACKGROUND_IMAGE_URL),
1428
+ /* harmony export */ Date: () => (/* binding */ Date),
1429
+ /* harmony export */ XMLHttpRequest: () => (/* binding */ XMLHttpRequest),
1430
+ /* harmony export */ agentsOfConvo: () => (/* binding */ agentsOfConvo),
1431
+ /* harmony export */ checkRunConditions: () => (/* binding */ checkRunConditions),
1432
+ /* harmony export */ clearInterval: () => (/* binding */ clearInterval),
1433
+ /* harmony export */ clearTimeout: () => (/* binding */ clearTimeout),
1434
+ /* harmony export */ cloneDeep: () => (/* binding */ cloneDeep),
1435
+ /* harmony export */ convoOfEv: () => (/* binding */ convoOfEv),
1436
+ /* harmony export */ convoToEv: () => (/* binding */ convoToEv),
1437
+ /* harmony export */ detectLang: () => (/* binding */ detectLang),
1438
+ /* harmony export */ diffDay: () => (/* binding */ diffDay),
1439
+ /* harmony export */ diffYear: () => (/* binding */ diffYear),
1440
+ /* harmony export */ each: () => (/* binding */ each),
1441
+ /* harmony export */ filter: () => (/* binding */ filter),
1442
+ /* harmony export */ find: () => (/* binding */ find),
1443
+ /* harmony export */ formatCurrency: () => (/* binding */ formatCurrency),
1444
+ /* harmony export */ getAgentDisplayName: () => (/* binding */ getAgentDisplayName),
1445
+ /* harmony export */ getDayName: () => (/* binding */ getDayName),
1446
+ /* harmony export */ getMs: () => (/* binding */ getMs),
1447
+ /* harmony export */ getMsgField: () => (/* binding */ getMsgField),
1448
+ /* harmony export */ getUrlParameter: () => (/* binding */ getUrlParameter),
1449
+ /* harmony export */ getUserAttr: () => (/* binding */ getUserAttr),
1450
+ /* harmony export */ includes: () => (/* binding */ includes),
1451
+ /* harmony export */ isConvoSeen: () => (/* binding */ isConvoSeen),
1452
+ /* harmony export */ isEmail: () => (/* binding */ isEmail),
1453
+ /* harmony export */ isNumber: () => (/* binding */ isNumber),
1454
+ /* harmony export */ isPhone: () => (/* binding */ isPhone),
1455
+ /* harmony export */ isURL: () => (/* binding */ isURL),
1456
+ /* harmony export */ isUserBanned: () => (/* binding */ isUserBanned),
1457
+ /* harmony export */ js2css: () => (/* binding */ js2css),
1458
+ /* harmony export */ last: () => (/* binding */ last),
1459
+ /* harmony export */ map: () => (/* binding */ map),
1460
+ /* harmony export */ merge: () => (/* binding */ merge),
1461
+ /* harmony export */ noop: () => (/* binding */ noop),
1462
+ /* harmony export */ norm: () => (/* binding */ norm),
1463
+ /* harmony export */ offsetToMin: () => (/* binding */ offsetToMin),
1464
+ /* harmony export */ orderBy: () => (/* binding */ orderBy),
1465
+ /* harmony export */ orderByF: () => (/* binding */ orderByF),
1466
+ /* harmony export */ parseJSON: () => (/* binding */ parseJSON),
1467
+ /* harmony export */ preloadImg: () => (/* binding */ preloadImg),
1468
+ /* harmony export */ preloadWebfonts: () => (/* binding */ preloadWebfonts),
1469
+ /* harmony export */ randomString: () => (/* binding */ randomString),
1470
+ /* harmony export */ replaceAll: () => (/* binding */ replaceAll),
1471
+ /* harmony export */ replaceCssVariable: () => (/* binding */ replaceCssVariable),
1472
+ /* harmony export */ replaceCssVariablePlugin: () => (/* binding */ replaceCssVariablePlugin),
1473
+ /* harmony export */ requestAnimationFrame: () => (/* binding */ requestAnimationFrame),
1474
+ /* harmony export */ sameDay: () => (/* binding */ sameDay),
1475
+ /* harmony export */ scrollIntoViewIfNeeded: () => (/* binding */ scrollIntoViewIfNeeded),
1476
+ /* harmony export */ setCss: () => (/* binding */ setCss),
1477
+ /* harmony export */ setInterval: () => (/* binding */ setInterval),
1478
+ /* harmony export */ setMsgField: () => (/* binding */ setMsgField),
1479
+ /* harmony export */ setTimeout: () => (/* binding */ setTimeout),
1480
+ /* harmony export */ setUserAttr: () => (/* binding */ setUserAttr),
1481
+ /* harmony export */ shortTime: () => (/* binding */ shortTime),
1482
+ /* harmony export */ size: () => (/* binding */ size),
1483
+ /* harmony export */ sleep: () => (/* binding */ sleep),
1484
+ /* harmony export */ startsWith: () => (/* binding */ startsWith),
1485
+ /* harmony export */ stringify: () => (/* binding */ stringify),
1486
+ /* harmony export */ throttle: () => (/* binding */ throttle),
1487
+ /* harmony export */ tokenize: () => (/* binding */ tokenize),
1488
+ /* harmony export */ trim: () => (/* binding */ trim),
1489
+ /* harmony export */ trimStart: () => (/* binding */ trimStart),
1490
+ /* harmony export */ unicodeToAscii: () => (/* binding */ unicodeToAscii),
1491
+ /* harmony export */ unixSec: () => (/* binding */ unixSec),
1492
+ /* harmony export */ usersOfConvo: () => (/* binding */ usersOfConvo)
1444
1493
  /* harmony export */ });
1445
1494
  var op = __webpack_require__(6877);
1446
1495
  function parseJSON(str) {
@@ -1527,10 +1576,7 @@ function getMsgField(ev, fieldName) {
1527
1576
  function isObject(item) {
1528
1577
  return item && typeof item === 'object' && !Array.isArray(item);
1529
1578
  }
1530
- function merge(target) {
1531
- for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1532
- sources[_key - 1] = arguments[_key];
1533
- }
1579
+ function merge(target, ...sources) {
1534
1580
  if (!sources.length) return target;
1535
1581
  const source = sources.shift();
1536
1582
  if (isObject(target) && isObject(source)) {
@@ -1758,7 +1804,7 @@ function setUserAttr(user, attr) {
1758
1804
  if (!user) return;
1759
1805
  if (!op.get(attr, 'key')) return;
1760
1806
  user.attributes = user.attributes || [];
1761
- var index = findIndex(user.attributes, a => a.key === attr.key);
1807
+ var index = findIndex(user.attributes, a => a && a.key === attr.key);
1762
1808
  if (index === -1) {
1763
1809
  user.attributes.push(attr);
1764
1810
  return;
@@ -2028,7 +2074,7 @@ function checkRunConditions(freq, conds, lastrun, store) {
2028
2074
  var acc = store.matchAccount() || {};
2029
2075
  var location = store.matchLocation() || {};
2030
2076
  if (!check_frequently(freq, lastrun, store)) return false;
2031
- for (var i = 0; i < size(conds); i++) {
2077
+ for (let i = 0; i < size(conds); i++) {
2032
2078
  var cond = conds[i];
2033
2079
  switch (cond.key) {
2034
2080
  case 'url':
@@ -2093,9 +2139,9 @@ function checkRunConditions(freq, conds, lastrun, store) {
2093
2139
  break;
2094
2140
  case 'user_is_a_contact':
2095
2141
  let attributes = op.get(store.matchUser(), 'attributes', []);
2096
- let emailAttr = find(attributes, att => att.key === 'emails') || {};
2097
- let phoneAttr = find(attributes, att => att.key === 'phones') || {};
2098
- let hasContact = emailAttr.text || phoneAttr.text;
2142
+ let emailAttr = find(attributes, att => att.key === 'emails' && attr.text && att.key === 'related_email' && attr.text);
2143
+ let phoneAttr = find(attributes, att => att.key === 'phones' && attr.text && att.key === 'related_phone' && attr.text);
2144
+ let hasContact = emailAttr || phoneAttr;
2099
2145
  if (cond.user_is_a_contact) {
2100
2146
  if (!hasContact) return false;
2101
2147
  }
@@ -2173,15 +2219,21 @@ function checkRunConditions(freq, conds, lastrun, store) {
2173
2219
  });
2174
2220
  if (!found) return false;
2175
2221
  }
2176
- if (size(cond.minute_of_days) > 0 && size(cond.minute_of_days) % 2 === 0) {
2222
+ if (size(cond.minutes_of_day) > 0 && size(cond.minutes_of_day) % 2 === 0) {
2177
2223
  var now = new Date();
2178
2224
  var minuteofday = now.getMinutes() + now.getHours() * 60;
2179
2225
  let found = false;
2180
- for (var i = 0; i < cond.minute_of_days.length; i += 2) {
2181
- if (cond.minute_of_days[i] <= minuteofday && minuteofday <= cond.minute_of_days[i + 1]) {
2226
+ for (let i = 0; i < cond.minutes_of_day.length; i += 2) {
2227
+ if (cond.minutes_of_day[i] <= minuteofday && minuteofday <= cond.minutes_of_day[i + 1]) {
2182
2228
  found = true;
2183
2229
  break;
2184
2230
  }
2231
+ if (cond.minutes_of_day[i] > cond.minutes_of_day[i + 1]) {
2232
+ if (minuteofday >= cond.minutes_of_day[i] || minuteofday <= cond.minutes_of_day[i + 1]) {
2233
+ found = true;
2234
+ break;
2235
+ }
2236
+ }
2185
2237
  }
2186
2238
  if (!found) return false;
2187
2239
  }
@@ -2328,8 +2380,7 @@ function getUrlParameter() {
2328
2380
  return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
2329
2381
  }
2330
2382
  var sleep = ms => new Promise(res => setTimeout(res, ms));
2331
- function formatCurrency(val) {
2332
- let currency = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'VND';
2383
+ function formatCurrency(val, currency = 'VND') {
2333
2384
  let currencyObj = ALL_CURRENCIES.find(cur => cur.code === currency) || {
2334
2385
  name: 'Dong',
2335
2386
  code: 'VND',
@@ -2397,648 +2448,468 @@ function scrollIntoViewIfNeeded($ele) {
2397
2448
  }
2398
2449
  }
2399
2450
  const ALL_CURRENCIES = [{
2400
- name: 'Afghani',
2401
2451
  code: 'AFN',
2402
2452
  symbol: '؋'
2403
2453
  }, {
2404
- name: 'Euro',
2405
2454
  code: 'EUR',
2406
2455
  symbol: '€'
2407
2456
  }, {
2408
- name: 'Lek',
2409
2457
  code: 'ALL',
2410
2458
  symbol: 'Lek'
2411
2459
  }, {
2412
- name: 'Algerian Dinar',
2413
2460
  code: 'DZD'
2414
2461
  }, {
2415
- name: 'US Dollar',
2416
2462
  code: 'USD',
2417
2463
  symbol: '$'
2418
2464
  }, {
2419
- name: 'Kwanza',
2420
2465
  code: 'AOA'
2421
2466
  }, {
2422
- name: 'East Caribbean Dollar',
2423
2467
  code: 'XCD',
2424
2468
  symbol: '$'
2425
2469
  }, {
2426
- name: 'Argentine Peso',
2427
2470
  code: 'ARS',
2428
2471
  symbol: '$'
2429
2472
  }, {
2430
- name: 'Armenian Dram',
2431
2473
  code: 'AMD'
2432
2474
  }, {
2433
- name: 'Aruban Florin',
2434
2475
  code: 'AWG',
2435
2476
  symbol: 'ƒ'
2436
2477
  }, {
2437
- name: 'Australian Dollar',
2438
2478
  code: 'AUD',
2439
2479
  symbol: '$'
2440
2480
  }, {
2441
- name: 'Azerbaijan Manat',
2442
2481
  code: 'AZN',
2443
2482
  symbol: '₼'
2444
2483
  }, {
2445
- name: 'Bahamian Dollar',
2446
2484
  code: 'BSD',
2447
2485
  symbol: '$'
2448
2486
  }, {
2449
- name: 'Bahraini Dinar',
2450
2487
  code: 'BHD'
2451
2488
  }, {
2452
- name: 'Taka',
2453
2489
  code: 'BDT'
2454
2490
  }, {
2455
- name: 'Barbados Dollar',
2456
2491
  code: 'BBD',
2457
2492
  symbol: '$'
2458
2493
  }, {
2459
- name: 'Belarusian Ruble',
2460
2494
  code: 'BYN',
2461
2495
  symbol: 'Br'
2462
2496
  }, {
2463
- name: 'Belize Dollar',
2464
2497
  code: 'BZD',
2465
2498
  symbol: 'BZ$'
2466
2499
  }, {
2467
- name: 'CFA Franc BCEAO',
2468
2500
  code: 'XOF'
2469
2501
  }, {
2470
- name: 'Bermudian Dollar',
2471
2502
  code: 'BMD',
2472
2503
  symbol: '$'
2473
2504
  }, {
2474
- name: 'Indian Rupee',
2475
2505
  code: 'INR',
2476
2506
  symbol: '₹'
2477
2507
  }, {
2478
- name: 'Ngultrum',
2479
2508
  code: 'BTN'
2480
2509
  }, {
2481
- name: 'Boliviano',
2482
2510
  code: 'BOB',
2483
2511
  symbol: '$b'
2484
2512
  }, {
2485
- name: 'Mvdol',
2486
2513
  code: 'BOV'
2487
2514
  }, {
2488
- name: 'Convertible Mark',
2489
2515
  code: 'BAM',
2490
2516
  symbol: 'KM'
2491
2517
  }, {
2492
- name: 'Pula',
2493
2518
  code: 'BWP',
2494
2519
  symbol: 'P'
2495
2520
  }, {
2496
- name: 'Norwegian Krone',
2497
2521
  code: 'NOK',
2498
2522
  symbol: 'kr'
2499
2523
  }, {
2500
- name: 'Brazilian Real',
2501
2524
  code: 'BRL',
2502
2525
  symbol: 'R$'
2503
2526
  }, {
2504
- name: 'Brunei Dollar',
2505
2527
  code: 'BND',
2506
2528
  symbol: '$'
2507
2529
  }, {
2508
- name: 'Bulgarian Lev',
2509
2530
  code: 'BGN',
2510
2531
  symbol: 'лв'
2511
2532
  }, {
2512
- name: 'Burundi Franc',
2513
2533
  code: 'BIF'
2514
2534
  }, {
2515
- name: 'Cabo Verde Escudo',
2516
2535
  code: 'CVE'
2517
2536
  }, {
2518
- name: 'Riel',
2519
2537
  code: 'KHR',
2520
2538
  symbol: '៛'
2521
2539
  }, {
2522
- name: 'CFA Franc BEAC',
2523
2540
  code: 'XAF'
2524
2541
  }, {
2525
- name: 'Canadian Dollar',
2526
2542
  code: 'CAD',
2527
2543
  symbol: '$'
2528
2544
  }, {
2529
- name: 'Cayman Islands Dollar',
2530
2545
  code: 'KYD',
2531
2546
  symbol: '$'
2532
2547
  }, {
2533
- name: 'Chilean Peso',
2534
2548
  code: 'CLP',
2535
2549
  symbol: '$'
2536
2550
  }, {
2537
- name: 'Unidad de Fomento',
2538
2551
  code: 'CLF'
2539
2552
  }, {
2540
- name: 'Yuan Renminbi',
2541
2553
  code: 'CNY',
2542
2554
  symbol: '¥'
2543
2555
  }, {
2544
- name: 'Colombian Peso',
2545
2556
  code: 'COP',
2546
2557
  symbol: '$'
2547
2558
  }, {
2548
- name: 'Unidad de Valor Real',
2549
2559
  code: 'COU'
2550
2560
  }, {
2551
- name: 'Comorian Franc ',
2552
2561
  code: 'KMF'
2553
2562
  }, {
2554
- name: 'Congolese Franc',
2555
2563
  code: 'CDF'
2556
2564
  }, {
2557
- name: 'New Zealand Dollar',
2558
2565
  code: 'NZD',
2559
2566
  symbol: '$'
2560
2567
  }, {
2561
- name: 'Costa Rican Colon',
2562
2568
  code: 'CRC',
2563
2569
  symbol: '₡'
2564
2570
  }, {
2565
- name: 'Kuna',
2566
2571
  code: 'HRK',
2567
2572
  symbol: 'kn'
2568
2573
  }, {
2569
- name: 'Cuban Peso',
2570
2574
  code: 'CUP',
2571
2575
  symbol: '₱'
2572
2576
  }, {
2573
- name: 'Peso Convertible',
2574
2577
  code: 'CUC'
2575
2578
  }, {
2576
- name: 'Netherlands Antillean Guilder',
2577
2579
  code: 'ANG',
2578
2580
  symbol: 'ƒ'
2579
2581
  }, {
2580
- name: 'Czech Koruna',
2581
2582
  code: 'CZK',
2582
2583
  symbol: 'Kč'
2583
2584
  }, {
2584
- name: 'Danish Krone',
2585
2585
  code: 'DKK',
2586
2586
  symbol: 'kr'
2587
2587
  }, {
2588
- name: 'Djibouti Franc',
2589
2588
  code: 'DJF'
2590
2589
  }, {
2591
- name: 'Dominican Peso',
2592
2590
  code: 'DOP',
2593
2591
  symbol: 'RD$'
2594
2592
  }, {
2595
- name: 'Egyptian Pound',
2596
2593
  code: 'EGP',
2597
2594
  symbol: '£'
2598
2595
  }, {
2599
- name: 'El Salvador Colon',
2600
2596
  code: 'SVC',
2601
2597
  symbol: '$'
2602
2598
  }, {
2603
- name: 'Nakfa',
2604
2599
  code: 'ERN'
2605
2600
  }, {
2606
- name: 'Lilangeni',
2607
2601
  code: 'SZL'
2608
2602
  }, {
2609
- name: 'Ethiopian Birr',
2610
2603
  code: 'ETB'
2611
2604
  }, {
2612
- name: 'Falkland Islands Pound',
2613
2605
  code: 'FKP',
2614
2606
  symbol: '£'
2615
2607
  }, {
2616
- name: 'Fiji Dollar',
2617
2608
  code: 'FJD',
2618
2609
  symbol: '$'
2619
2610
  }, {
2620
- name: 'CFP Franc',
2621
2611
  code: 'XPF'
2622
2612
  }, {
2623
- name: 'Dalasi',
2624
2613
  code: 'GMD'
2625
2614
  }, {
2626
- name: 'Lari',
2627
2615
  code: 'GEL'
2628
2616
  }, {
2629
- name: 'Ghana Cedi',
2630
2617
  code: 'GHS',
2631
2618
  symbol: '¢'
2632
2619
  }, {
2633
- name: 'Gibraltar Pound',
2634
2620
  code: 'GIP',
2635
2621
  symbol: '£'
2636
2622
  }, {
2637
- name: 'Quetzal',
2638
2623
  code: 'GTQ',
2639
2624
  symbol: 'Q'
2640
2625
  }, {
2641
- name: 'Pound Sterling',
2642
2626
  code: 'GBP',
2643
2627
  symbol: '£'
2644
2628
  }, {
2645
- name: 'Guinean Franc',
2646
2629
  code: 'GNF'
2647
2630
  }, {
2648
- name: 'Guyana Dollar',
2649
2631
  code: 'GYD',
2650
2632
  symbol: '$'
2651
2633
  }, {
2652
- name: 'Gourde',
2653
2634
  code: 'HTG'
2654
2635
  }, {
2655
- name: 'Lempira',
2656
2636
  code: 'HNL',
2657
2637
  symbol: 'L'
2658
2638
  }, {
2659
- name: 'Hong Kong Dollar',
2660
2639
  code: 'HKD',
2661
2640
  symbol: '$'
2662
2641
  }, {
2663
- name: 'Forint',
2664
2642
  code: 'HUF',
2665
2643
  symbol: 'Ft'
2666
2644
  }, {
2667
- name: 'Iceland Krona',
2668
2645
  code: 'ISK',
2669
2646
  symbol: 'kr'
2670
2647
  }, {
2671
- name: 'Rupiah',
2672
2648
  code: 'IDR',
2673
2649
  symbol: 'Rp'
2674
2650
  }, {
2675
- name: 'SDR (Special Drawing Right)',
2676
2651
  code: 'XDR'
2677
2652
  }, {
2678
- name: 'Iranian Rial',
2679
2653
  code: 'IRR',
2680
2654
  symbol: '﷼'
2681
2655
  }, {
2682
- name: 'Iraqi Dinar',
2683
2656
  code: 'IQD'
2684
2657
  }, {
2685
- name: 'New Israeli Sheqel',
2686
2658
  code: 'ILS',
2687
2659
  symbol: '₪'
2688
2660
  }, {
2689
- name: 'Jamaican Dollar',
2690
2661
  code: 'JMD',
2691
2662
  symbol: 'J$'
2692
2663
  }, {
2693
- name: 'Yen',
2694
2664
  code: 'JPY',
2695
2665
  symbol: '¥'
2696
2666
  }, {
2697
- name: 'Jordanian Dinar',
2698
2667
  code: 'JOD'
2699
2668
  }, {
2700
- name: 'Tenge',
2701
2669
  code: 'KZT',
2702
2670
  symbol: 'лв'
2703
2671
  }, {
2704
- name: 'Kenyan Shilling',
2705
2672
  code: 'KES'
2706
2673
  }, {
2707
- name: 'North Korean Won',
2708
2674
  code: 'KPW',
2709
2675
  symbol: '₩'
2710
2676
  }, {
2711
- name: 'Won',
2712
2677
  code: 'KRW',
2713
2678
  symbol: '₩'
2714
2679
  }, {
2715
- name: 'Kuwaiti Dinar',
2716
2680
  code: 'KWD'
2717
2681
  }, {
2718
- name: 'Som',
2719
2682
  code: 'KGS',
2720
2683
  symbol: 'лв'
2721
2684
  }, {
2722
- name: 'Lao Kip',
2723
2685
  code: 'LAK',
2724
2686
  symbol: '₭'
2725
2687
  }, {
2726
- name: 'Lebanese Pound',
2727
2688
  code: 'LBP',
2728
2689
  symbol: '£'
2729
2690
  }, {
2730
- name: 'Loti',
2731
2691
  code: 'LSL'
2732
2692
  }, {
2733
- name: 'Rand',
2734
2693
  code: 'ZAR',
2735
2694
  symbol: 'R'
2736
2695
  }, {
2737
- name: 'Liberian Dollar',
2738
2696
  code: 'LRD',
2739
2697
  symbol: '$'
2740
2698
  }, {
2741
- name: 'Libyan Dinar',
2742
2699
  code: 'LYD'
2743
2700
  }, {
2744
- name: 'Swiss Franc',
2745
2701
  code: 'CHF',
2746
2702
  symbol: 'CHF'
2747
2703
  }, {
2748
- name: 'Pataca',
2749
2704
  code: 'MOP'
2750
2705
  }, {
2751
- name: 'Denar',
2752
2706
  code: 'MKD',
2753
2707
  symbol: 'ден'
2754
2708
  }, {
2755
- name: 'Malagasy Ariary',
2756
2709
  code: 'MGA'
2757
2710
  }, {
2758
- name: 'Malawi Kwacha',
2759
2711
  code: 'MWK'
2760
2712
  }, {
2761
- name: 'Malaysian Ringgit',
2762
2713
  code: 'MYR',
2763
2714
  symbol: 'RM'
2764
2715
  }, {
2765
- name: 'Rufiyaa',
2766
2716
  code: 'MVR'
2767
2717
  }, {
2768
- name: 'Ouguiya',
2769
2718
  code: 'MRU'
2770
2719
  }, {
2771
- name: 'Mauritius Rupee',
2772
2720
  code: 'MUR',
2773
2721
  symbol: '₨'
2774
2722
  }, {
2775
- name: 'ADB Unit of Account',
2776
2723
  code: 'XUA'
2777
2724
  }, {
2778
- name: 'Mexican Peso',
2779
2725
  code: 'MXN',
2780
2726
  symbol: '$'
2781
2727
  }, {
2782
- name: 'Mexican Unidad de Inversion (UDI)',
2783
2728
  code: 'MXV'
2784
2729
  }, {
2785
- name: 'Moldovan Leu',
2786
2730
  code: 'MDL'
2787
2731
  }, {
2788
- name: 'Tugrik',
2789
2732
  code: 'MNT',
2790
2733
  symbol: '₮'
2791
2734
  }, {
2792
- name: 'Moroccan Dirham',
2793
2735
  code: 'MAD'
2794
2736
  }, {
2795
- name: 'Mozambique Metical',
2796
2737
  code: 'MZN',
2797
2738
  symbol: 'MT'
2798
2739
  }, {
2799
- name: 'Kyat',
2800
2740
  code: 'MMK'
2801
2741
  }, {
2802
- name: 'Namibia Dollar',
2803
2742
  code: 'NAD',
2804
2743
  symbol: '$'
2805
2744
  }, {
2806
- name: 'Nepalese Rupee',
2807
2745
  code: 'NPR',
2808
2746
  symbol: '₨'
2809
2747
  }, {
2810
- name: 'Cordoba Oro',
2811
2748
  code: 'NIO',
2812
2749
  symbol: 'C$'
2813
2750
  }, {
2814
- name: 'Naira',
2815
2751
  code: 'NGN',
2816
2752
  symbol: '₦'
2817
2753
  }, {
2818
- name: 'Rial Omani',
2819
2754
  code: 'OMR',
2820
2755
  symbol: '﷼'
2821
2756
  }, {
2822
- name: 'Pakistan Rupee',
2823
2757
  code: 'PKR',
2824
2758
  symbol: '₨'
2825
2759
  }, {
2826
- name: 'Balboa',
2827
2760
  code: 'PAB',
2828
2761
  symbol: 'B/.'
2829
2762
  }, {
2830
- name: 'Kina',
2831
2763
  code: 'PGK'
2832
2764
  }, {
2833
- name: 'Guarani',
2834
2765
  code: 'PYG',
2835
2766
  symbol: 'Gs'
2836
2767
  }, {
2837
- name: 'Sol',
2838
2768
  code: 'PEN',
2839
2769
  symbol: 'S/.'
2840
2770
  }, {
2841
- name: 'Philippine Peso',
2842
2771
  code: 'PHP',
2843
2772
  symbol: '₱'
2844
2773
  }, {
2845
- name: 'Zloty',
2846
2774
  code: 'PLN',
2847
2775
  symbol: 'zł'
2848
2776
  }, {
2849
- name: 'Qatari Rial',
2850
2777
  code: 'QAR',
2851
2778
  symbol: '﷼'
2852
2779
  }, {
2853
- name: 'Romanian Leu',
2854
2780
  code: 'RON',
2855
2781
  symbol: 'lei'
2856
2782
  }, {
2857
- name: 'Russian Ruble',
2858
2783
  code: 'RUB',
2859
2784
  symbol: '₽'
2860
2785
  }, {
2861
- name: 'Rwanda Franc',
2862
2786
  code: 'RWF'
2863
2787
  }, {
2864
- name: 'Saint Helena Pound',
2865
2788
  code: 'SHP',
2866
2789
  symbol: '£'
2867
2790
  }, {
2868
- name: 'Tala',
2869
2791
  code: 'WST'
2870
2792
  }, {
2871
- name: 'Dobra',
2872
2793
  code: 'STN'
2873
2794
  }, {
2874
- name: 'Saudi Riyal',
2875
2795
  code: 'SAR',
2876
2796
  symbol: '﷼'
2877
2797
  }, {
2878
- name: 'Serbian Dinar',
2879
2798
  code: 'RSD',
2880
2799
  symbol: 'Дин.'
2881
2800
  }, {
2882
- name: 'Seychelles Rupee',
2883
2801
  code: 'SCR',
2884
2802
  symbol: '₨'
2885
2803
  }, {
2886
- name: 'Leone',
2887
2804
  code: 'SLL'
2888
2805
  }, {
2889
- name: 'Singapore Dollar',
2890
2806
  code: 'SGD',
2891
2807
  symbol: '$'
2892
2808
  }, {
2893
- name: 'Sucre',
2894
2809
  code: 'XSU'
2895
2810
  }, {
2896
- name: 'Solomon Islands Dollar',
2897
2811
  code: 'SBD',
2898
2812
  symbol: '$'
2899
2813
  }, {
2900
- name: 'Somali Shilling',
2901
2814
  code: 'SOS',
2902
2815
  symbol: 'S'
2903
2816
  }, {
2904
- name: 'South Sudanese Pound',
2905
2817
  code: 'SSP'
2906
2818
  }, {
2907
- name: 'Sri Lanka Rupee',
2908
2819
  code: 'LKR',
2909
2820
  symbol: '₨'
2910
2821
  }, {
2911
- name: 'Sudanese Pound',
2912
2822
  code: 'SDG'
2913
2823
  }, {
2914
- name: 'Surinam Dollar',
2915
2824
  code: 'SRD',
2916
2825
  symbol: '$'
2917
2826
  }, {
2918
- name: 'Swedish Krona',
2919
2827
  code: 'SEK',
2920
2828
  symbol: 'kr'
2921
2829
  }, {
2922
- name: 'WIR Euro',
2923
2830
  code: 'CHE'
2924
2831
  }, {
2925
- name: 'WIR Franc',
2926
2832
  code: 'CHW'
2927
2833
  }, {
2928
- name: 'Syrian Pound',
2929
2834
  code: 'SYP',
2930
2835
  symbol: '£'
2931
2836
  }, {
2932
- name: 'New Taiwan Dollar',
2933
2837
  code: 'TWD',
2934
2838
  symbol: 'NT$'
2935
2839
  }, {
2936
- name: 'Somoni',
2937
2840
  code: 'TJS'
2938
2841
  }, {
2939
- name: 'Tanzanian Shilling',
2940
2842
  code: 'TZS'
2941
2843
  }, {
2942
- name: 'Baht',
2943
2844
  code: 'THB',
2944
2845
  symbol: '฿'
2945
2846
  }, {
2946
- name: 'Pa’anga',
2947
2847
  code: 'TOP'
2948
2848
  }, {
2949
- name: 'Trinidad and Tobago Dollar',
2950
2849
  code: 'TTD',
2951
2850
  symbol: 'TT$'
2952
2851
  }, {
2953
- name: 'Tunisian Dinar',
2954
2852
  code: 'TND'
2955
2853
  }, {
2956
- name: 'Turkish Lira',
2957
2854
  code: 'TRY',
2958
2855
  symbol: '₺'
2959
2856
  }, {
2960
- name: 'Turkmenistan New Manat',
2961
2857
  code: 'TMT'
2962
2858
  }, {
2963
- name: 'Uganda Shilling',
2964
2859
  code: 'UGX'
2965
2860
  }, {
2966
- name: 'Hryvnia',
2967
2861
  code: 'UAH',
2968
2862
  symbol: '₴'
2969
2863
  }, {
2970
- name: 'UAE Dirham',
2971
2864
  code: 'AED',
2972
2865
  symbol: ' د.إ'
2973
2866
  }, {
2974
- name: 'US Dollar (Next day)',
2975
2867
  code: 'USN'
2976
2868
  }, {
2977
- name: 'Peso Uruguayo',
2978
2869
  code: 'UYU',
2979
2870
  symbol: '$U'
2980
2871
  }, {
2981
- name: 'Uruguay Peso en Unidades Indexadas (UI)',
2982
2872
  code: 'UYI'
2983
2873
  }, {
2984
- name: 'Unidad Previsional',
2985
2874
  code: 'UYW'
2986
2875
  }, {
2987
- name: 'Uzbekistan Sum',
2988
2876
  code: 'UZS',
2989
2877
  symbol: 'лв'
2990
2878
  }, {
2991
- name: 'Vatu',
2992
2879
  code: 'VUV'
2993
2880
  }, {
2994
- name: 'Bolívar Soberano',
2995
2881
  code: 'VES'
2996
2882
  }, {
2997
- name: 'Bolívar Soberano',
2998
2883
  code: 'VED'
2999
2884
  }, {
3000
- name: 'Dong',
3001
2885
  code: 'VND',
3002
2886
  symbol: '₫'
3003
2887
  }, {
3004
- name: 'Yemeni Rial',
3005
2888
  code: 'YER',
3006
2889
  symbol: '﷼'
3007
2890
  }, {
3008
- name: 'Zambian Kwacha',
3009
2891
  code: 'ZMW'
3010
2892
  }, {
3011
- name: 'Zimbabwe Dollar',
3012
2893
  code: 'ZWL'
3013
2894
  }, {
3014
- name: 'Bond Markets Unit European Composite Unit (EURCO)',
3015
2895
  code: 'XBA'
3016
2896
  }, {
3017
- name: 'Bond Markets Unit European Monetary Unit (E.M.U.-6)',
3018
2897
  code: 'XBB'
3019
2898
  }, {
3020
- name: 'Bond Markets Unit European Unit of Account 9 (E.U.A.-9)',
3021
2899
  code: 'XBC'
3022
2900
  }, {
3023
- name: 'Bond Markets Unit European Unit of Account 17 (E.U.A.-17)',
3024
2901
  code: 'XBD'
3025
2902
  }, {
3026
- name: 'Codes specifically reserved for testing purposes',
3027
2903
  code: 'XTS'
3028
2904
  }, {
3029
- name: 'The codes assigned for transactions where no currency is involved',
3030
2905
  code: 'XXX'
3031
2906
  }, {
3032
- name: 'Gold',
3033
2907
  code: 'XAU'
3034
2908
  }, {
3035
- name: 'Palladium',
3036
2909
  code: 'XPD'
3037
2910
  }, {
3038
- name: 'Platinum',
3039
2911
  code: 'XPT'
3040
2912
  }, {
3041
- name: 'Silver',
3042
2913
  code: 'XAG'
3043
2914
  }];
3044
2915
 
@@ -3049,7 +2920,7 @@ const ALL_CURRENCIES = [{
3049
2920
 
3050
2921
  "use strict";
3051
2922
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3052
- /* harmony export */ "Z": () => (/* binding */ Gate)
2923
+ /* harmony export */ Z: () => (/* binding */ Gate)
3053
2924
  /* harmony export */ });
3054
2925
  class Gate {
3055
2926
  constructor(isOpen) {
@@ -3092,41 +2963,41 @@ class Gate {
3092
2963
 
3093
2964
  // EXPORTS
3094
2965
  __webpack_require__.d(__webpack_exports__, {
3095
- "Z": () => (/* binding */ util)
2966
+ Z: () => (/* binding */ util)
3096
2967
  });
3097
2968
 
3098
2969
  // NAMESPACE OBJECT: ./src/util/extractor.js
3099
2970
  var extractor_namespaceObject = {};
3100
2971
  __webpack_require__.r(extractor_namespaceObject);
3101
2972
  __webpack_require__.d(extractor_namespaceObject, {
3102
- "extract": () => (extract),
3103
- "extractEmails": () => (extractEmails),
3104
- "extractEmojis": () => (extractEmojis),
3105
- "extractLinks": () => (extractLinks),
3106
- "extractPhones": () => (extractPhones),
3107
- "extractText": () => (extractText),
3108
- "pipeExtracts": () => (pipeExtracts)
2973
+ extract: () => (extract),
2974
+ extractEmails: () => (extractEmails),
2975
+ extractEmojis: () => (extractEmojis),
2976
+ extractLinks: () => (extractLinks),
2977
+ extractPhones: () => (extractPhones),
2978
+ extractText: () => (extractText),
2979
+ pipeExtracts: () => (pipeExtracts)
3109
2980
  });
3110
2981
 
3111
2982
  // NAMESPACE OBJECT: ./src/util/campaign.js
3112
2983
  var campaign_namespaceObject = {};
3113
2984
  __webpack_require__.r(campaign_namespaceObject);
3114
2985
  __webpack_require__.d(campaign_namespaceObject, {
3115
- "trackAreaClicked": () => (trackAreaClicked),
3116
- "trackExitIntent": () => (trackExitIntent),
3117
- "trackInactivity": () => (trackInactivity),
3118
- "trackScrollingPercentage": () => (trackScrollingPercentage),
3119
- "trackTimeOnPage": () => (trackTimeOnPage)
2986
+ trackAreaClicked: () => (trackAreaClicked),
2987
+ trackExitIntent: () => (trackExitIntent),
2988
+ trackInactivity: () => (trackInactivity),
2989
+ trackScrollingPercentage: () => (trackScrollingPercentage),
2990
+ trackTimeOnPage: () => (trackTimeOnPage)
3120
2991
  });
3121
2992
 
3122
2993
  // NAMESPACE OBJECT: ./src/util/order.js
3123
2994
  var order_namespaceObject = {};
3124
2995
  __webpack_require__.r(order_namespaceObject);
3125
2996
  __webpack_require__.d(order_namespaceObject, {
3126
- "calcOrderTotal": () => (calcOrderTotal),
3127
- "displayOrderShippingAddress": () => (displayOrderShippingAddress),
3128
- "getOrderDisplayName": () => (getOrderDisplayName),
3129
- "getProductPropName": () => (getProductPropName)
2997
+ calcOrderTotal: () => (calcOrderTotal),
2998
+ displayOrderShippingAddress: () => (displayOrderShippingAddress),
2999
+ getOrderDisplayName: () => (getOrderDisplayName),
3000
+ getProductPropName: () => (getProductPropName)
3130
3001
  });
3131
3002
 
3132
3003
  // EXTERNAL MODULE: ./src/util/common.js
@@ -3286,9 +3157,7 @@ function trackAreaClicked(selector, cb) {
3286
3157
  on('click', selector, cb);
3287
3158
  });
3288
3159
  }
3289
- function trackInactivity() {
3290
- let seconds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
3291
- let cb = arguments.length > 1 ? arguments[1] : undefined;
3160
+ function trackInactivity(seconds = 0, cb) {
3292
3161
  let events = ['scroll', 'keyup', 'keydown', 'mousemove', 'mousewheel', 'mouseenter', 'mouseover', 'mousedown', 'touchstart', 'touchmove', 'touchenter'];
3293
3162
  let inactiveSeconds = 0;
3294
3163
  let resetTime = () => {
@@ -3311,9 +3180,7 @@ let timeOnPage = 0;
3311
3180
  campaign_common.setInterval(() => {
3312
3181
  timeOnPage += 5;
3313
3182
  }, 5000);
3314
- function trackTimeOnPage() {
3315
- let seconds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
3316
- let cb = arguments.length > 1 ? arguments[1] : undefined;
3183
+ function trackTimeOnPage(seconds = 0, cb) {
3317
3184
  if (seconds < 1) {
3318
3185
  return campaign_common.setTimeout(function () {
3319
3186
  cb(seconds);
@@ -3349,8 +3216,7 @@ op.map = order_common.map;
3349
3216
  op.each = order_common.each;
3350
3217
  op.size = order_common.size;
3351
3218
  op.find = order_common.find;
3352
- function getProductPropName(product) {
3353
- let seperator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ' - ';
3219
+ function getProductPropName(product, seperator = ' - ') {
3354
3220
  let options = op.get(product, 'options', []);
3355
3221
  let props = op.get(product, 'props', []);
3356
3222
  let multiPropsOptions = op.filter(options, option => op.size(option.values) > 1);
@@ -3361,8 +3227,7 @@ function getProductPropName(product) {
3361
3227
  });
3362
3228
  return names.join(seperator);
3363
3229
  }
3364
- function getOrderDisplayName() {
3365
- let order = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3230
+ function getOrderDisplayName(order = {}) {
3366
3231
  return order.number || order.id || '';
3367
3232
  }
3368
3233
  function displayOrderShippingAddress(order, isShorten) {
@@ -3472,7 +3337,7 @@ sb = Object.assign(sb, order_namespaceObject);
3472
3337
 
3473
3338
  "use strict";
3474
3339
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3475
- /* harmony export */ "Z": () => (/* binding */ Mutex)
3340
+ /* harmony export */ Z: () => (/* binding */ Mutex)
3476
3341
  /* harmony export */ });
3477
3342
  class Mutex {
3478
3343
  constructor() {
@@ -3507,8 +3372,8 @@ class Mutex {
3507
3372
  "use strict";
3508
3373
  __webpack_require__.r(__webpack_exports__);
3509
3374
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3510
- /* harmony export */ "get": () => (/* binding */ get),
3511
- /* harmony export */ "set": () => (/* binding */ set)
3375
+ /* harmony export */ get: () => (/* binding */ get),
3376
+ /* harmony export */ set: () => (/* binding */ set)
3512
3377
  /* harmony export */ });
3513
3378
  var toStr = Object.prototype.toString;
3514
3379
  var isArray = Array.isArray || function (obj) {
@@ -3566,7 +3431,7 @@ function set(obj, path, value) {
3566
3431
 
3567
3432
  "use strict";
3568
3433
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3569
- /* harmony export */ "Z": () => (/* binding */ Pubsub)
3434
+ /* harmony export */ Z: () => (/* binding */ Pubsub)
3570
3435
  /* harmony export */ });
3571
3436
  var {
3572
3437
  filter,
@@ -3578,12 +3443,9 @@ class Pubsub {
3578
3443
  }
3579
3444
  publish(topic, payload, payload2, payload3) {
3580
3445
  this.listeners[topic] = filter(this.listeners[topic], sub => sub.obj._isMounted);
3581
- map(this.listeners[topic], _ref => {
3582
- let {
3583
- cb
3584
- } = _ref;
3585
- return cb(payload, payload2, payload3);
3586
- });
3446
+ map(this.listeners[topic], ({
3447
+ cb
3448
+ }) => cb(payload, payload2, payload3));
3587
3449
  }
3588
3450
  on2(obj, topic, cb) {
3589
3451
  if (!this.listeners[topic]) this.listeners[topic] = [];
@@ -3788,14 +3650,14 @@ class Pubsub {
3788
3650
 
3789
3651
  "use strict";
3790
3652
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3791
- /* harmony export */ "HY": () => (/* binding */ p),
3792
- /* harmony export */ "Vf": () => (/* binding */ y),
3793
- /* harmony export */ "h": () => (/* binding */ h),
3794
- /* harmony export */ "sY": () => (/* binding */ P),
3795
- /* harmony export */ "wA": () => (/* binding */ d)
3653
+ /* harmony export */ HY: () => (/* binding */ g),
3654
+ /* harmony export */ Vf: () => (/* binding */ _),
3655
+ /* harmony export */ h: () => (/* binding */ y),
3656
+ /* harmony export */ sY: () => (/* binding */ q),
3657
+ /* harmony export */ wA: () => (/* binding */ b)
3796
3658
  /* harmony export */ });
3797
3659
  /* unused harmony exports cloneElement, createContext, createElement, hydrate, isValidElement, options, toChildArray */
3798
- var n,l,u,i,t,o,r,f={},e=[],c=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s(n,l){for(var u in l)n[u]=l[u];return n}function a(n){var l=n.parentNode;l&&l.removeChild(n)}function h(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return v(l,f,t,o,null)}function v(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u:r};return null==r&&null!=l.vnode&&l.vnode(f),f}function y(){return{current:null}}function p(n){return n.children}function d(n,l){this.props=n,this.context=l}function _(n,l){if(null==l)return n.__?_(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return"function"==typeof n.type?_(n):null}function k(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return k(n)}}function b(n){(!n.__d&&(n.__d=!0)&&t.push(n)&&!g.__r++||o!==l.debounceRendering)&&((o=l.debounceRendering)||setTimeout)(g)}function g(){for(var n;g.__r=t.length;)n=t.sort(function(n,l){return n.__v.__b-l.__v.__b}),t=[],n.some(function(n){var l,u,i,t,o,r;n.__d&&(o=(t=(l=n).__v).__e,(r=l.__P)&&(u=[],(i=s({},t)).__v=t.__v+1,j(r,t,i,l.__n,void 0!==r.ownerSVGElement,null!=t.__h?[o]:null,u,null==o?_(t):o,t.__h),z(u,t),t.__e!=o&&k(t)))})}function w(n,l,u,i,t,o,r,c,s,a){var h,y,d,k,b,g,w,x=i&&i.__k||e,C=x.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(k=u.__k[h]=null==(k=l[h])||"boolean"==typeof k?null:"string"==typeof k||"number"==typeof k||"bigint"==typeof k?v(null,k,null,null,k):Array.isArray(k)?v(p,{children:k},null,null,null):k.__b>0?v(k.type,k.props,k.key,k.ref?k.ref:null,k.__v):k)){if(k.__=u,k.__b=u.__b+1,null===(d=x[h])||d&&k.key==d.key&&k.type===d.type)x[h]=void 0;else for(y=0;y<C;y++){if((d=x[y])&&k.key==d.key&&k.type===d.type){x[y]=void 0;break}d=null}j(n,k,d=d||f,t,o,r,c,s,a),b=k.__e,(y=k.ref)&&d.ref!=y&&(w||(w=[]),d.ref&&w.push(d.ref,null,k),w.push(y,k.__c||b,k)),null!=b?(null==g&&(g=b),"function"==typeof k.type&&k.__k===d.__k?k.__d=s=m(k,s,n):s=A(n,k,d,x,b,s),"function"==typeof u.type&&(u.__d=s)):s&&d.__e==s&&s.parentNode!=n&&(s=_(d))}for(u.__e=g,h=C;h--;)null!=x[h]&&N(x[h],x[h]);if(w)for(h=0;h<w.length;h++)M(w[h],w[++h],w[++h])}function m(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l="function"==typeof i.type?m(i,l,u):A(u,i,i,t,i.__e,l));return l}function x(n,l){return l=l||[],null==n||"boolean"==typeof n||(Array.isArray(n)?n.some(function(n){x(n,l)}):l.push(n)),l}function A(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else{for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=1)if(f==t)break n;n.insertBefore(t,o),r=o}return void 0!==r?r:t.nextSibling}function C(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||H(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||H(n,o,l[o],u[o],i)}function $(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]=null==u?"":"number"!=typeof u||c.test(l)?u:u+"px"}function H(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else{if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||$(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||$(n.style,l,u[l])}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?T:I,o):n.removeEventListener(l,o?T:I,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&-1==l.indexOf("-")?n.removeAttribute(l):n.setAttribute(l,u))}}function I(n){this.l[n.type+!1](l.event?l.event(n):n)}function T(n){this.l[n.type+!0](l.event?l.event(n):n)}function j(n,u,i,t,o,r,f,e,c){var a,h,v,y,_,k,b,g,m,x,A,C,$,H,I,T=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(a=l.__b)&&a(u);try{n:if("function"==typeof T){if(g=u.props,m=(a=T.contextType)&&t[a.__c],x=a?m?m.props.value:a.__:t,i.__c?b=(h=u.__c=i.__c).__=h.__E:("prototype"in T&&T.prototype.render?u.__c=h=new T(g,x):(u.__c=h=new d(g,x),h.constructor=T,h.render=O),m&&m.sub(h),h.props=g,h.state||(h.state={}),h.context=x,h.__n=t,v=h.__d=!0,h.__h=[],h._sb=[]),null==h.__s&&(h.__s=h.state),null!=T.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=s({},h.__s)),s(h.__s,T.getDerivedStateFromProps(g,h.__s))),y=h.props,_=h.state,v)null==T.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(null==T.getDerivedStateFromProps&&g!==y&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(g,x),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(g,h.__s,x)||u.__v===i.__v){for(h.props=g,h.state=h.__s,u.__v!==i.__v&&(h.__d=!1),h.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u)}),A=0;A<h._sb.length;A++)h.__h.push(h._sb[A]);h._sb=[],h.__h.length&&f.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(g,h.__s,x),null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(y,_,k)})}if(h.context=x,h.props=g,h.__v=u,h.__P=n,C=l.__r,$=0,"prototype"in T&&T.prototype.render){for(h.state=h.__s,h.__d=!1,C&&C(u),a=h.render(h.props,h.state,h.context),H=0;H<h._sb.length;H++)h.__h.push(h._sb[H]);h._sb=[]}else do{h.__d=!1,C&&C(u),a=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&++$<25);h.state=h.__s,null!=h.getChildContext&&(t=s(s({},t),h.getChildContext())),v||null==h.getSnapshotBeforeUpdate||(k=h.getSnapshotBeforeUpdate(y,_)),I=null!=a&&a.type===p&&null==a.key?a.props.children:a,w(n,Array.isArray(I)?I:[I],u,i,t,o,r,f,e,c),h.base=u.__e,u.__h=null,h.__h.length&&f.push(h),b&&(h.__E=h.__=null),h.__e=!1}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=L(i.__e,u,i,t,o,r,f,c);(a=l.diffed)&&a(u)}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l.__e(n,u,i)}}function z(n,u){l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u)})}catch(n){l.__e(n,u.__v)}})}function L(l,u,i,t,o,r,e,c){var s,h,v,y=i.props,p=u.props,d=u.type,k=0;if("svg"===d&&(o=!0),null!=r)for(;k<r.length;k++)if((s=r[k])&&"setAttribute"in s==!!d&&(d?s.localName===d:3===s.nodeType)){l=s,r[k]=null;break}if(null==l){if(null===d)return document.createTextNode(p);l=o?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,p.is&&p),r=null,c=!1}if(null===d)y===p||c&&l.data===p||(l.data=p);else{if(r=r&&n.call(l.childNodes),h=(y=i.props||f).dangerouslySetInnerHTML,v=p.dangerouslySetInnerHTML,!c){if(null!=r)for(y={},k=0;k<l.attributes.length;k++)y[l.attributes[k].name]=l.attributes[k].value;(v||h)&&(v&&(h&&v.__html==h.__html||v.__html===l.innerHTML)||(l.innerHTML=v&&v.__html||""))}if(C(l,p,y,o,c),v)u.__k=[];else if(k=u.props.children,w(l,Array.isArray(k)?k:[k],u,i,t,o&&"foreignObject"!==d,r,e,r?r[0]:i.__k&&_(i,0),c),null!=r)for(k=r.length;k--;)null!=r[k]&&a(r[k]);c||("value"in p&&void 0!==(k=p.value)&&(k!==l.value||"progress"===d&&!k||"option"===d&&k!==y.value)&&H(l,"value",k,y.value,!1),"checked"in p&&void 0!==(k=p.checked)&&k!==l.checked&&H(l,"checked",k,y.checked,!1))}return l}function M(n,u,i){try{"function"==typeof n?n(u):n.current=u}catch(n){l.__e(n,i)}}function N(n,u,i){var t,o;if(l.unmount&&l.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||M(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount()}catch(n){l.__e(n,u)}t.base=t.__P=null,n.__c=void 0}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&N(t[o],u,i||"function"!=typeof n.type);i||null==n.__e||a(n.__e),n.__=n.__e=n.__d=void 0}function O(n,l,u){return this.constructor(n,u)}function P(u,i,t){var o,r,e;l.__&&l.__(u,i),r=(o="function"==typeof t)?null:t&&t.__k||i.__k,e=[],j(i,u=(!o&&t||i).__k=h(p,null,[u]),r||f,f,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n.call(i.childNodes):null,e,!o&&t?t:r?r.__e:i.firstChild,o),z(e,u)}function S(n,l){P(n,l,S)}function q(l,u,i){var t,o,r,f=s({},l.props);for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];return arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),v(l.type,f,t||l.key,o||l.ref,null)}function B(n,l){var u={__c:l="__cC"+r++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,i;return this.getChildContext||(u=[],(i={})[l]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(b)},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n)}}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=e.slice,l={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l}throw n}},u=0,i=function(n){return null!=n&&void 0===n.constructor},d.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=s({},this.state),"function"==typeof n&&(n=n(s({},u),this.props)),n&&s(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),b(this))},d.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),b(this))},d.prototype.render=p,t=[],g.__r=0,r=0;
3660
+ var n,l,u,t,i,o,r,f,e,c={},s=[],a=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,h=Array.isArray;function v(n,l){for(var u in l)n[u]=l[u];return n}function p(n){var l=n.parentNode;l&&l.removeChild(n)}function y(l,u,t){var i,o,r,f={};for(r in u)"key"==r?i=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return d(l,f,i,o,null)}function d(n,t,i,o,r){var f={type:n,props:t,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==r?++u:r,__i:-1,__u:0};return null==r&&null!=l.vnode&&l.vnode(f),f}function _(){return{current:null}}function g(n){return n.children}function b(n,l){this.props=n,this.context=l}function m(n,l){if(null==l)return n.__?m(n.__,n.__i+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return"function"==typeof n.type?m(n):null}function k(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return k(n)}}function w(n){(!n.__d&&(n.__d=!0)&&i.push(n)&&!x.__r++||o!==l.debounceRendering)&&((o=l.debounceRendering)||r)(x)}function x(){var n,u,t,o,r,e,c,s,a;for(i.sort(f);n=i.shift();)n.__d&&(u=i.length,o=void 0,e=(r=(t=n).__v).__e,s=[],a=[],(c=t.__P)&&((o=v({},r)).__v=r.__v+1,l.vnode&&l.vnode(o),L(c,o,r,t.__n,void 0!==c.ownerSVGElement,32&r.__u?[e]:null,s,null==e?m(r):e,!!(32&r.__u),a),o.__.__k[o.__i]=o,M(s,o,a),o.__e!=e&&k(o)),i.length>u&&i.sort(f));x.__r=0}function C(n,l,u,t,i,o,r,f,e,a,h){var v,p,y,d,_,g=t&&t.__k||s,b=l.length;for(u.__d=e,P(u,l,g),e=u.__d,v=0;v<b;v++)null!=(y=u.__k[v])&&"boolean"!=typeof y&&"function"!=typeof y&&(p=-1===y.__i?c:g[y.__i]||c,y.__i=v,L(n,y,p,i,o,r,f,e,a,h),d=y.__e,y.ref&&p.ref!=y.ref&&(p.ref&&z(p.ref,null,y),h.push(y.ref,y.__c||d,y)),null==_&&null!=d&&(_=d),65536&y.__u||p.__k===y.__k?e=S(y,e,n):"function"==typeof y.type&&void 0!==y.__d?e=y.__d:d&&(e=d.nextSibling),y.__d=void 0,y.__u&=-196609);u.__d=e,u.__e=_}function P(n,l,u){var t,i,o,r,f,e=l.length,c=u.length,s=c,a=0;for(n.__k=[],t=0;t<e;t++)null!=(i=n.__k[t]=null==(i=l[t])||"boolean"==typeof i||"function"==typeof i?null:"string"==typeof i||"number"==typeof i||"bigint"==typeof i||i.constructor==String?d(null,i,null,null,i):h(i)?d(g,{children:i},null,null,null):void 0===i.constructor&&i.__b>0?d(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)?(i.__=n,i.__b=n.__b+1,f=H(i,u,r=t+a,s),i.__i=f,o=null,-1!==f&&(s--,(o=u[f])&&(o.__u|=131072)),null==o||null===o.__v?(-1==f&&a--,"function"!=typeof i.type&&(i.__u|=65536)):f!==r&&(f===r+1?a++:f>r?s>e-r?a+=f-r:a--:a=f<r&&f==r-1?f-r:0,f!==t+a&&(i.__u|=65536))):(o=u[t])&&null==o.key&&o.__e&&(o.__e==n.__d&&(n.__d=m(o)),N(o,o,!1),u[t]=null,s--);if(s)for(t=0;t<c;t++)null!=(o=u[t])&&0==(131072&o.__u)&&(o.__e==n.__d&&(n.__d=m(o)),N(o,o))}function S(n,l,u){var t,i;if("function"==typeof n.type){for(t=n.__k,i=0;t&&i<t.length;i++)t[i]&&(t[i].__=n,l=S(t[i],l,u));return l}return n.__e!=l&&(u.insertBefore(n.__e,l||null),l=n.__e),l&&l.nextSibling}function $(n,l){return l=l||[],null==n||"boolean"==typeof n||(h(n)?n.some(function(n){$(n,l)}):l.push(n)),l}function H(n,l,u,t){var i=n.key,o=n.type,r=u-1,f=u+1,e=l[u];if(null===e||e&&i==e.key&&o===e.type)return u;if(t>(null!=e&&0==(131072&e.__u)?1:0))for(;r>=0||f<l.length;){if(r>=0){if((e=l[r])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return r;r--}if(f<l.length){if((e=l[f])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return f;f++}}return-1}function I(n,l,u){"-"===l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||a.test(l)?u:u+"px"}function T(n,l,u,t,i){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else{if("string"==typeof t&&(n.style.cssText=t=""),t)for(l in t)u&&l in u||I(n.style,l,"");if(u)for(l in u)t&&u[l]===t[l]||I(n.style,l,u[l])}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/(PointerCapture)$|Capture$/,"$1")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?t?u.u=t.u:(u.u=Date.now(),n.addEventListener(l,o?D:A,o)):n.removeEventListener(l,o?D:A,o);else{if(i)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==l&&"height"!==l&&"href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&"rowSpan"!==l&&"colSpan"!==l&&"role"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&"-"!==l[4]?n.removeAttribute(l):n.setAttribute(l,u))}}function A(n){var u=this.l[n.type+!1];if(n.t){if(n.t<=u.u)return}else n.t=Date.now();return u(l.event?l.event(n):n)}function D(n){return this.l[n.type+!0](l.event?l.event(n):n)}function L(n,u,t,i,o,r,f,e,c,s){var a,p,y,d,_,m,k,w,x,P,S,$,H,I,T,A=u.type;if(void 0!==u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),r=[e=u.__e=t.__e]),(a=l.__b)&&a(u);n:if("function"==typeof A)try{if(w=u.props,x=(a=A.contextType)&&i[a.__c],P=a?x?x.props.value:a.__:i,t.__c?k=(p=u.__c=t.__c).__=p.__E:("prototype"in A&&A.prototype.render?u.__c=p=new A(w,P):(u.__c=p=new b(w,P),p.constructor=A,p.render=O),x&&x.sub(p),p.props=w,p.state||(p.state={}),p.context=P,p.__n=i,y=p.__d=!0,p.__h=[],p._sb=[]),null==p.__s&&(p.__s=p.state),null!=A.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=v({},p.__s)),v(p.__s,A.getDerivedStateFromProps(w,p.__s))),d=p.props,_=p.state,p.__v=u,y)null==A.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(null==A.getDerivedStateFromProps&&w!==d&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(w,P),!p.__e&&(null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(w,p.__s,P)||u.__v===t.__v)){for(u.__v!==t.__v&&(p.props=w,p.state=p.__s,p.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.forEach(function(n){n&&(n.__=u)}),S=0;S<p._sb.length;S++)p.__h.push(p._sb[S]);p._sb=[],p.__h.length&&f.push(p);break n}null!=p.componentWillUpdate&&p.componentWillUpdate(w,p.__s,P),null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(d,_,m)})}if(p.context=P,p.props=w,p.__P=n,p.__e=!1,$=l.__r,H=0,"prototype"in A&&A.prototype.render){for(p.state=p.__s,p.__d=!1,$&&$(u),a=p.render(p.props,p.state,p.context),I=0;I<p._sb.length;I++)p.__h.push(p._sb[I]);p._sb=[]}else do{p.__d=!1,$&&$(u),a=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++H<25);p.state=p.__s,null!=p.getChildContext&&(i=v(v({},i),p.getChildContext())),y||null==p.getSnapshotBeforeUpdate||(m=p.getSnapshotBeforeUpdate(d,_)),C(n,h(T=null!=a&&a.type===g&&null==a.key?a.props.children:a)?T:[T],u,t,i,o,r,f,e,c,s),p.base=u.__e,u.__u&=-161,p.__h.length&&f.push(p),k&&(p.__E=p.__=null)}catch(n){u.__v=null,c||null!=r?(u.__e=e,u.__u|=c?160:32,r[r.indexOf(e)]=null):(u.__e=t.__e,u.__k=t.__k),l.__e(n,u,t)}else null==r&&u.__v===t.__v?(u.__k=t.__k,u.__e=t.__e):u.__e=j(t.__e,u,t,i,o,r,f,c,s);(a=l.diffed)&&a(u)}function M(n,u,t){u.__d=void 0;for(var i=0;i<t.length;i++)z(t[i],t[++i],t[++i]);l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u)})}catch(n){l.__e(n,u.__v)}})}function j(l,u,t,i,o,r,f,e,s){var a,v,y,d,_,g,b,k=t.props,w=u.props,x=u.type;if("svg"===x&&(o=!0),null!=r)for(a=0;a<r.length;a++)if((_=r[a])&&"setAttribute"in _==!!x&&(x?_.localName===x:3===_.nodeType)){l=_,r[a]=null;break}if(null==l){if(null===x)return document.createTextNode(w);l=o?document.createElementNS("http://www.w3.org/2000/svg",x):document.createElement(x,w.is&&w),r=null,e=!1}if(null===x)k===w||e&&l.data===w||(l.data=w);else{if(r=r&&n.call(l.childNodes),k=t.props||c,!e&&null!=r)for(k={},a=0;a<l.attributes.length;a++)k[(_=l.attributes[a]).name]=_.value;for(a in k)_=k[a],"children"==a||("dangerouslySetInnerHTML"==a?y=_:"key"===a||a in w||T(l,a,null,_,o));for(a in w)_=w[a],"children"==a?d=_:"dangerouslySetInnerHTML"==a?v=_:"value"==a?g=_:"checked"==a?b=_:"key"===a||e&&"function"!=typeof _||k[a]===_||T(l,a,_,k[a],o);if(v)e||y&&(v.__html===y.__html||v.__html===l.innerHTML)||(l.innerHTML=v.__html),u.__k=[];else if(y&&(l.innerHTML=""),C(l,h(d)?d:[d],u,t,i,o&&"foreignObject"!==x,r,f,r?r[0]:t.__k&&m(t,0),e,s),null!=r)for(a=r.length;a--;)null!=r[a]&&p(r[a]);e||(a="value",void 0!==g&&(g!==l[a]||"progress"===x&&!g||"option"===x&&g!==k[a])&&T(l,a,g,k[a],!1),a="checked",void 0!==b&&b!==l[a]&&T(l,a,b,k[a],!1))}return l}function z(n,u,t){try{"function"==typeof n?n(u):n.current=u}catch(n){l.__e(n,t)}}function N(n,u,t){var i,o;if(l.unmount&&l.unmount(n),(i=n.ref)&&(i.current&&i.current!==n.__e||z(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(n){l.__e(n,u)}i.base=i.__P=null,n.__c=void 0}if(i=n.__k)for(o=0;o<i.length;o++)i[o]&&N(i[o],u,t||"function"!=typeof n.type);t||null==n.__e||p(n.__e),n.__=n.__e=n.__d=void 0}function O(n,l,u){return this.constructor(n,u)}function q(u,t,i){var o,r,f,e;l.__&&l.__(u,t),r=(o="function"==typeof i)?null:i&&i.__k||t.__k,f=[],e=[],L(t,u=(!o&&i||t).__k=y(g,null,[u]),r||c,c,void 0!==t.ownerSVGElement,!o&&i?[i]:r?null:t.firstChild?n.call(t.childNodes):null,f,!o&&i?i:r?r.__e:t.firstChild,o,e),M(f,u,e)}function B(n,l){q(n,l,B)}function E(l,u,t){var i,o,r,f,e=v({},l.props);for(r in l.type&&l.type.defaultProps&&(f=l.type.defaultProps),u)"key"==r?i=u[r]:"ref"==r?o=u[r]:e[r]=void 0===u[r]&&void 0!==f?f[r]:u[r];return arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):t),d(l.type,e,i||l.key,o||l.ref,null)}function F(n,l){var u={__c:l="__cC"+e++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,t;return this.getChildContext||(u=[],(t={})[l]=this,this.getChildContext=function(){return t},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(function(n){n.__e=!0,w(n)})},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n)}}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=s.slice,l={__e:function(n,l,u,t){for(var i,o,r;l=l.__;)if((i=l.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(n)),r=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),r=i.__d),r)return i.__E=i}catch(l){n=l}throw n}},u=0,t=function(n){return null!=n&&null==n.constructor},b.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=v({},this.state),"function"==typeof n&&(n=n(v({},u),this.props)),n&&v(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),w(this))},b.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),w(this))},b.prototype.render=g,i=[],r="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f=function(n,l){return n.__v.__b-l.__v.__b},x.__r=0,e=0;
3799
3661
  //# sourceMappingURL=preact.module.js.map
3800
3662
 
3801
3663
 
@@ -3907,6 +3769,7 @@ var n,l,u,i,t,o,r,f={},e=[],c=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]
3907
3769
  /******/ script.setAttribute("nonce", __webpack_require__.nc);
3908
3770
  /******/ }
3909
3771
  /******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
3772
+ /******/
3910
3773
  /******/ script.src = url;
3911
3774
  /******/ }
3912
3775
  /******/ inProgress[url] = [done];
@@ -3919,7 +3782,7 @@ var n,l,u,i,t,o,r,f={},e=[],c=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]
3919
3782
  /******/ script.parentNode && script.parentNode.removeChild(script);
3920
3783
  /******/ doneFns && doneFns.forEach((fn) => (fn(event)));
3921
3784
  /******/ if(prev) return prev(event);
3922
- /******/ };
3785
+ /******/ }
3923
3786
  /******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
3924
3787
  /******/ script.onerror = onScriptComplete.bind(null, script.onerror);
3925
3788
  /******/ script.onload = onScriptComplete.bind(null, script.onload);
@@ -3988,7 +3851,7 @@ var n,l,u,i,t,o,r,f={},e=[],c=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]
3988
3851
  /******/ }
3989
3852
  /******/ };
3990
3853
  /******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
3991
- /******/ } else installedChunks[chunkId] = 0;
3854
+ /******/ }
3992
3855
  /******/ }
3993
3856
  /******/ }
3994
3857
  /******/ };
@@ -4054,14 +3917,14 @@ var lsdb = (__webpack_require__(6929)/* ["default"] */ .Z);
4054
3917
  });
4055
3918
  ;// CONCATENATED MODULE: ./src/store/api.js
4056
3919
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4057
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
4058
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
3920
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
3921
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4059
3922
 
4060
3923
  const ajax = __webpack_require__(7460);
4061
- ajax.env.XMLHttpRequest = util/* default.XMLHttpRequest */.Z.XMLHttpRequest;
3924
+ ajax.env.XMLHttpRequest = util/* default */.Z.XMLHttpRequest;
4062
3925
  function jsonifyTextPlain(param, done) {
4063
3926
  let req = param.request;
4064
- if (req.content_type === 'text/plain' && req.body !== undefined) req.body = util/* default.stringify */.Z.stringify(req.body);
3927
+ if (req.content_type === 'text/plain' && req.body !== undefined) req.body = util/* default */.Z.stringify(req.body);
4065
3928
  done(true);
4066
3929
  }
4067
3930
  /* harmony default export */ const api = (class {
@@ -4071,14 +3934,12 @@ function jsonifyTextPlain(param, done) {
4071
3934
  _defineProperty(this, "ajax", ajax);
4072
3935
  _defineProperty(this, "start", extraData => {
4073
3936
  let data = {
4074
- starter_id: this.uid,
4075
- starter_type: 'user',
4076
3937
  touchpoint: {
4077
3938
  channel: 'subiz',
4078
3939
  source: 'web'
4079
3940
  }
4080
3941
  };
4081
- util/* default.each */.Z.each(extraData, (v, k) => {
3942
+ util/* default */.Z.each(extraData, (v, k) => {
4082
3943
  data[k] = v;
4083
3944
  });
4084
3945
  return this.apireq.post(`/accounts/${this.accid}/conversations`, data);
@@ -4102,7 +3963,7 @@ function jsonifyTextPlain(param, done) {
4102
3963
  viewing_product_sku: sku,
4103
3964
  viewing_product_source_id: source_id,
4104
3965
  viewing_product_id: productid,
4105
- pinged: util/* default.Date.now */.Z.Date.now(),
3966
+ pinged: util/* default */.Z.Date.now(),
4106
3967
  is_focused: false
4107
3968
  }
4108
3969
  }
@@ -4141,7 +4002,7 @@ function jsonifyTextPlain(param, done) {
4141
4002
  error
4142
4003
  };
4143
4004
  return {
4144
- url: this.FileURL + body.url
4005
+ url: body.url
4145
4006
  };
4146
4007
  });
4147
4008
  _defineProperty(this, "time", _ => ajax.setBaseUrl(this.ApiURL).withCredentials(true).setParser('json').get('/time'));
@@ -4162,7 +4023,7 @@ function jsonifyTextPlain(param, done) {
4162
4023
  _defineProperty(this, "suggest_address", keyword => this.apireq.setQuery({
4163
4024
  keyword: keyword
4164
4025
  }).get(`/accounts/${this.accid}/addresses`));
4165
- this.refreshLock = new util/* default.Mutex */.Z.Mutex();
4026
+ this.refreshLock = new util/* default */.Z.Mutex();
4166
4027
  this.FileURL = FileURL;
4167
4028
  this.ApiURL = ApiURL;
4168
4029
  this.apireq = ajax.setBaseUrl(ApiURL).withCredentials(true).addQuery('v', '6').setContentType('text/plain').beforeHook(jsonifyTextPlain).setParser('json').beforeHook((param, done) => {
@@ -4193,15 +4054,16 @@ function jsonifyTextPlain(param, done) {
4193
4054
  let outuser;
4194
4055
  for (let i = 0; true; i++) {
4195
4056
  outuser = await ajax.setBaseUrl(this.ApiURL).withCredentials(true).addQuery('v', '6').addQuery('x-user-ref', this.ref).setParser('json').get(`/accounts/${this.accid}/users/${this.ref}`);
4196
- if (!util/* default.get */.Z.get(outuser, 'body.id')) {
4197
- let sleeptime = Math.min(2000 + i * 200, 60000);
4198
- await util/* default.sleep */.Z.sleep(sleeptime);
4057
+ if (outuser.error && util/* default */.Z.get(outuser, 'body.code', '').indexOf('locked_account') != -1) break;
4058
+ if (!util/* default */.Z.get(outuser, 'body.id')) {
4059
+ let sleeptime = Math.min(2000 + i * 400, 60000);
4060
+ await util/* default */.Z.sleep(sleeptime);
4199
4061
  continue;
4200
4062
  }
4201
4063
  break;
4202
4064
  }
4203
4065
  if (outuser.error) {
4204
- if (util/* default.get */.Z.get(outuser.body.code)) return {
4066
+ if (util/* default */.Z.get(outuser.body.code)) return {
4205
4067
  error: outuser.body.code
4206
4068
  };
4207
4069
  return outuser;
@@ -4214,7 +4076,7 @@ function jsonifyTextPlain(param, done) {
4214
4076
  this.tokensession = this.tokensession || 0;
4215
4077
  this.tokensession++;
4216
4078
  let tokensession = this.tokensession;
4217
- if (!this.accid || !util/* default.startsWith */.Z.startsWith(this.accid, 'ac')) return {
4079
+ if (!this.accid || !util/* default */.Z.startsWith(this.accid, 'ac')) return {
4218
4080
  error: 'invalid_account_id'
4219
4081
  };
4220
4082
  if (!this.profile_id) return {
@@ -4230,13 +4092,13 @@ function jsonifyTextPlain(param, done) {
4230
4092
  this.refreshLock.unlock();
4231
4093
  return;
4232
4094
  }
4233
- let age = (util/* default.Date.now */.Z.Date.now() - (this.last_token_at || 0)) / 1000;
4095
+ let age = (util/* default */.Z.Date.now() - (this.last_token_at || 0)) / 1000;
4234
4096
  if (!force && this.last_token && age < 1800) {
4235
4097
  this.refreshLock.unlock();
4236
4098
  return this.last_token;
4237
4099
  }
4238
4100
  if (!force && this.last_token && age < 3000) {
4239
- if (this.token_generator) util/* default.setTimeout */.Z.setTimeout(async () => {
4101
+ if (this.token_generator) util/* default */.Z.setTimeout(async () => {
4240
4102
  let token, err;
4241
4103
  try {
4242
4104
  token = await tokenGenerator(profile_id);
@@ -4248,7 +4110,7 @@ function jsonifyTextPlain(param, done) {
4248
4110
  return;
4249
4111
  }
4250
4112
  if (err) this.last_token = 'error';else this.last_token = token;
4251
- this.last_token_at = util/* default.Date.now */.Z.Date.now();
4113
+ this.last_token_at = util/* default */.Z.Date.now();
4252
4114
  this.refreshLock.unlock();
4253
4115
  });
4254
4116
  return this.last_token;
@@ -4265,7 +4127,7 @@ function jsonifyTextPlain(param, done) {
4265
4127
  return;
4266
4128
  }
4267
4129
  if (err) this.last_token = 'error';else this.last_token = token;
4268
- this.last_token_at = util/* default.Date.now */.Z.Date.now();
4130
+ this.last_token_at = util/* default */.Z.Date.now();
4269
4131
  this.refreshLock.unlock();
4270
4132
  return this.last_token;
4271
4133
  };
@@ -4274,15 +4136,15 @@ function jsonifyTextPlain(param, done) {
4274
4136
  await this.token_generator(true);
4275
4137
  if (tokensession != this.tokensession) break;
4276
4138
  outuser = await ajax.setBaseUrl(this.ApiURL).withCredentials(true).addQuery('v', '6').addQuery('x-access-token', this.last_token).setParser('json').get(`/accounts/${this.accid}/users/${profile_id}`);
4277
- if (!util/* default.get */.Z.get(outuser, 'body.id')) {
4139
+ if (!util/* default */.Z.get(outuser, 'body.id')) {
4278
4140
  let sleeptime = Math.min(2000 + i * 100, 120000);
4279
- await util/* default.sleep */.Z.sleep(sleeptime);
4141
+ await util/* default */.Z.sleep(sleeptime);
4280
4142
  continue;
4281
4143
  }
4282
4144
  break;
4283
4145
  }
4284
4146
  if (outuser.error) {
4285
- if (util/* default.get */.Z.get(outuser.body.code)) return {
4147
+ if (util/* default */.Z.get(outuser.body.code)) return {
4286
4148
  error: outuser.body.code
4287
4149
  };
4288
4150
  return outuser;
@@ -4325,15 +4187,15 @@ function jsonifyTextPlain(param, done) {
4325
4187
  });
4326
4188
  ;// CONCATENATED MODULE: ./src/store/api_fake.js
4327
4189
  function api_fake_defineProperty(obj, key, value) { key = api_fake_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4328
- function api_fake_toPropertyKey(arg) { var key = api_fake_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
4329
- function api_fake_toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4190
+ function api_fake_toPropertyKey(t) { var i = api_fake_toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
4191
+ function api_fake_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4330
4192
 
4331
4193
  const api_fake_ajax = __webpack_require__(7460);
4332
4194
  api_fake_ajax.env.XMLHttpRequest = window.XMLHttpRequest;
4333
4195
  const findAnswer = challenge => challenge.answer;
4334
4196
  function api_fake_jsonifyTextPlain(param, done) {
4335
4197
  let req = param.request;
4336
- if (req.content_type === 'text/plain' && req.body !== undefined) req.body = util/* default.stringify */.Z.stringify(req.body);
4198
+ if (req.content_type === 'text/plain' && req.body !== undefined) req.body = util/* default */.Z.stringify(req.body);
4337
4199
  done(true);
4338
4200
  }
4339
4201
  const OK200 = Promise.resolve({
@@ -4379,7 +4241,7 @@ const OK200 = Promise.resolve({
4379
4241
  api_fake_defineProperty(this, "getChallenge", accid => OK200);
4380
4242
  api_fake_defineProperty(this, "time", _ => Promise.resolve({
4381
4243
  code: 200,
4382
- body: new util/* default.Date */.Z.Date().toISOString()
4244
+ body: new util/* default */.Z.Date().toISOString()
4383
4245
  }));
4384
4246
  api_fake_defineProperty(this, "updateUser", data => OK200);
4385
4247
  api_fake_defineProperty(this, "getUser", _ => Promise.resolve({
@@ -4738,21 +4600,21 @@ function makeFakeMessages(accid, convoid, userid, agentid) {
4738
4600
  });
4739
4601
  ;// CONCATENATED MODULE: ./src/store/store.js
4740
4602
  function store_defineProperty(obj, key, value) { key = store_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4741
- function store_toPropertyKey(arg) { var key = store_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
4742
- function store_toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4603
+ function store_toPropertyKey(t) { var i = store_toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
4604
+ function store_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4743
4605
 
4744
4606
  var flow = __webpack_require__(3165);
4745
4607
 
4746
4608
 
4747
4609
 
4748
4610
 
4749
- var Realtime = __webpack_require__(8454);
4611
+ var Realtime = __webpack_require__(608);
4750
4612
  var cookie = __webpack_require__(9554);
4751
4613
  cookie.defaults.path = '/';
4752
4614
  cookie.expiresMultiplier = 60 * 60 * 24;
4753
4615
  cookie.defaults.expires = 3650;
4754
4616
  const MAX_CONVO = 20;
4755
- const page_loaded = util/* default.Date.now */.Z.Date.now();
4617
+ const page_loaded = util/* default */.Z.Date.now();
4756
4618
  class Store {
4757
4619
  constructor(ApiURL, FileURL, RealtimeURL, inmem, fakeapi) {
4758
4620
  store_defineProperty(this, "inmem", false);
@@ -4770,14 +4632,14 @@ class Store {
4770
4632
  let user = this.matchUser();
4771
4633
  let allconvos = this.matchConvo('*');
4772
4634
  let unreadcount = 0;
4773
- util/* default.map */.Z.map(allconvos, convo => {
4774
- if (!util/* default.isConvoSeen */.Z.isConvoSeen(convo, user.id)) unreadcount++;
4635
+ util/* default */.Z.map(allconvos, convo => {
4636
+ if (!util/* default */.Z.isConvoSeen(convo, user.id)) unreadcount++;
4775
4637
  });
4776
4638
  return unreadcount;
4777
4639
  });
4778
4640
  store_defineProperty(this, "matchPlugin", () => {
4779
- if (util/* default.size */.Z.size(this.forcePlugins) > 0) return util/* default.cloneDeep */.Z.cloneDeep(this.forcePlugins);
4780
- return util/* default.cloneDeep */.Z.cloneDeep(this.cache.match('plugin')) || {};
4641
+ if (util/* default */.Z.size(this.forcePlugins) > 0) return util/* default */.Z.cloneDeep(this.forcePlugins);
4642
+ return util/* default */.Z.cloneDeep(this.cache.match('plugin')) || {};
4781
4643
  });
4782
4644
  store_defineProperty(this, "device", {});
4783
4645
  store_defineProperty(this, "browserVisibility", 'visible');
@@ -4790,12 +4652,13 @@ class Store {
4790
4652
  if (!id) return;
4791
4653
  if (id === '*') {
4792
4654
  this._touchAcc();
4793
- return util/* default.filter */.Z.filter(this.cache.all(), (value, k) => k.startsWith('convo_'));
4655
+ return util/* default */.Z.filter(this.cache.all(), (value, k) => k.startsWith('convo_'));
4794
4656
  }
4795
4657
  if (!this.isInsync(id)) this.fetchConvo(id);
4796
4658
  return this.cache.match('convo_' + id);
4797
4659
  });
4798
4660
  store_defineProperty(this, "fetchConvo", async cid => {
4661
+ if (this._die) return dieErr;
4799
4662
  await this.readyGate.entry();
4800
4663
  await this.reconnectGate.entry(undefined, true);
4801
4664
  if (this.isInsync(cid)) return this.reconnectGate.open();
@@ -4813,7 +4676,7 @@ class Store {
4813
4676
  store_defineProperty(this, "listEvents", id => {
4814
4677
  if (!id || id === '*' || typeof id !== 'string') return;
4815
4678
  if (!this.isInsync('events' + id)) {
4816
- util/* default.setTimeout */.Z.setTimeout(async () => {
4679
+ util/* default */.Z.setTimeout(async () => {
4817
4680
  await this.readyGate.entry();
4818
4681
  await this.reconnectGate.entry(undefined, true);
4819
4682
  if (this.isInsync('events' + id)) return this.reconnectGate.open();
@@ -4836,10 +4699,10 @@ class Store {
4836
4699
  });
4837
4700
  store_defineProperty(this, "matchLocation", () => this.cache.match('location') || {});
4838
4701
  store_defineProperty(this, "matchBot", () => this.cache.match('bot') || {});
4839
- store_defineProperty(this, "readyGate", new util/* default.Gate */.Z.Gate());
4840
- store_defineProperty(this, "convoGate", new util/* default.Gate */.Z.Gate(true));
4841
- store_defineProperty(this, "reconnectGate", new util/* default.Gate */.Z.Gate(true));
4842
- store_defineProperty(this, "wsGate", new util/* default.Gate */.Z.Gate(true));
4702
+ store_defineProperty(this, "readyGate", new util/* default */.Z.Gate());
4703
+ store_defineProperty(this, "convoGate", new util/* default */.Z.Gate(true));
4704
+ store_defineProperty(this, "reconnectGate", new util/* default */.Z.Gate(true));
4705
+ store_defineProperty(this, "wsGate", new util/* default */.Z.Gate(true));
4843
4706
  store_defineProperty(this, "matchLastview", () => {
4844
4707
  let lastView = this.kv.match('lastview') || {};
4845
4708
  let user = this.cache.match('user') || {};
@@ -4850,23 +4713,26 @@ class Store {
4850
4713
  store_defineProperty(this, "matchIsOpen", () => !!this.kv.match('isopen'));
4851
4714
  store_defineProperty(this, "matchHasManuallyClosed", () => !!this.kv.match('hasManuallyClosed'));
4852
4715
  store_defineProperty(this, "matchClosePreviewAt", () => this.kv.match('close_preview_at') || 0);
4853
- store_defineProperty(this, "sendPresence", util/* default.throttle */.Z.throttle(async () => {
4716
+ store_defineProperty(this, "sendPresence", util/* default */.Z.throttle(async () => {
4717
+ if (this._die) return dieErr;
4854
4718
  await this.readyGate.entry();
4855
- if (!util/* default.get */.Z.get(this.cache.match('user'), 'id')) return;
4856
- if (util/* default.isUserBanned */.Z.isUserBanned(this.cache.match('user'))) return;
4719
+ if (!util/* default */.Z.get(this.cache.match('user'), 'id')) return;
4720
+ if (util/* default */.Z.isUserBanned(this.cache.match('user'))) return;
4857
4721
  let hasfocus = this.browserVisibility === 'visible' && document.hasFocus();
4858
4722
  if (!hasfocus) {
4859
4723
  this.api.sendLostFocus(this.device, this._currentViewingProduct.id, this._currentViewingProduct.source_id, this._currentViewingProduct.sku);
4860
4724
  return;
4861
4725
  }
4862
- this.api.sendContentView(this.device, location.href, document.title, this._currentViewingProduct.id, this._currentViewingProduct.source_id, this._currentViewingProduct.sku);
4726
+ if (this._track_page_view) {
4727
+ this.api.sendContentView(this.device, location.href, document.title, this._currentViewingProduct.id, this._currentViewingProduct.source_id, this._currentViewingProduct.sku);
4728
+ }
4863
4729
  }, 1000, {
4864
4730
  leading: false
4865
4731
  }));
4866
- store_defineProperty(this, "now", () => util/* default.Date.now */.Z.Date.now() + this.timeDiff);
4732
+ store_defineProperty(this, "now", () => util/* default */.Z.Date.now() + this.timeDiff);
4867
4733
  store_defineProperty(this, "seenQueue", []);
4868
4734
  store_defineProperty(this, "matchTrafficSource", () => this.kv.match('traffic_source'));
4869
- store_defineProperty(this, "_typing", util/* default.throttle */.Z.throttle(convoid => this.api.sendTyping(convoid), 3000, {
4735
+ store_defineProperty(this, "_typing", util/* default */.Z.throttle(convoid => this.api.sendTyping(convoid), 3000, {
4870
4736
  trailing: false
4871
4737
  }));
4872
4738
  store_defineProperty(this, "onConvoEvent", (o, cb) => this.pubsub.on2(o, 'events', cb));
@@ -4885,7 +4751,7 @@ class Store {
4885
4751
  sendEventToThirdParty('SUBIZ Chat', 'Opened', 'Subiz Windows');
4886
4752
  }
4887
4753
  });
4888
- store_defineProperty(this, "closePreview", () => this.kv.put('close_preview_at', new util/* default.Date */.Z.Date().getTime()));
4754
+ store_defineProperty(this, "closePreview", () => this.kv.put('close_preview_at', new util/* default */.Z.Date().getTime()));
4889
4755
  store_defineProperty(this, "setLastview", (view, opts) => {
4890
4756
  let user = this.cache.match('user') || {};
4891
4757
  if (!user.id) return;
@@ -4897,6 +4763,7 @@ class Store {
4897
4763
  });
4898
4764
  store_defineProperty(this, "timeDiff", 0);
4899
4765
  this.g_sync = {};
4766
+ this._die = false;
4900
4767
  this.forceDevice = null;
4901
4768
  this.forcePlugins = {};
4902
4769
  this.forceAcc = {};
@@ -4904,6 +4771,7 @@ class Store {
4904
4771
  this.RealtimeURL = RealtimeURL;
4905
4772
  this.fake = fakeapi;
4906
4773
  this.FileURL = FileURL;
4774
+ this._track_page_view = true;
4907
4775
  if (this.fake) this.api = new api_fake(ApiURL, FileURL);else this.api = new api(ApiURL, FileURL);
4908
4776
  if (!inmem) {
4909
4777
  try {
@@ -4918,31 +4786,38 @@ class Store {
4918
4786
  this.cookie = inmemCookie;
4919
4787
  }
4920
4788
  cleanLocalStorage();
4921
- this.pubsub = new util/* default.Pubsub */.Z.Pubsub();
4789
+ this.pubsub = new util/* default */.Z.Pubsub();
4922
4790
  this.kv = new storage.kv(new storage.lsdb('sbz2023', this.inmem), 'kv');
4923
4791
  this.cache = new storage.kv(new storage.lsdb('sbz2023', true), 'kv');
4924
4792
  this.chain = new storage.chain(new storage.lsdb('cbz2023', true), 'ch');
4925
4793
  this.getLocaleContent = this.api.getLocaleContent;
4926
4794
  this.g_haveSentSeenM = {};
4927
- window.addEventListener('blur', () => this.sendPresence());
4928
- window.addEventListener('focus', () => this.sendPresence());
4929
- util/* default.setInterval */.Z.setInterval(() => this.browserVisibility === 'visible' && document.hasFocus() && this.sendPresence(), 20000);
4930
- util/* default.setInterval */.Z.setInterval(() => (this.browserVisibility !== 'visible' || document.hasFocus()) && this.sendPresence(), 60000);
4795
+ window.addEventListener('blur', this.sendPresence);
4796
+ window.addEventListener('focus', this.sendPresence);
4797
+ this._presenceInterval1 = util/* default */.Z.setInterval(() => {
4798
+ if (this._die) return util/* default */.Z.clearInterval(this._presenceInterval1);
4799
+ if (this.browserVisibility === 'visible' && document.hasFocus()) this.sendPresence();
4800
+ }, 20000);
4801
+ this._presenceInterval2 = util/* default */.Z.setInterval(() => {
4802
+ if (this._die) return util/* default */.Z.clearInterval(this._presenceInterval2);
4803
+ if (this.browserVisibility !== 'visible' || document.hasFocus()) this.sendPresence();
4804
+ }, 60000);
4931
4805
  onVisibilityChange(val => {
4806
+ if (this._die) return;
4932
4807
  this.browserVisibility = val;
4933
4808
  this.sendPresence();
4934
4809
  });
4935
4810
  this.loopTime();
4936
4811
  this.device = this.getDeviceInfo();
4937
- const _gaInterval = util/* default.setInterval */.Z.setInterval(() => {
4812
+ const _gaInterval = util/* default */.Z.setInterval(() => {
4938
4813
  let user = this.cache.match('user') || {};
4939
4814
  if (!user.id) return;
4940
4815
  var dev = this.getDeviceInfo();
4941
4816
  if (!dev.ga_tracking_ids || !dev.ga_client_id) return;
4942
- util/* default.clearInterval */.Z.clearInterval(_gaInterval);
4817
+ util/* default */.Z.clearInterval(_gaInterval);
4943
4818
  this.device = dev;
4944
4819
  let ga_client_id = dev.ga_client_id;
4945
- if (ga_client_id !== util/* default.getUserAttr */.Z.getUserAttr(user, 'ga_client_id', 'text')) {
4820
+ if (ga_client_id !== util/* default */.Z.getUserAttr(user, 'ga_client_id', 'text')) {
4946
4821
  this.setUser({
4947
4822
  attributes: [{
4948
4823
  type: 'text',
@@ -4962,11 +4837,17 @@ class Store {
4962
4837
  if (p.source_id) this._currentViewingProduct.source_id = (p.source_id + '').trim();
4963
4838
  if (p.sku) this._currentViewingProduct.sku = (p.sku + '').trim();
4964
4839
  }
4840
+ getTrackPageview() {
4841
+ return this._track_page_view;
4842
+ }
4843
+ setTrackPageview(val) {
4844
+ this._track_page_view = !!val;
4845
+ }
4965
4846
  getLinkedProduct() {
4966
- return util/* default.cloneDeep */.Z.cloneDeep(this._currentViewingProduct);
4847
+ return util/* default */.Z.cloneDeep(this._currentViewingProduct);
4967
4848
  }
4968
4849
  isInsync(key) {
4969
- return util/* default.Date.now */.Z.Date.now() - (this.g_sync[key] || 0) < 600000;
4850
+ return util/* default */.Z.Date.now() - (this.g_sync[key] || 0) < 600000;
4970
4851
  }
4971
4852
  async fetchShippingAddresses() {
4972
4853
  let out = await this.api.fetchShippingAddresses();
@@ -4983,7 +4864,7 @@ class Store {
4983
4864
  return this.api.createShippingAddress(addr);
4984
4865
  }
4985
4866
  async overrideAcc(acc) {
4986
- this.forceAcc = util/* default.cloneDeep */.Z.cloneDeep(acc);
4867
+ this.forceAcc = util/* default */.Z.cloneDeep(acc);
4987
4868
  await this.readyGate.entry();
4988
4869
  this.disconnect('account');
4989
4870
  this.reconnect();
@@ -4993,7 +4874,7 @@ class Store {
4993
4874
  await this.readyGate.entry();
4994
4875
  this.disconnect('account');
4995
4876
  await this.reconnect();
4996
- util/* default.setTimeout */.Z.setTimeout(this.pubsub.publish('resetCSS'), 10);
4877
+ util/* default */.Z.setTimeout(this.pubsub.publish('resetCSS'), 10);
4997
4878
  }
4998
4879
  getDeviceInfo() {
4999
4880
  let device = {
@@ -5036,9 +4917,10 @@ class Store {
5036
4917
  return page_loaded;
5037
4918
  }
5038
4919
  overridePlugin(plugins) {
4920
+ if (this._die) return dieErr;
5039
4921
  if (!Array.isArray(plugins)) throw 'plugins must be be an array';
5040
4922
  let pluginM = {};
5041
- util/* default.map */.Z.map(plugins, function (plugin) {
4923
+ util/* default */.Z.map(plugins, function (plugin) {
5042
4924
  pluginM[plugin.id] = plugin;
5043
4925
  });
5044
4926
  this.forcePlugins = pluginM;
@@ -5046,7 +4928,7 @@ class Store {
5046
4928
  this.pubsub.publish('resetCSS');
5047
4929
  }
5048
4930
  markSync(key) {
5049
- this.g_sync[key] = util/* default.Date.now */.Z.Date.now();
4931
+ this.g_sync[key] = util/* default */.Z.Date.now();
5050
4932
  }
5051
4933
  async _touchAcc() {
5052
4934
  if (this.isInsync('account')) return;
@@ -5070,20 +4952,18 @@ class Store {
5070
4952
  if (mask) {
5071
4953
  let parts = mask.split('@');
5072
4954
  if (parts[0] != accid) {
5073
- userRef = util/* default.randomString */.Z.randomString(40);
4955
+ userRef = util/* default */.Z.randomString(40);
5074
4956
  this.new_visitor = true;
5075
4957
  }
5076
4958
  this.new_visitor = false;
5077
4959
  this.cookie.set('__sbmask', mask);
5078
4960
  } else {
5079
- userRef = util/* default.randomString */.Z.randomString(40);
4961
+ userRef = util/* default */.Z.randomString(40);
5080
4962
  this.new_visitor = true;
5081
4963
  }
5082
4964
  }
5083
4965
  }
5084
- if (this.cookie.get('__sbref', userRef) != userRef) {
5085
- cleanMyLocalStorage();
5086
- }
4966
+ if (this.cookie.get('__sbref', userRef) != userRef) cleanMyLocalStorage();
5087
4967
  this.api.setAuth({
5088
4968
  accid: accid
5089
4969
  });
@@ -5093,7 +4973,7 @@ class Store {
5093
4973
  mask: mask,
5094
4974
  ref: userRef
5095
4975
  });
5096
- if (user.error) return;
4976
+ if (user.error) return console.error(user);
5097
4977
  if (this.realtime) this.realtime.stop();
5098
4978
  if (this.fake) this.realtime = new realtime_fake();else this.realtime = new Realtime(this.RealtimeURL, {
5099
4979
  account_id: accid,
@@ -5109,6 +4989,7 @@ class Store {
5109
4989
  return user;
5110
4990
  }
5111
4991
  async login(accid, user_id, tokenGenerator) {
4992
+ if (this._die) return dieErr;
5112
4993
  let user = await this.api.setAuth({
5113
4994
  accid: accid,
5114
4995
  profile_id: user_id,
@@ -5139,22 +5020,23 @@ class Store {
5139
5020
  }
5140
5021
  seenLoop() {
5141
5022
  this.seenQueue = [];
5142
- util/* default.clearInterval */.Z.clearInterval(this._seenInterval);
5143
- this._seenInterval = util/* default.setInterval */.Z.setInterval(() => {
5023
+ util/* default */.Z.clearInterval(this._seenInterval);
5024
+ this._seenInterval = util/* default */.Z.setInterval(() => {
5025
+ if (this._die) return util/* default */.Z.clearInterval(this._seenInterval);
5144
5026
  this.seenQueue = [...new Set(this.seenQueue)];
5145
5027
  let user = this.cache.match('user') || {};
5146
- util/* default.map */.Z.map(this.seenQueue, id => {
5028
+ util/* default */.Z.map(this.seenQueue, id => {
5147
5029
  var events = this.listEvents(id);
5148
5030
  if (!events) return;
5149
- if (util/* default.size */.Z.size(events) === 0) return;
5150
- events = util/* default.filter */.Z.filter(events, ev => ev.type === 'message_sent');
5151
- var lastmsgsent = events[util/* default.size */.Z.size(events) - 1];
5031
+ if (util/* default */.Z.size(events) === 0) return;
5032
+ events = util/* default */.Z.filter(events, ev => ev.type === 'message_sent');
5033
+ var lastmsgsent = events[util/* default */.Z.size(events) - 1];
5152
5034
  if (!lastmsgsent) return;
5153
5035
  if (this.g_haveSentSeenM[lastmsgsent.id]) return;
5154
- if (lastmsgsent.id === util/* default.getMsgField */.Z.getMsgField(lastmsgsent, 'idempotency')) return;
5036
+ if (lastmsgsent.id === util/* default */.Z.getMsgField(lastmsgsent, 'idempotency')) return;
5155
5037
  this.api.markAsSeen(id, lastmsgsent.id);
5156
5038
  let convo = this.cache.match('convo_' + id) || {};
5157
- let mem = util/* default.find */.Z.find(convo.members, m => m.id === user.id);
5039
+ let mem = util/* default */.Z.find(convo.members, m => m.id === user.id);
5158
5040
  if (mem) mem.seen_at = Date.now();
5159
5041
  this._setConvo(convo);
5160
5042
  this.g_haveSentSeenM[lastmsgsent.id] = true;
@@ -5174,7 +5056,7 @@ class Store {
5174
5056
  if (this.isInsync('account')) return this.reconnectGate.open();
5175
5057
  this.markSync('account');
5176
5058
  let outs = await Promise.all([this.api.getUser(), this.api.getAccountSetting(), this.api.getIsOnline()]);
5177
- let error = util/* default.find */.Z.find(outs, out => out.error);
5059
+ let error = util/* default */.Z.find(outs, out => out.error);
5178
5060
  if (error) return console.error(error);
5179
5061
  let set = Object.assign(outs[1].body, outs[2].body);
5180
5062
  set.user = outs[0].body;
@@ -5183,13 +5065,13 @@ class Store {
5183
5065
  error = convob.error;
5184
5066
  let body = convob.body;
5185
5067
  if (!error) {
5186
- let convos = util/* default.get */.Z.get(body, 'conversations', []);
5187
- util/* default.map */.Z.map(this.cache.all(), (value, k) => {
5068
+ let convos = util/* default */.Z.get(body, 'conversations', []);
5069
+ util/* default */.Z.map(this.cache.all(), (value, k) => {
5188
5070
  if (k.startsWith('convo_')) {
5189
- if (this.now() - util/* default.getMs */.Z.getMs(util/* default.get */.Z.get(value, 'actived')) > 1209600000) this.cache.del(k);
5071
+ if (this.now() - util/* default */.Z.getMs(util/* default */.Z.get(value, 'actived')) > 1209600000) this.cache.del(k);
5190
5072
  }
5191
5073
  });
5192
- util/* default.map */.Z.map(convos, convo => this._setConvo(convo));
5074
+ util/* default */.Z.map(convos, convo => this._setConvo(convo));
5193
5075
  }
5194
5076
  return this.reconnectGate.open();
5195
5077
  }
@@ -5208,13 +5090,13 @@ class Store {
5208
5090
  }
5209
5091
  }
5210
5092
  _setUser(user) {
5211
- user = util/* default.cloneDeep */.Z.cloneDeep(user);
5093
+ user = util/* default */.Z.cloneDeep(user);
5212
5094
  let olduser = this.cache.match('user') || {};
5213
5095
  var accid = olduser.account_id || user.account_id;
5214
5096
  var id = olduser.id || user.id;
5215
- util/* default.each */.Z.each(user.attributes, newattr => {
5097
+ util/* default */.Z.each(user.attributes, newattr => {
5216
5098
  if (!newattr) return;
5217
- olduser.attributes = util/* default.filter */.Z.filter(olduser.attributes, oldattr => {
5099
+ olduser.attributes = util/* default */.Z.filter(olduser.attributes, oldattr => {
5218
5100
  if (!oldattr) return false;
5219
5101
  return oldattr.key !== newattr.key;
5220
5102
  });
@@ -5232,7 +5114,7 @@ class Store {
5232
5114
  return this._setSetting(setting);
5233
5115
  }
5234
5116
  async _setSetting(setting) {
5235
- setting = util/* default.cloneDeep */.Z.cloneDeep(setting) || {};
5117
+ setting = util/* default */.Z.cloneDeep(setting) || {};
5236
5118
  setting.account = Object.assign({}, setting.account, this.forceAcc);
5237
5119
  if (!setting.account.logo_url) {
5238
5120
  setting.account.logo_url = 'https://file-subiz.com/fiqpezhkmeyesdscyetk-default_logo.jpg';
@@ -5248,39 +5130,39 @@ class Store {
5248
5130
  this.cache.put('account', setting.account);
5249
5131
  delete setting.account;
5250
5132
  }
5251
- let location = util/* default.get */.Z.get(setting, 'location', []);
5133
+ let location = util/* default */.Z.get(setting, 'location', []);
5252
5134
  this.cache.put('location', location);
5253
- let bots = util/* default.get */.Z.get(setting, 'bots', []);
5135
+ let bots = util/* default */.Z.get(setting, 'bots', []);
5254
5136
  let botM = {};
5255
- util/* default.map */.Z.map(bots, bot => {
5137
+ util/* default */.Z.map(bots, bot => {
5256
5138
  botM[bot.id] = bot;
5257
5139
  });
5258
5140
  this.cache.put('bot', botM);
5259
- let plugins = util/* default.get */.Z.get(setting, 'plugins', []);
5141
+ let plugins = util/* default */.Z.get(setting, 'plugins', []);
5260
5142
  let pluginM = {};
5261
- util/* default.map */.Z.map(plugins, plugin => {
5143
+ util/* default */.Z.map(plugins, plugin => {
5262
5144
  if (plugin.type === 'chatbox') {
5263
- plugin = util/* default.merge */.Z.merge(plugin, this.forceChatbox);
5145
+ plugin = util/* default */.Z.merge(plugin, this.forceChatbox);
5264
5146
  }
5265
5147
  pluginM[plugin.id] = plugin;
5266
5148
  });
5267
5149
  this.cache.put('plugin', pluginM);
5268
- var agents = util/* default.get */.Z.get(setting, 'agents', []);
5269
- if (util/* default.size */.Z.size(agents) > 0) {
5150
+ var agents = util/* default */.Z.get(setting, 'agents', []);
5151
+ if (util/* default */.Z.size(agents) > 0) {
5270
5152
  let agentM = {};
5271
5153
  this.api.setAgentId(agents[0].id);
5272
- util/* default.map */.Z.map(agents, agent => {
5154
+ util/* default */.Z.map(agents, agent => {
5273
5155
  agentM[agent.id] = agent;
5274
5156
  });
5275
5157
  this.cache.put('agent', agentM);
5276
5158
  }
5277
- let pms = util/* default.get */.Z.get(setting, 'payment_methods', []);
5159
+ let pms = util/* default */.Z.get(setting, 'payment_methods', []);
5278
5160
  this.cache.put('payment_methods', pms);
5279
5161
  this.pubsub.publish('account');
5280
5162
  }
5281
5163
  async track() {
5282
5164
  let out = await this.api.sendContentView(this.device, location.href, document.title, this._currentViewingProduct.id, this._currentViewingProduct.source_id, this._currentViewingProduct.sku);
5283
- let traffic_source = util/* default.get */.Z.get(out, 'body.by.device.source', '');
5165
+ let traffic_source = util/* default */.Z.get(out, 'body.by.device.source', '');
5284
5166
  if (traffic_source) this.kv.put('traffic_source', traffic_source);
5285
5167
  }
5286
5168
  async onWs(ev) {
@@ -5290,17 +5172,18 @@ class Store {
5290
5172
  this.wsGate.open();
5291
5173
  }
5292
5174
  async _onWs(ev) {
5175
+ if (this._die) return;
5293
5176
  if (!ev || !ev.type) return;
5294
- ev.created = util/* default.getMs */.Z.getMs(ev.created);
5177
+ ev.created = util/* default */.Z.getMs(ev.created);
5295
5178
  if (ev.type === 'user_info_updated') {
5296
- let user = util/* default.cloneDeep */.Z.cloneDeep(this.cache.match('user'));
5297
- let attrs = util/* default.get */.Z.get(ev, 'data.user.attributes') || [];
5298
- util/* default.map */.Z.map(attrs, attr => util/* default.setUserAttr */.Z.setUserAttr(user, attr));
5179
+ let user = util/* default */.Z.cloneDeep(this.cache.match('user'));
5180
+ let attrs = util/* default */.Z.get(ev, 'data.user.attributes') || [];
5181
+ util/* default */.Z.map(attrs, attr => util/* default */.Z.setUserAttr(user, attr));
5299
5182
  this._setUser(user);
5300
5183
  return;
5301
5184
  }
5302
5185
  let user = this.cache.match('user') || {};
5303
- let cid = util/* default.convoOfEv */.Z.convoOfEv(ev);
5186
+ let cid = util/* default */.Z.convoOfEv(ev);
5304
5187
  let convo;
5305
5188
  let alreadyFetched = false;
5306
5189
  if (cid) {
@@ -5317,12 +5200,12 @@ class Store {
5317
5200
  }
5318
5201
  }
5319
5202
  if (!convo) return;
5320
- let channel = util/* default.get */.Z.get(ev, 'touchpoint.channel', '');
5203
+ let channel = util/* default */.Z.get(ev, 'touchpoint.channel', '');
5321
5204
  if (channel && channel != 'subiz') return;
5322
5205
  this.pubsub.publish('events', ev);
5323
5206
  if (ev.type === 'conversation_joined') {
5324
- let members = util/* default.get */.Z.get(ev, 'data.conversation.members', []);
5325
- let me = util/* default.find */.Z.find(members, m => m.id === this.cache.match('user').id);
5207
+ let members = util/* default */.Z.get(ev, 'data.conversation.members', []);
5208
+ let me = util/* default */.Z.find(members, m => m.id === this.cache.match('user').id);
5326
5209
  if (me) {
5327
5210
  await this.chain.reload(cid, (type, anchor, limit) => this.listmessageapi(type, anchor, limit));
5328
5211
  this.markSync('events' + cid);
@@ -5339,13 +5222,13 @@ class Store {
5339
5222
  }
5340
5223
  }
5341
5224
  if (ev.type === 'message_sent') {
5342
- if (util/* default.get */.Z.get(ev, 'by.id') !== user.id) {
5225
+ if (util/* default */.Z.get(ev, 'by.id') !== user.id) {
5343
5226
  this.api.markAsReceived(cid, ev.id);
5344
5227
  }
5345
5228
  }
5346
- if (util/* default.startsWith */.Z.startsWith(ev.type, 'message_') || util/* default.startsWith */.Z.startsWith(ev.type, 'conversation_')) {
5229
+ if (util/* default */.Z.startsWith(ev.type, 'message_') || util/* default */.Z.startsWith(ev.type, 'conversation_')) {
5347
5230
  this.restConvoEvent(ev);
5348
- if (ev.type === 'message_sent' && util/* default.get */.Z.get(ev, 'by.id') !== user.id) {
5231
+ if (ev.type === 'message_sent' && util/* default */.Z.get(ev, 'by.id') !== user.id) {
5349
5232
  sendEventToThirdParty('SUBIZ Chat', 'Received', 'User');
5350
5233
  }
5351
5234
  return;
@@ -5353,36 +5236,36 @@ class Store {
5353
5236
  }
5354
5237
  async restConvoEvent(ev) {
5355
5238
  let user = this.cache.match('user');
5356
- let cid = util/* default.convoOfEv */.Z.convoOfEv(ev);
5239
+ let cid = util/* default */.Z.convoOfEv(ev);
5357
5240
  let convo = this.cache.match('convo_' + cid) || {};
5358
5241
  if (ev.type === 'conversation_state_updated') {
5359
- if (!util/* default.get */.Z.get(convo, 'id')) {
5242
+ if (!util/* default */.Z.get(convo, 'id')) {
5360
5243
  let {
5361
5244
  body: convo,
5362
5245
  error
5363
5246
  } = await this.api.getConversation(cid);
5364
5247
  if (error) return;
5365
5248
  }
5366
- convo = Object.assign(convo, util/* default.get */.Z.get(ev, 'data.conversation'));
5249
+ convo = Object.assign(convo, util/* default */.Z.get(ev, 'data.conversation'));
5367
5250
  }
5368
5251
  if (ev.type === 'message_pong') {
5369
- var msgid = util/* default.get */.Z.get(ev, 'data.message.id');
5252
+ var msgid = util/* default */.Z.get(ev, 'data.message.id');
5370
5253
  var oldev = this.chain.match(cid, msgid);
5371
- if (!util/* default.get */.Z.get(oldev, 'data.message')) return;
5372
- var pongs = util/* default.get */.Z.get(oldev, 'data.message.pongs', []);
5373
- pongs = pongs.concat(util/* default.get */.Z.get(ev, 'data.message.pongs', []));
5254
+ if (!util/* default */.Z.get(oldev, 'data.message')) return;
5255
+ var pongs = util/* default */.Z.get(oldev, 'data.message.pongs', []);
5256
+ pongs = pongs.concat(util/* default */.Z.get(ev, 'data.message.pongs', []));
5374
5257
  oldev.data.message.pongs = pongs;
5375
- util/* default.map */.Z.map(pongs, pong => {
5258
+ util/* default */.Z.map(pongs, pong => {
5376
5259
  if (pong.member_id == user.id && pong.type === 'seen') {
5377
- let mem = util/* default.find */.Z.find(convo.members, mem => mem.id === user.id);
5260
+ let mem = util/* default */.Z.find(convo.members, mem => mem.id === user.id);
5378
5261
  if (mem) mem.seen_at = pong.created;
5379
5262
  }
5380
5263
  });
5381
- this.chain.put(cid, oldev.id, util/* default.getMs */.Z.getMs(oldev.created), oldev);
5264
+ this.chain.put(cid, oldev.id, util/* default */.Z.getMs(oldev.created), oldev);
5382
5265
  }
5383
5266
  if (ev.type === 'message_sent') {
5384
- let idemkey = util/* default.getMsgField */.Z.getMsgField(ev, 'idempotency');
5385
- let found = util/* default.find */.Z.find(this.listEvents(cid), oldev => oldev.id === idemkey);
5267
+ let idemkey = util/* default */.Z.getMsgField(ev, 'idempotency');
5268
+ let found = util/* default */.Z.find(this.listEvents(cid), oldev => oldev.id === idemkey);
5386
5269
  if (found) {
5387
5270
  this.chain.del(cid, found.id);
5388
5271
  ev.created = found.created;
@@ -5390,7 +5273,7 @@ class Store {
5390
5273
  convo.last_message_sent = ev;
5391
5274
  }
5392
5275
  if (ev.type !== 'message_pong' && ev.type !== 'conversation_typing') {
5393
- this.chain.put(cid, ev.id, util/* default.getMs */.Z.getMs(ev.created), ev);
5276
+ this.chain.put(cid, ev.id, util/* default */.Z.getMs(ev.created), ev);
5394
5277
  }
5395
5278
  this._setConvo(convo);
5396
5279
  this.pubsub.publish('account');
@@ -5398,31 +5281,31 @@ class Store {
5398
5281
  handleFormSubmit(convoKey, ev) {
5399
5282
  if (ev.type !== 'message_sent') return;
5400
5283
  let formSubmits = [];
5401
- let attachments = util/* default.get */.Z.get(ev, 'data.message.attachments') || [];
5402
- util/* default.each */.Z.each(attachments, att => {
5284
+ let attachments = util/* default */.Z.get(ev, 'data.message.attachments') || [];
5285
+ util/* default */.Z.each(attachments, att => {
5403
5286
  if (!att) return;
5404
5287
  if (att.type !== 'form_submit') return;
5405
5288
  formSubmits.push(att.form_submit);
5406
5289
  });
5407
- util/* default.each */.Z.each(formSubmits, submit => {
5408
- let formev = util/* default.get */.Z.get(this.convoEventM, convoKey + '.' + submit.form_message_id);
5290
+ util/* default */.Z.each(formSubmits, submit => {
5291
+ let formev = util/* default */.Z.get(this.convoEventM, convoKey + '.' + submit.form_message_id);
5409
5292
  if (!formev) return;
5410
- let forms = util/* default.filter */.Z.filter(util/* default.get */.Z.get(formev, 'data.message.attachments'), att => {
5293
+ let forms = util/* default */.Z.filter(util/* default */.Z.get(formev, 'data.message.attachments'), att => {
5411
5294
  if (!att) return false;
5412
5295
  if (att.type !== 'form' && att.type !== 'ask_info_form') return false;
5413
5296
  return true;
5414
5297
  });
5415
- util/* default.each */.Z.each(forms, form => {
5298
+ util/* default */.Z.each(forms, form => {
5416
5299
  form = form.form;
5417
- util/* default.each */.Z.each(form.fields, formfield => {
5418
- util/* default.each */.Z.each(submit.fields, submitfield => {
5300
+ util/* default */.Z.each(form.fields, formfield => {
5301
+ util/* default */.Z.each(submit.fields, submitfield => {
5419
5302
  if (formfield.name !== submitfield.name) return;
5420
5303
  if (formfield.default_answer) return;
5421
5304
  formfield.default_answer = submitfield.value;
5422
5305
  });
5423
5306
  });
5424
5307
  });
5425
- if (util/* default.size */.Z.size(forms) > 0) this.pubsub.publish('state.convoEventM', this.convoEventM, convoKey);
5308
+ if (util/* default */.Z.size(forms) > 0) this.pubsub.publish('state.convoEventM', this.convoEventM, convoKey);
5426
5309
  });
5427
5310
  }
5428
5311
  typing(cid) {
@@ -5457,7 +5340,7 @@ class Store {
5457
5340
  }
5458
5341
  async sendConvoEvent(cid, type, data) {
5459
5342
  await this.readyGate.entry();
5460
- var idempotency = util/* default.randomString */.Z.randomString(36);
5343
+ var idempotency = util/* default */.Z.randomString(36);
5461
5344
  let user = this.cache.match('user') || {};
5462
5345
  var event = {
5463
5346
  id: idempotency,
@@ -5470,17 +5353,24 @@ class Store {
5470
5353
  type,
5471
5354
  created: this.now()
5472
5355
  };
5473
- util/* default.convoToEv */.Z.convoToEv(cid, event);
5356
+ util/* default */.Z.convoToEv(cid, event);
5474
5357
  let files = [];
5475
5358
  if (type === 'message_sent') {
5476
- util/* default.setMsgField */.Z.setMsgField(event, 'idempotency', idempotency);
5359
+ util/* default */.Z.setMsgField(event, 'idempotency', idempotency);
5477
5360
  event.data.message.conversation_id = cid;
5478
5361
  await flow.map(event.data.message.attachments, 2, async (att, i) => {
5479
5362
  if (att.type !== 'file') return;
5480
5363
  if (!att._file) return;
5481
5364
  files.push(att);
5482
5365
  if (ImageTypes.includes(att._file.type)) {
5483
- att.url = await loadImage(att._file);
5366
+ let {
5367
+ width,
5368
+ height,
5369
+ url
5370
+ } = await loadImage(att._file);
5371
+ att.url = url;
5372
+ att.width = width;
5373
+ att.height = height;
5484
5374
  }
5485
5375
  });
5486
5376
  }
@@ -5492,7 +5382,7 @@ class Store {
5492
5382
  url,
5493
5383
  error
5494
5384
  } = await this.api.uploadToS3(att._file);
5495
- if (util/* default.get */.Z.get(body, 'code') == 'invalid_field_size') {
5385
+ if (util/* default */.Z.get(body, 'code') == 'invalid_field_size') {
5496
5386
  event._error_message = 'cannot_send_too_big_file';
5497
5387
  }
5498
5388
  event._error = error;
@@ -5520,23 +5410,23 @@ class Store {
5520
5410
  first_interaction: 1
5521
5411
  });
5522
5412
  }
5523
- this.kv.put('last_msg_sent', util/* default.Date.now */.Z.Date.now());
5413
+ this.kv.put('last_msg_sent', util/* default */.Z.Date.now());
5524
5414
  return ret;
5525
5415
  }
5526
5416
  _setConvo(convo) {
5527
5417
  let count = 0;
5528
5418
  let user = this.cache.match('user');
5529
- let channel = util/* default.get */.Z.get(convo, 'touchpoint.channel', '');
5419
+ let channel = util/* default */.Z.get(convo, 'touchpoint.channel', '');
5530
5420
  if (channel && channel != 'subiz') return;
5531
5421
  let allconvo = {};
5532
- util/* default.map */.Z.map(this.cache.all(), (value, key) => {
5422
+ util/* default */.Z.map(this.cache.all(), (value, key) => {
5533
5423
  if (key.startsWith('convo_')) {
5534
5424
  allconvo[key] = value;
5535
5425
  }
5536
5426
  });
5537
- if (util/* default.size */.Z.size(allconvo) > MAX_CONVO - 2) {
5538
- allconvo = util/* default.orderBy */.Z.orderBy(util/* default.map */.Z.map(allconvo), 'created', 'desc');
5539
- for (var i = MAX_CONVO - 2; i < util/* default.size */.Z.size(allconvo); i++) {
5427
+ if (util/* default */.Z.size(allconvo) > MAX_CONVO - 2) {
5428
+ allconvo = util/* default */.Z.orderBy(util/* default */.Z.map(allconvo), 'created', 'desc');
5429
+ for (var i = MAX_CONVO - 2; i < util/* default */.Z.size(allconvo); i++) {
5540
5430
  let convo = allconvo[i];
5541
5431
  this.cache.del('convo_' + convo.id);
5542
5432
  }
@@ -5592,7 +5482,7 @@ class Store {
5592
5482
  account_id: user.account_id,
5593
5483
  web_plugin_id: id,
5594
5484
  campaign_id: id,
5595
- user_id: util/* default.get */.Z.get(user, 'id'),
5485
+ user_id: util/* default */.Z.get(user, 'id'),
5596
5486
  url: window.location.href,
5597
5487
  device: this.device,
5598
5488
  submission,
@@ -5611,9 +5501,9 @@ class Store {
5611
5501
  error
5612
5502
  } = await this.api.listMessages(convoid, -limit, anchor);
5613
5503
  if (error || code !== 200) return [[], anchor, error];
5614
- anchor = util/* default.get */.Z.get(util/* default.last */.Z.last(events), 'id');
5615
- events = util/* default.map */.Z.map(events, event => {
5616
- event.created = util/* default.getMs */.Z.getMs(event.created);
5504
+ anchor = util/* default */.Z.get(util/* default */.Z.last(events), 'id');
5505
+ events = util/* default */.Z.map(events, event => {
5506
+ event.created = util/* default */.Z.getMs(event.created);
5617
5507
  return {
5618
5508
  id: event.id,
5619
5509
  index: event.created,
@@ -5624,8 +5514,8 @@ class Store {
5624
5514
  for (let i = 0; i < events.length; i++) {
5625
5515
  let ev = events[i].value;
5626
5516
  if (ev.type !== 'message_sent') continue;
5627
- if (util/* default.get */.Z.get(ev, 'by.id') === user.id) continue;
5628
- let pongbyme = util/* default.find */.Z.find(util/* default.get */.Z.get(ev, 'data.message.pongs'), p => p.member_id === user.id);
5517
+ if (util/* default */.Z.get(ev, 'by.id') === user.id) continue;
5518
+ let pongbyme = util/* default */.Z.find(util/* default */.Z.get(ev, 'data.message.pongs'), p => p.member_id === user.id);
5629
5519
  if (pongbyme) break;
5630
5520
  this.api.markAsReceived(convoid, ev.id);
5631
5521
  break;
@@ -5633,25 +5523,26 @@ class Store {
5633
5523
  return [events, anchor];
5634
5524
  }
5635
5525
  async loopTime() {
5636
- let startms = util/* default.Date.now */.Z.Date.now();
5637
- if (!util/* default.get */.Z.get(this.cache.match('user'), 'id')) return util/* default.setTimeout */.Z.setTimeout(() => this.loopTime(), 240000);
5526
+ if (this._die) return;
5527
+ let startms = util/* default */.Z.Date.now();
5528
+ if (!util/* default */.Z.get(this.cache.match('user'), 'id')) return util/* default */.Z.setTimeout(() => this.loopTime(), 240000);
5638
5529
  let {
5639
5530
  body: t,
5640
5531
  error
5641
5532
  } = await this.api.time();
5642
- if (error) return util/* default.setTimeout */.Z.setTimeout(() => this.loopTime(), 30000);
5643
- var latences = Math.abs(util/* default.Date.now */.Z.Date.now() - startms) / 2;
5644
- var serverMs = new util/* default.Date */.Z.Date(t).getTime() + latences;
5645
- var localMs = util/* default.Date.now */.Z.Date.now();
5533
+ if (error) return util/* default */.Z.setTimeout(() => this.loopTime(), 30000);
5534
+ var latences = Math.abs(util/* default */.Z.Date.now() - startms) / 2;
5535
+ var serverMs = new util/* default */.Z.Date(t).getTime() + latences;
5536
+ var localMs = util/* default */.Z.Date.now();
5646
5537
  this.timeDiff = Math.floor(serverMs - localMs);
5647
- util/* default.setTimeout */.Z.setTimeout(() => this.loopTime(), 240000);
5538
+ util/* default */.Z.setTimeout(() => this.loopTime(), 240000);
5648
5539
  }
5649
5540
  replaceFileUrl(src) {
5650
5541
  if (!src) return '';
5651
- if (util/* default.startsWith */.Z.startsWith(src, '/')) return src;
5652
- if (util/* default.startsWith */.Z.startsWith(src, 'data:')) return src;
5653
- if (!util/* default.startsWith */.Z.startsWith(src, 'http://') && !util/* default.startsWith */.Z.startsWith(src, 'https://') && !util/* default.startsWith */.Z.startsWith(src, '//')) {
5654
- src = util/* default.trim */.Z.trim(this.FileURL, '/') + '/' + util/* default.trimStart */.Z.trimStart(src, '/');
5542
+ if (util/* default */.Z.startsWith(src, '/')) return src;
5543
+ if (util/* default */.Z.startsWith(src, 'data:')) return src;
5544
+ if (!util/* default */.Z.startsWith(src, 'http://') && !util/* default */.Z.startsWith(src, 'https://') && !util/* default */.Z.startsWith(src, '//')) {
5545
+ src = util/* default */.Z.trim(this.FileURL, '/') + '/' + util/* default */.Z.trimStart(src, '/');
5655
5546
  }
5656
5547
  src = src.replace('https://file-subiz.com/', this.FileURL);
5657
5548
  src = src.replace('http://file-subiz.com/', this.FileURL);
@@ -5668,7 +5559,7 @@ class Store {
5668
5559
  return src;
5669
5560
  }
5670
5561
  clearBrowserData() {
5671
- util/* default.each */.Z.each(this.cookie.all(), (v, k) => {
5562
+ util/* default */.Z.each(this.cookie.all(), (v, k) => {
5672
5563
  if ((k || '').startsWith('__sb')) this.cookie.remove(k);
5673
5564
  });
5674
5565
  this.kv.destroy();
@@ -5678,16 +5569,29 @@ class Store {
5678
5569
  }
5679
5570
  destroy() {
5680
5571
  this._die = true;
5681
- this.clearBrowserData();
5572
+ if (this.kv) this.kv.destroy();
5573
+ if (this.chain) this.chain.destroy();
5574
+ util/* default */.Z.clearInterval(this._seenInterval);
5682
5575
  if (this.realtime) this.realtime.stop();
5683
5576
  this.readyGate.close();
5577
+ window.removeEventListener('blur', this.sendPresence);
5578
+ window.removeEventListener('focus', this.sendPresence);
5684
5579
  }
5685
5580
  }
5686
5581
  function loadImage(file) {
5687
5582
  return new Promise(rs => {
5688
5583
  var reader = new window.FileReader();
5689
5584
  reader.onload = e => {
5690
- rs(e.target.result);
5585
+ let src = e.target.result;
5586
+ let img = new Image();
5587
+ img.onload = () => {
5588
+ rs({
5589
+ url: src,
5590
+ width: img.width,
5591
+ height: img.height
5592
+ });
5593
+ };
5594
+ img.src = src;
5691
5595
  };
5692
5596
  reader.readAsDataURL(file);
5693
5597
  });
@@ -5798,7 +5702,7 @@ let cleanLocalStorage = () => {
5798
5702
  } catch (e) {
5799
5703
  return;
5800
5704
  }
5801
- util/* default.setTimeout */.Z.setTimeout(() => {
5705
+ util/* default */.Z.setTimeout(() => {
5802
5706
  for (var key in localStorage) {
5803
5707
  if (key && (key.startsWith('cbz2020') || key.startsWith('sbz2020'))) {
5804
5708
  localStorage.removeItem(key);
@@ -5812,7 +5716,7 @@ let cleanMyLocalStorage = () => {
5812
5716
  } catch (e) {
5813
5717
  return;
5814
5718
  }
5815
- util/* default.setTimeout */.Z.setTimeout(() => {
5719
+ util/* default */.Z.setTimeout(() => {
5816
5720
  for (var key in localStorage) {
5817
5721
  if (key && (key.startsWith('cbz2020') || key.startsWith('sbz2020') || key.startsWith('sbz2022') || key.startsWith('sbz2023'))) {
5818
5722
  localStorage.removeItem(key);
@@ -5830,8 +5734,8 @@ function dofetch(method, url, body, cb) {
5830
5734
  }).then(res => res.text().then(text => cb && cb(text, res.status))).catch(err => cb && cb(err, -1));
5831
5735
  }
5832
5736
  var xhrsend = function (method, url, body, cb) {
5833
- if (typeof util/* default.XMLHttpRequest */.Z.XMLHttpRequest === 'undefined') return dofetch(method, url, body, cb);
5834
- var request = new util/* default.XMLHttpRequest */.Z.XMLHttpRequest();
5737
+ if (typeof util/* default */.Z.XMLHttpRequest === 'undefined') return dofetch(method, url, body, cb);
5738
+ var request = new util/* default */.Z.XMLHttpRequest();
5835
5739
  request.onreadystatechange = function (e) {
5836
5740
  if (request.readyState !== 4) return;
5837
5741
  cb && cb(request.responseText, request.status);
@@ -5845,6 +5749,7 @@ var xhrsend = function (method, url, body, cb) {
5845
5749
  if (body) request.setRequestHeader('content-type', 'text/plain');
5846
5750
  request.send(body);
5847
5751
  };
5752
+ const dieErr = new Error('sdk unloaded');
5848
5753
  // EXTERNAL MODULE: ./src/common.js
5849
5754
  var common = __webpack_require__(2493);
5850
5755
  // EXTERNAL MODULE: ./node_modules/preact/dist/preact.module.js
@@ -5853,7 +5758,7 @@ var preact_module = __webpack_require__(6400);
5853
5758
 
5854
5759
 
5855
5760
 
5856
- const LoadChatbox = () => __webpack_require__.e(/* import() */ 132).then(__webpack_require__.bind(__webpack_require__, 8132));
5761
+ const LoadChatbox = () => __webpack_require__.e(/* import() */ 841).then(__webpack_require__.bind(__webpack_require__, 8841));
5857
5762
  const LoadContact = () => __webpack_require__.e(/* import() */ 335).then(__webpack_require__.bind(__webpack_require__, 2335));
5858
5763
  const LoadPopup = () => __webpack_require__.e(/* import() */ 213).then(__webpack_require__.bind(__webpack_require__, 8213));
5859
5764
  const LoadNotif = () => __webpack_require__.e(/* import() */ 605).then(__webpack_require__.bind(__webpack_require__, 9605));
@@ -5861,9 +5766,12 @@ function Plugin(plugin, store, $container, lib) {
5861
5766
  if (!$container) throw '$div must is a valid html node';
5862
5767
  var $div = document.createElement('div');
5863
5768
  $div.id = plugin.id;
5769
+ let acc = store.matchAccount();
5770
+ $div.setAttribute('sbz-plugin-type', plugin.type);
5771
+ $div.setAttribute('sbz-plugin-account-id', acc.id);
5864
5772
  $container.appendChild($div);
5865
- let _locale = common/* getLocale */.Kd(plugin, util/* default.detectLang */.Z.detectLang());
5866
- var domGate = new util/* default.Gate */.Z.Gate();
5773
+ let _locale = common/* getLocale */.Kd(plugin, util/* default */.Z.detectLang());
5774
+ var domGate = new util/* default */.Z.Gate();
5867
5775
  var pageIndex = 0;
5868
5776
  var highlight;
5869
5777
  var state = 'hold';
@@ -5876,13 +5784,13 @@ function Plugin(plugin, store, $container, lib) {
5876
5784
  let lastrun = store.matchLastPluginRun(plugin.id);
5877
5785
  if (plugin.type === 'chatbox' || plugin.type === 'notification') lastrun = undefined;
5878
5786
  if (!plugin.enabled) return;
5879
- let match = util/* default.checkRunConditions */.Z.checkRunConditions(plugin.initiative_frequency, plugin.conditions, lastrun, store);
5787
+ let match = util/* default */.Z.checkRunConditions(plugin.initiative_frequency, plugin.conditions, lastrun, store);
5880
5788
  if (!match) return;
5881
5789
  state = 'running';
5882
5790
  await _this.update(plugin);
5883
5791
  };
5884
5792
  this.forceRunPopup = async () => {
5885
- if (util/* default.get */.Z.get(_ref, 'current')) {
5793
+ if (util/* default */.Z.get(_ref, 'current')) {
5886
5794
  _ref.current.openPopup();
5887
5795
  } else {
5888
5796
  _render();
@@ -5969,11 +5877,10 @@ function Plugin(plugin, store, $container, lib) {
5969
5877
  };
5970
5878
  let t = key => {
5971
5879
  if (_locale === 'debug') return `{{${key}}}`;
5972
- let messages = util/* default.get */.Z.get(common/* langMessages */.Rs, _locale, []);
5973
- let message = util/* default.find */.Z.find(messages, message => message.key === key);
5974
- return util/* default.get */.Z.get(message, 'message', key);
5880
+ let messages = util/* default */.Z.get(common/* langMessages */.Rs, _locale, []);
5881
+ let message = util/* default */.Z.find(messages, message => message.key === key);
5882
+ return util/* default */.Z.get(message, 'message', key);
5975
5883
  };
5976
- let acc = store.matchAccount();
5977
5884
  t.i18n = i18nText => {
5978
5885
  if (!i18nText) return '';
5979
5886
  let fallbackLocale = plugin.locale || acc.locale || 'vi-VN';
@@ -5997,29 +5904,29 @@ function Plugin(plugin, store, $container, lib) {
5997
5904
  return _locale;
5998
5905
  };
5999
5906
  let images = {};
6000
- util/* default.map */.Z.map(util/* default.get */.Z.get(plugin, 'popup.pages'), page => {
5907
+ util/* default */.Z.map(util/* default */.Z.get(plugin, 'popup.pages'), page => {
6001
5908
  if (!page) return;
6002
- util/* default.map */.Z.map(page.components, com => {
5909
+ util/* default */.Z.map(page.components, com => {
6003
5910
  if (com.type === 'image' && com.image && com.image.url && com.image.url.startsWith('http')) {
6004
5911
  images[com.image.url] = true;
6005
5912
  }
6006
5913
  });
6007
5914
  });
6008
- if (util/* default.size */.Z.size(images) >= 0) util/* default.map */.Z.map(images, (_, image) => util/* default.preloadImg */.Z.preloadImg(image));
6009
- let triggers = util/* default.get */.Z.get(plugin, 'triggers') || [{
5915
+ if (util/* default */.Z.size(images) >= 0) util/* default */.Z.map(images, (_, image) => util/* default */.Z.preloadImg(image));
5916
+ let triggers = util/* default */.Z.get(plugin, 'triggers') || [{
6010
5917
  type: 'after_pageview',
6011
5918
  after_pageview_sec: 0,
6012
5919
  disabled: false
6013
5920
  }];
6014
- for (var i = 0; i < util/* default.size */.Z.size(triggers); i++) {
5921
+ for (var i = 0; i < util/* default */.Z.size(triggers); i++) {
6015
5922
  var tr = triggers[i];
6016
5923
  if (!tr) continue;
6017
5924
  if (tr.disabled) continue;
6018
- if (tr.type === 'exit_intent') util/* default.trackExitIntent */.Z.trackExitIntent(run);
6019
- if (tr.type === 'area_clicked') util/* default.trackAreaClicked */.Z.trackAreaClicked(tr.area_clicked_css_selector, run);
6020
- if (tr.type === 'scrolling_percentage') util/* default.trackScrollingPercentage */.Z.trackScrollingPercentage(tr.scrolling_percentage, run);
6021
- if (tr.type === 'inactivity_duration') util/* default.trackInactivity */.Z.trackInactivity(tr.inactivity_sec, run);
6022
- if (tr.type === 'after_pageview') util/* default.trackTimeOnPage */.Z.trackTimeOnPage(tr.after_pageview_sec, run);
5925
+ if (tr.type === 'exit_intent') util/* default */.Z.trackExitIntent(run);
5926
+ if (tr.type === 'area_clicked') util/* default */.Z.trackAreaClicked(tr.area_clicked_css_selector, run);
5927
+ if (tr.type === 'scrolling_percentage') util/* default */.Z.trackScrollingPercentage(tr.scrolling_percentage, run);
5928
+ if (tr.type === 'inactivity_duration') util/* default */.Z.trackInactivity(tr.inactivity_sec, run);
5929
+ if (tr.type === 'after_pageview') util/* default */.Z.trackTimeOnPage(tr.after_pageview_sec, run);
6023
5930
  }
6024
5931
  this.update(plugin);
6025
5932
  common/* downloadLanguage */.WW(store, _locale).then(() => {
@@ -6047,7 +5954,7 @@ class PluginMgr {
6047
5954
  if (this._destroy) return;
6048
5955
  let pluginM = this.lib.store.matchPlugin();
6049
5956
  let foundchatbox = false;
6050
- util/* default.each */.Z.each(pluginM, conf => {
5957
+ util/* default */.Z.each(pluginM, conf => {
6051
5958
  if (conf.type === 'chatbox') {
6052
5959
  if (foundchatbox) return;
6053
5960
  foundchatbox = true;
@@ -6058,7 +5965,7 @@ class PluginMgr {
6058
5965
  }
6059
5966
  this.pluginM[conf.id].update(conf);
6060
5967
  });
6061
- util/* default.each */.Z.each(this.pluginM, (conf, id) => {
5968
+ util/* default */.Z.each(this.pluginM, (conf, id) => {
6062
5969
  if (pluginM[id]) return;
6063
5970
  this.pluginM[id].destroy();
6064
5971
  delete this.pluginM[id];
@@ -6066,7 +5973,7 @@ class PluginMgr {
6066
5973
  });
6067
5974
  let pluginM = this.lib.store.matchPlugin();
6068
5975
  let foundchatbox = false;
6069
- util/* default.each */.Z.each(pluginM, conf => {
5976
+ util/* default */.Z.each(pluginM, conf => {
6070
5977
  if (conf.type === 'chatbox') {
6071
5978
  if (foundchatbox) return;
6072
5979
  foundchatbox = true;
@@ -6076,12 +5983,12 @@ class PluginMgr {
6076
5983
  }
6077
5984
  findChatbox() {
6078
5985
  var pluginM = this.lib.store.matchPlugin();
6079
- let chatboxs = util/* default.filter */.Z.filter(this.pluginM, (plugin, id) => pluginM[id].type === 'chatbox');
6080
- if (util/* default.size */.Z.size(chatboxs) === 0) {
5986
+ let chatboxs = util/* default */.Z.filter(this.pluginM, (plugin, id) => pluginM[id].type === 'chatbox');
5987
+ if (util/* default */.Z.size(chatboxs) === 0) {
6081
5988
  console.error('no chatbox found.');
6082
5989
  return;
6083
5990
  }
6084
- let chatbox = util/* default.find */.Z.find(chatboxs, chatbox => chatbox.getState() === 'running');
5991
+ let chatbox = util/* default */.Z.find(chatboxs, chatbox => chatbox.getState() === 'running');
6085
5992
  if (!chatbox) {
6086
5993
  chatbox = chatboxs[0];
6087
5994
  }
@@ -6137,9 +6044,8 @@ class PluginMgr {
6137
6044
  chatbox.setLocale(locale);
6138
6045
  }
6139
6046
  destroy() {
6140
- util/* default.map */.Z.map(this.pluginM, (conf, id) => {
6141
- if (this.pluginM[id]) return;
6142
- this.pluginM[id].destroy();
6047
+ util/* default */.Z.map(this.pluginM, (conf, id) => {
6048
+ conf.destroy();
6143
6049
  delete this.pluginM[id];
6144
6050
  });
6145
6051
  this._destroy = true;
@@ -6147,8 +6053,8 @@ class PluginMgr {
6147
6053
  }
6148
6054
  ;// CONCATENATED MODULE: ./src/lib.js
6149
6055
  function lib_defineProperty(obj, key, value) { key = lib_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6150
- function lib_toPropertyKey(arg) { var key = lib_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
6151
- function lib_toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6056
+ function lib_toPropertyKey(t) { var i = lib_toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
6057
+ function lib_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6152
6058
 
6153
6059
 
6154
6060
 
@@ -6156,39 +6062,45 @@ var $link = document.createElement('link');
6156
6062
  $link.href = 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap';
6157
6063
  $link.rel = 'stylesheet';
6158
6064
  document.head.append($link);
6159
- util/* default.preloadWebfonts */.Z.preloadWebfonts(['Inter'], [400, 500, 600]);
6065
+ util/* default */.Z.preloadWebfonts(['Inter'], [400, 500, 600]);
6160
6066
  class Widget {
6161
6067
  constructor(ApiURL, FileURL, RealtimeURL, inmem, fake) {
6162
6068
  lib_defineProperty(this, "version", () => '4.5');
6163
6069
  lib_defineProperty(this, "setSetting", setting => this.store.setSetting({
6164
6070
  account_setting: setting
6165
6071
  }));
6166
- lib_defineProperty(this, "getUser", () => util/* default.parseJSON */.Z.parseJSON(util/* default.stringify */.Z.stringify(this.store.matchUser())));
6072
+ lib_defineProperty(this, "getUser", () => util/* default */.Z.parseJSON(util/* default */.Z.stringify(this.store.matchUser())));
6167
6073
  lib_defineProperty(this, "setViewingProduct", p => this.store.linkProduct(p));
6168
6074
  lib_defineProperty(this, "getViewingProduct", () => this.store.getLinkedProduct());
6169
6075
  lib_defineProperty(this, "track", () => this.store.track());
6170
6076
  this.impressionTokens = {};
6171
- this.domGate = new util/* default.Gate */.Z.Gate();
6077
+ this.domGate = new util/* default */.Z.Gate();
6172
6078
  this.store = new Store(ApiURL, FileURL, RealtimeURL, inmem, fake);
6173
6079
  window.sbz_store = this.store;
6174
6080
  this.subs = [];
6175
6081
  this.store.onConvoEvent({
6176
6082
  _isMounted: true
6177
- }, ev => util/* default.map */.Z.map(this.subs, sub => sub(ev)));
6083
+ }, ev => util/* default */.Z.map(this.subs, sub => sub(ev)));
6178
6084
  }
6179
6085
  async waitReady(cb) {
6180
6086
  await this.store.readyGate.entry();
6181
6087
  cb();
6182
6088
  }
6089
+ setTrackPageView(val) {
6090
+ this.store.setTrackPageview(val);
6091
+ }
6092
+ getTrackPageView() {
6093
+ return this.store.getTrackPageview();
6094
+ }
6183
6095
  async cleanLogin(user_id, tokenGenerator) {}
6184
6096
  async login(accid, user_id, tokenGenerator, $container) {
6185
6097
  let user = await this.store.login(accid, user_id, tokenGenerator);
6186
6098
  if (!$container) $container = document.body;
6187
6099
  this.pluginMgr = new PluginMgr(this, $container);
6188
- let clean = util/* default.setInterval */.Z.setInterval(() => {
6100
+ let clean = util/* default */.Z.setInterval(() => {
6189
6101
  if ($container && $container.isConnected) return;
6190
6102
  this.pluginMgr.destroy();
6191
- util/* default.clearInterval */.Z.clearInterval(clean);
6103
+ util/* default */.Z.clearInterval(clean);
6192
6104
  }, 1000);
6193
6105
  this.domGate.open();
6194
6106
  return user;
@@ -6201,24 +6113,32 @@ class Widget {
6201
6113
  let accid = param.account_id;
6202
6114
  let ref = param.ref;
6203
6115
  let user = await this.store.init(accid, undefined, ref);
6116
+ util/* default */.Z.setTimeout(() => window.postMessage({
6117
+ type: 'widget_loaded',
6118
+ account_id: accid
6119
+ }, '*'), 0);
6204
6120
  if (!$container) $container = document.body || document;
6205
6121
  this.pluginMgr = new PluginMgr(this, $container);
6206
- let clean = util/* default.setInterval */.Z.setInterval(() => {
6122
+ let clean = util/* default */.Z.setInterval(() => {
6207
6123
  if ($container && $container.isConnected) return;
6208
6124
  this.pluginMgr.destroy();
6209
- util/* default.clearInterval */.Z.clearInterval(clean);
6125
+ util/* default */.Z.clearInterval(clean);
6210
6126
  }, 1000);
6211
6127
  this.domGate.open();
6212
6128
  return user;
6213
6129
  }
6214
6130
  async setAccount(id, $container, mask, cb) {
6215
6131
  let outmask = await this.store.init(id, mask);
6132
+ util/* default */.Z.setTimeout(() => window.postMessage({
6133
+ type: 'widget_loaded',
6134
+ account_id: id
6135
+ }, '*'), 0);
6216
6136
  if (!$container) $container = document.body || document;
6217
6137
  this.pluginMgr = new PluginMgr(this, $container);
6218
- let clean = util/* default.setInterval */.Z.setInterval(() => {
6138
+ let clean = util/* default */.Z.setInterval(() => {
6219
6139
  if ($container && $container.isConnected) return;
6220
6140
  this.pluginMgr.destroy();
6221
- util/* default.clearInterval */.Z.clearInterval(clean);
6141
+ util/* default */.Z.clearInterval(clean);
6222
6142
  }, 1000);
6223
6143
  this.domGate.open();
6224
6144
  cb && cb(outmask);
@@ -6232,12 +6152,12 @@ class Widget {
6232
6152
  attributes
6233
6153
  });
6234
6154
  var user = this.store.matchUser();
6235
- return util/* default.cloneDeep */.Z.cloneDeep(user.attributes);
6155
+ return util/* default */.Z.cloneDeep(user.attributes);
6236
6156
  }
6237
6157
  async getUserAttributes() {
6238
6158
  await this.store.readyGate.entry();
6239
6159
  var user = this.store.matchUser();
6240
- return util/* default.cloneDeep */.Z.cloneDeep(util/* default.get */.Z.get(user, 'attributes', []));
6160
+ return util/* default */.Z.cloneDeep(util/* default */.Z.get(user, 'attributes', []));
6241
6161
  }
6242
6162
  async getWidgetCurrentView() {
6243
6163
  await this.domGate.entry();
@@ -6268,40 +6188,40 @@ class Widget {
6268
6188
  });
6269
6189
  }
6270
6190
  async viewForm(formid) {
6271
- if (!formid || !util/* default.startsWith */.Z.startsWith(formid, 'cp')) return;
6191
+ if (!formid || !util/* default */.Z.startsWith(formid, 'cp')) return;
6272
6192
  let impressiontoken = this.impressionTokens[formid];
6273
6193
  if (impressiontoken) return impressiontoken;
6274
6194
  let {
6275
6195
  body: impression
6276
6196
  } = await this.store.sendImpression(formid);
6277
- impressiontoken = util/* default.get */.Z.get(impression, 'impression_token') || '';
6197
+ impressiontoken = util/* default */.Z.get(impression, 'impression_token') || '';
6278
6198
  this.impressionTokens[formid] = impressiontoken;
6279
6199
  return impressiontoken;
6280
6200
  }
6281
6201
  async submitForm(formid, values) {
6282
- if (!formid || !util/* default.startsWith */.Z.startsWith(formid, 'cp')) return;
6283
- let storeuser = util/* default.cloneDeep */.Z.cloneDeep(this.store.matchUser());
6202
+ if (!formid || !util/* default */.Z.startsWith(formid, 'cp')) return;
6203
+ let storeuser = util/* default */.Z.cloneDeep(this.store.matchUser());
6284
6204
  let user = {
6285
6205
  id: storeuser.id,
6286
6206
  account_id: storeuser.account_id
6287
6207
  };
6288
6208
  let is_lead = false;
6289
- values = util/* default.map */.Z.map(values, val => {
6209
+ values = util/* default */.Z.map(values, val => {
6290
6210
  let key = val.key;
6291
6211
  if (key === 'email') key = 'emails';
6292
6212
  if (key === 'phone') key = 'phones';
6293
6213
  is_lead = is_lead || key == 'emails' || key == 'phones';
6294
- util/* default.setUserAttr */.Z.setUserAttr(user, {
6214
+ util/* default */.Z.setUserAttr(user, {
6295
6215
  key: key,
6296
6216
  [val.type || 'text']: val.value
6297
6217
  });
6298
6218
  return {
6299
6219
  key: key,
6300
6220
  type: val.type || 'text',
6301
- value: util/* default.stringify */.Z.stringify(val.value)
6221
+ value: util/* default */.Z.stringify(val.value)
6302
6222
  };
6303
6223
  });
6304
- if (is_lead) util/* default.setUserAttr */.Z.setUserAttr(user, {
6224
+ if (is_lead) util/* default */.Z.setUserAttr(user, {
6305
6225
  key: 'lead_source',
6306
6226
  text: 'plugin.' + formid
6307
6227
  });
@@ -6346,6 +6266,10 @@ class Widget {
6346
6266
  _overrideDeviceType(type) {
6347
6267
  this.store.overrideDeviceType(type);
6348
6268
  }
6269
+ unload() {
6270
+ if (this.pluginMgr) this.pluginMgr.destroy();
6271
+ this.store.destroy();
6272
+ }
6349
6273
  _overridePlugin(plugins) {
6350
6274
  this.store.overridePlugin(plugins);
6351
6275
  }
@@ -6359,14 +6283,14 @@ class Widget {
6359
6283
  this.pluginMgr.forceRunPopup(pluginid);
6360
6284
  }
6361
6285
  unEvent(cb) {
6362
- this.subs = util/* default.filter */.Z.filter(this.subs, sub => sub !== cb);
6286
+ this.subs = util/* default */.Z.filter(this.subs, sub => sub !== cb);
6363
6287
  }
6364
6288
  async countUnreadMessages() {
6365
6289
  await this.domGate.entry();
6366
6290
  return this.store.matchUnread();
6367
6291
  }
6368
6292
  onEvent(cb) {
6369
- this.subs = util/* default.filter */.Z.filter(this.subs, sub => sub !== cb);
6293
+ this.subs = util/* default */.Z.filter(this.subs, sub => sub !== cb);
6370
6294
  this.subs.push(cb);
6371
6295
  }
6372
6296
  overrideAccount(acc) {
@@ -6374,7 +6298,7 @@ class Widget {
6374
6298
  }
6375
6299
  async overrideChatbox(chatbox) {
6376
6300
  await this.store.overrideChatbox(chatbox);
6377
- if (util/* default.get */.Z.get(chatbox, 'chatbox.greeting.greeting')) {
6301
+ if (util/* default */.Z.get(chatbox, 'chatbox.greeting.greeting')) {
6378
6302
  this.pluginMgr.showCurrentGreeting();
6379
6303
  }
6380
6304
  }