@subiz/widget-v4 4.1.54 → 4.1.56
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/cloudflare_worker.js +1 -0
- package/compiled_src/call/call.js +2 -2
- package/compiled_src/chatbox/DropdownSelect.js +2 -2
- package/compiled_src/chatbox/ImageAttachments.js +2 -2
- package/compiled_src/chatbox/MessageInput.js +2 -2
- package/compiled_src/chatbox/Order.js +2 -2
- package/compiled_src/chatbox/Rating.js +2 -2
- package/compiled_src/chatbox/Widget.js +2 -2
- package/compiled_src/contact/contact.js +2 -2
- package/compiled_src/lib.js +2 -2
- package/compiled_src/notif/notif.js +2 -2
- package/compiled_src/order/address_picker.js +2 -2
- package/compiled_src/order/order.js +2 -2
- package/compiled_src/popup/countdown.js +2 -2
- package/compiled_src/popup/popup.js +2 -2
- package/compiled_src/store/api.js +2 -2
- package/compiled_src/store/api_fake.js +2 -2
- package/compiled_src/store/store.js +2 -2
- package/compiled_src/util/common.js +0 -180
- package/dist/178.js +1 -1
- package/dist/18c7c220d13.178.js +1 -0
- package/dist/18c7c220d13.213.js +1 -0
- package/dist/18c7c220d13.335.js +1 -0
- package/dist/{18a02a9c54e.362.js → 18c7c220d13.362.js} +1 -1
- package/dist/18c7c220d13.605.js +1 -0
- package/dist/{18a02a9c54e.782.js → 18c7c220d13.782.js} +1 -1
- package/dist/18c7c220d13.841.js +1 -0
- package/dist/18c7c220d13.app.js +1 -0
- package/dist/{18a02a9c54e.index.html → 18c7c220d13.index.html} +4 -4
- package/dist/{18a02a9c54e.library.html → 18c7c220d13.library.html} +4 -4
- package/dist/18c7c220d13.library.js +1 -0
- package/dist/{18a02a9c54e.preview.html → 18c7c220d13.preview.html} +1 -1
- package/dist/18c7c220d13.preview.js +1 -0
- package/dist/18c7c220d13.screenshoot.js +1 -0
- package/dist/18c7c220d13.webview.js +1 -0
- package/dist/213.js +122 -106
- package/dist/335.js +27 -27
- package/dist/362.js +1 -1
- package/dist/605.js +52 -52
- package/dist/782.js +1 -1
- package/dist/{132.js → 841.js} +653 -644
- package/dist/HASH +1 -1
- package/dist/malicious-app.js +9 -3
- package/dist/screenshoot.html +1 -1
- package/dist/screenshoot.js +483 -438
- package/malicious-app.js +1 -0
- package/package.json +7 -7
- package/src/util/common.js +180 -180
- package/dist/18a02a9c54e.132.js +0 -1
- package/dist/18a02a9c54e.178.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/441.js +0 -2855
- /package/dist/{18a02a9c54e.678.js → 18c7c220d13.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,90 @@ module.exports = function sleep (ms) {
|
|
|
525
525
|
|
|
526
526
|
/***/ }),
|
|
527
527
|
|
|
528
|
-
/***/
|
|
529
|
-
/***/ ((module
|
|
528
|
+
/***/ 2611:
|
|
529
|
+
/***/ ((module) => {
|
|
530
|
+
|
|
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
|
+
}
|
|
530
566
|
|
|
531
|
-
|
|
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
|
+
function randomString(len, base) {
|
|
597
|
+
var str = ''
|
|
598
|
+
if (!len || len < 1) len = 10
|
|
599
|
+
var asciiKey
|
|
600
|
+
for (var i = 0; i < len; i++) {
|
|
601
|
+
if (base) {
|
|
602
|
+
str += base[Math.floor(Math.random() * base.length)]
|
|
603
|
+
} else {
|
|
604
|
+
asciiKey = Math.floor(Math.random() * 25 + 97)
|
|
605
|
+
str += String.fromCharCode(asciiKey)
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
return str
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
module.exports = {xhrsend, parseJSON, Pubsub, randomString}
|
|
532
612
|
|
|
533
613
|
|
|
534
614
|
/***/ }),
|
|
@@ -537,6 +617,7 @@ module.exports = __webpack_require__(608)
|
|
|
537
617
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
538
618
|
|
|
539
619
|
var flow = __webpack_require__(3165)
|
|
620
|
+
var {xhrsend, parseJSON, Pubsub} = __webpack_require__(2611)
|
|
540
621
|
|
|
541
622
|
// Conn represents a realtime connection between an user and the realtime
|
|
542
623
|
// server (https://rt-0.subiz.com)
|
|
@@ -750,74 +831,6 @@ function Realtime(apiUrls, credential, callAPI) {
|
|
|
750
831
|
reconnect()
|
|
751
832
|
}
|
|
752
833
|
|
|
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
834
|
// calcNextBackoff returns number of seconds we must wait
|
|
822
835
|
// before sending a next request
|
|
823
836
|
// the results is determind based on exponential backoff algorithm
|
|
@@ -862,7 +875,7 @@ module.exports = Realtime
|
|
|
862
875
|
|
|
863
876
|
"use strict";
|
|
864
877
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
865
|
-
/* harmony export */
|
|
878
|
+
/* harmony export */ Z: () => (/* binding */ Chain)
|
|
866
879
|
/* harmony export */ });
|
|
867
880
|
const ChainMaxSize = 50;
|
|
868
881
|
class Chain {
|
|
@@ -934,9 +947,7 @@ class Chain {
|
|
|
934
947
|
});
|
|
935
948
|
return out;
|
|
936
949
|
}
|
|
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;
|
|
950
|
+
async fetchMore(chain, limit = 20, api) {
|
|
940
951
|
if (this.dead) return {
|
|
941
952
|
error: 'dead'
|
|
942
953
|
};
|
|
@@ -1094,7 +1105,7 @@ function orderBy(a, k, d) {
|
|
|
1094
1105
|
|
|
1095
1106
|
"use strict";
|
|
1096
1107
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1097
|
-
/* harmony export */
|
|
1108
|
+
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
1098
1109
|
/* harmony export */ });
|
|
1099
1110
|
var localStorageMemory = {};
|
|
1100
1111
|
var cache = {};
|
|
@@ -1129,7 +1140,7 @@ localStorageMemory.clear = function () {
|
|
|
1129
1140
|
|
|
1130
1141
|
"use strict";
|
|
1131
1142
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1132
|
-
/* harmony export */
|
|
1143
|
+
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
1133
1144
|
/* harmony export */ });
|
|
1134
1145
|
let KvMaxSize = 500;
|
|
1135
1146
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (class {
|
|
@@ -1218,7 +1229,7 @@ let KvMaxSize = 500;
|
|
|
1218
1229
|
|
|
1219
1230
|
"use strict";
|
|
1220
1231
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1221
|
-
/* harmony export */
|
|
1232
|
+
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
1222
1233
|
/* harmony export */ });
|
|
1223
1234
|
let memlocalStorage = (__webpack_require__(9489)/* ["default"] */ .Z);
|
|
1224
1235
|
let requestIdleCallback = window.requestIdleCallback || (cb => cb());
|
|
@@ -1286,11 +1297,11 @@ function toString(obj) {
|
|
|
1286
1297
|
|
|
1287
1298
|
"use strict";
|
|
1288
1299
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1289
|
-
/* harmony export */
|
|
1290
|
-
/* harmony export */
|
|
1291
|
-
/* harmony export */
|
|
1292
|
-
/* harmony export */
|
|
1293
|
-
/* harmony export */
|
|
1300
|
+
/* harmony export */ Kd: () => (/* binding */ getLocale),
|
|
1301
|
+
/* harmony export */ Rs: () => (/* binding */ langMessages),
|
|
1302
|
+
/* harmony export */ WW: () => (/* binding */ downloadLanguage),
|
|
1303
|
+
/* harmony export */ u$: () => (/* binding */ Clickaway),
|
|
1304
|
+
/* harmony export */ up: () => (/* binding */ Com)
|
|
1294
1305
|
/* harmony export */ });
|
|
1295
1306
|
/* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6400);
|
|
1296
1307
|
/* harmony import */ var _util_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4494);
|
|
@@ -1300,7 +1311,7 @@ class Com extends preact__WEBPACK_IMPORTED_MODULE_0__/* .Component */ .wA {
|
|
|
1300
1311
|
constructor(props) {
|
|
1301
1312
|
super(props);
|
|
1302
1313
|
this._isMounted = true;
|
|
1303
|
-
_util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"]
|
|
1314
|
+
_util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.setTimeout(() => {
|
|
1304
1315
|
if (this.componentWillUnmount) {
|
|
1305
1316
|
let old = this.componentWillUnmount.bind(this);
|
|
1306
1317
|
this.componentWillUnmount = () => {
|
|
@@ -1339,9 +1350,9 @@ class Clickaway extends Com {
|
|
|
1339
1350
|
}
|
|
1340
1351
|
const getLocale = (plugin, loc) => {
|
|
1341
1352
|
if (!loc) loc = '';
|
|
1342
|
-
let found = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"]
|
|
1353
|
+
let found = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.find(plugin.locales, l => l.toLowerCase().trim() === loc.toLowerCase().trim());
|
|
1343
1354
|
if (found) return found;
|
|
1344
|
-
found = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"]
|
|
1355
|
+
found = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.find(plugin.locales, l => {
|
|
1345
1356
|
l = l.replace('-', '_').split('_')[0].trim().toLowerCase();
|
|
1346
1357
|
let compareloc = loc.replace('-', '_').split('_')[0].trim().toLowerCase();
|
|
1347
1358
|
return l == compareloc;
|
|
@@ -1352,7 +1363,7 @@ const getLocale = (plugin, loc) => {
|
|
|
1352
1363
|
let langMessages = {};
|
|
1353
1364
|
let downloadLock = false;
|
|
1354
1365
|
function downloadLanguage(store, locale, force) {
|
|
1355
|
-
if (downloadLock) return new Promise(resolve => _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"]
|
|
1366
|
+
if (downloadLock) return new Promise(resolve => _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.setTimeout(() => downloadLanguage(store, locale, force).then(resolve), 100));
|
|
1356
1367
|
downloadLock = true;
|
|
1357
1368
|
let messages;
|
|
1358
1369
|
if (locale === 'debug' || langMessages[locale] && !force) {
|
|
@@ -1361,7 +1372,7 @@ function downloadLanguage(store, locale, force) {
|
|
|
1361
1372
|
}
|
|
1362
1373
|
return store.getLocaleContent(locale).then(res => {
|
|
1363
1374
|
downloadLock = false;
|
|
1364
|
-
messages = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"]
|
|
1375
|
+
messages = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z.get(res, 'body.messages', []);
|
|
1365
1376
|
langMessages[locale] = messages;
|
|
1366
1377
|
});
|
|
1367
1378
|
}
|
|
@@ -1374,73 +1385,73 @@ function downloadLanguage(store, locale, force) {
|
|
|
1374
1385
|
"use strict";
|
|
1375
1386
|
__webpack_require__.r(__webpack_exports__);
|
|
1376
1387
|
/* 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 */
|
|
1388
|
+
/* harmony export */ DEFVAL: () => (/* binding */ DEFVAL),
|
|
1389
|
+
/* harmony export */ DEF_CHAT_BUTTON_BACKGROUND_IMAGE_URL: () => (/* binding */ DEF_CHAT_BUTTON_BACKGROUND_IMAGE_URL),
|
|
1390
|
+
/* harmony export */ Date: () => (/* binding */ Date),
|
|
1391
|
+
/* harmony export */ XMLHttpRequest: () => (/* binding */ XMLHttpRequest),
|
|
1392
|
+
/* harmony export */ agentsOfConvo: () => (/* binding */ agentsOfConvo),
|
|
1393
|
+
/* harmony export */ checkRunConditions: () => (/* binding */ checkRunConditions),
|
|
1394
|
+
/* harmony export */ clearInterval: () => (/* binding */ clearInterval),
|
|
1395
|
+
/* harmony export */ clearTimeout: () => (/* binding */ clearTimeout),
|
|
1396
|
+
/* harmony export */ cloneDeep: () => (/* binding */ cloneDeep),
|
|
1397
|
+
/* harmony export */ convoOfEv: () => (/* binding */ convoOfEv),
|
|
1398
|
+
/* harmony export */ convoToEv: () => (/* binding */ convoToEv),
|
|
1399
|
+
/* harmony export */ detectLang: () => (/* binding */ detectLang),
|
|
1400
|
+
/* harmony export */ diffDay: () => (/* binding */ diffDay),
|
|
1401
|
+
/* harmony export */ diffYear: () => (/* binding */ diffYear),
|
|
1402
|
+
/* harmony export */ each: () => (/* binding */ each),
|
|
1403
|
+
/* harmony export */ filter: () => (/* binding */ filter),
|
|
1404
|
+
/* harmony export */ find: () => (/* binding */ find),
|
|
1405
|
+
/* harmony export */ formatCurrency: () => (/* binding */ formatCurrency),
|
|
1406
|
+
/* harmony export */ getAgentDisplayName: () => (/* binding */ getAgentDisplayName),
|
|
1407
|
+
/* harmony export */ getDayName: () => (/* binding */ getDayName),
|
|
1408
|
+
/* harmony export */ getMs: () => (/* binding */ getMs),
|
|
1409
|
+
/* harmony export */ getMsgField: () => (/* binding */ getMsgField),
|
|
1410
|
+
/* harmony export */ getUrlParameter: () => (/* binding */ getUrlParameter),
|
|
1411
|
+
/* harmony export */ getUserAttr: () => (/* binding */ getUserAttr),
|
|
1412
|
+
/* harmony export */ includes: () => (/* binding */ includes),
|
|
1413
|
+
/* harmony export */ isConvoSeen: () => (/* binding */ isConvoSeen),
|
|
1414
|
+
/* harmony export */ isEmail: () => (/* binding */ isEmail),
|
|
1415
|
+
/* harmony export */ isNumber: () => (/* binding */ isNumber),
|
|
1416
|
+
/* harmony export */ isPhone: () => (/* binding */ isPhone),
|
|
1417
|
+
/* harmony export */ isURL: () => (/* binding */ isURL),
|
|
1418
|
+
/* harmony export */ isUserBanned: () => (/* binding */ isUserBanned),
|
|
1419
|
+
/* harmony export */ js2css: () => (/* binding */ js2css),
|
|
1420
|
+
/* harmony export */ last: () => (/* binding */ last),
|
|
1421
|
+
/* harmony export */ map: () => (/* binding */ map),
|
|
1422
|
+
/* harmony export */ merge: () => (/* binding */ merge),
|
|
1423
|
+
/* harmony export */ noop: () => (/* binding */ noop),
|
|
1424
|
+
/* harmony export */ norm: () => (/* binding */ norm),
|
|
1425
|
+
/* harmony export */ offsetToMin: () => (/* binding */ offsetToMin),
|
|
1426
|
+
/* harmony export */ orderBy: () => (/* binding */ orderBy),
|
|
1427
|
+
/* harmony export */ orderByF: () => (/* binding */ orderByF),
|
|
1428
|
+
/* harmony export */ parseJSON: () => (/* binding */ parseJSON),
|
|
1429
|
+
/* harmony export */ preloadImg: () => (/* binding */ preloadImg),
|
|
1430
|
+
/* harmony export */ preloadWebfonts: () => (/* binding */ preloadWebfonts),
|
|
1431
|
+
/* harmony export */ randomString: () => (/* binding */ randomString),
|
|
1432
|
+
/* harmony export */ replaceAll: () => (/* binding */ replaceAll),
|
|
1433
|
+
/* harmony export */ replaceCssVariable: () => (/* binding */ replaceCssVariable),
|
|
1434
|
+
/* harmony export */ replaceCssVariablePlugin: () => (/* binding */ replaceCssVariablePlugin),
|
|
1435
|
+
/* harmony export */ requestAnimationFrame: () => (/* binding */ requestAnimationFrame),
|
|
1436
|
+
/* harmony export */ sameDay: () => (/* binding */ sameDay),
|
|
1437
|
+
/* harmony export */ scrollIntoViewIfNeeded: () => (/* binding */ scrollIntoViewIfNeeded),
|
|
1438
|
+
/* harmony export */ setCss: () => (/* binding */ setCss),
|
|
1439
|
+
/* harmony export */ setInterval: () => (/* binding */ setInterval),
|
|
1440
|
+
/* harmony export */ setMsgField: () => (/* binding */ setMsgField),
|
|
1441
|
+
/* harmony export */ setTimeout: () => (/* binding */ setTimeout),
|
|
1442
|
+
/* harmony export */ setUserAttr: () => (/* binding */ setUserAttr),
|
|
1443
|
+
/* harmony export */ shortTime: () => (/* binding */ shortTime),
|
|
1444
|
+
/* harmony export */ size: () => (/* binding */ size),
|
|
1445
|
+
/* harmony export */ sleep: () => (/* binding */ sleep),
|
|
1446
|
+
/* harmony export */ startsWith: () => (/* binding */ startsWith),
|
|
1447
|
+
/* harmony export */ stringify: () => (/* binding */ stringify),
|
|
1448
|
+
/* harmony export */ throttle: () => (/* binding */ throttle),
|
|
1449
|
+
/* harmony export */ tokenize: () => (/* binding */ tokenize),
|
|
1450
|
+
/* harmony export */ trim: () => (/* binding */ trim),
|
|
1451
|
+
/* harmony export */ trimStart: () => (/* binding */ trimStart),
|
|
1452
|
+
/* harmony export */ unicodeToAscii: () => (/* binding */ unicodeToAscii),
|
|
1453
|
+
/* harmony export */ unixSec: () => (/* binding */ unixSec),
|
|
1454
|
+
/* harmony export */ usersOfConvo: () => (/* binding */ usersOfConvo)
|
|
1444
1455
|
/* harmony export */ });
|
|
1445
1456
|
var op = __webpack_require__(6877);
|
|
1446
1457
|
function parseJSON(str) {
|
|
@@ -1527,10 +1538,7 @@ function getMsgField(ev, fieldName) {
|
|
|
1527
1538
|
function isObject(item) {
|
|
1528
1539
|
return item && typeof item === 'object' && !Array.isArray(item);
|
|
1529
1540
|
}
|
|
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
|
-
}
|
|
1541
|
+
function merge(target, ...sources) {
|
|
1534
1542
|
if (!sources.length) return target;
|
|
1535
1543
|
const source = sources.shift();
|
|
1536
1544
|
if (isObject(target) && isObject(source)) {
|
|
@@ -1758,7 +1766,7 @@ function setUserAttr(user, attr) {
|
|
|
1758
1766
|
if (!user) return;
|
|
1759
1767
|
if (!op.get(attr, 'key')) return;
|
|
1760
1768
|
user.attributes = user.attributes || [];
|
|
1761
|
-
var index = findIndex(user.attributes, a => a.key === attr.key);
|
|
1769
|
+
var index = findIndex(user.attributes, a => a && a.key === attr.key);
|
|
1762
1770
|
if (index === -1) {
|
|
1763
1771
|
user.attributes.push(attr);
|
|
1764
1772
|
return;
|
|
@@ -2093,9 +2101,9 @@ function checkRunConditions(freq, conds, lastrun, store) {
|
|
|
2093
2101
|
break;
|
|
2094
2102
|
case 'user_is_a_contact':
|
|
2095
2103
|
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
|
|
2104
|
+
let emailAttr = find(attributes, att => att.key === 'emails' && attr.text && att.key === 'related_email' && attr.text);
|
|
2105
|
+
let phoneAttr = find(attributes, att => att.key === 'phones' && attr.text && att.key === 'related_phone' && attr.text);
|
|
2106
|
+
let hasContact = emailAttr || phoneAttr;
|
|
2099
2107
|
if (cond.user_is_a_contact) {
|
|
2100
2108
|
if (!hasContact) return false;
|
|
2101
2109
|
}
|
|
@@ -2328,8 +2336,7 @@ function getUrlParameter() {
|
|
|
2328
2336
|
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
|
|
2329
2337
|
}
|
|
2330
2338
|
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';
|
|
2339
|
+
function formatCurrency(val, currency = 'VND') {
|
|
2333
2340
|
let currencyObj = ALL_CURRENCIES.find(cur => cur.code === currency) || {
|
|
2334
2341
|
name: 'Dong',
|
|
2335
2342
|
code: 'VND',
|
|
@@ -3049,7 +3056,7 @@ const ALL_CURRENCIES = [{
|
|
|
3049
3056
|
|
|
3050
3057
|
"use strict";
|
|
3051
3058
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3052
|
-
/* harmony export */
|
|
3059
|
+
/* harmony export */ Z: () => (/* binding */ Gate)
|
|
3053
3060
|
/* harmony export */ });
|
|
3054
3061
|
class Gate {
|
|
3055
3062
|
constructor(isOpen) {
|
|
@@ -3092,41 +3099,41 @@ class Gate {
|
|
|
3092
3099
|
|
|
3093
3100
|
// EXPORTS
|
|
3094
3101
|
__webpack_require__.d(__webpack_exports__, {
|
|
3095
|
-
|
|
3102
|
+
Z: () => (/* binding */ util)
|
|
3096
3103
|
});
|
|
3097
3104
|
|
|
3098
3105
|
// NAMESPACE OBJECT: ./src/util/extractor.js
|
|
3099
3106
|
var extractor_namespaceObject = {};
|
|
3100
3107
|
__webpack_require__.r(extractor_namespaceObject);
|
|
3101
3108
|
__webpack_require__.d(extractor_namespaceObject, {
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
+
extract: () => (extract),
|
|
3110
|
+
extractEmails: () => (extractEmails),
|
|
3111
|
+
extractEmojis: () => (extractEmojis),
|
|
3112
|
+
extractLinks: () => (extractLinks),
|
|
3113
|
+
extractPhones: () => (extractPhones),
|
|
3114
|
+
extractText: () => (extractText),
|
|
3115
|
+
pipeExtracts: () => (pipeExtracts)
|
|
3109
3116
|
});
|
|
3110
3117
|
|
|
3111
3118
|
// NAMESPACE OBJECT: ./src/util/campaign.js
|
|
3112
3119
|
var campaign_namespaceObject = {};
|
|
3113
3120
|
__webpack_require__.r(campaign_namespaceObject);
|
|
3114
3121
|
__webpack_require__.d(campaign_namespaceObject, {
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3122
|
+
trackAreaClicked: () => (trackAreaClicked),
|
|
3123
|
+
trackExitIntent: () => (trackExitIntent),
|
|
3124
|
+
trackInactivity: () => (trackInactivity),
|
|
3125
|
+
trackScrollingPercentage: () => (trackScrollingPercentage),
|
|
3126
|
+
trackTimeOnPage: () => (trackTimeOnPage)
|
|
3120
3127
|
});
|
|
3121
3128
|
|
|
3122
3129
|
// NAMESPACE OBJECT: ./src/util/order.js
|
|
3123
3130
|
var order_namespaceObject = {};
|
|
3124
3131
|
__webpack_require__.r(order_namespaceObject);
|
|
3125
3132
|
__webpack_require__.d(order_namespaceObject, {
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3133
|
+
calcOrderTotal: () => (calcOrderTotal),
|
|
3134
|
+
displayOrderShippingAddress: () => (displayOrderShippingAddress),
|
|
3135
|
+
getOrderDisplayName: () => (getOrderDisplayName),
|
|
3136
|
+
getProductPropName: () => (getProductPropName)
|
|
3130
3137
|
});
|
|
3131
3138
|
|
|
3132
3139
|
// EXTERNAL MODULE: ./src/util/common.js
|
|
@@ -3286,9 +3293,7 @@ function trackAreaClicked(selector, cb) {
|
|
|
3286
3293
|
on('click', selector, cb);
|
|
3287
3294
|
});
|
|
3288
3295
|
}
|
|
3289
|
-
function trackInactivity() {
|
|
3290
|
-
let seconds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
3291
|
-
let cb = arguments.length > 1 ? arguments[1] : undefined;
|
|
3296
|
+
function trackInactivity(seconds = 0, cb) {
|
|
3292
3297
|
let events = ['scroll', 'keyup', 'keydown', 'mousemove', 'mousewheel', 'mouseenter', 'mouseover', 'mousedown', 'touchstart', 'touchmove', 'touchenter'];
|
|
3293
3298
|
let inactiveSeconds = 0;
|
|
3294
3299
|
let resetTime = () => {
|
|
@@ -3311,9 +3316,7 @@ let timeOnPage = 0;
|
|
|
3311
3316
|
campaign_common.setInterval(() => {
|
|
3312
3317
|
timeOnPage += 5;
|
|
3313
3318
|
}, 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;
|
|
3319
|
+
function trackTimeOnPage(seconds = 0, cb) {
|
|
3317
3320
|
if (seconds < 1) {
|
|
3318
3321
|
return campaign_common.setTimeout(function () {
|
|
3319
3322
|
cb(seconds);
|
|
@@ -3349,8 +3352,7 @@ op.map = order_common.map;
|
|
|
3349
3352
|
op.each = order_common.each;
|
|
3350
3353
|
op.size = order_common.size;
|
|
3351
3354
|
op.find = order_common.find;
|
|
3352
|
-
function getProductPropName(product) {
|
|
3353
|
-
let seperator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ' - ';
|
|
3355
|
+
function getProductPropName(product, seperator = ' - ') {
|
|
3354
3356
|
let options = op.get(product, 'options', []);
|
|
3355
3357
|
let props = op.get(product, 'props', []);
|
|
3356
3358
|
let multiPropsOptions = op.filter(options, option => op.size(option.values) > 1);
|
|
@@ -3361,8 +3363,7 @@ function getProductPropName(product) {
|
|
|
3361
3363
|
});
|
|
3362
3364
|
return names.join(seperator);
|
|
3363
3365
|
}
|
|
3364
|
-
function getOrderDisplayName() {
|
|
3365
|
-
let order = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3366
|
+
function getOrderDisplayName(order = {}) {
|
|
3366
3367
|
return order.number || order.id || '';
|
|
3367
3368
|
}
|
|
3368
3369
|
function displayOrderShippingAddress(order, isShorten) {
|
|
@@ -3472,7 +3473,7 @@ sb = Object.assign(sb, order_namespaceObject);
|
|
|
3472
3473
|
|
|
3473
3474
|
"use strict";
|
|
3474
3475
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3475
|
-
/* harmony export */
|
|
3476
|
+
/* harmony export */ Z: () => (/* binding */ Mutex)
|
|
3476
3477
|
/* harmony export */ });
|
|
3477
3478
|
class Mutex {
|
|
3478
3479
|
constructor() {
|
|
@@ -3507,8 +3508,8 @@ class Mutex {
|
|
|
3507
3508
|
"use strict";
|
|
3508
3509
|
__webpack_require__.r(__webpack_exports__);
|
|
3509
3510
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3510
|
-
/* harmony export */
|
|
3511
|
-
/* harmony export */
|
|
3511
|
+
/* harmony export */ get: () => (/* binding */ get),
|
|
3512
|
+
/* harmony export */ set: () => (/* binding */ set)
|
|
3512
3513
|
/* harmony export */ });
|
|
3513
3514
|
var toStr = Object.prototype.toString;
|
|
3514
3515
|
var isArray = Array.isArray || function (obj) {
|
|
@@ -3566,7 +3567,7 @@ function set(obj, path, value) {
|
|
|
3566
3567
|
|
|
3567
3568
|
"use strict";
|
|
3568
3569
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3569
|
-
/* harmony export */
|
|
3570
|
+
/* harmony export */ Z: () => (/* binding */ Pubsub)
|
|
3570
3571
|
/* harmony export */ });
|
|
3571
3572
|
var {
|
|
3572
3573
|
filter,
|
|
@@ -3578,12 +3579,9 @@ class Pubsub {
|
|
|
3578
3579
|
}
|
|
3579
3580
|
publish(topic, payload, payload2, payload3) {
|
|
3580
3581
|
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
|
-
});
|
|
3582
|
+
map(this.listeners[topic], ({
|
|
3583
|
+
cb
|
|
3584
|
+
}) => cb(payload, payload2, payload3));
|
|
3587
3585
|
}
|
|
3588
3586
|
on2(obj, topic, cb) {
|
|
3589
3587
|
if (!this.listeners[topic]) this.listeners[topic] = [];
|
|
@@ -3788,14 +3786,14 @@ class Pubsub {
|
|
|
3788
3786
|
|
|
3789
3787
|
"use strict";
|
|
3790
3788
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3791
|
-
/* harmony export */
|
|
3792
|
-
/* harmony export */
|
|
3793
|
-
/* harmony export */
|
|
3794
|
-
/* harmony export */
|
|
3795
|
-
/* harmony export */
|
|
3789
|
+
/* harmony export */ HY: () => (/* binding */ g),
|
|
3790
|
+
/* harmony export */ Vf: () => (/* binding */ _),
|
|
3791
|
+
/* harmony export */ h: () => (/* binding */ y),
|
|
3792
|
+
/* harmony export */ sY: () => (/* binding */ q),
|
|
3793
|
+
/* harmony export */ wA: () => (/* binding */ b)
|
|
3796
3794
|
/* harmony export */ });
|
|
3797
3795
|
/* 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;
|
|
3796
|
+
var n,l,u,t,i,o,r,f,e,c={},s=[],a=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,h=Array.isArray;function v(n,l){for(var u in l)n[u]=l[u];return n}function p(n){var l=n.parentNode;l&&l.removeChild(n)}function y(l,u,t){var i,o,r,f={};for(r in u)"key"==r?i=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return d(l,f,i,o,null)}function d(n,t,i,o,r){var f={type:n,props:t,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==r?++u:r,__i:-1,__u:0};return null==r&&null!=l.vnode&&l.vnode(f),f}function _(){return{current:null}}function g(n){return n.children}function b(n,l){this.props=n,this.context=l}function m(n,l){if(null==l)return n.__?m(n.__,n.__i+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return"function"==typeof n.type?m(n):null}function k(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return k(n)}}function w(n){(!n.__d&&(n.__d=!0)&&i.push(n)&&!x.__r++||o!==l.debounceRendering)&&((o=l.debounceRendering)||r)(x)}function x(){var n,u,t,o,r,e,c,s,a;for(i.sort(f);n=i.shift();)n.__d&&(u=i.length,o=void 0,e=(r=(t=n).__v).__e,s=[],a=[],(c=t.__P)&&((o=v({},r)).__v=r.__v+1,l.vnode&&l.vnode(o),L(c,o,r,t.__n,void 0!==c.ownerSVGElement,32&r.__u?[e]:null,s,null==e?m(r):e,!!(32&r.__u),a),o.__.__k[o.__i]=o,M(s,o,a),o.__e!=e&&k(o)),i.length>u&&i.sort(f));x.__r=0}function C(n,l,u,t,i,o,r,f,e,a,h){var v,p,y,d,_,g=t&&t.__k||s,b=l.length;for(u.__d=e,P(u,l,g),e=u.__d,v=0;v<b;v++)null!=(y=u.__k[v])&&"boolean"!=typeof y&&"function"!=typeof y&&(p=-1===y.__i?c:g[y.__i]||c,y.__i=v,L(n,y,p,i,o,r,f,e,a,h),d=y.__e,y.ref&&p.ref!=y.ref&&(p.ref&&z(p.ref,null,y),h.push(y.ref,y.__c||d,y)),null==_&&null!=d&&(_=d),65536&y.__u||p.__k===y.__k?e=S(y,e,n):"function"==typeof y.type&&void 0!==y.__d?e=y.__d:d&&(e=d.nextSibling),y.__d=void 0,y.__u&=-196609);u.__d=e,u.__e=_}function P(n,l,u){var t,i,o,r,f,e=l.length,c=u.length,s=c,a=0;for(n.__k=[],t=0;t<e;t++)null!=(i=n.__k[t]=null==(i=l[t])||"boolean"==typeof i||"function"==typeof i?null:"string"==typeof i||"number"==typeof i||"bigint"==typeof i||i.constructor==String?d(null,i,null,null,i):h(i)?d(g,{children:i},null,null,null):void 0===i.constructor&&i.__b>0?d(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)?(i.__=n,i.__b=n.__b+1,f=H(i,u,r=t+a,s),i.__i=f,o=null,-1!==f&&(s--,(o=u[f])&&(o.__u|=131072)),null==o||null===o.__v?(-1==f&&a--,"function"!=typeof i.type&&(i.__u|=65536)):f!==r&&(f===r+1?a++:f>r?s>e-r?a+=f-r:a--:a=f<r&&f==r-1?f-r:0,f!==t+a&&(i.__u|=65536))):(o=u[t])&&null==o.key&&o.__e&&(o.__e==n.__d&&(n.__d=m(o)),N(o,o,!1),u[t]=null,s--);if(s)for(t=0;t<c;t++)null!=(o=u[t])&&0==(131072&o.__u)&&(o.__e==n.__d&&(n.__d=m(o)),N(o,o))}function S(n,l,u){var t,i;if("function"==typeof n.type){for(t=n.__k,i=0;t&&i<t.length;i++)t[i]&&(t[i].__=n,l=S(t[i],l,u));return l}return n.__e!=l&&(u.insertBefore(n.__e,l||null),l=n.__e),l&&l.nextSibling}function $(n,l){return l=l||[],null==n||"boolean"==typeof n||(h(n)?n.some(function(n){$(n,l)}):l.push(n)),l}function H(n,l,u,t){var i=n.key,o=n.type,r=u-1,f=u+1,e=l[u];if(null===e||e&&i==e.key&&o===e.type)return u;if(t>(null!=e&&0==(131072&e.__u)?1:0))for(;r>=0||f<l.length;){if(r>=0){if((e=l[r])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return r;r--}if(f<l.length){if((e=l[f])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return f;f++}}return-1}function I(n,l,u){"-"===l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||a.test(l)?u:u+"px"}function T(n,l,u,t,i){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else{if("string"==typeof t&&(n.style.cssText=t=""),t)for(l in t)u&&l in u||I(n.style,l,"");if(u)for(l in u)t&&u[l]===t[l]||I(n.style,l,u[l])}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/(PointerCapture)$|Capture$/,"$1")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?t?u.u=t.u:(u.u=Date.now(),n.addEventListener(l,o?D:A,o)):n.removeEventListener(l,o?D:A,o);else{if(i)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==l&&"height"!==l&&"href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&"rowSpan"!==l&&"colSpan"!==l&&"role"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&"-"!==l[4]?n.removeAttribute(l):n.setAttribute(l,u))}}function A(n){var u=this.l[n.type+!1];if(n.t){if(n.t<=u.u)return}else n.t=Date.now();return u(l.event?l.event(n):n)}function D(n){return this.l[n.type+!0](l.event?l.event(n):n)}function L(n,u,t,i,o,r,f,e,c,s){var a,p,y,d,_,m,k,w,x,P,S,$,H,I,T,A=u.type;if(void 0!==u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),r=[e=u.__e=t.__e]),(a=l.__b)&&a(u);n:if("function"==typeof A)try{if(w=u.props,x=(a=A.contextType)&&i[a.__c],P=a?x?x.props.value:a.__:i,t.__c?k=(p=u.__c=t.__c).__=p.__E:("prototype"in A&&A.prototype.render?u.__c=p=new A(w,P):(u.__c=p=new b(w,P),p.constructor=A,p.render=O),x&&x.sub(p),p.props=w,p.state||(p.state={}),p.context=P,p.__n=i,y=p.__d=!0,p.__h=[],p._sb=[]),null==p.__s&&(p.__s=p.state),null!=A.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=v({},p.__s)),v(p.__s,A.getDerivedStateFromProps(w,p.__s))),d=p.props,_=p.state,p.__v=u,y)null==A.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(null==A.getDerivedStateFromProps&&w!==d&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(w,P),!p.__e&&(null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(w,p.__s,P)||u.__v===t.__v)){for(u.__v!==t.__v&&(p.props=w,p.state=p.__s,p.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.forEach(function(n){n&&(n.__=u)}),S=0;S<p._sb.length;S++)p.__h.push(p._sb[S]);p._sb=[],p.__h.length&&f.push(p);break n}null!=p.componentWillUpdate&&p.componentWillUpdate(w,p.__s,P),null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(d,_,m)})}if(p.context=P,p.props=w,p.__P=n,p.__e=!1,$=l.__r,H=0,"prototype"in A&&A.prototype.render){for(p.state=p.__s,p.__d=!1,$&&$(u),a=p.render(p.props,p.state,p.context),I=0;I<p._sb.length;I++)p.__h.push(p._sb[I]);p._sb=[]}else do{p.__d=!1,$&&$(u),a=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++H<25);p.state=p.__s,null!=p.getChildContext&&(i=v(v({},i),p.getChildContext())),y||null==p.getSnapshotBeforeUpdate||(m=p.getSnapshotBeforeUpdate(d,_)),C(n,h(T=null!=a&&a.type===g&&null==a.key?a.props.children:a)?T:[T],u,t,i,o,r,f,e,c,s),p.base=u.__e,u.__u&=-161,p.__h.length&&f.push(p),k&&(p.__E=p.__=null)}catch(n){u.__v=null,c||null!=r?(u.__e=e,u.__u|=c?160:32,r[r.indexOf(e)]=null):(u.__e=t.__e,u.__k=t.__k),l.__e(n,u,t)}else null==r&&u.__v===t.__v?(u.__k=t.__k,u.__e=t.__e):u.__e=j(t.__e,u,t,i,o,r,f,c,s);(a=l.diffed)&&a(u)}function M(n,u,t){u.__d=void 0;for(var i=0;i<t.length;i++)z(t[i],t[++i],t[++i]);l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u)})}catch(n){l.__e(n,u.__v)}})}function j(l,u,t,i,o,r,f,e,s){var a,v,y,d,_,g,b,k=t.props,w=u.props,x=u.type;if("svg"===x&&(o=!0),null!=r)for(a=0;a<r.length;a++)if((_=r[a])&&"setAttribute"in _==!!x&&(x?_.localName===x:3===_.nodeType)){l=_,r[a]=null;break}if(null==l){if(null===x)return document.createTextNode(w);l=o?document.createElementNS("http://www.w3.org/2000/svg",x):document.createElement(x,w.is&&w),r=null,e=!1}if(null===x)k===w||e&&l.data===w||(l.data=w);else{if(r=r&&n.call(l.childNodes),k=t.props||c,!e&&null!=r)for(k={},a=0;a<l.attributes.length;a++)k[(_=l.attributes[a]).name]=_.value;for(a in k)_=k[a],"children"==a||("dangerouslySetInnerHTML"==a?y=_:"key"===a||a in w||T(l,a,null,_,o));for(a in w)_=w[a],"children"==a?d=_:"dangerouslySetInnerHTML"==a?v=_:"value"==a?g=_:"checked"==a?b=_:"key"===a||e&&"function"!=typeof _||k[a]===_||T(l,a,_,k[a],o);if(v)e||y&&(v.__html===y.__html||v.__html===l.innerHTML)||(l.innerHTML=v.__html),u.__k=[];else if(y&&(l.innerHTML=""),C(l,h(d)?d:[d],u,t,i,o&&"foreignObject"!==x,r,f,r?r[0]:t.__k&&m(t,0),e,s),null!=r)for(a=r.length;a--;)null!=r[a]&&p(r[a]);e||(a="value",void 0!==g&&(g!==l[a]||"progress"===x&&!g||"option"===x&&g!==k[a])&&T(l,a,g,k[a],!1),a="checked",void 0!==b&&b!==l[a]&&T(l,a,b,k[a],!1))}return l}function z(n,u,t){try{"function"==typeof n?n(u):n.current=u}catch(n){l.__e(n,t)}}function N(n,u,t){var i,o;if(l.unmount&&l.unmount(n),(i=n.ref)&&(i.current&&i.current!==n.__e||z(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(n){l.__e(n,u)}i.base=i.__P=null,n.__c=void 0}if(i=n.__k)for(o=0;o<i.length;o++)i[o]&&N(i[o],u,t||"function"!=typeof n.type);t||null==n.__e||p(n.__e),n.__=n.__e=n.__d=void 0}function O(n,l,u){return this.constructor(n,u)}function q(u,t,i){var o,r,f,e;l.__&&l.__(u,t),r=(o="function"==typeof i)?null:i&&i.__k||t.__k,f=[],e=[],L(t,u=(!o&&i||t).__k=y(g,null,[u]),r||c,c,void 0!==t.ownerSVGElement,!o&&i?[i]:r?null:t.firstChild?n.call(t.childNodes):null,f,!o&&i?i:r?r.__e:t.firstChild,o,e),M(f,u,e)}function B(n,l){q(n,l,B)}function E(l,u,t){var i,o,r,f,e=v({},l.props);for(r in l.type&&l.type.defaultProps&&(f=l.type.defaultProps),u)"key"==r?i=u[r]:"ref"==r?o=u[r]:e[r]=void 0===u[r]&&void 0!==f?f[r]:u[r];return arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):t),d(l.type,e,i||l.key,o||l.ref,null)}function F(n,l){var u={__c:l="__cC"+e++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,t;return this.getChildContext||(u=[],(t={})[l]=this,this.getChildContext=function(){return t},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(function(n){n.__e=!0,w(n)})},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n)}}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=s.slice,l={__e:function(n,l,u,t){for(var i,o,r;l=l.__;)if((i=l.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(n)),r=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),r=i.__d),r)return i.__E=i}catch(l){n=l}throw n}},u=0,t=function(n){return null!=n&&null==n.constructor},b.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=v({},this.state),"function"==typeof n&&(n=n(v({},u),this.props)),n&&v(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),w(this))},b.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),w(this))},b.prototype.render=g,i=[],r="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f=function(n,l){return n.__v.__b-l.__v.__b},x.__r=0,e=0;
|
|
3799
3797
|
//# sourceMappingURL=preact.module.js.map
|
|
3800
3798
|
|
|
3801
3799
|
|
|
@@ -3907,6 +3905,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
3905
|
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
|
3908
3906
|
/******/ }
|
|
3909
3907
|
/******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
|
|
3908
|
+
/******/
|
|
3910
3909
|
/******/ script.src = url;
|
|
3911
3910
|
/******/ }
|
|
3912
3911
|
/******/ inProgress[url] = [done];
|
|
@@ -3919,7 +3918,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
3918
|
/******/ script.parentNode && script.parentNode.removeChild(script);
|
|
3920
3919
|
/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
|
|
3921
3920
|
/******/ if(prev) return prev(event);
|
|
3922
|
-
/******/ }
|
|
3921
|
+
/******/ }
|
|
3923
3922
|
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
|
|
3924
3923
|
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
|
|
3925
3924
|
/******/ script.onload = onScriptComplete.bind(null, script.onload);
|
|
@@ -3988,7 +3987,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
3987
|
/******/ }
|
|
3989
3988
|
/******/ };
|
|
3990
3989
|
/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
|
|
3991
|
-
/******/ }
|
|
3990
|
+
/******/ }
|
|
3992
3991
|
/******/ }
|
|
3993
3992
|
/******/ }
|
|
3994
3993
|
/******/ };
|
|
@@ -4054,14 +4053,14 @@ var lsdb = (__webpack_require__(6929)/* ["default"] */ .Z);
|
|
|
4054
4053
|
});
|
|
4055
4054
|
;// CONCATENATED MODULE: ./src/store/api.js
|
|
4056
4055
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4057
|
-
function _toPropertyKey(
|
|
4058
|
-
function _toPrimitive(
|
|
4056
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
4057
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4059
4058
|
|
|
4060
4059
|
const ajax = __webpack_require__(7460);
|
|
4061
|
-
ajax.env.XMLHttpRequest = util/* default
|
|
4060
|
+
ajax.env.XMLHttpRequest = util/* default */.Z.XMLHttpRequest;
|
|
4062
4061
|
function jsonifyTextPlain(param, done) {
|
|
4063
4062
|
let req = param.request;
|
|
4064
|
-
if (req.content_type === 'text/plain' && req.body !== undefined) req.body = util/* default
|
|
4063
|
+
if (req.content_type === 'text/plain' && req.body !== undefined) req.body = util/* default */.Z.stringify(req.body);
|
|
4065
4064
|
done(true);
|
|
4066
4065
|
}
|
|
4067
4066
|
/* harmony default export */ const api = (class {
|
|
@@ -4071,14 +4070,12 @@ function jsonifyTextPlain(param, done) {
|
|
|
4071
4070
|
_defineProperty(this, "ajax", ajax);
|
|
4072
4071
|
_defineProperty(this, "start", extraData => {
|
|
4073
4072
|
let data = {
|
|
4074
|
-
starter_id: this.uid,
|
|
4075
|
-
starter_type: 'user',
|
|
4076
4073
|
touchpoint: {
|
|
4077
4074
|
channel: 'subiz',
|
|
4078
4075
|
source: 'web'
|
|
4079
4076
|
}
|
|
4080
4077
|
};
|
|
4081
|
-
util/* default
|
|
4078
|
+
util/* default */.Z.each(extraData, (v, k) => {
|
|
4082
4079
|
data[k] = v;
|
|
4083
4080
|
});
|
|
4084
4081
|
return this.apireq.post(`/accounts/${this.accid}/conversations`, data);
|
|
@@ -4102,7 +4099,7 @@ function jsonifyTextPlain(param, done) {
|
|
|
4102
4099
|
viewing_product_sku: sku,
|
|
4103
4100
|
viewing_product_source_id: source_id,
|
|
4104
4101
|
viewing_product_id: productid,
|
|
4105
|
-
pinged: util/* default
|
|
4102
|
+
pinged: util/* default */.Z.Date.now(),
|
|
4106
4103
|
is_focused: false
|
|
4107
4104
|
}
|
|
4108
4105
|
}
|
|
@@ -4141,7 +4138,7 @@ function jsonifyTextPlain(param, done) {
|
|
|
4141
4138
|
error
|
|
4142
4139
|
};
|
|
4143
4140
|
return {
|
|
4144
|
-
url:
|
|
4141
|
+
url: body.url
|
|
4145
4142
|
};
|
|
4146
4143
|
});
|
|
4147
4144
|
_defineProperty(this, "time", _ => ajax.setBaseUrl(this.ApiURL).withCredentials(true).setParser('json').get('/time'));
|
|
@@ -4162,7 +4159,7 @@ function jsonifyTextPlain(param, done) {
|
|
|
4162
4159
|
_defineProperty(this, "suggest_address", keyword => this.apireq.setQuery({
|
|
4163
4160
|
keyword: keyword
|
|
4164
4161
|
}).get(`/accounts/${this.accid}/addresses`));
|
|
4165
|
-
this.refreshLock = new util/* default
|
|
4162
|
+
this.refreshLock = new util/* default */.Z.Mutex();
|
|
4166
4163
|
this.FileURL = FileURL;
|
|
4167
4164
|
this.ApiURL = ApiURL;
|
|
4168
4165
|
this.apireq = ajax.setBaseUrl(ApiURL).withCredentials(true).addQuery('v', '6').setContentType('text/plain').beforeHook(jsonifyTextPlain).setParser('json').beforeHook((param, done) => {
|
|
@@ -4193,15 +4190,16 @@ function jsonifyTextPlain(param, done) {
|
|
|
4193
4190
|
let outuser;
|
|
4194
4191
|
for (let i = 0; true; i++) {
|
|
4195
4192
|
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 (
|
|
4197
|
-
|
|
4198
|
-
|
|
4193
|
+
if (outuser.error && util/* default */.Z.get(outuser, 'body.code', '').indexOf('locked_account') != -1) break;
|
|
4194
|
+
if (!util/* default */.Z.get(outuser, 'body.id')) {
|
|
4195
|
+
let sleeptime = Math.min(2000 + i * 400, 60000);
|
|
4196
|
+
await util/* default */.Z.sleep(sleeptime);
|
|
4199
4197
|
continue;
|
|
4200
4198
|
}
|
|
4201
4199
|
break;
|
|
4202
4200
|
}
|
|
4203
4201
|
if (outuser.error) {
|
|
4204
|
-
if (util/* default
|
|
4202
|
+
if (util/* default */.Z.get(outuser.body.code)) return {
|
|
4205
4203
|
error: outuser.body.code
|
|
4206
4204
|
};
|
|
4207
4205
|
return outuser;
|
|
@@ -4214,7 +4212,7 @@ function jsonifyTextPlain(param, done) {
|
|
|
4214
4212
|
this.tokensession = this.tokensession || 0;
|
|
4215
4213
|
this.tokensession++;
|
|
4216
4214
|
let tokensession = this.tokensession;
|
|
4217
|
-
if (!this.accid || !util/* default
|
|
4215
|
+
if (!this.accid || !util/* default */.Z.startsWith(this.accid, 'ac')) return {
|
|
4218
4216
|
error: 'invalid_account_id'
|
|
4219
4217
|
};
|
|
4220
4218
|
if (!this.profile_id) return {
|
|
@@ -4230,13 +4228,13 @@ function jsonifyTextPlain(param, done) {
|
|
|
4230
4228
|
this.refreshLock.unlock();
|
|
4231
4229
|
return;
|
|
4232
4230
|
}
|
|
4233
|
-
let age = (util/* default
|
|
4231
|
+
let age = (util/* default */.Z.Date.now() - (this.last_token_at || 0)) / 1000;
|
|
4234
4232
|
if (!force && this.last_token && age < 1800) {
|
|
4235
4233
|
this.refreshLock.unlock();
|
|
4236
4234
|
return this.last_token;
|
|
4237
4235
|
}
|
|
4238
4236
|
if (!force && this.last_token && age < 3000) {
|
|
4239
|
-
if (this.token_generator) util/* default
|
|
4237
|
+
if (this.token_generator) util/* default */.Z.setTimeout(async () => {
|
|
4240
4238
|
let token, err;
|
|
4241
4239
|
try {
|
|
4242
4240
|
token = await tokenGenerator(profile_id);
|
|
@@ -4248,7 +4246,7 @@ function jsonifyTextPlain(param, done) {
|
|
|
4248
4246
|
return;
|
|
4249
4247
|
}
|
|
4250
4248
|
if (err) this.last_token = 'error';else this.last_token = token;
|
|
4251
|
-
this.last_token_at = util/* default
|
|
4249
|
+
this.last_token_at = util/* default */.Z.Date.now();
|
|
4252
4250
|
this.refreshLock.unlock();
|
|
4253
4251
|
});
|
|
4254
4252
|
return this.last_token;
|
|
@@ -4265,7 +4263,7 @@ function jsonifyTextPlain(param, done) {
|
|
|
4265
4263
|
return;
|
|
4266
4264
|
}
|
|
4267
4265
|
if (err) this.last_token = 'error';else this.last_token = token;
|
|
4268
|
-
this.last_token_at = util/* default
|
|
4266
|
+
this.last_token_at = util/* default */.Z.Date.now();
|
|
4269
4267
|
this.refreshLock.unlock();
|
|
4270
4268
|
return this.last_token;
|
|
4271
4269
|
};
|
|
@@ -4274,15 +4272,15 @@ function jsonifyTextPlain(param, done) {
|
|
|
4274
4272
|
await this.token_generator(true);
|
|
4275
4273
|
if (tokensession != this.tokensession) break;
|
|
4276
4274
|
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
|
|
4275
|
+
if (!util/* default */.Z.get(outuser, 'body.id')) {
|
|
4278
4276
|
let sleeptime = Math.min(2000 + i * 100, 120000);
|
|
4279
|
-
await util/* default
|
|
4277
|
+
await util/* default */.Z.sleep(sleeptime);
|
|
4280
4278
|
continue;
|
|
4281
4279
|
}
|
|
4282
4280
|
break;
|
|
4283
4281
|
}
|
|
4284
4282
|
if (outuser.error) {
|
|
4285
|
-
if (util/* default
|
|
4283
|
+
if (util/* default */.Z.get(outuser.body.code)) return {
|
|
4286
4284
|
error: outuser.body.code
|
|
4287
4285
|
};
|
|
4288
4286
|
return outuser;
|
|
@@ -4325,15 +4323,15 @@ function jsonifyTextPlain(param, done) {
|
|
|
4325
4323
|
});
|
|
4326
4324
|
;// CONCATENATED MODULE: ./src/store/api_fake.js
|
|
4327
4325
|
function api_fake_defineProperty(obj, key, value) { key = api_fake_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4328
|
-
function api_fake_toPropertyKey(
|
|
4329
|
-
function api_fake_toPrimitive(
|
|
4326
|
+
function api_fake_toPropertyKey(t) { var i = api_fake_toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
4327
|
+
function api_fake_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4330
4328
|
|
|
4331
4329
|
const api_fake_ajax = __webpack_require__(7460);
|
|
4332
4330
|
api_fake_ajax.env.XMLHttpRequest = window.XMLHttpRequest;
|
|
4333
4331
|
const findAnswer = challenge => challenge.answer;
|
|
4334
4332
|
function api_fake_jsonifyTextPlain(param, done) {
|
|
4335
4333
|
let req = param.request;
|
|
4336
|
-
if (req.content_type === 'text/plain' && req.body !== undefined) req.body = util/* default
|
|
4334
|
+
if (req.content_type === 'text/plain' && req.body !== undefined) req.body = util/* default */.Z.stringify(req.body);
|
|
4337
4335
|
done(true);
|
|
4338
4336
|
}
|
|
4339
4337
|
const OK200 = Promise.resolve({
|
|
@@ -4379,7 +4377,7 @@ const OK200 = Promise.resolve({
|
|
|
4379
4377
|
api_fake_defineProperty(this, "getChallenge", accid => OK200);
|
|
4380
4378
|
api_fake_defineProperty(this, "time", _ => Promise.resolve({
|
|
4381
4379
|
code: 200,
|
|
4382
|
-
body: new util/* default
|
|
4380
|
+
body: new util/* default */.Z.Date().toISOString()
|
|
4383
4381
|
}));
|
|
4384
4382
|
api_fake_defineProperty(this, "updateUser", data => OK200);
|
|
4385
4383
|
api_fake_defineProperty(this, "getUser", _ => Promise.resolve({
|
|
@@ -4738,21 +4736,21 @@ function makeFakeMessages(accid, convoid, userid, agentid) {
|
|
|
4738
4736
|
});
|
|
4739
4737
|
;// CONCATENATED MODULE: ./src/store/store.js
|
|
4740
4738
|
function store_defineProperty(obj, key, value) { key = store_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4741
|
-
function store_toPropertyKey(
|
|
4742
|
-
function store_toPrimitive(
|
|
4739
|
+
function store_toPropertyKey(t) { var i = store_toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
4740
|
+
function store_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4743
4741
|
|
|
4744
4742
|
var flow = __webpack_require__(3165);
|
|
4745
4743
|
|
|
4746
4744
|
|
|
4747
4745
|
|
|
4748
4746
|
|
|
4749
|
-
var Realtime = __webpack_require__(
|
|
4747
|
+
var Realtime = __webpack_require__(608);
|
|
4750
4748
|
var cookie = __webpack_require__(9554);
|
|
4751
4749
|
cookie.defaults.path = '/';
|
|
4752
4750
|
cookie.expiresMultiplier = 60 * 60 * 24;
|
|
4753
4751
|
cookie.defaults.expires = 3650;
|
|
4754
4752
|
const MAX_CONVO = 20;
|
|
4755
|
-
const page_loaded = util/* default
|
|
4753
|
+
const page_loaded = util/* default */.Z.Date.now();
|
|
4756
4754
|
class Store {
|
|
4757
4755
|
constructor(ApiURL, FileURL, RealtimeURL, inmem, fakeapi) {
|
|
4758
4756
|
store_defineProperty(this, "inmem", false);
|
|
@@ -4770,14 +4768,14 @@ class Store {
|
|
|
4770
4768
|
let user = this.matchUser();
|
|
4771
4769
|
let allconvos = this.matchConvo('*');
|
|
4772
4770
|
let unreadcount = 0;
|
|
4773
|
-
util/* default
|
|
4774
|
-
if (!util/* default
|
|
4771
|
+
util/* default */.Z.map(allconvos, convo => {
|
|
4772
|
+
if (!util/* default */.Z.isConvoSeen(convo, user.id)) unreadcount++;
|
|
4775
4773
|
});
|
|
4776
4774
|
return unreadcount;
|
|
4777
4775
|
});
|
|
4778
4776
|
store_defineProperty(this, "matchPlugin", () => {
|
|
4779
|
-
if (util/* default
|
|
4780
|
-
return util/* default
|
|
4777
|
+
if (util/* default */.Z.size(this.forcePlugins) > 0) return util/* default */.Z.cloneDeep(this.forcePlugins);
|
|
4778
|
+
return util/* default */.Z.cloneDeep(this.cache.match('plugin')) || {};
|
|
4781
4779
|
});
|
|
4782
4780
|
store_defineProperty(this, "device", {});
|
|
4783
4781
|
store_defineProperty(this, "browserVisibility", 'visible');
|
|
@@ -4790,12 +4788,13 @@ class Store {
|
|
|
4790
4788
|
if (!id) return;
|
|
4791
4789
|
if (id === '*') {
|
|
4792
4790
|
this._touchAcc();
|
|
4793
|
-
return util/* default
|
|
4791
|
+
return util/* default */.Z.filter(this.cache.all(), (value, k) => k.startsWith('convo_'));
|
|
4794
4792
|
}
|
|
4795
4793
|
if (!this.isInsync(id)) this.fetchConvo(id);
|
|
4796
4794
|
return this.cache.match('convo_' + id);
|
|
4797
4795
|
});
|
|
4798
4796
|
store_defineProperty(this, "fetchConvo", async cid => {
|
|
4797
|
+
if (this._die) return dieErr;
|
|
4799
4798
|
await this.readyGate.entry();
|
|
4800
4799
|
await this.reconnectGate.entry(undefined, true);
|
|
4801
4800
|
if (this.isInsync(cid)) return this.reconnectGate.open();
|
|
@@ -4813,7 +4812,7 @@ class Store {
|
|
|
4813
4812
|
store_defineProperty(this, "listEvents", id => {
|
|
4814
4813
|
if (!id || id === '*' || typeof id !== 'string') return;
|
|
4815
4814
|
if (!this.isInsync('events' + id)) {
|
|
4816
|
-
util/* default
|
|
4815
|
+
util/* default */.Z.setTimeout(async () => {
|
|
4817
4816
|
await this.readyGate.entry();
|
|
4818
4817
|
await this.reconnectGate.entry(undefined, true);
|
|
4819
4818
|
if (this.isInsync('events' + id)) return this.reconnectGate.open();
|
|
@@ -4836,10 +4835,10 @@ class Store {
|
|
|
4836
4835
|
});
|
|
4837
4836
|
store_defineProperty(this, "matchLocation", () => this.cache.match('location') || {});
|
|
4838
4837
|
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
|
|
4838
|
+
store_defineProperty(this, "readyGate", new util/* default */.Z.Gate());
|
|
4839
|
+
store_defineProperty(this, "convoGate", new util/* default */.Z.Gate(true));
|
|
4840
|
+
store_defineProperty(this, "reconnectGate", new util/* default */.Z.Gate(true));
|
|
4841
|
+
store_defineProperty(this, "wsGate", new util/* default */.Z.Gate(true));
|
|
4843
4842
|
store_defineProperty(this, "matchLastview", () => {
|
|
4844
4843
|
let lastView = this.kv.match('lastview') || {};
|
|
4845
4844
|
let user = this.cache.match('user') || {};
|
|
@@ -4850,10 +4849,11 @@ class Store {
|
|
|
4850
4849
|
store_defineProperty(this, "matchIsOpen", () => !!this.kv.match('isopen'));
|
|
4851
4850
|
store_defineProperty(this, "matchHasManuallyClosed", () => !!this.kv.match('hasManuallyClosed'));
|
|
4852
4851
|
store_defineProperty(this, "matchClosePreviewAt", () => this.kv.match('close_preview_at') || 0);
|
|
4853
|
-
store_defineProperty(this, "sendPresence", util/* default
|
|
4852
|
+
store_defineProperty(this, "sendPresence", util/* default */.Z.throttle(async () => {
|
|
4853
|
+
if (this._die) return dieErr;
|
|
4854
4854
|
await this.readyGate.entry();
|
|
4855
|
-
if (!util/* default
|
|
4856
|
-
if (util/* default
|
|
4855
|
+
if (!util/* default */.Z.get(this.cache.match('user'), 'id')) return;
|
|
4856
|
+
if (util/* default */.Z.isUserBanned(this.cache.match('user'))) return;
|
|
4857
4857
|
let hasfocus = this.browserVisibility === 'visible' && document.hasFocus();
|
|
4858
4858
|
if (!hasfocus) {
|
|
4859
4859
|
this.api.sendLostFocus(this.device, this._currentViewingProduct.id, this._currentViewingProduct.source_id, this._currentViewingProduct.sku);
|
|
@@ -4863,10 +4863,10 @@ class Store {
|
|
|
4863
4863
|
}, 1000, {
|
|
4864
4864
|
leading: false
|
|
4865
4865
|
}));
|
|
4866
|
-
store_defineProperty(this, "now", () => util/* default
|
|
4866
|
+
store_defineProperty(this, "now", () => util/* default */.Z.Date.now() + this.timeDiff);
|
|
4867
4867
|
store_defineProperty(this, "seenQueue", []);
|
|
4868
4868
|
store_defineProperty(this, "matchTrafficSource", () => this.kv.match('traffic_source'));
|
|
4869
|
-
store_defineProperty(this, "_typing", util/* default
|
|
4869
|
+
store_defineProperty(this, "_typing", util/* default */.Z.throttle(convoid => this.api.sendTyping(convoid), 3000, {
|
|
4870
4870
|
trailing: false
|
|
4871
4871
|
}));
|
|
4872
4872
|
store_defineProperty(this, "onConvoEvent", (o, cb) => this.pubsub.on2(o, 'events', cb));
|
|
@@ -4885,7 +4885,7 @@ class Store {
|
|
|
4885
4885
|
sendEventToThirdParty('SUBIZ Chat', 'Opened', 'Subiz Windows');
|
|
4886
4886
|
}
|
|
4887
4887
|
});
|
|
4888
|
-
store_defineProperty(this, "closePreview", () => this.kv.put('close_preview_at', new util/* default
|
|
4888
|
+
store_defineProperty(this, "closePreview", () => this.kv.put('close_preview_at', new util/* default */.Z.Date().getTime()));
|
|
4889
4889
|
store_defineProperty(this, "setLastview", (view, opts) => {
|
|
4890
4890
|
let user = this.cache.match('user') || {};
|
|
4891
4891
|
if (!user.id) return;
|
|
@@ -4897,6 +4897,7 @@ class Store {
|
|
|
4897
4897
|
});
|
|
4898
4898
|
store_defineProperty(this, "timeDiff", 0);
|
|
4899
4899
|
this.g_sync = {};
|
|
4900
|
+
this._die = false;
|
|
4900
4901
|
this.forceDevice = null;
|
|
4901
4902
|
this.forcePlugins = {};
|
|
4902
4903
|
this.forceAcc = {};
|
|
@@ -4918,31 +4919,38 @@ class Store {
|
|
|
4918
4919
|
this.cookie = inmemCookie;
|
|
4919
4920
|
}
|
|
4920
4921
|
cleanLocalStorage();
|
|
4921
|
-
this.pubsub = new util/* default
|
|
4922
|
+
this.pubsub = new util/* default */.Z.Pubsub();
|
|
4922
4923
|
this.kv = new storage.kv(new storage.lsdb('sbz2023', this.inmem), 'kv');
|
|
4923
4924
|
this.cache = new storage.kv(new storage.lsdb('sbz2023', true), 'kv');
|
|
4924
4925
|
this.chain = new storage.chain(new storage.lsdb('cbz2023', true), 'ch');
|
|
4925
4926
|
this.getLocaleContent = this.api.getLocaleContent;
|
|
4926
4927
|
this.g_haveSentSeenM = {};
|
|
4927
|
-
window.addEventListener('blur',
|
|
4928
|
-
window.addEventListener('focus',
|
|
4929
|
-
util/* default
|
|
4930
|
-
|
|
4928
|
+
window.addEventListener('blur', this.sendPresence);
|
|
4929
|
+
window.addEventListener('focus', this.sendPresence);
|
|
4930
|
+
this._presenceInterval1 = util/* default */.Z.setInterval(() => {
|
|
4931
|
+
if (this._die) return util/* default */.Z.clearInterval(this._presenceInterval1);
|
|
4932
|
+
if (this.browserVisibility === 'visible' && document.hasFocus()) this.sendPresence();
|
|
4933
|
+
}, 20000);
|
|
4934
|
+
this._presenceInterval2 = util/* default */.Z.setInterval(() => {
|
|
4935
|
+
if (this._die) return util/* default */.Z.clearInterval(this._presenceInterval2);
|
|
4936
|
+
if (this.browserVisibility !== 'visible' || document.hasFocus()) this.sendPresence();
|
|
4937
|
+
}, 60000);
|
|
4931
4938
|
onVisibilityChange(val => {
|
|
4939
|
+
if (this._die) return;
|
|
4932
4940
|
this.browserVisibility = val;
|
|
4933
4941
|
this.sendPresence();
|
|
4934
4942
|
});
|
|
4935
4943
|
this.loopTime();
|
|
4936
4944
|
this.device = this.getDeviceInfo();
|
|
4937
|
-
const _gaInterval = util/* default
|
|
4945
|
+
const _gaInterval = util/* default */.Z.setInterval(() => {
|
|
4938
4946
|
let user = this.cache.match('user') || {};
|
|
4939
4947
|
if (!user.id) return;
|
|
4940
4948
|
var dev = this.getDeviceInfo();
|
|
4941
4949
|
if (!dev.ga_tracking_ids || !dev.ga_client_id) return;
|
|
4942
|
-
util/* default
|
|
4950
|
+
util/* default */.Z.clearInterval(_gaInterval);
|
|
4943
4951
|
this.device = dev;
|
|
4944
4952
|
let ga_client_id = dev.ga_client_id;
|
|
4945
|
-
if (ga_client_id !== util/* default
|
|
4953
|
+
if (ga_client_id !== util/* default */.Z.getUserAttr(user, 'ga_client_id', 'text')) {
|
|
4946
4954
|
this.setUser({
|
|
4947
4955
|
attributes: [{
|
|
4948
4956
|
type: 'text',
|
|
@@ -4963,10 +4971,10 @@ class Store {
|
|
|
4963
4971
|
if (p.sku) this._currentViewingProduct.sku = (p.sku + '').trim();
|
|
4964
4972
|
}
|
|
4965
4973
|
getLinkedProduct() {
|
|
4966
|
-
return util/* default
|
|
4974
|
+
return util/* default */.Z.cloneDeep(this._currentViewingProduct);
|
|
4967
4975
|
}
|
|
4968
4976
|
isInsync(key) {
|
|
4969
|
-
return util/* default
|
|
4977
|
+
return util/* default */.Z.Date.now() - (this.g_sync[key] || 0) < 600000;
|
|
4970
4978
|
}
|
|
4971
4979
|
async fetchShippingAddresses() {
|
|
4972
4980
|
let out = await this.api.fetchShippingAddresses();
|
|
@@ -4983,7 +4991,7 @@ class Store {
|
|
|
4983
4991
|
return this.api.createShippingAddress(addr);
|
|
4984
4992
|
}
|
|
4985
4993
|
async overrideAcc(acc) {
|
|
4986
|
-
this.forceAcc = util/* default
|
|
4994
|
+
this.forceAcc = util/* default */.Z.cloneDeep(acc);
|
|
4987
4995
|
await this.readyGate.entry();
|
|
4988
4996
|
this.disconnect('account');
|
|
4989
4997
|
this.reconnect();
|
|
@@ -4993,7 +5001,7 @@ class Store {
|
|
|
4993
5001
|
await this.readyGate.entry();
|
|
4994
5002
|
this.disconnect('account');
|
|
4995
5003
|
await this.reconnect();
|
|
4996
|
-
util/* default
|
|
5004
|
+
util/* default */.Z.setTimeout(this.pubsub.publish('resetCSS'), 10);
|
|
4997
5005
|
}
|
|
4998
5006
|
getDeviceInfo() {
|
|
4999
5007
|
let device = {
|
|
@@ -5036,9 +5044,10 @@ class Store {
|
|
|
5036
5044
|
return page_loaded;
|
|
5037
5045
|
}
|
|
5038
5046
|
overridePlugin(plugins) {
|
|
5047
|
+
if (this._die) return dieErr;
|
|
5039
5048
|
if (!Array.isArray(plugins)) throw 'plugins must be be an array';
|
|
5040
5049
|
let pluginM = {};
|
|
5041
|
-
util/* default
|
|
5050
|
+
util/* default */.Z.map(plugins, function (plugin) {
|
|
5042
5051
|
pluginM[plugin.id] = plugin;
|
|
5043
5052
|
});
|
|
5044
5053
|
this.forcePlugins = pluginM;
|
|
@@ -5046,7 +5055,7 @@ class Store {
|
|
|
5046
5055
|
this.pubsub.publish('resetCSS');
|
|
5047
5056
|
}
|
|
5048
5057
|
markSync(key) {
|
|
5049
|
-
this.g_sync[key] = util/* default
|
|
5058
|
+
this.g_sync[key] = util/* default */.Z.Date.now();
|
|
5050
5059
|
}
|
|
5051
5060
|
async _touchAcc() {
|
|
5052
5061
|
if (this.isInsync('account')) return;
|
|
@@ -5070,20 +5079,18 @@ class Store {
|
|
|
5070
5079
|
if (mask) {
|
|
5071
5080
|
let parts = mask.split('@');
|
|
5072
5081
|
if (parts[0] != accid) {
|
|
5073
|
-
userRef = util/* default
|
|
5082
|
+
userRef = util/* default */.Z.randomString(40);
|
|
5074
5083
|
this.new_visitor = true;
|
|
5075
5084
|
}
|
|
5076
5085
|
this.new_visitor = false;
|
|
5077
5086
|
this.cookie.set('__sbmask', mask);
|
|
5078
5087
|
} else {
|
|
5079
|
-
userRef = util/* default
|
|
5088
|
+
userRef = util/* default */.Z.randomString(40);
|
|
5080
5089
|
this.new_visitor = true;
|
|
5081
5090
|
}
|
|
5082
5091
|
}
|
|
5083
5092
|
}
|
|
5084
|
-
if (this.cookie.get('__sbref', userRef) != userRef)
|
|
5085
|
-
cleanMyLocalStorage();
|
|
5086
|
-
}
|
|
5093
|
+
if (this.cookie.get('__sbref', userRef) != userRef) cleanMyLocalStorage();
|
|
5087
5094
|
this.api.setAuth({
|
|
5088
5095
|
accid: accid
|
|
5089
5096
|
});
|
|
@@ -5093,7 +5100,7 @@ class Store {
|
|
|
5093
5100
|
mask: mask,
|
|
5094
5101
|
ref: userRef
|
|
5095
5102
|
});
|
|
5096
|
-
if (user.error) return;
|
|
5103
|
+
if (user.error) return console.error(user);
|
|
5097
5104
|
if (this.realtime) this.realtime.stop();
|
|
5098
5105
|
if (this.fake) this.realtime = new realtime_fake();else this.realtime = new Realtime(this.RealtimeURL, {
|
|
5099
5106
|
account_id: accid,
|
|
@@ -5109,6 +5116,7 @@ class Store {
|
|
|
5109
5116
|
return user;
|
|
5110
5117
|
}
|
|
5111
5118
|
async login(accid, user_id, tokenGenerator) {
|
|
5119
|
+
if (this._die) return dieErr;
|
|
5112
5120
|
let user = await this.api.setAuth({
|
|
5113
5121
|
accid: accid,
|
|
5114
5122
|
profile_id: user_id,
|
|
@@ -5139,22 +5147,23 @@ class Store {
|
|
|
5139
5147
|
}
|
|
5140
5148
|
seenLoop() {
|
|
5141
5149
|
this.seenQueue = [];
|
|
5142
|
-
util/* default
|
|
5143
|
-
this._seenInterval = util/* default
|
|
5150
|
+
util/* default */.Z.clearInterval(this._seenInterval);
|
|
5151
|
+
this._seenInterval = util/* default */.Z.setInterval(() => {
|
|
5152
|
+
if (this._die) return util/* default */.Z.clearInterval(this._seenInterval);
|
|
5144
5153
|
this.seenQueue = [...new Set(this.seenQueue)];
|
|
5145
5154
|
let user = this.cache.match('user') || {};
|
|
5146
|
-
util/* default
|
|
5155
|
+
util/* default */.Z.map(this.seenQueue, id => {
|
|
5147
5156
|
var events = this.listEvents(id);
|
|
5148
5157
|
if (!events) return;
|
|
5149
|
-
if (util/* default
|
|
5150
|
-
events = util/* default
|
|
5151
|
-
var lastmsgsent = events[util/* default
|
|
5158
|
+
if (util/* default */.Z.size(events) === 0) return;
|
|
5159
|
+
events = util/* default */.Z.filter(events, ev => ev.type === 'message_sent');
|
|
5160
|
+
var lastmsgsent = events[util/* default */.Z.size(events) - 1];
|
|
5152
5161
|
if (!lastmsgsent) return;
|
|
5153
5162
|
if (this.g_haveSentSeenM[lastmsgsent.id]) return;
|
|
5154
|
-
if (lastmsgsent.id === util/* default
|
|
5163
|
+
if (lastmsgsent.id === util/* default */.Z.getMsgField(lastmsgsent, 'idempotency')) return;
|
|
5155
5164
|
this.api.markAsSeen(id, lastmsgsent.id);
|
|
5156
5165
|
let convo = this.cache.match('convo_' + id) || {};
|
|
5157
|
-
let mem = util/* default
|
|
5166
|
+
let mem = util/* default */.Z.find(convo.members, m => m.id === user.id);
|
|
5158
5167
|
if (mem) mem.seen_at = Date.now();
|
|
5159
5168
|
this._setConvo(convo);
|
|
5160
5169
|
this.g_haveSentSeenM[lastmsgsent.id] = true;
|
|
@@ -5174,7 +5183,7 @@ class Store {
|
|
|
5174
5183
|
if (this.isInsync('account')) return this.reconnectGate.open();
|
|
5175
5184
|
this.markSync('account');
|
|
5176
5185
|
let outs = await Promise.all([this.api.getUser(), this.api.getAccountSetting(), this.api.getIsOnline()]);
|
|
5177
|
-
let error = util/* default
|
|
5186
|
+
let error = util/* default */.Z.find(outs, out => out.error);
|
|
5178
5187
|
if (error) return console.error(error);
|
|
5179
5188
|
let set = Object.assign(outs[1].body, outs[2].body);
|
|
5180
5189
|
set.user = outs[0].body;
|
|
@@ -5183,13 +5192,13 @@ class Store {
|
|
|
5183
5192
|
error = convob.error;
|
|
5184
5193
|
let body = convob.body;
|
|
5185
5194
|
if (!error) {
|
|
5186
|
-
let convos = util/* default
|
|
5187
|
-
util/* default
|
|
5195
|
+
let convos = util/* default */.Z.get(body, 'conversations', []);
|
|
5196
|
+
util/* default */.Z.map(this.cache.all(), (value, k) => {
|
|
5188
5197
|
if (k.startsWith('convo_')) {
|
|
5189
|
-
if (this.now() - util/* default
|
|
5198
|
+
if (this.now() - util/* default */.Z.getMs(util/* default */.Z.get(value, 'actived')) > 1209600000) this.cache.del(k);
|
|
5190
5199
|
}
|
|
5191
5200
|
});
|
|
5192
|
-
util/* default
|
|
5201
|
+
util/* default */.Z.map(convos, convo => this._setConvo(convo));
|
|
5193
5202
|
}
|
|
5194
5203
|
return this.reconnectGate.open();
|
|
5195
5204
|
}
|
|
@@ -5208,13 +5217,13 @@ class Store {
|
|
|
5208
5217
|
}
|
|
5209
5218
|
}
|
|
5210
5219
|
_setUser(user) {
|
|
5211
|
-
user = util/* default
|
|
5220
|
+
user = util/* default */.Z.cloneDeep(user);
|
|
5212
5221
|
let olduser = this.cache.match('user') || {};
|
|
5213
5222
|
var accid = olduser.account_id || user.account_id;
|
|
5214
5223
|
var id = olduser.id || user.id;
|
|
5215
|
-
util/* default
|
|
5224
|
+
util/* default */.Z.each(user.attributes, newattr => {
|
|
5216
5225
|
if (!newattr) return;
|
|
5217
|
-
olduser.attributes = util/* default
|
|
5226
|
+
olduser.attributes = util/* default */.Z.filter(olduser.attributes, oldattr => {
|
|
5218
5227
|
if (!oldattr) return false;
|
|
5219
5228
|
return oldattr.key !== newattr.key;
|
|
5220
5229
|
});
|
|
@@ -5232,7 +5241,7 @@ class Store {
|
|
|
5232
5241
|
return this._setSetting(setting);
|
|
5233
5242
|
}
|
|
5234
5243
|
async _setSetting(setting) {
|
|
5235
|
-
setting = util/* default
|
|
5244
|
+
setting = util/* default */.Z.cloneDeep(setting) || {};
|
|
5236
5245
|
setting.account = Object.assign({}, setting.account, this.forceAcc);
|
|
5237
5246
|
if (!setting.account.logo_url) {
|
|
5238
5247
|
setting.account.logo_url = 'https://file-subiz.com/fiqpezhkmeyesdscyetk-default_logo.jpg';
|
|
@@ -5248,39 +5257,39 @@ class Store {
|
|
|
5248
5257
|
this.cache.put('account', setting.account);
|
|
5249
5258
|
delete setting.account;
|
|
5250
5259
|
}
|
|
5251
|
-
let location = util/* default
|
|
5260
|
+
let location = util/* default */.Z.get(setting, 'location', []);
|
|
5252
5261
|
this.cache.put('location', location);
|
|
5253
|
-
let bots = util/* default
|
|
5262
|
+
let bots = util/* default */.Z.get(setting, 'bots', []);
|
|
5254
5263
|
let botM = {};
|
|
5255
|
-
util/* default
|
|
5264
|
+
util/* default */.Z.map(bots, bot => {
|
|
5256
5265
|
botM[bot.id] = bot;
|
|
5257
5266
|
});
|
|
5258
5267
|
this.cache.put('bot', botM);
|
|
5259
|
-
let plugins = util/* default
|
|
5268
|
+
let plugins = util/* default */.Z.get(setting, 'plugins', []);
|
|
5260
5269
|
let pluginM = {};
|
|
5261
|
-
util/* default
|
|
5270
|
+
util/* default */.Z.map(plugins, plugin => {
|
|
5262
5271
|
if (plugin.type === 'chatbox') {
|
|
5263
|
-
plugin = util/* default
|
|
5272
|
+
plugin = util/* default */.Z.merge(plugin, this.forceChatbox);
|
|
5264
5273
|
}
|
|
5265
5274
|
pluginM[plugin.id] = plugin;
|
|
5266
5275
|
});
|
|
5267
5276
|
this.cache.put('plugin', pluginM);
|
|
5268
|
-
var agents = util/* default
|
|
5269
|
-
if (util/* default
|
|
5277
|
+
var agents = util/* default */.Z.get(setting, 'agents', []);
|
|
5278
|
+
if (util/* default */.Z.size(agents) > 0) {
|
|
5270
5279
|
let agentM = {};
|
|
5271
5280
|
this.api.setAgentId(agents[0].id);
|
|
5272
|
-
util/* default
|
|
5281
|
+
util/* default */.Z.map(agents, agent => {
|
|
5273
5282
|
agentM[agent.id] = agent;
|
|
5274
5283
|
});
|
|
5275
5284
|
this.cache.put('agent', agentM);
|
|
5276
5285
|
}
|
|
5277
|
-
let pms = util/* default
|
|
5286
|
+
let pms = util/* default */.Z.get(setting, 'payment_methods', []);
|
|
5278
5287
|
this.cache.put('payment_methods', pms);
|
|
5279
5288
|
this.pubsub.publish('account');
|
|
5280
5289
|
}
|
|
5281
5290
|
async track() {
|
|
5282
5291
|
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
|
|
5292
|
+
let traffic_source = util/* default */.Z.get(out, 'body.by.device.source', '');
|
|
5284
5293
|
if (traffic_source) this.kv.put('traffic_source', traffic_source);
|
|
5285
5294
|
}
|
|
5286
5295
|
async onWs(ev) {
|
|
@@ -5290,17 +5299,18 @@ class Store {
|
|
|
5290
5299
|
this.wsGate.open();
|
|
5291
5300
|
}
|
|
5292
5301
|
async _onWs(ev) {
|
|
5302
|
+
if (this._die) return;
|
|
5293
5303
|
if (!ev || !ev.type) return;
|
|
5294
|
-
ev.created = util/* default
|
|
5304
|
+
ev.created = util/* default */.Z.getMs(ev.created);
|
|
5295
5305
|
if (ev.type === 'user_info_updated') {
|
|
5296
|
-
let user = util/* default
|
|
5297
|
-
let attrs = util/* default
|
|
5298
|
-
util/* default
|
|
5306
|
+
let user = util/* default */.Z.cloneDeep(this.cache.match('user'));
|
|
5307
|
+
let attrs = util/* default */.Z.get(ev, 'data.user.attributes') || [];
|
|
5308
|
+
util/* default */.Z.map(attrs, attr => util/* default */.Z.setUserAttr(user, attr));
|
|
5299
5309
|
this._setUser(user);
|
|
5300
5310
|
return;
|
|
5301
5311
|
}
|
|
5302
5312
|
let user = this.cache.match('user') || {};
|
|
5303
|
-
let cid = util/* default
|
|
5313
|
+
let cid = util/* default */.Z.convoOfEv(ev);
|
|
5304
5314
|
let convo;
|
|
5305
5315
|
let alreadyFetched = false;
|
|
5306
5316
|
if (cid) {
|
|
@@ -5317,12 +5327,12 @@ class Store {
|
|
|
5317
5327
|
}
|
|
5318
5328
|
}
|
|
5319
5329
|
if (!convo) return;
|
|
5320
|
-
let channel = util/* default
|
|
5330
|
+
let channel = util/* default */.Z.get(ev, 'touchpoint.channel', '');
|
|
5321
5331
|
if (channel && channel != 'subiz') return;
|
|
5322
5332
|
this.pubsub.publish('events', ev);
|
|
5323
5333
|
if (ev.type === 'conversation_joined') {
|
|
5324
|
-
let members = util/* default
|
|
5325
|
-
let me = util/* default
|
|
5334
|
+
let members = util/* default */.Z.get(ev, 'data.conversation.members', []);
|
|
5335
|
+
let me = util/* default */.Z.find(members, m => m.id === this.cache.match('user').id);
|
|
5326
5336
|
if (me) {
|
|
5327
5337
|
await this.chain.reload(cid, (type, anchor, limit) => this.listmessageapi(type, anchor, limit));
|
|
5328
5338
|
this.markSync('events' + cid);
|
|
@@ -5339,13 +5349,13 @@ class Store {
|
|
|
5339
5349
|
}
|
|
5340
5350
|
}
|
|
5341
5351
|
if (ev.type === 'message_sent') {
|
|
5342
|
-
if (util/* default
|
|
5352
|
+
if (util/* default */.Z.get(ev, 'by.id') !== user.id) {
|
|
5343
5353
|
this.api.markAsReceived(cid, ev.id);
|
|
5344
5354
|
}
|
|
5345
5355
|
}
|
|
5346
|
-
if (util/* default
|
|
5356
|
+
if (util/* default */.Z.startsWith(ev.type, 'message_') || util/* default */.Z.startsWith(ev.type, 'conversation_')) {
|
|
5347
5357
|
this.restConvoEvent(ev);
|
|
5348
|
-
if (ev.type === 'message_sent' && util/* default
|
|
5358
|
+
if (ev.type === 'message_sent' && util/* default */.Z.get(ev, 'by.id') !== user.id) {
|
|
5349
5359
|
sendEventToThirdParty('SUBIZ Chat', 'Received', 'User');
|
|
5350
5360
|
}
|
|
5351
5361
|
return;
|
|
@@ -5353,36 +5363,36 @@ class Store {
|
|
|
5353
5363
|
}
|
|
5354
5364
|
async restConvoEvent(ev) {
|
|
5355
5365
|
let user = this.cache.match('user');
|
|
5356
|
-
let cid = util/* default
|
|
5366
|
+
let cid = util/* default */.Z.convoOfEv(ev);
|
|
5357
5367
|
let convo = this.cache.match('convo_' + cid) || {};
|
|
5358
5368
|
if (ev.type === 'conversation_state_updated') {
|
|
5359
|
-
if (!util/* default
|
|
5369
|
+
if (!util/* default */.Z.get(convo, 'id')) {
|
|
5360
5370
|
let {
|
|
5361
5371
|
body: convo,
|
|
5362
5372
|
error
|
|
5363
5373
|
} = await this.api.getConversation(cid);
|
|
5364
5374
|
if (error) return;
|
|
5365
5375
|
}
|
|
5366
|
-
convo = Object.assign(convo, util/* default
|
|
5376
|
+
convo = Object.assign(convo, util/* default */.Z.get(ev, 'data.conversation'));
|
|
5367
5377
|
}
|
|
5368
5378
|
if (ev.type === 'message_pong') {
|
|
5369
|
-
var msgid = util/* default
|
|
5379
|
+
var msgid = util/* default */.Z.get(ev, 'data.message.id');
|
|
5370
5380
|
var oldev = this.chain.match(cid, msgid);
|
|
5371
|
-
if (!util/* default
|
|
5372
|
-
var pongs = util/* default
|
|
5373
|
-
pongs = pongs.concat(util/* default
|
|
5381
|
+
if (!util/* default */.Z.get(oldev, 'data.message')) return;
|
|
5382
|
+
var pongs = util/* default */.Z.get(oldev, 'data.message.pongs', []);
|
|
5383
|
+
pongs = pongs.concat(util/* default */.Z.get(ev, 'data.message.pongs', []));
|
|
5374
5384
|
oldev.data.message.pongs = pongs;
|
|
5375
|
-
util/* default
|
|
5385
|
+
util/* default */.Z.map(pongs, pong => {
|
|
5376
5386
|
if (pong.member_id == user.id && pong.type === 'seen') {
|
|
5377
|
-
let mem = util/* default
|
|
5387
|
+
let mem = util/* default */.Z.find(convo.members, mem => mem.id === user.id);
|
|
5378
5388
|
if (mem) mem.seen_at = pong.created;
|
|
5379
5389
|
}
|
|
5380
5390
|
});
|
|
5381
|
-
this.chain.put(cid, oldev.id, util/* default
|
|
5391
|
+
this.chain.put(cid, oldev.id, util/* default */.Z.getMs(oldev.created), oldev);
|
|
5382
5392
|
}
|
|
5383
5393
|
if (ev.type === 'message_sent') {
|
|
5384
|
-
let idemkey = util/* default
|
|
5385
|
-
let found = util/* default
|
|
5394
|
+
let idemkey = util/* default */.Z.getMsgField(ev, 'idempotency');
|
|
5395
|
+
let found = util/* default */.Z.find(this.listEvents(cid), oldev => oldev.id === idemkey);
|
|
5386
5396
|
if (found) {
|
|
5387
5397
|
this.chain.del(cid, found.id);
|
|
5388
5398
|
ev.created = found.created;
|
|
@@ -5390,7 +5400,7 @@ class Store {
|
|
|
5390
5400
|
convo.last_message_sent = ev;
|
|
5391
5401
|
}
|
|
5392
5402
|
if (ev.type !== 'message_pong' && ev.type !== 'conversation_typing') {
|
|
5393
|
-
this.chain.put(cid, ev.id, util/* default
|
|
5403
|
+
this.chain.put(cid, ev.id, util/* default */.Z.getMs(ev.created), ev);
|
|
5394
5404
|
}
|
|
5395
5405
|
this._setConvo(convo);
|
|
5396
5406
|
this.pubsub.publish('account');
|
|
@@ -5398,31 +5408,31 @@ class Store {
|
|
|
5398
5408
|
handleFormSubmit(convoKey, ev) {
|
|
5399
5409
|
if (ev.type !== 'message_sent') return;
|
|
5400
5410
|
let formSubmits = [];
|
|
5401
|
-
let attachments = util/* default
|
|
5402
|
-
util/* default
|
|
5411
|
+
let attachments = util/* default */.Z.get(ev, 'data.message.attachments') || [];
|
|
5412
|
+
util/* default */.Z.each(attachments, att => {
|
|
5403
5413
|
if (!att) return;
|
|
5404
5414
|
if (att.type !== 'form_submit') return;
|
|
5405
5415
|
formSubmits.push(att.form_submit);
|
|
5406
5416
|
});
|
|
5407
|
-
util/* default
|
|
5408
|
-
let formev = util/* default
|
|
5417
|
+
util/* default */.Z.each(formSubmits, submit => {
|
|
5418
|
+
let formev = util/* default */.Z.get(this.convoEventM, convoKey + '.' + submit.form_message_id);
|
|
5409
5419
|
if (!formev) return;
|
|
5410
|
-
let forms = util/* default
|
|
5420
|
+
let forms = util/* default */.Z.filter(util/* default */.Z.get(formev, 'data.message.attachments'), att => {
|
|
5411
5421
|
if (!att) return false;
|
|
5412
5422
|
if (att.type !== 'form' && att.type !== 'ask_info_form') return false;
|
|
5413
5423
|
return true;
|
|
5414
5424
|
});
|
|
5415
|
-
util/* default
|
|
5425
|
+
util/* default */.Z.each(forms, form => {
|
|
5416
5426
|
form = form.form;
|
|
5417
|
-
util/* default
|
|
5418
|
-
util/* default
|
|
5427
|
+
util/* default */.Z.each(form.fields, formfield => {
|
|
5428
|
+
util/* default */.Z.each(submit.fields, submitfield => {
|
|
5419
5429
|
if (formfield.name !== submitfield.name) return;
|
|
5420
5430
|
if (formfield.default_answer) return;
|
|
5421
5431
|
formfield.default_answer = submitfield.value;
|
|
5422
5432
|
});
|
|
5423
5433
|
});
|
|
5424
5434
|
});
|
|
5425
|
-
if (util/* default
|
|
5435
|
+
if (util/* default */.Z.size(forms) > 0) this.pubsub.publish('state.convoEventM', this.convoEventM, convoKey);
|
|
5426
5436
|
});
|
|
5427
5437
|
}
|
|
5428
5438
|
typing(cid) {
|
|
@@ -5457,7 +5467,7 @@ class Store {
|
|
|
5457
5467
|
}
|
|
5458
5468
|
async sendConvoEvent(cid, type, data) {
|
|
5459
5469
|
await this.readyGate.entry();
|
|
5460
|
-
var idempotency = util/* default
|
|
5470
|
+
var idempotency = util/* default */.Z.randomString(36);
|
|
5461
5471
|
let user = this.cache.match('user') || {};
|
|
5462
5472
|
var event = {
|
|
5463
5473
|
id: idempotency,
|
|
@@ -5470,17 +5480,24 @@ class Store {
|
|
|
5470
5480
|
type,
|
|
5471
5481
|
created: this.now()
|
|
5472
5482
|
};
|
|
5473
|
-
util/* default
|
|
5483
|
+
util/* default */.Z.convoToEv(cid, event);
|
|
5474
5484
|
let files = [];
|
|
5475
5485
|
if (type === 'message_sent') {
|
|
5476
|
-
util/* default
|
|
5486
|
+
util/* default */.Z.setMsgField(event, 'idempotency', idempotency);
|
|
5477
5487
|
event.data.message.conversation_id = cid;
|
|
5478
5488
|
await flow.map(event.data.message.attachments, 2, async (att, i) => {
|
|
5479
5489
|
if (att.type !== 'file') return;
|
|
5480
5490
|
if (!att._file) return;
|
|
5481
5491
|
files.push(att);
|
|
5482
5492
|
if (ImageTypes.includes(att._file.type)) {
|
|
5483
|
-
|
|
5493
|
+
let {
|
|
5494
|
+
width,
|
|
5495
|
+
height,
|
|
5496
|
+
url
|
|
5497
|
+
} = await loadImage(att._file);
|
|
5498
|
+
att.url = url;
|
|
5499
|
+
att.width = width;
|
|
5500
|
+
att.height = height;
|
|
5484
5501
|
}
|
|
5485
5502
|
});
|
|
5486
5503
|
}
|
|
@@ -5492,7 +5509,7 @@ class Store {
|
|
|
5492
5509
|
url,
|
|
5493
5510
|
error
|
|
5494
5511
|
} = await this.api.uploadToS3(att._file);
|
|
5495
|
-
if (util/* default
|
|
5512
|
+
if (util/* default */.Z.get(body, 'code') == 'invalid_field_size') {
|
|
5496
5513
|
event._error_message = 'cannot_send_too_big_file';
|
|
5497
5514
|
}
|
|
5498
5515
|
event._error = error;
|
|
@@ -5520,23 +5537,23 @@ class Store {
|
|
|
5520
5537
|
first_interaction: 1
|
|
5521
5538
|
});
|
|
5522
5539
|
}
|
|
5523
|
-
this.kv.put('last_msg_sent', util/* default
|
|
5540
|
+
this.kv.put('last_msg_sent', util/* default */.Z.Date.now());
|
|
5524
5541
|
return ret;
|
|
5525
5542
|
}
|
|
5526
5543
|
_setConvo(convo) {
|
|
5527
5544
|
let count = 0;
|
|
5528
5545
|
let user = this.cache.match('user');
|
|
5529
|
-
let channel = util/* default
|
|
5546
|
+
let channel = util/* default */.Z.get(convo, 'touchpoint.channel', '');
|
|
5530
5547
|
if (channel && channel != 'subiz') return;
|
|
5531
5548
|
let allconvo = {};
|
|
5532
|
-
util/* default
|
|
5549
|
+
util/* default */.Z.map(this.cache.all(), (value, key) => {
|
|
5533
5550
|
if (key.startsWith('convo_')) {
|
|
5534
5551
|
allconvo[key] = value;
|
|
5535
5552
|
}
|
|
5536
5553
|
});
|
|
5537
|
-
if (util/* default
|
|
5538
|
-
allconvo = util/* default
|
|
5539
|
-
for (var i = MAX_CONVO - 2; i < util/* default
|
|
5554
|
+
if (util/* default */.Z.size(allconvo) > MAX_CONVO - 2) {
|
|
5555
|
+
allconvo = util/* default */.Z.orderBy(util/* default */.Z.map(allconvo), 'created', 'desc');
|
|
5556
|
+
for (var i = MAX_CONVO - 2; i < util/* default */.Z.size(allconvo); i++) {
|
|
5540
5557
|
let convo = allconvo[i];
|
|
5541
5558
|
this.cache.del('convo_' + convo.id);
|
|
5542
5559
|
}
|
|
@@ -5592,7 +5609,7 @@ class Store {
|
|
|
5592
5609
|
account_id: user.account_id,
|
|
5593
5610
|
web_plugin_id: id,
|
|
5594
5611
|
campaign_id: id,
|
|
5595
|
-
user_id: util/* default
|
|
5612
|
+
user_id: util/* default */.Z.get(user, 'id'),
|
|
5596
5613
|
url: window.location.href,
|
|
5597
5614
|
device: this.device,
|
|
5598
5615
|
submission,
|
|
@@ -5611,9 +5628,9 @@ class Store {
|
|
|
5611
5628
|
error
|
|
5612
5629
|
} = await this.api.listMessages(convoid, -limit, anchor);
|
|
5613
5630
|
if (error || code !== 200) return [[], anchor, error];
|
|
5614
|
-
anchor = util/* default
|
|
5615
|
-
events = util/* default
|
|
5616
|
-
event.created = util/* default
|
|
5631
|
+
anchor = util/* default */.Z.get(util/* default */.Z.last(events), 'id');
|
|
5632
|
+
events = util/* default */.Z.map(events, event => {
|
|
5633
|
+
event.created = util/* default */.Z.getMs(event.created);
|
|
5617
5634
|
return {
|
|
5618
5635
|
id: event.id,
|
|
5619
5636
|
index: event.created,
|
|
@@ -5624,8 +5641,8 @@ class Store {
|
|
|
5624
5641
|
for (let i = 0; i < events.length; i++) {
|
|
5625
5642
|
let ev = events[i].value;
|
|
5626
5643
|
if (ev.type !== 'message_sent') continue;
|
|
5627
|
-
if (util/* default
|
|
5628
|
-
let pongbyme = util/* default
|
|
5644
|
+
if (util/* default */.Z.get(ev, 'by.id') === user.id) continue;
|
|
5645
|
+
let pongbyme = util/* default */.Z.find(util/* default */.Z.get(ev, 'data.message.pongs'), p => p.member_id === user.id);
|
|
5629
5646
|
if (pongbyme) break;
|
|
5630
5647
|
this.api.markAsReceived(convoid, ev.id);
|
|
5631
5648
|
break;
|
|
@@ -5633,25 +5650,26 @@ class Store {
|
|
|
5633
5650
|
return [events, anchor];
|
|
5634
5651
|
}
|
|
5635
5652
|
async loopTime() {
|
|
5636
|
-
|
|
5637
|
-
|
|
5653
|
+
if (this._die) return;
|
|
5654
|
+
let startms = util/* default */.Z.Date.now();
|
|
5655
|
+
if (!util/* default */.Z.get(this.cache.match('user'), 'id')) return util/* default */.Z.setTimeout(() => this.loopTime(), 240000);
|
|
5638
5656
|
let {
|
|
5639
5657
|
body: t,
|
|
5640
5658
|
error
|
|
5641
5659
|
} = 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
|
|
5660
|
+
if (error) return util/* default */.Z.setTimeout(() => this.loopTime(), 30000);
|
|
5661
|
+
var latences = Math.abs(util/* default */.Z.Date.now() - startms) / 2;
|
|
5662
|
+
var serverMs = new util/* default */.Z.Date(t).getTime() + latences;
|
|
5663
|
+
var localMs = util/* default */.Z.Date.now();
|
|
5646
5664
|
this.timeDiff = Math.floor(serverMs - localMs);
|
|
5647
|
-
util/* default
|
|
5665
|
+
util/* default */.Z.setTimeout(() => this.loopTime(), 240000);
|
|
5648
5666
|
}
|
|
5649
5667
|
replaceFileUrl(src) {
|
|
5650
5668
|
if (!src) return '';
|
|
5651
|
-
if (util/* default
|
|
5652
|
-
if (util/* default
|
|
5653
|
-
if (!util/* default
|
|
5654
|
-
src = util/* default
|
|
5669
|
+
if (util/* default */.Z.startsWith(src, '/')) return src;
|
|
5670
|
+
if (util/* default */.Z.startsWith(src, 'data:')) return src;
|
|
5671
|
+
if (!util/* default */.Z.startsWith(src, 'http://') && !util/* default */.Z.startsWith(src, 'https://') && !util/* default */.Z.startsWith(src, '//')) {
|
|
5672
|
+
src = util/* default */.Z.trim(this.FileURL, '/') + '/' + util/* default */.Z.trimStart(src, '/');
|
|
5655
5673
|
}
|
|
5656
5674
|
src = src.replace('https://file-subiz.com/', this.FileURL);
|
|
5657
5675
|
src = src.replace('http://file-subiz.com/', this.FileURL);
|
|
@@ -5668,7 +5686,7 @@ class Store {
|
|
|
5668
5686
|
return src;
|
|
5669
5687
|
}
|
|
5670
5688
|
clearBrowserData() {
|
|
5671
|
-
util/* default
|
|
5689
|
+
util/* default */.Z.each(this.cookie.all(), (v, k) => {
|
|
5672
5690
|
if ((k || '').startsWith('__sb')) this.cookie.remove(k);
|
|
5673
5691
|
});
|
|
5674
5692
|
this.kv.destroy();
|
|
@@ -5678,16 +5696,29 @@ class Store {
|
|
|
5678
5696
|
}
|
|
5679
5697
|
destroy() {
|
|
5680
5698
|
this._die = true;
|
|
5681
|
-
this.
|
|
5699
|
+
if (this.kv) this.kv.destroy();
|
|
5700
|
+
if (this.chain) this.chain.destroy();
|
|
5701
|
+
util/* default */.Z.clearInterval(this._seenInterval);
|
|
5682
5702
|
if (this.realtime) this.realtime.stop();
|
|
5683
5703
|
this.readyGate.close();
|
|
5704
|
+
window.removeEventListener('blur', this.sendPresence);
|
|
5705
|
+
window.removeEventListener('focus', this.sendPresence);
|
|
5684
5706
|
}
|
|
5685
5707
|
}
|
|
5686
5708
|
function loadImage(file) {
|
|
5687
5709
|
return new Promise(rs => {
|
|
5688
5710
|
var reader = new window.FileReader();
|
|
5689
5711
|
reader.onload = e => {
|
|
5690
|
-
|
|
5712
|
+
let src = e.target.result;
|
|
5713
|
+
let img = new Image();
|
|
5714
|
+
img.onload = () => {
|
|
5715
|
+
rs({
|
|
5716
|
+
url: src,
|
|
5717
|
+
width: img.width,
|
|
5718
|
+
height: img.height
|
|
5719
|
+
});
|
|
5720
|
+
};
|
|
5721
|
+
img.src = src;
|
|
5691
5722
|
};
|
|
5692
5723
|
reader.readAsDataURL(file);
|
|
5693
5724
|
});
|
|
@@ -5798,7 +5829,7 @@ let cleanLocalStorage = () => {
|
|
|
5798
5829
|
} catch (e) {
|
|
5799
5830
|
return;
|
|
5800
5831
|
}
|
|
5801
|
-
util/* default
|
|
5832
|
+
util/* default */.Z.setTimeout(() => {
|
|
5802
5833
|
for (var key in localStorage) {
|
|
5803
5834
|
if (key && (key.startsWith('cbz2020') || key.startsWith('sbz2020'))) {
|
|
5804
5835
|
localStorage.removeItem(key);
|
|
@@ -5812,7 +5843,7 @@ let cleanMyLocalStorage = () => {
|
|
|
5812
5843
|
} catch (e) {
|
|
5813
5844
|
return;
|
|
5814
5845
|
}
|
|
5815
|
-
util/* default
|
|
5846
|
+
util/* default */.Z.setTimeout(() => {
|
|
5816
5847
|
for (var key in localStorage) {
|
|
5817
5848
|
if (key && (key.startsWith('cbz2020') || key.startsWith('sbz2020') || key.startsWith('sbz2022') || key.startsWith('sbz2023'))) {
|
|
5818
5849
|
localStorage.removeItem(key);
|
|
@@ -5830,8 +5861,8 @@ function dofetch(method, url, body, cb) {
|
|
|
5830
5861
|
}).then(res => res.text().then(text => cb && cb(text, res.status))).catch(err => cb && cb(err, -1));
|
|
5831
5862
|
}
|
|
5832
5863
|
var xhrsend = function (method, url, body, cb) {
|
|
5833
|
-
if (typeof util/* default
|
|
5834
|
-
var request = new util/* default
|
|
5864
|
+
if (typeof util/* default */.Z.XMLHttpRequest === 'undefined') return dofetch(method, url, body, cb);
|
|
5865
|
+
var request = new util/* default */.Z.XMLHttpRequest();
|
|
5835
5866
|
request.onreadystatechange = function (e) {
|
|
5836
5867
|
if (request.readyState !== 4) return;
|
|
5837
5868
|
cb && cb(request.responseText, request.status);
|
|
@@ -5845,6 +5876,7 @@ var xhrsend = function (method, url, body, cb) {
|
|
|
5845
5876
|
if (body) request.setRequestHeader('content-type', 'text/plain');
|
|
5846
5877
|
request.send(body);
|
|
5847
5878
|
};
|
|
5879
|
+
const dieErr = new Error('sdk unloaded');
|
|
5848
5880
|
// EXTERNAL MODULE: ./src/common.js
|
|
5849
5881
|
var common = __webpack_require__(2493);
|
|
5850
5882
|
// EXTERNAL MODULE: ./node_modules/preact/dist/preact.module.js
|
|
@@ -5853,7 +5885,7 @@ var preact_module = __webpack_require__(6400);
|
|
|
5853
5885
|
|
|
5854
5886
|
|
|
5855
5887
|
|
|
5856
|
-
const LoadChatbox = () => __webpack_require__.e(/* import() */
|
|
5888
|
+
const LoadChatbox = () => __webpack_require__.e(/* import() */ 841).then(__webpack_require__.bind(__webpack_require__, 8841));
|
|
5857
5889
|
const LoadContact = () => __webpack_require__.e(/* import() */ 335).then(__webpack_require__.bind(__webpack_require__, 2335));
|
|
5858
5890
|
const LoadPopup = () => __webpack_require__.e(/* import() */ 213).then(__webpack_require__.bind(__webpack_require__, 8213));
|
|
5859
5891
|
const LoadNotif = () => __webpack_require__.e(/* import() */ 605).then(__webpack_require__.bind(__webpack_require__, 9605));
|
|
@@ -5861,9 +5893,12 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5861
5893
|
if (!$container) throw '$div must is a valid html node';
|
|
5862
5894
|
var $div = document.createElement('div');
|
|
5863
5895
|
$div.id = plugin.id;
|
|
5896
|
+
let acc = store.matchAccount();
|
|
5897
|
+
$div.setAttribute('sbz-plugin-type', plugin.type);
|
|
5898
|
+
$div.setAttribute('sbz-plugin-account-id', acc.id);
|
|
5864
5899
|
$container.appendChild($div);
|
|
5865
|
-
let _locale = common/* getLocale */.Kd(plugin, util/* default
|
|
5866
|
-
var domGate = new util/* default
|
|
5900
|
+
let _locale = common/* getLocale */.Kd(plugin, util/* default */.Z.detectLang());
|
|
5901
|
+
var domGate = new util/* default */.Z.Gate();
|
|
5867
5902
|
var pageIndex = 0;
|
|
5868
5903
|
var highlight;
|
|
5869
5904
|
var state = 'hold';
|
|
@@ -5876,13 +5911,13 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5876
5911
|
let lastrun = store.matchLastPluginRun(plugin.id);
|
|
5877
5912
|
if (plugin.type === 'chatbox' || plugin.type === 'notification') lastrun = undefined;
|
|
5878
5913
|
if (!plugin.enabled) return;
|
|
5879
|
-
let match = util/* default
|
|
5914
|
+
let match = util/* default */.Z.checkRunConditions(plugin.initiative_frequency, plugin.conditions, lastrun, store);
|
|
5880
5915
|
if (!match) return;
|
|
5881
5916
|
state = 'running';
|
|
5882
5917
|
await _this.update(plugin);
|
|
5883
5918
|
};
|
|
5884
5919
|
this.forceRunPopup = async () => {
|
|
5885
|
-
if (util/* default
|
|
5920
|
+
if (util/* default */.Z.get(_ref, 'current')) {
|
|
5886
5921
|
_ref.current.openPopup();
|
|
5887
5922
|
} else {
|
|
5888
5923
|
_render();
|
|
@@ -5969,11 +6004,10 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5969
6004
|
};
|
|
5970
6005
|
let t = key => {
|
|
5971
6006
|
if (_locale === 'debug') return `{{${key}}}`;
|
|
5972
|
-
let messages = util/* default
|
|
5973
|
-
let message = util/* default
|
|
5974
|
-
return util/* default
|
|
6007
|
+
let messages = util/* default */.Z.get(common/* langMessages */.Rs, _locale, []);
|
|
6008
|
+
let message = util/* default */.Z.find(messages, message => message.key === key);
|
|
6009
|
+
return util/* default */.Z.get(message, 'message', key);
|
|
5975
6010
|
};
|
|
5976
|
-
let acc = store.matchAccount();
|
|
5977
6011
|
t.i18n = i18nText => {
|
|
5978
6012
|
if (!i18nText) return '';
|
|
5979
6013
|
let fallbackLocale = plugin.locale || acc.locale || 'vi-VN';
|
|
@@ -5997,29 +6031,29 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5997
6031
|
return _locale;
|
|
5998
6032
|
};
|
|
5999
6033
|
let images = {};
|
|
6000
|
-
util/* default
|
|
6034
|
+
util/* default */.Z.map(util/* default */.Z.get(plugin, 'popup.pages'), page => {
|
|
6001
6035
|
if (!page) return;
|
|
6002
|
-
util/* default
|
|
6036
|
+
util/* default */.Z.map(page.components, com => {
|
|
6003
6037
|
if (com.type === 'image' && com.image && com.image.url && com.image.url.startsWith('http')) {
|
|
6004
6038
|
images[com.image.url] = true;
|
|
6005
6039
|
}
|
|
6006
6040
|
});
|
|
6007
6041
|
});
|
|
6008
|
-
if (util/* default
|
|
6009
|
-
let triggers = util/* default
|
|
6042
|
+
if (util/* default */.Z.size(images) >= 0) util/* default */.Z.map(images, (_, image) => util/* default */.Z.preloadImg(image));
|
|
6043
|
+
let triggers = util/* default */.Z.get(plugin, 'triggers') || [{
|
|
6010
6044
|
type: 'after_pageview',
|
|
6011
6045
|
after_pageview_sec: 0,
|
|
6012
6046
|
disabled: false
|
|
6013
6047
|
}];
|
|
6014
|
-
for (var i = 0; i < util/* default
|
|
6048
|
+
for (var i = 0; i < util/* default */.Z.size(triggers); i++) {
|
|
6015
6049
|
var tr = triggers[i];
|
|
6016
6050
|
if (!tr) continue;
|
|
6017
6051
|
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
|
|
6052
|
+
if (tr.type === 'exit_intent') util/* default */.Z.trackExitIntent(run);
|
|
6053
|
+
if (tr.type === 'area_clicked') util/* default */.Z.trackAreaClicked(tr.area_clicked_css_selector, run);
|
|
6054
|
+
if (tr.type === 'scrolling_percentage') util/* default */.Z.trackScrollingPercentage(tr.scrolling_percentage, run);
|
|
6055
|
+
if (tr.type === 'inactivity_duration') util/* default */.Z.trackInactivity(tr.inactivity_sec, run);
|
|
6056
|
+
if (tr.type === 'after_pageview') util/* default */.Z.trackTimeOnPage(tr.after_pageview_sec, run);
|
|
6023
6057
|
}
|
|
6024
6058
|
this.update(plugin);
|
|
6025
6059
|
common/* downloadLanguage */.WW(store, _locale).then(() => {
|
|
@@ -6047,7 +6081,7 @@ class PluginMgr {
|
|
|
6047
6081
|
if (this._destroy) return;
|
|
6048
6082
|
let pluginM = this.lib.store.matchPlugin();
|
|
6049
6083
|
let foundchatbox = false;
|
|
6050
|
-
util/* default
|
|
6084
|
+
util/* default */.Z.each(pluginM, conf => {
|
|
6051
6085
|
if (conf.type === 'chatbox') {
|
|
6052
6086
|
if (foundchatbox) return;
|
|
6053
6087
|
foundchatbox = true;
|
|
@@ -6058,7 +6092,7 @@ class PluginMgr {
|
|
|
6058
6092
|
}
|
|
6059
6093
|
this.pluginM[conf.id].update(conf);
|
|
6060
6094
|
});
|
|
6061
|
-
util/* default
|
|
6095
|
+
util/* default */.Z.each(this.pluginM, (conf, id) => {
|
|
6062
6096
|
if (pluginM[id]) return;
|
|
6063
6097
|
this.pluginM[id].destroy();
|
|
6064
6098
|
delete this.pluginM[id];
|
|
@@ -6066,7 +6100,7 @@ class PluginMgr {
|
|
|
6066
6100
|
});
|
|
6067
6101
|
let pluginM = this.lib.store.matchPlugin();
|
|
6068
6102
|
let foundchatbox = false;
|
|
6069
|
-
util/* default
|
|
6103
|
+
util/* default */.Z.each(pluginM, conf => {
|
|
6070
6104
|
if (conf.type === 'chatbox') {
|
|
6071
6105
|
if (foundchatbox) return;
|
|
6072
6106
|
foundchatbox = true;
|
|
@@ -6076,12 +6110,12 @@ class PluginMgr {
|
|
|
6076
6110
|
}
|
|
6077
6111
|
findChatbox() {
|
|
6078
6112
|
var pluginM = this.lib.store.matchPlugin();
|
|
6079
|
-
let chatboxs = util/* default
|
|
6080
|
-
if (util/* default
|
|
6113
|
+
let chatboxs = util/* default */.Z.filter(this.pluginM, (plugin, id) => pluginM[id].type === 'chatbox');
|
|
6114
|
+
if (util/* default */.Z.size(chatboxs) === 0) {
|
|
6081
6115
|
console.error('no chatbox found.');
|
|
6082
6116
|
return;
|
|
6083
6117
|
}
|
|
6084
|
-
let chatbox = util/* default
|
|
6118
|
+
let chatbox = util/* default */.Z.find(chatboxs, chatbox => chatbox.getState() === 'running');
|
|
6085
6119
|
if (!chatbox) {
|
|
6086
6120
|
chatbox = chatboxs[0];
|
|
6087
6121
|
}
|
|
@@ -6137,9 +6171,8 @@ class PluginMgr {
|
|
|
6137
6171
|
chatbox.setLocale(locale);
|
|
6138
6172
|
}
|
|
6139
6173
|
destroy() {
|
|
6140
|
-
util/* default
|
|
6141
|
-
|
|
6142
|
-
this.pluginM[id].destroy();
|
|
6174
|
+
util/* default */.Z.map(this.pluginM, (conf, id) => {
|
|
6175
|
+
conf.destroy();
|
|
6143
6176
|
delete this.pluginM[id];
|
|
6144
6177
|
});
|
|
6145
6178
|
this._destroy = true;
|
|
@@ -6147,8 +6180,8 @@ class PluginMgr {
|
|
|
6147
6180
|
}
|
|
6148
6181
|
;// CONCATENATED MODULE: ./src/lib.js
|
|
6149
6182
|
function lib_defineProperty(obj, key, value) { key = lib_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6150
|
-
function lib_toPropertyKey(
|
|
6151
|
-
function lib_toPrimitive(
|
|
6183
|
+
function lib_toPropertyKey(t) { var i = lib_toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
6184
|
+
function lib_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6152
6185
|
|
|
6153
6186
|
|
|
6154
6187
|
|
|
@@ -6156,25 +6189,25 @@ var $link = document.createElement('link');
|
|
|
6156
6189
|
$link.href = 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap';
|
|
6157
6190
|
$link.rel = 'stylesheet';
|
|
6158
6191
|
document.head.append($link);
|
|
6159
|
-
util/* default
|
|
6192
|
+
util/* default */.Z.preloadWebfonts(['Inter'], [400, 500, 600]);
|
|
6160
6193
|
class Widget {
|
|
6161
6194
|
constructor(ApiURL, FileURL, RealtimeURL, inmem, fake) {
|
|
6162
6195
|
lib_defineProperty(this, "version", () => '4.5');
|
|
6163
6196
|
lib_defineProperty(this, "setSetting", setting => this.store.setSetting({
|
|
6164
6197
|
account_setting: setting
|
|
6165
6198
|
}));
|
|
6166
|
-
lib_defineProperty(this, "getUser", () => util/* default
|
|
6199
|
+
lib_defineProperty(this, "getUser", () => util/* default */.Z.parseJSON(util/* default */.Z.stringify(this.store.matchUser())));
|
|
6167
6200
|
lib_defineProperty(this, "setViewingProduct", p => this.store.linkProduct(p));
|
|
6168
6201
|
lib_defineProperty(this, "getViewingProduct", () => this.store.getLinkedProduct());
|
|
6169
6202
|
lib_defineProperty(this, "track", () => this.store.track());
|
|
6170
6203
|
this.impressionTokens = {};
|
|
6171
|
-
this.domGate = new util/* default
|
|
6204
|
+
this.domGate = new util/* default */.Z.Gate();
|
|
6172
6205
|
this.store = new Store(ApiURL, FileURL, RealtimeURL, inmem, fake);
|
|
6173
6206
|
window.sbz_store = this.store;
|
|
6174
6207
|
this.subs = [];
|
|
6175
6208
|
this.store.onConvoEvent({
|
|
6176
6209
|
_isMounted: true
|
|
6177
|
-
}, ev => util/* default
|
|
6210
|
+
}, ev => util/* default */.Z.map(this.subs, sub => sub(ev)));
|
|
6178
6211
|
}
|
|
6179
6212
|
async waitReady(cb) {
|
|
6180
6213
|
await this.store.readyGate.entry();
|
|
@@ -6185,10 +6218,10 @@ class Widget {
|
|
|
6185
6218
|
let user = await this.store.login(accid, user_id, tokenGenerator);
|
|
6186
6219
|
if (!$container) $container = document.body;
|
|
6187
6220
|
this.pluginMgr = new PluginMgr(this, $container);
|
|
6188
|
-
let clean = util/* default
|
|
6221
|
+
let clean = util/* default */.Z.setInterval(() => {
|
|
6189
6222
|
if ($container && $container.isConnected) return;
|
|
6190
6223
|
this.pluginMgr.destroy();
|
|
6191
|
-
util/* default
|
|
6224
|
+
util/* default */.Z.clearInterval(clean);
|
|
6192
6225
|
}, 1000);
|
|
6193
6226
|
this.domGate.open();
|
|
6194
6227
|
return user;
|
|
@@ -6201,24 +6234,32 @@ class Widget {
|
|
|
6201
6234
|
let accid = param.account_id;
|
|
6202
6235
|
let ref = param.ref;
|
|
6203
6236
|
let user = await this.store.init(accid, undefined, ref);
|
|
6237
|
+
util/* default */.Z.setTimeout(() => window.postMessage({
|
|
6238
|
+
type: 'widget_loaded',
|
|
6239
|
+
account_id: accid
|
|
6240
|
+
}, '*'), 0);
|
|
6204
6241
|
if (!$container) $container = document.body || document;
|
|
6205
6242
|
this.pluginMgr = new PluginMgr(this, $container);
|
|
6206
|
-
let clean = util/* default
|
|
6243
|
+
let clean = util/* default */.Z.setInterval(() => {
|
|
6207
6244
|
if ($container && $container.isConnected) return;
|
|
6208
6245
|
this.pluginMgr.destroy();
|
|
6209
|
-
util/* default
|
|
6246
|
+
util/* default */.Z.clearInterval(clean);
|
|
6210
6247
|
}, 1000);
|
|
6211
6248
|
this.domGate.open();
|
|
6212
6249
|
return user;
|
|
6213
6250
|
}
|
|
6214
6251
|
async setAccount(id, $container, mask, cb) {
|
|
6215
6252
|
let outmask = await this.store.init(id, mask);
|
|
6253
|
+
util/* default */.Z.setTimeout(() => window.postMessage({
|
|
6254
|
+
type: 'widget_loaded',
|
|
6255
|
+
account_id: id
|
|
6256
|
+
}, '*'), 0);
|
|
6216
6257
|
if (!$container) $container = document.body || document;
|
|
6217
6258
|
this.pluginMgr = new PluginMgr(this, $container);
|
|
6218
|
-
let clean = util/* default
|
|
6259
|
+
let clean = util/* default */.Z.setInterval(() => {
|
|
6219
6260
|
if ($container && $container.isConnected) return;
|
|
6220
6261
|
this.pluginMgr.destroy();
|
|
6221
|
-
util/* default
|
|
6262
|
+
util/* default */.Z.clearInterval(clean);
|
|
6222
6263
|
}, 1000);
|
|
6223
6264
|
this.domGate.open();
|
|
6224
6265
|
cb && cb(outmask);
|
|
@@ -6232,12 +6273,12 @@ class Widget {
|
|
|
6232
6273
|
attributes
|
|
6233
6274
|
});
|
|
6234
6275
|
var user = this.store.matchUser();
|
|
6235
|
-
return util/* default
|
|
6276
|
+
return util/* default */.Z.cloneDeep(user.attributes);
|
|
6236
6277
|
}
|
|
6237
6278
|
async getUserAttributes() {
|
|
6238
6279
|
await this.store.readyGate.entry();
|
|
6239
6280
|
var user = this.store.matchUser();
|
|
6240
|
-
return util/* default
|
|
6281
|
+
return util/* default */.Z.cloneDeep(util/* default */.Z.get(user, 'attributes', []));
|
|
6241
6282
|
}
|
|
6242
6283
|
async getWidgetCurrentView() {
|
|
6243
6284
|
await this.domGate.entry();
|
|
@@ -6268,40 +6309,40 @@ class Widget {
|
|
|
6268
6309
|
});
|
|
6269
6310
|
}
|
|
6270
6311
|
async viewForm(formid) {
|
|
6271
|
-
if (!formid || !util/* default
|
|
6312
|
+
if (!formid || !util/* default */.Z.startsWith(formid, 'cp')) return;
|
|
6272
6313
|
let impressiontoken = this.impressionTokens[formid];
|
|
6273
6314
|
if (impressiontoken) return impressiontoken;
|
|
6274
6315
|
let {
|
|
6275
6316
|
body: impression
|
|
6276
6317
|
} = await this.store.sendImpression(formid);
|
|
6277
|
-
impressiontoken = util/* default
|
|
6318
|
+
impressiontoken = util/* default */.Z.get(impression, 'impression_token') || '';
|
|
6278
6319
|
this.impressionTokens[formid] = impressiontoken;
|
|
6279
6320
|
return impressiontoken;
|
|
6280
6321
|
}
|
|
6281
6322
|
async submitForm(formid, values) {
|
|
6282
|
-
if (!formid || !util/* default
|
|
6283
|
-
let storeuser = util/* default
|
|
6323
|
+
if (!formid || !util/* default */.Z.startsWith(formid, 'cp')) return;
|
|
6324
|
+
let storeuser = util/* default */.Z.cloneDeep(this.store.matchUser());
|
|
6284
6325
|
let user = {
|
|
6285
6326
|
id: storeuser.id,
|
|
6286
6327
|
account_id: storeuser.account_id
|
|
6287
6328
|
};
|
|
6288
6329
|
let is_lead = false;
|
|
6289
|
-
values = util/* default
|
|
6330
|
+
values = util/* default */.Z.map(values, val => {
|
|
6290
6331
|
let key = val.key;
|
|
6291
6332
|
if (key === 'email') key = 'emails';
|
|
6292
6333
|
if (key === 'phone') key = 'phones';
|
|
6293
6334
|
is_lead = is_lead || key == 'emails' || key == 'phones';
|
|
6294
|
-
util/* default
|
|
6335
|
+
util/* default */.Z.setUserAttr(user, {
|
|
6295
6336
|
key: key,
|
|
6296
6337
|
[val.type || 'text']: val.value
|
|
6297
6338
|
});
|
|
6298
6339
|
return {
|
|
6299
6340
|
key: key,
|
|
6300
6341
|
type: val.type || 'text',
|
|
6301
|
-
value: util/* default
|
|
6342
|
+
value: util/* default */.Z.stringify(val.value)
|
|
6302
6343
|
};
|
|
6303
6344
|
});
|
|
6304
|
-
if (is_lead) util/* default
|
|
6345
|
+
if (is_lead) util/* default */.Z.setUserAttr(user, {
|
|
6305
6346
|
key: 'lead_source',
|
|
6306
6347
|
text: 'plugin.' + formid
|
|
6307
6348
|
});
|
|
@@ -6346,6 +6387,10 @@ class Widget {
|
|
|
6346
6387
|
_overrideDeviceType(type) {
|
|
6347
6388
|
this.store.overrideDeviceType(type);
|
|
6348
6389
|
}
|
|
6390
|
+
unload() {
|
|
6391
|
+
if (this.pluginMgr) this.pluginMgr.destroy();
|
|
6392
|
+
this.store.destroy();
|
|
6393
|
+
}
|
|
6349
6394
|
_overridePlugin(plugins) {
|
|
6350
6395
|
this.store.overridePlugin(plugins);
|
|
6351
6396
|
}
|
|
@@ -6359,14 +6404,14 @@ class Widget {
|
|
|
6359
6404
|
this.pluginMgr.forceRunPopup(pluginid);
|
|
6360
6405
|
}
|
|
6361
6406
|
unEvent(cb) {
|
|
6362
|
-
this.subs = util/* default
|
|
6407
|
+
this.subs = util/* default */.Z.filter(this.subs, sub => sub !== cb);
|
|
6363
6408
|
}
|
|
6364
6409
|
async countUnreadMessages() {
|
|
6365
6410
|
await this.domGate.entry();
|
|
6366
6411
|
return this.store.matchUnread();
|
|
6367
6412
|
}
|
|
6368
6413
|
onEvent(cb) {
|
|
6369
|
-
this.subs = util/* default
|
|
6414
|
+
this.subs = util/* default */.Z.filter(this.subs, sub => sub !== cb);
|
|
6370
6415
|
this.subs.push(cb);
|
|
6371
6416
|
}
|
|
6372
6417
|
overrideAccount(acc) {
|
|
@@ -6374,7 +6419,7 @@ class Widget {
|
|
|
6374
6419
|
}
|
|
6375
6420
|
async overrideChatbox(chatbox) {
|
|
6376
6421
|
await this.store.overrideChatbox(chatbox);
|
|
6377
|
-
if (util/* default
|
|
6422
|
+
if (util/* default */.Z.get(chatbox, 'chatbox.greeting.greeting')) {
|
|
6378
6423
|
this.pluginMgr.showCurrentGreeting();
|
|
6379
6424
|
}
|
|
6380
6425
|
}
|