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