@subiz/widget-v4 4.1.61 → 4.1.62
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/app.js +2 -6
- package/dist/{605.js → 104.js} +57 -57
- package/dist/{178.js → 176.js} +54 -54
- package/dist/18d7db7ca8c.104.js +1 -0
- package/dist/18d7db7ca8c.176.js +1 -0
- package/dist/{18d5e97bf55.782.js → 18d7db7ca8c.444.js} +1 -1
- package/dist/{18d5e97bf55.335.js → 18d7db7ca8c.508.js} +1 -1
- package/dist/18d7db7ca8c.672.js +1 -0
- package/dist/18d7db7ca8c.756.js +1 -0
- package/dist/{18d5e97bf55.213.js → 18d7db7ca8c.792.js} +1 -1
- package/dist/18d7db7ca8c.928.js +1 -0
- package/dist/18d7db7ca8c.app.js +1 -0
- package/dist/{18d5e97bf55.index.html → 18d7db7ca8c.index.html} +1 -1
- package/dist/{18d5e97bf55.library.html → 18d7db7ca8c.library.html} +1 -1
- package/dist/18d7db7ca8c.library.js +1 -0
- package/dist/{18d5e97bf55.preview.html → 18d7db7ca8c.preview.html} +1 -1
- package/dist/18d7db7ca8c.preview.js +1 -0
- package/dist/18d7db7ca8c.screenshoot.js +1 -0
- package/dist/18d7db7ca8c.webview.js +1 -0
- package/dist/{782.js → 444.js} +6 -6
- package/dist/{335.js → 508.js} +30 -30
- package/dist/{678.js → 672.js} +6 -6
- package/dist/{362.js → 756.js} +6 -6
- package/dist/{213.js → 792.js} +121 -121
- package/dist/{841.js → 928.js} +688 -677
- package/dist/HASH +1 -1
- package/dist/screenshoot.html +1 -1
- package/dist/screenshoot.js +291 -291
- package/malicious-app.js +4 -8
- package/package.json +6 -6
- package/dist/18d5e97bf55.178.js +0 -1
- package/dist/18d5e97bf55.362.js +0 -1
- package/dist/18d5e97bf55.605.js +0 -1
- package/dist/18d5e97bf55.678.js +0 -1
- package/dist/18d5e97bf55.841.js +0 -1
- package/dist/18d5e97bf55.app.js +0 -1
- package/dist/18d5e97bf55.library.js +0 -1
- package/dist/18d5e97bf55.preview.js +0 -1
- package/dist/18d5e97bf55.screenshoot.js +0 -1
- package/dist/18d5e97bf55.webview.js +0 -1
package/dist/screenshoot.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******/ (() => { // webpackBootstrap
|
|
2
2
|
/******/ var __webpack_modules__ = ({
|
|
3
3
|
|
|
4
|
-
/***/
|
|
4
|
+
/***/ 3048:
|
|
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
|
+
/***/ 4592:
|
|
293
293
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
294
294
|
|
|
295
|
-
var loop = __webpack_require__(
|
|
295
|
+
var loop = __webpack_require__(4464)
|
|
296
296
|
// item: {payload, priority}
|
|
297
297
|
|
|
298
298
|
// idle => executing
|
|
@@ -377,7 +377,7 @@ module.exports = function (maxBatch, maxDelay, handler) {
|
|
|
377
377
|
|
|
378
378
|
/***/ }),
|
|
379
379
|
|
|
380
|
-
/***/
|
|
380
|
+
/***/ 9848:
|
|
381
381
|
/***/ ((module) => {
|
|
382
382
|
|
|
383
383
|
function map(collection, predicate) {
|
|
@@ -413,13 +413,13 @@ module.exports = {map: map}
|
|
|
413
413
|
|
|
414
414
|
/***/ }),
|
|
415
415
|
|
|
416
|
-
/***/
|
|
416
|
+
/***/ 7616:
|
|
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__(2856)
|
|
420
|
+
var loop = __webpack_require__(4464)
|
|
421
|
+
var map = __webpack_require__(9676)
|
|
422
|
+
var batch = __webpack_require__(4592)
|
|
423
423
|
|
|
424
424
|
module.exports = {
|
|
425
425
|
sleep: sleep,
|
|
@@ -431,7 +431,7 @@ module.exports = {
|
|
|
431
431
|
|
|
432
432
|
/***/ }),
|
|
433
433
|
|
|
434
|
-
/***/
|
|
434
|
+
/***/ 4464:
|
|
435
435
|
/***/ ((module) => {
|
|
436
436
|
|
|
437
437
|
// loop keep calling promise sequenctially until the promise resolve a false value
|
|
@@ -454,10 +454,10 @@ module.exports = function loop(promise) {
|
|
|
454
454
|
|
|
455
455
|
/***/ }),
|
|
456
456
|
|
|
457
|
-
/***/
|
|
457
|
+
/***/ 9676:
|
|
458
458
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
459
459
|
|
|
460
|
-
var co = __webpack_require__(
|
|
460
|
+
var co = __webpack_require__(9848)
|
|
461
461
|
|
|
462
462
|
module.exports = function (collections, func, limit) {
|
|
463
463
|
if (typeof func === 'number') {
|
|
@@ -511,7 +511,7 @@ module.exports = function (collections, func, limit) {
|
|
|
511
511
|
|
|
512
512
|
/***/ }),
|
|
513
513
|
|
|
514
|
-
/***/
|
|
514
|
+
/***/ 2856:
|
|
515
515
|
/***/ ((module) => {
|
|
516
516
|
|
|
517
517
|
// sleep won't resolve after a given milliseconds
|
|
@@ -525,7 +525,7 @@ module.exports = function sleep(ms) {
|
|
|
525
525
|
|
|
526
526
|
/***/ }),
|
|
527
527
|
|
|
528
|
-
/***/
|
|
528
|
+
/***/ 9696:
|
|
529
529
|
/***/ ((module) => {
|
|
530
530
|
|
|
531
531
|
function logError(accid, userid, message, line) {
|
|
@@ -651,11 +651,11 @@ module.exports = {xhrsend, parseJSON, Pubsub, randomString, logError}
|
|
|
651
651
|
|
|
652
652
|
/***/ }),
|
|
653
653
|
|
|
654
|
-
/***/
|
|
654
|
+
/***/ 9364:
|
|
655
655
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
656
656
|
|
|
657
|
-
var flow = __webpack_require__(
|
|
658
|
-
var {xhrsend, parseJSON, Pubsub} = __webpack_require__(
|
|
657
|
+
var flow = __webpack_require__(7616)
|
|
658
|
+
var {xhrsend, parseJSON, Pubsub} = __webpack_require__(9696)
|
|
659
659
|
|
|
660
660
|
// Conn represents a realtime connection between an user and the realtime
|
|
661
661
|
// server (https://rt-0.subiz.com)
|
|
@@ -908,12 +908,12 @@ module.exports = Realtime
|
|
|
908
908
|
|
|
909
909
|
/***/ }),
|
|
910
910
|
|
|
911
|
-
/***/
|
|
911
|
+
/***/ 3232:
|
|
912
912
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
913
913
|
|
|
914
914
|
"use strict";
|
|
915
915
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
916
|
-
/* harmony export */
|
|
916
|
+
/* harmony export */ c: () => (/* binding */ Chain)
|
|
917
917
|
/* harmony export */ });
|
|
918
918
|
const ChainMaxSize = 50;
|
|
919
919
|
class Chain {
|
|
@@ -1138,12 +1138,12 @@ function orderBy(a, k, d) {
|
|
|
1138
1138
|
|
|
1139
1139
|
/***/ }),
|
|
1140
1140
|
|
|
1141
|
-
/***/
|
|
1141
|
+
/***/ 840:
|
|
1142
1142
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1143
1143
|
|
|
1144
1144
|
"use strict";
|
|
1145
1145
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1146
|
-
/* harmony export */
|
|
1146
|
+
/* harmony export */ c: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
1147
1147
|
/* harmony export */ });
|
|
1148
1148
|
var localStorageMemory = {};
|
|
1149
1149
|
var cache = {};
|
|
@@ -1173,12 +1173,12 @@ localStorageMemory.clear = function () {
|
|
|
1173
1173
|
|
|
1174
1174
|
/***/ }),
|
|
1175
1175
|
|
|
1176
|
-
/***/
|
|
1176
|
+
/***/ 8616:
|
|
1177
1177
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1178
1178
|
|
|
1179
1179
|
"use strict";
|
|
1180
1180
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1181
|
-
/* harmony export */
|
|
1181
|
+
/* harmony export */ c: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
1182
1182
|
/* harmony export */ });
|
|
1183
1183
|
let KvMaxSize = 500;
|
|
1184
1184
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (class {
|
|
@@ -1262,14 +1262,14 @@ let KvMaxSize = 500;
|
|
|
1262
1262
|
|
|
1263
1263
|
/***/ }),
|
|
1264
1264
|
|
|
1265
|
-
/***/
|
|
1265
|
+
/***/ 636:
|
|
1266
1266
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1267
1267
|
|
|
1268
1268
|
"use strict";
|
|
1269
1269
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1270
|
-
/* harmony export */
|
|
1270
|
+
/* harmony export */ c: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
1271
1271
|
/* harmony export */ });
|
|
1272
|
-
let memlocalStorage = (__webpack_require__(
|
|
1272
|
+
let memlocalStorage = (__webpack_require__(840)/* ["default"] */ .c);
|
|
1273
1273
|
let requestIdleCallback = window.requestIdleCallback || (cb => cb());
|
|
1274
1274
|
const LIMIT = 80;
|
|
1275
1275
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (class {
|
|
@@ -1330,26 +1330,26 @@ function toString(obj) {
|
|
|
1330
1330
|
|
|
1331
1331
|
/***/ }),
|
|
1332
1332
|
|
|
1333
|
-
/***/
|
|
1333
|
+
/***/ 6304:
|
|
1334
1334
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1335
1335
|
|
|
1336
1336
|
"use strict";
|
|
1337
1337
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1338
|
-
/* harmony export */
|
|
1339
|
-
/* harmony export */
|
|
1340
|
-
/* harmony export */
|
|
1341
|
-
/* harmony export */
|
|
1342
|
-
/* harmony export */
|
|
1338
|
+
/* harmony export */ C3: () => (/* binding */ Clickaway),
|
|
1339
|
+
/* harmony export */ Ml: () => (/* binding */ langMessages),
|
|
1340
|
+
/* harmony export */ Qj: () => (/* binding */ downloadLanguage),
|
|
1341
|
+
/* harmony export */ Sq: () => (/* binding */ Com),
|
|
1342
|
+
/* harmony export */ a8: () => (/* binding */ getLocale)
|
|
1343
1343
|
/* 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__(
|
|
1344
|
+
/* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4284);
|
|
1345
|
+
/* harmony import */ var _util_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5780);
|
|
1346
1346
|
|
|
1347
1347
|
|
|
1348
|
-
class Com extends preact__WEBPACK_IMPORTED_MODULE_0__/* .Component */ .
|
|
1348
|
+
class Com extends preact__WEBPACK_IMPORTED_MODULE_0__/* .Component */ .Yl {
|
|
1349
1349
|
constructor(props) {
|
|
1350
1350
|
super(props);
|
|
1351
1351
|
this._isMounted = true;
|
|
1352
|
-
_util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .
|
|
1352
|
+
_util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .c.setTimeout(() => {
|
|
1353
1353
|
if (this.componentWillUnmount) {
|
|
1354
1354
|
let old = this.componentWillUnmount.bind(this);
|
|
1355
1355
|
this.componentWillUnmount = () => {
|
|
@@ -1388,9 +1388,9 @@ class Clickaway extends Com {
|
|
|
1388
1388
|
}
|
|
1389
1389
|
const getLocale = (plugin, loc) => {
|
|
1390
1390
|
if (!loc) loc = '';
|
|
1391
|
-
let found = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .
|
|
1391
|
+
let found = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .c.find(plugin.locales, l => l.toLowerCase().trim() === loc.toLowerCase().trim());
|
|
1392
1392
|
if (found) return found;
|
|
1393
|
-
found = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .
|
|
1393
|
+
found = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .c.find(plugin.locales, l => {
|
|
1394
1394
|
l = l.replace('-', '_').split('_')[0].trim().toLowerCase();
|
|
1395
1395
|
let compareloc = loc.replace('-', '_').split('_')[0].trim().toLowerCase();
|
|
1396
1396
|
return l == compareloc;
|
|
@@ -1401,7 +1401,7 @@ const getLocale = (plugin, loc) => {
|
|
|
1401
1401
|
let langMessages = {};
|
|
1402
1402
|
let downloadLock = false;
|
|
1403
1403
|
function downloadLanguage(store, locale, force) {
|
|
1404
|
-
if (downloadLock) return new Promise(resolve => _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .
|
|
1404
|
+
if (downloadLock) return new Promise(resolve => _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .c.setTimeout(() => downloadLanguage(store, locale, force).then(resolve), 100));
|
|
1405
1405
|
downloadLock = true;
|
|
1406
1406
|
let messages;
|
|
1407
1407
|
if (locale === 'debug' || langMessages[locale] && !force) {
|
|
@@ -1410,14 +1410,14 @@ function downloadLanguage(store, locale, force) {
|
|
|
1410
1410
|
}
|
|
1411
1411
|
return store.getLocaleContent(locale).then(res => {
|
|
1412
1412
|
downloadLock = false;
|
|
1413
|
-
messages = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .
|
|
1413
|
+
messages = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .c.get(res, 'body.messages', []);
|
|
1414
1414
|
langMessages[locale] = messages;
|
|
1415
1415
|
});
|
|
1416
1416
|
}
|
|
1417
1417
|
|
|
1418
1418
|
/***/ }),
|
|
1419
1419
|
|
|
1420
|
-
/***/
|
|
1420
|
+
/***/ 6016:
|
|
1421
1421
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1422
1422
|
|
|
1423
1423
|
"use strict";
|
|
@@ -1491,7 +1491,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1491
1491
|
/* harmony export */ unixSec: () => (/* binding */ unixSec),
|
|
1492
1492
|
/* harmony export */ usersOfConvo: () => (/* binding */ usersOfConvo)
|
|
1493
1493
|
/* harmony export */ });
|
|
1494
|
-
var op = __webpack_require__(
|
|
1494
|
+
var op = __webpack_require__(1436);
|
|
1495
1495
|
function parseJSON(str) {
|
|
1496
1496
|
try {
|
|
1497
1497
|
return parse(str);
|
|
@@ -2915,12 +2915,12 @@ const ALL_CURRENCIES = [{
|
|
|
2915
2915
|
|
|
2916
2916
|
/***/ }),
|
|
2917
2917
|
|
|
2918
|
-
/***/
|
|
2918
|
+
/***/ 1276:
|
|
2919
2919
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2920
2920
|
|
|
2921
2921
|
"use strict";
|
|
2922
2922
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2923
|
-
/* harmony export */
|
|
2923
|
+
/* harmony export */ c: () => (/* binding */ Gate)
|
|
2924
2924
|
/* harmony export */ });
|
|
2925
2925
|
class Gate {
|
|
2926
2926
|
constructor(isOpen) {
|
|
@@ -2956,14 +2956,14 @@ class Gate {
|
|
|
2956
2956
|
|
|
2957
2957
|
/***/ }),
|
|
2958
2958
|
|
|
2959
|
-
/***/
|
|
2959
|
+
/***/ 5780:
|
|
2960
2960
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2961
2961
|
|
|
2962
2962
|
"use strict";
|
|
2963
2963
|
|
|
2964
2964
|
// EXPORTS
|
|
2965
2965
|
__webpack_require__.d(__webpack_exports__, {
|
|
2966
|
-
|
|
2966
|
+
c: () => (/* binding */ util)
|
|
2967
2967
|
});
|
|
2968
2968
|
|
|
2969
2969
|
// NAMESPACE OBJECT: ./src/util/extractor.js
|
|
@@ -3001,9 +3001,9 @@ __webpack_require__.d(order_namespaceObject, {
|
|
|
3001
3001
|
});
|
|
3002
3002
|
|
|
3003
3003
|
// EXTERNAL MODULE: ./src/util/common.js
|
|
3004
|
-
var common = __webpack_require__(
|
|
3004
|
+
var common = __webpack_require__(6016);
|
|
3005
3005
|
;// CONCATENATED MODULE: ./src/util/extractor.js
|
|
3006
|
-
var extractor_common = __webpack_require__(
|
|
3006
|
+
var extractor_common = __webpack_require__(6016);
|
|
3007
3007
|
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
3008
|
emojis = extractor_common.map(emojis, e => ':' + e + ':');
|
|
3009
3009
|
function extractEmojis(text) {
|
|
@@ -3128,7 +3128,7 @@ function extractText(text) {
|
|
|
3128
3128
|
return pipeExtracts(text, [email, link, phone, emoji]);
|
|
3129
3129
|
}
|
|
3130
3130
|
;// CONCATENATED MODULE: ./src/util/campaign.js
|
|
3131
|
-
var campaign_common = __webpack_require__(
|
|
3131
|
+
var campaign_common = __webpack_require__(6016);
|
|
3132
3132
|
function trackExitIntent(cb) {
|
|
3133
3133
|
let handler = e => {
|
|
3134
3134
|
if (e.clientY > 10) return;
|
|
@@ -3209,8 +3209,8 @@ function on(eventName, selector, fn) {
|
|
|
3209
3209
|
});
|
|
3210
3210
|
}
|
|
3211
3211
|
;// CONCATENATED MODULE: ./src/util/order.js
|
|
3212
|
-
const op = __webpack_require__(
|
|
3213
|
-
const order_common = __webpack_require__(
|
|
3212
|
+
const op = __webpack_require__(1436);
|
|
3213
|
+
const order_common = __webpack_require__(6016);
|
|
3214
3214
|
op.filter = order_common.filter;
|
|
3215
3215
|
op.map = order_common.map;
|
|
3216
3216
|
op.each = order_common.each;
|
|
@@ -3316,12 +3316,12 @@ function calcOrderTotal(order) {
|
|
|
3316
3316
|
var sb = {};
|
|
3317
3317
|
|
|
3318
3318
|
sb = Object.assign(sb, common);
|
|
3319
|
-
sb.Gate = (__webpack_require__(
|
|
3320
|
-
sb.Mutex = (__webpack_require__(
|
|
3321
|
-
var util_op = __webpack_require__(
|
|
3319
|
+
sb.Gate = (__webpack_require__(1276)/* ["default"] */ .c);
|
|
3320
|
+
sb.Mutex = (__webpack_require__(9248)/* ["default"] */ .c);
|
|
3321
|
+
var util_op = __webpack_require__(1436);
|
|
3322
3322
|
sb.get = util_op.get;
|
|
3323
3323
|
sb.set = util_op.set;
|
|
3324
|
-
sb.Pubsub = (__webpack_require__(
|
|
3324
|
+
sb.Pubsub = (__webpack_require__(4996)/* ["default"] */ .c);
|
|
3325
3325
|
|
|
3326
3326
|
sb = Object.assign(sb, extractor_namespaceObject);
|
|
3327
3327
|
|
|
@@ -3332,12 +3332,12 @@ sb = Object.assign(sb, order_namespaceObject);
|
|
|
3332
3332
|
|
|
3333
3333
|
/***/ }),
|
|
3334
3334
|
|
|
3335
|
-
/***/
|
|
3335
|
+
/***/ 9248:
|
|
3336
3336
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3337
3337
|
|
|
3338
3338
|
"use strict";
|
|
3339
3339
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3340
|
-
/* harmony export */
|
|
3340
|
+
/* harmony export */ c: () => (/* binding */ Mutex)
|
|
3341
3341
|
/* harmony export */ });
|
|
3342
3342
|
class Mutex {
|
|
3343
3343
|
constructor() {
|
|
@@ -3366,7 +3366,7 @@ class Mutex {
|
|
|
3366
3366
|
|
|
3367
3367
|
/***/ }),
|
|
3368
3368
|
|
|
3369
|
-
/***/
|
|
3369
|
+
/***/ 1436:
|
|
3370
3370
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3371
3371
|
|
|
3372
3372
|
"use strict";
|
|
@@ -3426,17 +3426,17 @@ function set(obj, path, value) {
|
|
|
3426
3426
|
|
|
3427
3427
|
/***/ }),
|
|
3428
3428
|
|
|
3429
|
-
/***/
|
|
3429
|
+
/***/ 4996:
|
|
3430
3430
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3431
3431
|
|
|
3432
3432
|
"use strict";
|
|
3433
3433
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3434
|
-
/* harmony export */
|
|
3434
|
+
/* harmony export */ c: () => (/* binding */ Pubsub)
|
|
3435
3435
|
/* harmony export */ });
|
|
3436
3436
|
var {
|
|
3437
3437
|
filter,
|
|
3438
3438
|
map
|
|
3439
|
-
} = __webpack_require__(
|
|
3439
|
+
} = __webpack_require__(6016);
|
|
3440
3440
|
class Pubsub {
|
|
3441
3441
|
constructor() {
|
|
3442
3442
|
this.listeners = {};
|
|
@@ -3458,7 +3458,7 @@ class Pubsub {
|
|
|
3458
3458
|
|
|
3459
3459
|
/***/ }),
|
|
3460
3460
|
|
|
3461
|
-
/***/
|
|
3461
|
+
/***/ 2420:
|
|
3462
3462
|
/***/ (function(module) {
|
|
3463
3463
|
|
|
3464
3464
|
(function (global, factory) {
|
|
@@ -3645,16 +3645,16 @@ class Pubsub {
|
|
|
3645
3645
|
|
|
3646
3646
|
/***/ }),
|
|
3647
3647
|
|
|
3648
|
-
/***/
|
|
3648
|
+
/***/ 4284:
|
|
3649
3649
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3650
3650
|
|
|
3651
3651
|
"use strict";
|
|
3652
3652
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3653
|
-
/* harmony export */
|
|
3654
|
-
/* harmony export */
|
|
3655
|
-
/* harmony export */
|
|
3656
|
-
/* harmony export */
|
|
3657
|
-
/* harmony export */
|
|
3653
|
+
/* harmony export */ Yl: () => (/* binding */ b),
|
|
3654
|
+
/* harmony export */ Yn: () => (/* binding */ _),
|
|
3655
|
+
/* harmony export */ ae: () => (/* binding */ g),
|
|
3656
|
+
/* harmony export */ ai: () => (/* binding */ q),
|
|
3657
|
+
/* harmony export */ h: () => (/* binding */ y)
|
|
3658
3658
|
/* harmony export */ });
|
|
3659
3659
|
/* unused harmony exports cloneElement, createContext, createElement, hydrate, isValidElement, options, toChildArray */
|
|
3660
3660
|
var n,l,u,t,i,o,r,f,e,c={},s=[],a=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,h=Array.isArray;function v(n,l){for(var u in l)n[u]=l[u];return n}function p(n){var l=n.parentNode;l&&l.removeChild(n)}function y(l,u,t){var i,o,r,f={};for(r in u)"key"==r?i=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return d(l,f,i,o,null)}function d(n,t,i,o,r){var f={type:n,props:t,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==r?++u:r,__i:-1,__u:0};return null==r&&null!=l.vnode&&l.vnode(f),f}function _(){return{current:null}}function g(n){return n.children}function b(n,l){this.props=n,this.context=l}function m(n,l){if(null==l)return n.__?m(n.__,n.__i+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return"function"==typeof n.type?m(n):null}function k(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return k(n)}}function w(n){(!n.__d&&(n.__d=!0)&&i.push(n)&&!x.__r++||o!==l.debounceRendering)&&((o=l.debounceRendering)||r)(x)}function x(){var n,u,t,o,r,e,c,s,a;for(i.sort(f);n=i.shift();)n.__d&&(u=i.length,o=void 0,e=(r=(t=n).__v).__e,s=[],a=[],(c=t.__P)&&((o=v({},r)).__v=r.__v+1,l.vnode&&l.vnode(o),L(c,o,r,t.__n,void 0!==c.ownerSVGElement,32&r.__u?[e]:null,s,null==e?m(r):e,!!(32&r.__u),a),o.__.__k[o.__i]=o,M(s,o,a),o.__e!=e&&k(o)),i.length>u&&i.sort(f));x.__r=0}function C(n,l,u,t,i,o,r,f,e,a,h){var v,p,y,d,_,g=t&&t.__k||s,b=l.length;for(u.__d=e,P(u,l,g),e=u.__d,v=0;v<b;v++)null!=(y=u.__k[v])&&"boolean"!=typeof y&&"function"!=typeof y&&(p=-1===y.__i?c:g[y.__i]||c,y.__i=v,L(n,y,p,i,o,r,f,e,a,h),d=y.__e,y.ref&&p.ref!=y.ref&&(p.ref&&z(p.ref,null,y),h.push(y.ref,y.__c||d,y)),null==_&&null!=d&&(_=d),65536&y.__u||p.__k===y.__k?e=S(y,e,n):"function"==typeof y.type&&void 0!==y.__d?e=y.__d:d&&(e=d.nextSibling),y.__d=void 0,y.__u&=-196609);u.__d=e,u.__e=_}function P(n,l,u){var t,i,o,r,f,e=l.length,c=u.length,s=c,a=0;for(n.__k=[],t=0;t<e;t++)null!=(i=n.__k[t]=null==(i=l[t])||"boolean"==typeof i||"function"==typeof i?null:"string"==typeof i||"number"==typeof i||"bigint"==typeof i||i.constructor==String?d(null,i,null,null,i):h(i)?d(g,{children:i},null,null,null):void 0===i.constructor&&i.__b>0?d(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)?(i.__=n,i.__b=n.__b+1,f=H(i,u,r=t+a,s),i.__i=f,o=null,-1!==f&&(s--,(o=u[f])&&(o.__u|=131072)),null==o||null===o.__v?(-1==f&&a--,"function"!=typeof i.type&&(i.__u|=65536)):f!==r&&(f===r+1?a++:f>r?s>e-r?a+=f-r:a--:a=f<r&&f==r-1?f-r:0,f!==t+a&&(i.__u|=65536))):(o=u[t])&&null==o.key&&o.__e&&(o.__e==n.__d&&(n.__d=m(o)),N(o,o,!1),u[t]=null,s--);if(s)for(t=0;t<c;t++)null!=(o=u[t])&&0==(131072&o.__u)&&(o.__e==n.__d&&(n.__d=m(o)),N(o,o))}function S(n,l,u){var t,i;if("function"==typeof n.type){for(t=n.__k,i=0;t&&i<t.length;i++)t[i]&&(t[i].__=n,l=S(t[i],l,u));return l}return n.__e!=l&&(u.insertBefore(n.__e,l||null),l=n.__e),l&&l.nextSibling}function $(n,l){return l=l||[],null==n||"boolean"==typeof n||(h(n)?n.some(function(n){$(n,l)}):l.push(n)),l}function H(n,l,u,t){var i=n.key,o=n.type,r=u-1,f=u+1,e=l[u];if(null===e||e&&i==e.key&&o===e.type)return u;if(t>(null!=e&&0==(131072&e.__u)?1:0))for(;r>=0||f<l.length;){if(r>=0){if((e=l[r])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return r;r--}if(f<l.length){if((e=l[f])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return f;f++}}return-1}function I(n,l,u){"-"===l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||a.test(l)?u:u+"px"}function T(n,l,u,t,i){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else{if("string"==typeof t&&(n.style.cssText=t=""),t)for(l in t)u&&l in u||I(n.style,l,"");if(u)for(l in u)t&&u[l]===t[l]||I(n.style,l,u[l])}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/(PointerCapture)$|Capture$/,"$1")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?t?u.u=t.u:(u.u=Date.now(),n.addEventListener(l,o?D:A,o)):n.removeEventListener(l,o?D:A,o);else{if(i)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==l&&"height"!==l&&"href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&"rowSpan"!==l&&"colSpan"!==l&&"role"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&"-"!==l[4]?n.removeAttribute(l):n.setAttribute(l,u))}}function A(n){var u=this.l[n.type+!1];if(n.t){if(n.t<=u.u)return}else n.t=Date.now();return u(l.event?l.event(n):n)}function D(n){return this.l[n.type+!0](l.event?l.event(n):n)}function L(n,u,t,i,o,r,f,e,c,s){var a,p,y,d,_,m,k,w,x,P,S,$,H,I,T,A=u.type;if(void 0!==u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),r=[e=u.__e=t.__e]),(a=l.__b)&&a(u);n:if("function"==typeof A)try{if(w=u.props,x=(a=A.contextType)&&i[a.__c],P=a?x?x.props.value:a.__:i,t.__c?k=(p=u.__c=t.__c).__=p.__E:("prototype"in A&&A.prototype.render?u.__c=p=new A(w,P):(u.__c=p=new b(w,P),p.constructor=A,p.render=O),x&&x.sub(p),p.props=w,p.state||(p.state={}),p.context=P,p.__n=i,y=p.__d=!0,p.__h=[],p._sb=[]),null==p.__s&&(p.__s=p.state),null!=A.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=v({},p.__s)),v(p.__s,A.getDerivedStateFromProps(w,p.__s))),d=p.props,_=p.state,p.__v=u,y)null==A.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(null==A.getDerivedStateFromProps&&w!==d&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(w,P),!p.__e&&(null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(w,p.__s,P)||u.__v===t.__v)){for(u.__v!==t.__v&&(p.props=w,p.state=p.__s,p.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.forEach(function(n){n&&(n.__=u)}),S=0;S<p._sb.length;S++)p.__h.push(p._sb[S]);p._sb=[],p.__h.length&&f.push(p);break n}null!=p.componentWillUpdate&&p.componentWillUpdate(w,p.__s,P),null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(d,_,m)})}if(p.context=P,p.props=w,p.__P=n,p.__e=!1,$=l.__r,H=0,"prototype"in A&&A.prototype.render){for(p.state=p.__s,p.__d=!1,$&&$(u),a=p.render(p.props,p.state,p.context),I=0;I<p._sb.length;I++)p.__h.push(p._sb[I]);p._sb=[]}else do{p.__d=!1,$&&$(u),a=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++H<25);p.state=p.__s,null!=p.getChildContext&&(i=v(v({},i),p.getChildContext())),y||null==p.getSnapshotBeforeUpdate||(m=p.getSnapshotBeforeUpdate(d,_)),C(n,h(T=null!=a&&a.type===g&&null==a.key?a.props.children:a)?T:[T],u,t,i,o,r,f,e,c,s),p.base=u.__e,u.__u&=-161,p.__h.length&&f.push(p),k&&(p.__E=p.__=null)}catch(n){u.__v=null,c||null!=r?(u.__e=e,u.__u|=c?160:32,r[r.indexOf(e)]=null):(u.__e=t.__e,u.__k=t.__k),l.__e(n,u,t)}else null==r&&u.__v===t.__v?(u.__k=t.__k,u.__e=t.__e):u.__e=j(t.__e,u,t,i,o,r,f,c,s);(a=l.diffed)&&a(u)}function M(n,u,t){u.__d=void 0;for(var i=0;i<t.length;i++)z(t[i],t[++i],t[++i]);l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u)})}catch(n){l.__e(n,u.__v)}})}function j(l,u,t,i,o,r,f,e,s){var a,v,y,d,_,g,b,k=t.props,w=u.props,x=u.type;if("svg"===x&&(o=!0),null!=r)for(a=0;a<r.length;a++)if((_=r[a])&&"setAttribute"in _==!!x&&(x?_.localName===x:3===_.nodeType)){l=_,r[a]=null;break}if(null==l){if(null===x)return document.createTextNode(w);l=o?document.createElementNS("http://www.w3.org/2000/svg",x):document.createElement(x,w.is&&w),r=null,e=!1}if(null===x)k===w||e&&l.data===w||(l.data=w);else{if(r=r&&n.call(l.childNodes),k=t.props||c,!e&&null!=r)for(k={},a=0;a<l.attributes.length;a++)k[(_=l.attributes[a]).name]=_.value;for(a in k)_=k[a],"children"==a||("dangerouslySetInnerHTML"==a?y=_:"key"===a||a in w||T(l,a,null,_,o));for(a in w)_=w[a],"children"==a?d=_:"dangerouslySetInnerHTML"==a?v=_:"value"==a?g=_:"checked"==a?b=_:"key"===a||e&&"function"!=typeof _||k[a]===_||T(l,a,_,k[a],o);if(v)e||y&&(v.__html===y.__html||v.__html===l.innerHTML)||(l.innerHTML=v.__html),u.__k=[];else if(y&&(l.innerHTML=""),C(l,h(d)?d:[d],u,t,i,o&&"foreignObject"!==x,r,f,r?r[0]:t.__k&&m(t,0),e,s),null!=r)for(a=r.length;a--;)null!=r[a]&&p(r[a]);e||(a="value",void 0!==g&&(g!==l[a]||"progress"===x&&!g||"option"===x&&g!==k[a])&&T(l,a,g,k[a],!1),a="checked",void 0!==b&&b!==l[a]&&T(l,a,b,k[a],!1))}return l}function z(n,u,t){try{"function"==typeof n?n(u):n.current=u}catch(n){l.__e(n,t)}}function N(n,u,t){var i,o;if(l.unmount&&l.unmount(n),(i=n.ref)&&(i.current&&i.current!==n.__e||z(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(n){l.__e(n,u)}i.base=i.__P=null,n.__c=void 0}if(i=n.__k)for(o=0;o<i.length;o++)i[o]&&N(i[o],u,t||"function"!=typeof n.type);t||null==n.__e||p(n.__e),n.__=n.__e=n.__d=void 0}function O(n,l,u){return this.constructor(n,u)}function q(u,t,i){var o,r,f,e;l.__&&l.__(u,t),r=(o="function"==typeof i)?null:i&&i.__k||t.__k,f=[],e=[],L(t,u=(!o&&i||t).__k=y(g,null,[u]),r||c,c,void 0!==t.ownerSVGElement,!o&&i?[i]:r?null:t.firstChild?n.call(t.childNodes):null,f,!o&&i?i:r?r.__e:t.firstChild,o,e),M(f,u,e)}function B(n,l){q(n,l,B)}function E(l,u,t){var i,o,r,f,e=v({},l.props);for(r in l.type&&l.type.defaultProps&&(f=l.type.defaultProps),u)"key"==r?i=u[r]:"ref"==r?o=u[r]:e[r]=void 0===u[r]&&void 0!==f?f[r]:u[r];return arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):t),d(l.type,e,i||l.key,o||l.ref,null)}function F(n,l){var u={__c:l="__cC"+e++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,t;return this.getChildContext||(u=[],(t={})[l]=this,this.getChildContext=function(){return t},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(function(n){n.__e=!0,w(n)})},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n)}}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=s.slice,l={__e:function(n,l,u,t){for(var i,o,r;l=l.__;)if((i=l.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(n)),r=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),r=i.__d),r)return i.__E=i}catch(l){n=l}throw n}},u=0,t=function(n){return null!=n&&null==n.constructor},b.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=v({},this.state),"function"==typeof n&&(n=n(v({},u),this.props)),n&&v(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),w(this))},b.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),w(this))},b.prototype.render=g,i=[],r="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f=function(n,l){return n.__v.__b-l.__v.__b},x.__r=0,e=0;
|
|
@@ -3814,7 +3814,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
3814
|
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
|
3815
3815
|
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
|
|
3816
3816
|
/******/ var installedChunks = {
|
|
3817
|
-
/******/
|
|
3817
|
+
/******/ 160: 0
|
|
3818
3818
|
/******/ };
|
|
3819
3819
|
/******/
|
|
3820
3820
|
/******/ __webpack_require__.f.j = (chunkId, promises) => {
|
|
@@ -3903,12 +3903,12 @@ var __webpack_exports__ = {};
|
|
|
3903
3903
|
"use strict";
|
|
3904
3904
|
|
|
3905
3905
|
// EXTERNAL MODULE: ./src/util/index.js + 3 modules
|
|
3906
|
-
var util = __webpack_require__(
|
|
3906
|
+
var util = __webpack_require__(5780);
|
|
3907
3907
|
;// 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__(
|
|
3908
|
+
var kv = (__webpack_require__(8616)/* ["default"] */ .c);
|
|
3909
|
+
var chain = (__webpack_require__(3232)/* ["default"] */ .c);
|
|
3910
|
+
var inmem_localstorage = (__webpack_require__(840)/* ["default"] */ .c);
|
|
3911
|
+
var lsdb = (__webpack_require__(636)/* ["default"] */ .c);
|
|
3912
3912
|
/* harmony default export */ const storage = ({
|
|
3913
3913
|
kv,
|
|
3914
3914
|
lsdb,
|
|
@@ -3920,11 +3920,11 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
3920
3920
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
3921
3921
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
3922
3922
|
|
|
3923
|
-
const ajax = __webpack_require__(
|
|
3924
|
-
ajax.env.XMLHttpRequest = util/* default */.
|
|
3923
|
+
const ajax = __webpack_require__(3048);
|
|
3924
|
+
ajax.env.XMLHttpRequest = util/* default */.c.XMLHttpRequest;
|
|
3925
3925
|
function jsonifyTextPlain(param, done) {
|
|
3926
3926
|
let req = param.request;
|
|
3927
|
-
if (req.content_type === 'text/plain' && req.body !== undefined) req.body = util/* default */.
|
|
3927
|
+
if (req.content_type === 'text/plain' && req.body !== undefined) req.body = util/* default */.c.stringify(req.body);
|
|
3928
3928
|
done(true);
|
|
3929
3929
|
}
|
|
3930
3930
|
/* harmony default export */ const api = (class {
|
|
@@ -3939,7 +3939,7 @@ function jsonifyTextPlain(param, done) {
|
|
|
3939
3939
|
source: 'web'
|
|
3940
3940
|
}
|
|
3941
3941
|
};
|
|
3942
|
-
util/* default */.
|
|
3942
|
+
util/* default */.c.each(extraData, (v, k) => {
|
|
3943
3943
|
data[k] = v;
|
|
3944
3944
|
});
|
|
3945
3945
|
return this.apireq.post(`/accounts/${this.accid}/conversations`, data);
|
|
@@ -3963,7 +3963,7 @@ function jsonifyTextPlain(param, done) {
|
|
|
3963
3963
|
viewing_product_sku: sku,
|
|
3964
3964
|
viewing_product_source_id: source_id,
|
|
3965
3965
|
viewing_product_id: productid,
|
|
3966
|
-
pinged: util/* default */.
|
|
3966
|
+
pinged: util/* default */.c.Date.now(),
|
|
3967
3967
|
is_focused: false
|
|
3968
3968
|
}
|
|
3969
3969
|
}
|
|
@@ -4023,7 +4023,7 @@ function jsonifyTextPlain(param, done) {
|
|
|
4023
4023
|
_defineProperty(this, "suggest_address", keyword => this.apireq.setQuery({
|
|
4024
4024
|
keyword: keyword
|
|
4025
4025
|
}).get(`/accounts/${this.accid}/addresses`));
|
|
4026
|
-
this.refreshLock = new util/* default */.
|
|
4026
|
+
this.refreshLock = new util/* default */.c.Mutex();
|
|
4027
4027
|
this.FileURL = FileURL;
|
|
4028
4028
|
this.ApiURL = ApiURL;
|
|
4029
4029
|
this.apireq = ajax.setBaseUrl(ApiURL).withCredentials(true).addQuery('v', '6').setContentType('text/plain').beforeHook(jsonifyTextPlain).setParser('json').beforeHook((param, done) => {
|
|
@@ -4054,16 +4054,16 @@ function jsonifyTextPlain(param, done) {
|
|
|
4054
4054
|
let outuser;
|
|
4055
4055
|
for (let i = 0; true; i++) {
|
|
4056
4056
|
outuser = await ajax.setBaseUrl(this.ApiURL).withCredentials(true).addQuery('v', '6').addQuery('x-user-ref', this.ref).setParser('json').get(`/accounts/${this.accid}/users/${this.ref}`);
|
|
4057
|
-
if (outuser.error && util/* default */.
|
|
4058
|
-
if (!util/* default */.
|
|
4057
|
+
if (outuser.error && util/* default */.c.get(outuser, 'body.code', '').indexOf('locked_account') != -1) break;
|
|
4058
|
+
if (!util/* default */.c.get(outuser, 'body.id')) {
|
|
4059
4059
|
let sleeptime = Math.min(2000 + i * 400, 60000);
|
|
4060
|
-
await util/* default */.
|
|
4060
|
+
await util/* default */.c.sleep(sleeptime);
|
|
4061
4061
|
continue;
|
|
4062
4062
|
}
|
|
4063
4063
|
break;
|
|
4064
4064
|
}
|
|
4065
4065
|
if (outuser.error) {
|
|
4066
|
-
if (util/* default */.
|
|
4066
|
+
if (util/* default */.c.get(outuser.body.code)) return {
|
|
4067
4067
|
error: outuser.body.code
|
|
4068
4068
|
};
|
|
4069
4069
|
return outuser;
|
|
@@ -4076,7 +4076,7 @@ function jsonifyTextPlain(param, done) {
|
|
|
4076
4076
|
this.tokensession = this.tokensession || 0;
|
|
4077
4077
|
this.tokensession++;
|
|
4078
4078
|
let tokensession = this.tokensession;
|
|
4079
|
-
if (!this.accid || !util/* default */.
|
|
4079
|
+
if (!this.accid || !util/* default */.c.startsWith(this.accid, 'ac')) return {
|
|
4080
4080
|
error: 'invalid_account_id'
|
|
4081
4081
|
};
|
|
4082
4082
|
if (!this.profile_id) return {
|
|
@@ -4092,13 +4092,13 @@ function jsonifyTextPlain(param, done) {
|
|
|
4092
4092
|
this.refreshLock.unlock();
|
|
4093
4093
|
return;
|
|
4094
4094
|
}
|
|
4095
|
-
let age = (util/* default */.
|
|
4095
|
+
let age = (util/* default */.c.Date.now() - (this.last_token_at || 0)) / 1000;
|
|
4096
4096
|
if (!force && this.last_token && age < 1800) {
|
|
4097
4097
|
this.refreshLock.unlock();
|
|
4098
4098
|
return this.last_token;
|
|
4099
4099
|
}
|
|
4100
4100
|
if (!force && this.last_token && age < 3000) {
|
|
4101
|
-
if (this.token_generator) util/* default */.
|
|
4101
|
+
if (this.token_generator) util/* default */.c.setTimeout(async () => {
|
|
4102
4102
|
let token, err;
|
|
4103
4103
|
try {
|
|
4104
4104
|
token = await tokenGenerator(profile_id);
|
|
@@ -4110,7 +4110,7 @@ function jsonifyTextPlain(param, done) {
|
|
|
4110
4110
|
return;
|
|
4111
4111
|
}
|
|
4112
4112
|
if (err) this.last_token = 'error';else this.last_token = token;
|
|
4113
|
-
this.last_token_at = util/* default */.
|
|
4113
|
+
this.last_token_at = util/* default */.c.Date.now();
|
|
4114
4114
|
this.refreshLock.unlock();
|
|
4115
4115
|
});
|
|
4116
4116
|
return this.last_token;
|
|
@@ -4127,7 +4127,7 @@ function jsonifyTextPlain(param, done) {
|
|
|
4127
4127
|
return;
|
|
4128
4128
|
}
|
|
4129
4129
|
if (err) this.last_token = 'error';else this.last_token = token;
|
|
4130
|
-
this.last_token_at = util/* default */.
|
|
4130
|
+
this.last_token_at = util/* default */.c.Date.now();
|
|
4131
4131
|
this.refreshLock.unlock();
|
|
4132
4132
|
return this.last_token;
|
|
4133
4133
|
};
|
|
@@ -4136,15 +4136,15 @@ function jsonifyTextPlain(param, done) {
|
|
|
4136
4136
|
await this.token_generator(true);
|
|
4137
4137
|
if (tokensession != this.tokensession) break;
|
|
4138
4138
|
outuser = await ajax.setBaseUrl(this.ApiURL).withCredentials(true).addQuery('v', '6').addQuery('x-access-token', this.last_token).setParser('json').get(`/accounts/${this.accid}/users/${profile_id}`);
|
|
4139
|
-
if (!util/* default */.
|
|
4139
|
+
if (!util/* default */.c.get(outuser, 'body.id')) {
|
|
4140
4140
|
let sleeptime = Math.min(2000 + i * 100, 120000);
|
|
4141
|
-
await util/* default */.
|
|
4141
|
+
await util/* default */.c.sleep(sleeptime);
|
|
4142
4142
|
continue;
|
|
4143
4143
|
}
|
|
4144
4144
|
break;
|
|
4145
4145
|
}
|
|
4146
4146
|
if (outuser.error) {
|
|
4147
|
-
if (util/* default */.
|
|
4147
|
+
if (util/* default */.c.get(outuser.body.code)) return {
|
|
4148
4148
|
error: outuser.body.code
|
|
4149
4149
|
};
|
|
4150
4150
|
return outuser;
|
|
@@ -4190,12 +4190,12 @@ function api_fake_defineProperty(obj, key, value) { key = api_fake_toPropertyKey
|
|
|
4190
4190
|
function api_fake_toPropertyKey(t) { var i = api_fake_toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
4191
4191
|
function api_fake_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4192
4192
|
|
|
4193
|
-
const api_fake_ajax = __webpack_require__(
|
|
4193
|
+
const api_fake_ajax = __webpack_require__(3048);
|
|
4194
4194
|
api_fake_ajax.env.XMLHttpRequest = window.XMLHttpRequest;
|
|
4195
4195
|
const findAnswer = challenge => challenge.answer;
|
|
4196
4196
|
function api_fake_jsonifyTextPlain(param, done) {
|
|
4197
4197
|
let req = param.request;
|
|
4198
|
-
if (req.content_type === 'text/plain' && req.body !== undefined) req.body = util/* default */.
|
|
4198
|
+
if (req.content_type === 'text/plain' && req.body !== undefined) req.body = util/* default */.c.stringify(req.body);
|
|
4199
4199
|
done(true);
|
|
4200
4200
|
}
|
|
4201
4201
|
const OK200 = Promise.resolve({
|
|
@@ -4241,7 +4241,7 @@ const OK200 = Promise.resolve({
|
|
|
4241
4241
|
api_fake_defineProperty(this, "getChallenge", accid => OK200);
|
|
4242
4242
|
api_fake_defineProperty(this, "time", _ => Promise.resolve({
|
|
4243
4243
|
code: 200,
|
|
4244
|
-
body: new util/* default */.
|
|
4244
|
+
body: new util/* default */.c.Date().toISOString()
|
|
4245
4245
|
}));
|
|
4246
4246
|
api_fake_defineProperty(this, "updateUser", data => OK200);
|
|
4247
4247
|
api_fake_defineProperty(this, "getUser", _ => Promise.resolve({
|
|
@@ -4603,18 +4603,18 @@ function store_defineProperty(obj, key, value) { key = store_toPropertyKey(key);
|
|
|
4603
4603
|
function store_toPropertyKey(t) { var i = store_toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
4604
4604
|
function store_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4605
4605
|
|
|
4606
|
-
var flow = __webpack_require__(
|
|
4606
|
+
var flow = __webpack_require__(7616);
|
|
4607
4607
|
|
|
4608
4608
|
|
|
4609
4609
|
|
|
4610
4610
|
|
|
4611
|
-
var Realtime = __webpack_require__(
|
|
4612
|
-
var cookie = __webpack_require__(
|
|
4611
|
+
var Realtime = __webpack_require__(9364);
|
|
4612
|
+
var cookie = __webpack_require__(2420);
|
|
4613
4613
|
cookie.defaults.path = '/';
|
|
4614
4614
|
cookie.expiresMultiplier = 60 * 60 * 24;
|
|
4615
4615
|
cookie.defaults.expires = 3650;
|
|
4616
4616
|
const MAX_CONVO = 20;
|
|
4617
|
-
const page_loaded = util/* default */.
|
|
4617
|
+
const page_loaded = util/* default */.c.Date.now();
|
|
4618
4618
|
class Store {
|
|
4619
4619
|
constructor(ApiURL, FileURL, RealtimeURL, inmem, fakeapi) {
|
|
4620
4620
|
store_defineProperty(this, "inmem", false);
|
|
@@ -4632,14 +4632,14 @@ class Store {
|
|
|
4632
4632
|
let user = this.matchUser();
|
|
4633
4633
|
let allconvos = this.matchConvo('*');
|
|
4634
4634
|
let unreadcount = 0;
|
|
4635
|
-
util/* default */.
|
|
4636
|
-
if (!util/* default */.
|
|
4635
|
+
util/* default */.c.map(allconvos, convo => {
|
|
4636
|
+
if (!util/* default */.c.isConvoSeen(convo, user.id)) unreadcount++;
|
|
4637
4637
|
});
|
|
4638
4638
|
return unreadcount;
|
|
4639
4639
|
});
|
|
4640
4640
|
store_defineProperty(this, "matchPlugin", () => {
|
|
4641
|
-
if (util/* default */.
|
|
4642
|
-
return util/* default */.
|
|
4641
|
+
if (util/* default */.c.size(this.forcePlugins) > 0) return util/* default */.c.cloneDeep(this.forcePlugins);
|
|
4642
|
+
return util/* default */.c.cloneDeep(this.cache.match('plugin')) || {};
|
|
4643
4643
|
});
|
|
4644
4644
|
store_defineProperty(this, "device", {});
|
|
4645
4645
|
store_defineProperty(this, "browserVisibility", 'visible');
|
|
@@ -4652,7 +4652,7 @@ class Store {
|
|
|
4652
4652
|
if (!id) return;
|
|
4653
4653
|
if (id === '*') {
|
|
4654
4654
|
this._touchAcc();
|
|
4655
|
-
return util/* default */.
|
|
4655
|
+
return util/* default */.c.filter(this.cache.all(), (value, k) => k.startsWith('convo_'));
|
|
4656
4656
|
}
|
|
4657
4657
|
if (!this.isInsync(id)) this.fetchConvo(id);
|
|
4658
4658
|
return this.cache.match('convo_' + id);
|
|
@@ -4676,7 +4676,7 @@ class Store {
|
|
|
4676
4676
|
store_defineProperty(this, "listEvents", id => {
|
|
4677
4677
|
if (!id || id === '*' || typeof id !== 'string') return;
|
|
4678
4678
|
if (!this.isInsync('events' + id)) {
|
|
4679
|
-
util/* default */.
|
|
4679
|
+
util/* default */.c.setTimeout(async () => {
|
|
4680
4680
|
await this.readyGate.entry();
|
|
4681
4681
|
await this.reconnectGate.entry(undefined, true);
|
|
4682
4682
|
if (this.isInsync('events' + id)) return this.reconnectGate.open();
|
|
@@ -4699,10 +4699,10 @@ class Store {
|
|
|
4699
4699
|
});
|
|
4700
4700
|
store_defineProperty(this, "matchLocation", () => this.cache.match('location') || {});
|
|
4701
4701
|
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 */.
|
|
4702
|
+
store_defineProperty(this, "readyGate", new util/* default */.c.Gate());
|
|
4703
|
+
store_defineProperty(this, "convoGate", new util/* default */.c.Gate(true));
|
|
4704
|
+
store_defineProperty(this, "reconnectGate", new util/* default */.c.Gate(true));
|
|
4705
|
+
store_defineProperty(this, "wsGate", new util/* default */.c.Gate(true));
|
|
4706
4706
|
store_defineProperty(this, "matchLastview", () => {
|
|
4707
4707
|
let lastView = this.kv.match('lastview') || {};
|
|
4708
4708
|
let user = this.cache.match('user') || {};
|
|
@@ -4713,11 +4713,11 @@ class Store {
|
|
|
4713
4713
|
store_defineProperty(this, "matchIsOpen", () => !!this.kv.match('isopen'));
|
|
4714
4714
|
store_defineProperty(this, "matchHasManuallyClosed", () => !!this.kv.match('hasManuallyClosed'));
|
|
4715
4715
|
store_defineProperty(this, "matchClosePreviewAt", () => this.kv.match('close_preview_at') || 0);
|
|
4716
|
-
store_defineProperty(this, "sendPresence", util/* default */.
|
|
4716
|
+
store_defineProperty(this, "sendPresence", util/* default */.c.throttle(async () => {
|
|
4717
4717
|
if (this._die) return dieErr;
|
|
4718
4718
|
await this.readyGate.entry();
|
|
4719
|
-
if (!util/* default */.
|
|
4720
|
-
if (util/* default */.
|
|
4719
|
+
if (!util/* default */.c.get(this.cache.match('user'), 'id')) return;
|
|
4720
|
+
if (util/* default */.c.isUserBanned(this.cache.match('user'))) return;
|
|
4721
4721
|
let hasfocus = this.browserVisibility === 'visible' && document.hasFocus();
|
|
4722
4722
|
if (!hasfocus) {
|
|
4723
4723
|
this.api.sendLostFocus(this.device, this._currentViewingProduct.id, this._currentViewingProduct.source_id, this._currentViewingProduct.sku);
|
|
@@ -4729,10 +4729,10 @@ class Store {
|
|
|
4729
4729
|
}, 1000, {
|
|
4730
4730
|
leading: false
|
|
4731
4731
|
}));
|
|
4732
|
-
store_defineProperty(this, "now", () => util/* default */.
|
|
4732
|
+
store_defineProperty(this, "now", () => util/* default */.c.Date.now() + this.timeDiff);
|
|
4733
4733
|
store_defineProperty(this, "seenQueue", []);
|
|
4734
4734
|
store_defineProperty(this, "matchTrafficSource", () => this.kv.match('traffic_source'));
|
|
4735
|
-
store_defineProperty(this, "_typing", util/* default */.
|
|
4735
|
+
store_defineProperty(this, "_typing", util/* default */.c.throttle(convoid => this.api.sendTyping(convoid), 3000, {
|
|
4736
4736
|
trailing: false
|
|
4737
4737
|
}));
|
|
4738
4738
|
store_defineProperty(this, "onConvoEvent", (o, cb) => this.pubsub.on2(o, 'events', cb));
|
|
@@ -4751,7 +4751,7 @@ class Store {
|
|
|
4751
4751
|
sendEventToThirdParty('SUBIZ Chat', 'Opened', 'Subiz Windows');
|
|
4752
4752
|
}
|
|
4753
4753
|
});
|
|
4754
|
-
store_defineProperty(this, "closePreview", () => this.kv.put('close_preview_at', new util/* default */.
|
|
4754
|
+
store_defineProperty(this, "closePreview", () => this.kv.put('close_preview_at', new util/* default */.c.Date().getTime()));
|
|
4755
4755
|
store_defineProperty(this, "setLastview", (view, opts) => {
|
|
4756
4756
|
let user = this.cache.match('user') || {};
|
|
4757
4757
|
if (!user.id) return;
|
|
@@ -4786,7 +4786,7 @@ class Store {
|
|
|
4786
4786
|
this.cookie = inmemCookie;
|
|
4787
4787
|
}
|
|
4788
4788
|
cleanLocalStorage();
|
|
4789
|
-
this.pubsub = new util/* default */.
|
|
4789
|
+
this.pubsub = new util/* default */.c.Pubsub();
|
|
4790
4790
|
this.kv = new storage.kv(new storage.lsdb('sbz2023', this.inmem), 'kv');
|
|
4791
4791
|
this.cache = new storage.kv(new storage.lsdb('sbz2023', true), 'kv');
|
|
4792
4792
|
this.chain = new storage.chain(new storage.lsdb('cbz2023', true), 'ch');
|
|
@@ -4794,12 +4794,12 @@ class Store {
|
|
|
4794
4794
|
this.g_haveSentSeenM = {};
|
|
4795
4795
|
window.addEventListener('blur', this.sendPresence);
|
|
4796
4796
|
window.addEventListener('focus', this.sendPresence);
|
|
4797
|
-
this._presenceInterval1 = util/* default */.
|
|
4798
|
-
if (this._die) return util/* default */.
|
|
4797
|
+
this._presenceInterval1 = util/* default */.c.setInterval(() => {
|
|
4798
|
+
if (this._die) return util/* default */.c.clearInterval(this._presenceInterval1);
|
|
4799
4799
|
if (this.browserVisibility === 'visible' && document.hasFocus()) this.sendPresence();
|
|
4800
4800
|
}, 20000);
|
|
4801
|
-
this._presenceInterval2 = util/* default */.
|
|
4802
|
-
if (this._die) return util/* default */.
|
|
4801
|
+
this._presenceInterval2 = util/* default */.c.setInterval(() => {
|
|
4802
|
+
if (this._die) return util/* default */.c.clearInterval(this._presenceInterval2);
|
|
4803
4803
|
if (this.browserVisibility !== 'visible' || document.hasFocus()) this.sendPresence();
|
|
4804
4804
|
}, 60000);
|
|
4805
4805
|
onVisibilityChange(val => {
|
|
@@ -4809,15 +4809,15 @@ class Store {
|
|
|
4809
4809
|
});
|
|
4810
4810
|
this.loopTime();
|
|
4811
4811
|
this.device = this.getDeviceInfo();
|
|
4812
|
-
const _gaInterval = util/* default */.
|
|
4812
|
+
const _gaInterval = util/* default */.c.setInterval(() => {
|
|
4813
4813
|
let user = this.cache.match('user') || {};
|
|
4814
4814
|
if (!user.id) return;
|
|
4815
4815
|
var dev = this.getDeviceInfo();
|
|
4816
4816
|
if (!dev.ga_tracking_ids || !dev.ga_client_id) return;
|
|
4817
|
-
util/* default */.
|
|
4817
|
+
util/* default */.c.clearInterval(_gaInterval);
|
|
4818
4818
|
this.device = dev;
|
|
4819
4819
|
let ga_client_id = dev.ga_client_id;
|
|
4820
|
-
if (ga_client_id !== util/* default */.
|
|
4820
|
+
if (ga_client_id !== util/* default */.c.getUserAttr(user, 'ga_client_id', 'text')) {
|
|
4821
4821
|
this.setUser({
|
|
4822
4822
|
attributes: [{
|
|
4823
4823
|
type: 'text',
|
|
@@ -4844,10 +4844,10 @@ class Store {
|
|
|
4844
4844
|
this._track_page_view = !!val;
|
|
4845
4845
|
}
|
|
4846
4846
|
getLinkedProduct() {
|
|
4847
|
-
return util/* default */.
|
|
4847
|
+
return util/* default */.c.cloneDeep(this._currentViewingProduct);
|
|
4848
4848
|
}
|
|
4849
4849
|
isInsync(key) {
|
|
4850
|
-
return util/* default */.
|
|
4850
|
+
return util/* default */.c.Date.now() - (this.g_sync[key] || 0) < 600000;
|
|
4851
4851
|
}
|
|
4852
4852
|
async fetchShippingAddresses() {
|
|
4853
4853
|
let out = await this.api.fetchShippingAddresses();
|
|
@@ -4864,7 +4864,7 @@ class Store {
|
|
|
4864
4864
|
return this.api.createShippingAddress(addr);
|
|
4865
4865
|
}
|
|
4866
4866
|
async overrideAcc(acc) {
|
|
4867
|
-
this.forceAcc = util/* default */.
|
|
4867
|
+
this.forceAcc = util/* default */.c.cloneDeep(acc);
|
|
4868
4868
|
await this.readyGate.entry();
|
|
4869
4869
|
this.disconnect('account');
|
|
4870
4870
|
this.reconnect();
|
|
@@ -4874,7 +4874,7 @@ class Store {
|
|
|
4874
4874
|
await this.readyGate.entry();
|
|
4875
4875
|
this.disconnect('account');
|
|
4876
4876
|
await this.reconnect();
|
|
4877
|
-
util/* default */.
|
|
4877
|
+
util/* default */.c.setTimeout(this.pubsub.publish('resetCSS'), 10);
|
|
4878
4878
|
}
|
|
4879
4879
|
getDeviceInfo() {
|
|
4880
4880
|
let device = {
|
|
@@ -4920,7 +4920,7 @@ class Store {
|
|
|
4920
4920
|
if (this._die) return dieErr;
|
|
4921
4921
|
if (!Array.isArray(plugins)) throw 'plugins must be be an array';
|
|
4922
4922
|
let pluginM = {};
|
|
4923
|
-
util/* default */.
|
|
4923
|
+
util/* default */.c.map(plugins, function (plugin) {
|
|
4924
4924
|
pluginM[plugin.id] = plugin;
|
|
4925
4925
|
});
|
|
4926
4926
|
this.forcePlugins = pluginM;
|
|
@@ -4928,7 +4928,7 @@ class Store {
|
|
|
4928
4928
|
this.pubsub.publish('resetCSS');
|
|
4929
4929
|
}
|
|
4930
4930
|
markSync(key) {
|
|
4931
|
-
this.g_sync[key] = util/* default */.
|
|
4931
|
+
this.g_sync[key] = util/* default */.c.Date.now();
|
|
4932
4932
|
}
|
|
4933
4933
|
async _touchAcc() {
|
|
4934
4934
|
if (this.isInsync('account')) return;
|
|
@@ -4952,13 +4952,13 @@ class Store {
|
|
|
4952
4952
|
if (mask) {
|
|
4953
4953
|
let parts = mask.split('@');
|
|
4954
4954
|
if (parts[0] != accid) {
|
|
4955
|
-
userRef = util/* default */.
|
|
4955
|
+
userRef = util/* default */.c.randomString(40);
|
|
4956
4956
|
this.new_visitor = true;
|
|
4957
4957
|
}
|
|
4958
4958
|
this.new_visitor = false;
|
|
4959
4959
|
this.cookie.set('__sbmask', mask);
|
|
4960
4960
|
} else {
|
|
4961
|
-
userRef = util/* default */.
|
|
4961
|
+
userRef = util/* default */.c.randomString(40);
|
|
4962
4962
|
this.new_visitor = true;
|
|
4963
4963
|
}
|
|
4964
4964
|
}
|
|
@@ -5020,23 +5020,23 @@ class Store {
|
|
|
5020
5020
|
}
|
|
5021
5021
|
seenLoop() {
|
|
5022
5022
|
this.seenQueue = [];
|
|
5023
|
-
util/* default */.
|
|
5024
|
-
this._seenInterval = util/* default */.
|
|
5025
|
-
if (this._die) return util/* default */.
|
|
5023
|
+
util/* default */.c.clearInterval(this._seenInterval);
|
|
5024
|
+
this._seenInterval = util/* default */.c.setInterval(() => {
|
|
5025
|
+
if (this._die) return util/* default */.c.clearInterval(this._seenInterval);
|
|
5026
5026
|
this.seenQueue = [...new Set(this.seenQueue)];
|
|
5027
5027
|
let user = this.cache.match('user') || {};
|
|
5028
|
-
util/* default */.
|
|
5028
|
+
util/* default */.c.map(this.seenQueue, id => {
|
|
5029
5029
|
var events = this.listEvents(id);
|
|
5030
5030
|
if (!events) return;
|
|
5031
|
-
if (util/* default */.
|
|
5032
|
-
events = util/* default */.
|
|
5033
|
-
var lastmsgsent = events[util/* default */.
|
|
5031
|
+
if (util/* default */.c.size(events) === 0) return;
|
|
5032
|
+
events = util/* default */.c.filter(events, ev => ev.type === 'message_sent');
|
|
5033
|
+
var lastmsgsent = events[util/* default */.c.size(events) - 1];
|
|
5034
5034
|
if (!lastmsgsent) return;
|
|
5035
5035
|
if (this.g_haveSentSeenM[lastmsgsent.id]) return;
|
|
5036
|
-
if (lastmsgsent.id === util/* default */.
|
|
5036
|
+
if (lastmsgsent.id === util/* default */.c.getMsgField(lastmsgsent, 'idempotency')) return;
|
|
5037
5037
|
this.api.markAsSeen(id, lastmsgsent.id);
|
|
5038
5038
|
let convo = this.cache.match('convo_' + id) || {};
|
|
5039
|
-
let mem = util/* default */.
|
|
5039
|
+
let mem = util/* default */.c.find(convo.members, m => m.id === user.id);
|
|
5040
5040
|
if (mem) mem.seen_at = Date.now();
|
|
5041
5041
|
this._setConvo(convo);
|
|
5042
5042
|
this.g_haveSentSeenM[lastmsgsent.id] = true;
|
|
@@ -5056,7 +5056,7 @@ class Store {
|
|
|
5056
5056
|
if (this.isInsync('account')) return this.reconnectGate.open();
|
|
5057
5057
|
this.markSync('account');
|
|
5058
5058
|
let outs = await Promise.all([this.api.getUser(), this.api.getAccountSetting(), this.api.getIsOnline()]);
|
|
5059
|
-
let error = util/* default */.
|
|
5059
|
+
let error = util/* default */.c.find(outs, out => out.error);
|
|
5060
5060
|
if (error) return console.error(error);
|
|
5061
5061
|
let set = Object.assign(outs[1].body, outs[2].body);
|
|
5062
5062
|
set.user = outs[0].body;
|
|
@@ -5065,13 +5065,13 @@ class Store {
|
|
|
5065
5065
|
error = convob.error;
|
|
5066
5066
|
let body = convob.body;
|
|
5067
5067
|
if (!error) {
|
|
5068
|
-
let convos = util/* default */.
|
|
5069
|
-
util/* default */.
|
|
5068
|
+
let convos = util/* default */.c.get(body, 'conversations', []);
|
|
5069
|
+
util/* default */.c.map(this.cache.all(), (value, k) => {
|
|
5070
5070
|
if (k.startsWith('convo_')) {
|
|
5071
|
-
if (this.now() - util/* default */.
|
|
5071
|
+
if (this.now() - util/* default */.c.getMs(util/* default */.c.get(value, 'actived')) > 1209600000) this.cache.del(k);
|
|
5072
5072
|
}
|
|
5073
5073
|
});
|
|
5074
|
-
util/* default */.
|
|
5074
|
+
util/* default */.c.map(convos, convo => this._setConvo(convo));
|
|
5075
5075
|
}
|
|
5076
5076
|
return this.reconnectGate.open();
|
|
5077
5077
|
}
|
|
@@ -5090,13 +5090,13 @@ class Store {
|
|
|
5090
5090
|
}
|
|
5091
5091
|
}
|
|
5092
5092
|
_setUser(user) {
|
|
5093
|
-
user = util/* default */.
|
|
5093
|
+
user = util/* default */.c.cloneDeep(user);
|
|
5094
5094
|
let olduser = this.cache.match('user') || {};
|
|
5095
5095
|
var accid = olduser.account_id || user.account_id;
|
|
5096
5096
|
var id = olduser.id || user.id;
|
|
5097
|
-
util/* default */.
|
|
5097
|
+
util/* default */.c.each(user.attributes, newattr => {
|
|
5098
5098
|
if (!newattr) return;
|
|
5099
|
-
olduser.attributes = util/* default */.
|
|
5099
|
+
olduser.attributes = util/* default */.c.filter(olduser.attributes, oldattr => {
|
|
5100
5100
|
if (!oldattr) return false;
|
|
5101
5101
|
return oldattr.key !== newattr.key;
|
|
5102
5102
|
});
|
|
@@ -5114,7 +5114,7 @@ class Store {
|
|
|
5114
5114
|
return this._setSetting(setting);
|
|
5115
5115
|
}
|
|
5116
5116
|
async _setSetting(setting) {
|
|
5117
|
-
setting = util/* default */.
|
|
5117
|
+
setting = util/* default */.c.cloneDeep(setting) || {};
|
|
5118
5118
|
setting.account = Object.assign({}, setting.account, this.forceAcc);
|
|
5119
5119
|
if (!setting.account.logo_url) {
|
|
5120
5120
|
setting.account.logo_url = 'https://file-subiz.com/fiqpezhkmeyesdscyetk-default_logo.jpg';
|
|
@@ -5130,39 +5130,39 @@ class Store {
|
|
|
5130
5130
|
this.cache.put('account', setting.account);
|
|
5131
5131
|
delete setting.account;
|
|
5132
5132
|
}
|
|
5133
|
-
let location = util/* default */.
|
|
5133
|
+
let location = util/* default */.c.get(setting, 'location', []);
|
|
5134
5134
|
this.cache.put('location', location);
|
|
5135
|
-
let bots = util/* default */.
|
|
5135
|
+
let bots = util/* default */.c.get(setting, 'bots', []);
|
|
5136
5136
|
let botM = {};
|
|
5137
|
-
util/* default */.
|
|
5137
|
+
util/* default */.c.map(bots, bot => {
|
|
5138
5138
|
botM[bot.id] = bot;
|
|
5139
5139
|
});
|
|
5140
5140
|
this.cache.put('bot', botM);
|
|
5141
|
-
let plugins = util/* default */.
|
|
5141
|
+
let plugins = util/* default */.c.get(setting, 'plugins', []);
|
|
5142
5142
|
let pluginM = {};
|
|
5143
|
-
util/* default */.
|
|
5143
|
+
util/* default */.c.map(plugins, plugin => {
|
|
5144
5144
|
if (plugin.type === 'chatbox') {
|
|
5145
|
-
plugin = util/* default */.
|
|
5145
|
+
plugin = util/* default */.c.merge(plugin, this.forceChatbox);
|
|
5146
5146
|
}
|
|
5147
5147
|
pluginM[plugin.id] = plugin;
|
|
5148
5148
|
});
|
|
5149
5149
|
this.cache.put('plugin', pluginM);
|
|
5150
|
-
var agents = util/* default */.
|
|
5151
|
-
if (util/* default */.
|
|
5150
|
+
var agents = util/* default */.c.get(setting, 'agents', []);
|
|
5151
|
+
if (util/* default */.c.size(agents) > 0) {
|
|
5152
5152
|
let agentM = {};
|
|
5153
5153
|
this.api.setAgentId(agents[0].id);
|
|
5154
|
-
util/* default */.
|
|
5154
|
+
util/* default */.c.map(agents, agent => {
|
|
5155
5155
|
agentM[agent.id] = agent;
|
|
5156
5156
|
});
|
|
5157
5157
|
this.cache.put('agent', agentM);
|
|
5158
5158
|
}
|
|
5159
|
-
let pms = util/* default */.
|
|
5159
|
+
let pms = util/* default */.c.get(setting, 'payment_methods', []);
|
|
5160
5160
|
this.cache.put('payment_methods', pms);
|
|
5161
5161
|
this.pubsub.publish('account');
|
|
5162
5162
|
}
|
|
5163
5163
|
async track() {
|
|
5164
5164
|
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 */.
|
|
5165
|
+
let traffic_source = util/* default */.c.get(out, 'body.by.device.source', '');
|
|
5166
5166
|
if (traffic_source) this.kv.put('traffic_source', traffic_source);
|
|
5167
5167
|
}
|
|
5168
5168
|
async onWs(ev) {
|
|
@@ -5174,16 +5174,16 @@ class Store {
|
|
|
5174
5174
|
async _onWs(ev) {
|
|
5175
5175
|
if (this._die) return;
|
|
5176
5176
|
if (!ev || !ev.type) return;
|
|
5177
|
-
ev.created = util/* default */.
|
|
5177
|
+
ev.created = util/* default */.c.getMs(ev.created);
|
|
5178
5178
|
if (ev.type === 'user_info_updated') {
|
|
5179
|
-
let user = util/* default */.
|
|
5180
|
-
let attrs = util/* default */.
|
|
5181
|
-
util/* default */.
|
|
5179
|
+
let user = util/* default */.c.cloneDeep(this.cache.match('user'));
|
|
5180
|
+
let attrs = util/* default */.c.get(ev, 'data.user.attributes') || [];
|
|
5181
|
+
util/* default */.c.map(attrs, attr => util/* default */.c.setUserAttr(user, attr));
|
|
5182
5182
|
this._setUser(user);
|
|
5183
5183
|
return;
|
|
5184
5184
|
}
|
|
5185
5185
|
let user = this.cache.match('user') || {};
|
|
5186
|
-
let cid = util/* default */.
|
|
5186
|
+
let cid = util/* default */.c.convoOfEv(ev);
|
|
5187
5187
|
let convo;
|
|
5188
5188
|
let alreadyFetched = false;
|
|
5189
5189
|
if (cid) {
|
|
@@ -5200,12 +5200,12 @@ class Store {
|
|
|
5200
5200
|
}
|
|
5201
5201
|
}
|
|
5202
5202
|
if (!convo) return;
|
|
5203
|
-
let channel = util/* default */.
|
|
5203
|
+
let channel = util/* default */.c.get(ev, 'touchpoint.channel', '');
|
|
5204
5204
|
if (channel && channel != 'subiz') return;
|
|
5205
5205
|
this.pubsub.publish('events', ev);
|
|
5206
5206
|
if (ev.type === 'conversation_joined') {
|
|
5207
|
-
let members = util/* default */.
|
|
5208
|
-
let me = util/* default */.
|
|
5207
|
+
let members = util/* default */.c.get(ev, 'data.conversation.members', []);
|
|
5208
|
+
let me = util/* default */.c.find(members, m => m.id === this.cache.match('user').id);
|
|
5209
5209
|
if (me) {
|
|
5210
5210
|
await this.chain.reload(cid, (type, anchor, limit) => this.listmessageapi(type, anchor, limit));
|
|
5211
5211
|
this.markSync('events' + cid);
|
|
@@ -5222,13 +5222,13 @@ class Store {
|
|
|
5222
5222
|
}
|
|
5223
5223
|
}
|
|
5224
5224
|
if (ev.type === 'message_sent') {
|
|
5225
|
-
if (util/* default */.
|
|
5225
|
+
if (util/* default */.c.get(ev, 'by.id') !== user.id) {
|
|
5226
5226
|
this.api.markAsReceived(cid, ev.id);
|
|
5227
5227
|
}
|
|
5228
5228
|
}
|
|
5229
|
-
if (util/* default */.
|
|
5229
|
+
if (util/* default */.c.startsWith(ev.type, 'message_') || util/* default */.c.startsWith(ev.type, 'conversation_')) {
|
|
5230
5230
|
this.restConvoEvent(ev);
|
|
5231
|
-
if (ev.type === 'message_sent' && util/* default */.
|
|
5231
|
+
if (ev.type === 'message_sent' && util/* default */.c.get(ev, 'by.id') !== user.id) {
|
|
5232
5232
|
sendEventToThirdParty('SUBIZ Chat', 'Received', 'User');
|
|
5233
5233
|
}
|
|
5234
5234
|
return;
|
|
@@ -5236,36 +5236,36 @@ class Store {
|
|
|
5236
5236
|
}
|
|
5237
5237
|
async restConvoEvent(ev) {
|
|
5238
5238
|
let user = this.cache.match('user');
|
|
5239
|
-
let cid = util/* default */.
|
|
5239
|
+
let cid = util/* default */.c.convoOfEv(ev);
|
|
5240
5240
|
let convo = this.cache.match('convo_' + cid) || {};
|
|
5241
5241
|
if (ev.type === 'conversation_state_updated') {
|
|
5242
|
-
if (!util/* default */.
|
|
5242
|
+
if (!util/* default */.c.get(convo, 'id')) {
|
|
5243
5243
|
let {
|
|
5244
5244
|
body: convo,
|
|
5245
5245
|
error
|
|
5246
5246
|
} = await this.api.getConversation(cid);
|
|
5247
5247
|
if (error) return;
|
|
5248
5248
|
}
|
|
5249
|
-
convo = Object.assign(convo, util/* default */.
|
|
5249
|
+
convo = Object.assign(convo, util/* default */.c.get(ev, 'data.conversation'));
|
|
5250
5250
|
}
|
|
5251
5251
|
if (ev.type === 'message_pong') {
|
|
5252
|
-
var msgid = util/* default */.
|
|
5252
|
+
var msgid = util/* default */.c.get(ev, 'data.message.id');
|
|
5253
5253
|
var oldev = this.chain.match(cid, msgid);
|
|
5254
|
-
if (!util/* default */.
|
|
5255
|
-
var pongs = util/* default */.
|
|
5256
|
-
pongs = pongs.concat(util/* default */.
|
|
5254
|
+
if (!util/* default */.c.get(oldev, 'data.message')) return;
|
|
5255
|
+
var pongs = util/* default */.c.get(oldev, 'data.message.pongs', []);
|
|
5256
|
+
pongs = pongs.concat(util/* default */.c.get(ev, 'data.message.pongs', []));
|
|
5257
5257
|
oldev.data.message.pongs = pongs;
|
|
5258
|
-
util/* default */.
|
|
5258
|
+
util/* default */.c.map(pongs, pong => {
|
|
5259
5259
|
if (pong.member_id == user.id && pong.type === 'seen') {
|
|
5260
|
-
let mem = util/* default */.
|
|
5260
|
+
let mem = util/* default */.c.find(convo.members, mem => mem.id === user.id);
|
|
5261
5261
|
if (mem) mem.seen_at = pong.created;
|
|
5262
5262
|
}
|
|
5263
5263
|
});
|
|
5264
|
-
this.chain.put(cid, oldev.id, util/* default */.
|
|
5264
|
+
this.chain.put(cid, oldev.id, util/* default */.c.getMs(oldev.created), oldev);
|
|
5265
5265
|
}
|
|
5266
5266
|
if (ev.type === 'message_sent') {
|
|
5267
|
-
let idemkey = util/* default */.
|
|
5268
|
-
let found = util/* default */.
|
|
5267
|
+
let idemkey = util/* default */.c.getMsgField(ev, 'idempotency');
|
|
5268
|
+
let found = util/* default */.c.find(this.listEvents(cid), oldev => oldev.id === idemkey);
|
|
5269
5269
|
if (found) {
|
|
5270
5270
|
this.chain.del(cid, found.id);
|
|
5271
5271
|
ev.created = found.created;
|
|
@@ -5273,7 +5273,7 @@ class Store {
|
|
|
5273
5273
|
convo.last_message_sent = ev;
|
|
5274
5274
|
}
|
|
5275
5275
|
if (ev.type !== 'message_pong' && ev.type !== 'conversation_typing') {
|
|
5276
|
-
this.chain.put(cid, ev.id, util/* default */.
|
|
5276
|
+
this.chain.put(cid, ev.id, util/* default */.c.getMs(ev.created), ev);
|
|
5277
5277
|
}
|
|
5278
5278
|
this._setConvo(convo);
|
|
5279
5279
|
this.pubsub.publish('account');
|
|
@@ -5281,31 +5281,31 @@ class Store {
|
|
|
5281
5281
|
handleFormSubmit(convoKey, ev) {
|
|
5282
5282
|
if (ev.type !== 'message_sent') return;
|
|
5283
5283
|
let formSubmits = [];
|
|
5284
|
-
let attachments = util/* default */.
|
|
5285
|
-
util/* default */.
|
|
5284
|
+
let attachments = util/* default */.c.get(ev, 'data.message.attachments') || [];
|
|
5285
|
+
util/* default */.c.each(attachments, att => {
|
|
5286
5286
|
if (!att) return;
|
|
5287
5287
|
if (att.type !== 'form_submit') return;
|
|
5288
5288
|
formSubmits.push(att.form_submit);
|
|
5289
5289
|
});
|
|
5290
|
-
util/* default */.
|
|
5291
|
-
let formev = util/* default */.
|
|
5290
|
+
util/* default */.c.each(formSubmits, submit => {
|
|
5291
|
+
let formev = util/* default */.c.get(this.convoEventM, convoKey + '.' + submit.form_message_id);
|
|
5292
5292
|
if (!formev) return;
|
|
5293
|
-
let forms = util/* default */.
|
|
5293
|
+
let forms = util/* default */.c.filter(util/* default */.c.get(formev, 'data.message.attachments'), att => {
|
|
5294
5294
|
if (!att) return false;
|
|
5295
5295
|
if (att.type !== 'form' && att.type !== 'ask_info_form') return false;
|
|
5296
5296
|
return true;
|
|
5297
5297
|
});
|
|
5298
|
-
util/* default */.
|
|
5298
|
+
util/* default */.c.each(forms, form => {
|
|
5299
5299
|
form = form.form;
|
|
5300
|
-
util/* default */.
|
|
5301
|
-
util/* default */.
|
|
5300
|
+
util/* default */.c.each(form.fields, formfield => {
|
|
5301
|
+
util/* default */.c.each(submit.fields, submitfield => {
|
|
5302
5302
|
if (formfield.name !== submitfield.name) return;
|
|
5303
5303
|
if (formfield.default_answer) return;
|
|
5304
5304
|
formfield.default_answer = submitfield.value;
|
|
5305
5305
|
});
|
|
5306
5306
|
});
|
|
5307
5307
|
});
|
|
5308
|
-
if (util/* default */.
|
|
5308
|
+
if (util/* default */.c.size(forms) > 0) this.pubsub.publish('state.convoEventM', this.convoEventM, convoKey);
|
|
5309
5309
|
});
|
|
5310
5310
|
}
|
|
5311
5311
|
typing(cid) {
|
|
@@ -5340,7 +5340,7 @@ class Store {
|
|
|
5340
5340
|
}
|
|
5341
5341
|
async sendConvoEvent(cid, type, data) {
|
|
5342
5342
|
await this.readyGate.entry();
|
|
5343
|
-
var idempotency = util/* default */.
|
|
5343
|
+
var idempotency = util/* default */.c.randomString(36);
|
|
5344
5344
|
let user = this.cache.match('user') || {};
|
|
5345
5345
|
var event = {
|
|
5346
5346
|
id: idempotency,
|
|
@@ -5353,10 +5353,10 @@ class Store {
|
|
|
5353
5353
|
type,
|
|
5354
5354
|
created: this.now()
|
|
5355
5355
|
};
|
|
5356
|
-
util/* default */.
|
|
5356
|
+
util/* default */.c.convoToEv(cid, event);
|
|
5357
5357
|
let files = [];
|
|
5358
5358
|
if (type === 'message_sent') {
|
|
5359
|
-
util/* default */.
|
|
5359
|
+
util/* default */.c.setMsgField(event, 'idempotency', idempotency);
|
|
5360
5360
|
event.data.message.conversation_id = cid;
|
|
5361
5361
|
await flow.map(event.data.message.attachments, 2, async (att, i) => {
|
|
5362
5362
|
if (att.type !== 'file') return;
|
|
@@ -5382,7 +5382,7 @@ class Store {
|
|
|
5382
5382
|
url,
|
|
5383
5383
|
error
|
|
5384
5384
|
} = await this.api.uploadToS3(att._file);
|
|
5385
|
-
if (util/* default */.
|
|
5385
|
+
if (util/* default */.c.get(body, 'code') == 'invalid_field_size') {
|
|
5386
5386
|
event._error_message = 'cannot_send_too_big_file';
|
|
5387
5387
|
}
|
|
5388
5388
|
event._error = error;
|
|
@@ -5410,23 +5410,23 @@ class Store {
|
|
|
5410
5410
|
first_interaction: 1
|
|
5411
5411
|
});
|
|
5412
5412
|
}
|
|
5413
|
-
this.kv.put('last_msg_sent', util/* default */.
|
|
5413
|
+
this.kv.put('last_msg_sent', util/* default */.c.Date.now());
|
|
5414
5414
|
return ret;
|
|
5415
5415
|
}
|
|
5416
5416
|
_setConvo(convo) {
|
|
5417
5417
|
let count = 0;
|
|
5418
5418
|
let user = this.cache.match('user');
|
|
5419
|
-
let channel = util/* default */.
|
|
5419
|
+
let channel = util/* default */.c.get(convo, 'touchpoint.channel', '');
|
|
5420
5420
|
if (channel && channel != 'subiz') return;
|
|
5421
5421
|
let allconvo = {};
|
|
5422
|
-
util/* default */.
|
|
5422
|
+
util/* default */.c.map(this.cache.all(), (value, key) => {
|
|
5423
5423
|
if (key.startsWith('convo_')) {
|
|
5424
5424
|
allconvo[key] = value;
|
|
5425
5425
|
}
|
|
5426
5426
|
});
|
|
5427
|
-
if (util/* default */.
|
|
5428
|
-
allconvo = util/* default */.
|
|
5429
|
-
for (var i = MAX_CONVO - 2; i < util/* default */.
|
|
5427
|
+
if (util/* default */.c.size(allconvo) > MAX_CONVO - 2) {
|
|
5428
|
+
allconvo = util/* default */.c.orderBy(util/* default */.c.map(allconvo), 'created', 'desc');
|
|
5429
|
+
for (var i = MAX_CONVO - 2; i < util/* default */.c.size(allconvo); i++) {
|
|
5430
5430
|
let convo = allconvo[i];
|
|
5431
5431
|
this.cache.del('convo_' + convo.id);
|
|
5432
5432
|
}
|
|
@@ -5482,7 +5482,7 @@ class Store {
|
|
|
5482
5482
|
account_id: user.account_id,
|
|
5483
5483
|
web_plugin_id: id,
|
|
5484
5484
|
campaign_id: id,
|
|
5485
|
-
user_id: util/* default */.
|
|
5485
|
+
user_id: util/* default */.c.get(user, 'id'),
|
|
5486
5486
|
url: window.location.href,
|
|
5487
5487
|
device: this.device,
|
|
5488
5488
|
submission,
|
|
@@ -5501,9 +5501,9 @@ class Store {
|
|
|
5501
5501
|
error
|
|
5502
5502
|
} = await this.api.listMessages(convoid, -limit, anchor);
|
|
5503
5503
|
if (error || code !== 200) return [[], anchor, error];
|
|
5504
|
-
anchor = util/* default */.
|
|
5505
|
-
events = util/* default */.
|
|
5506
|
-
event.created = util/* default */.
|
|
5504
|
+
anchor = util/* default */.c.get(util/* default */.c.last(events), 'id');
|
|
5505
|
+
events = util/* default */.c.map(events, event => {
|
|
5506
|
+
event.created = util/* default */.c.getMs(event.created);
|
|
5507
5507
|
return {
|
|
5508
5508
|
id: event.id,
|
|
5509
5509
|
index: event.created,
|
|
@@ -5514,8 +5514,8 @@ class Store {
|
|
|
5514
5514
|
for (let i = 0; i < events.length; i++) {
|
|
5515
5515
|
let ev = events[i].value;
|
|
5516
5516
|
if (ev.type !== 'message_sent') continue;
|
|
5517
|
-
if (util/* default */.
|
|
5518
|
-
let pongbyme = util/* default */.
|
|
5517
|
+
if (util/* default */.c.get(ev, 'by.id') === user.id) continue;
|
|
5518
|
+
let pongbyme = util/* default */.c.find(util/* default */.c.get(ev, 'data.message.pongs'), p => p.member_id === user.id);
|
|
5519
5519
|
if (pongbyme) break;
|
|
5520
5520
|
this.api.markAsReceived(convoid, ev.id);
|
|
5521
5521
|
break;
|
|
@@ -5524,25 +5524,25 @@ class Store {
|
|
|
5524
5524
|
}
|
|
5525
5525
|
async loopTime() {
|
|
5526
5526
|
if (this._die) return;
|
|
5527
|
-
let startms = util/* default */.
|
|
5528
|
-
if (!util/* default */.
|
|
5527
|
+
let startms = util/* default */.c.Date.now();
|
|
5528
|
+
if (!util/* default */.c.get(this.cache.match('user'), 'id')) return util/* default */.c.setTimeout(() => this.loopTime(), 240000);
|
|
5529
5529
|
let {
|
|
5530
5530
|
body: t,
|
|
5531
5531
|
error
|
|
5532
5532
|
} = 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 */.
|
|
5533
|
+
if (error) return util/* default */.c.setTimeout(() => this.loopTime(), 30000);
|
|
5534
|
+
var latences = Math.abs(util/* default */.c.Date.now() - startms) / 2;
|
|
5535
|
+
var serverMs = new util/* default */.c.Date(t).getTime() + latences;
|
|
5536
|
+
var localMs = util/* default */.c.Date.now();
|
|
5537
5537
|
this.timeDiff = Math.floor(serverMs - localMs);
|
|
5538
|
-
util/* default */.
|
|
5538
|
+
util/* default */.c.setTimeout(() => this.loopTime(), 240000);
|
|
5539
5539
|
}
|
|
5540
5540
|
replaceFileUrl(src) {
|
|
5541
5541
|
if (!src) return '';
|
|
5542
|
-
if (util/* default */.
|
|
5543
|
-
if (util/* default */.
|
|
5544
|
-
if (!util/* default */.
|
|
5545
|
-
src = util/* default */.
|
|
5542
|
+
if (util/* default */.c.startsWith(src, '/')) return src;
|
|
5543
|
+
if (util/* default */.c.startsWith(src, 'data:')) return src;
|
|
5544
|
+
if (!util/* default */.c.startsWith(src, 'http://') && !util/* default */.c.startsWith(src, 'https://') && !util/* default */.c.startsWith(src, '//')) {
|
|
5545
|
+
src = util/* default */.c.trim(this.FileURL, '/') + '/' + util/* default */.c.trimStart(src, '/');
|
|
5546
5546
|
}
|
|
5547
5547
|
src = src.replace('https://file-subiz.com/', this.FileURL);
|
|
5548
5548
|
src = src.replace('http://file-subiz.com/', this.FileURL);
|
|
@@ -5559,7 +5559,7 @@ class Store {
|
|
|
5559
5559
|
return src;
|
|
5560
5560
|
}
|
|
5561
5561
|
clearBrowserData() {
|
|
5562
|
-
util/* default */.
|
|
5562
|
+
util/* default */.c.each(this.cookie.all(), (v, k) => {
|
|
5563
5563
|
if ((k || '').startsWith('__sb')) this.cookie.remove(k);
|
|
5564
5564
|
});
|
|
5565
5565
|
this.kv.destroy();
|
|
@@ -5571,7 +5571,7 @@ class Store {
|
|
|
5571
5571
|
this._die = true;
|
|
5572
5572
|
if (this.kv) this.kv.destroy();
|
|
5573
5573
|
if (this.chain) this.chain.destroy();
|
|
5574
|
-
util/* default */.
|
|
5574
|
+
util/* default */.c.clearInterval(this._seenInterval);
|
|
5575
5575
|
if (this.realtime) this.realtime.stop();
|
|
5576
5576
|
this.readyGate.close();
|
|
5577
5577
|
window.removeEventListener('blur', this.sendPresence);
|
|
@@ -5702,7 +5702,7 @@ let cleanLocalStorage = () => {
|
|
|
5702
5702
|
} catch (e) {
|
|
5703
5703
|
return;
|
|
5704
5704
|
}
|
|
5705
|
-
util/* default */.
|
|
5705
|
+
util/* default */.c.setTimeout(() => {
|
|
5706
5706
|
for (var key in localStorage) {
|
|
5707
5707
|
if (key && (key.startsWith('cbz2020') || key.startsWith('sbz2020'))) {
|
|
5708
5708
|
localStorage.removeItem(key);
|
|
@@ -5716,7 +5716,7 @@ let cleanMyLocalStorage = () => {
|
|
|
5716
5716
|
} catch (e) {
|
|
5717
5717
|
return;
|
|
5718
5718
|
}
|
|
5719
|
-
util/* default */.
|
|
5719
|
+
util/* default */.c.setTimeout(() => {
|
|
5720
5720
|
for (var key in localStorage) {
|
|
5721
5721
|
if (key && (key.startsWith('cbz2020') || key.startsWith('sbz2020') || key.startsWith('sbz2022') || key.startsWith('sbz2023'))) {
|
|
5722
5722
|
localStorage.removeItem(key);
|
|
@@ -5734,8 +5734,8 @@ function dofetch(method, url, body, cb) {
|
|
|
5734
5734
|
}).then(res => res.text().then(text => cb && cb(text, res.status))).catch(err => cb && cb(err, -1));
|
|
5735
5735
|
}
|
|
5736
5736
|
var xhrsend = function (method, url, body, cb) {
|
|
5737
|
-
if (typeof util/* default */.
|
|
5738
|
-
var request = new util/* default */.
|
|
5737
|
+
if (typeof util/* default */.c.XMLHttpRequest === 'undefined') return dofetch(method, url, body, cb);
|
|
5738
|
+
var request = new util/* default */.c.XMLHttpRequest();
|
|
5739
5739
|
request.onreadystatechange = function (e) {
|
|
5740
5740
|
if (request.readyState !== 4) return;
|
|
5741
5741
|
cb && cb(request.responseText, request.status);
|
|
@@ -5751,17 +5751,17 @@ var xhrsend = function (method, url, body, cb) {
|
|
|
5751
5751
|
};
|
|
5752
5752
|
const dieErr = new Error('sdk unloaded');
|
|
5753
5753
|
// EXTERNAL MODULE: ./src/common.js
|
|
5754
|
-
var common = __webpack_require__(
|
|
5754
|
+
var common = __webpack_require__(6304);
|
|
5755
5755
|
// EXTERNAL MODULE: ./node_modules/preact/dist/preact.module.js
|
|
5756
|
-
var preact_module = __webpack_require__(
|
|
5756
|
+
var preact_module = __webpack_require__(4284);
|
|
5757
5757
|
;// CONCATENATED MODULE: ./src/plugin.js
|
|
5758
5758
|
|
|
5759
5759
|
|
|
5760
5760
|
|
|
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() */
|
|
5761
|
+
const LoadChatbox = () => __webpack_require__.e(/* import() */ 928).then(__webpack_require__.bind(__webpack_require__, 3928));
|
|
5762
|
+
const LoadContact = () => __webpack_require__.e(/* import() */ 508).then(__webpack_require__.bind(__webpack_require__, 7508));
|
|
5763
|
+
const LoadPopup = () => __webpack_require__.e(/* import() */ 792).then(__webpack_require__.bind(__webpack_require__, 9792));
|
|
5764
|
+
const LoadNotif = () => __webpack_require__.e(/* import() */ 104).then(__webpack_require__.bind(__webpack_require__, 3104));
|
|
5765
5765
|
function Plugin(plugin, store, $container, lib) {
|
|
5766
5766
|
if (!$container) throw '$div must is a valid html node';
|
|
5767
5767
|
var $div = document.createElement('div');
|
|
@@ -5770,8 +5770,8 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5770
5770
|
$div.setAttribute('sbz-plugin-type', plugin.type);
|
|
5771
5771
|
$div.setAttribute('sbz-plugin-account-id', acc.id);
|
|
5772
5772
|
$container.appendChild($div);
|
|
5773
|
-
let _locale = common/* getLocale */.
|
|
5774
|
-
var domGate = new util/* default */.
|
|
5773
|
+
let _locale = common/* getLocale */.a8(plugin, util/* default */.c.detectLang());
|
|
5774
|
+
var domGate = new util/* default */.c.Gate();
|
|
5775
5775
|
var pageIndex = 0;
|
|
5776
5776
|
var highlight;
|
|
5777
5777
|
var state = 'hold';
|
|
@@ -5784,19 +5784,19 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5784
5784
|
let lastrun = store.matchLastPluginRun(plugin.id);
|
|
5785
5785
|
if (plugin.type === 'chatbox' || plugin.type === 'notification') lastrun = undefined;
|
|
5786
5786
|
if (!plugin.enabled) return;
|
|
5787
|
-
let match = util/* default */.
|
|
5787
|
+
let match = util/* default */.c.checkRunConditions(plugin.initiative_frequency, plugin.conditions, lastrun, store);
|
|
5788
5788
|
if (!match) return;
|
|
5789
5789
|
state = 'running';
|
|
5790
5790
|
await _this.update(plugin);
|
|
5791
5791
|
};
|
|
5792
5792
|
this.forceRunPopup = async () => {
|
|
5793
|
-
if (util/* default */.
|
|
5793
|
+
if (util/* default */.c.get(_ref, 'current')) {
|
|
5794
5794
|
_ref.current.openPopup();
|
|
5795
5795
|
} else {
|
|
5796
5796
|
_render();
|
|
5797
5797
|
}
|
|
5798
5798
|
};
|
|
5799
|
-
var _ref = (0,preact_module/* createRef */.
|
|
5799
|
+
var _ref = (0,preact_module/* createRef */.Yn)();
|
|
5800
5800
|
let Chatbox = null;
|
|
5801
5801
|
let Popup = null;
|
|
5802
5802
|
let Contact = null;
|
|
@@ -5811,7 +5811,7 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5811
5811
|
if (!$div) return;
|
|
5812
5812
|
if (plugin.type === 'chatbox') {
|
|
5813
5813
|
if (!Chatbox) Chatbox = (await LoadChatbox()).default;
|
|
5814
|
-
(0,preact_module/* render */.
|
|
5814
|
+
(0,preact_module/* render */.ai)((0,preact_module.h)(Chatbox, {
|
|
5815
5815
|
destroy: _destroy,
|
|
5816
5816
|
plugin: plugin,
|
|
5817
5817
|
store: store,
|
|
@@ -5821,7 +5821,7 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5821
5821
|
}
|
|
5822
5822
|
if (plugin.type === 'popup') {
|
|
5823
5823
|
if (!Popup) Popup = (await LoadPopup()).default;
|
|
5824
|
-
(0,preact_module/* render */.
|
|
5824
|
+
(0,preact_module/* render */.ai)((0,preact_module.h)(Popup, {
|
|
5825
5825
|
destroy: _destroy,
|
|
5826
5826
|
t: this.t,
|
|
5827
5827
|
highlight: highlight,
|
|
@@ -5836,7 +5836,7 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5836
5836
|
}
|
|
5837
5837
|
if (plugin.type === 'notification') {
|
|
5838
5838
|
if (!Notif) Notif = (await LoadNotif()).default;
|
|
5839
|
-
(0,preact_module/* render */.
|
|
5839
|
+
(0,preact_module/* render */.ai)((0,preact_module.h)(Notif, {
|
|
5840
5840
|
destroy: _destroy,
|
|
5841
5841
|
t: this.t,
|
|
5842
5842
|
mobile: store.isMobile(),
|
|
@@ -5847,7 +5847,7 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5847
5847
|
}
|
|
5848
5848
|
if (plugin.type === 'contact') {
|
|
5849
5849
|
if (!Contact) Contact = (await LoadContact()).default;
|
|
5850
|
-
(0,preact_module/* render */.
|
|
5850
|
+
(0,preact_module/* render */.ai)((0,preact_module.h)(Contact, {
|
|
5851
5851
|
destroy: _destroy,
|
|
5852
5852
|
t: this.t,
|
|
5853
5853
|
plugin: plugin,
|
|
@@ -5861,7 +5861,7 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5861
5861
|
var _destroy = false;
|
|
5862
5862
|
this.destroy = () => {
|
|
5863
5863
|
_destroy = true;
|
|
5864
|
-
(0,preact_module/* render */.
|
|
5864
|
+
(0,preact_module/* render */.ai)(null, $div);
|
|
5865
5865
|
$div.parentNode.removeChild($div);
|
|
5866
5866
|
};
|
|
5867
5867
|
this.highlight = comref => {
|
|
@@ -5877,9 +5877,9 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5877
5877
|
};
|
|
5878
5878
|
let t = key => {
|
|
5879
5879
|
if (_locale === 'debug') return `{{${key}}}`;
|
|
5880
|
-
let messages = util/* default */.
|
|
5881
|
-
let message = util/* default */.
|
|
5882
|
-
return util/* default */.
|
|
5880
|
+
let messages = util/* default */.c.get(common/* langMessages */.Ml, _locale, []);
|
|
5881
|
+
let message = util/* default */.c.find(messages, message => message.key === key);
|
|
5882
|
+
return util/* default */.c.get(message, 'message', key);
|
|
5883
5883
|
};
|
|
5884
5884
|
t.i18n = i18nText => {
|
|
5885
5885
|
if (!i18nText) return '';
|
|
@@ -5890,46 +5890,46 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5890
5890
|
};
|
|
5891
5891
|
t.locale = () => _locale;
|
|
5892
5892
|
this.forceDownloadLanguage = async () => {
|
|
5893
|
-
await common/* downloadLanguage */.
|
|
5893
|
+
await common/* downloadLanguage */.Qj(store, _locale, true);
|
|
5894
5894
|
this.update(plugin);
|
|
5895
5895
|
};
|
|
5896
5896
|
this.setLocale = async locale => {
|
|
5897
5897
|
if (_locale === locale) return locale;
|
|
5898
5898
|
this.t = null;
|
|
5899
5899
|
_render();
|
|
5900
|
-
_locale = common/* getLocale */.
|
|
5901
|
-
await common/* downloadLanguage */.
|
|
5900
|
+
_locale = common/* getLocale */.a8(plugin, locale);
|
|
5901
|
+
await common/* downloadLanguage */.Qj(store, _locale);
|
|
5902
5902
|
this.t = t;
|
|
5903
5903
|
_render();
|
|
5904
5904
|
return _locale;
|
|
5905
5905
|
};
|
|
5906
5906
|
let images = {};
|
|
5907
|
-
util/* default */.
|
|
5907
|
+
util/* default */.c.map(util/* default */.c.get(plugin, 'popup.pages'), page => {
|
|
5908
5908
|
if (!page) return;
|
|
5909
|
-
util/* default */.
|
|
5909
|
+
util/* default */.c.map(page.components, com => {
|
|
5910
5910
|
if (com.type === 'image' && com.image && com.image.url && com.image.url.startsWith('http')) {
|
|
5911
5911
|
images[com.image.url] = true;
|
|
5912
5912
|
}
|
|
5913
5913
|
});
|
|
5914
5914
|
});
|
|
5915
|
-
if (util/* default */.
|
|
5916
|
-
let triggers = util/* default */.
|
|
5915
|
+
if (util/* default */.c.size(images) >= 0) util/* default */.c.map(images, (_, image) => util/* default */.c.preloadImg(image));
|
|
5916
|
+
let triggers = util/* default */.c.get(plugin, 'triggers') || [{
|
|
5917
5917
|
type: 'after_pageview',
|
|
5918
5918
|
after_pageview_sec: 0,
|
|
5919
5919
|
disabled: false
|
|
5920
5920
|
}];
|
|
5921
|
-
for (var i = 0; i < util/* default */.
|
|
5921
|
+
for (var i = 0; i < util/* default */.c.size(triggers); i++) {
|
|
5922
5922
|
var tr = triggers[i];
|
|
5923
5923
|
if (!tr) continue;
|
|
5924
5924
|
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 */.
|
|
5925
|
+
if (tr.type === 'exit_intent') util/* default */.c.trackExitIntent(run);
|
|
5926
|
+
if (tr.type === 'area_clicked') util/* default */.c.trackAreaClicked(tr.area_clicked_css_selector, run);
|
|
5927
|
+
if (tr.type === 'scrolling_percentage') util/* default */.c.trackScrollingPercentage(tr.scrolling_percentage, run);
|
|
5928
|
+
if (tr.type === 'inactivity_duration') util/* default */.c.trackInactivity(tr.inactivity_sec, run);
|
|
5929
|
+
if (tr.type === 'after_pageview') util/* default */.c.trackTimeOnPage(tr.after_pageview_sec, run);
|
|
5930
5930
|
}
|
|
5931
5931
|
this.update(plugin);
|
|
5932
|
-
common/* downloadLanguage */.
|
|
5932
|
+
common/* downloadLanguage */.Qj(store, _locale).then(() => {
|
|
5933
5933
|
this.t = t;
|
|
5934
5934
|
this.update(plugin);
|
|
5935
5935
|
});
|
|
@@ -5954,7 +5954,7 @@ class PluginMgr {
|
|
|
5954
5954
|
if (this._destroy) return;
|
|
5955
5955
|
let pluginM = this.lib.store.matchPlugin();
|
|
5956
5956
|
let foundchatbox = false;
|
|
5957
|
-
util/* default */.
|
|
5957
|
+
util/* default */.c.each(pluginM, conf => {
|
|
5958
5958
|
if (conf.type === 'chatbox') {
|
|
5959
5959
|
if (foundchatbox) return;
|
|
5960
5960
|
foundchatbox = true;
|
|
@@ -5965,7 +5965,7 @@ class PluginMgr {
|
|
|
5965
5965
|
}
|
|
5966
5966
|
this.pluginM[conf.id].update(conf);
|
|
5967
5967
|
});
|
|
5968
|
-
util/* default */.
|
|
5968
|
+
util/* default */.c.each(this.pluginM, (conf, id) => {
|
|
5969
5969
|
if (pluginM[id]) return;
|
|
5970
5970
|
this.pluginM[id].destroy();
|
|
5971
5971
|
delete this.pluginM[id];
|
|
@@ -5973,7 +5973,7 @@ class PluginMgr {
|
|
|
5973
5973
|
});
|
|
5974
5974
|
let pluginM = this.lib.store.matchPlugin();
|
|
5975
5975
|
let foundchatbox = false;
|
|
5976
|
-
util/* default */.
|
|
5976
|
+
util/* default */.c.each(pluginM, conf => {
|
|
5977
5977
|
if (conf.type === 'chatbox') {
|
|
5978
5978
|
if (foundchatbox) return;
|
|
5979
5979
|
foundchatbox = true;
|
|
@@ -5983,12 +5983,12 @@ class PluginMgr {
|
|
|
5983
5983
|
}
|
|
5984
5984
|
findChatbox() {
|
|
5985
5985
|
var pluginM = this.lib.store.matchPlugin();
|
|
5986
|
-
let chatboxs = util/* default */.
|
|
5987
|
-
if (util/* default */.
|
|
5986
|
+
let chatboxs = util/* default */.c.filter(this.pluginM, (plugin, id) => pluginM[id].type === 'chatbox');
|
|
5987
|
+
if (util/* default */.c.size(chatboxs) === 0) {
|
|
5988
5988
|
console.error('no chatbox found.');
|
|
5989
5989
|
return;
|
|
5990
5990
|
}
|
|
5991
|
-
let chatbox = util/* default */.
|
|
5991
|
+
let chatbox = util/* default */.c.find(chatboxs, chatbox => chatbox.getState() === 'running');
|
|
5992
5992
|
if (!chatbox) {
|
|
5993
5993
|
chatbox = chatboxs[0];
|
|
5994
5994
|
}
|
|
@@ -6044,7 +6044,7 @@ class PluginMgr {
|
|
|
6044
6044
|
chatbox.setLocale(locale);
|
|
6045
6045
|
}
|
|
6046
6046
|
destroy() {
|
|
6047
|
-
util/* default */.
|
|
6047
|
+
util/* default */.c.map(this.pluginM, (conf, id) => {
|
|
6048
6048
|
conf.destroy();
|
|
6049
6049
|
delete this.pluginM[id];
|
|
6050
6050
|
});
|
|
@@ -6062,25 +6062,25 @@ var $link = document.createElement('link');
|
|
|
6062
6062
|
$link.href = 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap';
|
|
6063
6063
|
$link.rel = 'stylesheet';
|
|
6064
6064
|
document.head.append($link);
|
|
6065
|
-
util/* default */.
|
|
6065
|
+
util/* default */.c.preloadWebfonts(['Inter'], [400, 500, 600]);
|
|
6066
6066
|
class Widget {
|
|
6067
6067
|
constructor(ApiURL, FileURL, RealtimeURL, inmem, fake) {
|
|
6068
6068
|
lib_defineProperty(this, "version", () => '4.5');
|
|
6069
6069
|
lib_defineProperty(this, "setSetting", setting => this.store.setSetting({
|
|
6070
6070
|
account_setting: setting
|
|
6071
6071
|
}));
|
|
6072
|
-
lib_defineProperty(this, "getUser", () => util/* default */.
|
|
6072
|
+
lib_defineProperty(this, "getUser", () => util/* default */.c.parseJSON(util/* default */.c.stringify(this.store.matchUser())));
|
|
6073
6073
|
lib_defineProperty(this, "setViewingProduct", p => this.store.linkProduct(p));
|
|
6074
6074
|
lib_defineProperty(this, "getViewingProduct", () => this.store.getLinkedProduct());
|
|
6075
6075
|
lib_defineProperty(this, "track", () => this.store.track());
|
|
6076
6076
|
this.impressionTokens = {};
|
|
6077
|
-
this.domGate = new util/* default */.
|
|
6077
|
+
this.domGate = new util/* default */.c.Gate();
|
|
6078
6078
|
this.store = new Store(ApiURL, FileURL, RealtimeURL, inmem, fake);
|
|
6079
6079
|
window.sbz_store = this.store;
|
|
6080
6080
|
this.subs = [];
|
|
6081
6081
|
this.store.onConvoEvent({
|
|
6082
6082
|
_isMounted: true
|
|
6083
|
-
}, ev => util/* default */.
|
|
6083
|
+
}, ev => util/* default */.c.map(this.subs, sub => sub(ev)));
|
|
6084
6084
|
}
|
|
6085
6085
|
async waitReady(cb) {
|
|
6086
6086
|
await this.store.readyGate.entry();
|
|
@@ -6097,10 +6097,10 @@ class Widget {
|
|
|
6097
6097
|
let user = await this.store.login(accid, user_id, tokenGenerator);
|
|
6098
6098
|
if (!$container) $container = document.body;
|
|
6099
6099
|
this.pluginMgr = new PluginMgr(this, $container);
|
|
6100
|
-
let clean = util/* default */.
|
|
6100
|
+
let clean = util/* default */.c.setInterval(() => {
|
|
6101
6101
|
if ($container && $container.isConnected) return;
|
|
6102
6102
|
this.pluginMgr.destroy();
|
|
6103
|
-
util/* default */.
|
|
6103
|
+
util/* default */.c.clearInterval(clean);
|
|
6104
6104
|
}, 1000);
|
|
6105
6105
|
this.domGate.open();
|
|
6106
6106
|
return user;
|
|
@@ -6113,32 +6113,32 @@ class Widget {
|
|
|
6113
6113
|
let accid = param.account_id;
|
|
6114
6114
|
let ref = param.ref;
|
|
6115
6115
|
let user = await this.store.init(accid, undefined, ref);
|
|
6116
|
-
util/* default */.
|
|
6116
|
+
util/* default */.c.setTimeout(() => window.postMessage({
|
|
6117
6117
|
type: 'widget_loaded',
|
|
6118
6118
|
account_id: accid
|
|
6119
6119
|
}, '*'), 0);
|
|
6120
6120
|
if (!$container) $container = document.body || document;
|
|
6121
6121
|
this.pluginMgr = new PluginMgr(this, $container);
|
|
6122
|
-
let clean = util/* default */.
|
|
6122
|
+
let clean = util/* default */.c.setInterval(() => {
|
|
6123
6123
|
if ($container && $container.isConnected) return;
|
|
6124
6124
|
this.pluginMgr.destroy();
|
|
6125
|
-
util/* default */.
|
|
6125
|
+
util/* default */.c.clearInterval(clean);
|
|
6126
6126
|
}, 1000);
|
|
6127
6127
|
this.domGate.open();
|
|
6128
6128
|
return user;
|
|
6129
6129
|
}
|
|
6130
6130
|
async setAccount(id, $container, mask, cb) {
|
|
6131
6131
|
let outmask = await this.store.init(id, mask);
|
|
6132
|
-
util/* default */.
|
|
6132
|
+
util/* default */.c.setTimeout(() => window.postMessage({
|
|
6133
6133
|
type: 'widget_loaded',
|
|
6134
6134
|
account_id: id
|
|
6135
6135
|
}, '*'), 0);
|
|
6136
6136
|
if (!$container) $container = document.body || document;
|
|
6137
6137
|
this.pluginMgr = new PluginMgr(this, $container);
|
|
6138
|
-
let clean = util/* default */.
|
|
6138
|
+
let clean = util/* default */.c.setInterval(() => {
|
|
6139
6139
|
if ($container && $container.isConnected) return;
|
|
6140
6140
|
this.pluginMgr.destroy();
|
|
6141
|
-
util/* default */.
|
|
6141
|
+
util/* default */.c.clearInterval(clean);
|
|
6142
6142
|
}, 1000);
|
|
6143
6143
|
this.domGate.open();
|
|
6144
6144
|
cb && cb(outmask);
|
|
@@ -6152,12 +6152,12 @@ class Widget {
|
|
|
6152
6152
|
attributes
|
|
6153
6153
|
});
|
|
6154
6154
|
var user = this.store.matchUser();
|
|
6155
|
-
return util/* default */.
|
|
6155
|
+
return util/* default */.c.cloneDeep(user.attributes);
|
|
6156
6156
|
}
|
|
6157
6157
|
async getUserAttributes() {
|
|
6158
6158
|
await this.store.readyGate.entry();
|
|
6159
6159
|
var user = this.store.matchUser();
|
|
6160
|
-
return util/* default */.
|
|
6160
|
+
return util/* default */.c.cloneDeep(util/* default */.c.get(user, 'attributes', []));
|
|
6161
6161
|
}
|
|
6162
6162
|
async getWidgetCurrentView() {
|
|
6163
6163
|
await this.domGate.entry();
|
|
@@ -6188,40 +6188,40 @@ class Widget {
|
|
|
6188
6188
|
});
|
|
6189
6189
|
}
|
|
6190
6190
|
async viewForm(formid) {
|
|
6191
|
-
if (!formid || !util/* default */.
|
|
6191
|
+
if (!formid || !util/* default */.c.startsWith(formid, 'cp')) return;
|
|
6192
6192
|
let impressiontoken = this.impressionTokens[formid];
|
|
6193
6193
|
if (impressiontoken) return impressiontoken;
|
|
6194
6194
|
let {
|
|
6195
6195
|
body: impression
|
|
6196
6196
|
} = await this.store.sendImpression(formid);
|
|
6197
|
-
impressiontoken = util/* default */.
|
|
6197
|
+
impressiontoken = util/* default */.c.get(impression, 'impression_token') || '';
|
|
6198
6198
|
this.impressionTokens[formid] = impressiontoken;
|
|
6199
6199
|
return impressiontoken;
|
|
6200
6200
|
}
|
|
6201
6201
|
async submitForm(formid, values) {
|
|
6202
|
-
if (!formid || !util/* default */.
|
|
6203
|
-
let storeuser = util/* default */.
|
|
6202
|
+
if (!formid || !util/* default */.c.startsWith(formid, 'cp')) return;
|
|
6203
|
+
let storeuser = util/* default */.c.cloneDeep(this.store.matchUser());
|
|
6204
6204
|
let user = {
|
|
6205
6205
|
id: storeuser.id,
|
|
6206
6206
|
account_id: storeuser.account_id
|
|
6207
6207
|
};
|
|
6208
6208
|
let is_lead = false;
|
|
6209
|
-
values = util/* default */.
|
|
6209
|
+
values = util/* default */.c.map(values, val => {
|
|
6210
6210
|
let key = val.key;
|
|
6211
6211
|
if (key === 'email') key = 'emails';
|
|
6212
6212
|
if (key === 'phone') key = 'phones';
|
|
6213
6213
|
is_lead = is_lead || key == 'emails' || key == 'phones';
|
|
6214
|
-
util/* default */.
|
|
6214
|
+
util/* default */.c.setUserAttr(user, {
|
|
6215
6215
|
key: key,
|
|
6216
6216
|
[val.type || 'text']: val.value
|
|
6217
6217
|
});
|
|
6218
6218
|
return {
|
|
6219
6219
|
key: key,
|
|
6220
6220
|
type: val.type || 'text',
|
|
6221
|
-
value: util/* default */.
|
|
6221
|
+
value: util/* default */.c.stringify(val.value)
|
|
6222
6222
|
};
|
|
6223
6223
|
});
|
|
6224
|
-
if (is_lead) util/* default */.
|
|
6224
|
+
if (is_lead) util/* default */.c.setUserAttr(user, {
|
|
6225
6225
|
key: 'lead_source',
|
|
6226
6226
|
text: 'plugin.' + formid
|
|
6227
6227
|
});
|
|
@@ -6283,14 +6283,14 @@ class Widget {
|
|
|
6283
6283
|
this.pluginMgr.forceRunPopup(pluginid);
|
|
6284
6284
|
}
|
|
6285
6285
|
unEvent(cb) {
|
|
6286
|
-
this.subs = util/* default */.
|
|
6286
|
+
this.subs = util/* default */.c.filter(this.subs, sub => sub !== cb);
|
|
6287
6287
|
}
|
|
6288
6288
|
async countUnreadMessages() {
|
|
6289
6289
|
await this.domGate.entry();
|
|
6290
6290
|
return this.store.matchUnread();
|
|
6291
6291
|
}
|
|
6292
6292
|
onEvent(cb) {
|
|
6293
|
-
this.subs = util/* default */.
|
|
6293
|
+
this.subs = util/* default */.c.filter(this.subs, sub => sub !== cb);
|
|
6294
6294
|
this.subs.push(cb);
|
|
6295
6295
|
}
|
|
6296
6296
|
overrideAccount(acc) {
|
|
@@ -6298,7 +6298,7 @@ class Widget {
|
|
|
6298
6298
|
}
|
|
6299
6299
|
async overrideChatbox(chatbox) {
|
|
6300
6300
|
await this.store.overrideChatbox(chatbox);
|
|
6301
|
-
if (util/* default */.
|
|
6301
|
+
if (util/* default */.c.get(chatbox, 'chatbox.greeting.greeting')) {
|
|
6302
6302
|
this.pluginMgr.showCurrentGreeting();
|
|
6303
6303
|
}
|
|
6304
6304
|
}
|