@subiz/widget-v4 4.0.61 → 4.0.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/img/caret.svg +1 -0
- package/assets/img/done_green.svg +4 -0
- package/assets/img/empty_1.svg +11 -0
- package/assets/img/ghn.svg +17 -0
- package/assets/img/ghtk.svg +18 -0
- package/assets/img/home.svg +1 -0
- package/assets/img/info.svg +1 -0
- package/assets/img/loader.svg +1 -0
- package/assets/img/map-pin.svg +1 -0
- package/assets/img/not_found_search.png +0 -0
- package/assets/img/package.svg +5 -0
- package/assets/img/package_fade.svg +1 -0
- package/assets/img/phone.svg +1 -0
- package/assets/img/search.svg +1 -0
- package/assets/img/shop.svg +1 -0
- package/assets/img/shop_faded.svg +1 -0
- package/assets/img/user.svg +1 -0
- package/assets/img/x.svg +5 -0
- package/assets/less/chatbox.less +39 -1
- package/assets/less/dropdown_select.less +130 -0
- package/assets/less/form.less +7 -20
- package/assets/less/order.less +489 -0
- package/assets/less/rating.less +3 -8
- package/babel.config.js +2 -4
- package/compiled_src/bot.js +7 -1
- package/compiled_src/chatbox/ChatButton.js +3 -1
- package/compiled_src/chatbox/DropdownSelect.js +248 -0
- package/compiled_src/chatbox/Event.js +5 -2
- package/compiled_src/chatbox/Events.js +1 -0
- package/compiled_src/chatbox/Order.js +285 -0
- package/compiled_src/chatbox/OrderAttachments.js +2 -1
- package/compiled_src/chatbox/ProductAttachments.js +40 -4
- package/compiled_src/chatbox/TextMessage.js +9 -2
- package/compiled_src/chatbox/Typing.js +3 -1
- package/compiled_src/chatbox/Widget.js +44 -3
- package/compiled_src/chatbox/main.js +2 -0
- package/compiled_src/chatbox/spinner.js +1 -1
- package/compiled_src/chatbox/time.js +3 -1
- package/compiled_src/common.js +40 -1
- package/compiled_src/contact/contact.js +1 -3
- package/compiled_src/order/address_picker.js +249 -0
- package/compiled_src/order/icon.js +62 -0
- package/compiled_src/order/index.js +113 -0
- package/compiled_src/order/order.js +1234 -0
- package/compiled_src/plugin.js +9 -42
- package/compiled_src/store/api.js +20 -0
- package/compiled_src/store/store.js +67 -3
- package/compiled_src/util/common.js +36 -2
- package/dist/{74.js → 132.js} +2355 -271
- package/dist/178.js +1 -1
- package/dist/17fdfed03d1.132.js +1 -0
- package/dist/17fdfed03d1.178.js +1 -0
- package/dist/17fdfed03d1.213.js +1 -0
- package/dist/17fdfed03d1.335.js +1 -0
- package/dist/17fdfed03d1.362.js +1 -0
- package/dist/17fdfed03d1.441.js +1 -0
- package/dist/17fdfed03d1.605.js +1 -0
- package/dist/{17db8166252.678.js → 17fdfed03d1.678.js} +0 -0
- package/dist/17fdfed03d1.782.js +1 -0
- package/dist/17fdfed03d1.app.js +1 -0
- package/dist/{17db8166252.index.html → 17fdfed03d1.index.html} +1 -1
- package/dist/{17db8166252.library.html → 17fdfed03d1.library.html} +1 -1
- package/dist/17fdfed03d1.library.js +1 -0
- package/dist/{17db8166252.preview.html → 17fdfed03d1.preview.html} +1 -1
- package/dist/17fdfed03d1.preview.js +1 -0
- package/dist/17fdfed03d1.screenshoot.js +1 -0
- package/dist/213.js +5 -69
- package/dist/335.js +411 -0
- package/dist/362.js +1 -1
- package/dist/441.js +70 -44
- package/dist/605.js +1 -64
- package/dist/782.js +1 -1
- package/dist/HASH +1 -1
- package/dist/assets/img/caret.998eb8f.svg +1 -0
- package/dist/assets/img/done_green.b817fd4.svg +4 -0
- package/dist/assets/img/empty_1.0b98af0.svg +11 -0
- package/dist/assets/img/ghn.070f8e3.svg +17 -0
- package/dist/assets/img/ghtk.326eac1.svg +18 -0
- package/dist/assets/img/info.ebce7ea.svg +1 -0
- package/dist/assets/img/loader.37000a7.svg +1 -0
- package/dist/assets/img/not_found_search.2ddb8d1.png +0 -0
- package/dist/assets/img/package.8d37d0f.svg +5 -0
- package/dist/assets/img/package_fade.763c001.svg +1 -0
- package/dist/assets/img/search.f9705ff.svg +1 -0
- package/dist/assets/img/shop.f7dc7d8.svg +1 -0
- package/dist/assets/img/shop_faded.df7845a.svg +1 -0
- package/dist/assets/img/x.26fdfa3.svg +5 -0
- package/dist/screenshoot.html +1 -1
- package/dist/screenshoot.js +281 -98
- package/order.html +19 -771
- package/package.json +15 -16
- package/src/bot.js +2 -1
- package/src/chatbox/Buttons.js +8 -8
- package/src/chatbox/ChatButton.js +2 -2
- package/src/chatbox/DropdownSelect.js +229 -0
- package/src/chatbox/Event.js +3 -3
- package/src/chatbox/Events.js +43 -42
- package/src/chatbox/Order.js +232 -0
- package/src/chatbox/OrderAttachments.js +2 -1
- package/src/chatbox/ProductAttachments.js +41 -5
- package/src/chatbox/TextMessage.js +21 -12
- package/src/chatbox/Typing.js +5 -1
- package/src/chatbox/Widget.js +34 -4
- package/src/chatbox/main.js +4 -1
- package/src/chatbox/spinner.js +1 -1
- package/src/chatbox/time.js +1 -1
- package/src/common.js +52 -8
- package/src/contact/contact.js +1 -1
- package/src/order/address_picker.js +235 -0
- package/src/order/icon.js +32 -0
- package/src/order/index.js +86 -0
- package/src/order/order.js +1157 -0
- package/src/order/scratch +211 -0
- package/src/plugin.js +7 -52
- package/src/store/api.js +26 -1
- package/src/store/store.js +53 -3
- package/src/util/common.js +48 -2
- package/up +1 -1
- package/webpack.dev.js +2 -0
- package/dist/17db8166252.178.js +0 -1
- package/dist/17db8166252.213.js +0 -1
- package/dist/17db8166252.362.js +0 -1
- package/dist/17db8166252.441.js +0 -1
- package/dist/17db8166252.605.js +0 -1
- package/dist/17db8166252.619.js +0 -1
- package/dist/17db8166252.74.js +0 -1
- package/dist/17db8166252.782.js +0 -1
- package/dist/17db8166252.app.js +0 -1
- package/dist/17db8166252.library.js +0 -1
- package/dist/17db8166252.preview.js +0 -1
- package/dist/17db8166252.screenshoot.js +0 -1
- package/dist/619.js +0 -777
- package/order.js +0 -0
- package/test.js +0 -1
package/dist/screenshoot.js
CHANGED
|
@@ -1343,74 +1343,173 @@ function toString(obj) {
|
|
|
1343
1343
|
|
|
1344
1344
|
/***/ }),
|
|
1345
1345
|
|
|
1346
|
+
/***/ 2493:
|
|
1347
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1348
|
+
|
|
1349
|
+
"use strict";
|
|
1350
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1351
|
+
/* harmony export */ "Kd": () => (/* binding */ getLocale),
|
|
1352
|
+
/* harmony export */ "Rs": () => (/* binding */ langMessages),
|
|
1353
|
+
/* harmony export */ "WW": () => (/* binding */ downloadLanguage),
|
|
1354
|
+
/* harmony export */ "u$": () => (/* binding */ Clickaway),
|
|
1355
|
+
/* harmony export */ "up": () => (/* binding */ Com)
|
|
1356
|
+
/* harmony export */ });
|
|
1357
|
+
/* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6400);
|
|
1358
|
+
/* harmony import */ var _util_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(819);
|
|
1359
|
+
|
|
1360
|
+
|
|
1361
|
+
class Com extends preact__WEBPACK_IMPORTED_MODULE_0__/* .Component */ .wA {
|
|
1362
|
+
constructor(props) {
|
|
1363
|
+
super(props);
|
|
1364
|
+
this._isMounted = true;
|
|
1365
|
+
setTimeout(() => {
|
|
1366
|
+
if (this.componentWillUnmount) {
|
|
1367
|
+
let old = this.componentWillUnmount.bind(this);
|
|
1368
|
+
|
|
1369
|
+
this.componentWillUnmount = () => {
|
|
1370
|
+
old();
|
|
1371
|
+
this._isMounted = false;
|
|
1372
|
+
};
|
|
1373
|
+
}
|
|
1374
|
+
}, 10);
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
}
|
|
1378
|
+
class Clickaway extends Com {
|
|
1379
|
+
constructor(props) {
|
|
1380
|
+
super(props);
|
|
1381
|
+
this.setWrapperRef = this.setWrapperRef.bind(this);
|
|
1382
|
+
this.onClick = this.onClick.bind(this);
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
componentDidMount() {
|
|
1386
|
+
document.addEventListener('mousedown', this.onClick);
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
componentWillUnmount() {
|
|
1390
|
+
document.removeEventListener('mousedown', this.onClick);
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
setWrapperRef(node) {
|
|
1394
|
+
this.wrapperRef = node;
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
onClick(event) {
|
|
1398
|
+
if (this.wrapperRef && !this.wrapperRef.contains(event.target)) {
|
|
1399
|
+
this.props.onClickaway && this.props.onClickaway();
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
render() {
|
|
1404
|
+
return (0,preact__WEBPACK_IMPORTED_MODULE_0__.h)("div", {
|
|
1405
|
+
ref: this.setWrapperRef
|
|
1406
|
+
}, this.props.children);
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
}
|
|
1410
|
+
const getLocale = (plugin, loc) => {
|
|
1411
|
+
if (!loc) loc = '';
|
|
1412
|
+
let found = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"].find */ .Z.find(plugin.locales, l => l.toLowerCase().trim() === loc.toLowerCase().trim());
|
|
1413
|
+
if (found) return found;
|
|
1414
|
+
found = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"].find */ .Z.find(plugin.locales, l => {
|
|
1415
|
+
l = l.replace('-', '_').split('_')[0].trim().toLowerCase();
|
|
1416
|
+
let compareloc = loc.replace('-', '_').split('_')[0].trim().toLowerCase();
|
|
1417
|
+
return l == compareloc;
|
|
1418
|
+
});
|
|
1419
|
+
if (found) return found;
|
|
1420
|
+
return plugin.locale || 'en-US';
|
|
1421
|
+
};
|
|
1422
|
+
let langMessages = {};
|
|
1423
|
+
let downloadLock = false;
|
|
1424
|
+
function downloadLanguage(store, locale, force) {
|
|
1425
|
+
if (downloadLock) return new Promise(resolve => setTimeout(() => downloadLanguage(store, locale, force).then(resolve), 100));
|
|
1426
|
+
downloadLock = true;
|
|
1427
|
+
let messages;
|
|
1428
|
+
|
|
1429
|
+
if (locale === 'debug' || langMessages[locale] && !force) {
|
|
1430
|
+
downloadLock = false;
|
|
1431
|
+
return Promise.resolve();
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
return store.getLocaleContent(locale).then(res => {
|
|
1435
|
+
downloadLock = false;
|
|
1436
|
+
messages = _util_index_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"].get */ .Z.get(res, 'body.messages', []);
|
|
1437
|
+
langMessages[locale] = messages;
|
|
1438
|
+
});
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
/***/ }),
|
|
1442
|
+
|
|
1346
1443
|
/***/ 8733:
|
|
1347
1444
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1348
1445
|
|
|
1349
1446
|
"use strict";
|
|
1350
1447
|
__webpack_require__.r(__webpack_exports__);
|
|
1351
1448
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1352
|
-
/* harmony export */ "
|
|
1353
|
-
/* harmony export */ "
|
|
1449
|
+
/* harmony export */ "DEFVAL": () => (/* binding */ DEFVAL),
|
|
1450
|
+
/* harmony export */ "DEF_CHAT_BUTTON_BACKGROUND_IMAGE_URL": () => (/* binding */ DEF_CHAT_BUTTON_BACKGROUND_IMAGE_URL),
|
|
1354
1451
|
/* harmony export */ "Date": () => (/* binding */ Date),
|
|
1355
|
-
/* harmony export */ "
|
|
1356
|
-
/* harmony export */ "
|
|
1357
|
-
/* harmony export */ "
|
|
1452
|
+
/* harmony export */ "agentsOfConvo": () => (/* binding */ agentsOfConvo),
|
|
1453
|
+
/* harmony export */ "checkRunConditions": () => (/* binding */ checkRunConditions),
|
|
1454
|
+
/* harmony export */ "cloneDeep": () => (/* binding */ cloneDeep),
|
|
1358
1455
|
/* harmony export */ "convoOfEv": () => (/* binding */ convoOfEv),
|
|
1359
1456
|
/* harmony export */ "convoToEv": () => (/* binding */ convoToEv),
|
|
1360
|
-
/* harmony export */ "
|
|
1361
|
-
/* harmony export */ "
|
|
1362
|
-
/* harmony export */ "
|
|
1363
|
-
/* harmony export */ "cloneDeep": () => (/* binding */ cloneDeep),
|
|
1364
|
-
/* harmony export */ "randomString": () => (/* binding */ randomString),
|
|
1365
|
-
/* harmony export */ "filter": () => (/* binding */ filter),
|
|
1366
|
-
/* harmony export */ "includes": () => (/* binding */ includes),
|
|
1367
|
-
/* harmony export */ "map": () => (/* binding */ map),
|
|
1457
|
+
/* harmony export */ "detectLang": () => (/* binding */ detectLang),
|
|
1458
|
+
/* harmony export */ "diffDay": () => (/* binding */ diffDay),
|
|
1459
|
+
/* harmony export */ "diffYear": () => (/* binding */ diffYear),
|
|
1368
1460
|
/* harmony export */ "each": () => (/* binding */ each),
|
|
1369
|
-
/* harmony export */ "
|
|
1370
|
-
/* harmony export */ "isConvoSeen": () => (/* binding */ isConvoSeen),
|
|
1371
|
-
/* harmony export */ "agentsOfConvo": () => (/* binding */ agentsOfConvo),
|
|
1372
|
-
/* harmony export */ "startsWith": () => (/* binding */ startsWith),
|
|
1373
|
-
/* harmony export */ "size": () => (/* binding */ size),
|
|
1374
|
-
/* harmony export */ "replaceAll": () => (/* binding */ replaceAll),
|
|
1375
|
-
/* harmony export */ "trim": () => (/* binding */ trim),
|
|
1376
|
-
/* harmony export */ "trimStart": () => (/* binding */ trimStart),
|
|
1377
|
-
/* harmony export */ "throttle": () => (/* binding */ throttle),
|
|
1461
|
+
/* harmony export */ "filter": () => (/* binding */ filter),
|
|
1378
1462
|
/* harmony export */ "find": () => (/* binding */ find),
|
|
1379
|
-
/* harmony export */ "
|
|
1463
|
+
/* harmony export */ "formatCurrency": () => (/* binding */ formatCurrency),
|
|
1464
|
+
/* harmony export */ "getAgentDisplayName": () => (/* binding */ getAgentDisplayName),
|
|
1465
|
+
/* harmony export */ "getDayName": () => (/* binding */ getDayName),
|
|
1380
1466
|
/* harmony export */ "getIntegrationId": () => (/* binding */ getIntegrationId),
|
|
1467
|
+
/* harmony export */ "getMs": () => (/* binding */ getMs),
|
|
1468
|
+
/* harmony export */ "getMsgField": () => (/* binding */ getMsgField),
|
|
1469
|
+
/* harmony export */ "getUrlParameter": () => (/* binding */ getUrlParameter),
|
|
1470
|
+
/* harmony export */ "getUserAttr": () => (/* binding */ getUserAttr),
|
|
1471
|
+
/* harmony export */ "includes": () => (/* binding */ includes),
|
|
1472
|
+
/* harmony export */ "isConvoSeen": () => (/* binding */ isConvoSeen),
|
|
1473
|
+
/* harmony export */ "isEmail": () => (/* binding */ isEmail),
|
|
1474
|
+
/* harmony export */ "isNumber": () => (/* binding */ isNumber),
|
|
1381
1475
|
/* harmony export */ "isPhone": () => (/* binding */ isPhone),
|
|
1382
1476
|
/* harmony export */ "isURL": () => (/* binding */ isURL),
|
|
1383
|
-
/* harmony export */ "isNumber": () => (/* binding */ isNumber),
|
|
1384
|
-
/* harmony export */ "isEmail": () => (/* binding */ isEmail),
|
|
1385
|
-
/* harmony export */ "last": () => (/* binding */ last),
|
|
1386
|
-
/* harmony export */ "getAgentDisplayName": () => (/* binding */ getAgentDisplayName),
|
|
1387
1477
|
/* harmony export */ "isUserBanned": () => (/* binding */ isUserBanned),
|
|
1388
|
-
/* harmony export */ "setUserAttr": () => (/* binding */ setUserAttr),
|
|
1389
|
-
/* harmony export */ "getUserAttr": () => (/* binding */ getUserAttr),
|
|
1390
|
-
/* harmony export */ "norm": () => (/* binding */ norm),
|
|
1391
|
-
/* harmony export */ "noop": () => (/* binding */ noop),
|
|
1392
|
-
/* harmony export */ "replaceCssVariablePlugin": () => (/* binding */ replaceCssVariablePlugin),
|
|
1393
|
-
/* harmony export */ "replaceCssVariable": () => (/* binding */ replaceCssVariable),
|
|
1394
|
-
/* harmony export */ "tokenize": () => (/* binding */ tokenize),
|
|
1395
|
-
/* harmony export */ "setCss": () => (/* binding */ setCss),
|
|
1396
|
-
/* harmony export */ "DEF_CHAT_BUTTON_BACKGROUND_IMAGE_URL": () => (/* binding */ DEF_CHAT_BUTTON_BACKGROUND_IMAGE_URL),
|
|
1397
|
-
/* harmony export */ "DEFVAL": () => (/* binding */ DEFVAL),
|
|
1398
1478
|
/* harmony export */ "js2css": () => (/* binding */ js2css),
|
|
1399
|
-
/* harmony export */ "
|
|
1400
|
-
/* harmony export */ "
|
|
1401
|
-
/* harmony export */ "
|
|
1402
|
-
/* harmony export */ "
|
|
1479
|
+
/* harmony export */ "last": () => (/* binding */ last),
|
|
1480
|
+
/* harmony export */ "map": () => (/* binding */ map),
|
|
1481
|
+
/* harmony export */ "merge": () => (/* binding */ merge),
|
|
1482
|
+
/* harmony export */ "noop": () => (/* binding */ noop),
|
|
1483
|
+
/* harmony export */ "norm": () => (/* binding */ norm),
|
|
1403
1484
|
/* harmony export */ "offsetToMin": () => (/* binding */ offsetToMin),
|
|
1404
|
-
/* harmony export */ "
|
|
1405
|
-
/* harmony export */ "
|
|
1485
|
+
/* harmony export */ "orderBy": () => (/* binding */ orderBy),
|
|
1486
|
+
/* harmony export */ "parseJSON": () => (/* binding */ parseJSON),
|
|
1487
|
+
/* harmony export */ "preloadImg": () => (/* binding */ preloadImg),
|
|
1488
|
+
/* harmony export */ "preloadWebfonts": () => (/* binding */ preloadWebfonts),
|
|
1489
|
+
/* harmony export */ "randomString": () => (/* binding */ randomString),
|
|
1490
|
+
/* harmony export */ "replaceAll": () => (/* binding */ replaceAll),
|
|
1491
|
+
/* harmony export */ "replaceCssVariable": () => (/* binding */ replaceCssVariable),
|
|
1492
|
+
/* harmony export */ "replaceCssVariablePlugin": () => (/* binding */ replaceCssVariablePlugin),
|
|
1493
|
+
/* harmony export */ "requestAnimationFrame": () => (/* binding */ requestAnimationFrame),
|
|
1406
1494
|
/* harmony export */ "sameDay": () => (/* binding */ sameDay),
|
|
1495
|
+
/* harmony export */ "scrollIntoViewIfNeeded": () => (/* binding */ scrollIntoViewIfNeeded),
|
|
1496
|
+
/* harmony export */ "setCss": () => (/* binding */ setCss),
|
|
1497
|
+
/* harmony export */ "setInterval": () => (/* binding */ setInterval),
|
|
1498
|
+
/* harmony export */ "setMsgField": () => (/* binding */ setMsgField),
|
|
1499
|
+
/* harmony export */ "setTimeout": () => (/* binding */ setTimeout),
|
|
1500
|
+
/* harmony export */ "setUserAttr": () => (/* binding */ setUserAttr),
|
|
1407
1501
|
/* harmony export */ "shortTime": () => (/* binding */ shortTime),
|
|
1408
|
-
/* harmony export */ "
|
|
1409
|
-
/* harmony export */ "getMs": () => (/* binding */ getMs),
|
|
1410
|
-
/* harmony export */ "detectLang": () => (/* binding */ detectLang),
|
|
1411
|
-
/* harmony export */ "getUrlParameter": () => (/* binding */ getUrlParameter),
|
|
1502
|
+
/* harmony export */ "size": () => (/* binding */ size),
|
|
1412
1503
|
/* harmony export */ "sleep": () => (/* binding */ sleep),
|
|
1413
|
-
/* harmony export */ "
|
|
1504
|
+
/* harmony export */ "startsWith": () => (/* binding */ startsWith),
|
|
1505
|
+
/* harmony export */ "stringify": () => (/* binding */ stringify),
|
|
1506
|
+
/* harmony export */ "throttle": () => (/* binding */ throttle),
|
|
1507
|
+
/* harmony export */ "tokenize": () => (/* binding */ tokenize),
|
|
1508
|
+
/* harmony export */ "trim": () => (/* binding */ trim),
|
|
1509
|
+
/* harmony export */ "trimStart": () => (/* binding */ trimStart),
|
|
1510
|
+
/* harmony export */ "unicodeToAscii": () => (/* binding */ unicodeToAscii),
|
|
1511
|
+
/* harmony export */ "unixSec": () => (/* binding */ unixSec),
|
|
1512
|
+
/* harmony export */ "usersOfConvo": () => (/* binding */ usersOfConvo)
|
|
1414
1513
|
/* harmony export */ });
|
|
1415
1514
|
var op = __webpack_require__(6877);
|
|
1416
1515
|
|
|
@@ -2298,6 +2397,7 @@ function preloadWebfonts(fonts, done) {
|
|
|
2298
2397
|
node.style.color = 'transparent';
|
|
2299
2398
|
node.style.fontSize = '20px';
|
|
2300
2399
|
node.style.height = '0px';
|
|
2400
|
+
node.style.top = '0px';
|
|
2301
2401
|
node.style.width = '0px';
|
|
2302
2402
|
node.style.fontWeight = weight;
|
|
2303
2403
|
node.setAttribute('subiz-preload', font + ':' + weight);
|
|
@@ -2419,9 +2519,9 @@ function getUrlParameter() {
|
|
|
2419
2519
|
}
|
|
2420
2520
|
var sleep = ms => new Promise(res => setTimeout(res, ms));
|
|
2421
2521
|
function formatCurrency(val) {
|
|
2422
|
-
if (!val) return 0;
|
|
2522
|
+
if (!val) return '0 đ';
|
|
2423
2523
|
val = Math.round(val);
|
|
2424
|
-
return val.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,');
|
|
2524
|
+
return val.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,') + ' đ';
|
|
2425
2525
|
}
|
|
2426
2526
|
|
|
2427
2527
|
function replaceFileUrl(src) {
|
|
@@ -2449,6 +2549,36 @@ function replaceFileUrl(src) {
|
|
|
2449
2549
|
return src;
|
|
2450
2550
|
}
|
|
2451
2551
|
|
|
2552
|
+
function unicodeToAscii(str) {
|
|
2553
|
+
str = str + '';
|
|
2554
|
+
str = str.replace('đ', 'd').replace('Đ', 'D');
|
|
2555
|
+
return str.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
|
2556
|
+
}
|
|
2557
|
+
function scrollIntoViewIfNeeded($ele) {
|
|
2558
|
+
centerIfNeeded = arguments.length === 0 ? true : !!centerIfNeeded;
|
|
2559
|
+
var parent = $ele.parentNode;
|
|
2560
|
+
var parentComputedStyle = window.getComputedStyle(parent, null);
|
|
2561
|
+
var parentBorderTopWidth = parseInt(parentComputedStyle.getPropertyValue('border-top-width'));
|
|
2562
|
+
var parentBorderLeftWidth = parseInt(parentComputedStyle.getPropertyValue('border-left-width'));
|
|
2563
|
+
var overTop = $ele.offsetTop - parent.offsetTop < parent.scrollTop;
|
|
2564
|
+
var overBottom = $ele.offsetTop - parent.offsetTop + $ele.clientHeight - parentBorderTopWidth > parent.scrollTop + parent.clientHeight;
|
|
2565
|
+
var overLeft = $ele.offsetLeft - parent.offsetLeft < parent.scrollLeft;
|
|
2566
|
+
var overRight = $ele.offsetLeft - parent.offsetLeft + $ele.clientWidth - parentBorderLeftWidth > parent.scrollLeft + parent.clientWidth;
|
|
2567
|
+
var alignWithTop = overTop && !overBottom;
|
|
2568
|
+
|
|
2569
|
+
if ((overTop || overBottom) && centerIfNeeded) {
|
|
2570
|
+
parent.scrollTop = $ele.offsetTop - parent.offsetTop - parent.clientHeight / 2 - parentBorderTopWidth + $ele.clientHeight / 2;
|
|
2571
|
+
}
|
|
2572
|
+
|
|
2573
|
+
if ((overLeft || overRight) && centerIfNeeded) {
|
|
2574
|
+
parent.scrollLeft = $ele.offsetLeft - parent.offsetLeft - parent.clientWidth / 2 - parentBorderLeftWidth + $ele.clientWidth / 2;
|
|
2575
|
+
}
|
|
2576
|
+
|
|
2577
|
+
if ((overTop || overBottom || overLeft || overRight) && !centerIfNeeded) {
|
|
2578
|
+
$ele.scrollIntoView(alignWithTop);
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2452
2582
|
/***/ }),
|
|
2453
2583
|
|
|
2454
2584
|
/***/ 2302:
|
|
@@ -3076,14 +3206,14 @@ class Pubsub {
|
|
|
3076
3206
|
|
|
3077
3207
|
"use strict";
|
|
3078
3208
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3079
|
-
/* harmony export */ "sY": () => (/* binding */ S),
|
|
3080
|
-
/* harmony export */ "h": () => (/* binding */ v),
|
|
3081
3209
|
/* harmony export */ "HY": () => (/* binding */ d),
|
|
3082
3210
|
/* harmony export */ "Vf": () => (/* binding */ p),
|
|
3211
|
+
/* harmony export */ "h": () => (/* binding */ v),
|
|
3212
|
+
/* harmony export */ "sY": () => (/* binding */ S),
|
|
3083
3213
|
/* harmony export */ "wA": () => (/* binding */ _)
|
|
3084
3214
|
/* harmony export */ });
|
|
3085
3215
|
/* unused harmony exports hydrate, createElement, isValidElement, cloneElement, createContext, toChildArray, options */
|
|
3086
|
-
var n,l,u,i,t,r,
|
|
3216
|
+
var n,l,u,i,t,o,r,f,e={},c=[],s=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function a(n,l){for(var u in l)n[u]=l[u];return n}function h(n){var l=n.parentNode;l&&l.removeChild(n)}function v(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return y(l,f,t,o,null)}function y(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u:r};return null==r&&null!=l.vnode&&l.vnode(f),f}function p(){return{current:null}}function d(n){return n.children}function _(n,l){this.props=n,this.context=l}function k(n,l){if(null==l)return n.__?k(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return"function"==typeof n.type?k(n):null}function b(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 b(n)}}function m(n){(!n.__d&&(n.__d=!0)&&t.push(n)&&!g.__r++||r!==l.debounceRendering)&&((r=l.debounceRendering)||o)(g)}function g(){for(var n;g.__r=t.length;)n=t.sort(function(n,l){return n.__v.__b-l.__v.__b}),t=[],n.some(function(n){var l,u,i,t,o,r;n.__d&&(o=(t=(l=n).__v).__e,(r=l.__P)&&(u=[],(i=a({},t)).__v=t.__v+1,j(r,t,i,l.__n,void 0!==r.ownerSVGElement,null!=t.__h?[o]:null,u,null==o?k(t):o,t.__h),z(u,t),t.__e!=o&&b(t)))})}function w(n,l,u,i,t,o,r,f,s,a){var h,v,p,_,b,m,g,w=i&&i.__k||c,A=w.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(_=u.__k[h]=null==(_=l[h])||"boolean"==typeof _?null:"string"==typeof _||"number"==typeof _||"bigint"==typeof _?y(null,_,null,null,_):Array.isArray(_)?y(d,{children:_},null,null,null):_.__b>0?y(_.type,_.props,_.key,null,_.__v):_)){if(_.__=u,_.__b=u.__b+1,null===(p=w[h])||p&&_.key==p.key&&_.type===p.type)w[h]=void 0;else for(v=0;v<A;v++){if((p=w[v])&&_.key==p.key&&_.type===p.type){w[v]=void 0;break}p=null}j(n,_,p=p||e,t,o,r,f,s,a),b=_.__e,(v=_.ref)&&p.ref!=v&&(g||(g=[]),p.ref&&g.push(p.ref,null,_),g.push(v,_.__c||b,_)),null!=b?(null==m&&(m=b),"function"==typeof _.type&&_.__k===p.__k?_.__d=s=x(_,s,n):s=P(n,_,p,w,b,s),"function"==typeof u.type&&(u.__d=s)):s&&p.__e==s&&s.parentNode!=n&&(s=k(p))}for(u.__e=m,h=A;h--;)null!=w[h]&&("function"==typeof u.type&&null!=w[h].__e&&w[h].__e==u.__d&&(u.__d=k(i,h+1)),N(w[h],w[h]));if(g)for(h=0;h<g.length;h++)M(g[h],g[++h],g[++h])}function x(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l="function"==typeof i.type?x(i,l,u):P(u,i,i,t,i.__e,l));return l}function A(n,l){return l=l||[],null==n||"boolean"==typeof n||(Array.isArray(n)?n.some(function(n){A(n,l)}):l.push(n)),l}function P(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else{for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=2)if(f==t)break n;n.insertBefore(t,o),r=o}return void 0!==r?r:t.nextSibling}function C(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||H(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||H(n,o,l[o],u[o],i)}function $(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]=null==u?"":"number"!=typeof u||s.test(l)?u:u+"px"}function H(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else{if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||$(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||$(n.style,l,u[l])}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?T:I,o):n.removeEventListener(l,o?T:I,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null!=u&&(!1!==u||"a"===l[0]&&"r"===l[1])?n.setAttribute(l,u):n.removeAttribute(l))}}function I(n){this.l[n.type+!1](l.event?l.event(n):n)}function T(n){this.l[n.type+!0](l.event?l.event(n):n)}function j(n,u,i,t,o,r,f,e,c){var s,h,v,y,p,k,b,m,g,x,A,P=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(s=l.__b)&&s(u);try{n:if("function"==typeof P){if(m=u.props,g=(s=P.contextType)&&t[s.__c],x=s?g?g.props.value:s.__:t,i.__c?b=(h=u.__c=i.__c).__=h.__E:("prototype"in P&&P.prototype.render?u.__c=h=new P(m,x):(u.__c=h=new _(m,x),h.constructor=P,h.render=O),g&&g.sub(h),h.props=m,h.state||(h.state={}),h.context=x,h.__n=t,v=h.__d=!0,h.__h=[]),null==h.__s&&(h.__s=h.state),null!=P.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=a({},h.__s)),a(h.__s,P.getDerivedStateFromProps(m,h.__s))),y=h.props,p=h.state,v)null==P.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(null==P.getDerivedStateFromProps&&m!==y&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(m,x),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(m,h.__s,x)||u.__v===i.__v){h.props=m,h.state=h.__s,u.__v!==i.__v&&(h.__d=!1),h.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u)}),h.__h.length&&f.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(m,h.__s,x),null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(y,p,k)})}h.context=x,h.props=m,h.state=h.__s,(s=l.__r)&&s(u),h.__d=!1,h.__v=u,h.__P=n,s=h.render(h.props,h.state,h.context),h.state=h.__s,null!=h.getChildContext&&(t=a(a({},t),h.getChildContext())),v||null==h.getSnapshotBeforeUpdate||(k=h.getSnapshotBeforeUpdate(y,p)),A=null!=s&&s.type===d&&null==s.key?s.props.children:s,w(n,Array.isArray(A)?A:[A],u,i,t,o,r,f,e,c),h.base=u.__e,u.__h=null,h.__h.length&&f.push(h),b&&(h.__E=h.__=null),h.__e=!1}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=L(i.__e,u,i,t,o,r,f,c);(s=l.diffed)&&s(u)}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l.__e(n,u,i)}}function z(n,u){l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u)})}catch(n){l.__e(n,u.__v)}})}function L(l,u,i,t,o,r,f,c){var s,a,v,y=i.props,p=u.props,d=u.type,_=0;if("svg"===d&&(o=!0),null!=r)for(;_<r.length;_++)if((s=r[_])&&"setAttribute"in s==!!d&&(d?s.localName===d:3===s.nodeType)){l=s,r[_]=null;break}if(null==l){if(null===d)return document.createTextNode(p);l=o?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,p.is&&p),r=null,c=!1}if(null===d)y===p||c&&l.data===p||(l.data=p);else{if(r=r&&n.call(l.childNodes),a=(y=i.props||e).dangerouslySetInnerHTML,v=p.dangerouslySetInnerHTML,!c){if(null!=r)for(y={},_=0;_<l.attributes.length;_++)y[l.attributes[_].name]=l.attributes[_].value;(v||a)&&(v&&(a&&v.__html==a.__html||v.__html===l.innerHTML)||(l.innerHTML=v&&v.__html||""))}if(C(l,p,y,o,c),v)u.__k=[];else if(_=u.props.children,w(l,Array.isArray(_)?_:[_],u,i,t,o&&"foreignObject"!==d,r,f,r?r[0]:i.__k&&k(i,0),c),null!=r)for(_=r.length;_--;)null!=r[_]&&h(r[_]);c||("value"in p&&void 0!==(_=p.value)&&(_!==l.value||"progress"===d&&!_||"option"===d&&_!==y.value)&&H(l,"value",_,y.value,!1),"checked"in p&&void 0!==(_=p.checked)&&_!==l.checked&&H(l,"checked",_,y.checked,!1))}return l}function M(n,u,i){try{"function"==typeof n?n(u):n.current=u}catch(n){l.__e(n,i)}}function N(n,u,i){var t,o;if(l.unmount&&l.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||M(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount()}catch(n){l.__e(n,u)}t.base=t.__P=null}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&N(t[o],u,"function"!=typeof n.type);i||null==n.__e||h(n.__e),n.__e=n.__d=void 0}function O(n,l,u){return this.constructor(n,u)}function S(u,i,t){var o,r,f;l.__&&l.__(u,i),r=(o="function"==typeof t)?null:t&&t.__k||i.__k,f=[],j(i,u=(!o&&t||i).__k=v(d,null,[u]),r||e,e,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n.call(i.childNodes):null,f,!o&&t?t:r?r.__e:i.firstChild,o),z(f,u)}function q(n,l){S(n,l,q)}function B(l,u,i){var t,o,r,f=a({},l.props);for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];return arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),y(l.type,f,t||l.key,o||l.ref,null)}function D(n,l){var u={__c:l="__cC"+f++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,i;return this.getChildContext||(u=[],(i={})[l]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(m)},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=c.slice,l={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l}throw n}},u=0,i=function(n){return null!=n&&void 0===n.constructor},_.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=a({},this.state),"function"==typeof n&&(n=n(a({},u),this.props)),n&&a(u,n),null!=n&&this.__v&&(l&&this.__h.push(l),m(this))},_.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),m(this))},_.prototype.render=d,t=[],o="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,g.__r=0,f=0;
|
|
3087
3217
|
//# sourceMappingURL=preact.module.js.map
|
|
3088
3218
|
|
|
3089
3219
|
|
|
@@ -3312,7 +3442,7 @@ var n,l,u,i,t,r,o,f,e={},c=[],s=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[c
|
|
|
3312
3442
|
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
|
|
3313
3443
|
/******/ installedChunks[chunkId][0]();
|
|
3314
3444
|
/******/ }
|
|
3315
|
-
/******/ installedChunks[
|
|
3445
|
+
/******/ installedChunks[chunkId] = 0;
|
|
3316
3446
|
/******/ }
|
|
3317
3447
|
/******/
|
|
3318
3448
|
/******/ }
|
|
@@ -3450,6 +3580,26 @@ function jsonifyTextPlain(param, done) {
|
|
|
3450
3580
|
|
|
3451
3581
|
_defineProperty(this, "sendConversion", conversion => this.apireq.post(`/accounts/${this.accid}/campaigns/${conversion.campaign_id}/conversions`, conversion));
|
|
3452
3582
|
|
|
3583
|
+
_defineProperty(this, "lookupOrder", key => ajax.setBaseUrl(this.ApiURL).setContentType('text/plain').beforeHook(jsonifyTextPlain).setParser('json').addQuery('x-signed-key', key).get(`/orders/123`));
|
|
3584
|
+
|
|
3585
|
+
_defineProperty(this, "getOrder", id => this.apireq.get(`/accounts/${this.accid}/orders/` + id));
|
|
3586
|
+
|
|
3587
|
+
_defineProperty(this, "updateOrder", order => this.apireq.post(`/accounts/${this.accid}/orders/` + order.id, order));
|
|
3588
|
+
|
|
3589
|
+
_defineProperty(this, "fetchShippingAddresses", () => this.apireq.get(`/accounts/${this.accid}/users/${this.uid}/shipping-addresses`));
|
|
3590
|
+
|
|
3591
|
+
_defineProperty(this, "createShippingAddress", addr => this.apireq.post(`/accounts/${this.accid}/users/${this.uid}/shipping-addresses`, addr));
|
|
3592
|
+
|
|
3593
|
+
_defineProperty(this, "list_provinces", () => this.apireq.get(`/accounts/${this.accid}/provinces`));
|
|
3594
|
+
|
|
3595
|
+
_defineProperty(this, "list_districts", p => this.apireq.setQuery(p).get(`/accounts/${this.accid}/districts`));
|
|
3596
|
+
|
|
3597
|
+
_defineProperty(this, "list_wards", p => this.apireq.setQuery(p).get(`/accounts/${this.accid}/wards`));
|
|
3598
|
+
|
|
3599
|
+
_defineProperty(this, "suggest_address", keyword => this.apireq.setQuery({
|
|
3600
|
+
keyword: keyword
|
|
3601
|
+
}).get(`/accounts/${this.accid}/addresses`));
|
|
3602
|
+
|
|
3453
3603
|
this.FileURL = FileURL;
|
|
3454
3604
|
this.ApiURL = ApiURL;
|
|
3455
3605
|
this.apireq = ajax.setBaseUrl(ApiURL).withCredentials(true).addQuery('v', '6').setContentType('text/plain').beforeHook(jsonifyTextPlain).setParser('json').beforeHook((param, done) => {
|
|
@@ -4046,10 +4196,14 @@ class Store {
|
|
|
4046
4196
|
return this.kv.match('user');
|
|
4047
4197
|
});
|
|
4048
4198
|
|
|
4199
|
+
store_defineProperty(this, "suggest_addresses", keyword => this.api.suggest_address(keyword));
|
|
4200
|
+
|
|
4049
4201
|
store_defineProperty(this, "matchSession", () => this.kv.match('session') || {});
|
|
4050
4202
|
|
|
4051
4203
|
store_defineProperty(this, "matchAccount", () => this.cache.match('account'));
|
|
4052
4204
|
|
|
4205
|
+
store_defineProperty(this, "matchPaymentMethods", () => this.cache.match('payment_methods'));
|
|
4206
|
+
|
|
4053
4207
|
store_defineProperty(this, "matchUnread", () => {
|
|
4054
4208
|
let user = this.matchUser();
|
|
4055
4209
|
let allconvos = this.matchConvo('*');
|
|
@@ -4101,6 +4255,14 @@ class Store {
|
|
|
4101
4255
|
return this.reconnectGate.open();
|
|
4102
4256
|
});
|
|
4103
4257
|
|
|
4258
|
+
store_defineProperty(this, "list_provinces", () => this.api.list_provinces());
|
|
4259
|
+
|
|
4260
|
+
store_defineProperty(this, "list_districts", p => this.api.list_districts(p));
|
|
4261
|
+
|
|
4262
|
+
store_defineProperty(this, "list_wards", p => this.api.list_wards(p));
|
|
4263
|
+
|
|
4264
|
+
store_defineProperty(this, "list_provices", void 0);
|
|
4265
|
+
|
|
4104
4266
|
store_defineProperty(this, "listEvents", id => {
|
|
4105
4267
|
if (!id || id === '*' || typeof id !== 'string') return;
|
|
4106
4268
|
|
|
@@ -4176,7 +4338,10 @@ class Store {
|
|
|
4176
4338
|
store_defineProperty(this, "setIsOpen", isopen => {
|
|
4177
4339
|
let lastisopen = this.kv.match('isopen');
|
|
4178
4340
|
this.kv.put('isopen', isopen);
|
|
4179
|
-
|
|
4341
|
+
|
|
4342
|
+
if (!lastisopen && isopen) {
|
|
4343
|
+
sendEventToThirdParty('SUBIZ Chat', 'Opened', 'Subiz Windows');
|
|
4344
|
+
}
|
|
4180
4345
|
});
|
|
4181
4346
|
|
|
4182
4347
|
store_defineProperty(this, "closePreview", () => this.kv.put('close_preview_at', new util/* default.Date */.Z.Date().getTime()));
|
|
@@ -4245,6 +4410,24 @@ class Store {
|
|
|
4245
4410
|
return util/* default.Date.now */.Z.Date.now() - (this.g_sync[key] || 0) < 300000;
|
|
4246
4411
|
}
|
|
4247
4412
|
|
|
4413
|
+
async fetchShippingAddresses() {
|
|
4414
|
+
let out = await this.api.fetchShippingAddresses();
|
|
4415
|
+
if (out.error) return null;
|
|
4416
|
+
this.cache.put('shipping_address', out.body.shipping_addresses);
|
|
4417
|
+
}
|
|
4418
|
+
|
|
4419
|
+
matchShippingAddresses() {
|
|
4420
|
+
return this.cache.match('shipping_address');
|
|
4421
|
+
}
|
|
4422
|
+
|
|
4423
|
+
updateOrder(order) {
|
|
4424
|
+
return this.api.updateOrder(order);
|
|
4425
|
+
}
|
|
4426
|
+
|
|
4427
|
+
createShippingAddress(addr) {
|
|
4428
|
+
return this.api.createShippingAddress(addr);
|
|
4429
|
+
}
|
|
4430
|
+
|
|
4248
4431
|
async overrideAcc(acc) {
|
|
4249
4432
|
this.forceAcc = util/* default.cloneDeep */.Z.cloneDeep(acc);
|
|
4250
4433
|
await this.readyGate.entry();
|
|
@@ -4458,6 +4641,7 @@ class Store {
|
|
|
4458
4641
|
}
|
|
4459
4642
|
|
|
4460
4643
|
_setUser(user) {
|
|
4644
|
+
user = util/* default.cloneDeep */.Z.cloneDeep(user);
|
|
4461
4645
|
let olduser = this.kv.match('user') || {};
|
|
4462
4646
|
var accid = olduser.account_id || user.account_id;
|
|
4463
4647
|
var id = olduser.id || user.id;
|
|
@@ -4549,6 +4733,8 @@ class Store {
|
|
|
4549
4733
|
this.cache.put('agent', agentM);
|
|
4550
4734
|
}
|
|
4551
4735
|
|
|
4736
|
+
let pms = util/* default.get */.Z.get(setting, 'payment_methods', []);
|
|
4737
|
+
this.cache.put('payment_methods', pms);
|
|
4552
4738
|
this.pubsub.publish('account');
|
|
4553
4739
|
}
|
|
4554
4740
|
|
|
@@ -4747,6 +4933,14 @@ class Store {
|
|
|
4747
4933
|
};
|
|
4748
4934
|
}
|
|
4749
4935
|
|
|
4936
|
+
fetchOrder(id) {
|
|
4937
|
+
return this.api.getOrder(id);
|
|
4938
|
+
}
|
|
4939
|
+
|
|
4940
|
+
lookupOrder(key) {
|
|
4941
|
+
return this.api.lookupOrder(key);
|
|
4942
|
+
}
|
|
4943
|
+
|
|
4750
4944
|
createPostback(cid, postback) {
|
|
4751
4945
|
return this.api.createPostback(cid, postback);
|
|
4752
4946
|
}
|
|
@@ -4809,6 +5003,19 @@ class Store {
|
|
|
4809
5003
|
|
|
4810
5004
|
this.onWs(ret);
|
|
4811
5005
|
sendEventToThirdParty('SUBIZ Chat', 'Sent', 'User');
|
|
5006
|
+
let lastMsgSent = this.kv.match('last_msg_sent');
|
|
5007
|
+
|
|
5008
|
+
if (!lastMsgSent) {
|
|
5009
|
+
let dataLayer = window.dataLayer || [];
|
|
5010
|
+
dataLayer.push({
|
|
5011
|
+
event: 'SUBIZ Chat',
|
|
5012
|
+
event_action: 'Sent',
|
|
5013
|
+
event_label: 'User',
|
|
5014
|
+
first_interaction: 1
|
|
5015
|
+
});
|
|
5016
|
+
}
|
|
5017
|
+
|
|
5018
|
+
this.kv.put('last_msg_sent', util/* default.Date.now */.Z.Date.now());
|
|
4812
5019
|
}
|
|
4813
5020
|
|
|
4814
5021
|
_setConvo(convo) {
|
|
@@ -4942,7 +5149,7 @@ class Store {
|
|
|
4942
5149
|
|
|
4943
5150
|
async loopTime() {
|
|
4944
5151
|
let startms = util/* default.Date.now */.Z.Date.now();
|
|
4945
|
-
if (!util/* default.get */.Z.get(this.kv.match('user'), 'id')) return setTimeout(() => this.loopTime(),
|
|
5152
|
+
if (!util/* default.get */.Z.get(this.kv.match('user'), 'id')) return setTimeout(() => this.loopTime(), 120000);
|
|
4946
5153
|
let {
|
|
4947
5154
|
body: t,
|
|
4948
5155
|
error
|
|
@@ -4952,7 +5159,7 @@ class Store {
|
|
|
4952
5159
|
var serverMs = new util/* default.Date */.Z.Date(t).getTime() + latences;
|
|
4953
5160
|
var localMs = util/* default.Date.now */.Z.Date.now();
|
|
4954
5161
|
this.timeDiff = Math.floor(serverMs - localMs);
|
|
4955
|
-
setTimeout(() => this.loopTime(),
|
|
5162
|
+
setTimeout(() => this.loopTime(), 120000);
|
|
4956
5163
|
}
|
|
4957
5164
|
|
|
4958
5165
|
replaceFileUrl(src) {
|
|
@@ -5107,6 +5314,12 @@ function sendEventToThirdParty(category, action, label) {
|
|
|
5107
5314
|
}));
|
|
5108
5315
|
sendToGA(category, action, label);
|
|
5109
5316
|
sendToFBPixel(category, action, label);
|
|
5317
|
+
let dataLayer = window.dataLayer || [];
|
|
5318
|
+
dataLayer.push({
|
|
5319
|
+
event: category,
|
|
5320
|
+
event_action: action,
|
|
5321
|
+
event_label: label
|
|
5322
|
+
});
|
|
5110
5323
|
}
|
|
5111
5324
|
|
|
5112
5325
|
let mobileCheck = function (a) {
|
|
@@ -5114,30 +5327,30 @@ let mobileCheck = function (a) {
|
|
|
5114
5327
|
}(navigator.userAgent || navigator.vendor || window.opera);
|
|
5115
5328
|
|
|
5116
5329
|
let tabletCheck = /(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(navigator.userAgent);
|
|
5330
|
+
// EXTERNAL MODULE: ./src/common.js
|
|
5331
|
+
var common = __webpack_require__(2493);
|
|
5117
5332
|
// EXTERNAL MODULE: ./node_modules/preact/dist/preact.module.js
|
|
5118
5333
|
var preact_module = __webpack_require__(6400);
|
|
5119
5334
|
;// CONCATENATED MODULE: ./src/plugin.js
|
|
5120
5335
|
|
|
5121
5336
|
|
|
5122
5337
|
|
|
5123
|
-
const LoadChatbox = () => __webpack_require__.e(/* import() */ 74).then(__webpack_require__.bind(__webpack_require__, 1074));
|
|
5124
5338
|
|
|
5125
|
-
const
|
|
5339
|
+
const LoadChatbox = () => __webpack_require__.e(/* import() */ 132).then(__webpack_require__.bind(__webpack_require__, 8132));
|
|
5340
|
+
|
|
5341
|
+
const LoadContact = () => __webpack_require__.e(/* import() */ 335).then(__webpack_require__.bind(__webpack_require__, 2335));
|
|
5126
5342
|
|
|
5127
5343
|
const LoadPopup = () => __webpack_require__.e(/* import() */ 213).then(__webpack_require__.bind(__webpack_require__, 8213));
|
|
5128
5344
|
|
|
5129
5345
|
const LoadNotif = () => __webpack_require__.e(/* import() */ 605).then(__webpack_require__.bind(__webpack_require__, 9605));
|
|
5130
5346
|
|
|
5131
|
-
let langMessages = {};
|
|
5132
|
-
let downloadLock = false;
|
|
5133
|
-
|
|
5134
5347
|
function Plugin(plugin, store, $container, lib) {
|
|
5135
5348
|
if (!$container) throw '$div must is a valid html node';
|
|
5136
5349
|
var $div = document.createElement('div');
|
|
5137
5350
|
$div.id = plugin.id;
|
|
5138
5351
|
$container.appendChild($div);
|
|
5139
5352
|
|
|
5140
|
-
let _locale = getLocale(plugin, util/* default.detectLang */.Z.detectLang());
|
|
5353
|
+
let _locale = common/* getLocale */.Kd(plugin, util/* default.detectLang */.Z.detectLang());
|
|
5141
5354
|
|
|
5142
5355
|
var domGate = new util/* default.Gate */.Z.Gate();
|
|
5143
5356
|
var pageIndex = 0;
|
|
@@ -5267,7 +5480,7 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5267
5480
|
|
|
5268
5481
|
let t = key => {
|
|
5269
5482
|
if (_locale === 'debug') return `{{${key}}}`;
|
|
5270
|
-
let messages = util/* default.get */.Z.get(langMessages, _locale, []);
|
|
5483
|
+
let messages = util/* default.get */.Z.get(common/* langMessages */.Rs, _locale, []);
|
|
5271
5484
|
let message = util/* default.find */.Z.find(messages, message => message.key === key);
|
|
5272
5485
|
return util/* default.get */.Z.get(message, 'message', key);
|
|
5273
5486
|
};
|
|
@@ -5287,7 +5500,7 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5287
5500
|
t.locale = () => _locale;
|
|
5288
5501
|
|
|
5289
5502
|
this.forceDownloadLanguage = async () => {
|
|
5290
|
-
await downloadLanguage(store, _locale, true);
|
|
5503
|
+
await common/* downloadLanguage */.WW(store, _locale, true);
|
|
5291
5504
|
this.update(plugin);
|
|
5292
5505
|
};
|
|
5293
5506
|
|
|
@@ -5297,8 +5510,8 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5297
5510
|
|
|
5298
5511
|
_render();
|
|
5299
5512
|
|
|
5300
|
-
_locale = getLocale(plugin, locale);
|
|
5301
|
-
await downloadLanguage(store, _locale);
|
|
5513
|
+
_locale = common/* getLocale */.Kd(plugin, locale);
|
|
5514
|
+
await common/* downloadLanguage */.WW(store, _locale);
|
|
5302
5515
|
this.t = t;
|
|
5303
5516
|
|
|
5304
5517
|
_render();
|
|
@@ -5334,7 +5547,7 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5334
5547
|
}
|
|
5335
5548
|
|
|
5336
5549
|
this.update(plugin);
|
|
5337
|
-
downloadLanguage(store, _locale).then(() => {
|
|
5550
|
+
common/* downloadLanguage */.WW(store, _locale).then(() => {
|
|
5338
5551
|
this.t = t;
|
|
5339
5552
|
this.update(plugin);
|
|
5340
5553
|
});
|
|
@@ -5478,36 +5691,6 @@ class PluginMgr {
|
|
|
5478
5691
|
}
|
|
5479
5692
|
|
|
5480
5693
|
}
|
|
5481
|
-
|
|
5482
|
-
function downloadLanguage(store, locale, force) {
|
|
5483
|
-
if (downloadLock) return new Promise(resolve => setTimeout(() => downloadLanguage(store, locale, force).then(resolve), 100));
|
|
5484
|
-
downloadLock = true;
|
|
5485
|
-
let messages;
|
|
5486
|
-
|
|
5487
|
-
if (locale === 'debug' || langMessages[locale] && !force) {
|
|
5488
|
-
downloadLock = false;
|
|
5489
|
-
return Promise.resolve();
|
|
5490
|
-
}
|
|
5491
|
-
|
|
5492
|
-
return store.getLocaleContent(locale).then(res => {
|
|
5493
|
-
downloadLock = false;
|
|
5494
|
-
messages = util/* default.get */.Z.get(res, 'body.messages', []);
|
|
5495
|
-
langMessages[locale] = messages;
|
|
5496
|
-
});
|
|
5497
|
-
}
|
|
5498
|
-
|
|
5499
|
-
const getLocale = (plugin, loc) => {
|
|
5500
|
-
if (!loc) loc = '';
|
|
5501
|
-
let found = util/* default.find */.Z.find(plugin.locales, l => l.toLowerCase().trim() === loc.toLowerCase().trim());
|
|
5502
|
-
if (found) return found;
|
|
5503
|
-
found = util/* default.find */.Z.find(plugin.locales, l => {
|
|
5504
|
-
l = l.replace('-', '_').split('_')[0].trim().toLowerCase();
|
|
5505
|
-
let compareloc = loc.replace('-', '_').split('_')[0].trim().toLowerCase();
|
|
5506
|
-
return l == compareloc;
|
|
5507
|
-
});
|
|
5508
|
-
if (found) return found;
|
|
5509
|
-
return plugin.locale || 'en-US';
|
|
5510
|
-
};
|
|
5511
5694
|
;// CONCATENATED MODULE: ./src/lib.js
|
|
5512
5695
|
function lib_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5513
5696
|
|