@subiz/widget-v4 4.0.99 → 4.1.1
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/call/call.js +3 -3
- package/compiled_src/chatbox/AgentsAvatar.js +0 -3
- package/compiled_src/chatbox/ButtonAttachments.js +0 -1
- package/compiled_src/chatbox/ChatButton.js +0 -5
- package/compiled_src/chatbox/DropdownSelect.js +4 -5
- package/compiled_src/chatbox/Event.js +0 -2
- package/compiled_src/chatbox/Events.js +1 -9
- package/compiled_src/chatbox/FormAttachment.js +0 -1
- package/compiled_src/chatbox/GenericTemplateAttachments.js +0 -3
- package/compiled_src/chatbox/Header.js +5 -2
- package/compiled_src/chatbox/InfoMessage.js +0 -1
- package/compiled_src/chatbox/MessageInput.js +3 -3
- package/compiled_src/chatbox/Order.js +3 -1
- package/compiled_src/chatbox/OrderAttachments.js +0 -1
- package/compiled_src/chatbox/QuickReplies.js +0 -1
- package/compiled_src/chatbox/Rating.js +3 -1
- package/compiled_src/chatbox/TextMessage.js +0 -2
- package/compiled_src/chatbox/Typing.js +0 -1
- package/compiled_src/chatbox/Widget.js +4 -18
- package/compiled_src/chatbox/main.js +0 -1
- package/compiled_src/chatbox/releaseAnimation.js +0 -1
- package/compiled_src/contact/contact.js +3 -7
- package/compiled_src/lib.js +7 -18
- package/compiled_src/notif/notif.js +3 -3
- package/compiled_src/order/address_picker.js +4 -6
- package/compiled_src/order/index.js +0 -2
- package/compiled_src/order/order.js +4 -7
- package/compiled_src/plugin.js +0 -9
- package/compiled_src/popup/countdown.js +3 -5
- package/compiled_src/popup/popup.js +3 -8
- package/compiled_src/popup/tick.core.commonjs.js +16 -158
- package/compiled_src/popup/tick.view.flip.commonjs.js +0 -25
- package/compiled_src/store/api.js +3 -9
- package/compiled_src/store/api_fake.js +3 -3
- package/compiled_src/store/store.js +5 -48
- package/compiled_src/util/campaign.js +0 -5
- package/compiled_src/util/common.js +0 -27
- package/compiled_src/util/extractor.js +0 -1
- package/compiled_src/util/gate.test.js +0 -1
- package/compiled_src/util/index.js +0 -1
- package/compiled_src/util/op.js +0 -1
- package/compiled_src/util/order.js +0 -4
- package/dist/132.js +26 -89
- package/dist/184d8eee275.132.js +1 -0
- package/dist/184d8eee275.178.js +1 -0
- package/dist/184d8eee275.213.js +1 -0
- package/dist/184d8eee275.335.js +1 -0
- package/dist/184d8eee275.362.js +1 -0
- package/dist/184d8eee275.441.js +1 -0
- package/dist/184d8eee275.605.js +1 -0
- package/dist/184d8eee275.678.js +1 -0
- package/dist/184d8eee275.782.js +1 -0
- package/dist/184d8eee275.app.js +1 -0
- package/dist/184d8eee275.index.html +26 -0
- package/dist/184d8eee275.library.html +26 -0
- package/dist/184d8eee275.library.js +1 -0
- package/dist/184d8eee275.preview.html +759 -0
- package/dist/184d8eee275.preview.js +1 -0
- package/dist/184d8eee275.screenshoot.js +1 -0
- package/dist/213.js +22 -198
- package/dist/335.js +3 -7
- package/dist/605.js +3 -3
- package/dist/HASH +1 -1
- package/dist/assets/img/award1a.1a58e10.png +0 -0
- package/dist/assets/img/award3a.3b74423.png +0 -0
- package/dist/assets/img/award4a.ed6ccd4.png +0 -0
- package/dist/assets/img/award5.39eb7ae.png +0 -0
- package/dist/assets/img/examplte_logo.f86535f.svg +1 -0
- package/dist/assets/img/main-service1.d536cc2.png +0 -0
- package/dist/assets/img/main-service2.9b99549.png +0 -0
- package/dist/screenshoot.html +1 -1
- package/dist/screenshoot.js +14 -130
- package/package.json +4 -4
- package/src/chatbox/Header.js +9 -3
- package/src/lib.js +5 -15
package/dist/screenshoot.js
CHANGED
|
@@ -859,7 +859,6 @@ module.exports = Realtime
|
|
|
859
859
|
/* harmony export */ "Z": () => (/* binding */ Chain)
|
|
860
860
|
/* harmony export */ });
|
|
861
861
|
const ChainMaxSize = 50;
|
|
862
|
-
|
|
863
862
|
class Chain {
|
|
864
863
|
constructor(db, schema, inmem) {
|
|
865
864
|
this.schema = schema + '_chain';
|
|
@@ -867,7 +866,6 @@ class Chain {
|
|
|
867
866
|
this.db = db;
|
|
868
867
|
this.anchorCache = {};
|
|
869
868
|
this.cache = {};
|
|
870
|
-
|
|
871
869
|
this.init();
|
|
872
870
|
}
|
|
873
871
|
init() {
|
|
@@ -903,7 +901,6 @@ class Chain {
|
|
|
903
901
|
this.anchorCache = {};
|
|
904
902
|
this.db = undefined;
|
|
905
903
|
}
|
|
906
|
-
|
|
907
904
|
put(chain, id, node_index, value) {
|
|
908
905
|
if (this.dead) return;
|
|
909
906
|
let inmemItemM = this.cache[chain] || {};
|
|
@@ -958,7 +955,6 @@ class Chain {
|
|
|
958
955
|
inmemItemM[item.id] = item;
|
|
959
956
|
this.db.put('items', item.full_id, item);
|
|
960
957
|
});
|
|
961
|
-
|
|
962
958
|
this.anchorCache[chain] = newanchor;
|
|
963
959
|
this.cache[chain] = inmemItemM;
|
|
964
960
|
return {};
|
|
@@ -992,9 +988,7 @@ class Chain {
|
|
|
992
988
|
});
|
|
993
989
|
});
|
|
994
990
|
if (newItems.length === 0 || newanchor === lastanchor) break;
|
|
995
|
-
|
|
996
991
|
if (fetchedItems.length >= 200) {
|
|
997
|
-
|
|
998
992
|
let inmemItemM = this.cache[chain] || {};
|
|
999
993
|
let removeids = [];
|
|
1000
994
|
map(inmemItemM, item => {
|
|
@@ -1007,7 +1001,6 @@ class Chain {
|
|
|
1007
1001
|
}
|
|
1008
1002
|
let minindexitem = minIndex(fetchedItems) || {};
|
|
1009
1003
|
if (minindexitem.index <= topindex) {
|
|
1010
|
-
|
|
1011
1004
|
lastanchor = this.anchorCache[chain] || newanchor;
|
|
1012
1005
|
break;
|
|
1013
1006
|
}
|
|
@@ -1097,7 +1090,6 @@ function orderBy(a, k, d) {
|
|
|
1097
1090
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1098
1091
|
/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
1099
1092
|
/* harmony export */ });
|
|
1100
|
-
|
|
1101
1093
|
var localStorageMemory = {};
|
|
1102
1094
|
var cache = {};
|
|
1103
1095
|
localStorageMemory.length = 0;
|
|
@@ -1162,7 +1154,6 @@ let KvMaxSize = 500;
|
|
|
1162
1154
|
inmemItemM[item.key] = item.value;
|
|
1163
1155
|
});
|
|
1164
1156
|
this.cache = inmemItemM;
|
|
1165
|
-
|
|
1166
1157
|
let allkeys = Object.keys(this.cache);
|
|
1167
1158
|
if (allkeys.length > KvMaxSize) {
|
|
1168
1159
|
let liveChance = KvMaxSize / 2 / allkeys.lenth;
|
|
@@ -1189,7 +1180,6 @@ let KvMaxSize = 500;
|
|
|
1189
1180
|
if (!key) return;
|
|
1190
1181
|
return this.cache[key];
|
|
1191
1182
|
}
|
|
1192
|
-
|
|
1193
1183
|
put(key, value) {
|
|
1194
1184
|
if (!key) return;
|
|
1195
1185
|
if (this.dead) return [];
|
|
@@ -1200,7 +1190,6 @@ let KvMaxSize = 500;
|
|
|
1200
1190
|
value
|
|
1201
1191
|
});
|
|
1202
1192
|
}
|
|
1203
|
-
|
|
1204
1193
|
del(key) {
|
|
1205
1194
|
if (this.dead) return;
|
|
1206
1195
|
if (!this.initialized) throw new Error('uninitialized');
|
|
@@ -1241,7 +1230,6 @@ const LIMIT = 80;
|
|
|
1241
1230
|
}
|
|
1242
1231
|
this.schema = schema;
|
|
1243
1232
|
}
|
|
1244
|
-
|
|
1245
1233
|
all(table) {
|
|
1246
1234
|
let items = [];
|
|
1247
1235
|
for (var i = 0; i < this.localStorage.length; i++) {
|
|
@@ -1252,14 +1240,12 @@ const LIMIT = 80;
|
|
|
1252
1240
|
}
|
|
1253
1241
|
return items;
|
|
1254
1242
|
}
|
|
1255
|
-
|
|
1256
1243
|
removes(table, keys) {
|
|
1257
1244
|
for (var i = 0; i < keys.length; i++) {
|
|
1258
1245
|
delete this.allkeys[this.schema + '#' + table + '#' + keys[i]];
|
|
1259
1246
|
this.localStorage.removeItem(this.schema + '#' + table + '#' + keys[i]);
|
|
1260
1247
|
}
|
|
1261
1248
|
}
|
|
1262
|
-
|
|
1263
1249
|
clear(table) {
|
|
1264
1250
|
let matchkeys = [];
|
|
1265
1251
|
for (var i = 0; i < this.localStorage.length; i++) {
|
|
@@ -1270,7 +1256,6 @@ const LIMIT = 80;
|
|
|
1270
1256
|
for (var i = 0; i < matchkeys.length; i++) this.localStorage.removeItem(matchkeys[i]);
|
|
1271
1257
|
this.allkeys = {};
|
|
1272
1258
|
}
|
|
1273
|
-
|
|
1274
1259
|
put(table, key, value) {
|
|
1275
1260
|
this.allkeys[this.schema + '#' + table + '#' + key] = true;
|
|
1276
1261
|
if (Object.keys(this.allkeys).length > LIMIT) this.clear(table);
|
|
@@ -1462,7 +1447,6 @@ var Date = f.contentWindow.Date;
|
|
|
1462
1447
|
var requestAnimationFrame = f.contentWindow.requestAnimationFrame;
|
|
1463
1448
|
var setTimeout = f.contentWindow.setTimeout;
|
|
1464
1449
|
var setInterval = f.contentWindow.setInterval;
|
|
1465
|
-
|
|
1466
1450
|
function convoOfEv(ev) {
|
|
1467
1451
|
if (!ev) return '';
|
|
1468
1452
|
switch (ev.type) {
|
|
@@ -1656,7 +1640,6 @@ function trimStart(s, prefix) {
|
|
|
1656
1640
|
while (s.charAt(0) === prefix) s = s.substr(1);
|
|
1657
1641
|
return s;
|
|
1658
1642
|
}
|
|
1659
|
-
|
|
1660
1643
|
function throttle(func, wait, options) {
|
|
1661
1644
|
var context, args, result;
|
|
1662
1645
|
var timeout = null;
|
|
@@ -1805,7 +1788,6 @@ function replaceCssVariablePlugin(css, setting) {
|
|
|
1805
1788
|
ret.push(item);
|
|
1806
1789
|
continue;
|
|
1807
1790
|
}
|
|
1808
|
-
|
|
1809
1791
|
var path = item.type.substr(2, item.type.length - 3);
|
|
1810
1792
|
var val = op.get(setting, path) || op.get(DEFVAL, path) || '';
|
|
1811
1793
|
ret.push(val);
|
|
@@ -1871,14 +1853,12 @@ function replaceCssVariable(css, setting) {
|
|
|
1871
1853
|
ret.push(val + 5);
|
|
1872
1854
|
continue;
|
|
1873
1855
|
}
|
|
1874
|
-
|
|
1875
1856
|
var path = item.type.substr(2, item.type.length - 3);
|
|
1876
1857
|
var val = op.get(setting, path) || op.get(DEFVAL, path) || '';
|
|
1877
1858
|
val = norm2(val);
|
|
1878
1859
|
if (['mobile_button.width', 'mobile_button.height', 'mobile_button.margin_x', 'mobile_button.margin_y', 'desktop_button.width', 'desktop_button.height', 'desktop_button.margin_x', 'desktop_button.margin_y', 'width', 'height'].includes(path)) {
|
|
1879
1860
|
val += 'px';
|
|
1880
1861
|
}
|
|
1881
|
-
|
|
1882
1862
|
if (path === 'height' && op.get(setting, 'window_mode') === 'full') {
|
|
1883
1863
|
ret.push('100%');
|
|
1884
1864
|
continue;
|
|
@@ -1887,7 +1867,6 @@ function replaceCssVariable(css, setting) {
|
|
|
1887
1867
|
}
|
|
1888
1868
|
return ret.join('');
|
|
1889
1869
|
}
|
|
1890
|
-
|
|
1891
1870
|
function tokenize(arr, token) {
|
|
1892
1871
|
if (!arr || !arr.length) return [];
|
|
1893
1872
|
var out = [];
|
|
@@ -1949,23 +1928,18 @@ function js2css(js, onlyprops, variables) {
|
|
|
1949
1928
|
var newjs = {};
|
|
1950
1929
|
for (var prop in js) {
|
|
1951
1930
|
if (!js.hasOwnProperty(prop)) continue;
|
|
1952
|
-
|
|
1953
1931
|
if (onlyprops && onlyprops.length > 0 && onlyprops.indexOf(prop) === -1) continue;
|
|
1954
|
-
|
|
1955
1932
|
if (typeof js[prop] === 'string') newjs[prop] = trim(js[prop]);else newjs[prop] = js[prop];
|
|
1956
1933
|
}
|
|
1957
1934
|
js = newjs;
|
|
1958
1935
|
let style = '';
|
|
1959
1936
|
for (var prop in js) {
|
|
1960
1937
|
if (!js.hasOwnProperty(prop)) continue;
|
|
1961
|
-
|
|
1962
1938
|
var filter = '';
|
|
1963
1939
|
if (js.blur) filter += 'blur(' + js.blur + ') ';
|
|
1964
1940
|
if (js.grayscale) filter += 'grayscale(' + js + ') ';
|
|
1965
1941
|
if (filter) style += 'filter: ' + filter + '!important;';
|
|
1966
|
-
|
|
1967
1942
|
if (js.rotate !== undefined) style += 'transform:rotate(' + js.rotate + ') !important;';
|
|
1968
|
-
|
|
1969
1943
|
if (js[prop] !== undefined) {
|
|
1970
1944
|
let propval = js[prop] + '';
|
|
1971
1945
|
map(variables, (value, name) => {
|
|
@@ -1979,22 +1953,15 @@ function js2css(js, onlyprops, variables) {
|
|
|
1979
1953
|
}
|
|
1980
1954
|
function browserName() {
|
|
1981
1955
|
var isOpera = !!window.opr && !!opr.addons || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
|
|
1982
|
-
|
|
1983
1956
|
var isFirefox = typeof InstallTrigger !== 'undefined';
|
|
1984
|
-
|
|
1985
1957
|
var isSafari = /constructor/i.test(window.HTMLElement) || function (p) {
|
|
1986
1958
|
return p.toString() === '[object SafariRemoteNotification]';
|
|
1987
1959
|
}(!window['safari'] || typeof safari !== 'undefined' && window['safari'].pushNotification);
|
|
1988
|
-
|
|
1989
1960
|
var isIE = false || !!document.documentMode;
|
|
1990
|
-
|
|
1991
1961
|
var isEdge = !isIE && !!window.StyleMedia;
|
|
1992
|
-
|
|
1993
1962
|
var isChrome = !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);
|
|
1994
1963
|
if (!isChrome) isChrome = navigator.userAgent.indexOf('Chrome');
|
|
1995
|
-
|
|
1996
1964
|
var isEdgeChromium = isChrome && navigator.userAgent.indexOf('Edg') != -1;
|
|
1997
|
-
|
|
1998
1965
|
var isBlink = (isChrome || isOpera) && !!window.CSS;
|
|
1999
1966
|
if (isOpera) return 'opera';
|
|
2000
1967
|
if (isFirefox) return 'firefox';
|
|
@@ -2018,7 +1985,6 @@ function osName() {
|
|
|
2018
1985
|
if (window.navigator.userAgent.indexOf('Linux') != -1) OSName = 'Linux';
|
|
2019
1986
|
return OSName;
|
|
2020
1987
|
}
|
|
2021
|
-
|
|
2022
1988
|
function check_frequently(freq, lastrun, store) {
|
|
2023
1989
|
if (!lastrun) return true;
|
|
2024
1990
|
if (op.get(freq, 'once_per_user')) return false;
|
|
@@ -2034,7 +2000,6 @@ function check_frequently(freq, lastrun, store) {
|
|
|
2034
2000
|
function checkRunConditions(freq, conds, lastrun, store) {
|
|
2035
2001
|
var acc = store.matchAccount() || {};
|
|
2036
2002
|
var location = store.matchLocation() || {};
|
|
2037
|
-
|
|
2038
2003
|
if (!check_frequently(freq, lastrun, store)) return false;
|
|
2039
2004
|
for (var i = 0; i < size(conds); i++) {
|
|
2040
2005
|
var cond = conds[i];
|
|
@@ -2047,7 +2012,6 @@ function checkRunConditions(freq, conds, lastrun, store) {
|
|
|
2047
2012
|
});
|
|
2048
2013
|
if (found) return false;
|
|
2049
2014
|
}
|
|
2050
|
-
|
|
2051
2015
|
let urls = filter(cond.urls, url => norm(url));
|
|
2052
2016
|
if (size(urls) > 0) {
|
|
2053
2017
|
let found = find(urls, url => {
|
|
@@ -2281,7 +2245,6 @@ function diffYear(a, b, tzoffset) {
|
|
|
2281
2245
|
function sameDay(a, b, tzoffset) {
|
|
2282
2246
|
return diffDay(a, b, tzoffset) === 0;
|
|
2283
2247
|
}
|
|
2284
|
-
|
|
2285
2248
|
function shortTime(utcms, tzoffset, now) {
|
|
2286
2249
|
var machineoffsetmin = -new Date().getTimezoneOffset();
|
|
2287
2250
|
var offsetmin = machineoffsetmin;
|
|
@@ -2304,13 +2267,9 @@ function shortTime(utcms, tzoffset, now) {
|
|
|
2304
2267
|
let tzdate = tztime.getDate();
|
|
2305
2268
|
if (tzhour < 10) tzhour = '0' + tzhour;
|
|
2306
2269
|
if (tzmin < 10) tzmin = '0' + tzmin;
|
|
2307
|
-
|
|
2308
2270
|
if (sameDay(time, now, tzoffset)) return tzhour + ':' + tzmin;
|
|
2309
|
-
|
|
2310
2271
|
if (diffDay(time, now, tzoffset) <= 5) return tzdddd + ', ' + tzhour + ':' + tzmin;
|
|
2311
|
-
|
|
2312
2272
|
if (diffYear(time, now, tzoffset) === 0) return tzmonthname + ' ' + tzdate + ', ' + tzhour + ':' + tzmin;
|
|
2313
|
-
|
|
2314
2273
|
return tzyear + '/' + tzmonth + '/' + tzdate + ', ' + tzhour + ':' + tzmin;
|
|
2315
2274
|
}
|
|
2316
2275
|
function unixSec(t) {
|
|
@@ -2329,7 +2288,6 @@ function getMs(t) {
|
|
|
2329
2288
|
}
|
|
2330
2289
|
return t * 1e3;
|
|
2331
2290
|
}
|
|
2332
|
-
|
|
2333
2291
|
function detectLang() {
|
|
2334
2292
|
let urllang = getUrlParameter('sbz_locale');
|
|
2335
2293
|
let doclang = document.getElementsByTagName('html')[0].getAttribute('xml:lang') || document.getElementsByTagName('html')[0].getAttribute('lang');
|
|
@@ -2534,7 +2492,6 @@ function extractEmails(text) {
|
|
|
2534
2492
|
function extractPhones(msg) {
|
|
2535
2493
|
msg = msg || '';
|
|
2536
2494
|
var fgmsg = '';
|
|
2537
|
-
|
|
2538
2495
|
var realchmap = {};
|
|
2539
2496
|
for (var i = 0; i < msg.length; i++) {
|
|
2540
2497
|
var ch = msg.charAt(i);
|
|
@@ -2614,7 +2571,6 @@ function extractText(text) {
|
|
|
2614
2571
|
}
|
|
2615
2572
|
;// CONCATENATED MODULE: ./src/util/campaign.js
|
|
2616
2573
|
var campaign_common = __webpack_require__(8733);
|
|
2617
|
-
|
|
2618
2574
|
function trackExitIntent(cb) {
|
|
2619
2575
|
let handler = e => {
|
|
2620
2576
|
if (e.clientY > 10) return;
|
|
@@ -2623,7 +2579,6 @@ function trackExitIntent(cb) {
|
|
|
2623
2579
|
};
|
|
2624
2580
|
document.addEventListener('mouseout', handler);
|
|
2625
2581
|
}
|
|
2626
|
-
|
|
2627
2582
|
function trackScrollingPercentage(percent, cb) {
|
|
2628
2583
|
let handleScroll = e => {
|
|
2629
2584
|
let scrollTop = e.srcElement.scrollingElement ? e.srcElement.scrollingElement.scrollTop : e.srcElement.scrollTop;
|
|
@@ -2635,7 +2590,6 @@ function trackScrollingPercentage(percent, cb) {
|
|
|
2635
2590
|
};
|
|
2636
2591
|
window.addEventListener('scroll', handleScroll, false);
|
|
2637
2592
|
}
|
|
2638
|
-
|
|
2639
2593
|
function trackAreaClicked(selector, cb) {
|
|
2640
2594
|
if (!selector) return;
|
|
2641
2595
|
selector = selector || '';
|
|
@@ -2652,7 +2606,6 @@ function trackAreaClicked(selector, cb) {
|
|
|
2652
2606
|
});
|
|
2653
2607
|
});
|
|
2654
2608
|
}
|
|
2655
|
-
|
|
2656
2609
|
function trackInactivity(seconds, cb) {
|
|
2657
2610
|
let events = ['scroll', 'keyup', 'keydown', 'mousemove', 'mousewheel', 'mouseenter', 'mouseover', 'mousedown', 'touchstart', 'touchmove', 'touchenter'];
|
|
2658
2611
|
let inactiveSeconds = 0;
|
|
@@ -2676,7 +2629,6 @@ let timeOnPage = 0;
|
|
|
2676
2629
|
setInterval(() => {
|
|
2677
2630
|
timeOnPage += 5;
|
|
2678
2631
|
}, 5000);
|
|
2679
|
-
|
|
2680
2632
|
function trackTimeOnPage(seconds, cb) {
|
|
2681
2633
|
if (seconds < 1) {
|
|
2682
2634
|
return setTimeout(function () {
|
|
@@ -2734,7 +2686,6 @@ function calcOrderTotal(order) {
|
|
|
2734
2686
|
if (!item.product) return 0;
|
|
2735
2687
|
let price = op.get(item, 'product.price', 0) * (item.quantity || 0);
|
|
2736
2688
|
ordervalue += price;
|
|
2737
|
-
|
|
2738
2689
|
if (item.discount_type == 'percentage') {
|
|
2739
2690
|
if (item.discount_percentage > 0) {
|
|
2740
2691
|
beforeTaxDiscount += price * item.discount_percentage / 10000;
|
|
@@ -2750,7 +2701,6 @@ function calcOrderTotal(order) {
|
|
|
2750
2701
|
item.total = price;
|
|
2751
2702
|
subtotal += price;
|
|
2752
2703
|
});
|
|
2753
|
-
|
|
2754
2704
|
let taxM = {};
|
|
2755
2705
|
op.map(order.items, (item, i) => {
|
|
2756
2706
|
if (!item.product) return;
|
|
@@ -2772,7 +2722,6 @@ function calcOrderTotal(order) {
|
|
|
2772
2722
|
} else if (order.discount_type == 'amount') {
|
|
2773
2723
|
computed_discount = order.discount_amount || 0;
|
|
2774
2724
|
}
|
|
2775
|
-
|
|
2776
2725
|
let shippingfee = op.get(order, 'shipping.nominal_fee', 0);
|
|
2777
2726
|
if (shippingfee > 0) {
|
|
2778
2727
|
if (op.get(order, 'shipping.tax.id')) {
|
|
@@ -2788,7 +2737,6 @@ function calcOrderTotal(order) {
|
|
|
2788
2737
|
totaltax = 0;
|
|
2789
2738
|
op.map(taxM, t => totaltax += t.taxprice);
|
|
2790
2739
|
let total = subtotal + totaltax - computed_discount + shippingfee;
|
|
2791
|
-
|
|
2792
2740
|
total += order.adjustment || 0;
|
|
2793
2741
|
if (total < 0) total = 0;
|
|
2794
2742
|
order.subtotal = subtotal;
|
|
@@ -2800,8 +2748,6 @@ function calcOrderTotal(order) {
|
|
|
2800
2748
|
order._order_value = ordervalue;
|
|
2801
2749
|
}
|
|
2802
2750
|
;// CONCATENATED MODULE: ./src/util/index.js
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
2751
|
var sb = {};
|
|
2806
2752
|
|
|
2807
2753
|
sb = Object.assign(sb, common);
|
|
@@ -2864,8 +2810,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2864
2810
|
/* harmony export */ "get": () => (/* binding */ get),
|
|
2865
2811
|
/* harmony export */ "set": () => (/* binding */ set)
|
|
2866
2812
|
/* harmony export */ });
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
2813
|
var toStr = Object.prototype.toString;
|
|
2870
2814
|
var isArray = Array.isArray || function (obj) {
|
|
2871
2815
|
return toStr.call(obj) === '[object Array]';
|
|
@@ -3409,7 +3353,9 @@ var lsdb = (__webpack_require__(6929)/* ["default"] */ .Z);
|
|
|
3409
3353
|
inmem_localstorage
|
|
3410
3354
|
});
|
|
3411
3355
|
;// CONCATENATED MODULE: ./src/store/api.js
|
|
3412
|
-
function _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; }
|
|
3356
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3357
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3358
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
3413
3359
|
|
|
3414
3360
|
const ajax = __webpack_require__(7460);
|
|
3415
3361
|
ajax.env.XMLHttpRequest = window.XMLHttpRequest;
|
|
@@ -3483,7 +3429,6 @@ function jsonifyTextPlain(param, done) {
|
|
|
3483
3429
|
if (error) return {
|
|
3484
3430
|
error
|
|
3485
3431
|
};
|
|
3486
|
-
|
|
3487
3432
|
let body;
|
|
3488
3433
|
({
|
|
3489
3434
|
body,
|
|
@@ -3525,7 +3470,6 @@ function jsonifyTextPlain(param, done) {
|
|
|
3525
3470
|
let user_id = this.profile_id;
|
|
3526
3471
|
this.token_generator().then(token => {
|
|
3527
3472
|
if (user_id != this.profile_id) return done(true);
|
|
3528
|
-
|
|
3529
3473
|
if (!token) return done(false);
|
|
3530
3474
|
if (token == 'error') return done(false);
|
|
3531
3475
|
param.request = param.request.addQuery('x-access-token', token);
|
|
@@ -3537,7 +3481,6 @@ function jsonifyTextPlain(param, done) {
|
|
|
3537
3481
|
return done(true);
|
|
3538
3482
|
});
|
|
3539
3483
|
}
|
|
3540
|
-
|
|
3541
3484
|
setAgentId(agid) {
|
|
3542
3485
|
this.agentid = agid;
|
|
3543
3486
|
}
|
|
@@ -3567,9 +3510,7 @@ function jsonifyTextPlain(param, done) {
|
|
|
3567
3510
|
this.refreshLock.unlock();
|
|
3568
3511
|
return;
|
|
3569
3512
|
}
|
|
3570
|
-
|
|
3571
3513
|
let age = (util/* default.Date.now */.Z.Date.now() - (this.last_token_at || 0)) / 1000;
|
|
3572
|
-
|
|
3573
3514
|
if (!force && this.last_token && age < 1800) {
|
|
3574
3515
|
this.refreshLock.unlock();
|
|
3575
3516
|
return this.last_token;
|
|
@@ -3586,14 +3527,12 @@ function jsonifyTextPlain(param, done) {
|
|
|
3586
3527
|
this.refreshLock.unlock();
|
|
3587
3528
|
return;
|
|
3588
3529
|
}
|
|
3589
|
-
|
|
3590
3530
|
if (err) this.last_token = 'error';else this.last_token = token;
|
|
3591
3531
|
this.last_token_at = util/* default.Date.now */.Z.Date.now();
|
|
3592
3532
|
this.refreshLock.unlock();
|
|
3593
3533
|
});
|
|
3594
3534
|
return this.last_token;
|
|
3595
3535
|
}
|
|
3596
|
-
|
|
3597
3536
|
let token;
|
|
3598
3537
|
let err;
|
|
3599
3538
|
try {
|
|
@@ -3605,7 +3544,6 @@ function jsonifyTextPlain(param, done) {
|
|
|
3605
3544
|
this.refreshLock.unlock();
|
|
3606
3545
|
return;
|
|
3607
3546
|
}
|
|
3608
|
-
|
|
3609
3547
|
if (err) this.last_token = 'error';else this.last_token = token;
|
|
3610
3548
|
this.last_token_at = util/* default.Date.now */.Z.Date.now();
|
|
3611
3549
|
this.refreshLock.unlock();
|
|
@@ -3676,7 +3614,9 @@ function jsonifyTextPlain(param, done) {
|
|
|
3676
3614
|
}
|
|
3677
3615
|
});
|
|
3678
3616
|
;// CONCATENATED MODULE: ./src/store/api_fake.js
|
|
3679
|
-
function api_fake_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; }
|
|
3617
|
+
function api_fake_defineProperty(obj, key, value) { key = api_fake_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3618
|
+
function api_fake_toPropertyKey(arg) { var key = api_fake_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3619
|
+
function api_fake_toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
3680
3620
|
|
|
3681
3621
|
const api_fake_ajax = __webpack_require__(7460);
|
|
3682
3622
|
api_fake_ajax.env.XMLHttpRequest = window.XMLHttpRequest;
|
|
@@ -3748,7 +3688,6 @@ const OK200 = Promise.resolve({
|
|
|
3748
3688
|
this.FileURL = FileURL;
|
|
3749
3689
|
this.apireq = api_fake_ajax.setBaseUrl(ApiURL).setContentType('text/plain').beforeHook(api_fake_jsonifyTextPlain).setParser('json');
|
|
3750
3690
|
}
|
|
3751
|
-
|
|
3752
3691
|
setAgentId(agid) {
|
|
3753
3692
|
this.agentid = agid;
|
|
3754
3693
|
}
|
|
@@ -3761,7 +3700,6 @@ const OK200 = Promise.resolve({
|
|
|
3761
3700
|
this.uid = obj.uid;
|
|
3762
3701
|
}
|
|
3763
3702
|
});
|
|
3764
|
-
|
|
3765
3703
|
function makeFakeConvo(accid, convoid, userid, agentid) {
|
|
3766
3704
|
let inteid = accid + '.subizv4.subikon';
|
|
3767
3705
|
return {
|
|
@@ -4083,7 +4021,9 @@ function makeFakeMessages(accid, convoid, userid, agentid) {
|
|
|
4083
4021
|
stop() {}
|
|
4084
4022
|
});
|
|
4085
4023
|
;// CONCATENATED MODULE: ./src/store/store.js
|
|
4086
|
-
function store_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; }
|
|
4024
|
+
function store_defineProperty(obj, key, value) { key = store_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4025
|
+
function store_toPropertyKey(arg) { var key = store_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
4026
|
+
function store_toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4087
4027
|
|
|
4088
4028
|
var flow = __webpack_require__(3165);
|
|
4089
4029
|
|
|
@@ -4095,10 +4035,8 @@ var cookie = __webpack_require__(9554);
|
|
|
4095
4035
|
cookie.defaults.path = '/';
|
|
4096
4036
|
cookie.expiresMultiplier = 60 * 60 * 24;
|
|
4097
4037
|
cookie.defaults.expires = 3650;
|
|
4098
|
-
|
|
4099
4038
|
const MAX_CONVO = 20;
|
|
4100
4039
|
const page_loaded = util/* default.Date.now */.Z.Date.now();
|
|
4101
|
-
|
|
4102
4040
|
class Store {
|
|
4103
4041
|
constructor(ApiURL, FileURL, RealtimeURL, inmem, fakeapi) {
|
|
4104
4042
|
store_defineProperty(this, "inmem", false);
|
|
@@ -4144,7 +4082,6 @@ class Store {
|
|
|
4144
4082
|
store_defineProperty(this, "fetchConvo", async cid => {
|
|
4145
4083
|
await this.readyGate.entry();
|
|
4146
4084
|
await this.reconnectGate.entry(undefined, true);
|
|
4147
|
-
|
|
4148
4085
|
if (this.isInsync(cid)) return this.reconnectGate.open();
|
|
4149
4086
|
this.markSync(cid);
|
|
4150
4087
|
let {
|
|
@@ -4202,8 +4139,7 @@ class Store {
|
|
|
4202
4139
|
return;
|
|
4203
4140
|
}
|
|
4204
4141
|
this.api.sendContentView(this.device, location.href, document.title, this._currentViewingProduct.id, this._currentViewingProduct.source_id, this._currentViewingProduct.sku);
|
|
4205
|
-
}, 1000,
|
|
4206
|
-
{
|
|
4142
|
+
}, 1000, {
|
|
4207
4143
|
leading: false
|
|
4208
4144
|
}));
|
|
4209
4145
|
store_defineProperty(this, "now", () => util/* default.Date.now */.Z.Date.now() + this.timeDiff);
|
|
@@ -4252,21 +4188,17 @@ class Store {
|
|
|
4252
4188
|
this.cache = new storage.kv(new storage.lsdb('sbz2020', true), 'kv');
|
|
4253
4189
|
this.chain = new storage.chain(new storage.lsdb('cbz2020', true), 'ch');
|
|
4254
4190
|
this.getLocaleContent = this.api.getLocaleContent;
|
|
4255
|
-
|
|
4256
4191
|
this.g_haveSentSeenM = {};
|
|
4257
4192
|
window.addEventListener('blur', () => this.sendPresence());
|
|
4258
4193
|
window.addEventListener('focus', () => this.sendPresence());
|
|
4259
|
-
|
|
4260
4194
|
setInterval(() => this.browserVisibility === 'visible' && document.hasFocus() && this.sendPresence(), 20000);
|
|
4261
4195
|
setInterval(() => (this.browserVisibility !== 'visible' || document.hasFocus()) && this.sendPresence(), 60000);
|
|
4262
|
-
|
|
4263
4196
|
onVisibilityChange(val => {
|
|
4264
4197
|
this.browserVisibility = val;
|
|
4265
4198
|
this.sendPresence();
|
|
4266
4199
|
});
|
|
4267
4200
|
this.loopTime();
|
|
4268
4201
|
this.device = this.getDeviceInfo();
|
|
4269
|
-
|
|
4270
4202
|
const _gaInterval = setInterval(() => {
|
|
4271
4203
|
let user = this.kv.match('user') || {};
|
|
4272
4204
|
if (!user.id) return;
|
|
@@ -4274,7 +4206,6 @@ class Store {
|
|
|
4274
4206
|
if (!dev.ga_tracking_ids || !dev.ga_client_id) return;
|
|
4275
4207
|
clearInterval(_gaInterval);
|
|
4276
4208
|
this.device = dev;
|
|
4277
|
-
|
|
4278
4209
|
let ga_client_id = dev.ga_client_id;
|
|
4279
4210
|
if (ga_client_id !== util/* default.getUserAttr */.Z.getUserAttr(user, 'ga_client_id', 'text')) {
|
|
4280
4211
|
this.setUser({
|
|
@@ -4296,7 +4227,6 @@ class Store {
|
|
|
4296
4227
|
if (p.source_id) this._currentViewingProduct.source_id = (p.source_id + '').trim();
|
|
4297
4228
|
if (p.sku) this._currentViewingProduct.sku = (p.sku + '').trim();
|
|
4298
4229
|
}
|
|
4299
|
-
|
|
4300
4230
|
getLinkedProduct() {
|
|
4301
4231
|
return util/* default.cloneDeep */.Z.cloneDeep(this._currentViewingProduct);
|
|
4302
4232
|
}
|
|
@@ -4367,7 +4297,6 @@ class Store {
|
|
|
4367
4297
|
disconnect(key) {
|
|
4368
4298
|
this.g_sync[key] = 0;
|
|
4369
4299
|
}
|
|
4370
|
-
|
|
4371
4300
|
pageLoaded() {
|
|
4372
4301
|
return page_loaded;
|
|
4373
4302
|
}
|
|
@@ -4389,7 +4318,6 @@ class Store {
|
|
|
4389
4318
|
await this.readyGate.entry();
|
|
4390
4319
|
if (!this.isInsync('account')) this.reconnect();
|
|
4391
4320
|
}
|
|
4392
|
-
|
|
4393
4321
|
async init(accid, mask) {
|
|
4394
4322
|
this.readyGate.close();
|
|
4395
4323
|
accid = (accid || '').trim();
|
|
@@ -4404,7 +4332,6 @@ class Store {
|
|
|
4404
4332
|
}
|
|
4405
4333
|
let localstorageMask = this.kv.match('mask');
|
|
4406
4334
|
if (!mask && localstorageMask) mask = localstorageMask;
|
|
4407
|
-
|
|
4408
4335
|
if (mask && localstorageMask && mask !== localstorageMask) this.clearBrowserData();
|
|
4409
4336
|
var userId = '';
|
|
4410
4337
|
if (mask) {
|
|
@@ -4422,7 +4349,6 @@ class Store {
|
|
|
4422
4349
|
} else {
|
|
4423
4350
|
this.new_visitor = false;
|
|
4424
4351
|
}
|
|
4425
|
-
|
|
4426
4352
|
this.cookie.set('__sbmask', mask);
|
|
4427
4353
|
this.kv.put('mask', mask);
|
|
4428
4354
|
if (this.realtime) this.realtime.stop();
|
|
@@ -4450,7 +4376,6 @@ class Store {
|
|
|
4450
4376
|
accid = (accid || '').trim();
|
|
4451
4377
|
this.g_sync = {};
|
|
4452
4378
|
this.new_visitor = false;
|
|
4453
|
-
|
|
4454
4379
|
if (this.realtime) this.realtime.stop();
|
|
4455
4380
|
if (this.fake) this.realtime = new realtime_fake();else this.realtime = new Realtime(this.RealtimeURL, {
|
|
4456
4381
|
getAccessToken: () => this.api.token_generator()
|
|
@@ -4476,14 +4401,11 @@ class Store {
|
|
|
4476
4401
|
var events = this.listEvents(id);
|
|
4477
4402
|
if (!events) return;
|
|
4478
4403
|
if (util/* default.size */.Z.size(events) === 0) return;
|
|
4479
|
-
|
|
4480
4404
|
events = util/* default.filter */.Z.filter(events, ev => ev.type === 'message_sent');
|
|
4481
4405
|
var lastmsgsent = events[util/* default.size */.Z.size(events) - 1];
|
|
4482
4406
|
if (!lastmsgsent) return;
|
|
4483
4407
|
if (this.g_haveSentSeenM[lastmsgsent.id]) return;
|
|
4484
|
-
|
|
4485
4408
|
if (lastmsgsent.id === util/* default.getMsgField */.Z.getMsgField(lastmsgsent, 'idempotency')) return;
|
|
4486
|
-
|
|
4487
4409
|
this.api.markAsSeen(id, lastmsgsent.id);
|
|
4488
4410
|
let convo = this.cache.match('convo_' + id) || {};
|
|
4489
4411
|
let mem = util/* default.find */.Z.find(convo.members, m => m.id === user.id);
|
|
@@ -4502,7 +4424,6 @@ class Store {
|
|
|
4502
4424
|
}
|
|
4503
4425
|
async reconnect() {
|
|
4504
4426
|
if (this._die) return;
|
|
4505
|
-
|
|
4506
4427
|
await this.reconnectGate.entry(undefined, true);
|
|
4507
4428
|
if (this.isInsync('account')) return this.reconnectGate.open();
|
|
4508
4429
|
this.markSync('account');
|
|
@@ -4526,7 +4447,6 @@ class Store {
|
|
|
4526
4447
|
}
|
|
4527
4448
|
return this.reconnectGate.open();
|
|
4528
4449
|
}
|
|
4529
|
-
|
|
4530
4450
|
async setUser(user) {
|
|
4531
4451
|
if (!user) return;
|
|
4532
4452
|
await this.readyGate.entry();
|
|
@@ -4538,7 +4458,6 @@ class Store {
|
|
|
4538
4458
|
let olduser = this.kv.match('user') || {};
|
|
4539
4459
|
var accid = olduser.account_id || user.account_id;
|
|
4540
4460
|
var id = olduser.id || user.id;
|
|
4541
|
-
|
|
4542
4461
|
util/* default.each */.Z.each(user.attributes, newattr => {
|
|
4543
4462
|
if (!newattr) return;
|
|
4544
4463
|
olduser.attributes = util/* default.filter */.Z.filter(olduser.attributes, oldattr => {
|
|
@@ -4575,17 +4494,14 @@ class Store {
|
|
|
4575
4494
|
this.cache.put('account', setting.account);
|
|
4576
4495
|
delete setting.account;
|
|
4577
4496
|
}
|
|
4578
|
-
|
|
4579
4497
|
let location = util/* default.get */.Z.get(setting, 'location', []);
|
|
4580
4498
|
this.cache.put('location', location);
|
|
4581
|
-
|
|
4582
4499
|
let bots = util/* default.get */.Z.get(setting, 'bots', []);
|
|
4583
4500
|
let botM = {};
|
|
4584
4501
|
util/* default.map */.Z.map(bots, bot => {
|
|
4585
4502
|
botM[bot.id] = bot;
|
|
4586
4503
|
});
|
|
4587
4504
|
this.cache.put('bot', botM);
|
|
4588
|
-
|
|
4589
4505
|
let plugins = util/* default.get */.Z.get(setting, 'plugins', []);
|
|
4590
4506
|
let pluginM = {};
|
|
4591
4507
|
util/* default.map */.Z.map(plugins, plugin => {
|
|
@@ -4595,7 +4511,6 @@ class Store {
|
|
|
4595
4511
|
pluginM[plugin.id] = plugin;
|
|
4596
4512
|
});
|
|
4597
4513
|
this.cache.put('plugin', pluginM);
|
|
4598
|
-
|
|
4599
4514
|
var agents = util/* default.get */.Z.get(setting, 'agents', []);
|
|
4600
4515
|
if (util/* default.size */.Z.size(agents) > 0) {
|
|
4601
4516
|
let agentM = {};
|
|
@@ -4605,12 +4520,10 @@ class Store {
|
|
|
4605
4520
|
});
|
|
4606
4521
|
this.cache.put('agent', agentM);
|
|
4607
4522
|
}
|
|
4608
|
-
|
|
4609
4523
|
let pms = util/* default.get */.Z.get(setting, 'payment_methods', []);
|
|
4610
4524
|
this.cache.put('payment_methods', pms);
|
|
4611
4525
|
this.pubsub.publish('account');
|
|
4612
4526
|
}
|
|
4613
|
-
|
|
4614
4527
|
async track() {
|
|
4615
4528
|
let out = await this.api.sendContentView(this.device, location.href, document.title, this._currentViewingProduct.id, this._currentViewingProduct.source_id, this._currentViewingProduct.sku);
|
|
4616
4529
|
let traffic_source = util/* default.get */.Z.get(out, 'body.by.device.source', '');
|
|
@@ -4632,7 +4545,6 @@ class Store {
|
|
|
4632
4545
|
this._setUser(user);
|
|
4633
4546
|
return;
|
|
4634
4547
|
}
|
|
4635
|
-
|
|
4636
4548
|
let user = this.kv.match('user') || {};
|
|
4637
4549
|
let cid = util/* default.convoOfEv */.Z.convoOfEv(ev);
|
|
4638
4550
|
let convo;
|
|
@@ -4651,11 +4563,9 @@ class Store {
|
|
|
4651
4563
|
}
|
|
4652
4564
|
}
|
|
4653
4565
|
if (!convo) return;
|
|
4654
|
-
|
|
4655
4566
|
let channel = util/* default.get */.Z.get(ev, 'touchpoint.channel', '');
|
|
4656
4567
|
if (channel && channel != 'subiz') return;
|
|
4657
4568
|
this.pubsub.publish('events', ev);
|
|
4658
|
-
|
|
4659
4569
|
if (ev.type === 'conversation_joined') {
|
|
4660
4570
|
let members = util/* default.get */.Z.get(ev, 'data.conversation.members', []);
|
|
4661
4571
|
let me = util/* default.find */.Z.find(members, m => m.id === this.kv.match('user').id);
|
|
@@ -4725,7 +4635,6 @@ class Store {
|
|
|
4725
4635
|
}
|
|
4726
4636
|
convo.last_message_sent = ev;
|
|
4727
4637
|
}
|
|
4728
|
-
|
|
4729
4638
|
if (ev.type !== 'message_pong' && ev.type !== 'conversation_typing') {
|
|
4730
4639
|
this.chain.put(cid, ev.id, util/* default.getMs */.Z.getMs(ev.created), ev);
|
|
4731
4640
|
}
|
|
@@ -4744,7 +4653,6 @@ class Store {
|
|
|
4744
4653
|
util/* default.each */.Z.each(formSubmits, submit => {
|
|
4745
4654
|
let formev = util/* default.get */.Z.get(this.convoEventM, convoKey + '.' + submit.form_message_id);
|
|
4746
4655
|
if (!formev) return;
|
|
4747
|
-
|
|
4748
4656
|
let forms = util/* default.filter */.Z.filter(util/* default.get */.Z.get(formev, 'data.message.attachments'), att => {
|
|
4749
4657
|
if (!att) return false;
|
|
4750
4658
|
if (att.type !== 'form' && att.type !== 'ask_info_form') return false;
|
|
@@ -4813,7 +4721,6 @@ class Store {
|
|
|
4813
4721
|
if (type === 'message_sent') {
|
|
4814
4722
|
util/* default.setMsgField */.Z.setMsgField(event, 'idempotency', idempotency);
|
|
4815
4723
|
event.data.message.conversation_id = cid;
|
|
4816
|
-
|
|
4817
4724
|
await flow.map(event.data.message.attachments, 2, async (att, i) => {
|
|
4818
4725
|
if (att.type !== 'file') return;
|
|
4819
4726
|
if (!att._file) return;
|
|
@@ -4825,7 +4732,6 @@ class Store {
|
|
|
4825
4732
|
}
|
|
4826
4733
|
this.onWs(event);
|
|
4827
4734
|
await this.convoGate.entry();
|
|
4828
|
-
|
|
4829
4735
|
await flow.map(files, 1, async att => {
|
|
4830
4736
|
const {
|
|
4831
4737
|
url,
|
|
@@ -4861,7 +4767,6 @@ class Store {
|
|
|
4861
4767
|
}
|
|
4862
4768
|
_setConvo(convo) {
|
|
4863
4769
|
let count = 0;
|
|
4864
|
-
|
|
4865
4770
|
let user = this.kv.match('user');
|
|
4866
4771
|
let channel = util/* default.get */.Z.get(convo, 'touchpoint.channel', '');
|
|
4867
4772
|
if (channel && channel != 'subiz') return;
|
|
@@ -4957,7 +4862,6 @@ class Store {
|
|
|
4957
4862
|
value: event
|
|
4958
4863
|
};
|
|
4959
4864
|
});
|
|
4960
|
-
|
|
4961
4865
|
let user = this.kv.match('user') || {};
|
|
4962
4866
|
for (let i = 0; i < events.length; i++) {
|
|
4963
4867
|
let ev = events[i].value;
|
|
@@ -4972,7 +4876,6 @@ class Store {
|
|
|
4972
4876
|
}
|
|
4973
4877
|
async loopTime() {
|
|
4974
4878
|
let startms = util/* default.Date.now */.Z.Date.now();
|
|
4975
|
-
|
|
4976
4879
|
if (!util/* default.get */.Z.get(this.kv.match('user'), 'id')) return setTimeout(() => this.loopTime(), 240000);
|
|
4977
4880
|
let {
|
|
4978
4881
|
body: t,
|
|
@@ -5028,17 +4931,13 @@ function loadImage(file) {
|
|
|
5028
4931
|
reader.onload = e => {
|
|
5029
4932
|
rs(e.target.result);
|
|
5030
4933
|
};
|
|
5031
|
-
|
|
5032
4934
|
reader.readAsDataURL(file);
|
|
5033
4935
|
});
|
|
5034
4936
|
}
|
|
5035
4937
|
const ImageTypes = ['image/gif', 'image/jpeg', 'image/png', 'image/svg+xml'];
|
|
5036
4938
|
function onVisibilityChange(cb) {
|
|
5037
4939
|
var hidden = 'hidden';
|
|
5038
|
-
|
|
5039
|
-
if (hidden in document) document.addEventListener('visibilitychange', onchange);else if ((hidden = 'mozHidden') in document) document.addEventListener('mozvisibilitychange', onchange);else if ((hidden = 'webkitHidden') in document) document.addEventListener('webkitvisibilitychange', onchange);else if ((hidden = 'msHidden') in document) document.addEventListener('msvisibilitychange', onchange);
|
|
5040
|
-
else if ('onfocusin' in document) document.onfocusin = document.onfocusout = onchange;
|
|
5041
|
-
else window.onpageshow = window.onpagehide = window.onfocus = window.onblur = onchange;
|
|
4940
|
+
if (hidden in document) document.addEventListener('visibilitychange', onchange);else if ((hidden = 'mozHidden') in document) document.addEventListener('mozvisibilitychange', onchange);else if ((hidden = 'webkitHidden') in document) document.addEventListener('webkitvisibilitychange', onchange);else if ((hidden = 'msHidden') in document) document.addEventListener('msvisibilitychange', onchange);else if ('onfocusin' in document) document.onfocusin = document.onfocusout = onchange;else window.onpageshow = window.onpagehide = window.onfocus = window.onblur = onchange;
|
|
5042
4941
|
function onchange(evt) {
|
|
5043
4942
|
var v = 'visible';
|
|
5044
4943
|
var h = 'hidden';
|
|
@@ -5053,7 +4952,6 @@ function onVisibilityChange(cb) {
|
|
|
5053
4952
|
evt = evt || window.event;
|
|
5054
4953
|
if (evt.type in evtMap) cb(evtMap[evt.type]);else cb(this[hidden] ? 'hidden' : 'visible');
|
|
5055
4954
|
}
|
|
5056
|
-
|
|
5057
4955
|
if (document[hidden] !== undefined) onchange({
|
|
5058
4956
|
type: document[hidden] ? 'blur' : 'focus'
|
|
5059
4957
|
});
|
|
@@ -5073,7 +4971,6 @@ const inmemCookie = {
|
|
|
5073
4971
|
delete this.data[k];
|
|
5074
4972
|
}
|
|
5075
4973
|
};
|
|
5076
|
-
|
|
5077
4974
|
function getGaClientId() {
|
|
5078
4975
|
if (!window.ga) return;
|
|
5079
4976
|
if (!window.ga.getAll) return;
|
|
@@ -5084,7 +4981,6 @@ function getGaClientId() {
|
|
|
5084
4981
|
});
|
|
5085
4982
|
return ga_client_id;
|
|
5086
4983
|
}
|
|
5087
|
-
|
|
5088
4984
|
function getGaTrackingIds() {
|
|
5089
4985
|
var trackingIds = [];
|
|
5090
4986
|
if (!(window.ga && window.ga.getAll)) return trackingIds;
|
|
@@ -5134,7 +5030,6 @@ function sendEventToThirdParty(category, action, label) {
|
|
|
5134
5030
|
event_label: label
|
|
5135
5031
|
});
|
|
5136
5032
|
}
|
|
5137
|
-
|
|
5138
5033
|
let mobileCheck = function (a) {
|
|
5139
5034
|
return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4));
|
|
5140
5035
|
}(navigator.userAgent || navigator.vendor || window.opera);
|
|
@@ -5156,7 +5051,6 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5156
5051
|
var $div = document.createElement('div');
|
|
5157
5052
|
$div.id = plugin.id;
|
|
5158
5053
|
$container.appendChild($div);
|
|
5159
|
-
|
|
5160
5054
|
let _locale = common/* getLocale */.Kd(plugin, util/* default.detectLang */.Z.detectLang());
|
|
5161
5055
|
var domGate = new util/* default.Gate */.Z.Gate();
|
|
5162
5056
|
var pageIndex = 0;
|
|
@@ -5248,15 +5142,12 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5248
5142
|
this.destroy = () => {
|
|
5249
5143
|
_destroy = true;
|
|
5250
5144
|
(0,preact_module/* render */.sY)(null, $div);
|
|
5251
|
-
|
|
5252
5145
|
$div.parentNode.removeChild($div);
|
|
5253
5146
|
};
|
|
5254
|
-
|
|
5255
5147
|
this.highlight = comref => {
|
|
5256
5148
|
highlight = comref;
|
|
5257
5149
|
_render();
|
|
5258
5150
|
};
|
|
5259
|
-
|
|
5260
5151
|
this.update = config => {
|
|
5261
5152
|
if (_destroy) return;
|
|
5262
5153
|
plugin = config;
|
|
@@ -5264,7 +5155,6 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5264
5155
|
if (state === 'finished') return;
|
|
5265
5156
|
_render();
|
|
5266
5157
|
};
|
|
5267
|
-
|
|
5268
5158
|
let t = key => {
|
|
5269
5159
|
if (_locale === 'debug') return `{{${key}}}`;
|
|
5270
5160
|
let messages = util/* default.get */.Z.get(common/* langMessages */.Rs, _locale, []);
|
|
@@ -5288,14 +5178,12 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5288
5178
|
if (_locale === locale) return locale;
|
|
5289
5179
|
this.t = null;
|
|
5290
5180
|
_render();
|
|
5291
|
-
|
|
5292
5181
|
_locale = common/* getLocale */.Kd(plugin, locale);
|
|
5293
5182
|
await common/* downloadLanguage */.WW(store, _locale);
|
|
5294
5183
|
this.t = t;
|
|
5295
5184
|
_render();
|
|
5296
5185
|
return _locale;
|
|
5297
5186
|
};
|
|
5298
|
-
|
|
5299
5187
|
let images = {};
|
|
5300
5188
|
util/* default.map */.Z.map(util/* default.get */.Z.get(plugin, 'popup.pages'), page => {
|
|
5301
5189
|
if (!page) return;
|
|
@@ -5327,7 +5215,6 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
5327
5215
|
this.update(plugin);
|
|
5328
5216
|
});
|
|
5329
5217
|
}
|
|
5330
|
-
|
|
5331
5218
|
class PluginMgr {
|
|
5332
5219
|
constructor(lib, $div) {
|
|
5333
5220
|
this.refM = {};
|
|
@@ -5359,7 +5246,6 @@ class PluginMgr {
|
|
|
5359
5246
|
}
|
|
5360
5247
|
this.pluginM[conf.id].update(conf);
|
|
5361
5248
|
});
|
|
5362
|
-
|
|
5363
5249
|
util/* default.each */.Z.each(this.pluginM, (conf, id) => {
|
|
5364
5250
|
if (pluginM[id]) return;
|
|
5365
5251
|
this.pluginM[id].destroy();
|
|
@@ -5448,7 +5334,9 @@ class PluginMgr {
|
|
|
5448
5334
|
}
|
|
5449
5335
|
}
|
|
5450
5336
|
;// CONCATENATED MODULE: ./src/lib.js
|
|
5451
|
-
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; }
|
|
5337
|
+
function lib_defineProperty(obj, key, value) { key = lib_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5338
|
+
function lib_toPropertyKey(arg) { var key = lib_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5339
|
+
function lib_toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
5452
5340
|
|
|
5453
5341
|
|
|
5454
5342
|
|
|
@@ -5472,7 +5360,6 @@ class Widget {
|
|
|
5472
5360
|
lib_defineProperty(this, "track", () => this.store.track());
|
|
5473
5361
|
this.domGate = new util/* default.Gate */.Z.Gate();
|
|
5474
5362
|
this.store = new Store(ApiURL, FileURL, RealtimeURL, inmem, fake);
|
|
5475
|
-
|
|
5476
5363
|
window.sbz_store = this.store;
|
|
5477
5364
|
this.subs = [];
|
|
5478
5365
|
this.store.onConvoEvent({
|
|
@@ -5522,7 +5409,6 @@ class Widget {
|
|
|
5522
5409
|
cb && cb(outmask);
|
|
5523
5410
|
return outmask;
|
|
5524
5411
|
}
|
|
5525
|
-
|
|
5526
5412
|
_setAccount(id, $con) {
|
|
5527
5413
|
return this.setAccount(id, $con);
|
|
5528
5414
|
}
|
|
@@ -5577,7 +5463,6 @@ class Widget {
|
|
|
5577
5463
|
await this.domGate.entry();
|
|
5578
5464
|
this.pluginMgr.hideCurrentGreeting();
|
|
5579
5465
|
}
|
|
5580
|
-
|
|
5581
5466
|
async showWidget(view, cid) {
|
|
5582
5467
|
await this.domGate.entry();
|
|
5583
5468
|
this.pluginMgr.showCurrentChatbox({
|
|
@@ -5633,7 +5518,6 @@ class Widget {
|
|
|
5633
5518
|
}
|
|
5634
5519
|
}
|
|
5635
5520
|
}
|
|
5636
|
-
|
|
5637
5521
|
window.__sbz_WIDGET = Widget;
|
|
5638
5522
|
/* harmony default export */ const lib = (Widget);
|
|
5639
5523
|
;// CONCATENATED MODULE: ./screenshoot.js
|