@subiz/widget-v4 4.1.40 → 4.1.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiled_src/lib.js +4 -0
- package/compiled_src/plugin.js +1 -2
- package/compiled_src/store/store.js +26 -6
- package/compiled_src/util/campaign.js +2 -6
- package/compiled_src/util/common.js +2 -6
- package/compiled_src/util/order.js +2 -4
- package/compiled_src/util/pubsub.js +3 -6
- package/dist/132.js +531 -525
- package/dist/18a3a577516.132.js +1 -0
- package/dist/18a3a577516.213.js +1 -0
- package/dist/18a3a577516.335.js +1 -0
- package/dist/{18a02a9c54e.362.js → 18a3a577516.362.js} +1 -1
- package/dist/18a3a577516.441.js +1 -0
- package/dist/18a3a577516.605.js +1 -0
- package/dist/{18a02a9c54e.782.js → 18a3a577516.782.js} +1 -1
- package/dist/18a3a577516.app.js +1 -0
- package/dist/{18a02a9c54e.index.html → 18a3a577516.index.html} +4 -4
- package/dist/{18a02a9c54e.library.html → 18a3a577516.library.html} +4 -4
- package/dist/18a3a577516.library.js +1 -0
- package/dist/{18a02a9c54e.preview.html → 18a3a577516.preview.html} +1 -1
- package/dist/18a3a577516.preview.js +1 -0
- package/dist/18a3a577516.screenshoot.js +1 -0
- package/dist/18a3a577516.webview.js +1 -0
- package/dist/213.js +118 -100
- package/dist/335.js +25 -25
- package/dist/362.js +1 -1
- package/dist/441.js +2441 -2597
- package/dist/605.js +50 -50
- package/dist/782.js +1 -1
- package/dist/HASH +1 -1
- package/dist/screenshoot.html +1 -1
- package/dist/screenshoot.js +396 -412
- package/package.json +10 -10
- package/src/lib.js +6 -0
- package/src/plugin.js +2 -3
- package/src/store/store.js +26 -5
- package/dist/18a02a9c54e.132.js +0 -1
- package/dist/18a02a9c54e.213.js +0 -1
- package/dist/18a02a9c54e.335.js +0 -1
- package/dist/18a02a9c54e.441.js +0 -1
- package/dist/18a02a9c54e.605.js +0 -1
- package/dist/18a02a9c54e.app.js +0 -1
- package/dist/18a02a9c54e.library.js +0 -1
- package/dist/18a02a9c54e.preview.js +0 -1
- package/dist/18a02a9c54e.screenshoot.js +0 -1
- package/dist/18a02a9c54e.webview.js +0 -1
- /package/dist/{18a02a9c54e.178.js → 18a3a577516.178.js} +0 -0
- /package/dist/{18a02a9c54e.678.js → 18a3a577516.678.js} +0 -0
package/dist/screenshoot.js
CHANGED
|
@@ -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({
|
|
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
|
|
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 = {
|
|
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
|
|
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.
|
|
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
|
|
519
|
+
module.exports = function sleep(ms) {
|
|
520
520
|
return new Promise(function (res) {
|
|
521
521
|
setTimeout(res, ms)
|
|
522
522
|
})
|
|
@@ -525,10 +525,75 @@ module.exports = function sleep (ms) {
|
|
|
525
525
|
|
|
526
526
|
/***/ }),
|
|
527
527
|
|
|
528
|
-
/***/
|
|
529
|
-
/***/ ((module
|
|
528
|
+
/***/ 2611:
|
|
529
|
+
/***/ ((module) => {
|
|
530
530
|
|
|
531
|
-
|
|
531
|
+
function dofetch(method, url, body, cb) {
|
|
532
|
+
let headers = {}
|
|
533
|
+
if (body) headers['content-type'] = 'text/plain'
|
|
534
|
+
fetch(url, {method: method, headers: headers, body: body})
|
|
535
|
+
.then((res) => res.text().then((text) => cb && cb(text, res.status)))
|
|
536
|
+
.catch((err) => cb && cb(err, -1))
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
// xhrsend sends an HTTP request
|
|
540
|
+
var xhrsend = function (method, url, body, cb) {
|
|
541
|
+
if (typeof XMLHttpRequest === 'undefined') return dofetch(method, url, body, cb)
|
|
542
|
+
var request = new XMLHttpRequest()
|
|
543
|
+
request.onreadystatechange = function (e) {
|
|
544
|
+
if (request.readyState !== 4) return
|
|
545
|
+
cb && cb(request.responseText, request.status)
|
|
546
|
+
cb = undefined // dont call cb anymore
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
request.onerror = function () {
|
|
550
|
+
cb && cb(request.responseText, -1) // network error
|
|
551
|
+
cb = undefined // dont call cb anymore
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
request.open(method, url)
|
|
555
|
+
if (body) request.setRequestHeader('content-type', 'text/plain')
|
|
556
|
+
request.send(body)
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
// JSON.parse without exeption
|
|
560
|
+
// return undefined when parsing invalid JSON string
|
|
561
|
+
function parseJSON(str) {
|
|
562
|
+
try {
|
|
563
|
+
return JSON.parse(str)
|
|
564
|
+
} catch (e) {}
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
function Pubsub() {
|
|
568
|
+
// holds all subscriptions for all topics
|
|
569
|
+
// example {
|
|
570
|
+
// topic1: [cb1, cb2],
|
|
571
|
+
// topic2: [cb3, cb4],
|
|
572
|
+
// }
|
|
573
|
+
var listeners = {}
|
|
574
|
+
|
|
575
|
+
// emit notifies any callback functions that previously
|
|
576
|
+
// subscribed to the topic (by the on function)
|
|
577
|
+
this.emit = function (topic) {
|
|
578
|
+
// skip the first item in arguments, which is the topic
|
|
579
|
+
var args = []
|
|
580
|
+
for (var i = 1; i < arguments.length; i++) args.push(arguments[i])
|
|
581
|
+
|
|
582
|
+
var cbs = listeners[topic]
|
|
583
|
+
if (!cbs) return
|
|
584
|
+
for (var i = 0; i < cbs.length; i++) cbs[i].apply(undefined, args)
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
// register a callback function for a topic
|
|
588
|
+
// when something is sent to the topic (by the emit function),
|
|
589
|
+
// the callback function will be called
|
|
590
|
+
this.on = function (topic, cb) {
|
|
591
|
+
if (!listeners[topic]) listeners[topic] = []
|
|
592
|
+
listeners[topic].push(cb)
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
module.exports = {xhrsend, parseJSON, Pubsub}
|
|
532
597
|
|
|
533
598
|
|
|
534
599
|
/***/ }),
|
|
@@ -537,6 +602,7 @@ module.exports = __webpack_require__(608)
|
|
|
537
602
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
538
603
|
|
|
539
604
|
var flow = __webpack_require__(3165)
|
|
605
|
+
var {xhrsend, parseJSON, Pubsub} = __webpack_require__(2611)
|
|
540
606
|
|
|
541
607
|
// Conn represents a realtime connection between an user and the realtime
|
|
542
608
|
// server (https://rt-0.subiz.com)
|
|
@@ -750,74 +816,6 @@ function Realtime(apiUrls, credential, callAPI) {
|
|
|
750
816
|
reconnect()
|
|
751
817
|
}
|
|
752
818
|
|
|
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
819
|
// calcNextBackoff returns number of seconds we must wait
|
|
822
820
|
// before sending a next request
|
|
823
821
|
// the results is determind based on exponential backoff algorithm
|
|
@@ -862,7 +860,7 @@ module.exports = Realtime
|
|
|
862
860
|
|
|
863
861
|
"use strict";
|
|
864
862
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
865
|
-
/* harmony export */
|
|
863
|
+
/* harmony export */ Z: () => (/* binding */ Chain)
|
|
866
864
|
/* harmony export */ });
|
|
867
865
|
const ChainMaxSize = 50;
|
|
868
866
|
class Chain {
|
|
@@ -934,9 +932,7 @@ class Chain {
|
|
|
934
932
|
});
|
|
935
933
|
return out;
|
|
936
934
|
}
|
|
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;
|
|
935
|
+
async fetchMore(chain, limit = 20, api) {
|
|
940
936
|
if (this.dead) return {
|
|
941
937
|
error: 'dead'
|
|
942
938
|
};
|
|
@@ -1094,7 +1090,7 @@ function orderBy(a, k, d) {
|
|
|
1094
1090
|
|
|
1095
1091
|
"use strict";
|
|
1096
1092
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1097
|
-
/* harmony export */
|
|
1093
|
+
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
1098
1094
|
/* harmony export */ });
|
|
1099
1095
|
var localStorageMemory = {};
|
|
1100
1096
|
var cache = {};
|
|
@@ -1129,7 +1125,7 @@ localStorageMemory.clear = function () {
|
|
|
1129
1125
|
|
|
1130
1126
|
"use strict";
|
|
1131
1127
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1132
|
-
/* harmony export */
|
|
1128
|
+
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
1133
1129
|
/* harmony export */ });
|
|
1134
1130
|
let KvMaxSize = 500;
|
|
1135
1131
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (class {
|
|
@@ -1218,7 +1214,7 @@ let KvMaxSize = 500;
|
|
|
1218
1214
|
|
|
1219
1215
|
"use strict";
|
|
1220
1216
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1221
|
-
/* harmony export */
|
|
1217
|
+
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
1222
1218
|
/* harmony export */ });
|
|
1223
1219
|
let memlocalStorage = (__webpack_require__(9489)/* ["default"] */ .Z);
|
|
1224
1220
|
let requestIdleCallback = window.requestIdleCallback || (cb => cb());
|
|
@@ -1286,11 +1282,11 @@ function toString(obj) {
|
|
|
1286
1282
|
|
|
1287
1283
|
"use strict";
|
|
1288
1284
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1289
|
-
/* harmony export */
|
|
1290
|
-
/* harmony export */
|
|
1291
|
-
/* harmony export */
|
|
1292
|
-
/* harmony export */
|
|
1293
|
-
/* harmony export */
|
|
1285
|
+
/* harmony export */ Kd: () => (/* binding */ getLocale),
|
|
1286
|
+
/* harmony export */ Rs: () => (/* binding */ langMessages),
|
|
1287
|
+
/* harmony export */ WW: () => (/* binding */ downloadLanguage),
|
|
1288
|
+
/* harmony export */ u$: () => (/* binding */ Clickaway),
|
|
1289
|
+
/* harmony export */ up: () => (/* binding */ Com)
|
|
1294
1290
|
/* harmony export */ });
|
|
1295
1291
|
/* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6400);
|
|
1296
1292
|
/* harmony import */ var _util_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4494);
|
|
@@ -1300,7 +1296,7 @@ class Com extends preact__WEBPACK_IMPORTED_MODULE_0__/* .Component */ .wA {
|
|
|
1300
1296
|
constructor(props) {
|
|
1301
1297
|
super(props);
|
|
1302
1298
|
this._isMounted = true;
|
|
1303
|
-
_util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"]
|
|
1299
|
+
_util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.setTimeout(() => {
|
|
1304
1300
|
if (this.componentWillUnmount) {
|
|
1305
1301
|
let old = this.componentWillUnmount.bind(this);
|
|
1306
1302
|
this.componentWillUnmount = () => {
|
|
@@ -1339,9 +1335,9 @@ class Clickaway extends Com {
|
|
|
1339
1335
|
}
|
|
1340
1336
|
const getLocale = (plugin, loc) => {
|
|
1341
1337
|
if (!loc) loc = '';
|
|
1342
|
-
let found = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"]
|
|
1338
|
+
let found = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.find(plugin.locales, l => l.toLowerCase().trim() === loc.toLowerCase().trim());
|
|
1343
1339
|
if (found) return found;
|
|
1344
|
-
found = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"]
|
|
1340
|
+
found = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.find(plugin.locales, l => {
|
|
1345
1341
|
l = l.replace('-', '_').split('_')[0].trim().toLowerCase();
|
|
1346
1342
|
let compareloc = loc.replace('-', '_').split('_')[0].trim().toLowerCase();
|
|
1347
1343
|
return l == compareloc;
|
|
@@ -1352,7 +1348,7 @@ const getLocale = (plugin, loc) => {
|
|
|
1352
1348
|
let langMessages = {};
|
|
1353
1349
|
let downloadLock = false;
|
|
1354
1350
|
function downloadLanguage(store, locale, force) {
|
|
1355
|
-
if (downloadLock) return new Promise(resolve => _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"]
|
|
1351
|
+
if (downloadLock) return new Promise(resolve => _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.setTimeout(() => downloadLanguage(store, locale, force).then(resolve), 100));
|
|
1356
1352
|
downloadLock = true;
|
|
1357
1353
|
let messages;
|
|
1358
1354
|
if (locale === 'debug' || langMessages[locale] && !force) {
|
|
@@ -1361,7 +1357,7 @@ function downloadLanguage(store, locale, force) {
|
|
|
1361
1357
|
}
|
|
1362
1358
|
return store.getLocaleContent(locale).then(res => {
|
|
1363
1359
|
downloadLock = false;
|
|
1364
|
-
messages = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"]
|
|
1360
|
+
messages = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.get(res, 'body.messages', []);
|
|
1365
1361
|
langMessages[locale] = messages;
|
|
1366
1362
|
});
|
|
1367
1363
|
}
|
|
@@ -1374,73 +1370,73 @@ function downloadLanguage(store, locale, force) {
|
|
|
1374
1370
|
"use strict";
|
|
1375
1371
|
__webpack_require__.r(__webpack_exports__);
|
|
1376
1372
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1377
|
-
/* harmony export */
|
|
1378
|
-
/* harmony export */
|
|
1379
|
-
/* harmony export */
|
|
1380
|
-
/* harmony export */
|
|
1381
|
-
/* harmony export */
|
|
1382
|
-
/* harmony export */
|
|
1383
|
-
/* harmony export */
|
|
1384
|
-
/* harmony export */
|
|
1385
|
-
/* harmony export */
|
|
1386
|
-
/* harmony export */
|
|
1387
|
-
/* harmony export */
|
|
1388
|
-
/* harmony export */
|
|
1389
|
-
/* harmony export */
|
|
1390
|
-
/* harmony export */
|
|
1391
|
-
/* harmony export */
|
|
1392
|
-
/* harmony export */
|
|
1393
|
-
/* harmony export */
|
|
1394
|
-
/* harmony export */
|
|
1395
|
-
/* harmony export */
|
|
1396
|
-
/* harmony export */
|
|
1397
|
-
/* harmony export */
|
|
1398
|
-
/* harmony export */
|
|
1399
|
-
/* harmony export */
|
|
1400
|
-
/* harmony export */
|
|
1401
|
-
/* harmony export */
|
|
1402
|
-
/* harmony export */
|
|
1403
|
-
/* harmony export */
|
|
1404
|
-
/* harmony export */
|
|
1405
|
-
/* harmony export */
|
|
1406
|
-
/* harmony export */
|
|
1407
|
-
/* harmony export */
|
|
1408
|
-
/* harmony export */
|
|
1409
|
-
/* harmony export */
|
|
1410
|
-
/* harmony export */
|
|
1411
|
-
/* harmony export */
|
|
1412
|
-
/* harmony export */
|
|
1413
|
-
/* harmony export */
|
|
1414
|
-
/* harmony export */
|
|
1415
|
-
/* harmony export */
|
|
1416
|
-
/* harmony export */
|
|
1417
|
-
/* harmony export */
|
|
1418
|
-
/* harmony export */
|
|
1419
|
-
/* harmony export */
|
|
1420
|
-
/* harmony export */
|
|
1421
|
-
/* harmony export */
|
|
1422
|
-
/* harmony export */
|
|
1423
|
-
/* harmony export */
|
|
1424
|
-
/* harmony export */
|
|
1425
|
-
/* harmony export */
|
|
1426
|
-
/* harmony export */
|
|
1427
|
-
/* harmony export */
|
|
1428
|
-
/* harmony export */
|
|
1429
|
-
/* harmony export */
|
|
1430
|
-
/* harmony export */
|
|
1431
|
-
/* harmony export */
|
|
1432
|
-
/* harmony export */
|
|
1433
|
-
/* harmony export */
|
|
1434
|
-
/* harmony export */
|
|
1435
|
-
/* harmony export */
|
|
1436
|
-
/* harmony export */
|
|
1437
|
-
/* harmony export */
|
|
1438
|
-
/* harmony export */
|
|
1439
|
-
/* harmony export */
|
|
1440
|
-
/* harmony export */
|
|
1441
|
-
/* harmony export */
|
|
1442
|
-
/* harmony export */
|
|
1443
|
-
/* harmony export */
|
|
1373
|
+
/* harmony export */ DEFVAL: () => (/* binding */ DEFVAL),
|
|
1374
|
+
/* harmony export */ DEF_CHAT_BUTTON_BACKGROUND_IMAGE_URL: () => (/* binding */ DEF_CHAT_BUTTON_BACKGROUND_IMAGE_URL),
|
|
1375
|
+
/* harmony export */ Date: () => (/* binding */ Date),
|
|
1376
|
+
/* harmony export */ XMLHttpRequest: () => (/* binding */ XMLHttpRequest),
|
|
1377
|
+
/* harmony export */ agentsOfConvo: () => (/* binding */ agentsOfConvo),
|
|
1378
|
+
/* harmony export */ checkRunConditions: () => (/* binding */ checkRunConditions),
|
|
1379
|
+
/* harmony export */ clearInterval: () => (/* binding */ clearInterval),
|
|
1380
|
+
/* harmony export */ clearTimeout: () => (/* binding */ clearTimeout),
|
|
1381
|
+
/* harmony export */ cloneDeep: () => (/* binding */ cloneDeep),
|
|
1382
|
+
/* harmony export */ convoOfEv: () => (/* binding */ convoOfEv),
|
|
1383
|
+
/* harmony export */ convoToEv: () => (/* binding */ convoToEv),
|
|
1384
|
+
/* harmony export */ detectLang: () => (/* binding */ detectLang),
|
|
1385
|
+
/* harmony export */ diffDay: () => (/* binding */ diffDay),
|
|
1386
|
+
/* harmony export */ diffYear: () => (/* binding */ diffYear),
|
|
1387
|
+
/* harmony export */ each: () => (/* binding */ each),
|
|
1388
|
+
/* harmony export */ filter: () => (/* binding */ filter),
|
|
1389
|
+
/* harmony export */ find: () => (/* binding */ find),
|
|
1390
|
+
/* harmony export */ formatCurrency: () => (/* binding */ formatCurrency),
|
|
1391
|
+
/* harmony export */ getAgentDisplayName: () => (/* binding */ getAgentDisplayName),
|
|
1392
|
+
/* harmony export */ getDayName: () => (/* binding */ getDayName),
|
|
1393
|
+
/* harmony export */ getMs: () => (/* binding */ getMs),
|
|
1394
|
+
/* harmony export */ getMsgField: () => (/* binding */ getMsgField),
|
|
1395
|
+
/* harmony export */ getUrlParameter: () => (/* binding */ getUrlParameter),
|
|
1396
|
+
/* harmony export */ getUserAttr: () => (/* binding */ getUserAttr),
|
|
1397
|
+
/* harmony export */ includes: () => (/* binding */ includes),
|
|
1398
|
+
/* harmony export */ isConvoSeen: () => (/* binding */ isConvoSeen),
|
|
1399
|
+
/* harmony export */ isEmail: () => (/* binding */ isEmail),
|
|
1400
|
+
/* harmony export */ isNumber: () => (/* binding */ isNumber),
|
|
1401
|
+
/* harmony export */ isPhone: () => (/* binding */ isPhone),
|
|
1402
|
+
/* harmony export */ isURL: () => (/* binding */ isURL),
|
|
1403
|
+
/* harmony export */ isUserBanned: () => (/* binding */ isUserBanned),
|
|
1404
|
+
/* harmony export */ js2css: () => (/* binding */ js2css),
|
|
1405
|
+
/* harmony export */ last: () => (/* binding */ last),
|
|
1406
|
+
/* harmony export */ map: () => (/* binding */ map),
|
|
1407
|
+
/* harmony export */ merge: () => (/* binding */ merge),
|
|
1408
|
+
/* harmony export */ noop: () => (/* binding */ noop),
|
|
1409
|
+
/* harmony export */ norm: () => (/* binding */ norm),
|
|
1410
|
+
/* harmony export */ offsetToMin: () => (/* binding */ offsetToMin),
|
|
1411
|
+
/* harmony export */ orderBy: () => (/* binding */ orderBy),
|
|
1412
|
+
/* harmony export */ orderByF: () => (/* binding */ orderByF),
|
|
1413
|
+
/* harmony export */ parseJSON: () => (/* binding */ parseJSON),
|
|
1414
|
+
/* harmony export */ preloadImg: () => (/* binding */ preloadImg),
|
|
1415
|
+
/* harmony export */ preloadWebfonts: () => (/* binding */ preloadWebfonts),
|
|
1416
|
+
/* harmony export */ randomString: () => (/* binding */ randomString),
|
|
1417
|
+
/* harmony export */ replaceAll: () => (/* binding */ replaceAll),
|
|
1418
|
+
/* harmony export */ replaceCssVariable: () => (/* binding */ replaceCssVariable),
|
|
1419
|
+
/* harmony export */ replaceCssVariablePlugin: () => (/* binding */ replaceCssVariablePlugin),
|
|
1420
|
+
/* harmony export */ requestAnimationFrame: () => (/* binding */ requestAnimationFrame),
|
|
1421
|
+
/* harmony export */ sameDay: () => (/* binding */ sameDay),
|
|
1422
|
+
/* harmony export */ scrollIntoViewIfNeeded: () => (/* binding */ scrollIntoViewIfNeeded),
|
|
1423
|
+
/* harmony export */ setCss: () => (/* binding */ setCss),
|
|
1424
|
+
/* harmony export */ setInterval: () => (/* binding */ setInterval),
|
|
1425
|
+
/* harmony export */ setMsgField: () => (/* binding */ setMsgField),
|
|
1426
|
+
/* harmony export */ setTimeout: () => (/* binding */ setTimeout),
|
|
1427
|
+
/* harmony export */ setUserAttr: () => (/* binding */ setUserAttr),
|
|
1428
|
+
/* harmony export */ shortTime: () => (/* binding */ shortTime),
|
|
1429
|
+
/* harmony export */ size: () => (/* binding */ size),
|
|
1430
|
+
/* harmony export */ sleep: () => (/* binding */ sleep),
|
|
1431
|
+
/* harmony export */ startsWith: () => (/* binding */ startsWith),
|
|
1432
|
+
/* harmony export */ stringify: () => (/* binding */ stringify),
|
|
1433
|
+
/* harmony export */ throttle: () => (/* binding */ throttle),
|
|
1434
|
+
/* harmony export */ tokenize: () => (/* binding */ tokenize),
|
|
1435
|
+
/* harmony export */ trim: () => (/* binding */ trim),
|
|
1436
|
+
/* harmony export */ trimStart: () => (/* binding */ trimStart),
|
|
1437
|
+
/* harmony export */ unicodeToAscii: () => (/* binding */ unicodeToAscii),
|
|
1438
|
+
/* harmony export */ unixSec: () => (/* binding */ unixSec),
|
|
1439
|
+
/* harmony export */ usersOfConvo: () => (/* binding */ usersOfConvo)
|
|
1444
1440
|
/* harmony export */ });
|
|
1445
1441
|
var op = __webpack_require__(6877);
|
|
1446
1442
|
function parseJSON(str) {
|
|
@@ -1527,10 +1523,7 @@ function getMsgField(ev, fieldName) {
|
|
|
1527
1523
|
function isObject(item) {
|
|
1528
1524
|
return item && typeof item === 'object' && !Array.isArray(item);
|
|
1529
1525
|
}
|
|
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
|
-
}
|
|
1526
|
+
function merge(target, ...sources) {
|
|
1534
1527
|
if (!sources.length) return target;
|
|
1535
1528
|
const source = sources.shift();
|
|
1536
1529
|
if (isObject(target) && isObject(source)) {
|
|
@@ -2093,9 +2086,9 @@ function checkRunConditions(freq, conds, lastrun, store) {
|
|
|
2093
2086
|
break;
|
|
2094
2087
|
case 'user_is_a_contact':
|
|
2095
2088
|
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
|
|
2089
|
+
let emailAttr = find(attributes, att => att.key === 'emails' && attr.text && att.key === 'related_email' && attr.text);
|
|
2090
|
+
let phoneAttr = find(attributes, att => att.key === 'phones' && attr.text && att.key === 'related_phone' && attr.text);
|
|
2091
|
+
let hasContact = emailAttr || phoneAttr;
|
|
2099
2092
|
if (cond.user_is_a_contact) {
|
|
2100
2093
|
if (!hasContact) return false;
|
|
2101
2094
|
}
|
|
@@ -2328,8 +2321,7 @@ function getUrlParameter() {
|
|
|
2328
2321
|
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
|
|
2329
2322
|
}
|
|
2330
2323
|
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';
|
|
2324
|
+
function formatCurrency(val, currency = 'VND') {
|
|
2333
2325
|
let currencyObj = ALL_CURRENCIES.find(cur => cur.code === currency) || {
|
|
2334
2326
|
name: 'Dong',
|
|
2335
2327
|
code: 'VND',
|
|
@@ -3049,7 +3041,7 @@ const ALL_CURRENCIES = [{
|
|
|
3049
3041
|
|
|
3050
3042
|
"use strict";
|
|
3051
3043
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3052
|
-
/* harmony export */
|
|
3044
|
+
/* harmony export */ Z: () => (/* binding */ Gate)
|
|
3053
3045
|
/* harmony export */ });
|
|
3054
3046
|
class Gate {
|
|
3055
3047
|
constructor(isOpen) {
|
|
@@ -3092,41 +3084,41 @@ class Gate {
|
|
|
3092
3084
|
|
|
3093
3085
|
// EXPORTS
|
|
3094
3086
|
__webpack_require__.d(__webpack_exports__, {
|
|
3095
|
-
|
|
3087
|
+
Z: () => (/* binding */ util)
|
|
3096
3088
|
});
|
|
3097
3089
|
|
|
3098
3090
|
// NAMESPACE OBJECT: ./src/util/extractor.js
|
|
3099
3091
|
var extractor_namespaceObject = {};
|
|
3100
3092
|
__webpack_require__.r(extractor_namespaceObject);
|
|
3101
3093
|
__webpack_require__.d(extractor_namespaceObject, {
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3094
|
+
extract: () => (extract),
|
|
3095
|
+
extractEmails: () => (extractEmails),
|
|
3096
|
+
extractEmojis: () => (extractEmojis),
|
|
3097
|
+
extractLinks: () => (extractLinks),
|
|
3098
|
+
extractPhones: () => (extractPhones),
|
|
3099
|
+
extractText: () => (extractText),
|
|
3100
|
+
pipeExtracts: () => (pipeExtracts)
|
|
3109
3101
|
});
|
|
3110
3102
|
|
|
3111
3103
|
// NAMESPACE OBJECT: ./src/util/campaign.js
|
|
3112
3104
|
var campaign_namespaceObject = {};
|
|
3113
3105
|
__webpack_require__.r(campaign_namespaceObject);
|
|
3114
3106
|
__webpack_require__.d(campaign_namespaceObject, {
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3107
|
+
trackAreaClicked: () => (trackAreaClicked),
|
|
3108
|
+
trackExitIntent: () => (trackExitIntent),
|
|
3109
|
+
trackInactivity: () => (trackInactivity),
|
|
3110
|
+
trackScrollingPercentage: () => (trackScrollingPercentage),
|
|
3111
|
+
trackTimeOnPage: () => (trackTimeOnPage)
|
|
3120
3112
|
});
|
|
3121
3113
|
|
|
3122
3114
|
// NAMESPACE OBJECT: ./src/util/order.js
|
|
3123
3115
|
var order_namespaceObject = {};
|
|
3124
3116
|
__webpack_require__.r(order_namespaceObject);
|
|
3125
3117
|
__webpack_require__.d(order_namespaceObject, {
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3118
|
+
calcOrderTotal: () => (calcOrderTotal),
|
|
3119
|
+
displayOrderShippingAddress: () => (displayOrderShippingAddress),
|
|
3120
|
+
getOrderDisplayName: () => (getOrderDisplayName),
|
|
3121
|
+
getProductPropName: () => (getProductPropName)
|
|
3130
3122
|
});
|
|
3131
3123
|
|
|
3132
3124
|
// EXTERNAL MODULE: ./src/util/common.js
|
|
@@ -3286,9 +3278,7 @@ function trackAreaClicked(selector, cb) {
|
|
|
3286
3278
|
on('click', selector, cb);
|
|
3287
3279
|
});
|
|
3288
3280
|
}
|
|
3289
|
-
function trackInactivity() {
|
|
3290
|
-
let seconds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
3291
|
-
let cb = arguments.length > 1 ? arguments[1] : undefined;
|
|
3281
|
+
function trackInactivity(seconds = 0, cb) {
|
|
3292
3282
|
let events = ['scroll', 'keyup', 'keydown', 'mousemove', 'mousewheel', 'mouseenter', 'mouseover', 'mousedown', 'touchstart', 'touchmove', 'touchenter'];
|
|
3293
3283
|
let inactiveSeconds = 0;
|
|
3294
3284
|
let resetTime = () => {
|
|
@@ -3311,9 +3301,7 @@ let timeOnPage = 0;
|
|
|
3311
3301
|
campaign_common.setInterval(() => {
|
|
3312
3302
|
timeOnPage += 5;
|
|
3313
3303
|
}, 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;
|
|
3304
|
+
function trackTimeOnPage(seconds = 0, cb) {
|
|
3317
3305
|
if (seconds < 1) {
|
|
3318
3306
|
return campaign_common.setTimeout(function () {
|
|
3319
3307
|
cb(seconds);
|
|
@@ -3349,8 +3337,7 @@ op.map = order_common.map;
|
|
|
3349
3337
|
op.each = order_common.each;
|
|
3350
3338
|
op.size = order_common.size;
|
|
3351
3339
|
op.find = order_common.find;
|
|
3352
|
-
function getProductPropName(product) {
|
|
3353
|
-
let seperator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ' - ';
|
|
3340
|
+
function getProductPropName(product, seperator = ' - ') {
|
|
3354
3341
|
let options = op.get(product, 'options', []);
|
|
3355
3342
|
let props = op.get(product, 'props', []);
|
|
3356
3343
|
let multiPropsOptions = op.filter(options, option => op.size(option.values) > 1);
|
|
@@ -3361,8 +3348,7 @@ function getProductPropName(product) {
|
|
|
3361
3348
|
});
|
|
3362
3349
|
return names.join(seperator);
|
|
3363
3350
|
}
|
|
3364
|
-
function getOrderDisplayName() {
|
|
3365
|
-
let order = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3351
|
+
function getOrderDisplayName(order = {}) {
|
|
3366
3352
|
return order.number || order.id || '';
|
|
3367
3353
|
}
|
|
3368
3354
|
function displayOrderShippingAddress(order, isShorten) {
|
|
@@ -3472,7 +3458,7 @@ sb = Object.assign(sb, order_namespaceObject);
|
|
|
3472
3458
|
|
|
3473
3459
|
"use strict";
|
|
3474
3460
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3475
|
-
/* harmony export */
|
|
3461
|
+
/* harmony export */ Z: () => (/* binding */ Mutex)
|
|
3476
3462
|
/* harmony export */ });
|
|
3477
3463
|
class Mutex {
|
|
3478
3464
|
constructor() {
|
|
@@ -3507,8 +3493,8 @@ class Mutex {
|
|
|
3507
3493
|
"use strict";
|
|
3508
3494
|
__webpack_require__.r(__webpack_exports__);
|
|
3509
3495
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3510
|
-
/* harmony export */
|
|
3511
|
-
/* harmony export */
|
|
3496
|
+
/* harmony export */ get: () => (/* binding */ get),
|
|
3497
|
+
/* harmony export */ set: () => (/* binding */ set)
|
|
3512
3498
|
/* harmony export */ });
|
|
3513
3499
|
var toStr = Object.prototype.toString;
|
|
3514
3500
|
var isArray = Array.isArray || function (obj) {
|
|
@@ -3566,7 +3552,7 @@ function set(obj, path, value) {
|
|
|
3566
3552
|
|
|
3567
3553
|
"use strict";
|
|
3568
3554
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3569
|
-
/* harmony export */
|
|
3555
|
+
/* harmony export */ Z: () => (/* binding */ Pubsub)
|
|
3570
3556
|
/* harmony export */ });
|
|
3571
3557
|
var {
|
|
3572
3558
|
filter,
|
|
@@ -3578,12 +3564,9 @@ class Pubsub {
|
|
|
3578
3564
|
}
|
|
3579
3565
|
publish(topic, payload, payload2, payload3) {
|
|
3580
3566
|
this.listeners[topic] = filter(this.listeners[topic], sub => sub.obj._isMounted);
|
|
3581
|
-
map(this.listeners[topic],
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
} = _ref;
|
|
3585
|
-
return cb(payload, payload2, payload3);
|
|
3586
|
-
});
|
|
3567
|
+
map(this.listeners[topic], ({
|
|
3568
|
+
cb
|
|
3569
|
+
}) => cb(payload, payload2, payload3));
|
|
3587
3570
|
}
|
|
3588
3571
|
on2(obj, topic, cb) {
|
|
3589
3572
|
if (!this.listeners[topic]) this.listeners[topic] = [];
|
|
@@ -3788,14 +3771,14 @@ class Pubsub {
|
|
|
3788
3771
|
|
|
3789
3772
|
"use strict";
|
|
3790
3773
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3791
|
-
/* harmony export */
|
|
3792
|
-
/* harmony export */
|
|
3793
|
-
/* harmony export */
|
|
3794
|
-
/* harmony export */
|
|
3795
|
-
/* harmony export */
|
|
3774
|
+
/* harmony export */ HY: () => (/* binding */ k),
|
|
3775
|
+
/* harmony export */ Vf: () => (/* binding */ _),
|
|
3776
|
+
/* harmony export */ h: () => (/* binding */ y),
|
|
3777
|
+
/* harmony export */ sY: () => (/* binding */ D),
|
|
3778
|
+
/* harmony export */ wA: () => (/* binding */ b)
|
|
3796
3779
|
/* harmony export */ });
|
|
3797
3780
|
/* 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;
|
|
3781
|
+
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,__h:null,constructor:void 0,__v:null==r?++u:r};return null==r&&null!=l.vnode&&l.vnode(f),f}function _(){return{current:null}}function k(n){return n.children}function b(n,l){this.props=n,this.context=l}function g(n,l){if(null==l)return n.__?g(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?g(n):null}function m(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 m(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,l,u,t,o,r,e,c,s;for(i.sort(f);n=i.shift();)n.__d&&(l=i.length,t=void 0,o=void 0,r=void 0,c=(e=(u=n).__v).__e,(s=u.__P)&&(t=[],o=[],(r=v({},e)).__v=e.__v+1,L(s,e,r,u.__n,void 0!==s.ownerSVGElement,null!=e.__h?[c]:null,t,null==c?g(e):c,e.__h,o),M(t,e,o),e.__e!=c&&m(e)),i.length>l&&i.sort(f));x.__r=0}function P(n,l,u,t,i,o,r,f,e,a,v){var p,y,_,b,m,w,x,P,C,H=0,I=t&&t.__k||s,T=I.length,j=T,z=l.length;for(u.__k=[],p=0;p<z;p++)null!=(b=u.__k[p]=null==(b=l[p])||"boolean"==typeof b||"function"==typeof b?null:"string"==typeof b||"number"==typeof b||"bigint"==typeof b?d(null,b,null,null,b):h(b)?d(k,{children:b},null,null,null):b.__b>0?d(b.type,b.props,b.key,b.ref?b.ref:null,b.__v):b)?(b.__=u,b.__b=u.__b+1,-1===(P=A(b,I,x=p+H,j))?_=c:(_=I[P]||c,I[P]=void 0,j--),L(n,b,_,i,o,r,f,e,a,v),m=b.__e,(y=b.ref)&&_.ref!=y&&(_.ref&&O(_.ref,null,b),v.push(y,b.__c||m,b)),null!=m&&(null==w&&(w=m),(C=_===c||null===_.__v)?-1==P&&H--:P!==x&&(P===x+1?H++:P>x?j>z-x?H+=P-x:H--:H=P<x&&P==x-1?P-x:0),x=p+H,"function"!=typeof b.type||P===x&&_.__k!==b.__k?"function"==typeof b.type||P===x&&!C?void 0!==b.__d?(e=b.__d,b.__d=void 0):e=m.nextSibling:e=S(n,m,e):e=$(b,e,n),"function"==typeof u.type&&(u.__d=e))):(_=I[p])&&null==_.key&&_.__e&&(_.__e==e&&(e=g(_)),q(_,_,!1),I[p]=null);for(u.__e=w,p=T;p--;)null!=I[p]&&("function"==typeof u.type&&null!=I[p].__e&&I[p].__e==u.__d&&(u.__d=I[p].__e.nextSibling),q(I[p],I[p]))}function $(n,l,u){for(var t,i=n.__k,o=0;i&&o<i.length;o++)(t=i[o])&&(t.__=n,l="function"==typeof t.type?$(t,l,u):S(u,t.__e,l));return l}function C(n,l){return l=l||[],null==n||"boolean"==typeof n||(h(n)?n.some(function(n){C(n,l)}):l.push(n)),l}function S(n,l,u){return null==u||u.parentNode!==n?n.insertBefore(l,null):l==u&&null!=l.parentNode||n.insertBefore(l,u),l.nextSibling}function A(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?1:0))for(;r>=0||f<l.length;){if(r>=0){if((e=l[r])&&i==e.key&&o===e.type)return r;r--}if(f<l.length){if((e=l[f])&&i==e.key&&o===e.type)return f;f++}}return-1}function H(n,l,u,t,i){var o;for(o in u)"children"===o||"key"===o||o in l||T(n,o,null,u[o],t);for(o in l)i&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||T(n,o,l[o],u[o],t)}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||n.addEventListener(l,o?z:j,o):n.removeEventListener(l,o?z:j,o);else if("dangerouslySetInnerHTML"!==l){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&&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 j(n){return this.l[n.type+!1](l.event?l.event(n):n)}function z(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,_,g,m,w,x,$,C,S,A,H,I,T=u.type;if(void 0!==u.constructor)return null;null!=t.__h&&(c=t.__h,e=u.__e=t.__e,u.__h=null,r=[e]),(a=l.__b)&&a(u);n:if("function"==typeof T)try{if(w=u.props,x=(a=T.contextType)&&i[a.__c],$=a?x?x.props.value:a.__:i,t.__c?m=(p=u.__c=t.__c).__=p.__E:("prototype"in T&&T.prototype.render?u.__c=p=new T(w,$):(u.__c=p=new b(w,$),p.constructor=T,p.render=B),x&&x.sub(p),p.props=w,p.state||(p.state={}),p.context=$,p.__n=i,y=p.__d=!0,p.__h=[],p._sb=[]),null==p.__s&&(p.__s=p.state),null!=T.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=v({},p.__s)),v(p.__s,T.getDerivedStateFromProps(w,p.__s))),d=p.props,_=p.state,p.__v=u,y)null==T.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(null==T.getDerivedStateFromProps&&w!==d&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(w,$),!p.__e&&(null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(w,p.__s,$)||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)}),C=0;C<p._sb.length;C++)p.__h.push(p._sb[C]);p._sb=[],p.__h.length&&f.push(p);break n}null!=p.componentWillUpdate&&p.componentWillUpdate(w,p.__s,$),null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(d,_,g)})}if(p.context=$,p.props=w,p.__P=n,p.__e=!1,S=l.__r,A=0,"prototype"in T&&T.prototype.render){for(p.state=p.__s,p.__d=!1,S&&S(u),a=p.render(p.props,p.state,p.context),H=0;H<p._sb.length;H++)p.__h.push(p._sb[H]);p._sb=[]}else do{p.__d=!1,S&&S(u),a=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++A<25);p.state=p.__s,null!=p.getChildContext&&(i=v(v({},i),p.getChildContext())),y||null==p.getSnapshotBeforeUpdate||(g=p.getSnapshotBeforeUpdate(d,_)),P(n,h(I=null!=a&&a.type===k&&null==a.key?a.props.children:a)?I:[I],u,t,i,o,r,f,e,c,s),p.base=u.__e,u.__h=null,p.__h.length&&f.push(p),m&&(p.__E=p.__=null)}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l.__e(n,u,t)}else null==r&&u.__v===t.__v?(u.__k=t.__k,u.__e=t.__e):u.__e=N(t.__e,u,t,i,o,r,f,c,s);(a=l.diffed)&&a(u)}function M(n,u,t){for(var i=0;i<t.length;i++)O(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 N(l,u,t,i,o,r,f,e,s){var a,v,y,d=t.props,_=u.props,k=u.type,b=0;if("svg"===k&&(o=!0),null!=r)for(;b<r.length;b++)if((a=r[b])&&"setAttribute"in a==!!k&&(k?a.localName===k:3===a.nodeType)){l=a,r[b]=null;break}if(null==l){if(null===k)return document.createTextNode(_);l=o?document.createElementNS("http://www.w3.org/2000/svg",k):document.createElement(k,_.is&&_),r=null,e=!1}if(null===k)d===_||e&&l.data===_||(l.data=_);else{if(r=r&&n.call(l.childNodes),v=(d=t.props||c).dangerouslySetInnerHTML,y=_.dangerouslySetInnerHTML,!e){if(null!=r)for(d={},b=0;b<l.attributes.length;b++)d[l.attributes[b].name]=l.attributes[b].value;(y||v)&&(y&&(v&&y.__html==v.__html||y.__html===l.innerHTML)||(l.innerHTML=y&&y.__html||""))}if(H(l,_,d,o,e),y)u.__k=[];else if(P(l,h(b=u.props.children)?b:[b],u,t,i,o&&"foreignObject"!==k,r,f,r?r[0]:t.__k&&g(t,0),e,s),null!=r)for(b=r.length;b--;)null!=r[b]&&p(r[b]);e||("value"in _&&void 0!==(b=_.value)&&(b!==l.value||"progress"===k&&!b||"option"===k&&b!==d.value)&&T(l,"value",b,d.value,!1),"checked"in _&&void 0!==(b=_.checked)&&b!==l.checked&&T(l,"checked",b,d.checked,!1))}return l}function O(n,u,t){try{"function"==typeof n?n(u):n.current=u}catch(n){l.__e(n,t)}}function q(n,u,t){var i,o;if(l.unmount&&l.unmount(n),(i=n.ref)&&(i.current&&i.current!==n.__e||O(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]&&q(i[o],u,t||"function"!=typeof n.type);t||null==n.__e||p(n.__e),n.__=n.__e=n.__d=void 0}function B(n,l,u){return this.constructor(n,u)}function D(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(k,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 E(n,l){D(n,l,E)}function F(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 G(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&&void 0===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=k,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
3782
|
//# sourceMappingURL=preact.module.js.map
|
|
3800
3783
|
|
|
3801
3784
|
|
|
@@ -3907,6 +3890,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
3890
|
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
|
3908
3891
|
/******/ }
|
|
3909
3892
|
/******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
|
|
3893
|
+
/******/
|
|
3910
3894
|
/******/ script.src = url;
|
|
3911
3895
|
/******/ }
|
|
3912
3896
|
/******/ inProgress[url] = [done];
|
|
@@ -3919,7 +3903,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
3903
|
/******/ script.parentNode && script.parentNode.removeChild(script);
|
|
3920
3904
|
/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
|
|
3921
3905
|
/******/ if(prev) return prev(event);
|
|
3922
|
-
/******/ }
|
|
3906
|
+
/******/ }
|
|
3923
3907
|
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
|
|
3924
3908
|
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
|
|
3925
3909
|
/******/ script.onload = onScriptComplete.bind(null, script.onload);
|
|
@@ -3988,7 +3972,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
3972
|
/******/ }
|
|
3989
3973
|
/******/ };
|
|
3990
3974
|
/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
|
|
3991
|
-
/******/ }
|
|
3975
|
+
/******/ }
|
|
3992
3976
|
/******/ }
|
|
3993
3977
|
/******/ }
|
|
3994
3978
|
/******/ };
|
|
@@ -4058,10 +4042,10 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
|
|
|
4058
4042
|
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); }
|
|
4059
4043
|
|
|
4060
4044
|
const ajax = __webpack_require__(7460);
|
|
4061
|
-
ajax.env.XMLHttpRequest = util/* default
|
|
4045
|
+
ajax.env.XMLHttpRequest = util/* default */.Z.XMLHttpRequest;
|
|
4062
4046
|
function jsonifyTextPlain(param, done) {
|
|
4063
4047
|
let req = param.request;
|
|
4064
|
-
if (req.content_type === 'text/plain' && req.body !== undefined) req.body = util/* default
|
|
4048
|
+
if (req.content_type === 'text/plain' && req.body !== undefined) req.body = util/* default */.Z.stringify(req.body);
|
|
4065
4049
|
done(true);
|
|
4066
4050
|
}
|
|
4067
4051
|
/* harmony default export */ const api = (class {
|
|
@@ -4078,7 +4062,7 @@ function jsonifyTextPlain(param, done) {
|
|
|
4078
4062
|
source: 'web'
|
|
4079
4063
|
}
|
|
4080
4064
|
};
|
|
4081
|
-
util/* default
|
|
4065
|
+
util/* default */.Z.each(extraData, (v, k) => {
|
|
4082
4066
|
data[k] = v;
|
|
4083
4067
|
});
|
|
4084
4068
|
return this.apireq.post(`/accounts/${this.accid}/conversations`, data);
|
|
@@ -4102,7 +4086,7 @@ function jsonifyTextPlain(param, done) {
|
|
|
4102
4086
|
viewing_product_sku: sku,
|
|
4103
4087
|
viewing_product_source_id: source_id,
|
|
4104
4088
|
viewing_product_id: productid,
|
|
4105
|
-
pinged: util/* default
|
|
4089
|
+
pinged: util/* default */.Z.Date.now(),
|
|
4106
4090
|
is_focused: false
|
|
4107
4091
|
}
|
|
4108
4092
|
}
|
|
@@ -4162,7 +4146,7 @@ function jsonifyTextPlain(param, done) {
|
|
|
4162
4146
|
_defineProperty(this, "suggest_address", keyword => this.apireq.setQuery({
|
|
4163
4147
|
keyword: keyword
|
|
4164
4148
|
}).get(`/accounts/${this.accid}/addresses`));
|
|
4165
|
-
this.refreshLock = new util/* default
|
|
4149
|
+
this.refreshLock = new util/* default */.Z.Mutex();
|
|
4166
4150
|
this.FileURL = FileURL;
|
|
4167
4151
|
this.ApiURL = ApiURL;
|
|
4168
4152
|
this.apireq = ajax.setBaseUrl(ApiURL).withCredentials(true).addQuery('v', '6').setContentType('text/plain').beforeHook(jsonifyTextPlain).setParser('json').beforeHook((param, done) => {
|
|
@@ -4193,15 +4177,15 @@ function jsonifyTextPlain(param, done) {
|
|
|
4193
4177
|
let outuser;
|
|
4194
4178
|
for (let i = 0; true; i++) {
|
|
4195
4179
|
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
|
|
4180
|
+
if (!util/* default */.Z.get(outuser, 'body.id')) {
|
|
4197
4181
|
let sleeptime = Math.min(2000 + i * 200, 60000);
|
|
4198
|
-
await util/* default
|
|
4182
|
+
await util/* default */.Z.sleep(sleeptime);
|
|
4199
4183
|
continue;
|
|
4200
4184
|
}
|
|
4201
4185
|
break;
|
|
4202
4186
|
}
|
|
4203
4187
|
if (outuser.error) {
|
|
4204
|
-
if (util/* default
|
|
4188
|
+
if (util/* default */.Z.get(outuser.body.code)) return {
|
|
4205
4189
|
error: outuser.body.code
|
|
4206
4190
|
};
|
|
4207
4191
|
return outuser;
|
|
@@ -4214,7 +4198,7 @@ function jsonifyTextPlain(param, done) {
|
|
|
4214
4198
|
this.tokensession = this.tokensession || 0;
|
|
4215
4199
|
this.tokensession++;
|
|
4216
4200
|
let tokensession = this.tokensession;
|
|
4217
|
-
if (!this.accid || !util/* default
|
|
4201
|
+
if (!this.accid || !util/* default */.Z.startsWith(this.accid, 'ac')) return {
|
|
4218
4202
|
error: 'invalid_account_id'
|
|
4219
4203
|
};
|
|
4220
4204
|
if (!this.profile_id) return {
|
|
@@ -4230,13 +4214,13 @@ function jsonifyTextPlain(param, done) {
|
|
|
4230
4214
|
this.refreshLock.unlock();
|
|
4231
4215
|
return;
|
|
4232
4216
|
}
|
|
4233
|
-
let age = (util/* default
|
|
4217
|
+
let age = (util/* default */.Z.Date.now() - (this.last_token_at || 0)) / 1000;
|
|
4234
4218
|
if (!force && this.last_token && age < 1800) {
|
|
4235
4219
|
this.refreshLock.unlock();
|
|
4236
4220
|
return this.last_token;
|
|
4237
4221
|
}
|
|
4238
4222
|
if (!force && this.last_token && age < 3000) {
|
|
4239
|
-
if (this.token_generator) util/* default
|
|
4223
|
+
if (this.token_generator) util/* default */.Z.setTimeout(async () => {
|
|
4240
4224
|
let token, err;
|
|
4241
4225
|
try {
|
|
4242
4226
|
token = await tokenGenerator(profile_id);
|
|
@@ -4248,7 +4232,7 @@ function jsonifyTextPlain(param, done) {
|
|
|
4248
4232
|
return;
|
|
4249
4233
|
}
|
|
4250
4234
|
if (err) this.last_token = 'error';else this.last_token = token;
|
|
4251
|
-
this.last_token_at = util/* default
|
|
4235
|
+
this.last_token_at = util/* default */.Z.Date.now();
|
|
4252
4236
|
this.refreshLock.unlock();
|
|
4253
4237
|
});
|
|
4254
4238
|
return this.last_token;
|
|
@@ -4265,7 +4249,7 @@ function jsonifyTextPlain(param, done) {
|
|
|
4265
4249
|
return;
|
|
4266
4250
|
}
|
|
4267
4251
|
if (err) this.last_token = 'error';else this.last_token = token;
|
|
4268
|
-
this.last_token_at = util/* default
|
|
4252
|
+
this.last_token_at = util/* default */.Z.Date.now();
|
|
4269
4253
|
this.refreshLock.unlock();
|
|
4270
4254
|
return this.last_token;
|
|
4271
4255
|
};
|
|
@@ -4274,15 +4258,15 @@ function jsonifyTextPlain(param, done) {
|
|
|
4274
4258
|
await this.token_generator(true);
|
|
4275
4259
|
if (tokensession != this.tokensession) break;
|
|
4276
4260
|
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
|
|
4261
|
+
if (!util/* default */.Z.get(outuser, 'body.id')) {
|
|
4278
4262
|
let sleeptime = Math.min(2000 + i * 100, 120000);
|
|
4279
|
-
await util/* default
|
|
4263
|
+
await util/* default */.Z.sleep(sleeptime);
|
|
4280
4264
|
continue;
|
|
4281
4265
|
}
|
|
4282
4266
|
break;
|
|
4283
4267
|
}
|
|
4284
4268
|
if (outuser.error) {
|
|
4285
|
-
if (util/* default
|
|
4269
|
+
if (util/* default */.Z.get(outuser.body.code)) return {
|
|
4286
4270
|
error: outuser.body.code
|
|
4287
4271
|
};
|
|
4288
4272
|
return outuser;
|
|
@@ -4333,7 +4317,7 @@ api_fake_ajax.env.XMLHttpRequest = window.XMLHttpRequest;
|
|
|
4333
4317
|
const findAnswer = challenge => challenge.answer;
|
|
4334
4318
|
function api_fake_jsonifyTextPlain(param, done) {
|
|
4335
4319
|
let req = param.request;
|
|
4336
|
-
if (req.content_type === 'text/plain' && req.body !== undefined) req.body = util/* default
|
|
4320
|
+
if (req.content_type === 'text/plain' && req.body !== undefined) req.body = util/* default */.Z.stringify(req.body);
|
|
4337
4321
|
done(true);
|
|
4338
4322
|
}
|
|
4339
4323
|
const OK200 = Promise.resolve({
|
|
@@ -4379,7 +4363,7 @@ const OK200 = Promise.resolve({
|
|
|
4379
4363
|
api_fake_defineProperty(this, "getChallenge", accid => OK200);
|
|
4380
4364
|
api_fake_defineProperty(this, "time", _ => Promise.resolve({
|
|
4381
4365
|
code: 200,
|
|
4382
|
-
body: new util/* default
|
|
4366
|
+
body: new util/* default */.Z.Date().toISOString()
|
|
4383
4367
|
}));
|
|
4384
4368
|
api_fake_defineProperty(this, "updateUser", data => OK200);
|
|
4385
4369
|
api_fake_defineProperty(this, "getUser", _ => Promise.resolve({
|
|
@@ -4746,13 +4730,13 @@ var flow = __webpack_require__(3165);
|
|
|
4746
4730
|
|
|
4747
4731
|
|
|
4748
4732
|
|
|
4749
|
-
var Realtime = __webpack_require__(
|
|
4733
|
+
var Realtime = __webpack_require__(608);
|
|
4750
4734
|
var cookie = __webpack_require__(9554);
|
|
4751
4735
|
cookie.defaults.path = '/';
|
|
4752
4736
|
cookie.expiresMultiplier = 60 * 60 * 24;
|
|
4753
4737
|
cookie.defaults.expires = 3650;
|
|
4754
4738
|
const MAX_CONVO = 20;
|
|
4755
|
-
const page_loaded = util/* default
|
|
4739
|
+
const page_loaded = util/* default */.Z.Date.now();
|
|
4756
4740
|
class Store {
|
|
4757
4741
|
constructor(ApiURL, FileURL, RealtimeURL, inmem, fakeapi) {
|
|
4758
4742
|
store_defineProperty(this, "inmem", false);
|
|
@@ -4770,14 +4754,14 @@ class Store {
|
|
|
4770
4754
|
let user = this.matchUser();
|
|
4771
4755
|
let allconvos = this.matchConvo('*');
|
|
4772
4756
|
let unreadcount = 0;
|
|
4773
|
-
util/* default
|
|
4774
|
-
if (!util/* default
|
|
4757
|
+
util/* default */.Z.map(allconvos, convo => {
|
|
4758
|
+
if (!util/* default */.Z.isConvoSeen(convo, user.id)) unreadcount++;
|
|
4775
4759
|
});
|
|
4776
4760
|
return unreadcount;
|
|
4777
4761
|
});
|
|
4778
4762
|
store_defineProperty(this, "matchPlugin", () => {
|
|
4779
|
-
if (util/* default
|
|
4780
|
-
return util/* default
|
|
4763
|
+
if (util/* default */.Z.size(this.forcePlugins) > 0) return util/* default */.Z.cloneDeep(this.forcePlugins);
|
|
4764
|
+
return util/* default */.Z.cloneDeep(this.cache.match('plugin')) || {};
|
|
4781
4765
|
});
|
|
4782
4766
|
store_defineProperty(this, "device", {});
|
|
4783
4767
|
store_defineProperty(this, "browserVisibility", 'visible');
|
|
@@ -4790,7 +4774,7 @@ class Store {
|
|
|
4790
4774
|
if (!id) return;
|
|
4791
4775
|
if (id === '*') {
|
|
4792
4776
|
this._touchAcc();
|
|
4793
|
-
return util/* default
|
|
4777
|
+
return util/* default */.Z.filter(this.cache.all(), (value, k) => k.startsWith('convo_'));
|
|
4794
4778
|
}
|
|
4795
4779
|
if (!this.isInsync(id)) this.fetchConvo(id);
|
|
4796
4780
|
return this.cache.match('convo_' + id);
|
|
@@ -4813,7 +4797,7 @@ class Store {
|
|
|
4813
4797
|
store_defineProperty(this, "listEvents", id => {
|
|
4814
4798
|
if (!id || id === '*' || typeof id !== 'string') return;
|
|
4815
4799
|
if (!this.isInsync('events' + id)) {
|
|
4816
|
-
util/* default
|
|
4800
|
+
util/* default */.Z.setTimeout(async () => {
|
|
4817
4801
|
await this.readyGate.entry();
|
|
4818
4802
|
await this.reconnectGate.entry(undefined, true);
|
|
4819
4803
|
if (this.isInsync('events' + id)) return this.reconnectGate.open();
|
|
@@ -4836,10 +4820,10 @@ class Store {
|
|
|
4836
4820
|
});
|
|
4837
4821
|
store_defineProperty(this, "matchLocation", () => this.cache.match('location') || {});
|
|
4838
4822
|
store_defineProperty(this, "matchBot", () => this.cache.match('bot') || {});
|
|
4839
|
-
store_defineProperty(this, "readyGate", new util/* default
|
|
4840
|
-
store_defineProperty(this, "convoGate", new util/* default
|
|
4841
|
-
store_defineProperty(this, "reconnectGate", new util/* default
|
|
4842
|
-
store_defineProperty(this, "wsGate", new util/* default
|
|
4823
|
+
store_defineProperty(this, "readyGate", new util/* default */.Z.Gate());
|
|
4824
|
+
store_defineProperty(this, "convoGate", new util/* default */.Z.Gate(true));
|
|
4825
|
+
store_defineProperty(this, "reconnectGate", new util/* default */.Z.Gate(true));
|
|
4826
|
+
store_defineProperty(this, "wsGate", new util/* default */.Z.Gate(true));
|
|
4843
4827
|
store_defineProperty(this, "matchLastview", () => {
|
|
4844
4828
|
let lastView = this.kv.match('lastview') || {};
|
|
4845
4829
|
let user = this.cache.match('user') || {};
|
|
@@ -4850,10 +4834,10 @@ class Store {
|
|
|
4850
4834
|
store_defineProperty(this, "matchIsOpen", () => !!this.kv.match('isopen'));
|
|
4851
4835
|
store_defineProperty(this, "matchHasManuallyClosed", () => !!this.kv.match('hasManuallyClosed'));
|
|
4852
4836
|
store_defineProperty(this, "matchClosePreviewAt", () => this.kv.match('close_preview_at') || 0);
|
|
4853
|
-
store_defineProperty(this, "sendPresence", util/* default
|
|
4837
|
+
store_defineProperty(this, "sendPresence", util/* default */.Z.throttle(async () => {
|
|
4854
4838
|
await this.readyGate.entry();
|
|
4855
|
-
if (!util/* default
|
|
4856
|
-
if (util/* default
|
|
4839
|
+
if (!util/* default */.Z.get(this.cache.match('user'), 'id')) return;
|
|
4840
|
+
if (util/* default */.Z.isUserBanned(this.cache.match('user'))) return;
|
|
4857
4841
|
let hasfocus = this.browserVisibility === 'visible' && document.hasFocus();
|
|
4858
4842
|
if (!hasfocus) {
|
|
4859
4843
|
this.api.sendLostFocus(this.device, this._currentViewingProduct.id, this._currentViewingProduct.source_id, this._currentViewingProduct.sku);
|
|
@@ -4863,10 +4847,10 @@ class Store {
|
|
|
4863
4847
|
}, 1000, {
|
|
4864
4848
|
leading: false
|
|
4865
4849
|
}));
|
|
4866
|
-
store_defineProperty(this, "now", () => util/* default
|
|
4850
|
+
store_defineProperty(this, "now", () => util/* default */.Z.Date.now() + this.timeDiff);
|
|
4867
4851
|
store_defineProperty(this, "seenQueue", []);
|
|
4868
4852
|
store_defineProperty(this, "matchTrafficSource", () => this.kv.match('traffic_source'));
|
|
4869
|
-
store_defineProperty(this, "_typing", util/* default
|
|
4853
|
+
store_defineProperty(this, "_typing", util/* default */.Z.throttle(convoid => this.api.sendTyping(convoid), 3000, {
|
|
4870
4854
|
trailing: false
|
|
4871
4855
|
}));
|
|
4872
4856
|
store_defineProperty(this, "onConvoEvent", (o, cb) => this.pubsub.on2(o, 'events', cb));
|
|
@@ -4885,7 +4869,7 @@ class Store {
|
|
|
4885
4869
|
sendEventToThirdParty('SUBIZ Chat', 'Opened', 'Subiz Windows');
|
|
4886
4870
|
}
|
|
4887
4871
|
});
|
|
4888
|
-
store_defineProperty(this, "closePreview", () => this.kv.put('close_preview_at', new util/* default
|
|
4872
|
+
store_defineProperty(this, "closePreview", () => this.kv.put('close_preview_at', new util/* default */.Z.Date().getTime()));
|
|
4889
4873
|
store_defineProperty(this, "setLastview", (view, opts) => {
|
|
4890
4874
|
let user = this.cache.match('user') || {};
|
|
4891
4875
|
if (!user.id) return;
|
|
@@ -4918,7 +4902,7 @@ class Store {
|
|
|
4918
4902
|
this.cookie = inmemCookie;
|
|
4919
4903
|
}
|
|
4920
4904
|
cleanLocalStorage();
|
|
4921
|
-
this.pubsub = new util/* default
|
|
4905
|
+
this.pubsub = new util/* default */.Z.Pubsub();
|
|
4922
4906
|
this.kv = new storage.kv(new storage.lsdb('sbz2023', this.inmem), 'kv');
|
|
4923
4907
|
this.cache = new storage.kv(new storage.lsdb('sbz2023', true), 'kv');
|
|
4924
4908
|
this.chain = new storage.chain(new storage.lsdb('cbz2023', true), 'ch');
|
|
@@ -4926,23 +4910,23 @@ class Store {
|
|
|
4926
4910
|
this.g_haveSentSeenM = {};
|
|
4927
4911
|
window.addEventListener('blur', () => this.sendPresence());
|
|
4928
4912
|
window.addEventListener('focus', () => this.sendPresence());
|
|
4929
|
-
util/* default
|
|
4930
|
-
util/* default
|
|
4913
|
+
util/* default */.Z.setInterval(() => this.browserVisibility === 'visible' && document.hasFocus() && this.sendPresence(), 20000);
|
|
4914
|
+
util/* default */.Z.setInterval(() => (this.browserVisibility !== 'visible' || document.hasFocus()) && this.sendPresence(), 60000);
|
|
4931
4915
|
onVisibilityChange(val => {
|
|
4932
4916
|
this.browserVisibility = val;
|
|
4933
4917
|
this.sendPresence();
|
|
4934
4918
|
});
|
|
4935
4919
|
this.loopTime();
|
|
4936
4920
|
this.device = this.getDeviceInfo();
|
|
4937
|
-
const _gaInterval = util/* default
|
|
4921
|
+
const _gaInterval = util/* default */.Z.setInterval(() => {
|
|
4938
4922
|
let user = this.cache.match('user') || {};
|
|
4939
4923
|
if (!user.id) return;
|
|
4940
4924
|
var dev = this.getDeviceInfo();
|
|
4941
4925
|
if (!dev.ga_tracking_ids || !dev.ga_client_id) return;
|
|
4942
|
-
util/* default
|
|
4926
|
+
util/* default */.Z.clearInterval(_gaInterval);
|
|
4943
4927
|
this.device = dev;
|
|
4944
4928
|
let ga_client_id = dev.ga_client_id;
|
|
4945
|
-
if (ga_client_id !== util/* default
|
|
4929
|
+
if (ga_client_id !== util/* default */.Z.getUserAttr(user, 'ga_client_id', 'text')) {
|
|
4946
4930
|
this.setUser({
|
|
4947
4931
|
attributes: [{
|
|
4948
4932
|
type: 'text',
|
|
@@ -4963,10 +4947,10 @@ class Store {
|
|
|
4963
4947
|
if (p.sku) this._currentViewingProduct.sku = (p.sku + '').trim();
|
|
4964
4948
|
}
|
|
4965
4949
|
getLinkedProduct() {
|
|
4966
|
-
return util/* default
|
|
4950
|
+
return util/* default */.Z.cloneDeep(this._currentViewingProduct);
|
|
4967
4951
|
}
|
|
4968
4952
|
isInsync(key) {
|
|
4969
|
-
return util/* default
|
|
4953
|
+
return util/* default */.Z.Date.now() - (this.g_sync[key] || 0) < 600000;
|
|
4970
4954
|
}
|
|
4971
4955
|
async fetchShippingAddresses() {
|
|
4972
4956
|
let out = await this.api.fetchShippingAddresses();
|
|
@@ -4983,7 +4967,7 @@ class Store {
|
|
|
4983
4967
|
return this.api.createShippingAddress(addr);
|
|
4984
4968
|
}
|
|
4985
4969
|
async overrideAcc(acc) {
|
|
4986
|
-
this.forceAcc = util/* default
|
|
4970
|
+
this.forceAcc = util/* default */.Z.cloneDeep(acc);
|
|
4987
4971
|
await this.readyGate.entry();
|
|
4988
4972
|
this.disconnect('account');
|
|
4989
4973
|
this.reconnect();
|
|
@@ -4993,7 +4977,7 @@ class Store {
|
|
|
4993
4977
|
await this.readyGate.entry();
|
|
4994
4978
|
this.disconnect('account');
|
|
4995
4979
|
await this.reconnect();
|
|
4996
|
-
util/* default
|
|
4980
|
+
util/* default */.Z.setTimeout(this.pubsub.publish('resetCSS'), 10);
|
|
4997
4981
|
}
|
|
4998
4982
|
getDeviceInfo() {
|
|
4999
4983
|
let device = {
|
|
@@ -5038,7 +5022,7 @@ class Store {
|
|
|
5038
5022
|
overridePlugin(plugins) {
|
|
5039
5023
|
if (!Array.isArray(plugins)) throw 'plugins must be be an array';
|
|
5040
5024
|
let pluginM = {};
|
|
5041
|
-
util/* default
|
|
5025
|
+
util/* default */.Z.map(plugins, function (plugin) {
|
|
5042
5026
|
pluginM[plugin.id] = plugin;
|
|
5043
5027
|
});
|
|
5044
5028
|
this.forcePlugins = pluginM;
|
|
@@ -5046,7 +5030,7 @@ class Store {
|
|
|
5046
5030
|
this.pubsub.publish('resetCSS');
|
|
5047
5031
|
}
|
|
5048
5032
|
markSync(key) {
|
|
5049
|
-
this.g_sync[key] = util/* default
|
|
5033
|
+
this.g_sync[key] = util/* default */.Z.Date.now();
|
|
5050
5034
|
}
|
|
5051
5035
|
async _touchAcc() {
|
|
5052
5036
|
if (this.isInsync('account')) return;
|
|
@@ -5070,13 +5054,13 @@ class Store {
|
|
|
5070
5054
|
if (mask) {
|
|
5071
5055
|
let parts = mask.split('@');
|
|
5072
5056
|
if (parts[0] != accid) {
|
|
5073
|
-
userRef = util/* default
|
|
5057
|
+
userRef = util/* default */.Z.randomString(40);
|
|
5074
5058
|
this.new_visitor = true;
|
|
5075
5059
|
}
|
|
5076
5060
|
this.new_visitor = false;
|
|
5077
5061
|
this.cookie.set('__sbmask', mask);
|
|
5078
5062
|
} else {
|
|
5079
|
-
userRef = util/* default
|
|
5063
|
+
userRef = util/* default */.Z.randomString(40);
|
|
5080
5064
|
this.new_visitor = true;
|
|
5081
5065
|
}
|
|
5082
5066
|
}
|
|
@@ -5139,22 +5123,22 @@ class Store {
|
|
|
5139
5123
|
}
|
|
5140
5124
|
seenLoop() {
|
|
5141
5125
|
this.seenQueue = [];
|
|
5142
|
-
util/* default
|
|
5143
|
-
this._seenInterval = util/* default
|
|
5126
|
+
util/* default */.Z.clearInterval(this._seenInterval);
|
|
5127
|
+
this._seenInterval = util/* default */.Z.setInterval(() => {
|
|
5144
5128
|
this.seenQueue = [...new Set(this.seenQueue)];
|
|
5145
5129
|
let user = this.cache.match('user') || {};
|
|
5146
|
-
util/* default
|
|
5130
|
+
util/* default */.Z.map(this.seenQueue, id => {
|
|
5147
5131
|
var events = this.listEvents(id);
|
|
5148
5132
|
if (!events) return;
|
|
5149
|
-
if (util/* default
|
|
5150
|
-
events = util/* default
|
|
5151
|
-
var lastmsgsent = events[util/* default
|
|
5133
|
+
if (util/* default */.Z.size(events) === 0) return;
|
|
5134
|
+
events = util/* default */.Z.filter(events, ev => ev.type === 'message_sent');
|
|
5135
|
+
var lastmsgsent = events[util/* default */.Z.size(events) - 1];
|
|
5152
5136
|
if (!lastmsgsent) return;
|
|
5153
5137
|
if (this.g_haveSentSeenM[lastmsgsent.id]) return;
|
|
5154
|
-
if (lastmsgsent.id === util/* default
|
|
5138
|
+
if (lastmsgsent.id === util/* default */.Z.getMsgField(lastmsgsent, 'idempotency')) return;
|
|
5155
5139
|
this.api.markAsSeen(id, lastmsgsent.id);
|
|
5156
5140
|
let convo = this.cache.match('convo_' + id) || {};
|
|
5157
|
-
let mem = util/* default
|
|
5141
|
+
let mem = util/* default */.Z.find(convo.members, m => m.id === user.id);
|
|
5158
5142
|
if (mem) mem.seen_at = Date.now();
|
|
5159
5143
|
this._setConvo(convo);
|
|
5160
5144
|
this.g_haveSentSeenM[lastmsgsent.id] = true;
|
|
@@ -5174,7 +5158,7 @@ class Store {
|
|
|
5174
5158
|
if (this.isInsync('account')) return this.reconnectGate.open();
|
|
5175
5159
|
this.markSync('account');
|
|
5176
5160
|
let outs = await Promise.all([this.api.getUser(), this.api.getAccountSetting(), this.api.getIsOnline()]);
|
|
5177
|
-
let error = util/* default
|
|
5161
|
+
let error = util/* default */.Z.find(outs, out => out.error);
|
|
5178
5162
|
if (error) return console.error(error);
|
|
5179
5163
|
let set = Object.assign(outs[1].body, outs[2].body);
|
|
5180
5164
|
set.user = outs[0].body;
|
|
@@ -5183,13 +5167,13 @@ class Store {
|
|
|
5183
5167
|
error = convob.error;
|
|
5184
5168
|
let body = convob.body;
|
|
5185
5169
|
if (!error) {
|
|
5186
|
-
let convos = util/* default
|
|
5187
|
-
util/* default
|
|
5170
|
+
let convos = util/* default */.Z.get(body, 'conversations', []);
|
|
5171
|
+
util/* default */.Z.map(this.cache.all(), (value, k) => {
|
|
5188
5172
|
if (k.startsWith('convo_')) {
|
|
5189
|
-
if (this.now() - util/* default
|
|
5173
|
+
if (this.now() - util/* default */.Z.getMs(util/* default */.Z.get(value, 'actived')) > 1209600000) this.cache.del(k);
|
|
5190
5174
|
}
|
|
5191
5175
|
});
|
|
5192
|
-
util/* default
|
|
5176
|
+
util/* default */.Z.map(convos, convo => this._setConvo(convo));
|
|
5193
5177
|
}
|
|
5194
5178
|
return this.reconnectGate.open();
|
|
5195
5179
|
}
|
|
@@ -5208,13 +5192,13 @@ class Store {
|
|
|
5208
5192
|
}
|
|
5209
5193
|
}
|
|
5210
5194
|
_setUser(user) {
|
|
5211
|
-
user = util/* default
|
|
5195
|
+
user = util/* default */.Z.cloneDeep(user);
|
|
5212
5196
|
let olduser = this.cache.match('user') || {};
|
|
5213
5197
|
var accid = olduser.account_id || user.account_id;
|
|
5214
5198
|
var id = olduser.id || user.id;
|
|
5215
|
-
util/* default
|
|
5199
|
+
util/* default */.Z.each(user.attributes, newattr => {
|
|
5216
5200
|
if (!newattr) return;
|
|
5217
|
-
olduser.attributes = util/* default
|
|
5201
|
+
olduser.attributes = util/* default */.Z.filter(olduser.attributes, oldattr => {
|
|
5218
5202
|
if (!oldattr) return false;
|
|
5219
5203
|
return oldattr.key !== newattr.key;
|
|
5220
5204
|
});
|
|
@@ -5232,7 +5216,7 @@ class Store {
|
|
|
5232
5216
|
return this._setSetting(setting);
|
|
5233
5217
|
}
|
|
5234
5218
|
async _setSetting(setting) {
|
|
5235
|
-
setting = util/* default
|
|
5219
|
+
setting = util/* default */.Z.cloneDeep(setting) || {};
|
|
5236
5220
|
setting.account = Object.assign({}, setting.account, this.forceAcc);
|
|
5237
5221
|
if (!setting.account.logo_url) {
|
|
5238
5222
|
setting.account.logo_url = 'https://file-subiz.com/fiqpezhkmeyesdscyetk-default_logo.jpg';
|
|
@@ -5248,39 +5232,39 @@ class Store {
|
|
|
5248
5232
|
this.cache.put('account', setting.account);
|
|
5249
5233
|
delete setting.account;
|
|
5250
5234
|
}
|
|
5251
|
-
let location = util/* default
|
|
5235
|
+
let location = util/* default */.Z.get(setting, 'location', []);
|
|
5252
5236
|
this.cache.put('location', location);
|
|
5253
|
-
let bots = util/* default
|
|
5237
|
+
let bots = util/* default */.Z.get(setting, 'bots', []);
|
|
5254
5238
|
let botM = {};
|
|
5255
|
-
util/* default
|
|
5239
|
+
util/* default */.Z.map(bots, bot => {
|
|
5256
5240
|
botM[bot.id] = bot;
|
|
5257
5241
|
});
|
|
5258
5242
|
this.cache.put('bot', botM);
|
|
5259
|
-
let plugins = util/* default
|
|
5243
|
+
let plugins = util/* default */.Z.get(setting, 'plugins', []);
|
|
5260
5244
|
let pluginM = {};
|
|
5261
|
-
util/* default
|
|
5245
|
+
util/* default */.Z.map(plugins, plugin => {
|
|
5262
5246
|
if (plugin.type === 'chatbox') {
|
|
5263
|
-
plugin = util/* default
|
|
5247
|
+
plugin = util/* default */.Z.merge(plugin, this.forceChatbox);
|
|
5264
5248
|
}
|
|
5265
5249
|
pluginM[plugin.id] = plugin;
|
|
5266
5250
|
});
|
|
5267
5251
|
this.cache.put('plugin', pluginM);
|
|
5268
|
-
var agents = util/* default
|
|
5269
|
-
if (util/* default
|
|
5252
|
+
var agents = util/* default */.Z.get(setting, 'agents', []);
|
|
5253
|
+
if (util/* default */.Z.size(agents) > 0) {
|
|
5270
5254
|
let agentM = {};
|
|
5271
5255
|
this.api.setAgentId(agents[0].id);
|
|
5272
|
-
util/* default
|
|
5256
|
+
util/* default */.Z.map(agents, agent => {
|
|
5273
5257
|
agentM[agent.id] = agent;
|
|
5274
5258
|
});
|
|
5275
5259
|
this.cache.put('agent', agentM);
|
|
5276
5260
|
}
|
|
5277
|
-
let pms = util/* default
|
|
5261
|
+
let pms = util/* default */.Z.get(setting, 'payment_methods', []);
|
|
5278
5262
|
this.cache.put('payment_methods', pms);
|
|
5279
5263
|
this.pubsub.publish('account');
|
|
5280
5264
|
}
|
|
5281
5265
|
async track() {
|
|
5282
5266
|
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
|
|
5267
|
+
let traffic_source = util/* default */.Z.get(out, 'body.by.device.source', '');
|
|
5284
5268
|
if (traffic_source) this.kv.put('traffic_source', traffic_source);
|
|
5285
5269
|
}
|
|
5286
5270
|
async onWs(ev) {
|
|
@@ -5291,16 +5275,16 @@ class Store {
|
|
|
5291
5275
|
}
|
|
5292
5276
|
async _onWs(ev) {
|
|
5293
5277
|
if (!ev || !ev.type) return;
|
|
5294
|
-
ev.created = util/* default
|
|
5278
|
+
ev.created = util/* default */.Z.getMs(ev.created);
|
|
5295
5279
|
if (ev.type === 'user_info_updated') {
|
|
5296
|
-
let user = util/* default
|
|
5297
|
-
let attrs = util/* default
|
|
5298
|
-
util/* default
|
|
5280
|
+
let user = util/* default */.Z.cloneDeep(this.cache.match('user'));
|
|
5281
|
+
let attrs = util/* default */.Z.get(ev, 'data.user.attributes') || [];
|
|
5282
|
+
util/* default */.Z.map(attrs, attr => util/* default */.Z.setUserAttr(user, attr));
|
|
5299
5283
|
this._setUser(user);
|
|
5300
5284
|
return;
|
|
5301
5285
|
}
|
|
5302
5286
|
let user = this.cache.match('user') || {};
|
|
5303
|
-
let cid = util/* default
|
|
5287
|
+
let cid = util/* default */.Z.convoOfEv(ev);
|
|
5304
5288
|
let convo;
|
|
5305
5289
|
let alreadyFetched = false;
|
|
5306
5290
|
if (cid) {
|
|
@@ -5317,12 +5301,12 @@ class Store {
|
|
|
5317
5301
|
}
|
|
5318
5302
|
}
|
|
5319
5303
|
if (!convo) return;
|
|
5320
|
-
let channel = util/* default
|
|
5304
|
+
let channel = util/* default */.Z.get(ev, 'touchpoint.channel', '');
|
|
5321
5305
|
if (channel && channel != 'subiz') return;
|
|
5322
5306
|
this.pubsub.publish('events', ev);
|
|
5323
5307
|
if (ev.type === 'conversation_joined') {
|
|
5324
|
-
let members = util/* default
|
|
5325
|
-
let me = util/* default
|
|
5308
|
+
let members = util/* default */.Z.get(ev, 'data.conversation.members', []);
|
|
5309
|
+
let me = util/* default */.Z.find(members, m => m.id === this.cache.match('user').id);
|
|
5326
5310
|
if (me) {
|
|
5327
5311
|
await this.chain.reload(cid, (type, anchor, limit) => this.listmessageapi(type, anchor, limit));
|
|
5328
5312
|
this.markSync('events' + cid);
|
|
@@ -5339,13 +5323,13 @@ class Store {
|
|
|
5339
5323
|
}
|
|
5340
5324
|
}
|
|
5341
5325
|
if (ev.type === 'message_sent') {
|
|
5342
|
-
if (util/* default
|
|
5326
|
+
if (util/* default */.Z.get(ev, 'by.id') !== user.id) {
|
|
5343
5327
|
this.api.markAsReceived(cid, ev.id);
|
|
5344
5328
|
}
|
|
5345
5329
|
}
|
|
5346
|
-
if (util/* default
|
|
5330
|
+
if (util/* default */.Z.startsWith(ev.type, 'message_') || util/* default */.Z.startsWith(ev.type, 'conversation_')) {
|
|
5347
5331
|
this.restConvoEvent(ev);
|
|
5348
|
-
if (ev.type === 'message_sent' && util/* default
|
|
5332
|
+
if (ev.type === 'message_sent' && util/* default */.Z.get(ev, 'by.id') !== user.id) {
|
|
5349
5333
|
sendEventToThirdParty('SUBIZ Chat', 'Received', 'User');
|
|
5350
5334
|
}
|
|
5351
5335
|
return;
|
|
@@ -5353,36 +5337,36 @@ class Store {
|
|
|
5353
5337
|
}
|
|
5354
5338
|
async restConvoEvent(ev) {
|
|
5355
5339
|
let user = this.cache.match('user');
|
|
5356
|
-
let cid = util/* default
|
|
5340
|
+
let cid = util/* default */.Z.convoOfEv(ev);
|
|
5357
5341
|
let convo = this.cache.match('convo_' + cid) || {};
|
|
5358
5342
|
if (ev.type === 'conversation_state_updated') {
|
|
5359
|
-
if (!util/* default
|
|
5343
|
+
if (!util/* default */.Z.get(convo, 'id')) {
|
|
5360
5344
|
let {
|
|
5361
5345
|
body: convo,
|
|
5362
5346
|
error
|
|
5363
5347
|
} = await this.api.getConversation(cid);
|
|
5364
5348
|
if (error) return;
|
|
5365
5349
|
}
|
|
5366
|
-
convo = Object.assign(convo, util/* default
|
|
5350
|
+
convo = Object.assign(convo, util/* default */.Z.get(ev, 'data.conversation'));
|
|
5367
5351
|
}
|
|
5368
5352
|
if (ev.type === 'message_pong') {
|
|
5369
|
-
var msgid = util/* default
|
|
5353
|
+
var msgid = util/* default */.Z.get(ev, 'data.message.id');
|
|
5370
5354
|
var oldev = this.chain.match(cid, msgid);
|
|
5371
|
-
if (!util/* default
|
|
5372
|
-
var pongs = util/* default
|
|
5373
|
-
pongs = pongs.concat(util/* default
|
|
5355
|
+
if (!util/* default */.Z.get(oldev, 'data.message')) return;
|
|
5356
|
+
var pongs = util/* default */.Z.get(oldev, 'data.message.pongs', []);
|
|
5357
|
+
pongs = pongs.concat(util/* default */.Z.get(ev, 'data.message.pongs', []));
|
|
5374
5358
|
oldev.data.message.pongs = pongs;
|
|
5375
|
-
util/* default
|
|
5359
|
+
util/* default */.Z.map(pongs, pong => {
|
|
5376
5360
|
if (pong.member_id == user.id && pong.type === 'seen') {
|
|
5377
|
-
let mem = util/* default
|
|
5361
|
+
let mem = util/* default */.Z.find(convo.members, mem => mem.id === user.id);
|
|
5378
5362
|
if (mem) mem.seen_at = pong.created;
|
|
5379
5363
|
}
|
|
5380
5364
|
});
|
|
5381
|
-
this.chain.put(cid, oldev.id, util/* default
|
|
5365
|
+
this.chain.put(cid, oldev.id, util/* default */.Z.getMs(oldev.created), oldev);
|
|
5382
5366
|
}
|
|
5383
5367
|
if (ev.type === 'message_sent') {
|
|
5384
|
-
let idemkey = util/* default
|
|
5385
|
-
let found = util/* default
|
|
5368
|
+
let idemkey = util/* default */.Z.getMsgField(ev, 'idempotency');
|
|
5369
|
+
let found = util/* default */.Z.find(this.listEvents(cid), oldev => oldev.id === idemkey);
|
|
5386
5370
|
if (found) {
|
|
5387
5371
|
this.chain.del(cid, found.id);
|
|
5388
5372
|
ev.created = found.created;
|
|
@@ -5390,7 +5374,7 @@ class Store {
|
|
|
5390
5374
|
convo.last_message_sent = ev;
|
|
5391
5375
|
}
|
|
5392
5376
|
if (ev.type !== 'message_pong' && ev.type !== 'conversation_typing') {
|
|
5393
|
-
this.chain.put(cid, ev.id, util/* default
|
|
5377
|
+
this.chain.put(cid, ev.id, util/* default */.Z.getMs(ev.created), ev);
|
|
5394
5378
|
}
|
|
5395
5379
|
this._setConvo(convo);
|
|
5396
5380
|
this.pubsub.publish('account');
|
|
@@ -5398,31 +5382,31 @@ class Store {
|
|
|
5398
5382
|
handleFormSubmit(convoKey, ev) {
|
|
5399
5383
|
if (ev.type !== 'message_sent') return;
|
|
5400
5384
|
let formSubmits = [];
|
|
5401
|
-
let attachments = util/* default
|
|
5402
|
-
util/* default
|
|
5385
|
+
let attachments = util/* default */.Z.get(ev, 'data.message.attachments') || [];
|
|
5386
|
+
util/* default */.Z.each(attachments, att => {
|
|
5403
5387
|
if (!att) return;
|
|
5404
5388
|
if (att.type !== 'form_submit') return;
|
|
5405
5389
|
formSubmits.push(att.form_submit);
|
|
5406
5390
|
});
|
|
5407
|
-
util/* default
|
|
5408
|
-
let formev = util/* default
|
|
5391
|
+
util/* default */.Z.each(formSubmits, submit => {
|
|
5392
|
+
let formev = util/* default */.Z.get(this.convoEventM, convoKey + '.' + submit.form_message_id);
|
|
5409
5393
|
if (!formev) return;
|
|
5410
|
-
let forms = util/* default
|
|
5394
|
+
let forms = util/* default */.Z.filter(util/* default */.Z.get(formev, 'data.message.attachments'), att => {
|
|
5411
5395
|
if (!att) return false;
|
|
5412
5396
|
if (att.type !== 'form' && att.type !== 'ask_info_form') return false;
|
|
5413
5397
|
return true;
|
|
5414
5398
|
});
|
|
5415
|
-
util/* default
|
|
5399
|
+
util/* default */.Z.each(forms, form => {
|
|
5416
5400
|
form = form.form;
|
|
5417
|
-
util/* default
|
|
5418
|
-
util/* default
|
|
5401
|
+
util/* default */.Z.each(form.fields, formfield => {
|
|
5402
|
+
util/* default */.Z.each(submit.fields, submitfield => {
|
|
5419
5403
|
if (formfield.name !== submitfield.name) return;
|
|
5420
5404
|
if (formfield.default_answer) return;
|
|
5421
5405
|
formfield.default_answer = submitfield.value;
|
|
5422
5406
|
});
|
|
5423
5407
|
});
|
|
5424
5408
|
});
|
|
5425
|
-
if (util/* default
|
|
5409
|
+
if (util/* default */.Z.size(forms) > 0) this.pubsub.publish('state.convoEventM', this.convoEventM, convoKey);
|
|
5426
5410
|
});
|
|
5427
5411
|
}
|
|
5428
5412
|
typing(cid) {
|
|
@@ -5457,7 +5441,7 @@ class Store {
|
|
|
5457
5441
|
}
|
|
5458
5442
|
async sendConvoEvent(cid, type, data) {
|
|
5459
5443
|
await this.readyGate.entry();
|
|
5460
|
-
var idempotency = util/* default
|
|
5444
|
+
var idempotency = util/* default */.Z.randomString(36);
|
|
5461
5445
|
let user = this.cache.match('user') || {};
|
|
5462
5446
|
var event = {
|
|
5463
5447
|
id: idempotency,
|
|
@@ -5470,10 +5454,10 @@ class Store {
|
|
|
5470
5454
|
type,
|
|
5471
5455
|
created: this.now()
|
|
5472
5456
|
};
|
|
5473
|
-
util/* default
|
|
5457
|
+
util/* default */.Z.convoToEv(cid, event);
|
|
5474
5458
|
let files = [];
|
|
5475
5459
|
if (type === 'message_sent') {
|
|
5476
|
-
util/* default
|
|
5460
|
+
util/* default */.Z.setMsgField(event, 'idempotency', idempotency);
|
|
5477
5461
|
event.data.message.conversation_id = cid;
|
|
5478
5462
|
await flow.map(event.data.message.attachments, 2, async (att, i) => {
|
|
5479
5463
|
if (att.type !== 'file') return;
|
|
@@ -5492,7 +5476,7 @@ class Store {
|
|
|
5492
5476
|
url,
|
|
5493
5477
|
error
|
|
5494
5478
|
} = await this.api.uploadToS3(att._file);
|
|
5495
|
-
if (util/* default
|
|
5479
|
+
if (util/* default */.Z.get(body, 'code') == 'invalid_field_size') {
|
|
5496
5480
|
event._error_message = 'cannot_send_too_big_file';
|
|
5497
5481
|
}
|
|
5498
5482
|
event._error = error;
|
|
@@ -5520,23 +5504,23 @@ class Store {
|
|
|
5520
5504
|
first_interaction: 1
|
|
5521
5505
|
});
|
|
5522
5506
|
}
|
|
5523
|
-
this.kv.put('last_msg_sent', util/* default
|
|
5507
|
+
this.kv.put('last_msg_sent', util/* default */.Z.Date.now());
|
|
5524
5508
|
return ret;
|
|
5525
5509
|
}
|
|
5526
5510
|
_setConvo(convo) {
|
|
5527
5511
|
let count = 0;
|
|
5528
5512
|
let user = this.cache.match('user');
|
|
5529
|
-
let channel = util/* default
|
|
5513
|
+
let channel = util/* default */.Z.get(convo, 'touchpoint.channel', '');
|
|
5530
5514
|
if (channel && channel != 'subiz') return;
|
|
5531
5515
|
let allconvo = {};
|
|
5532
|
-
util/* default
|
|
5516
|
+
util/* default */.Z.map(this.cache.all(), (value, key) => {
|
|
5533
5517
|
if (key.startsWith('convo_')) {
|
|
5534
5518
|
allconvo[key] = value;
|
|
5535
5519
|
}
|
|
5536
5520
|
});
|
|
5537
|
-
if (util/* default
|
|
5538
|
-
allconvo = util/* default
|
|
5539
|
-
for (var i = MAX_CONVO - 2; i < util/* default
|
|
5521
|
+
if (util/* default */.Z.size(allconvo) > MAX_CONVO - 2) {
|
|
5522
|
+
allconvo = util/* default */.Z.orderBy(util/* default */.Z.map(allconvo), 'created', 'desc');
|
|
5523
|
+
for (var i = MAX_CONVO - 2; i < util/* default */.Z.size(allconvo); i++) {
|
|
5540
5524
|
let convo = allconvo[i];
|
|
5541
5525
|
this.cache.del('convo_' + convo.id);
|
|
5542
5526
|
}
|
|
@@ -5592,7 +5576,7 @@ class Store {
|
|
|
5592
5576
|
account_id: user.account_id,
|
|
5593
5577
|
web_plugin_id: id,
|
|
5594
5578
|
campaign_id: id,
|
|
5595
|
-
user_id: util/* default
|
|
5579
|
+
user_id: util/* default */.Z.get(user, 'id'),
|
|
5596
5580
|
url: window.location.href,
|
|
5597
5581
|
device: this.device,
|
|
5598
5582
|
submission,
|
|
@@ -5611,9 +5595,9 @@ class Store {
|
|
|
5611
5595
|
error
|
|
5612
5596
|
} = await this.api.listMessages(convoid, -limit, anchor);
|
|
5613
5597
|
if (error || code !== 200) return [[], anchor, error];
|
|
5614
|
-
anchor = util/* default
|
|
5615
|
-
events = util/* default
|
|
5616
|
-
event.created = util/* default
|
|
5598
|
+
anchor = util/* default */.Z.get(util/* default */.Z.last(events), 'id');
|
|
5599
|
+
events = util/* default */.Z.map(events, event => {
|
|
5600
|
+
event.created = util/* default */.Z.getMs(event.created);
|
|
5617
5601
|
return {
|
|
5618
5602
|
id: event.id,
|
|
5619
5603
|
index: event.created,
|
|
@@ -5624,8 +5608,8 @@ class Store {
|
|
|
5624
5608
|
for (let i = 0; i < events.length; i++) {
|
|
5625
5609
|
let ev = events[i].value;
|
|
5626
5610
|
if (ev.type !== 'message_sent') continue;
|
|
5627
|
-
if (util/* default
|
|
5628
|
-
let pongbyme = util/* default
|
|
5611
|
+
if (util/* default */.Z.get(ev, 'by.id') === user.id) continue;
|
|
5612
|
+
let pongbyme = util/* default */.Z.find(util/* default */.Z.get(ev, 'data.message.pongs'), p => p.member_id === user.id);
|
|
5629
5613
|
if (pongbyme) break;
|
|
5630
5614
|
this.api.markAsReceived(convoid, ev.id);
|
|
5631
5615
|
break;
|
|
@@ -5633,25 +5617,25 @@ class Store {
|
|
|
5633
5617
|
return [events, anchor];
|
|
5634
5618
|
}
|
|
5635
5619
|
async loopTime() {
|
|
5636
|
-
let startms = util/* default
|
|
5637
|
-
if (!util/* default
|
|
5620
|
+
let startms = util/* default */.Z.Date.now();
|
|
5621
|
+
if (!util/* default */.Z.get(this.cache.match('user'), 'id')) return util/* default */.Z.setTimeout(() => this.loopTime(), 240000);
|
|
5638
5622
|
let {
|
|
5639
5623
|
body: t,
|
|
5640
5624
|
error
|
|
5641
5625
|
} = await this.api.time();
|
|
5642
|
-
if (error) return util/* default
|
|
5643
|
-
var latences = Math.abs(util/* default
|
|
5644
|
-
var serverMs = new util/* default
|
|
5645
|
-
var localMs = util/* default
|
|
5626
|
+
if (error) return util/* default */.Z.setTimeout(() => this.loopTime(), 30000);
|
|
5627
|
+
var latences = Math.abs(util/* default */.Z.Date.now() - startms) / 2;
|
|
5628
|
+
var serverMs = new util/* default */.Z.Date(t).getTime() + latences;
|
|
5629
|
+
var localMs = util/* default */.Z.Date.now();
|
|
5646
5630
|
this.timeDiff = Math.floor(serverMs - localMs);
|
|
5647
|
-
util/* default
|
|
5631
|
+
util/* default */.Z.setTimeout(() => this.loopTime(), 240000);
|
|
5648
5632
|
}
|
|
5649
5633
|
replaceFileUrl(src) {
|
|
5650
5634
|
if (!src) return '';
|
|
5651
|
-
if (util/* default
|
|
5652
|
-
if (util/* default
|
|
5653
|
-
if (!util/* default
|
|
5654
|
-
src = util/* default
|
|
5635
|
+
if (util/* default */.Z.startsWith(src, '/')) return src;
|
|
5636
|
+
if (util/* default */.Z.startsWith(src, 'data:')) return src;
|
|
5637
|
+
if (!util/* default */.Z.startsWith(src, 'http://') && !util/* default */.Z.startsWith(src, 'https://') && !util/* default */.Z.startsWith(src, '//')) {
|
|
5638
|
+
src = util/* default */.Z.trim(this.FileURL, '/') + '/' + util/* default */.Z.trimStart(src, '/');
|
|
5655
5639
|
}
|
|
5656
5640
|
src = src.replace('https://file-subiz.com/', this.FileURL);
|
|
5657
5641
|
src = src.replace('http://file-subiz.com/', this.FileURL);
|
|
@@ -5668,7 +5652,7 @@ class Store {
|
|
|
5668
5652
|
return src;
|
|
5669
5653
|
}
|
|
5670
5654
|
clearBrowserData() {
|
|
5671
|
-
util/* default
|
|
5655
|
+
util/* default */.Z.each(this.cookie.all(), (v, k) => {
|
|
5672
5656
|
if ((k || '').startsWith('__sb')) this.cookie.remove(k);
|
|
5673
5657
|
});
|
|
5674
5658
|
this.kv.destroy();
|
|
@@ -5798,7 +5782,7 @@ let cleanLocalStorage = () => {
|
|
|
5798
5782
|
} catch (e) {
|
|
5799
5783
|
return;
|
|
5800
5784
|
}
|
|
5801
|
-
util/* default
|
|
5785
|
+
util/* default */.Z.setTimeout(() => {
|
|
5802
5786
|
for (var key in localStorage) {
|
|
5803
5787
|
if (key && (key.startsWith('cbz2020') || key.startsWith('sbz2020'))) {
|
|
5804
5788
|
localStorage.removeItem(key);
|
|
@@ -5812,7 +5796,7 @@ let cleanMyLocalStorage = () => {
|
|
|
5812
5796
|
} catch (e) {
|
|
5813
5797
|
return;
|
|
5814
5798
|
}
|
|
5815
|
-
util/* default
|
|
5799
|
+
util/* default */.Z.setTimeout(() => {
|
|
5816
5800
|
for (var key in localStorage) {
|
|
5817
5801
|
if (key && (key.startsWith('cbz2020') || key.startsWith('sbz2020') || key.startsWith('sbz2022') || key.startsWith('sbz2023'))) {
|
|
5818
5802
|
localStorage.removeItem(key);
|
|
@@ -5830,8 +5814,8 @@ function dofetch(method, url, body, cb) {
|
|
|
5830
5814
|
}).then(res => res.text().then(text => cb && cb(text, res.status))).catch(err => cb && cb(err, -1));
|
|
5831
5815
|
}
|
|
5832
5816
|
var xhrsend = function (method, url, body, cb) {
|
|
5833
|
-
if (typeof util/* default
|
|
5834
|
-
var request = new util/* default
|
|
5817
|
+
if (typeof util/* default */.Z.XMLHttpRequest === 'undefined') return dofetch(method, url, body, cb);
|
|
5818
|
+
var request = new util/* default */.Z.XMLHttpRequest();
|
|
5835
5819
|
request.onreadystatechange = function (e) {
|
|
5836
5820
|
if (request.readyState !== 4) return;
|
|
5837
5821
|
cb && cb(request.responseText, request.status);
|
|
@@ -5862,8 +5846,8 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5862
5846
|
var $div = document.createElement('div');
|
|
5863
5847
|
$div.id = plugin.id;
|
|
5864
5848
|
$container.appendChild($div);
|
|
5865
|
-
let _locale = common/* getLocale */.Kd(plugin, util/* default
|
|
5866
|
-
var domGate = new util/* default
|
|
5849
|
+
let _locale = common/* getLocale */.Kd(plugin, util/* default */.Z.detectLang());
|
|
5850
|
+
var domGate = new util/* default */.Z.Gate();
|
|
5867
5851
|
var pageIndex = 0;
|
|
5868
5852
|
var highlight;
|
|
5869
5853
|
var state = 'hold';
|
|
@@ -5876,13 +5860,13 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5876
5860
|
let lastrun = store.matchLastPluginRun(plugin.id);
|
|
5877
5861
|
if (plugin.type === 'chatbox' || plugin.type === 'notification') lastrun = undefined;
|
|
5878
5862
|
if (!plugin.enabled) return;
|
|
5879
|
-
let match = util/* default
|
|
5863
|
+
let match = util/* default */.Z.checkRunConditions(plugin.initiative_frequency, plugin.conditions, lastrun, store);
|
|
5880
5864
|
if (!match) return;
|
|
5881
5865
|
state = 'running';
|
|
5882
5866
|
await _this.update(plugin);
|
|
5883
5867
|
};
|
|
5884
5868
|
this.forceRunPopup = async () => {
|
|
5885
|
-
if (util/* default
|
|
5869
|
+
if (util/* default */.Z.get(_ref, 'current')) {
|
|
5886
5870
|
_ref.current.openPopup();
|
|
5887
5871
|
} else {
|
|
5888
5872
|
_render();
|
|
@@ -5969,9 +5953,9 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5969
5953
|
};
|
|
5970
5954
|
let t = key => {
|
|
5971
5955
|
if (_locale === 'debug') return `{{${key}}}`;
|
|
5972
|
-
let messages = util/* default
|
|
5973
|
-
let message = util/* default
|
|
5974
|
-
return util/* default
|
|
5956
|
+
let messages = util/* default */.Z.get(common/* langMessages */.Rs, _locale, []);
|
|
5957
|
+
let message = util/* default */.Z.find(messages, message => message.key === key);
|
|
5958
|
+
return util/* default */.Z.get(message, 'message', key);
|
|
5975
5959
|
};
|
|
5976
5960
|
let acc = store.matchAccount();
|
|
5977
5961
|
t.i18n = i18nText => {
|
|
@@ -5997,29 +5981,29 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5997
5981
|
return _locale;
|
|
5998
5982
|
};
|
|
5999
5983
|
let images = {};
|
|
6000
|
-
util/* default
|
|
5984
|
+
util/* default */.Z.map(util/* default */.Z.get(plugin, 'popup.pages'), page => {
|
|
6001
5985
|
if (!page) return;
|
|
6002
|
-
util/* default
|
|
5986
|
+
util/* default */.Z.map(page.components, com => {
|
|
6003
5987
|
if (com.type === 'image' && com.image && com.image.url && com.image.url.startsWith('http')) {
|
|
6004
5988
|
images[com.image.url] = true;
|
|
6005
5989
|
}
|
|
6006
5990
|
});
|
|
6007
5991
|
});
|
|
6008
|
-
if (util/* default
|
|
6009
|
-
let triggers = util/* default
|
|
5992
|
+
if (util/* default */.Z.size(images) >= 0) util/* default */.Z.map(images, (_, image) => util/* default */.Z.preloadImg(image));
|
|
5993
|
+
let triggers = util/* default */.Z.get(plugin, 'triggers') || [{
|
|
6010
5994
|
type: 'after_pageview',
|
|
6011
5995
|
after_pageview_sec: 0,
|
|
6012
5996
|
disabled: false
|
|
6013
5997
|
}];
|
|
6014
|
-
for (var i = 0; i < util/* default
|
|
5998
|
+
for (var i = 0; i < util/* default */.Z.size(triggers); i++) {
|
|
6015
5999
|
var tr = triggers[i];
|
|
6016
6000
|
if (!tr) continue;
|
|
6017
6001
|
if (tr.disabled) continue;
|
|
6018
|
-
if (tr.type === 'exit_intent') util/* default
|
|
6019
|
-
if (tr.type === 'area_clicked') util/* default
|
|
6020
|
-
if (tr.type === 'scrolling_percentage') util/* default
|
|
6021
|
-
if (tr.type === 'inactivity_duration') util/* default
|
|
6022
|
-
if (tr.type === 'after_pageview') util/* default
|
|
6002
|
+
if (tr.type === 'exit_intent') util/* default */.Z.trackExitIntent(run);
|
|
6003
|
+
if (tr.type === 'area_clicked') util/* default */.Z.trackAreaClicked(tr.area_clicked_css_selector, run);
|
|
6004
|
+
if (tr.type === 'scrolling_percentage') util/* default */.Z.trackScrollingPercentage(tr.scrolling_percentage, run);
|
|
6005
|
+
if (tr.type === 'inactivity_duration') util/* default */.Z.trackInactivity(tr.inactivity_sec, run);
|
|
6006
|
+
if (tr.type === 'after_pageview') util/* default */.Z.trackTimeOnPage(tr.after_pageview_sec, run);
|
|
6023
6007
|
}
|
|
6024
6008
|
this.update(plugin);
|
|
6025
6009
|
common/* downloadLanguage */.WW(store, _locale).then(() => {
|
|
@@ -6047,7 +6031,7 @@ class PluginMgr {
|
|
|
6047
6031
|
if (this._destroy) return;
|
|
6048
6032
|
let pluginM = this.lib.store.matchPlugin();
|
|
6049
6033
|
let foundchatbox = false;
|
|
6050
|
-
util/* default
|
|
6034
|
+
util/* default */.Z.each(pluginM, conf => {
|
|
6051
6035
|
if (conf.type === 'chatbox') {
|
|
6052
6036
|
if (foundchatbox) return;
|
|
6053
6037
|
foundchatbox = true;
|
|
@@ -6058,7 +6042,7 @@ class PluginMgr {
|
|
|
6058
6042
|
}
|
|
6059
6043
|
this.pluginM[conf.id].update(conf);
|
|
6060
6044
|
});
|
|
6061
|
-
util/* default
|
|
6045
|
+
util/* default */.Z.each(this.pluginM, (conf, id) => {
|
|
6062
6046
|
if (pluginM[id]) return;
|
|
6063
6047
|
this.pluginM[id].destroy();
|
|
6064
6048
|
delete this.pluginM[id];
|
|
@@ -6066,7 +6050,7 @@ class PluginMgr {
|
|
|
6066
6050
|
});
|
|
6067
6051
|
let pluginM = this.lib.store.matchPlugin();
|
|
6068
6052
|
let foundchatbox = false;
|
|
6069
|
-
util/* default
|
|
6053
|
+
util/* default */.Z.each(pluginM, conf => {
|
|
6070
6054
|
if (conf.type === 'chatbox') {
|
|
6071
6055
|
if (foundchatbox) return;
|
|
6072
6056
|
foundchatbox = true;
|
|
@@ -6076,12 +6060,12 @@ class PluginMgr {
|
|
|
6076
6060
|
}
|
|
6077
6061
|
findChatbox() {
|
|
6078
6062
|
var pluginM = this.lib.store.matchPlugin();
|
|
6079
|
-
let chatboxs = util/* default
|
|
6080
|
-
if (util/* default
|
|
6063
|
+
let chatboxs = util/* default */.Z.filter(this.pluginM, (plugin, id) => pluginM[id].type === 'chatbox');
|
|
6064
|
+
if (util/* default */.Z.size(chatboxs) === 0) {
|
|
6081
6065
|
console.error('no chatbox found.');
|
|
6082
6066
|
return;
|
|
6083
6067
|
}
|
|
6084
|
-
let chatbox = util/* default
|
|
6068
|
+
let chatbox = util/* default */.Z.find(chatboxs, chatbox => chatbox.getState() === 'running');
|
|
6085
6069
|
if (!chatbox) {
|
|
6086
6070
|
chatbox = chatboxs[0];
|
|
6087
6071
|
}
|
|
@@ -6137,7 +6121,7 @@ class PluginMgr {
|
|
|
6137
6121
|
chatbox.setLocale(locale);
|
|
6138
6122
|
}
|
|
6139
6123
|
destroy() {
|
|
6140
|
-
util/* default
|
|
6124
|
+
util/* default */.Z.map(this.pluginM, (conf, id) => {
|
|
6141
6125
|
if (this.pluginM[id]) return;
|
|
6142
6126
|
this.pluginM[id].destroy();
|
|
6143
6127
|
delete this.pluginM[id];
|
|
@@ -6156,25 +6140,25 @@ var $link = document.createElement('link');
|
|
|
6156
6140
|
$link.href = 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap';
|
|
6157
6141
|
$link.rel = 'stylesheet';
|
|
6158
6142
|
document.head.append($link);
|
|
6159
|
-
util/* default
|
|
6143
|
+
util/* default */.Z.preloadWebfonts(['Inter'], [400, 500, 600]);
|
|
6160
6144
|
class Widget {
|
|
6161
6145
|
constructor(ApiURL, FileURL, RealtimeURL, inmem, fake) {
|
|
6162
6146
|
lib_defineProperty(this, "version", () => '4.5');
|
|
6163
6147
|
lib_defineProperty(this, "setSetting", setting => this.store.setSetting({
|
|
6164
6148
|
account_setting: setting
|
|
6165
6149
|
}));
|
|
6166
|
-
lib_defineProperty(this, "getUser", () => util/* default
|
|
6150
|
+
lib_defineProperty(this, "getUser", () => util/* default */.Z.parseJSON(util/* default */.Z.stringify(this.store.matchUser())));
|
|
6167
6151
|
lib_defineProperty(this, "setViewingProduct", p => this.store.linkProduct(p));
|
|
6168
6152
|
lib_defineProperty(this, "getViewingProduct", () => this.store.getLinkedProduct());
|
|
6169
6153
|
lib_defineProperty(this, "track", () => this.store.track());
|
|
6170
6154
|
this.impressionTokens = {};
|
|
6171
|
-
this.domGate = new util/* default
|
|
6155
|
+
this.domGate = new util/* default */.Z.Gate();
|
|
6172
6156
|
this.store = new Store(ApiURL, FileURL, RealtimeURL, inmem, fake);
|
|
6173
6157
|
window.sbz_store = this.store;
|
|
6174
6158
|
this.subs = [];
|
|
6175
6159
|
this.store.onConvoEvent({
|
|
6176
6160
|
_isMounted: true
|
|
6177
|
-
}, ev => util/* default
|
|
6161
|
+
}, ev => util/* default */.Z.map(this.subs, sub => sub(ev)));
|
|
6178
6162
|
}
|
|
6179
6163
|
async waitReady(cb) {
|
|
6180
6164
|
await this.store.readyGate.entry();
|
|
@@ -6185,10 +6169,10 @@ class Widget {
|
|
|
6185
6169
|
let user = await this.store.login(accid, user_id, tokenGenerator);
|
|
6186
6170
|
if (!$container) $container = document.body;
|
|
6187
6171
|
this.pluginMgr = new PluginMgr(this, $container);
|
|
6188
|
-
let clean = util/* default
|
|
6172
|
+
let clean = util/* default */.Z.setInterval(() => {
|
|
6189
6173
|
if ($container && $container.isConnected) return;
|
|
6190
6174
|
this.pluginMgr.destroy();
|
|
6191
|
-
util/* default
|
|
6175
|
+
util/* default */.Z.clearInterval(clean);
|
|
6192
6176
|
}, 1000);
|
|
6193
6177
|
this.domGate.open();
|
|
6194
6178
|
return user;
|
|
@@ -6203,10 +6187,10 @@ class Widget {
|
|
|
6203
6187
|
let user = await this.store.init(accid, undefined, ref);
|
|
6204
6188
|
if (!$container) $container = document.body || document;
|
|
6205
6189
|
this.pluginMgr = new PluginMgr(this, $container);
|
|
6206
|
-
let clean = util/* default
|
|
6190
|
+
let clean = util/* default */.Z.setInterval(() => {
|
|
6207
6191
|
if ($container && $container.isConnected) return;
|
|
6208
6192
|
this.pluginMgr.destroy();
|
|
6209
|
-
util/* default
|
|
6193
|
+
util/* default */.Z.clearInterval(clean);
|
|
6210
6194
|
}, 1000);
|
|
6211
6195
|
this.domGate.open();
|
|
6212
6196
|
return user;
|
|
@@ -6215,10 +6199,10 @@ class Widget {
|
|
|
6215
6199
|
let outmask = await this.store.init(id, mask);
|
|
6216
6200
|
if (!$container) $container = document.body || document;
|
|
6217
6201
|
this.pluginMgr = new PluginMgr(this, $container);
|
|
6218
|
-
let clean = util/* default
|
|
6202
|
+
let clean = util/* default */.Z.setInterval(() => {
|
|
6219
6203
|
if ($container && $container.isConnected) return;
|
|
6220
6204
|
this.pluginMgr.destroy();
|
|
6221
|
-
util/* default
|
|
6205
|
+
util/* default */.Z.clearInterval(clean);
|
|
6222
6206
|
}, 1000);
|
|
6223
6207
|
this.domGate.open();
|
|
6224
6208
|
cb && cb(outmask);
|
|
@@ -6232,12 +6216,12 @@ class Widget {
|
|
|
6232
6216
|
attributes
|
|
6233
6217
|
});
|
|
6234
6218
|
var user = this.store.matchUser();
|
|
6235
|
-
return util/* default
|
|
6219
|
+
return util/* default */.Z.cloneDeep(user.attributes);
|
|
6236
6220
|
}
|
|
6237
6221
|
async getUserAttributes() {
|
|
6238
6222
|
await this.store.readyGate.entry();
|
|
6239
6223
|
var user = this.store.matchUser();
|
|
6240
|
-
return util/* default
|
|
6224
|
+
return util/* default */.Z.cloneDeep(util/* default */.Z.get(user, 'attributes', []));
|
|
6241
6225
|
}
|
|
6242
6226
|
async getWidgetCurrentView() {
|
|
6243
6227
|
await this.domGate.entry();
|
|
@@ -6268,40 +6252,40 @@ class Widget {
|
|
|
6268
6252
|
});
|
|
6269
6253
|
}
|
|
6270
6254
|
async viewForm(formid) {
|
|
6271
|
-
if (!formid || !util/* default
|
|
6255
|
+
if (!formid || !util/* default */.Z.startsWith(formid, 'cp')) return;
|
|
6272
6256
|
let impressiontoken = this.impressionTokens[formid];
|
|
6273
6257
|
if (impressiontoken) return impressiontoken;
|
|
6274
6258
|
let {
|
|
6275
6259
|
body: impression
|
|
6276
6260
|
} = await this.store.sendImpression(formid);
|
|
6277
|
-
impressiontoken = util/* default
|
|
6261
|
+
impressiontoken = util/* default */.Z.get(impression, 'impression_token') || '';
|
|
6278
6262
|
this.impressionTokens[formid] = impressiontoken;
|
|
6279
6263
|
return impressiontoken;
|
|
6280
6264
|
}
|
|
6281
6265
|
async submitForm(formid, values) {
|
|
6282
|
-
if (!formid || !util/* default
|
|
6283
|
-
let storeuser = util/* default
|
|
6266
|
+
if (!formid || !util/* default */.Z.startsWith(formid, 'cp')) return;
|
|
6267
|
+
let storeuser = util/* default */.Z.cloneDeep(this.store.matchUser());
|
|
6284
6268
|
let user = {
|
|
6285
6269
|
id: storeuser.id,
|
|
6286
6270
|
account_id: storeuser.account_id
|
|
6287
6271
|
};
|
|
6288
6272
|
let is_lead = false;
|
|
6289
|
-
values = util/* default
|
|
6273
|
+
values = util/* default */.Z.map(values, val => {
|
|
6290
6274
|
let key = val.key;
|
|
6291
6275
|
if (key === 'email') key = 'emails';
|
|
6292
6276
|
if (key === 'phone') key = 'phones';
|
|
6293
6277
|
is_lead = is_lead || key == 'emails' || key == 'phones';
|
|
6294
|
-
util/* default
|
|
6278
|
+
util/* default */.Z.setUserAttr(user, {
|
|
6295
6279
|
key: key,
|
|
6296
6280
|
[val.type || 'text']: val.value
|
|
6297
6281
|
});
|
|
6298
6282
|
return {
|
|
6299
6283
|
key: key,
|
|
6300
6284
|
type: val.type || 'text',
|
|
6301
|
-
value: util/* default
|
|
6285
|
+
value: util/* default */.Z.stringify(val.value)
|
|
6302
6286
|
};
|
|
6303
6287
|
});
|
|
6304
|
-
if (is_lead) util/* default
|
|
6288
|
+
if (is_lead) util/* default */.Z.setUserAttr(user, {
|
|
6305
6289
|
key: 'lead_source',
|
|
6306
6290
|
text: 'plugin.' + formid
|
|
6307
6291
|
});
|
|
@@ -6359,14 +6343,14 @@ class Widget {
|
|
|
6359
6343
|
this.pluginMgr.forceRunPopup(pluginid);
|
|
6360
6344
|
}
|
|
6361
6345
|
unEvent(cb) {
|
|
6362
|
-
this.subs = util/* default
|
|
6346
|
+
this.subs = util/* default */.Z.filter(this.subs, sub => sub !== cb);
|
|
6363
6347
|
}
|
|
6364
6348
|
async countUnreadMessages() {
|
|
6365
6349
|
await this.domGate.entry();
|
|
6366
6350
|
return this.store.matchUnread();
|
|
6367
6351
|
}
|
|
6368
6352
|
onEvent(cb) {
|
|
6369
|
-
this.subs = util/* default
|
|
6353
|
+
this.subs = util/* default */.Z.filter(this.subs, sub => sub !== cb);
|
|
6370
6354
|
this.subs.push(cb);
|
|
6371
6355
|
}
|
|
6372
6356
|
overrideAccount(acc) {
|
|
@@ -6374,7 +6358,7 @@ class Widget {
|
|
|
6374
6358
|
}
|
|
6375
6359
|
async overrideChatbox(chatbox) {
|
|
6376
6360
|
await this.store.overrideChatbox(chatbox);
|
|
6377
|
-
if (util/* default
|
|
6361
|
+
if (util/* default */.Z.get(chatbox, 'chatbox.greeting.greeting')) {
|
|
6378
6362
|
this.pluginMgr.showCurrentGreeting();
|
|
6379
6363
|
}
|
|
6380
6364
|
}
|