@subiz/widget-v4 4.0.91 → 4.0.92
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/compiled_src/chatbox/main.js +2 -3
- package/compiled_src/store/api.js +4 -1
- package/compiled_src/store/store.js +4 -9
- package/compiled_src/util/common.js +0 -5
- package/dist/132.js +405 -90
- package/dist/178.js +174 -341
- package/dist/18364d15f37.132.js +1 -0
- package/dist/18364d15f37.178.js +1 -0
- package/dist/{17f00e48d38.213.js → 18364d15f37.213.js} +1 -1
- package/dist/{17f00e48d38.335.js → 18364d15f37.335.js} +1 -1
- package/dist/18364d15f37.362.js +1 -0
- package/dist/18364d15f37.441.js +1 -0
- package/dist/{17f00e48d38.605.js → 18364d15f37.605.js} +0 -0
- package/dist/18364d15f37.678.js +1 -0
- package/dist/18364d15f37.782.js +1 -0
- package/dist/18364d15f37.app.js +1 -0
- package/dist/{17f00e48d38.index.html → 18364d15f37.index.html} +7 -3
- package/dist/{17f00e48d38.library.html → 18364d15f37.library.html} +7 -3
- package/dist/18364d15f37.library.js +1 -0
- package/dist/{17f00e48d38.preview.html → 18364d15f37.preview.html} +1 -1
- package/dist/18364d15f37.preview.js +1 -0
- package/dist/18364d15f37.screenshoot.js +1 -0
- package/dist/213.js +28 -1
- package/dist/335.js +2 -2
- package/dist/362.js +21 -71
- package/dist/441.js +202 -100
- package/dist/678.js +20 -70
- package/dist/782.js +21 -118
- package/dist/HASH +1 -1
- package/dist/screenshoot.html +1 -1
- package/dist/screenshoot.js +209 -175
- package/package.json +8 -8
- package/src/chatbox/main.js +3 -3
- package/src/store/api.js +1 -1
- package/src/store/store.js +7 -9
- package/src/util/common.js +0 -4
- package/dist/0b82fa7e5c3b07b40a44.png +0 -1
- package/dist/0f4af006e38ee8b93633.png +0 -1
- package/dist/17f00e48d38.132.js +0 -1
- package/dist/17f00e48d38.178.js +0 -1
- package/dist/17f00e48d38.362.js +0 -1
- package/dist/17f00e48d38.441.js +0 -1
- package/dist/17f00e48d38.678.js +0 -1
- package/dist/17f00e48d38.782.js +0 -1
- package/dist/17f00e48d38.app.js +0 -1
- package/dist/17f00e48d38.library.js +0 -1
- package/dist/17f00e48d38.preview.js +0 -1
- package/dist/17f00e48d38.screenshoot.js +0 -1
- package/dist/1ea1c6cd21d25176810c.png +0 -1
- package/dist/292d42404e1b03398f61.png +0 -1
- package/dist/312d376370831b7bea83.png +0 -1
- package/dist/313d1bfc1cf776d1aefe.png +0 -1
- package/dist/4aa58bb7a66bb44975aa.png +0 -1
- package/dist/56ce063bc6c81adb7322.png +0 -1
- package/dist/6a411166ef5cc79e0714.png +0 -1
- package/dist/6faf403782fefacc1649.png +0 -1
- package/dist/79dca33c68fab79c067f.png +0 -1
- package/dist/82da1578fa84f9debaeb.png +0 -1
- package/dist/8b8e0f0824743974b282.png +0 -1
- package/dist/8d551390d81e39130a3c.png +0 -1
- package/dist/9fc61b9479877ebdb6c7.png +0 -1
- package/dist/a165d31dcb3dc90f1057.png +0 -1
- package/dist/a98d4a5698812c4426b3.png +0 -1
- package/dist/c41606bf9d1b604e46d5.png +0 -1
- package/dist/ce1f7450ce6c1aacd330.png +0 -1
- package/dist/cf8c01e88f4770a6e3e5.png +0 -1
- package/dist/dfbcfeab1d5622a737e2.png +0 -1
- package/dist/e4893ed8c2f7b8329919.png +0 -1
- package/dist/ec2ab4eb4ef73d186186.png +0 -1
package/dist/screenshoot.js
CHANGED
|
@@ -1348,11 +1348,11 @@ function toString(obj) {
|
|
|
1348
1348
|
|
|
1349
1349
|
"use strict";
|
|
1350
1350
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1351
|
-
/* harmony export */ "up": () => (/* binding */ Com),
|
|
1352
|
-
/* harmony export */ "u$": () => (/* binding */ Clickaway),
|
|
1353
1351
|
/* harmony export */ "Kd": () => (/* binding */ getLocale),
|
|
1354
1352
|
/* harmony export */ "Rs": () => (/* binding */ langMessages),
|
|
1355
|
-
/* harmony export */ "WW": () => (/* binding */ downloadLanguage)
|
|
1353
|
+
/* harmony export */ "WW": () => (/* binding */ downloadLanguage),
|
|
1354
|
+
/* harmony export */ "u$": () => (/* binding */ Clickaway),
|
|
1355
|
+
/* harmony export */ "up": () => (/* binding */ Com)
|
|
1356
1356
|
/* harmony export */ });
|
|
1357
1357
|
/* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6400);
|
|
1358
1358
|
/* harmony import */ var _util_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(819);
|
|
@@ -1446,70 +1446,70 @@ function downloadLanguage(store, locale, force) {
|
|
|
1446
1446
|
"use strict";
|
|
1447
1447
|
__webpack_require__.r(__webpack_exports__);
|
|
1448
1448
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1449
|
-
/* harmony export */ "
|
|
1450
|
-
/* harmony export */ "
|
|
1449
|
+
/* harmony export */ "DEFVAL": () => (/* binding */ DEFVAL),
|
|
1450
|
+
/* harmony export */ "DEF_CHAT_BUTTON_BACKGROUND_IMAGE_URL": () => (/* binding */ DEF_CHAT_BUTTON_BACKGROUND_IMAGE_URL),
|
|
1451
1451
|
/* harmony export */ "Date": () => (/* binding */ Date),
|
|
1452
|
-
/* harmony export */ "
|
|
1453
|
-
/* harmony export */ "
|
|
1454
|
-
/* harmony export */ "
|
|
1452
|
+
/* harmony export */ "agentsOfConvo": () => (/* binding */ agentsOfConvo),
|
|
1453
|
+
/* harmony export */ "checkRunConditions": () => (/* binding */ checkRunConditions),
|
|
1454
|
+
/* harmony export */ "cloneDeep": () => (/* binding */ cloneDeep),
|
|
1455
1455
|
/* harmony export */ "convoOfEv": () => (/* binding */ convoOfEv),
|
|
1456
1456
|
/* harmony export */ "convoToEv": () => (/* binding */ convoToEv),
|
|
1457
|
-
/* harmony export */ "
|
|
1458
|
-
/* harmony export */ "
|
|
1459
|
-
/* harmony export */ "
|
|
1460
|
-
/* harmony export */ "cloneDeep": () => (/* binding */ cloneDeep),
|
|
1461
|
-
/* harmony export */ "randomString": () => (/* binding */ randomString),
|
|
1462
|
-
/* harmony export */ "filter": () => (/* binding */ filter),
|
|
1463
|
-
/* harmony export */ "includes": () => (/* binding */ includes),
|
|
1464
|
-
/* harmony export */ "map": () => (/* binding */ map),
|
|
1457
|
+
/* harmony export */ "detectLang": () => (/* binding */ detectLang),
|
|
1458
|
+
/* harmony export */ "diffDay": () => (/* binding */ diffDay),
|
|
1459
|
+
/* harmony export */ "diffYear": () => (/* binding */ diffYear),
|
|
1465
1460
|
/* harmony export */ "each": () => (/* binding */ each),
|
|
1466
|
-
/* harmony export */ "
|
|
1467
|
-
/* harmony export */ "isConvoSeen": () => (/* binding */ isConvoSeen),
|
|
1468
|
-
/* harmony export */ "agentsOfConvo": () => (/* binding */ agentsOfConvo),
|
|
1469
|
-
/* harmony export */ "startsWith": () => (/* binding */ startsWith),
|
|
1470
|
-
/* harmony export */ "size": () => (/* binding */ size),
|
|
1471
|
-
/* harmony export */ "replaceAll": () => (/* binding */ replaceAll),
|
|
1472
|
-
/* harmony export */ "trim": () => (/* binding */ trim),
|
|
1473
|
-
/* harmony export */ "trimStart": () => (/* binding */ trimStart),
|
|
1474
|
-
/* harmony export */ "throttle": () => (/* binding */ throttle),
|
|
1461
|
+
/* harmony export */ "filter": () => (/* binding */ filter),
|
|
1475
1462
|
/* harmony export */ "find": () => (/* binding */ find),
|
|
1476
|
-
/* harmony export */ "
|
|
1463
|
+
/* harmony export */ "formatCurrency": () => (/* binding */ formatCurrency),
|
|
1464
|
+
/* harmony export */ "getAgentDisplayName": () => (/* binding */ getAgentDisplayName),
|
|
1465
|
+
/* harmony export */ "getDayName": () => (/* binding */ getDayName),
|
|
1477
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),
|
|
1478
1475
|
/* harmony export */ "isPhone": () => (/* binding */ isPhone),
|
|
1479
1476
|
/* harmony export */ "isURL": () => (/* binding */ isURL),
|
|
1480
|
-
/* harmony export */ "isNumber": () => (/* binding */ isNumber),
|
|
1481
|
-
/* harmony export */ "isEmail": () => (/* binding */ isEmail),
|
|
1482
|
-
/* harmony export */ "last": () => (/* binding */ last),
|
|
1483
|
-
/* harmony export */ "getAgentDisplayName": () => (/* binding */ getAgentDisplayName),
|
|
1484
1477
|
/* harmony export */ "isUserBanned": () => (/* binding */ isUserBanned),
|
|
1485
|
-
/* harmony export */ "setUserAttr": () => (/* binding */ setUserAttr),
|
|
1486
|
-
/* harmony export */ "getUserAttr": () => (/* binding */ getUserAttr),
|
|
1487
|
-
/* harmony export */ "norm": () => (/* binding */ norm),
|
|
1488
|
-
/* harmony export */ "noop": () => (/* binding */ noop),
|
|
1489
|
-
/* harmony export */ "replaceCssVariablePlugin": () => (/* binding */ replaceCssVariablePlugin),
|
|
1490
|
-
/* harmony export */ "replaceCssVariable": () => (/* binding */ replaceCssVariable),
|
|
1491
|
-
/* harmony export */ "tokenize": () => (/* binding */ tokenize),
|
|
1492
|
-
/* harmony export */ "setCss": () => (/* binding */ setCss),
|
|
1493
|
-
/* harmony export */ "DEF_CHAT_BUTTON_BACKGROUND_IMAGE_URL": () => (/* binding */ DEF_CHAT_BUTTON_BACKGROUND_IMAGE_URL),
|
|
1494
|
-
/* harmony export */ "DEFVAL": () => (/* binding */ DEFVAL),
|
|
1495
1478
|
/* harmony export */ "js2css": () => (/* binding */ js2css),
|
|
1496
|
-
/* harmony export */ "
|
|
1497
|
-
/* harmony export */ "
|
|
1498
|
-
/* harmony export */ "
|
|
1499
|
-
/* 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),
|
|
1500
1484
|
/* harmony export */ "offsetToMin": () => (/* binding */ offsetToMin),
|
|
1501
|
-
/* harmony export */ "
|
|
1502
|
-
/* 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),
|
|
1503
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),
|
|
1504
1501
|
/* harmony export */ "shortTime": () => (/* binding */ shortTime),
|
|
1505
|
-
/* harmony export */ "
|
|
1506
|
-
/* harmony export */ "getMs": () => (/* binding */ getMs),
|
|
1507
|
-
/* harmony export */ "detectLang": () => (/* binding */ detectLang),
|
|
1508
|
-
/* harmony export */ "getUrlParameter": () => (/* binding */ getUrlParameter),
|
|
1502
|
+
/* harmony export */ "size": () => (/* binding */ size),
|
|
1509
1503
|
/* harmony export */ "sleep": () => (/* binding */ sleep),
|
|
1510
|
-
/* 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),
|
|
1511
1510
|
/* harmony export */ "unicodeToAscii": () => (/* binding */ unicodeToAscii),
|
|
1512
|
-
/* harmony export */ "
|
|
1511
|
+
/* harmony export */ "unixSec": () => (/* binding */ unixSec),
|
|
1512
|
+
/* harmony export */ "usersOfConvo": () => (/* binding */ usersOfConvo)
|
|
1513
1513
|
/* harmony export */ });
|
|
1514
1514
|
var op = __webpack_require__(6877);
|
|
1515
1515
|
|
|
@@ -1837,7 +1837,7 @@ function isURL(url) {
|
|
|
1837
1837
|
return re.test(String(url).toLowerCase());
|
|
1838
1838
|
}
|
|
1839
1839
|
function isNumber(num) {
|
|
1840
|
-
var
|
|
1840
|
+
var re = /^\d+$/;
|
|
1841
1841
|
return re.test(String(num));
|
|
1842
1842
|
}
|
|
1843
1843
|
function isEmail(email) {
|
|
@@ -2150,10 +2150,9 @@ function osName() {
|
|
|
2150
2150
|
function check_frequently(freq, lastrun, store) {
|
|
2151
2151
|
if (!lastrun) return true;
|
|
2152
2152
|
if (op.get(freq, 'once_per_user')) return false;
|
|
2153
|
-
var session = store.matchSession() || {};
|
|
2154
2153
|
|
|
2155
2154
|
if (op.get(freq, 'once_per_session')) {
|
|
2156
|
-
if (lastrun.
|
|
2155
|
+
if (sameDay(lastrun.created, Date.now())) return false;
|
|
2157
2156
|
}
|
|
2158
2157
|
|
|
2159
2158
|
if (op.get(freq, 'interval_sec')) {
|
|
@@ -2166,7 +2165,7 @@ function check_frequently(freq, lastrun, store) {
|
|
|
2166
2165
|
|
|
2167
2166
|
function checkRunConditions(freq, conds, lastrun, store) {
|
|
2168
2167
|
var acc = store.matchAccount() || {};
|
|
2169
|
-
var
|
|
2168
|
+
var location = store.matchLocation() || {};
|
|
2170
2169
|
if (!check_frequently(freq, lastrun, store)) return false;
|
|
2171
2170
|
|
|
2172
2171
|
for (var i = 0; i < size(conds); i++) {
|
|
@@ -2206,15 +2205,15 @@ function checkRunConditions(freq, conds, lastrun, store) {
|
|
|
2206
2205
|
if (size(cond.exclude_locations) > 0) {
|
|
2207
2206
|
let found = find(cond.exclude_locations, loc => {
|
|
2208
2207
|
if (loc.city_name && loc.country_code) {
|
|
2209
|
-
if (loc.city_name ===
|
|
2208
|
+
if (loc.city_name === location.city_name && loc.country_code === location.country_code) return true;
|
|
2210
2209
|
}
|
|
2211
2210
|
|
|
2212
2211
|
if (loc.city_name && !loc.country_code) {
|
|
2213
|
-
if (loc.city_name ===
|
|
2212
|
+
if (loc.city_name === location.city_name) return true;
|
|
2214
2213
|
}
|
|
2215
2214
|
|
|
2216
2215
|
if (!loc.city_name && loc.country_code) {
|
|
2217
|
-
if (loc.country_code ===
|
|
2216
|
+
if (loc.country_code === location.country_code) return true;
|
|
2218
2217
|
}
|
|
2219
2218
|
});
|
|
2220
2219
|
if (found) return false;
|
|
@@ -2223,15 +2222,15 @@ function checkRunConditions(freq, conds, lastrun, store) {
|
|
|
2223
2222
|
if (size(cond.locations) > 0) {
|
|
2224
2223
|
let found = find(cond.locations, loc => {
|
|
2225
2224
|
if (loc.city_name && loc.country_code) {
|
|
2226
|
-
if (loc.city_name ===
|
|
2225
|
+
if (loc.city_name === location.city_name && loc.country_code === location.country_code) return true;
|
|
2227
2226
|
}
|
|
2228
2227
|
|
|
2229
2228
|
if (loc.city_name && !loc.country_code) {
|
|
2230
|
-
if (loc.city_name ===
|
|
2229
|
+
if (loc.city_name === location.city_name) return true;
|
|
2231
2230
|
}
|
|
2232
2231
|
|
|
2233
2232
|
if (!loc.city_name && loc.country_code) {
|
|
2234
|
-
if (loc.country_code ===
|
|
2233
|
+
if (loc.country_code === location.country_code) return true;
|
|
2235
2234
|
}
|
|
2236
2235
|
});
|
|
2237
2236
|
if (!found) return false;
|
|
@@ -2295,7 +2294,8 @@ function checkRunConditions(freq, conds, lastrun, store) {
|
|
|
2295
2294
|
|
|
2296
2295
|
case 'source':
|
|
2297
2296
|
if (size(cond.sources) > 0) {
|
|
2298
|
-
|
|
2297
|
+
let source = store.matchTrafficSource() || 'direct';
|
|
2298
|
+
if (!find(cond.sources, src => norm(src) === norm(source))) return false;
|
|
2299
2299
|
}
|
|
2300
2300
|
|
|
2301
2301
|
break;
|
|
@@ -2869,7 +2869,9 @@ function trackInactivity(seconds, cb) {
|
|
|
2869
2869
|
}
|
|
2870
2870
|
}
|
|
2871
2871
|
let timeOnPage = 0;
|
|
2872
|
-
setInterval(() =>
|
|
2872
|
+
setInterval(() => {
|
|
2873
|
+
timeOnPage += 5;
|
|
2874
|
+
}, 5000);
|
|
2873
2875
|
function trackTimeOnPage(seconds, cb) {
|
|
2874
2876
|
if (seconds < 1) {
|
|
2875
2877
|
return setTimeout(function () {
|
|
@@ -3206,14 +3208,14 @@ class Pubsub {
|
|
|
3206
3208
|
|
|
3207
3209
|
"use strict";
|
|
3208
3210
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3209
|
-
/* harmony export */ "
|
|
3210
|
-
/* harmony export */ "
|
|
3211
|
-
/* harmony export */ "
|
|
3212
|
-
/* harmony export */ "
|
|
3213
|
-
/* harmony export */ "wA": () => (/* binding */
|
|
3211
|
+
/* harmony export */ "HY": () => (/* binding */ p),
|
|
3212
|
+
/* harmony export */ "Vf": () => (/* binding */ y),
|
|
3213
|
+
/* harmony export */ "h": () => (/* binding */ h),
|
|
3214
|
+
/* harmony export */ "sY": () => (/* binding */ P),
|
|
3215
|
+
/* harmony export */ "wA": () => (/* binding */ d)
|
|
3214
3216
|
/* harmony export */ });
|
|
3215
|
-
/* unused harmony exports
|
|
3216
|
-
var n,l,u,i,t,o,r,f
|
|
3217
|
+
/* unused harmony exports cloneElement, createContext, createElement, hydrate, isValidElement, options, toChildArray */
|
|
3218
|
+
var n,l,u,i,t,o,r,f={},e=[],c=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s(n,l){for(var u in l)n[u]=l[u];return n}function a(n){var l=n.parentNode;l&&l.removeChild(n)}function h(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return v(l,f,t,o,null)}function v(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u:r};return null==r&&null!=l.vnode&&l.vnode(f),f}function y(){return{current:null}}function p(n){return n.children}function d(n,l){this.props=n,this.context=l}function _(n,l){if(null==l)return n.__?_(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return"function"==typeof n.type?_(n):null}function k(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return k(n)}}function b(n){(!n.__d&&(n.__d=!0)&&t.push(n)&&!g.__r++||o!==l.debounceRendering)&&((o=l.debounceRendering)||setTimeout)(g)}function g(){for(var n;g.__r=t.length;)n=t.sort(function(n,l){return n.__v.__b-l.__v.__b}),t=[],n.some(function(n){var l,u,i,t,o,r;n.__d&&(o=(t=(l=n).__v).__e,(r=l.__P)&&(u=[],(i=s({},t)).__v=t.__v+1,j(r,t,i,l.__n,void 0!==r.ownerSVGElement,null!=t.__h?[o]:null,u,null==o?_(t):o,t.__h),z(u,t),t.__e!=o&&k(t)))})}function w(n,l,u,i,t,o,r,c,s,a){var h,y,d,k,b,g,w,x=i&&i.__k||e,C=x.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(k=u.__k[h]=null==(k=l[h])||"boolean"==typeof k?null:"string"==typeof k||"number"==typeof k||"bigint"==typeof k?v(null,k,null,null,k):Array.isArray(k)?v(p,{children:k},null,null,null):k.__b>0?v(k.type,k.props,k.key,k.ref?k.ref:null,k.__v):k)){if(k.__=u,k.__b=u.__b+1,null===(d=x[h])||d&&k.key==d.key&&k.type===d.type)x[h]=void 0;else for(y=0;y<C;y++){if((d=x[y])&&k.key==d.key&&k.type===d.type){x[y]=void 0;break}d=null}j(n,k,d=d||f,t,o,r,c,s,a),b=k.__e,(y=k.ref)&&d.ref!=y&&(w||(w=[]),d.ref&&w.push(d.ref,null,k),w.push(y,k.__c||b,k)),null!=b?(null==g&&(g=b),"function"==typeof k.type&&k.__k===d.__k?k.__d=s=m(k,s,n):s=A(n,k,d,x,b,s),"function"==typeof u.type&&(u.__d=s)):s&&d.__e==s&&s.parentNode!=n&&(s=_(d))}for(u.__e=g,h=C;h--;)null!=x[h]&&("function"==typeof u.type&&null!=x[h].__e&&x[h].__e==u.__d&&(u.__d=_(i,h+1)),N(x[h],x[h]));if(w)for(h=0;h<w.length;h++)M(w[h],w[++h],w[++h])}function m(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l="function"==typeof i.type?m(i,l,u):A(u,i,i,t,i.__e,l));return l}function x(n,l){return l=l||[],null==n||"boolean"==typeof n||(Array.isArray(n)?n.some(function(n){x(n,l)}):l.push(n)),l}function A(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else{for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=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||c.test(l)?u:u+"px"}function H(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else{if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||$(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||$(n.style,l,u[l])}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?T:I,o):n.removeEventListener(l,o?T:I,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null!=u&&(!1!==u||"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 a,h,v,y,_,k,b,g,m,x,A,C,$,H=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(a=l.__b)&&a(u);try{n:if("function"==typeof H){if(g=u.props,m=(a=H.contextType)&&t[a.__c],x=a?m?m.props.value:a.__:t,i.__c?b=(h=u.__c=i.__c).__=h.__E:("prototype"in H&&H.prototype.render?u.__c=h=new H(g,x):(u.__c=h=new d(g,x),h.constructor=H,h.render=O),m&&m.sub(h),h.props=g,h.state||(h.state={}),h.context=x,h.__n=t,v=h.__d=!0,h.__h=[]),null==h.__s&&(h.__s=h.state),null!=H.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=s({},h.__s)),s(h.__s,H.getDerivedStateFromProps(g,h.__s))),y=h.props,_=h.state,v)null==H.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(null==H.getDerivedStateFromProps&&g!==y&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(g,x),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(g,h.__s,x)||u.__v===i.__v){h.props=g,h.state=h.__s,u.__v!==i.__v&&(h.__d=!1),h.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u)}),h.__h.length&&f.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(g,h.__s,x),null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(y,_,k)})}if(h.context=x,h.props=g,h.__v=u,h.__P=n,A=l.__r,C=0,"prototype"in H&&H.prototype.render)h.state=h.__s,h.__d=!1,A&&A(u),a=h.render(h.props,h.state,h.context);else do{h.__d=!1,A&&A(u),a=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&++C<25);h.state=h.__s,null!=h.getChildContext&&(t=s(s({},t),h.getChildContext())),v||null==h.getSnapshotBeforeUpdate||(k=h.getSnapshotBeforeUpdate(y,_)),$=null!=a&&a.type===p&&null==a.key?a.props.children:a,w(n,Array.isArray($)?$:[$],u,i,t,o,r,f,e,c),h.base=u.__e,u.__h=null,h.__h.length&&f.push(h),b&&(h.__E=h.__=null),h.__e=!1}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=L(i.__e,u,i,t,o,r,f,c);(a=l.diffed)&&a(u)}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l.__e(n,u,i)}}function z(n,u){l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u)})}catch(n){l.__e(n,u.__v)}})}function L(l,u,i,t,o,r,e,c){var s,h,v,y=i.props,p=u.props,d=u.type,k=0;if("svg"===d&&(o=!0),null!=r)for(;k<r.length;k++)if((s=r[k])&&"setAttribute"in s==!!d&&(d?s.localName===d:3===s.nodeType)){l=s,r[k]=null;break}if(null==l){if(null===d)return document.createTextNode(p);l=o?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,p.is&&p),r=null,c=!1}if(null===d)y===p||c&&l.data===p||(l.data=p);else{if(r=r&&n.call(l.childNodes),h=(y=i.props||f).dangerouslySetInnerHTML,v=p.dangerouslySetInnerHTML,!c){if(null!=r)for(y={},k=0;k<l.attributes.length;k++)y[l.attributes[k].name]=l.attributes[k].value;(v||h)&&(v&&(h&&v.__html==h.__html||v.__html===l.innerHTML)||(l.innerHTML=v&&v.__html||""))}if(C(l,p,y,o,c),v)u.__k=[];else if(k=u.props.children,w(l,Array.isArray(k)?k:[k],u,i,t,o&&"foreignObject"!==d,r,e,r?r[0]:i.__k&&_(i,0),c),null!=r)for(k=r.length;k--;)null!=r[k]&&a(r[k]);c||("value"in p&&void 0!==(k=p.value)&&(k!==l.value||"progress"===d&&!k||"option"===d&&k!==y.value)&&H(l,"value",k,y.value,!1),"checked"in p&&void 0!==(k=p.checked)&&k!==l.checked&&H(l,"checked",k,y.checked,!1))}return l}function M(n,u,i){try{"function"==typeof n?n(u):n.current=u}catch(n){l.__e(n,i)}}function N(n,u,i){var t,o;if(l.unmount&&l.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||M(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount()}catch(n){l.__e(n,u)}t.base=t.__P=null,n.__c=void 0}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&N(t[o],u,"function"!=typeof n.type);i||null==n.__e||a(n.__e),n.__=n.__e=n.__d=void 0}function O(n,l,u){return this.constructor(n,u)}function P(u,i,t){var o,r,e;l.__&&l.__(u,i),r=(o="function"==typeof t)?null:t&&t.__k||i.__k,e=[],j(i,u=(!o&&t||i).__k=h(p,null,[u]),r||f,f,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n.call(i.childNodes):null,e,!o&&t?t:r?r.__e:i.firstChild,o),z(e,u)}function S(n,l){P(n,l,S)}function q(l,u,i){var t,o,r,f=s({},l.props);for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];return arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),v(l.type,f,t||l.key,o||l.ref,null)}function B(n,l){var u={__c:l="__cC"+r++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,i;return this.getChildContext||(u=[],(i={})[l]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(b)},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n)}}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=e.slice,l={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l}throw n}},u=0,i=function(n){return null!=n&&void 0===n.constructor},d.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=s({},this.state),"function"==typeof n&&(n=n(s({},u),this.props)),n&&s(u,n),null!=n&&this.__v&&(l&&this.__h.push(l),b(this))},d.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),b(this))},d.prototype.render=p,t=[],g.__r=0,r=0;
|
|
3217
3219
|
//# sourceMappingURL=preact.module.js.map
|
|
3218
3220
|
|
|
3219
3221
|
|
|
@@ -3364,7 +3366,7 @@ var n,l,u,i,t,o,r,f,e={},c=[],s=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[c
|
|
|
3364
3366
|
/******/
|
|
3365
3367
|
/******/ /* webpack/runtime/jsonp chunk loading */
|
|
3366
3368
|
/******/ (() => {
|
|
3367
|
-
/******/
|
|
3369
|
+
/******/ // no baseURI
|
|
3368
3370
|
/******/
|
|
3369
3371
|
/******/ // object to store loaded and loading chunks
|
|
3370
3372
|
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
|
@@ -3528,6 +3530,23 @@ function jsonifyTextPlain(param, done) {
|
|
|
3528
3530
|
|
|
3529
3531
|
_defineProperty(this, "sendTyping", cid => this.apireq.post(`/conversations/${cid}/typing`));
|
|
3530
3532
|
|
|
3533
|
+
_defineProperty(this, "sendPresence", (device, is_focused, productid, source_id, sku) => this.sendEvent({
|
|
3534
|
+
by: {
|
|
3535
|
+
id: this.uid,
|
|
3536
|
+
device: device
|
|
3537
|
+
},
|
|
3538
|
+
type: 'presence_updated',
|
|
3539
|
+
data: {
|
|
3540
|
+
presence: {
|
|
3541
|
+
viewing_product_sku: sku,
|
|
3542
|
+
viewing_product_source_id: source_id,
|
|
3543
|
+
viewing_product_id: productid,
|
|
3544
|
+
pinged: util/* default.Date.now */.Z.Date.now(),
|
|
3545
|
+
is_focused
|
|
3546
|
+
}
|
|
3547
|
+
}
|
|
3548
|
+
}));
|
|
3549
|
+
|
|
3531
3550
|
_defineProperty(this, "uploadToS3", async file => {
|
|
3532
3551
|
let {
|
|
3533
3552
|
body: signed,
|
|
@@ -3618,23 +3637,9 @@ function jsonifyTextPlain(param, done) {
|
|
|
3618
3637
|
this.uid = obj.uid;
|
|
3619
3638
|
}
|
|
3620
3639
|
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
id: this.uid,
|
|
3625
|
-
device: device
|
|
3626
|
-
},
|
|
3627
|
-
type: 'presence_updated',
|
|
3628
|
-
data: {
|
|
3629
|
-
presence: {
|
|
3630
|
-
pinged: util/* default.Date.now */.Z.Date.now(),
|
|
3631
|
-
is_focused
|
|
3632
|
-
}
|
|
3633
|
-
}
|
|
3634
|
-
});
|
|
3635
|
-
}
|
|
3636
|
-
|
|
3637
|
-
sendContent(device, pageUrl, pageTitle) {
|
|
3640
|
+
sendContentView(device, pageUrl, pageTitle, id, source_id, sku) {
|
|
3641
|
+
if (!id) id = undefined;
|
|
3642
|
+
if (!source_id) source_id = undefined;
|
|
3638
3643
|
return this.sendEvent({
|
|
3639
3644
|
by: {
|
|
3640
3645
|
id: this.uid,
|
|
@@ -3643,9 +3648,12 @@ function jsonifyTextPlain(param, done) {
|
|
|
3643
3648
|
type: 'content_viewed',
|
|
3644
3649
|
data: {
|
|
3645
3650
|
product: {
|
|
3651
|
+
id: id,
|
|
3652
|
+
source_id: source_id,
|
|
3646
3653
|
url: pageUrl,
|
|
3647
3654
|
name: pageTitle,
|
|
3648
|
-
title: pageTitle
|
|
3655
|
+
title: pageTitle,
|
|
3656
|
+
sku: sku
|
|
3649
3657
|
}
|
|
3650
3658
|
}
|
|
3651
3659
|
});
|
|
@@ -3847,30 +3855,6 @@ function makeFakeConvo(accid, convoid, userid, agentid) {
|
|
|
3847
3855
|
id: inteid
|
|
3848
3856
|
},
|
|
3849
3857
|
actived: 1610453070259,
|
|
3850
|
-
last_event: {
|
|
3851
|
-
id: 'evqyiykaoizbwnkaecwphttwk',
|
|
3852
|
-
account_id: accid,
|
|
3853
|
-
created: 1616213311830,
|
|
3854
|
-
type: 'message_sent',
|
|
3855
|
-
by: {
|
|
3856
|
-
id: userid,
|
|
3857
|
-
client_id: 'clsubizapi',
|
|
3858
|
-
type: 'user'
|
|
3859
|
-
},
|
|
3860
|
-
data: {
|
|
3861
|
-
message: {
|
|
3862
|
-
conversation_id: convoid,
|
|
3863
|
-
text: 'ok cám ơn!',
|
|
3864
|
-
format: 'plaintext',
|
|
3865
|
-
integration_id: inteid,
|
|
3866
|
-
pongs: [{
|
|
3867
|
-
member_id: userid,
|
|
3868
|
-
type: 'seen',
|
|
3869
|
-
created: 1616213312110
|
|
3870
|
-
}]
|
|
3871
|
-
}
|
|
3872
|
-
}
|
|
3873
|
-
},
|
|
3874
3858
|
last_message_sent: {
|
|
3875
3859
|
id: 'evqyiykaoizbwnkaecwphttwk',
|
|
3876
3860
|
account_id: accid,
|
|
@@ -4188,6 +4172,8 @@ class Store {
|
|
|
4188
4172
|
|
|
4189
4173
|
store_defineProperty(this, "cookie", cookie);
|
|
4190
4174
|
|
|
4175
|
+
store_defineProperty(this, "_currentViewingProduct", {});
|
|
4176
|
+
|
|
4191
4177
|
store_defineProperty(this, "new_visitor", true);
|
|
4192
4178
|
|
|
4193
4179
|
store_defineProperty(this, "matchUser", () => {
|
|
@@ -4198,8 +4184,6 @@ class Store {
|
|
|
4198
4184
|
|
|
4199
4185
|
store_defineProperty(this, "suggest_addresses", keyword => this.api.suggest_address(keyword));
|
|
4200
4186
|
|
|
4201
|
-
store_defineProperty(this, "matchSession", () => this.kv.match('session') || {});
|
|
4202
|
-
|
|
4203
4187
|
store_defineProperty(this, "matchAccount", () => this.cache.match('account'));
|
|
4204
4188
|
|
|
4205
4189
|
store_defineProperty(this, "matchPaymentMethods", () => this.cache.match('payment_methods'));
|
|
@@ -4291,6 +4275,8 @@ class Store {
|
|
|
4291
4275
|
};
|
|
4292
4276
|
});
|
|
4293
4277
|
|
|
4278
|
+
store_defineProperty(this, "matchLocation", () => this.cache.match('location') || {});
|
|
4279
|
+
|
|
4294
4280
|
store_defineProperty(this, "matchBot", () => this.cache.match('bot') || {});
|
|
4295
4281
|
|
|
4296
4282
|
store_defineProperty(this, "readyGate", new util/* default.Gate */.Z.Gate());
|
|
@@ -4311,14 +4297,18 @@ class Store {
|
|
|
4311
4297
|
await this.readyGate.entry();
|
|
4312
4298
|
if (!util/* default.get */.Z.get(this.kv.match('user'), 'id')) return;
|
|
4313
4299
|
if (util/* default.isUserBanned */.Z.isUserBanned(this.kv.match('user'))) return;
|
|
4314
|
-
return this.api.sendPresence(this.device, this.browserVisibility === 'visible' && document.hasFocus());
|
|
4300
|
+
return this.api.sendPresence(this.device, this.browserVisibility === 'visible' && document.hasFocus(), this._currentViewingProduct.id, this._currentViewingProduct.source_id, this._currentViewingProduct.sku);
|
|
4315
4301
|
}, 1000));
|
|
4316
4302
|
|
|
4317
4303
|
store_defineProperty(this, "now", () => util/* default.Date.now */.Z.Date.now() + this.timeDiff);
|
|
4318
4304
|
|
|
4319
4305
|
store_defineProperty(this, "seenQueue", []);
|
|
4320
4306
|
|
|
4321
|
-
store_defineProperty(this, "
|
|
4307
|
+
store_defineProperty(this, "matchTrafficSource", () => this.kv.match('traffic_source'));
|
|
4308
|
+
|
|
4309
|
+
store_defineProperty(this, "_typing", util/* default.throttle */.Z.throttle(convoid => this.api.sendTyping(convoid), 3000, {
|
|
4310
|
+
trailing: false
|
|
4311
|
+
}));
|
|
4322
4312
|
|
|
4323
4313
|
store_defineProperty(this, "onConvoEvent", (o, cb) => this.pubsub.on2(o, 'events', cb));
|
|
4324
4314
|
|
|
@@ -4338,7 +4328,10 @@ class Store {
|
|
|
4338
4328
|
store_defineProperty(this, "setIsOpen", isopen => {
|
|
4339
4329
|
let lastisopen = this.kv.match('isopen');
|
|
4340
4330
|
this.kv.put('isopen', isopen);
|
|
4341
|
-
|
|
4331
|
+
|
|
4332
|
+
if (!lastisopen && isopen) {
|
|
4333
|
+
sendEventToThirdParty('SUBIZ Chat', 'Opened', 'Subiz Windows');
|
|
4334
|
+
}
|
|
4342
4335
|
});
|
|
4343
4336
|
|
|
4344
4337
|
store_defineProperty(this, "closePreview", () => this.kv.put('close_preview_at', new util/* default.Date */.Z.Date().getTime()));
|
|
@@ -4374,7 +4367,8 @@ class Store {
|
|
|
4374
4367
|
this.g_haveSentSeenM = {};
|
|
4375
4368
|
window.addEventListener('blur', () => this.sendPresence());
|
|
4376
4369
|
window.addEventListener('focus', () => this.sendPresence());
|
|
4377
|
-
setInterval(() => this.sendPresence(),
|
|
4370
|
+
setInterval(() => this.browserVisibility === 'visible' && document.hasFocus() && this.sendPresence(), 20000);
|
|
4371
|
+
setInterval(() => (this.browserVisibility !== 'visible' || document.hasFocus()) && this.sendPresence(), 60000);
|
|
4378
4372
|
onVisibilityChange(val => {
|
|
4379
4373
|
this.browserVisibility = val;
|
|
4380
4374
|
this.sendPresence();
|
|
@@ -4403,8 +4397,23 @@ class Store {
|
|
|
4403
4397
|
}, 2000);
|
|
4404
4398
|
}
|
|
4405
4399
|
|
|
4400
|
+
linkProduct(p) {
|
|
4401
|
+
if (!p) {
|
|
4402
|
+
this._currentViewingProduct = {};
|
|
4403
|
+
return;
|
|
4404
|
+
}
|
|
4405
|
+
|
|
4406
|
+
if (p.id) this._currentViewingProduct.id = (p.id + '').trim();
|
|
4407
|
+
if (p.source_id) this._currentViewingProduct.source_id = (p.source_id + '').trim();
|
|
4408
|
+
if (p.sku) this._currentViewingProduct.sku = (p.sku + '').trim();
|
|
4409
|
+
}
|
|
4410
|
+
|
|
4411
|
+
getLinkedProduct() {
|
|
4412
|
+
return util/* default.cloneDeep */.Z.cloneDeep(this._currentViewingProduct);
|
|
4413
|
+
}
|
|
4414
|
+
|
|
4406
4415
|
isInsync(key) {
|
|
4407
|
-
return util/* default.Date.now */.Z.Date.now() - (this.g_sync[key] || 0) <
|
|
4416
|
+
return util/* default.Date.now */.Z.Date.now() - (this.g_sync[key] || 0) < 600000;
|
|
4408
4417
|
}
|
|
4409
4418
|
|
|
4410
4419
|
async fetchShippingAddresses() {
|
|
@@ -4448,7 +4457,9 @@ class Store {
|
|
|
4448
4457
|
platform: window.navigator.platform,
|
|
4449
4458
|
referrer: document.URL,
|
|
4450
4459
|
type: this.isMobile() ? 'mobile' : 'desktop',
|
|
4451
|
-
language: navigator.language
|
|
4460
|
+
language: navigator.language,
|
|
4461
|
+
page_url: document.URL,
|
|
4462
|
+
page_title: document.title
|
|
4452
4463
|
};
|
|
4453
4464
|
let ga_client_id = getGaClientId();
|
|
4454
4465
|
if (ga_client_id) device.ga_client_id = ga_client_id;
|
|
@@ -4673,24 +4684,6 @@ class Store {
|
|
|
4673
4684
|
|
|
4674
4685
|
if (setting.user) {
|
|
4675
4686
|
setting.user.account_id = setting.account.id;
|
|
4676
|
-
let oldsession = this.matchSession();
|
|
4677
|
-
let session = setting.user.session;
|
|
4678
|
-
|
|
4679
|
-
if (session) {
|
|
4680
|
-
if (session.id === oldsession.id) {
|
|
4681
|
-
session._urls = oldsession._urls;
|
|
4682
|
-
} else {}
|
|
4683
|
-
} else {
|
|
4684
|
-
session = oldsession;
|
|
4685
|
-
}
|
|
4686
|
-
|
|
4687
|
-
session._urls = session._urls || [];
|
|
4688
|
-
|
|
4689
|
-
session._urls.push(location.href);
|
|
4690
|
-
|
|
4691
|
-
while (session._urls.length > 1000) session._urls.shift();
|
|
4692
|
-
|
|
4693
|
-
this.kv.put('session', session);
|
|
4694
4687
|
delete setting.user.session;
|
|
4695
4688
|
|
|
4696
4689
|
this._setUser(setting.user);
|
|
@@ -4703,6 +4696,8 @@ class Store {
|
|
|
4703
4696
|
delete setting.account;
|
|
4704
4697
|
}
|
|
4705
4698
|
|
|
4699
|
+
let location = util/* default.get */.Z.get(setting, 'location', []);
|
|
4700
|
+
this.cache.put('location', location);
|
|
4706
4701
|
let bots = util/* default.get */.Z.get(setting, 'bots', []);
|
|
4707
4702
|
let botM = {};
|
|
4708
4703
|
util/* default.map */.Z.map(bots, bot => {
|
|
@@ -4737,7 +4732,9 @@ class Store {
|
|
|
4737
4732
|
|
|
4738
4733
|
async track() {
|
|
4739
4734
|
let user = this.kv.match('user') || {};
|
|
4740
|
-
await this.api.
|
|
4735
|
+
let out = await this.api.sendContentView(this.device, location.href, document.title, this._currentViewingProduct.id, this._currentViewingProduct.source_id, this._currentViewingProduct.sku);
|
|
4736
|
+
let traffic_source = util/* default.get */.Z.get(out, 'body.by.device.source', '');
|
|
4737
|
+
if (traffic_source) this.kv.put('traffic_source', traffic_source);
|
|
4741
4738
|
this.sendPresence();
|
|
4742
4739
|
}
|
|
4743
4740
|
|
|
@@ -4844,7 +4841,7 @@ class Store {
|
|
|
4844
4841
|
util/* default.map */.Z.map(pongs, pong => {
|
|
4845
4842
|
if (pong.member_id == user.id && pong.type === 'seen') {
|
|
4846
4843
|
let mem = util/* default.find */.Z.find(convo.members, mem => mem.id === user.id);
|
|
4847
|
-
mem.seen_at = pong.created;
|
|
4844
|
+
if (mem) mem.seen_at = pong.created;
|
|
4848
4845
|
}
|
|
4849
4846
|
});
|
|
4850
4847
|
this.chain.put(cid, oldev.id, util/* default.getMs */.Z.getMs(oldev.created), oldev);
|
|
@@ -4866,8 +4863,6 @@ class Store {
|
|
|
4866
4863
|
this.chain.put(cid, ev.id, util/* default.getMs */.Z.getMs(ev.created), ev);
|
|
4867
4864
|
}
|
|
4868
4865
|
|
|
4869
|
-
convo.last_event = ev;
|
|
4870
|
-
|
|
4871
4866
|
this._setConvo(convo);
|
|
4872
4867
|
|
|
4873
4868
|
this.pubsub.publish('account');
|
|
@@ -4951,9 +4946,7 @@ class Store {
|
|
|
4951
4946
|
by: {
|
|
4952
4947
|
id: user.id,
|
|
4953
4948
|
type: 'user',
|
|
4954
|
-
device:
|
|
4955
|
-
referrer: document.URL
|
|
4956
|
-
}
|
|
4949
|
+
device: this.device
|
|
4957
4950
|
},
|
|
4958
4951
|
data,
|
|
4959
4952
|
type,
|
|
@@ -5000,6 +4993,20 @@ class Store {
|
|
|
5000
4993
|
|
|
5001
4994
|
this.onWs(ret);
|
|
5002
4995
|
sendEventToThirdParty('SUBIZ Chat', 'Sent', 'User');
|
|
4996
|
+
let lastMsgSent = this.kv.match('last_msg_sent');
|
|
4997
|
+
|
|
4998
|
+
if (!lastMsgSent) {
|
|
4999
|
+
let dataLayer = window.dataLayer || [];
|
|
5000
|
+
dataLayer.push({
|
|
5001
|
+
event: 'SUBIZ Chat',
|
|
5002
|
+
event_action: 'Sent',
|
|
5003
|
+
event_label: 'User',
|
|
5004
|
+
first_interaction: 1
|
|
5005
|
+
});
|
|
5006
|
+
}
|
|
5007
|
+
|
|
5008
|
+
this.kv.put('last_msg_sent', util/* default.Date.now */.Z.Date.now());
|
|
5009
|
+
return ret;
|
|
5003
5010
|
}
|
|
5004
5011
|
|
|
5005
5012
|
_setConvo(convo) {
|
|
@@ -5040,12 +5047,10 @@ class Store {
|
|
|
5040
5047
|
}
|
|
5041
5048
|
|
|
5042
5049
|
logBotRun(botid) {
|
|
5043
|
-
let session = this.matchSession();
|
|
5044
5050
|
let log = this.kv.match('bot_run_logs') || {};
|
|
5045
5051
|
log[botid] = {
|
|
5046
5052
|
bot_id: botid,
|
|
5047
|
-
created: this.now()
|
|
5048
|
-
session_id: session.id
|
|
5053
|
+
created: this.now()
|
|
5049
5054
|
};
|
|
5050
5055
|
this.kv.put('bot_run_logs', log);
|
|
5051
5056
|
}
|
|
@@ -5053,11 +5058,9 @@ class Store {
|
|
|
5053
5058
|
sendImpression(id) {
|
|
5054
5059
|
let user = this.kv.match('user') || {};
|
|
5055
5060
|
let log = this.kv.match('plugin_run_logs') || {};
|
|
5056
|
-
let session = this.matchSession();
|
|
5057
5061
|
log[id] = {
|
|
5058
5062
|
web_plugin_id: id,
|
|
5059
|
-
created: this.now()
|
|
5060
|
-
session_id: session.id
|
|
5063
|
+
created: this.now()
|
|
5061
5064
|
};
|
|
5062
5065
|
this.kv.put('plugin_run_logs', log);
|
|
5063
5066
|
return this.api.sendImpression({
|
|
@@ -5066,8 +5069,7 @@ class Store {
|
|
|
5066
5069
|
web_plugin_id: id,
|
|
5067
5070
|
user_id: user.id,
|
|
5068
5071
|
url: window.location.href,
|
|
5069
|
-
device: this.device
|
|
5070
|
-
session_id: session.id
|
|
5072
|
+
device: this.device
|
|
5071
5073
|
});
|
|
5072
5074
|
}
|
|
5073
5075
|
|
|
@@ -5089,8 +5091,7 @@ class Store {
|
|
|
5089
5091
|
url: window.location.href,
|
|
5090
5092
|
device: this.device,
|
|
5091
5093
|
submission,
|
|
5092
|
-
impression_token: impressionToken
|
|
5093
|
-
session_id: this.matchSession().id
|
|
5094
|
+
impression_token: impressionToken
|
|
5094
5095
|
});
|
|
5095
5096
|
}
|
|
5096
5097
|
|
|
@@ -5133,7 +5134,7 @@ class Store {
|
|
|
5133
5134
|
|
|
5134
5135
|
async loopTime() {
|
|
5135
5136
|
let startms = util/* default.Date.now */.Z.Date.now();
|
|
5136
|
-
if (!util/* default.get */.Z.get(this.kv.match('user'), 'id')) return setTimeout(() => this.loopTime(),
|
|
5137
|
+
if (!util/* default.get */.Z.get(this.kv.match('user'), 'id')) return setTimeout(() => this.loopTime(), 240000);
|
|
5137
5138
|
let {
|
|
5138
5139
|
body: t,
|
|
5139
5140
|
error
|
|
@@ -5143,7 +5144,7 @@ class Store {
|
|
|
5143
5144
|
var serverMs = new util/* default.Date */.Z.Date(t).getTime() + latences;
|
|
5144
5145
|
var localMs = util/* default.Date.now */.Z.Date.now();
|
|
5145
5146
|
this.timeDiff = Math.floor(serverMs - localMs);
|
|
5146
|
-
setTimeout(() => this.loopTime(),
|
|
5147
|
+
setTimeout(() => this.loopTime(), 240000);
|
|
5147
5148
|
}
|
|
5148
5149
|
|
|
5149
5150
|
replaceFileUrl(src) {
|
|
@@ -5249,20 +5250,21 @@ const inmemCookie = {
|
|
|
5249
5250
|
};
|
|
5250
5251
|
|
|
5251
5252
|
function getGaClientId() {
|
|
5252
|
-
|
|
5253
|
-
if (!
|
|
5253
|
+
if (!window.ga) return;
|
|
5254
|
+
if (!window.ga.getAll) return;
|
|
5254
5255
|
var allTrackers = window.ga.getAll() || [];
|
|
5256
|
+
let ga_client_id = '';
|
|
5255
5257
|
allTrackers.forEach(function (tracker) {
|
|
5256
|
-
|
|
5258
|
+
ga_client_id = tracker.get('clientId');
|
|
5257
5259
|
});
|
|
5258
|
-
return
|
|
5260
|
+
return ga_client_id;
|
|
5259
5261
|
}
|
|
5260
5262
|
|
|
5261
|
-
const hasGA = () => !!(window.ga && window.ga.getAll);
|
|
5262
|
-
|
|
5263
5263
|
function getGaTrackingIds() {
|
|
5264
5264
|
var trackingIds = [];
|
|
5265
|
-
if (!
|
|
5265
|
+
if (!(window.ga && window.ga.getAll)) return trackingIds;
|
|
5266
|
+
if (!window.ga) return [];
|
|
5267
|
+
if (!window.ga.getAll) return [];
|
|
5266
5268
|
const allTrackers = window.ga.getAll() || [];
|
|
5267
5269
|
allTrackers.forEach(function (tracker) {
|
|
5268
5270
|
var trackingId = tracker.get('trackingId');
|
|
@@ -5280,12 +5282,18 @@ function sendToFBPixel(category, action, label) {
|
|
|
5280
5282
|
}
|
|
5281
5283
|
|
|
5282
5284
|
function sendToGA(category, action, label) {
|
|
5283
|
-
if (
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
const name = tracker.get('name');
|
|
5287
|
-
window.ga(name + '.send', 'event', category, action, label);
|
|
5285
|
+
if (window.gtag) window.gtag('event', category, {
|
|
5286
|
+
Action: action,
|
|
5287
|
+
Label: label
|
|
5288
5288
|
});
|
|
5289
|
+
|
|
5290
|
+
if (window.ga && window.ga.getAll) {
|
|
5291
|
+
const allTrackers = window.ga.getAll() || [];
|
|
5292
|
+
allTrackers.forEach(function (tracker) {
|
|
5293
|
+
const name = tracker.get('name');
|
|
5294
|
+
window.ga(name + '.send', 'event', category, action, label);
|
|
5295
|
+
});
|
|
5296
|
+
}
|
|
5289
5297
|
}
|
|
5290
5298
|
|
|
5291
5299
|
function sendEventToThirdParty(category, action, label) {
|
|
@@ -5298,6 +5306,12 @@ function sendEventToThirdParty(category, action, label) {
|
|
|
5298
5306
|
}));
|
|
5299
5307
|
sendToGA(category, action, label);
|
|
5300
5308
|
sendToFBPixel(category, action, label);
|
|
5309
|
+
let dataLayer = window.dataLayer || [];
|
|
5310
|
+
dataLayer.push({
|
|
5311
|
+
event: category,
|
|
5312
|
+
event_action: action,
|
|
5313
|
+
event_label: label
|
|
5314
|
+
});
|
|
5301
5315
|
}
|
|
5302
5316
|
|
|
5303
5317
|
let mobileCheck = function (a) {
|
|
@@ -5683,7 +5697,7 @@ util/* default.preloadWebfonts */.Z.preloadWebfonts(['Roboto'], [400, 500]);
|
|
|
5683
5697
|
|
|
5684
5698
|
class Widget {
|
|
5685
5699
|
constructor(ApiURL, FileURL, RealtimeURL, inmem, fake, agenttoken) {
|
|
5686
|
-
lib_defineProperty(this, "version", () => '4.
|
|
5700
|
+
lib_defineProperty(this, "version", () => '4.5');
|
|
5687
5701
|
|
|
5688
5702
|
lib_defineProperty(this, "setSetting", setting => this.store.setSetting({
|
|
5689
5703
|
account_setting: setting
|
|
@@ -5695,6 +5709,12 @@ class Widget {
|
|
|
5695
5709
|
|
|
5696
5710
|
lib_defineProperty(this, "getUser", () => util/* default.parseJSON */.Z.parseJSON(util/* default.stringify */.Z.stringify(this.store.matchUser())));
|
|
5697
5711
|
|
|
5712
|
+
lib_defineProperty(this, "setViewingProduct", p => this.store.linkProduct(p));
|
|
5713
|
+
|
|
5714
|
+
lib_defineProperty(this, "getViewingProduct", () => this.store.getLinkedProduct());
|
|
5715
|
+
|
|
5716
|
+
lib_defineProperty(this, "track", () => this.store.track());
|
|
5717
|
+
|
|
5698
5718
|
this.domGate = new util/* default.Gate */.Z.Gate();
|
|
5699
5719
|
this.store = new Store(ApiURL, FileURL, RealtimeURL, inmem, fake, agenttoken);
|
|
5700
5720
|
window.sbz_store = this.store;
|
|
@@ -5767,7 +5787,21 @@ class Widget {
|
|
|
5767
5787
|
}
|
|
5768
5788
|
|
|
5769
5789
|
async sendMessage(convoid, message) {
|
|
5770
|
-
|
|
5790
|
+
if (!convoid) {
|
|
5791
|
+
const {
|
|
5792
|
+
convo,
|
|
5793
|
+
error
|
|
5794
|
+
} = await this.store.startConvo({
|
|
5795
|
+
message: message.text,
|
|
5796
|
+
initial_by: this.store.matchUser().id
|
|
5797
|
+
});
|
|
5798
|
+
if (error) return {
|
|
5799
|
+
error
|
|
5800
|
+
};
|
|
5801
|
+
convoid = convo.id;
|
|
5802
|
+
}
|
|
5803
|
+
|
|
5804
|
+
return this.store.sendConvoEvent(convoid, 'message_sent', {
|
|
5771
5805
|
message
|
|
5772
5806
|
});
|
|
5773
5807
|
}
|
|
@@ -5786,11 +5820,11 @@ class Widget {
|
|
|
5786
5820
|
this.pluginMgr.hideCurrentGreeting();
|
|
5787
5821
|
}
|
|
5788
5822
|
|
|
5789
|
-
async showWidget(view,
|
|
5823
|
+
async showWidget(view, cid) {
|
|
5790
5824
|
await this.domGate.entry();
|
|
5791
5825
|
this.pluginMgr.showCurrentChatbox({
|
|
5792
5826
|
view,
|
|
5793
|
-
cid:
|
|
5827
|
+
cid: cid
|
|
5794
5828
|
});
|
|
5795
5829
|
}
|
|
5796
5830
|
|