@subiz/widget-v4 4.0.63 → 4.0.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/less/chatbox.less +6 -1
- package/babel.config.js +2 -4
- package/compiled_src/bot.js +7 -1
- package/compiled_src/call/call.js +15 -12
- package/compiled_src/chatbox/ChatButton.js +3 -1
- package/compiled_src/chatbox/DropdownSelect.js +75 -66
- package/compiled_src/chatbox/Event.js +1 -0
- package/compiled_src/chatbox/MessageInput.js +7 -4
- package/compiled_src/chatbox/Order.js +94 -90
- package/compiled_src/chatbox/ProductAttachments.js +40 -4
- package/compiled_src/chatbox/Rating.js +10 -7
- package/compiled_src/chatbox/Typing.js +3 -1
- package/compiled_src/chatbox/Widget.js +27 -23
- package/compiled_src/chatbox/main.js +2 -0
- package/compiled_src/contact/contact.js +9 -6
- package/compiled_src/lib.js +14 -9
- package/compiled_src/notif/notif.js +15 -12
- package/compiled_src/order/address_picker.js +71 -63
- package/compiled_src/order/order.js +330 -316
- package/compiled_src/popup/countdown.js +7 -4
- package/compiled_src/popup/popup.js +12 -9
- package/compiled_src/store/api.js +110 -80
- package/compiled_src/store/api_fake.js +82 -55
- package/compiled_src/store/store.js +194 -135
- package/compiled_src/util/common.js +1 -1
- package/dist/132.js +678 -591
- package/dist/178.js +174 -341
- package/dist/17ff367201e.132.js +1 -0
- package/dist/17ff367201e.178.js +1 -0
- package/dist/17ff367201e.213.js +1 -0
- package/dist/17ff367201e.335.js +1 -0
- package/dist/17ff367201e.362.js +1 -0
- package/dist/17ff367201e.441.js +1 -0
- package/dist/17ff367201e.605.js +1 -0
- package/dist/17ff367201e.678.js +1 -0
- package/dist/17ff367201e.782.js +1 -0
- package/dist/17ff367201e.app.js +1 -0
- package/dist/{17e757ccadd.index.html → 17ff367201e.index.html} +1 -1
- package/dist/{17e757ccadd.library.html → 17ff367201e.library.html} +1 -1
- package/dist/17ff367201e.library.js +1 -0
- package/dist/{17e757ccadd.preview.html → 17ff367201e.preview.html} +1 -1
- package/dist/17ff367201e.preview.js +1 -0
- package/dist/17ff367201e.screenshoot.js +1 -0
- package/dist/213.js +19 -13
- package/dist/335.js +11 -8
- package/dist/362.js +21 -71
- package/dist/441.js +2 -2
- package/dist/605.js +15 -12
- 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 +453 -332
- package/package.json +14 -14
- package/src/bot.js +2 -1
- package/src/chatbox/Buttons.js +8 -8
- package/src/chatbox/ChatButton.js +2 -2
- package/src/chatbox/Event.js +1 -1
- package/src/chatbox/ProductAttachments.js +41 -5
- package/src/chatbox/Typing.js +5 -1
- package/src/chatbox/main.js +4 -1
- package/src/store/store.js +24 -11
- package/src/util/common.js +1 -1
- package/up +1 -1
- package/dist/0b82fa7e5c3b07b40a44.png +0 -1
- package/dist/0f4af006e38ee8b93633.png +0 -1
- package/dist/17e757ccadd.132.js +0 -1
- package/dist/17e757ccadd.178.js +0 -1
- package/dist/17e757ccadd.213.js +0 -1
- package/dist/17e757ccadd.335.js +0 -1
- package/dist/17e757ccadd.362.js +0 -1
- package/dist/17e757ccadd.441.js +0 -1
- package/dist/17e757ccadd.605.js +0 -1
- package/dist/17e757ccadd.678.js +0 -1
- package/dist/17e757ccadd.782.js +0 -1
- package/dist/17e757ccadd.app.js +0 -1
- package/dist/17e757ccadd.library.js +0 -1
- package/dist/17e757ccadd.preview.js +0 -1
- package/dist/17e757ccadd.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) {
|
|
@@ -3206,14 +3206,14 @@ class Pubsub {
|
|
|
3206
3206
|
|
|
3207
3207
|
"use strict";
|
|
3208
3208
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3209
|
-
/* harmony export */ "sY": () => (/* binding */ S),
|
|
3210
|
-
/* harmony export */ "h": () => (/* binding */ v),
|
|
3211
3209
|
/* harmony export */ "HY": () => (/* binding */ d),
|
|
3212
3210
|
/* harmony export */ "Vf": () => (/* binding */ p),
|
|
3211
|
+
/* harmony export */ "h": () => (/* binding */ v),
|
|
3212
|
+
/* harmony export */ "sY": () => (/* binding */ S),
|
|
3213
3213
|
/* harmony export */ "wA": () => (/* binding */ _)
|
|
3214
3214
|
/* harmony export */ });
|
|
3215
3215
|
/* unused harmony exports hydrate, createElement, isValidElement, cloneElement, createContext, toChildArray, options */
|
|
3216
|
-
var n,l,u,i,t,r,
|
|
3216
|
+
var n,l,u,i,t,o,r,f,e={},c=[],s=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function a(n,l){for(var u in l)n[u]=l[u];return n}function h(n){var l=n.parentNode;l&&l.removeChild(n)}function v(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return y(l,f,t,o,null)}function y(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u:r};return null==r&&null!=l.vnode&&l.vnode(f),f}function p(){return{current:null}}function d(n){return n.children}function _(n,l){this.props=n,this.context=l}function k(n,l){if(null==l)return n.__?k(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return"function"==typeof n.type?k(n):null}function b(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return b(n)}}function m(n){(!n.__d&&(n.__d=!0)&&t.push(n)&&!g.__r++||r!==l.debounceRendering)&&((r=l.debounceRendering)||o)(g)}function g(){for(var n;g.__r=t.length;)n=t.sort(function(n,l){return n.__v.__b-l.__v.__b}),t=[],n.some(function(n){var l,u,i,t,o,r;n.__d&&(o=(t=(l=n).__v).__e,(r=l.__P)&&(u=[],(i=a({},t)).__v=t.__v+1,j(r,t,i,l.__n,void 0!==r.ownerSVGElement,null!=t.__h?[o]:null,u,null==o?k(t):o,t.__h),z(u,t),t.__e!=o&&b(t)))})}function w(n,l,u,i,t,o,r,f,s,a){var h,v,p,_,b,m,g,w=i&&i.__k||c,A=w.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(_=u.__k[h]=null==(_=l[h])||"boolean"==typeof _?null:"string"==typeof _||"number"==typeof _||"bigint"==typeof _?y(null,_,null,null,_):Array.isArray(_)?y(d,{children:_},null,null,null):_.__b>0?y(_.type,_.props,_.key,null,_.__v):_)){if(_.__=u,_.__b=u.__b+1,null===(p=w[h])||p&&_.key==p.key&&_.type===p.type)w[h]=void 0;else for(v=0;v<A;v++){if((p=w[v])&&_.key==p.key&&_.type===p.type){w[v]=void 0;break}p=null}j(n,_,p=p||e,t,o,r,f,s,a),b=_.__e,(v=_.ref)&&p.ref!=v&&(g||(g=[]),p.ref&&g.push(p.ref,null,_),g.push(v,_.__c||b,_)),null!=b?(null==m&&(m=b),"function"==typeof _.type&&_.__k===p.__k?_.__d=s=x(_,s,n):s=P(n,_,p,w,b,s),"function"==typeof u.type&&(u.__d=s)):s&&p.__e==s&&s.parentNode!=n&&(s=k(p))}for(u.__e=m,h=A;h--;)null!=w[h]&&("function"==typeof u.type&&null!=w[h].__e&&w[h].__e==u.__d&&(u.__d=k(i,h+1)),N(w[h],w[h]));if(g)for(h=0;h<g.length;h++)M(g[h],g[++h],g[++h])}function x(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l="function"==typeof i.type?x(i,l,u):P(u,i,i,t,i.__e,l));return l}function A(n,l){return l=l||[],null==n||"boolean"==typeof n||(Array.isArray(n)?n.some(function(n){A(n,l)}):l.push(n)),l}function P(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else{for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=2)if(f==t)break n;n.insertBefore(t,o),r=o}return void 0!==r?r:t.nextSibling}function C(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||H(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||H(n,o,l[o],u[o],i)}function $(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]=null==u?"":"number"!=typeof u||s.test(l)?u:u+"px"}function H(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else{if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||$(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||$(n.style,l,u[l])}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?T:I,o):n.removeEventListener(l,o?T:I,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null!=u&&(!1!==u||"a"===l[0]&&"r"===l[1])?n.setAttribute(l,u):n.removeAttribute(l))}}function I(n){this.l[n.type+!1](l.event?l.event(n):n)}function T(n){this.l[n.type+!0](l.event?l.event(n):n)}function j(n,u,i,t,o,r,f,e,c){var s,h,v,y,p,k,b,m,g,x,A,P=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(s=l.__b)&&s(u);try{n:if("function"==typeof P){if(m=u.props,g=(s=P.contextType)&&t[s.__c],x=s?g?g.props.value:s.__:t,i.__c?b=(h=u.__c=i.__c).__=h.__E:("prototype"in P&&P.prototype.render?u.__c=h=new P(m,x):(u.__c=h=new _(m,x),h.constructor=P,h.render=O),g&&g.sub(h),h.props=m,h.state||(h.state={}),h.context=x,h.__n=t,v=h.__d=!0,h.__h=[]),null==h.__s&&(h.__s=h.state),null!=P.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=a({},h.__s)),a(h.__s,P.getDerivedStateFromProps(m,h.__s))),y=h.props,p=h.state,v)null==P.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(null==P.getDerivedStateFromProps&&m!==y&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(m,x),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(m,h.__s,x)||u.__v===i.__v){h.props=m,h.state=h.__s,u.__v!==i.__v&&(h.__d=!1),h.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u)}),h.__h.length&&f.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(m,h.__s,x),null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(y,p,k)})}h.context=x,h.props=m,h.state=h.__s,(s=l.__r)&&s(u),h.__d=!1,h.__v=u,h.__P=n,s=h.render(h.props,h.state,h.context),h.state=h.__s,null!=h.getChildContext&&(t=a(a({},t),h.getChildContext())),v||null==h.getSnapshotBeforeUpdate||(k=h.getSnapshotBeforeUpdate(y,p)),A=null!=s&&s.type===d&&null==s.key?s.props.children:s,w(n,Array.isArray(A)?A:[A],u,i,t,o,r,f,e,c),h.base=u.__e,u.__h=null,h.__h.length&&f.push(h),b&&(h.__E=h.__=null),h.__e=!1}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=L(i.__e,u,i,t,o,r,f,c);(s=l.diffed)&&s(u)}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l.__e(n,u,i)}}function z(n,u){l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u)})}catch(n){l.__e(n,u.__v)}})}function L(l,u,i,t,o,r,f,c){var s,a,v,y=i.props,p=u.props,d=u.type,_=0;if("svg"===d&&(o=!0),null!=r)for(;_<r.length;_++)if((s=r[_])&&"setAttribute"in s==!!d&&(d?s.localName===d:3===s.nodeType)){l=s,r[_]=null;break}if(null==l){if(null===d)return document.createTextNode(p);l=o?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,p.is&&p),r=null,c=!1}if(null===d)y===p||c&&l.data===p||(l.data=p);else{if(r=r&&n.call(l.childNodes),a=(y=i.props||e).dangerouslySetInnerHTML,v=p.dangerouslySetInnerHTML,!c){if(null!=r)for(y={},_=0;_<l.attributes.length;_++)y[l.attributes[_].name]=l.attributes[_].value;(v||a)&&(v&&(a&&v.__html==a.__html||v.__html===l.innerHTML)||(l.innerHTML=v&&v.__html||""))}if(C(l,p,y,o,c),v)u.__k=[];else if(_=u.props.children,w(l,Array.isArray(_)?_:[_],u,i,t,o&&"foreignObject"!==d,r,f,r?r[0]:i.__k&&k(i,0),c),null!=r)for(_=r.length;_--;)null!=r[_]&&h(r[_]);c||("value"in p&&void 0!==(_=p.value)&&(_!==l.value||"progress"===d&&!_||"option"===d&&_!==y.value)&&H(l,"value",_,y.value,!1),"checked"in p&&void 0!==(_=p.checked)&&_!==l.checked&&H(l,"checked",_,y.checked,!1))}return l}function M(n,u,i){try{"function"==typeof n?n(u):n.current=u}catch(n){l.__e(n,i)}}function N(n,u,i){var t,o;if(l.unmount&&l.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||M(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount()}catch(n){l.__e(n,u)}t.base=t.__P=null}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&N(t[o],u,"function"!=typeof n.type);i||null==n.__e||h(n.__e),n.__e=n.__d=void 0}function O(n,l,u){return this.constructor(n,u)}function S(u,i,t){var o,r,f;l.__&&l.__(u,i),r=(o="function"==typeof t)?null:t&&t.__k||i.__k,f=[],j(i,u=(!o&&t||i).__k=v(d,null,[u]),r||e,e,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n.call(i.childNodes):null,f,!o&&t?t:r?r.__e:i.firstChild,o),z(f,u)}function q(n,l){S(n,l,q)}function B(l,u,i){var t,o,r,f=a({},l.props);for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];return arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),y(l.type,f,t||l.key,o||l.ref,null)}function D(n,l){var u={__c:l="__cC"+f++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,i;return this.getChildContext||(u=[],(i={})[l]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(m)},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n)}}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=c.slice,l={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l}throw n}},u=0,i=function(n){return null!=n&&void 0===n.constructor},_.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=a({},this.state),"function"==typeof n&&(n=n(a({},u),this.props)),n&&a(u,n),null!=n&&this.__v&&(l&&this.__h.push(l),m(this))},_.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),m(this))},_.prototype.render=d,t=[],o="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,g.__r=0,f=0;
|
|
3217
3217
|
//# sourceMappingURL=preact.module.js.map
|
|
3218
3218
|
|
|
3219
3219
|
|
|
@@ -3364,7 +3364,7 @@ var n,l,u,i,t,r,o,f,e={},c=[],s=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[c
|
|
|
3364
3364
|
/******/
|
|
3365
3365
|
/******/ /* webpack/runtime/jsonp chunk loading */
|
|
3366
3366
|
/******/ (() => {
|
|
3367
|
-
/******/
|
|
3367
|
+
/******/ // no baseURI
|
|
3368
3368
|
/******/
|
|
3369
3369
|
/******/ // object to store loaded and loading chunks
|
|
3370
3370
|
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
|
@@ -3476,6 +3476,8 @@ var lsdb = (__webpack_require__(6929)/* ["default"] */ .Z);
|
|
|
3476
3476
|
inmem_localstorage
|
|
3477
3477
|
});
|
|
3478
3478
|
;// CONCATENATED MODULE: ./src/store/api.js
|
|
3479
|
+
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; }
|
|
3480
|
+
|
|
3479
3481
|
|
|
3480
3482
|
|
|
3481
3483
|
const ajax = __webpack_require__(7460);
|
|
@@ -3492,6 +3494,112 @@ function jsonifyTextPlain(param, done) {
|
|
|
3492
3494
|
|
|
3493
3495
|
/* harmony default export */ const api = (class {
|
|
3494
3496
|
constructor(ApiURL, FileURL) {
|
|
3497
|
+
_defineProperty(this, "listConversations", _ => this.apireq.addQuery('user_id', this.uid).addQuery('integration_id', `${this.accid}.subizv4.subikon`).get('/conversations'));
|
|
3498
|
+
|
|
3499
|
+
_defineProperty(this, "listMessages", (cid, limit, start_id) => this.apireq.addQuery('limit', limit).addQuery('start_id', start_id).get(`/conversations/${cid}/messages`));
|
|
3500
|
+
|
|
3501
|
+
_defineProperty(this, "ajax", ajax);
|
|
3502
|
+
|
|
3503
|
+
_defineProperty(this, "start", extraData => {
|
|
3504
|
+
let data = {
|
|
3505
|
+
starter_id: this.uid,
|
|
3506
|
+
starter_type: 'user',
|
|
3507
|
+
integration_id: `${this.accid}.subizv4.subikon`
|
|
3508
|
+
};
|
|
3509
|
+
util/* default.each */.Z.each(extraData, (v, k) => {
|
|
3510
|
+
data[k] = v;
|
|
3511
|
+
});
|
|
3512
|
+
return this.apireq.post('/conversations', data);
|
|
3513
|
+
});
|
|
3514
|
+
|
|
3515
|
+
_defineProperty(this, "sendConvoEvent", (cid, ev) => this.apireq.post(`/accounts/${this.accid}/conversations/${cid}/events`, ev));
|
|
3516
|
+
|
|
3517
|
+
_defineProperty(this, "createPostback", (cid, p) => this.apireq.post(`/accounts/${this.accid}/conversations/${cid}/postbacks`, p));
|
|
3518
|
+
|
|
3519
|
+
_defineProperty(this, "markAsReceived", (cid, messageId) => this.apireq.post(`/conversations/${cid}/messages/${messageId}/receive`));
|
|
3520
|
+
|
|
3521
|
+
_defineProperty(this, "markAsSeen", (cid, messageId) => this.apireq.post(`/conversations/${cid}/messages/${messageId}/seen`));
|
|
3522
|
+
|
|
3523
|
+
_defineProperty(this, "getConversation", cid => this.apireq.get(`/conversations/${cid}`));
|
|
3524
|
+
|
|
3525
|
+
_defineProperty(this, "getLocaleContent", locale => this.apireq.get(`/accounts/${this.accid}/locales/${locale}`));
|
|
3526
|
+
|
|
3527
|
+
_defineProperty(this, "sendEvent", data => this.apireq.post(`/users/${this.uid}/events`, data));
|
|
3528
|
+
|
|
3529
|
+
_defineProperty(this, "sendTyping", cid => this.apireq.post(`/conversations/${cid}/typing`));
|
|
3530
|
+
|
|
3531
|
+
_defineProperty(this, "uploadToS3", async file => {
|
|
3532
|
+
let {
|
|
3533
|
+
body: signed,
|
|
3534
|
+
error
|
|
3535
|
+
} = await this.apireq.post(`/accounts/${this.accid}/files`, {
|
|
3536
|
+
account_id: this.accid,
|
|
3537
|
+
description: 'upload\n user-client: web-widget',
|
|
3538
|
+
name: file.name.replace(/\s+/g, '_'),
|
|
3539
|
+
size: file.size,
|
|
3540
|
+
type: file.type
|
|
3541
|
+
});
|
|
3542
|
+
if (error) return {
|
|
3543
|
+
error
|
|
3544
|
+
};
|
|
3545
|
+
let contentType = file.type || 'application/octet-stream';
|
|
3546
|
+
({
|
|
3547
|
+
error
|
|
3548
|
+
} = await ajax.setContentType(contentType).put(signed.signed_url, file));
|
|
3549
|
+
if (error) return {
|
|
3550
|
+
error
|
|
3551
|
+
};
|
|
3552
|
+
let body;
|
|
3553
|
+
({
|
|
3554
|
+
body,
|
|
3555
|
+
error
|
|
3556
|
+
} = await this.apireq.post(`/accounts/${this.accid}/files/${signed.id}`, {
|
|
3557
|
+
account_id: this.accid
|
|
3558
|
+
}));
|
|
3559
|
+
if (error) return {
|
|
3560
|
+
error
|
|
3561
|
+
};
|
|
3562
|
+
return {
|
|
3563
|
+
url: this.FileURL + body.url
|
|
3564
|
+
};
|
|
3565
|
+
});
|
|
3566
|
+
|
|
3567
|
+
_defineProperty(this, "getChallenge", accid => this.apireq.post(`/accounts/${accid}/scrypt-challenges`));
|
|
3568
|
+
|
|
3569
|
+
_defineProperty(this, "time", _ => this.apireq.get('/time'));
|
|
3570
|
+
|
|
3571
|
+
_defineProperty(this, "updateUser", data => this.apireq.post(`/users/${this.uid}`, data));
|
|
3572
|
+
|
|
3573
|
+
_defineProperty(this, "getUser", _ => this.apireq.get(`/accounts/${this.accid}/users/${this.uid}`));
|
|
3574
|
+
|
|
3575
|
+
_defineProperty(this, "getAccountSetting", () => this.apireq.get(`/accounts/${this.accid}/settings`));
|
|
3576
|
+
|
|
3577
|
+
_defineProperty(this, "getIsOnline", () => this.apireq.get(`/accounts/${this.accid}/is_online`));
|
|
3578
|
+
|
|
3579
|
+
_defineProperty(this, "sendImpression", impression => this.apireq.post(`/accounts/${this.accid}/campaigns/${impression.campaign_id}/impressions`, impression));
|
|
3580
|
+
|
|
3581
|
+
_defineProperty(this, "sendConversion", conversion => this.apireq.post(`/accounts/${this.accid}/campaigns/${conversion.campaign_id}/conversions`, conversion));
|
|
3582
|
+
|
|
3583
|
+
_defineProperty(this, "lookupOrder", key => ajax.setBaseUrl(this.ApiURL).setContentType('text/plain').beforeHook(jsonifyTextPlain).setParser('json').addQuery('x-signed-key', key).get(`/orders/123`));
|
|
3584
|
+
|
|
3585
|
+
_defineProperty(this, "getOrder", id => this.apireq.get(`/accounts/${this.accid}/orders/` + id));
|
|
3586
|
+
|
|
3587
|
+
_defineProperty(this, "updateOrder", order => this.apireq.post(`/accounts/${this.accid}/orders/` + order.id, order));
|
|
3588
|
+
|
|
3589
|
+
_defineProperty(this, "fetchShippingAddresses", () => this.apireq.get(`/accounts/${this.accid}/users/${this.uid}/shipping-addresses`));
|
|
3590
|
+
|
|
3591
|
+
_defineProperty(this, "createShippingAddress", addr => this.apireq.post(`/accounts/${this.accid}/users/${this.uid}/shipping-addresses`, addr));
|
|
3592
|
+
|
|
3593
|
+
_defineProperty(this, "list_provinces", () => this.apireq.get(`/accounts/${this.accid}/provinces`));
|
|
3594
|
+
|
|
3595
|
+
_defineProperty(this, "list_districts", p => this.apireq.setQuery(p).get(`/accounts/${this.accid}/districts`));
|
|
3596
|
+
|
|
3597
|
+
_defineProperty(this, "list_wards", p => this.apireq.setQuery(p).get(`/accounts/${this.accid}/wards`));
|
|
3598
|
+
|
|
3599
|
+
_defineProperty(this, "suggest_address", keyword => this.apireq.setQuery({
|
|
3600
|
+
keyword: keyword
|
|
3601
|
+
}).get(`/accounts/${this.accid}/addresses`));
|
|
3602
|
+
|
|
3495
3603
|
this.FileURL = FileURL;
|
|
3496
3604
|
this.ApiURL = ApiURL;
|
|
3497
3605
|
this.apireq = ajax.setBaseUrl(ApiURL).withCredentials(true).addQuery('v', '6').setContentType('text/plain').beforeHook(jsonifyTextPlain).setParser('json').beforeHook((param, done) => {
|
|
@@ -3510,29 +3618,6 @@ function jsonifyTextPlain(param, done) {
|
|
|
3510
3618
|
this.uid = obj.uid;
|
|
3511
3619
|
}
|
|
3512
3620
|
|
|
3513
|
-
listConversations = _ => this.apireq.addQuery('user_id', this.uid).addQuery('integration_id', `${this.accid}.subizv4.subikon`).get('/conversations');
|
|
3514
|
-
listMessages = (cid, limit, start_id) => this.apireq.addQuery('limit', limit).addQuery('start_id', start_id).get(`/conversations/${cid}/messages`);
|
|
3515
|
-
ajax = ajax;
|
|
3516
|
-
start = extraData => {
|
|
3517
|
-
let data = {
|
|
3518
|
-
starter_id: this.uid,
|
|
3519
|
-
starter_type: 'user',
|
|
3520
|
-
integration_id: `${this.accid}.subizv4.subikon`
|
|
3521
|
-
};
|
|
3522
|
-
util/* default.each */.Z.each(extraData, (v, k) => {
|
|
3523
|
-
data[k] = v;
|
|
3524
|
-
});
|
|
3525
|
-
return this.apireq.post('/conversations', data);
|
|
3526
|
-
};
|
|
3527
|
-
sendConvoEvent = (cid, ev) => this.apireq.post(`/accounts/${this.accid}/conversations/${cid}/events`, ev);
|
|
3528
|
-
createPostback = (cid, p) => this.apireq.post(`/accounts/${this.accid}/conversations/${cid}/postbacks`, p);
|
|
3529
|
-
markAsReceived = (cid, messageId) => this.apireq.post(`/conversations/${cid}/messages/${messageId}/receive`);
|
|
3530
|
-
markAsSeen = (cid, messageId) => this.apireq.post(`/conversations/${cid}/messages/${messageId}/seen`);
|
|
3531
|
-
getConversation = cid => this.apireq.get(`/conversations/${cid}`);
|
|
3532
|
-
getLocaleContent = locale => this.apireq.get(`/accounts/${this.accid}/locales/${locale}`);
|
|
3533
|
-
sendEvent = data => this.apireq.post(`/users/${this.uid}/events`, data);
|
|
3534
|
-
sendTyping = cid => this.apireq.post(`/conversations/${cid}/typing`);
|
|
3535
|
-
|
|
3536
3621
|
sendPresence(device, is_focused) {
|
|
3537
3622
|
return this.sendEvent({
|
|
3538
3623
|
by: {
|
|
@@ -3566,43 +3651,6 @@ function jsonifyTextPlain(param, done) {
|
|
|
3566
3651
|
});
|
|
3567
3652
|
}
|
|
3568
3653
|
|
|
3569
|
-
uploadToS3 = async file => {
|
|
3570
|
-
let {
|
|
3571
|
-
body: signed,
|
|
3572
|
-
error
|
|
3573
|
-
} = await this.apireq.post(`/accounts/${this.accid}/files`, {
|
|
3574
|
-
account_id: this.accid,
|
|
3575
|
-
description: 'upload\n user-client: web-widget',
|
|
3576
|
-
name: file.name.replace(/\s+/g, '_'),
|
|
3577
|
-
size: file.size,
|
|
3578
|
-
type: file.type
|
|
3579
|
-
});
|
|
3580
|
-
if (error) return {
|
|
3581
|
-
error
|
|
3582
|
-
};
|
|
3583
|
-
let contentType = file.type || 'application/octet-stream';
|
|
3584
|
-
({
|
|
3585
|
-
error
|
|
3586
|
-
} = await ajax.setContentType(contentType).put(signed.signed_url, file));
|
|
3587
|
-
if (error) return {
|
|
3588
|
-
error
|
|
3589
|
-
};
|
|
3590
|
-
let body;
|
|
3591
|
-
({
|
|
3592
|
-
body,
|
|
3593
|
-
error
|
|
3594
|
-
} = await this.apireq.post(`/accounts/${this.accid}/files/${signed.id}`, {
|
|
3595
|
-
account_id: this.accid
|
|
3596
|
-
}));
|
|
3597
|
-
if (error) return {
|
|
3598
|
-
error
|
|
3599
|
-
};
|
|
3600
|
-
return {
|
|
3601
|
-
url: this.FileURL + body.url
|
|
3602
|
-
};
|
|
3603
|
-
};
|
|
3604
|
-
getChallenge = accid => this.apireq.post(`/accounts/${accid}/scrypt-challenges`);
|
|
3605
|
-
|
|
3606
3654
|
async createAgentUser(agenttoken) {
|
|
3607
3655
|
for (var i = 0; i < 10; i++) {
|
|
3608
3656
|
let {
|
|
@@ -3645,26 +3693,10 @@ function jsonifyTextPlain(param, done) {
|
|
|
3645
3693
|
}
|
|
3646
3694
|
}
|
|
3647
3695
|
|
|
3648
|
-
time = _ => this.apireq.get('/time');
|
|
3649
|
-
updateUser = data => this.apireq.post(`/users/${this.uid}`, data);
|
|
3650
|
-
getUser = _ => this.apireq.get(`/accounts/${this.accid}/users/${this.uid}`);
|
|
3651
|
-
getAccountSetting = () => this.apireq.get(`/accounts/${this.accid}/settings`);
|
|
3652
|
-
getIsOnline = () => this.apireq.get(`/accounts/${this.accid}/is_online`);
|
|
3653
|
-
sendImpression = impression => this.apireq.post(`/accounts/${this.accid}/campaigns/${impression.campaign_id}/impressions`, impression);
|
|
3654
|
-
sendConversion = conversion => this.apireq.post(`/accounts/${this.accid}/campaigns/${conversion.campaign_id}/conversions`, conversion);
|
|
3655
|
-
lookupOrder = key => ajax.setBaseUrl(this.ApiURL).setContentType('text/plain').beforeHook(jsonifyTextPlain).setParser('json').addQuery('x-signed-key', key).get(`/orders/123`);
|
|
3656
|
-
getOrder = id => this.apireq.get(`/accounts/${this.accid}/orders/` + id);
|
|
3657
|
-
updateOrder = order => this.apireq.post(`/accounts/${this.accid}/orders/` + order.id, order);
|
|
3658
|
-
fetchShippingAddresses = () => this.apireq.get(`/accounts/${this.accid}/users/${this.uid}/shipping-addresses`);
|
|
3659
|
-
createShippingAddress = addr => this.apireq.post(`/accounts/${this.accid}/users/${this.uid}/shipping-addresses`, addr);
|
|
3660
|
-
list_provinces = () => this.apireq.get(`/accounts/${this.accid}/provinces`);
|
|
3661
|
-
list_districts = p => this.apireq.setQuery(p).get(`/accounts/${this.accid}/districts`);
|
|
3662
|
-
list_wards = p => this.apireq.setQuery(p).get(`/accounts/${this.accid}/wards`);
|
|
3663
|
-
suggest_address = keyword => this.apireq.setQuery({
|
|
3664
|
-
keyword: keyword
|
|
3665
|
-
}).get(`/accounts/${this.accid}/addresses`);
|
|
3666
3696
|
});
|
|
3667
3697
|
;// CONCATENATED MODULE: ./src/store/api_fake.js
|
|
3698
|
+
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; }
|
|
3699
|
+
|
|
3668
3700
|
|
|
3669
3701
|
|
|
3670
3702
|
const api_fake_ajax = __webpack_require__(7460);
|
|
@@ -3684,6 +3716,86 @@ const OK200 = Promise.resolve({
|
|
|
3684
3716
|
});
|
|
3685
3717
|
/* harmony default export */ const api_fake = (class {
|
|
3686
3718
|
constructor(ApiURL, FileURL) {
|
|
3719
|
+
api_fake_defineProperty(this, "listConversations", _ => {
|
|
3720
|
+
let convo = makeFakeConvo(this.accid, 'csqwudlkftltnbebvq', this.uid, this.agentid);
|
|
3721
|
+
return Promise.resolve({
|
|
3722
|
+
body: {
|
|
3723
|
+
anchor: '',
|
|
3724
|
+
conversations: [convo]
|
|
3725
|
+
},
|
|
3726
|
+
code: 200
|
|
3727
|
+
});
|
|
3728
|
+
});
|
|
3729
|
+
|
|
3730
|
+
api_fake_defineProperty(this, "listMessages", (cid, limit, start_id) => {
|
|
3731
|
+
let messages = makeFakeMessages(this.accid, 'csqwudlkftltnbebvq', this.uid, this.agentid);
|
|
3732
|
+
return Promise.resolve({
|
|
3733
|
+
body: messages,
|
|
3734
|
+
code: 200
|
|
3735
|
+
});
|
|
3736
|
+
});
|
|
3737
|
+
|
|
3738
|
+
api_fake_defineProperty(this, "ajax", api_fake_ajax);
|
|
3739
|
+
|
|
3740
|
+
api_fake_defineProperty(this, "start", extraData => OK200);
|
|
3741
|
+
|
|
3742
|
+
api_fake_defineProperty(this, "sendConvoEvent", (cid, ev) => OK200);
|
|
3743
|
+
|
|
3744
|
+
api_fake_defineProperty(this, "createPostback", (cid, p) => OK200);
|
|
3745
|
+
|
|
3746
|
+
api_fake_defineProperty(this, "markAsReceived", (cid, messageId) => OK200);
|
|
3747
|
+
|
|
3748
|
+
api_fake_defineProperty(this, "markAsSeen", (cid, messageId) => OK200);
|
|
3749
|
+
|
|
3750
|
+
api_fake_defineProperty(this, "getConversation", cid => Promise.resolve({
|
|
3751
|
+
body: makeFakeConvo(this.accid, 'csqwudlkftltnbebvq', this.uid, this.agentid),
|
|
3752
|
+
code: 200
|
|
3753
|
+
}));
|
|
3754
|
+
|
|
3755
|
+
api_fake_defineProperty(this, "getLocaleContent", locale => this.apireq.get(`/accounts/${this.accid}/locales/${locale}`));
|
|
3756
|
+
|
|
3757
|
+
api_fake_defineProperty(this, "sendEvent", data => OK200);
|
|
3758
|
+
|
|
3759
|
+
api_fake_defineProperty(this, "sendTyping", cid => OK200);
|
|
3760
|
+
|
|
3761
|
+
api_fake_defineProperty(this, "sendPresence", data => OK200);
|
|
3762
|
+
|
|
3763
|
+
api_fake_defineProperty(this, "sendContent", data => OK200);
|
|
3764
|
+
|
|
3765
|
+
api_fake_defineProperty(this, "uploadToS3", async file => OK200);
|
|
3766
|
+
|
|
3767
|
+
api_fake_defineProperty(this, "getChallenge", accid => OK200);
|
|
3768
|
+
|
|
3769
|
+
api_fake_defineProperty(this, "createUser", accid => Promise.resolve({
|
|
3770
|
+
account_id: accid,
|
|
3771
|
+
id: 'usqzgtgfake',
|
|
3772
|
+
mask: 'fakemask'
|
|
3773
|
+
}));
|
|
3774
|
+
|
|
3775
|
+
api_fake_defineProperty(this, "createAgentUser", agenttoken => Promise.resolve('fakemask'));
|
|
3776
|
+
|
|
3777
|
+
api_fake_defineProperty(this, "time", _ => Promise.resolve({
|
|
3778
|
+
code: 200,
|
|
3779
|
+
body: new util/* default.Date */.Z.Date().toISOString()
|
|
3780
|
+
}));
|
|
3781
|
+
|
|
3782
|
+
api_fake_defineProperty(this, "updateUser", data => OK200);
|
|
3783
|
+
|
|
3784
|
+
api_fake_defineProperty(this, "getUser", _ => Promise.resolve({
|
|
3785
|
+
code: 200,
|
|
3786
|
+
body: {
|
|
3787
|
+
id: '-'
|
|
3788
|
+
}
|
|
3789
|
+
}));
|
|
3790
|
+
|
|
3791
|
+
api_fake_defineProperty(this, "getAccountSetting", () => this.apireq.get(`/accounts/${this.accid}/settings`));
|
|
3792
|
+
|
|
3793
|
+
api_fake_defineProperty(this, "getIsOnline", () => this.apireq.get(`/accounts/${this.accid}/is_online`));
|
|
3794
|
+
|
|
3795
|
+
api_fake_defineProperty(this, "sendImpression", impression => OK200);
|
|
3796
|
+
|
|
3797
|
+
api_fake_defineProperty(this, "sendConversion", conversion => OK200);
|
|
3798
|
+
|
|
3687
3799
|
this.FileURL = FileURL;
|
|
3688
3800
|
this.apireq = api_fake_ajax.setBaseUrl(ApiURL).setContentType('text/plain').beforeHook(api_fake_jsonifyTextPlain).setParser('json');
|
|
3689
3801
|
}
|
|
@@ -3698,61 +3810,6 @@ const OK200 = Promise.resolve({
|
|
|
3698
3810
|
this.uid = obj.uid;
|
|
3699
3811
|
}
|
|
3700
3812
|
|
|
3701
|
-
listConversations = _ => {
|
|
3702
|
-
let convo = makeFakeConvo(this.accid, 'csqwudlkftltnbebvq', this.uid, this.agentid);
|
|
3703
|
-
return Promise.resolve({
|
|
3704
|
-
body: {
|
|
3705
|
-
anchor: '',
|
|
3706
|
-
conversations: [convo]
|
|
3707
|
-
},
|
|
3708
|
-
code: 200
|
|
3709
|
-
});
|
|
3710
|
-
};
|
|
3711
|
-
listMessages = (cid, limit, start_id) => {
|
|
3712
|
-
let messages = makeFakeMessages(this.accid, 'csqwudlkftltnbebvq', this.uid, this.agentid);
|
|
3713
|
-
return Promise.resolve({
|
|
3714
|
-
body: messages,
|
|
3715
|
-
code: 200
|
|
3716
|
-
});
|
|
3717
|
-
};
|
|
3718
|
-
ajax = api_fake_ajax;
|
|
3719
|
-
start = extraData => OK200;
|
|
3720
|
-
sendConvoEvent = (cid, ev) => OK200;
|
|
3721
|
-
createPostback = (cid, p) => OK200;
|
|
3722
|
-
markAsReceived = (cid, messageId) => OK200;
|
|
3723
|
-
markAsSeen = (cid, messageId) => OK200;
|
|
3724
|
-
getConversation = cid => Promise.resolve({
|
|
3725
|
-
body: makeFakeConvo(this.accid, 'csqwudlkftltnbebvq', this.uid, this.agentid),
|
|
3726
|
-
code: 200
|
|
3727
|
-
});
|
|
3728
|
-
getLocaleContent = locale => this.apireq.get(`/accounts/${this.accid}/locales/${locale}`);
|
|
3729
|
-
sendEvent = data => OK200;
|
|
3730
|
-
sendTyping = cid => OK200;
|
|
3731
|
-
sendPresence = data => OK200;
|
|
3732
|
-
sendContent = data => OK200;
|
|
3733
|
-
uploadToS3 = async file => OK200;
|
|
3734
|
-
getChallenge = accid => OK200;
|
|
3735
|
-
createUser = accid => Promise.resolve({
|
|
3736
|
-
account_id: accid,
|
|
3737
|
-
id: 'usqzgtgfake',
|
|
3738
|
-
mask: 'fakemask'
|
|
3739
|
-
});
|
|
3740
|
-
createAgentUser = agenttoken => Promise.resolve('fakemask');
|
|
3741
|
-
time = _ => Promise.resolve({
|
|
3742
|
-
code: 200,
|
|
3743
|
-
body: new util/* default.Date */.Z.Date().toISOString()
|
|
3744
|
-
});
|
|
3745
|
-
updateUser = data => OK200;
|
|
3746
|
-
getUser = _ => Promise.resolve({
|
|
3747
|
-
code: 200,
|
|
3748
|
-
body: {
|
|
3749
|
-
id: '-'
|
|
3750
|
-
}
|
|
3751
|
-
});
|
|
3752
|
-
getAccountSetting = () => this.apireq.get(`/accounts/${this.accid}/settings`);
|
|
3753
|
-
getIsOnline = () => this.apireq.get(`/accounts/${this.accid}/is_online`);
|
|
3754
|
-
sendImpression = impression => OK200;
|
|
3755
|
-
sendConversion = conversion => OK200;
|
|
3756
3813
|
});
|
|
3757
3814
|
|
|
3758
3815
|
function makeFakeConvo(accid, convoid, userid, agentid) {
|
|
@@ -4105,6 +4162,8 @@ function makeFakeMessages(accid, convoid, userid, agentid) {
|
|
|
4105
4162
|
|
|
4106
4163
|
});
|
|
4107
4164
|
;// CONCATENATED MODULE: ./src/store/store.js
|
|
4165
|
+
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; }
|
|
4166
|
+
|
|
4108
4167
|
|
|
4109
4168
|
|
|
4110
4169
|
var flow = __webpack_require__(3165);
|
|
@@ -4125,6 +4184,175 @@ const MAX_CONVO = 20;
|
|
|
4125
4184
|
const page_loaded = util/* default.Date.now */.Z.Date.now();
|
|
4126
4185
|
class Store {
|
|
4127
4186
|
constructor(ApiURL, FileURL, RealtimeURL, inmem, fakeapi, agenttoken) {
|
|
4187
|
+
store_defineProperty(this, "inmem", false);
|
|
4188
|
+
|
|
4189
|
+
store_defineProperty(this, "cookie", cookie);
|
|
4190
|
+
|
|
4191
|
+
store_defineProperty(this, "new_visitor", true);
|
|
4192
|
+
|
|
4193
|
+
store_defineProperty(this, "matchUser", () => {
|
|
4194
|
+
this._touchAcc();
|
|
4195
|
+
|
|
4196
|
+
return this.kv.match('user');
|
|
4197
|
+
});
|
|
4198
|
+
|
|
4199
|
+
store_defineProperty(this, "suggest_addresses", keyword => this.api.suggest_address(keyword));
|
|
4200
|
+
|
|
4201
|
+
store_defineProperty(this, "matchSession", () => this.kv.match('session') || {});
|
|
4202
|
+
|
|
4203
|
+
store_defineProperty(this, "matchAccount", () => this.cache.match('account'));
|
|
4204
|
+
|
|
4205
|
+
store_defineProperty(this, "matchPaymentMethods", () => this.cache.match('payment_methods'));
|
|
4206
|
+
|
|
4207
|
+
store_defineProperty(this, "matchUnread", () => {
|
|
4208
|
+
let user = this.matchUser();
|
|
4209
|
+
let allconvos = this.matchConvo('*');
|
|
4210
|
+
let unreadcount = 0;
|
|
4211
|
+
util/* default.map */.Z.map(allconvos, convo => {
|
|
4212
|
+
if (!util/* default.isConvoSeen */.Z.isConvoSeen(convo, user.id)) unreadcount++;
|
|
4213
|
+
});
|
|
4214
|
+
return unreadcount;
|
|
4215
|
+
});
|
|
4216
|
+
|
|
4217
|
+
store_defineProperty(this, "matchPlugin", () => {
|
|
4218
|
+
if (util/* default.size */.Z.size(this.forcePlugins) > 0) return util/* default.cloneDeep */.Z.cloneDeep(this.forcePlugins);
|
|
4219
|
+
return util/* default.cloneDeep */.Z.cloneDeep(this.cache.match('plugin')) || {};
|
|
4220
|
+
});
|
|
4221
|
+
|
|
4222
|
+
store_defineProperty(this, "device", {});
|
|
4223
|
+
|
|
4224
|
+
store_defineProperty(this, "browserVisibility", 'visible');
|
|
4225
|
+
|
|
4226
|
+
store_defineProperty(this, "matchAgent", id => {
|
|
4227
|
+
let agentM = this.cache.match('agent') || {};
|
|
4228
|
+
if (id === '*') return agentM;
|
|
4229
|
+
return agentM[id];
|
|
4230
|
+
});
|
|
4231
|
+
|
|
4232
|
+
store_defineProperty(this, "matchConvo", id => {
|
|
4233
|
+
if (!id) return;
|
|
4234
|
+
|
|
4235
|
+
if (id === '*') {
|
|
4236
|
+
this._touchAcc();
|
|
4237
|
+
|
|
4238
|
+
return util/* default.filter */.Z.filter(this.cache.all(), (value, k) => k.startsWith('convo_'));
|
|
4239
|
+
}
|
|
4240
|
+
|
|
4241
|
+
if (!this.isInsync(id)) this.fetchConvo(id);
|
|
4242
|
+
return this.cache.match('convo_' + id);
|
|
4243
|
+
});
|
|
4244
|
+
|
|
4245
|
+
store_defineProperty(this, "fetchConvo", async cid => {
|
|
4246
|
+
await this.readyGate.entry();
|
|
4247
|
+
await this.reconnectGate.entry(undefined, true);
|
|
4248
|
+
if (this.isInsync(cid)) return this.reconnectGate.open();
|
|
4249
|
+
this.markSync(cid);
|
|
4250
|
+
let {
|
|
4251
|
+
body: convo,
|
|
4252
|
+
error
|
|
4253
|
+
} = await this.api.getConversation(cid);
|
|
4254
|
+
if (convo && !error) this._setConvo(convo);
|
|
4255
|
+
return this.reconnectGate.open();
|
|
4256
|
+
});
|
|
4257
|
+
|
|
4258
|
+
store_defineProperty(this, "list_provinces", () => this.api.list_provinces());
|
|
4259
|
+
|
|
4260
|
+
store_defineProperty(this, "list_districts", p => this.api.list_districts(p));
|
|
4261
|
+
|
|
4262
|
+
store_defineProperty(this, "list_wards", p => this.api.list_wards(p));
|
|
4263
|
+
|
|
4264
|
+
store_defineProperty(this, "list_provices", void 0);
|
|
4265
|
+
|
|
4266
|
+
store_defineProperty(this, "listEvents", id => {
|
|
4267
|
+
if (!id || id === '*' || typeof id !== 'string') return;
|
|
4268
|
+
|
|
4269
|
+
if (!this.isInsync('events' + id)) {
|
|
4270
|
+
setTimeout(async () => {
|
|
4271
|
+
await this.readyGate.entry();
|
|
4272
|
+
await this.reconnectGate.entry(undefined, true);
|
|
4273
|
+
if (this.isInsync('events' + id)) return this.reconnectGate.open();
|
|
4274
|
+
this.markSync('events' + id);
|
|
4275
|
+
await this.chain.reload(id, (type, anchor, limit) => this.listmessageapi(type, anchor, limit));
|
|
4276
|
+
this.pubsub.publish('account');
|
|
4277
|
+
return this.reconnectGate.open();
|
|
4278
|
+
}, 10);
|
|
4279
|
+
}
|
|
4280
|
+
|
|
4281
|
+
return this.chain.listM(id);
|
|
4282
|
+
});
|
|
4283
|
+
|
|
4284
|
+
store_defineProperty(this, "fetchMoreEvents", async convoid => {
|
|
4285
|
+
let {
|
|
4286
|
+
error
|
|
4287
|
+
} = await this.chain.fetchMore(convoid, 50, (type, anchor, limit) => this.listmessageapi(type, anchor, limit));
|
|
4288
|
+
this.pubsub.publish('account');
|
|
4289
|
+
return {
|
|
4290
|
+
error
|
|
4291
|
+
};
|
|
4292
|
+
});
|
|
4293
|
+
|
|
4294
|
+
store_defineProperty(this, "matchBot", () => this.cache.match('bot') || {});
|
|
4295
|
+
|
|
4296
|
+
store_defineProperty(this, "readyGate", new util/* default.Gate */.Z.Gate());
|
|
4297
|
+
|
|
4298
|
+
store_defineProperty(this, "convoGate", new util/* default.Gate */.Z.Gate(true));
|
|
4299
|
+
|
|
4300
|
+
store_defineProperty(this, "reconnectGate", new util/* default.Gate */.Z.Gate(true));
|
|
4301
|
+
|
|
4302
|
+
store_defineProperty(this, "matchLastview", () => this.kv.match('lastview') || {});
|
|
4303
|
+
|
|
4304
|
+
store_defineProperty(this, "matchIsOpen", () => !!this.kv.match('isopen'));
|
|
4305
|
+
|
|
4306
|
+
store_defineProperty(this, "matchHasManuallyClosed", () => !!this.kv.match('hasManuallyClosed'));
|
|
4307
|
+
|
|
4308
|
+
store_defineProperty(this, "matchClosePreviewAt", () => this.kv.match('close_preview_at') || 0);
|
|
4309
|
+
|
|
4310
|
+
store_defineProperty(this, "sendPresence", util/* default.throttle */.Z.throttle(async () => {
|
|
4311
|
+
await this.readyGate.entry();
|
|
4312
|
+
if (!util/* default.get */.Z.get(this.kv.match('user'), 'id')) return;
|
|
4313
|
+
if (util/* default.isUserBanned */.Z.isUserBanned(this.kv.match('user'))) return;
|
|
4314
|
+
return this.api.sendPresence(this.device, this.browserVisibility === 'visible' && document.hasFocus());
|
|
4315
|
+
}, 1000));
|
|
4316
|
+
|
|
4317
|
+
store_defineProperty(this, "now", () => util/* default.Date.now */.Z.Date.now() + this.timeDiff);
|
|
4318
|
+
|
|
4319
|
+
store_defineProperty(this, "seenQueue", []);
|
|
4320
|
+
|
|
4321
|
+
store_defineProperty(this, "_typing", util/* default.throttle */.Z.throttle(convoid => this.api.sendTyping(convoid), 3000));
|
|
4322
|
+
|
|
4323
|
+
store_defineProperty(this, "onConvoEvent", (o, cb) => this.pubsub.on2(o, 'events', cb));
|
|
4324
|
+
|
|
4325
|
+
store_defineProperty(this, "seenConvo", id => {
|
|
4326
|
+
if (!id || id === 'create') return;
|
|
4327
|
+
this.seenQueue.push(id);
|
|
4328
|
+
});
|
|
4329
|
+
|
|
4330
|
+
store_defineProperty(this, "onUpdate", (o, cb) => this.pubsub.on2(o, 'account', cb));
|
|
4331
|
+
|
|
4332
|
+
store_defineProperty(this, "onResetCSS", (o, cb) => this.pubsub.on2(o, 'resetCSS', cb));
|
|
4333
|
+
|
|
4334
|
+
store_defineProperty(this, "onHighlight", (o, cb) => this.pubsub.on2(o, 'highlight', cb));
|
|
4335
|
+
|
|
4336
|
+
store_defineProperty(this, "setHasManuallyClosed", () => this.kv.put('hasManuallyClosed', true));
|
|
4337
|
+
|
|
4338
|
+
store_defineProperty(this, "setIsOpen", isopen => {
|
|
4339
|
+
let lastisopen = this.kv.match('isopen');
|
|
4340
|
+
this.kv.put('isopen', isopen);
|
|
4341
|
+
|
|
4342
|
+
if (!lastisopen && isopen) {
|
|
4343
|
+
sendEventToThirdParty('SUBIZ Chat', 'Opened', 'Subiz Windows');
|
|
4344
|
+
}
|
|
4345
|
+
});
|
|
4346
|
+
|
|
4347
|
+
store_defineProperty(this, "closePreview", () => this.kv.put('close_preview_at', new util/* default.Date */.Z.Date().getTime()));
|
|
4348
|
+
|
|
4349
|
+
store_defineProperty(this, "setLastview", (view, opts) => this.kv.put('lastview', {
|
|
4350
|
+
view,
|
|
4351
|
+
opts
|
|
4352
|
+
}));
|
|
4353
|
+
|
|
4354
|
+
store_defineProperty(this, "timeDiff", 0);
|
|
4355
|
+
|
|
4128
4356
|
this.agent_token = agenttoken;
|
|
4129
4357
|
this.g_sync = {};
|
|
4130
4358
|
this.forceDevice = null;
|
|
@@ -4178,9 +4406,6 @@ class Store {
|
|
|
4178
4406
|
}, 2000);
|
|
4179
4407
|
}
|
|
4180
4408
|
|
|
4181
|
-
inmem = false;
|
|
4182
|
-
cookie = cookie;
|
|
4183
|
-
|
|
4184
4409
|
isInsync(key) {
|
|
4185
4410
|
return util/* default.Date.now */.Z.Date.now() - (this.g_sync[key] || 0) < 300000;
|
|
4186
4411
|
}
|
|
@@ -4279,113 +4504,12 @@ class Store {
|
|
|
4279
4504
|
this.g_sync[key] = util/* default.Date.now */.Z.Date.now();
|
|
4280
4505
|
}
|
|
4281
4506
|
|
|
4282
|
-
new_visitor = true;
|
|
4283
|
-
|
|
4284
4507
|
async _touchAcc() {
|
|
4285
4508
|
if (this.isInsync('account')) return;
|
|
4286
4509
|
await this.readyGate.entry();
|
|
4287
4510
|
if (!this.isInsync('account')) this.reconnect();
|
|
4288
4511
|
}
|
|
4289
4512
|
|
|
4290
|
-
matchUser = () => {
|
|
4291
|
-
this._touchAcc();
|
|
4292
|
-
|
|
4293
|
-
return this.kv.match('user');
|
|
4294
|
-
};
|
|
4295
|
-
suggest_addresses = keyword => this.api.suggest_address(keyword);
|
|
4296
|
-
matchSession = () => this.kv.match('session') || {};
|
|
4297
|
-
matchAccount = () => this.cache.match('account');
|
|
4298
|
-
matchPaymentMethods = () => this.cache.match('payment_methods');
|
|
4299
|
-
matchUnread = () => {
|
|
4300
|
-
let user = this.matchUser();
|
|
4301
|
-
let allconvos = this.matchConvo('*');
|
|
4302
|
-
let unreadcount = 0;
|
|
4303
|
-
util/* default.map */.Z.map(allconvos, convo => {
|
|
4304
|
-
if (!util/* default.isConvoSeen */.Z.isConvoSeen(convo, user.id)) unreadcount++;
|
|
4305
|
-
});
|
|
4306
|
-
return unreadcount;
|
|
4307
|
-
};
|
|
4308
|
-
matchPlugin = () => {
|
|
4309
|
-
if (util/* default.size */.Z.size(this.forcePlugins) > 0) return util/* default.cloneDeep */.Z.cloneDeep(this.forcePlugins);
|
|
4310
|
-
return util/* default.cloneDeep */.Z.cloneDeep(this.cache.match('plugin')) || {};
|
|
4311
|
-
};
|
|
4312
|
-
device = {};
|
|
4313
|
-
browserVisibility = 'visible';
|
|
4314
|
-
matchAgent = id => {
|
|
4315
|
-
let agentM = this.cache.match('agent') || {};
|
|
4316
|
-
if (id === '*') return agentM;
|
|
4317
|
-
return agentM[id];
|
|
4318
|
-
};
|
|
4319
|
-
matchConvo = id => {
|
|
4320
|
-
if (!id) return;
|
|
4321
|
-
|
|
4322
|
-
if (id === '*') {
|
|
4323
|
-
this._touchAcc();
|
|
4324
|
-
|
|
4325
|
-
return util/* default.filter */.Z.filter(this.cache.all(), (value, k) => k.startsWith('convo_'));
|
|
4326
|
-
}
|
|
4327
|
-
|
|
4328
|
-
if (!this.isInsync(id)) this.fetchConvo(id);
|
|
4329
|
-
return this.cache.match('convo_' + id);
|
|
4330
|
-
};
|
|
4331
|
-
fetchConvo = async cid => {
|
|
4332
|
-
await this.readyGate.entry();
|
|
4333
|
-
await this.reconnectGate.entry(undefined, true);
|
|
4334
|
-
if (this.isInsync(cid)) return this.reconnectGate.open();
|
|
4335
|
-
this.markSync(cid);
|
|
4336
|
-
let {
|
|
4337
|
-
body: convo,
|
|
4338
|
-
error
|
|
4339
|
-
} = await this.api.getConversation(cid);
|
|
4340
|
-
if (convo && !error) this._setConvo(convo);
|
|
4341
|
-
return this.reconnectGate.open();
|
|
4342
|
-
};
|
|
4343
|
-
list_provinces = () => this.api.list_provinces();
|
|
4344
|
-
list_districts = p => this.api.list_districts(p);
|
|
4345
|
-
list_wards = p => this.api.list_wards(p);
|
|
4346
|
-
list_provices;
|
|
4347
|
-
listEvents = id => {
|
|
4348
|
-
if (!id || id === '*' || typeof id !== 'string') return;
|
|
4349
|
-
|
|
4350
|
-
if (!this.isInsync('events' + id)) {
|
|
4351
|
-
setTimeout(async () => {
|
|
4352
|
-
await this.readyGate.entry();
|
|
4353
|
-
await this.reconnectGate.entry(undefined, true);
|
|
4354
|
-
if (this.isInsync('events' + id)) return this.reconnectGate.open();
|
|
4355
|
-
this.markSync('events' + id);
|
|
4356
|
-
await this.chain.reload(id, (type, anchor, limit) => this.listmessageapi(type, anchor, limit));
|
|
4357
|
-
this.pubsub.publish('account');
|
|
4358
|
-
return this.reconnectGate.open();
|
|
4359
|
-
}, 10);
|
|
4360
|
-
}
|
|
4361
|
-
|
|
4362
|
-
return this.chain.listM(id);
|
|
4363
|
-
};
|
|
4364
|
-
fetchMoreEvents = async convoid => {
|
|
4365
|
-
let {
|
|
4366
|
-
error
|
|
4367
|
-
} = await this.chain.fetchMore(convoid, 50, (type, anchor, limit) => this.listmessageapi(type, anchor, limit));
|
|
4368
|
-
this.pubsub.publish('account');
|
|
4369
|
-
return {
|
|
4370
|
-
error
|
|
4371
|
-
};
|
|
4372
|
-
};
|
|
4373
|
-
matchBot = () => this.cache.match('bot') || {};
|
|
4374
|
-
readyGate = new util/* default.Gate */.Z.Gate();
|
|
4375
|
-
convoGate = new util/* default.Gate */.Z.Gate(true);
|
|
4376
|
-
reconnectGate = new util/* default.Gate */.Z.Gate(true);
|
|
4377
|
-
matchLastview = () => this.kv.match('lastview') || {};
|
|
4378
|
-
matchIsOpen = () => !!this.kv.match('isopen');
|
|
4379
|
-
matchHasManuallyClosed = () => !!this.kv.match('hasManuallyClosed');
|
|
4380
|
-
matchClosePreviewAt = () => this.kv.match('close_preview_at') || 0;
|
|
4381
|
-
sendPresence = util/* default.throttle */.Z.throttle(async () => {
|
|
4382
|
-
await this.readyGate.entry();
|
|
4383
|
-
if (!util/* default.get */.Z.get(this.kv.match('user'), 'id')) return;
|
|
4384
|
-
if (util/* default.isUserBanned */.Z.isUserBanned(this.kv.match('user'))) return;
|
|
4385
|
-
return this.api.sendPresence(this.device, this.browserVisibility === 'visible' && document.hasFocus());
|
|
4386
|
-
}, 1000);
|
|
4387
|
-
now = () => util/* default.Date.now */.Z.Date.now() + this.timeDiff;
|
|
4388
|
-
|
|
4389
4513
|
async init(accid, mask) {
|
|
4390
4514
|
this.readyGate.close();
|
|
4391
4515
|
accid = (accid || '').trim();
|
|
@@ -4444,8 +4568,6 @@ class Store {
|
|
|
4444
4568
|
return mask;
|
|
4445
4569
|
}
|
|
4446
4570
|
|
|
4447
|
-
seenQueue = [];
|
|
4448
|
-
|
|
4449
4571
|
seenLoop() {
|
|
4450
4572
|
this.seenQueue = [];
|
|
4451
4573
|
clearInterval(this._seenInterval);
|
|
@@ -4791,8 +4913,6 @@ class Store {
|
|
|
4791
4913
|
this._typing(cid);
|
|
4792
4914
|
}
|
|
4793
4915
|
|
|
4794
|
-
_typing = util/* default.throttle */.Z.throttle(convoid => this.api.sendTyping(convoid), 3000);
|
|
4795
|
-
|
|
4796
4916
|
async startConvo(req) {
|
|
4797
4917
|
await this.readyGate.entry();
|
|
4798
4918
|
this.convoGate.close();
|
|
@@ -4883,13 +5003,20 @@ class Store {
|
|
|
4883
5003
|
|
|
4884
5004
|
this.onWs(ret);
|
|
4885
5005
|
sendEventToThirdParty('SUBIZ Chat', 'Sent', 'User');
|
|
4886
|
-
|
|
5006
|
+
let lastMsgSent = this.kv.match('last_msg_sent');
|
|
5007
|
+
|
|
5008
|
+
if (!lastMsgSent) {
|
|
5009
|
+
let dataLayer = window.dataLayer || [];
|
|
5010
|
+
dataLayer.push({
|
|
5011
|
+
event: 'SUBIZ Chat',
|
|
5012
|
+
event_action: 'Sent',
|
|
5013
|
+
event_label: 'User',
|
|
5014
|
+
first_interaction: 1
|
|
5015
|
+
});
|
|
5016
|
+
}
|
|
4887
5017
|
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
if (!id || id === 'create') return;
|
|
4891
|
-
this.seenQueue.push(id);
|
|
4892
|
-
};
|
|
5018
|
+
this.kv.put('last_msg_sent', util/* default.Date.now */.Z.Date.now());
|
|
5019
|
+
}
|
|
4893
5020
|
|
|
4894
5021
|
_setConvo(convo) {
|
|
4895
5022
|
let count = 0;
|
|
@@ -4918,21 +5045,6 @@ class Store {
|
|
|
4918
5045
|
this.cache.put('convo_' + convo.id, convo);
|
|
4919
5046
|
}
|
|
4920
5047
|
|
|
4921
|
-
onUpdate = (o, cb) => this.pubsub.on2(o, 'account', cb);
|
|
4922
|
-
onResetCSS = (o, cb) => this.pubsub.on2(o, 'resetCSS', cb);
|
|
4923
|
-
onHighlight = (o, cb) => this.pubsub.on2(o, 'highlight', cb);
|
|
4924
|
-
setHasManuallyClosed = () => this.kv.put('hasManuallyClosed', true);
|
|
4925
|
-
setIsOpen = isopen => {
|
|
4926
|
-
let lastisopen = this.kv.match('isopen');
|
|
4927
|
-
this.kv.put('isopen', isopen);
|
|
4928
|
-
if (!lastisopen && isopen) sendEventToThirdParty('SUBIZ Chat', 'Opened', 'Subiz Windows');
|
|
4929
|
-
};
|
|
4930
|
-
closePreview = () => this.kv.put('close_preview_at', new util/* default.Date */.Z.Date().getTime());
|
|
4931
|
-
setLastview = (view, opts) => this.kv.put('lastview', {
|
|
4932
|
-
view,
|
|
4933
|
-
opts
|
|
4934
|
-
});
|
|
4935
|
-
|
|
4936
5048
|
matchLastPluginRun(pluginid) {
|
|
4937
5049
|
let log = this.kv.match('plugin_run_logs') || {};
|
|
4938
5050
|
return log[pluginid];
|
|
@@ -5035,11 +5147,9 @@ class Store {
|
|
|
5035
5147
|
return [events, anchor];
|
|
5036
5148
|
}
|
|
5037
5149
|
|
|
5038
|
-
timeDiff = 0;
|
|
5039
|
-
|
|
5040
5150
|
async loopTime() {
|
|
5041
5151
|
let startms = util/* default.Date.now */.Z.Date.now();
|
|
5042
|
-
if (!util/* default.get */.Z.get(this.kv.match('user'), 'id')) return setTimeout(() => this.loopTime(),
|
|
5152
|
+
if (!util/* default.get */.Z.get(this.kv.match('user'), 'id')) return setTimeout(() => this.loopTime(), 120000);
|
|
5043
5153
|
let {
|
|
5044
5154
|
body: t,
|
|
5045
5155
|
error
|
|
@@ -5049,7 +5159,7 @@ class Store {
|
|
|
5049
5159
|
var serverMs = new util/* default.Date */.Z.Date(t).getTime() + latences;
|
|
5050
5160
|
var localMs = util/* default.Date.now */.Z.Date.now();
|
|
5051
5161
|
this.timeDiff = Math.floor(serverMs - localMs);
|
|
5052
|
-
setTimeout(() => this.loopTime(),
|
|
5162
|
+
setTimeout(() => this.loopTime(), 120000);
|
|
5053
5163
|
}
|
|
5054
5164
|
|
|
5055
5165
|
replaceFileUrl(src) {
|
|
@@ -5204,6 +5314,12 @@ function sendEventToThirdParty(category, action, label) {
|
|
|
5204
5314
|
}));
|
|
5205
5315
|
sendToGA(category, action, label);
|
|
5206
5316
|
sendToFBPixel(category, action, label);
|
|
5317
|
+
let dataLayer = window.dataLayer || [];
|
|
5318
|
+
dataLayer.push({
|
|
5319
|
+
event: category,
|
|
5320
|
+
event_action: action,
|
|
5321
|
+
event_label: label
|
|
5322
|
+
});
|
|
5207
5323
|
}
|
|
5208
5324
|
|
|
5209
5325
|
let mobileCheck = function (a) {
|
|
@@ -5576,6 +5692,8 @@ class PluginMgr {
|
|
|
5576
5692
|
|
|
5577
5693
|
}
|
|
5578
5694
|
;// CONCATENATED MODULE: ./src/lib.js
|
|
5695
|
+
function lib_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5696
|
+
|
|
5579
5697
|
|
|
5580
5698
|
|
|
5581
5699
|
|
|
@@ -5587,6 +5705,18 @@ util/* default.preloadWebfonts */.Z.preloadWebfonts(['Roboto'], [400, 500]);
|
|
|
5587
5705
|
|
|
5588
5706
|
class Widget {
|
|
5589
5707
|
constructor(ApiURL, FileURL, RealtimeURL, inmem, fake, agenttoken) {
|
|
5708
|
+
lib_defineProperty(this, "version", () => '4.4');
|
|
5709
|
+
|
|
5710
|
+
lib_defineProperty(this, "setSetting", setting => this.store.setSetting({
|
|
5711
|
+
account_setting: setting
|
|
5712
|
+
}));
|
|
5713
|
+
|
|
5714
|
+
lib_defineProperty(this, "getSetting", _ => ({
|
|
5715
|
+
account_setting: util/* default.cloneDeep */.Z.cloneDeep(this.store.matchAccountSetting())
|
|
5716
|
+
}));
|
|
5717
|
+
|
|
5718
|
+
lib_defineProperty(this, "getUser", () => util/* default.parseJSON */.Z.parseJSON(util/* default.stringify */.Z.stringify(this.store.matchUser())));
|
|
5719
|
+
|
|
5590
5720
|
this.domGate = new util/* default.Gate */.Z.Gate();
|
|
5591
5721
|
this.store = new Store(ApiURL, FileURL, RealtimeURL, inmem, fake, agenttoken);
|
|
5592
5722
|
window.sbz_store = this.store;
|
|
@@ -5691,15 +5821,6 @@ class Widget {
|
|
|
5691
5821
|
this.pluginMgr.hideCurrentChatbox();
|
|
5692
5822
|
}
|
|
5693
5823
|
|
|
5694
|
-
version = () => '4.4';
|
|
5695
|
-
setSetting = setting => this.store.setSetting({
|
|
5696
|
-
account_setting: setting
|
|
5697
|
-
});
|
|
5698
|
-
getSetting = _ => ({
|
|
5699
|
-
account_setting: util/* default.cloneDeep */.Z.cloneDeep(this.store.matchAccountSetting())
|
|
5700
|
-
});
|
|
5701
|
-
getUser = () => util/* default.parseJSON */.Z.parseJSON(util/* default.stringify */.Z.stringify(this.store.matchUser()));
|
|
5702
|
-
|
|
5703
5824
|
async setLocale(locale) {
|
|
5704
5825
|
await this.domGate.entry();
|
|
5705
5826
|
return this.pluginMgr.setCurrentChatboxLocale(locale);
|