@subiz/widget-v4 4.1.175 → 4.1.177
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app.js +10 -15
- package/assets/less/chatbox.less +4 -3
- package/assets/less/message.less +6 -0
- package/assets/less/widget.less +1 -1
- package/cloudflare_worker.js +3 -4
- package/compiled_src/chatbox/GenericTemplateAttachments.js +2 -1
- package/compiled_src/chatbox/main.js +11 -9
- package/compiled_src/lib.js +5 -0
- package/compiled_src/store/api.js +2 -2
- package/compiled_src/store/store.js +11 -0
- package/compiled_src/util/common.js +1 -0
- package/dist/185.js +10 -10
- package/dist/{198cd86b62f.27.js → 1991cfb4656.27.js} +1 -1
- package/dist/{198cd86b62f.278.js → 1991cfb4656.278.js} +1 -1
- package/dist/{198cd86b62f.339.js → 1991cfb4656.339.js} +1 -1
- package/dist/{198cd86b62f.459.js → 1991cfb4656.459.js} +1 -1
- package/dist/{198cd86b62f.app.js → 1991cfb4656.app.js} +1 -1
- package/dist/{198cd86b62f.chat.html → 1991cfb4656.chat.html} +1 -1
- package/dist/{198cd86b62f.chat.js → 1991cfb4656.chat.js} +1 -1
- package/dist/{198cd86b62f.form.html → 1991cfb4656.form.html} +1 -1
- package/dist/{198cd86b62f.form.js → 1991cfb4656.form.js} +1 -1
- package/dist/{198cd86b62f.index.html → 1991cfb4656.index.html} +1 -1
- package/dist/{198cd86b62f.library.html → 1991cfb4656.library.html} +1 -1
- package/dist/{198cd86b62f.library.js → 1991cfb4656.library.js} +1 -1
- package/dist/{198cd86b62f.preview.html → 1991cfb4656.preview.html} +1 -1
- package/dist/{198cd86b62f.preview.js → 1991cfb4656.preview.js} +1 -1
- package/dist/{198cd86b62f.webview.js → 1991cfb4656.webview.js} +1 -1
- package/dist/27.js +1 -1
- package/dist/278.js +1 -1
- package/dist/459.js +1 -1
- package/dist/HASH +1 -1
- package/dist/screenshoot.js +13 -14
- package/package.json +4 -4
- package/src/chatbox/GenericTemplateAttachments.js +1 -1
- package/src/chatbox/main.js +11 -9
- package/src/lib.js +13 -3
- package/src/store/api.js +4 -0
- package/src/store/store.js +14 -6
- package/src/util/common.js +1 -0
- package/tracking.js +3 -2
- /package/dist/{198cd86b62f.127.js → 1991cfb4656.127.js} +0 -0
- /package/dist/{198cd86b62f.132.js → 1991cfb4656.132.js} +0 -0
- /package/dist/{198cd86b62f.185.js → 1991cfb4656.185.js} +0 -0
- /package/dist/{198cd86b62f.490.js → 1991cfb4656.490.js} +0 -0
- /package/dist/{198cd86b62f.74.js → 1991cfb4656.74.js} +0 -0
- /package/dist/{198cd86b62f.997.js → 1991cfb4656.997.js} +0 -0
package/app.js
CHANGED
|
@@ -16,11 +16,6 @@ import RunBot from './src/bot.js'
|
|
|
16
16
|
var ajax = require('@subiz/ajax/src/ajax.js')
|
|
17
17
|
var config = require('./config.js')
|
|
18
18
|
|
|
19
|
-
var VERSION = detect()
|
|
20
|
-
if (!VERSION) throw new Error('subiz cannot detect version')
|
|
21
|
-
|
|
22
|
-
var apiV4 = new ApiV4(config.ApiURL, config.FileURL, config.RealtimeURL)
|
|
23
|
-
|
|
24
19
|
// isV4 tells whether the website is using widget version 4.2 or not
|
|
25
20
|
function isV4_2() {
|
|
26
21
|
if (window.sbz_v4) return true
|
|
@@ -37,14 +32,6 @@ function isV4_2() {
|
|
|
37
32
|
return false
|
|
38
33
|
}
|
|
39
34
|
|
|
40
|
-
// return widget version
|
|
41
|
-
function detect() {
|
|
42
|
-
if (window._sbzaccid) return '4.3'
|
|
43
|
-
if (isV4_2()) return '4.2'
|
|
44
|
-
if (window.subiz_account_id && window.subiz_account_id > 0) return '1'
|
|
45
|
-
return undefined
|
|
46
|
-
}
|
|
47
|
-
|
|
48
35
|
function callV2(args) {
|
|
49
36
|
args = args || []
|
|
50
37
|
var out = []
|
|
@@ -110,9 +97,17 @@ function loopTitle(laststate) {
|
|
|
110
97
|
return setTimeout(loopTitle, 2000, 'dirty invisible')
|
|
111
98
|
}
|
|
112
99
|
|
|
113
|
-
|
|
114
|
-
|
|
100
|
+
var apiV4 = {}
|
|
115
101
|
function init() {
|
|
102
|
+
let VERSION = undefined
|
|
103
|
+
if (window._sbzaccid) VERSION = '4.3'
|
|
104
|
+
else if (isV4_2()) VERSION = '4.2'
|
|
105
|
+
else if (window.subiz_account_id && window.subiz_account_id > 0) VERSION = '1'
|
|
106
|
+
if (!VERSION) throw new Error('subiz cannot detect version')
|
|
107
|
+
|
|
108
|
+
apiV4 = new ApiV4(config.ApiURL, config.FileURL, config.RealtimeURL)
|
|
109
|
+
loopTitle()
|
|
110
|
+
|
|
116
111
|
if (VERSION === '4.2' || VERSION === '4.3') {
|
|
117
112
|
let queue = (window.subiz && window.subiz.q) || []
|
|
118
113
|
window.subiz = function () {
|
package/assets/less/chatbox.less
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
//@desktop-chat-button-background-mask-url : '@desktop_button.background_mask_url'; //@default-chat-button-background-image-url;
|
|
19
19
|
@desktop-chat-button-margin-x: '@desktop_button.margin_x'; //20px;
|
|
20
20
|
@desktop-chat-button-margin-y: '@desktop_button.margin_y'; // 20px;
|
|
21
|
+
@desktop-widget-max-height: '@desktop_widget_max_height'; // calc(100% - desktop_buttom.margin_y)
|
|
21
22
|
|
|
22
23
|
@form-page-background-color: '@form_background_color';
|
|
23
24
|
@form-page-header-font-size: '@form_header_font_size';
|
|
@@ -159,9 +160,9 @@ body div#sbz92 {
|
|
|
159
160
|
.text-xl {
|
|
160
161
|
font-size: 20px;
|
|
161
162
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
.text-sm {
|
|
164
|
+
font-size: 14px;
|
|
165
|
+
}
|
|
165
166
|
.text-center {
|
|
166
167
|
text-align: center;
|
|
167
168
|
}
|
package/assets/less/message.less
CHANGED
|
@@ -532,6 +532,12 @@ a.message_error {
|
|
|
532
532
|
padding: 0px 13px;
|
|
533
533
|
.color(gray);
|
|
534
534
|
margin-top: 5px;
|
|
535
|
+
white-space: pre-wrap;
|
|
536
|
+
display: -webkit-box;
|
|
537
|
+
-webkit-line-clamp: 4;
|
|
538
|
+
-webkit-box-orient: vertical;
|
|
539
|
+
overflow: hidden;
|
|
540
|
+
text-overflow: ellipsis;
|
|
535
541
|
}
|
|
536
542
|
}
|
|
537
543
|
|
package/assets/less/widget.less
CHANGED
package/cloudflare_worker.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
let hash = 'XXXXXXXX' // do not change, will be replaced to real hash
|
|
2
2
|
|
|
3
|
-
addEventListener('fetch', event => event.respondWith(handleRequest(event.request)))
|
|
3
|
+
addEventListener('fetch', (event) => event.respondWith(handleRequest(event.request)))
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Respond to the request
|
|
7
7
|
* @param {Request} request
|
|
8
8
|
*/
|
|
9
|
-
async function handleRequest
|
|
10
|
-
|
|
9
|
+
async function handleRequest(request) {
|
|
10
|
+
let body = `if (!window._subiz_init_2094850928430) {
|
|
11
11
|
window._subiz_init_2094850928430 = true
|
|
12
12
|
window._subiz_init_2094850928430_keep_loading = true
|
|
13
13
|
var tag = document.createElement('script')
|
|
14
14
|
tag.async = 1
|
|
15
|
-
tag.defer = true
|
|
16
15
|
tag.src = 'https://public-gcs.subiz-cdn.com/widget-v4/public/${hash}.app.js'
|
|
17
16
|
document.body.appendChild(tag)
|
|
18
17
|
}`
|
|
@@ -44,7 +44,8 @@ class GenericTemplateAttachments extends _common.Com {
|
|
|
44
44
|
class: "generic-attachment--element-title"
|
|
45
45
|
}, title) : null;
|
|
46
46
|
let $subtitle = subtitle ? (0, _preact.h)("div", {
|
|
47
|
-
class: "generic-attachment--element-subtitle"
|
|
47
|
+
class: "generic-attachment--element-subtitle",
|
|
48
|
+
title: subtitle
|
|
48
49
|
}, subtitle) : null;
|
|
49
50
|
let imgsrc = this.props.store.replaceFileUrl(ele.image_url);
|
|
50
51
|
if (!ele.image_url) {
|
|
@@ -9,21 +9,23 @@ var _ChatButton = _interopRequireDefault(require("./ChatButton.js"));
|
|
|
9
9
|
var _Widget = _interopRequireDefault(require("./Widget.js"));
|
|
10
10
|
var _common = require("../common.js");
|
|
11
11
|
var _preact = require("preact");
|
|
12
|
+
var _css = _interopRequireDefault(require("./css.js"));
|
|
12
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
|
-
let promiseMainCSS = (() => Promise.resolve().then(() => _interopRequireWildcard(require('./css.js'))))();
|
|
15
14
|
class Main extends _common.Com {
|
|
16
15
|
constructor(props) {
|
|
17
16
|
super(props);
|
|
18
17
|
this.refButton = (0, _preact.createRef)();
|
|
19
18
|
this.refWidget = (0, _preact.createRef)();
|
|
20
19
|
}
|
|
21
|
-
|
|
20
|
+
refreshCSS() {
|
|
22
21
|
let plugins = this.props.store.matchPlugin();
|
|
23
22
|
let found = _index.default.find(plugins, plugin => plugin.id === this.props.plugin.id);
|
|
24
23
|
if (!found) return;
|
|
25
|
-
let css =
|
|
26
|
-
|
|
24
|
+
let css = _css.default.default.toString() + '';
|
|
25
|
+
let chatbox = found.chatbox;
|
|
26
|
+
let margin_y = _index.default.get(chatbox, 'desktop_button.margin_y');
|
|
27
|
+
chatbox.desktop_widget_max_height = margin_y ? `calc(100% - ${margin_y + 10}px)` : 'calc(100% - 40px)';
|
|
28
|
+
var outcss = _index.default.replaceCssVariable(css, chatbox);
|
|
27
29
|
_index.default.setCss(this.props.plugin.id, this.$cssStyleDiv, outcss);
|
|
28
30
|
}
|
|
29
31
|
componentWillUnmount() {
|
|
@@ -38,7 +40,7 @@ class Main extends _common.Com {
|
|
|
38
40
|
this.$cssStyleDiv.id = 'subiz-style-for-' + this.props.plugin.id;
|
|
39
41
|
}
|
|
40
42
|
this.setState({
|
|
41
|
-
|
|
43
|
+
cssReady: false,
|
|
42
44
|
isShowWidget: false,
|
|
43
45
|
widgetView: '',
|
|
44
46
|
widgetConvoId: ''
|
|
@@ -53,9 +55,9 @@ class Main extends _common.Com {
|
|
|
53
55
|
widgetConvoId: ''
|
|
54
56
|
});
|
|
55
57
|
});
|
|
56
|
-
|
|
58
|
+
this.refreshCSS();
|
|
57
59
|
this.setState({
|
|
58
|
-
|
|
60
|
+
cssReady: true
|
|
59
61
|
});
|
|
60
62
|
if (this.props.store.matchIsOpen() && this.props.store.matchLastview().view) {
|
|
61
63
|
if (this.props.store.isMobile()) return;
|
|
@@ -68,7 +70,7 @@ class Main extends _common.Com {
|
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
render() {
|
|
71
|
-
if (!this.state.
|
|
73
|
+
if (!this.state.cssReady) {
|
|
72
74
|
if (typeof sbz_info != 'undefined') sbz_info.render_chatbox_css_not_ready = _index.default.Date.now();
|
|
73
75
|
return null;
|
|
74
76
|
}
|
package/compiled_src/lib.js
CHANGED
|
@@ -112,6 +112,11 @@ class Widget {
|
|
|
112
112
|
}
|
|
113
113
|
async setAccount(id, $container, mask, cb) {
|
|
114
114
|
if (typeof sbz_info != 'undefined') sbz_info.set_account = _index.default.Date.now();
|
|
115
|
+
if (document && document.location && document.location.href && document.location.href.indexOf('subiz-verification-1') > 0) {
|
|
116
|
+
window.subiz_verification_account_id = id;
|
|
117
|
+
if (typeof sbz_info != 'undefined') sbz_info = undefined;
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
115
120
|
if (!id) return {
|
|
116
121
|
error: 'empty_account_id'
|
|
117
122
|
};
|
|
@@ -227,7 +227,7 @@ class _default {
|
|
|
227
227
|
if (obj.ref) {
|
|
228
228
|
let outuser;
|
|
229
229
|
for (let i = 0; true; i++) {
|
|
230
|
-
outuser = await ajax.setBaseUrl(this.ApiURL).withCredentials(true).addQuery('v', '6').addQuery('x-user-ref', this.ref).setParser('json').get(`/accounts/${this.accid}/users/${this.ref}`);
|
|
230
|
+
outuser = await ajax.setBaseUrl(this.ApiURL).withCredentials(true).afterHook(trackResponseFn).beforeHook(trackRequestFn).addQuery('v', '6').addQuery('x-user-ref', this.ref).setParser('json').get(`/accounts/${this.accid}/users/${this.ref}`);
|
|
231
231
|
if (_index.default.get(outuser, 'body.error.code', '').indexOf('locked_account') != -1) break;
|
|
232
232
|
if (_index.default.get(outuser, 'body.error.code', '').indexOf('user_is_banned') != -1) {
|
|
233
233
|
await _index.default.sleep(120000);
|
|
@@ -313,7 +313,7 @@ class _default {
|
|
|
313
313
|
for (let i = 0; true; i++) {
|
|
314
314
|
await this.token_generator(true);
|
|
315
315
|
if (tokensession != this.tokensession) break;
|
|
316
|
-
outuser = await ajax.setBaseUrl(this.ApiURL).withCredentials(true).addQuery('v', '6').addQuery('x-access-token', this.last_token).setParser('json').get(`/accounts/${this.accid}/users/${profile_id}`);
|
|
316
|
+
outuser = await ajax.setBaseUrl(this.ApiURL).withCredentials(true).addQuery('v', '6').afterHook(trackResponseFn).beforeHook(trackRequestFn).addQuery('x-access-token', this.last_token).setParser('json').get(`/accounts/${this.accid}/users/${profile_id}`);
|
|
317
317
|
if (!_index.default.get(outuser, 'body.id')) {
|
|
318
318
|
let sleeptime = Math.min(2000 + i * 100, 120000);
|
|
319
319
|
await _index.default.sleep(sleeptime);
|
|
@@ -447,15 +447,18 @@ class Store {
|
|
|
447
447
|
}
|
|
448
448
|
async init(accid, mask, userRef, options) {
|
|
449
449
|
this.g_sync = {};
|
|
450
|
+
if (typeof sbz_info != 'undefined') sbz_info.store_0 = true;
|
|
450
451
|
if (!options || !options.use_subdomain_cookie) {
|
|
451
452
|
if (window && window.location && window.location.hostname) {
|
|
452
453
|
cookie.defaults.domain = '.' + window.location.hostname;
|
|
453
454
|
}
|
|
454
455
|
}
|
|
456
|
+
if (typeof sbz_info != 'undefined') sbz_info.store_1 = true;
|
|
455
457
|
if (!userRef) {
|
|
456
458
|
try {
|
|
457
459
|
userRef = this.cookie.get('__sbref', '');
|
|
458
460
|
} catch (e) {}
|
|
461
|
+
if (typeof sbz_info != 'undefined') sbz_info.store_2 = true;
|
|
459
462
|
if (!userRef) {
|
|
460
463
|
if (!mask) {
|
|
461
464
|
try {
|
|
@@ -476,14 +479,18 @@ class Store {
|
|
|
476
479
|
}
|
|
477
480
|
}
|
|
478
481
|
}
|
|
482
|
+
if (typeof sbz_info != 'undefined') sbz_info.store_3 = true;
|
|
479
483
|
if (this.cookie.get('__sbref', userRef) != userRef) {
|
|
480
484
|
cleanMyLocalStorage();
|
|
481
485
|
this.clearBrowserData();
|
|
482
486
|
}
|
|
487
|
+
if (typeof sbz_info != 'undefined') sbz_info.store_4 = true;
|
|
483
488
|
this.api.setAuth({
|
|
484
489
|
accid: accid
|
|
485
490
|
});
|
|
491
|
+
if (typeof sbz_info != 'undefined') sbz_info.store_5 = true;
|
|
486
492
|
if (userRef) this.cookie.set('__sbref', userRef);
|
|
493
|
+
if (typeof sbz_info != 'undefined') sbz_info.store_6 = true;
|
|
487
494
|
return this._initResource(accid, {
|
|
488
495
|
accid: accid,
|
|
489
496
|
mask: mask,
|
|
@@ -497,6 +504,7 @@ class Store {
|
|
|
497
504
|
async _initResource(accid, auth, realtimep) {
|
|
498
505
|
this.g_sync = {};
|
|
499
506
|
let user = await this.api.setAuth(auth);
|
|
507
|
+
if (typeof sbz_info != 'undefined') sbz_info.store_7 = true;
|
|
500
508
|
if (user.error) {
|
|
501
509
|
console.error(user);
|
|
502
510
|
return user;
|
|
@@ -512,10 +520,13 @@ class Store {
|
|
|
512
520
|
await this.reconnectWs(accid, user.id);
|
|
513
521
|
this.reconnect();
|
|
514
522
|
});
|
|
523
|
+
if (typeof sbz_info != 'undefined') sbz_info.store_8 = true;
|
|
515
524
|
this.seenLoop();
|
|
525
|
+
if (typeof sbz_info != 'undefined') sbz_info.store_9 = true;
|
|
516
526
|
await this.reconnect({
|
|
517
527
|
user: user
|
|
518
528
|
});
|
|
529
|
+
if (typeof sbz_info != 'undefined') sbz_info.store_10 = true;
|
|
519
530
|
this.readyGate.open();
|
|
520
531
|
this.reconnectWs(accid, user.id);
|
|
521
532
|
return user;
|
|
@@ -627,6 +627,7 @@ function replaceCssVariable(css, setting) {
|
|
|
627
627
|
tokens = tokenize(tokens, "'@desktop_button.border_radius'");
|
|
628
628
|
tokens = tokenize(tokens, "'@desktop_button.margin_x'");
|
|
629
629
|
tokens = tokenize(tokens, "'@desktop_button.margin_y'");
|
|
630
|
+
tokens = tokenize(tokens, "'@desktop_widget_max_height'");
|
|
630
631
|
tokens = tokenize(tokens, "'@mobile_button.width'");
|
|
631
632
|
tokens = tokenize(tokens, "'@mobile_button.height'");
|
|
632
633
|
tokens = tokenize(tokens, "'@mobile_button.background'");
|
package/dist/185.js
CHANGED
|
@@ -854,25 +854,25 @@ class order_Order extends common/* Com */.Mw {
|
|
|
854
854
|
renderDesktopPaymentMethod(order) {
|
|
855
855
|
return null;
|
|
856
856
|
// removed by dead control flow
|
|
857
|
-
|
|
857
|
+
{}
|
|
858
858
|
// removed by dead control flow
|
|
859
|
-
|
|
859
|
+
{}
|
|
860
860
|
// removed by dead control flow
|
|
861
|
-
|
|
861
|
+
{}
|
|
862
862
|
// removed by dead control flow
|
|
863
|
-
|
|
863
|
+
{}
|
|
864
864
|
// removed by dead control flow
|
|
865
|
-
|
|
865
|
+
{}
|
|
866
866
|
// removed by dead control flow
|
|
867
|
-
|
|
867
|
+
{}
|
|
868
868
|
// removed by dead control flow
|
|
869
|
-
|
|
869
|
+
{}
|
|
870
870
|
// removed by dead control flow
|
|
871
|
-
|
|
871
|
+
{}
|
|
872
872
|
// removed by dead control flow
|
|
873
|
-
|
|
873
|
+
{}
|
|
874
874
|
// removed by dead control flow
|
|
875
|
-
|
|
875
|
+
{}
|
|
876
876
|
}
|
|
877
877
|
renderDesktopShipping(order) {
|
|
878
878
|
let editmode = false;
|