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