@subiz/widget-v4 4.0.64 → 4.0.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/less/chatbox.less +6 -1
- package/compiled_src/chatbox/ChatButton.js +3 -1
- package/compiled_src/chatbox/Event.js +1 -0
- package/compiled_src/chatbox/ProductAttachments.js +40 -4
- package/compiled_src/chatbox/Typing.js +3 -1
- package/compiled_src/chatbox/main.js +2 -0
- package/compiled_src/store/store.js +25 -3
- package/dist/132.js +48 -6
- package/dist/178.js +174 -341
- package/dist/17fdfed03d1.132.js +1 -0
- package/dist/17fdfed03d1.178.js +1 -0
- package/dist/{17ee31b89ac.213.js → 17fdfed03d1.213.js} +0 -0
- package/dist/{17ee31b89ac.335.js → 17fdfed03d1.335.js} +1 -1
- package/dist/17fdfed03d1.362.js +1 -0
- package/dist/{17ee31b89ac.441.js → 17fdfed03d1.441.js} +0 -0
- package/dist/{17ee31b89ac.605.js → 17fdfed03d1.605.js} +0 -0
- package/dist/17fdfed03d1.678.js +1 -0
- package/dist/17fdfed03d1.782.js +1 -0
- package/dist/17fdfed03d1.app.js +1 -0
- package/dist/{17ee31b89ac.index.html → 17fdfed03d1.index.html} +1 -1
- package/dist/{17ee31b89ac.library.html → 17fdfed03d1.library.html} +1 -1
- package/dist/17fdfed03d1.library.js +1 -0
- package/dist/{17ee31b89ac.preview.html → 17fdfed03d1.preview.html} +1 -1
- package/dist/17fdfed03d1.preview.js +1 -0
- package/dist/17fdfed03d1.screenshoot.js +1 -0
- package/dist/335.js +2 -2
- package/dist/362.js +20 -70
- 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 +81 -59
- package/package.json +10 -10
- 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/up +1 -1
- package/dist/0b82fa7e5c3b07b40a44.png +0 -1
- package/dist/0f4af006e38ee8b93633.png +0 -1
- package/dist/17ee31b89ac.132.js +0 -1
- package/dist/17ee31b89ac.178.js +0 -1
- package/dist/17ee31b89ac.362.js +0 -1
- package/dist/17ee31b89ac.678.js +0 -1
- package/dist/17ee31b89ac.782.js +0 -1
- package/dist/17ee31b89ac.app.js +0 -1
- package/dist/17ee31b89ac.library.js +0 -1
- package/dist/17ee31b89ac.preview.js +0 -1
- package/dist/17ee31b89ac.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/assets/less/chatbox.less
CHANGED
|
@@ -47,12 +47,17 @@
|
|
|
47
47
|
@z-index-4: '@z_index_4';
|
|
48
48
|
@z-index-5: '@z_index_5';
|
|
49
49
|
|
|
50
|
-
|
|
51
50
|
// stop client css rule on all elements inside #subiz
|
|
52
51
|
#sbz92 * {
|
|
53
52
|
all: unset !important;
|
|
54
53
|
}
|
|
55
54
|
|
|
55
|
+
.sbz_no_scroll {
|
|
56
|
+
overflow: hidden !important;
|
|
57
|
+
overflow-x: hidden !important;
|
|
58
|
+
overflow-y: hidden !important;
|
|
59
|
+
}
|
|
60
|
+
|
|
56
61
|
#sbz92 {
|
|
57
62
|
#makeImportant() !important;
|
|
58
63
|
}
|
|
@@ -146,7 +146,9 @@ class ChatButton extends _common.Com {
|
|
|
146
146
|
|
|
147
147
|
let greeting = _index.default.get(accountSetting, 'greeting', {});
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
let text = this.props.t.i18n(_index.default.get(greeting, 'greeting', {})) || greeting.message;
|
|
150
|
+
|
|
151
|
+
if (!text || !greeting.enabled) {
|
|
150
152
|
this.setState({
|
|
151
153
|
previewEvent: {}
|
|
152
154
|
});
|
|
@@ -200,6 +200,7 @@ class Event extends _common.Com {
|
|
|
200
200
|
onSelect: e => this.choosePostbackBtn(e)
|
|
201
201
|
}), (0, _preact.h)(_ProductAttachments.default, {
|
|
202
202
|
t: this.props.t,
|
|
203
|
+
onPostback: e => this.choosePostbackBtn(e),
|
|
203
204
|
store: this.props.store,
|
|
204
205
|
ev: ev
|
|
205
206
|
}), (0, _preact.h)(_OrderAttachments.default, {
|
|
@@ -29,17 +29,53 @@ class ProductAttachments extends _common.Com {
|
|
|
29
29
|
|
|
30
30
|
let $products = _index.default.map(products, (att, index) => {
|
|
31
31
|
let product = att.product;
|
|
32
|
-
let $
|
|
32
|
+
let $detailbtns = [];
|
|
33
33
|
let url = product.url || product.mobile_url;
|
|
34
34
|
if (this.props.store.isMobile()) url = product.mobile_url || product.url;
|
|
35
|
-
if (url)
|
|
35
|
+
if (url && _index.default.size(product.buttons) == 0) $detailbtns.push((0, _preact.h)("a", {
|
|
36
36
|
class: "product_attachment__btn",
|
|
37
37
|
href: url,
|
|
38
38
|
target: "_blank"
|
|
39
39
|
}, this.props.t('detail'), (0, _preact.h)("img", {
|
|
40
40
|
src: require('../../assets/img/external-link.svg'),
|
|
41
41
|
class: "product_attachment__btn_external_link"
|
|
42
|
-
}));
|
|
42
|
+
})));
|
|
43
|
+
console.log("P", product);
|
|
44
|
+
|
|
45
|
+
if (_index.default.size(product.buttons) > 0) {
|
|
46
|
+
$detailbtns = $detailbtns.concat(_index.default.map(product.buttons, (button, index) => {
|
|
47
|
+
if (button.type === 'call_button') {
|
|
48
|
+
return (0, _preact.h)("a", {
|
|
49
|
+
class: "product_attachment__btn",
|
|
50
|
+
href: 'tel:' + button.phone_number,
|
|
51
|
+
key: index,
|
|
52
|
+
title: button.title
|
|
53
|
+
}, button.title);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (button.type === 'url_button') {
|
|
57
|
+
return (0, _preact.h)("a", {
|
|
58
|
+
class: "product_attachment__btn",
|
|
59
|
+
href: button.url,
|
|
60
|
+
target: "_blank",
|
|
61
|
+
key: index,
|
|
62
|
+
title: button.title
|
|
63
|
+
}, button.title || this.props.t('detail'), ' ', (0, _preact.h)("img", {
|
|
64
|
+
src: require('../../assets/img/external-link.svg'),
|
|
65
|
+
class: "product_attachment__btn_external_link"
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (button.type === 'postback_button') {
|
|
70
|
+
return (0, _preact.h)("a", {
|
|
71
|
+
class: "product_attachment__btn",
|
|
72
|
+
href: "javascript:;",
|
|
73
|
+
onClick: _ => this.props.onPostback(button)
|
|
74
|
+
}, button.title);
|
|
75
|
+
}
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
|
|
43
79
|
let $title = (0, _preact.h)("a", {
|
|
44
80
|
href: url,
|
|
45
81
|
class: "product_attachment__title",
|
|
@@ -68,7 +104,7 @@ class ProductAttachments extends _common.Com {
|
|
|
68
104
|
src: this.props.store.replaceFileUrl(product.image)
|
|
69
105
|
}))), $title, $subtitle, $price, (0, _preact.h)("div", {
|
|
70
106
|
class: "product_attachment__btns"
|
|
71
|
-
}, $
|
|
107
|
+
}, $detailbtns));
|
|
72
108
|
});
|
|
73
109
|
|
|
74
110
|
return $products;
|
|
@@ -41,6 +41,8 @@ class Typing extends _common.Com {
|
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
let ag = this.props.store.matchAgent(ev.by.id);
|
|
45
|
+
if (ag.type == 'agent') return;
|
|
44
46
|
if (_index.default.get(ev, 'type') !== 'conversation_typing') return;
|
|
45
47
|
this.setState({
|
|
46
48
|
ev: ev,
|
|
@@ -53,7 +55,7 @@ class Typing extends _common.Com {
|
|
|
53
55
|
this.setState({
|
|
54
56
|
isShow: false
|
|
55
57
|
});
|
|
56
|
-
},
|
|
58
|
+
}, 5000);
|
|
57
59
|
});
|
|
58
60
|
}
|
|
59
61
|
|
|
@@ -184,11 +184,13 @@ class Main extends _common.Com {
|
|
|
184
184
|
exports.default = Main;
|
|
185
185
|
|
|
186
186
|
function restoreViewport() {
|
|
187
|
+
if (document.body && document.body.classList) document.body.classList.remove('sbz_no_scroll');
|
|
187
188
|
let metatag = document.getElementById('subiz-meta-viewport');
|
|
188
189
|
if (metatag) metatag.remove();
|
|
189
190
|
}
|
|
190
191
|
|
|
191
192
|
function modifyViewport() {
|
|
193
|
+
if (document.body && document.body.classList) document.body.classList.add('sbz_no_scroll');
|
|
192
194
|
let metatag = document.createElement('meta');
|
|
193
195
|
metatag.httpEquiv = 'X-UA-Compatible';
|
|
194
196
|
metatag.name = 'viewport';
|
|
@@ -190,7 +190,10 @@ class Store {
|
|
|
190
190
|
_defineProperty(this, "setIsOpen", isopen => {
|
|
191
191
|
let lastisopen = this.kv.match('isopen');
|
|
192
192
|
this.kv.put('isopen', isopen);
|
|
193
|
-
|
|
193
|
+
|
|
194
|
+
if (!lastisopen && isopen) {
|
|
195
|
+
sendEventToThirdParty('SUBIZ Chat', 'Opened', 'Subiz Windows');
|
|
196
|
+
}
|
|
194
197
|
});
|
|
195
198
|
|
|
196
199
|
_defineProperty(this, "closePreview", () => this.kv.put('close_preview_at', new _index.default.Date().getTime()));
|
|
@@ -904,6 +907,19 @@ class Store {
|
|
|
904
907
|
|
|
905
908
|
this.onWs(ret);
|
|
906
909
|
sendEventToThirdParty('SUBIZ Chat', 'Sent', 'User');
|
|
910
|
+
let lastMsgSent = this.kv.match('last_msg_sent');
|
|
911
|
+
|
|
912
|
+
if (!lastMsgSent) {
|
|
913
|
+
let dataLayer = window.dataLayer || [];
|
|
914
|
+
dataLayer.push({
|
|
915
|
+
event: 'SUBIZ Chat',
|
|
916
|
+
event_action: 'Sent',
|
|
917
|
+
event_label: 'User',
|
|
918
|
+
first_interaction: 1
|
|
919
|
+
});
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
this.kv.put('last_msg_sent', _index.default.Date.now());
|
|
907
923
|
}
|
|
908
924
|
|
|
909
925
|
_setConvo(convo) {
|
|
@@ -1044,7 +1060,7 @@ class Store {
|
|
|
1044
1060
|
async loopTime() {
|
|
1045
1061
|
let startms = _index.default.Date.now();
|
|
1046
1062
|
|
|
1047
|
-
if (!_index.default.get(this.kv.match('user'), 'id')) return setTimeout(() => this.loopTime(),
|
|
1063
|
+
if (!_index.default.get(this.kv.match('user'), 'id')) return setTimeout(() => this.loopTime(), 120000);
|
|
1048
1064
|
let {
|
|
1049
1065
|
body: t,
|
|
1050
1066
|
error
|
|
@@ -1056,7 +1072,7 @@ class Store {
|
|
|
1056
1072
|
var localMs = _index.default.Date.now();
|
|
1057
1073
|
|
|
1058
1074
|
this.timeDiff = Math.floor(serverMs - localMs);
|
|
1059
|
-
setTimeout(() => this.loopTime(),
|
|
1075
|
+
setTimeout(() => this.loopTime(), 120000);
|
|
1060
1076
|
}
|
|
1061
1077
|
|
|
1062
1078
|
replaceFileUrl(src) {
|
|
@@ -1214,6 +1230,12 @@ function sendEventToThirdParty(category, action, label) {
|
|
|
1214
1230
|
}));
|
|
1215
1231
|
sendToGA(category, action, label);
|
|
1216
1232
|
sendToFBPixel(category, action, label);
|
|
1233
|
+
let dataLayer = window.dataLayer || [];
|
|
1234
|
+
dataLayer.push({
|
|
1235
|
+
event: category,
|
|
1236
|
+
event_action: action,
|
|
1237
|
+
event_label: label
|
|
1238
|
+
});
|
|
1217
1239
|
}
|
|
1218
1240
|
|
|
1219
1241
|
let mobileCheck = function (a) {
|
package/dist/132.js
CHANGED
|
@@ -161,8 +161,9 @@ class ChatButton extends common/* Com */.up {
|
|
|
161
161
|
let accountSetting = this.props.plugin.chatbox;
|
|
162
162
|
if (new util/* default.Date */.Z.Date().getTime() - this.props.store.matchClosePreviewAt() < Ms30Mins) return;
|
|
163
163
|
let greeting = util/* default.get */.Z.get(accountSetting, 'greeting', {});
|
|
164
|
+
let text = this.props.t.i18n(util/* default.get */.Z.get(greeting, 'greeting', {})) || greeting.message;
|
|
164
165
|
|
|
165
|
-
if (!
|
|
166
|
+
if (!text || !greeting.enabled) {
|
|
166
167
|
this.setState({
|
|
167
168
|
previewEvent: {}
|
|
168
169
|
});
|
|
@@ -2031,17 +2032,53 @@ class ProductAttachments extends common/* Com */.up {
|
|
|
2031
2032
|
let acc = this.props.store.matchAccount();
|
|
2032
2033
|
let $products = util/* default.map */.Z.map(products, (att, index) => {
|
|
2033
2034
|
let product = att.product;
|
|
2034
|
-
let $
|
|
2035
|
+
let $detailbtns = [];
|
|
2035
2036
|
let url = product.url || product.mobile_url;
|
|
2036
2037
|
if (this.props.store.isMobile()) url = product.mobile_url || product.url;
|
|
2037
|
-
if (url)
|
|
2038
|
+
if (url && util/* default.size */.Z.size(product.buttons) == 0) $detailbtns.push((0,preact_module.h)("a", {
|
|
2038
2039
|
class: "product_attachment__btn",
|
|
2039
2040
|
href: url,
|
|
2040
2041
|
target: "_blank"
|
|
2041
2042
|
}, this.props.t('detail'), (0,preact_module.h)("img", {
|
|
2042
2043
|
src: __webpack_require__(8453),
|
|
2043
2044
|
class: "product_attachment__btn_external_link"
|
|
2044
|
-
}));
|
|
2045
|
+
})));
|
|
2046
|
+
console.log("P", product);
|
|
2047
|
+
|
|
2048
|
+
if (util/* default.size */.Z.size(product.buttons) > 0) {
|
|
2049
|
+
$detailbtns = $detailbtns.concat(util/* default.map */.Z.map(product.buttons, (button, index) => {
|
|
2050
|
+
if (button.type === 'call_button') {
|
|
2051
|
+
return (0,preact_module.h)("a", {
|
|
2052
|
+
class: "product_attachment__btn",
|
|
2053
|
+
href: 'tel:' + button.phone_number,
|
|
2054
|
+
key: index,
|
|
2055
|
+
title: button.title
|
|
2056
|
+
}, button.title);
|
|
2057
|
+
}
|
|
2058
|
+
|
|
2059
|
+
if (button.type === 'url_button') {
|
|
2060
|
+
return (0,preact_module.h)("a", {
|
|
2061
|
+
class: "product_attachment__btn",
|
|
2062
|
+
href: button.url,
|
|
2063
|
+
target: "_blank",
|
|
2064
|
+
key: index,
|
|
2065
|
+
title: button.title
|
|
2066
|
+
}, button.title || this.props.t('detail'), ' ', (0,preact_module.h)("img", {
|
|
2067
|
+
src: __webpack_require__(8453),
|
|
2068
|
+
class: "product_attachment__btn_external_link"
|
|
2069
|
+
}));
|
|
2070
|
+
}
|
|
2071
|
+
|
|
2072
|
+
if (button.type === 'postback_button') {
|
|
2073
|
+
return (0,preact_module.h)("a", {
|
|
2074
|
+
class: "product_attachment__btn",
|
|
2075
|
+
href: "javascript:;",
|
|
2076
|
+
onClick: _ => this.props.onPostback(button)
|
|
2077
|
+
}, button.title);
|
|
2078
|
+
}
|
|
2079
|
+
}));
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2045
2082
|
let $title = (0,preact_module.h)("a", {
|
|
2046
2083
|
href: url,
|
|
2047
2084
|
class: "product_attachment__title",
|
|
@@ -2070,7 +2107,7 @@ class ProductAttachments extends common/* Com */.up {
|
|
|
2070
2107
|
src: this.props.store.replaceFileUrl(product.image)
|
|
2071
2108
|
}))), $title, $subtitle, $price, (0,preact_module.h)("div", {
|
|
2072
2109
|
class: "product_attachment__btns"
|
|
2073
|
-
}, $
|
|
2110
|
+
}, $detailbtns));
|
|
2074
2111
|
});
|
|
2075
2112
|
return $products;
|
|
2076
2113
|
}
|
|
@@ -2696,6 +2733,7 @@ class Event extends common/* Com */.up {
|
|
|
2696
2733
|
onSelect: e => this.choosePostbackBtn(e)
|
|
2697
2734
|
}), (0,preact_module.h)(ProductAttachments, {
|
|
2698
2735
|
t: this.props.t,
|
|
2736
|
+
onPostback: e => this.choosePostbackBtn(e),
|
|
2699
2737
|
store: this.props.store,
|
|
2700
2738
|
ev: ev
|
|
2701
2739
|
}), (0,preact_module.h)(OrderAttachments_ProductAttachments, {
|
|
@@ -3149,6 +3187,8 @@ class Typing extends common/* Com */.up {
|
|
|
3149
3187
|
return;
|
|
3150
3188
|
}
|
|
3151
3189
|
|
|
3190
|
+
let ag = this.props.store.matchAgent(ev.by.id);
|
|
3191
|
+
if (ag.type == 'agent') return;
|
|
3152
3192
|
if (util/* default.get */.Z.get(ev, 'type') !== 'conversation_typing') return;
|
|
3153
3193
|
this.setState({
|
|
3154
3194
|
ev: ev,
|
|
@@ -3161,7 +3201,7 @@ class Typing extends common/* Com */.up {
|
|
|
3161
3201
|
this.setState({
|
|
3162
3202
|
isShow: false
|
|
3163
3203
|
});
|
|
3164
|
-
},
|
|
3204
|
+
}, 5000);
|
|
3165
3205
|
});
|
|
3166
3206
|
}
|
|
3167
3207
|
|
|
@@ -6563,11 +6603,13 @@ class Main extends common/* Com */.up {
|
|
|
6563
6603
|
}
|
|
6564
6604
|
|
|
6565
6605
|
function restoreViewport() {
|
|
6606
|
+
if (document.body && document.body.classList) document.body.classList.remove('sbz_no_scroll');
|
|
6566
6607
|
let metatag = document.getElementById('subiz-meta-viewport');
|
|
6567
6608
|
if (metatag) metatag.remove();
|
|
6568
6609
|
}
|
|
6569
6610
|
|
|
6570
6611
|
function modifyViewport() {
|
|
6612
|
+
if (document.body && document.body.classList) document.body.classList.add('sbz_no_scroll');
|
|
6571
6613
|
let metatag = document.createElement('meta');
|
|
6572
6614
|
metatag.httpEquiv = 'X-UA-Compatible';
|
|
6573
6615
|
metatag.name = 'viewport';
|