@subiz/widget-v4 4.1.60 → 4.1.62
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 +6 -0
- package/compiled_src/call/call.js +2 -2
- package/compiled_src/chatbox/DropdownSelect.js +2 -2
- package/compiled_src/chatbox/ImageAttachments.js +2 -2
- package/compiled_src/chatbox/MessageInput.js +2 -2
- package/compiled_src/chatbox/Order.js +2 -2
- package/compiled_src/chatbox/Rating.js +2 -2
- package/compiled_src/chatbox/Widget.js +2 -2
- package/compiled_src/contact/contact.js +2 -2
- package/compiled_src/lib.js +2 -2
- package/compiled_src/notif/notif.js +2 -2
- package/compiled_src/order/address_picker.js +2 -2
- package/compiled_src/order/order.js +2 -2
- package/compiled_src/popup/countdown.js +2 -2
- package/compiled_src/popup/popup.js +2 -2
- package/compiled_src/store/api.js +2 -2
- package/compiled_src/store/api_fake.js +2 -2
- package/compiled_src/store/store.js +2 -2
- package/dist/{605.js → 104.js} +59 -60
- package/dist/{178.js → 176.js} +55 -55
- package/dist/18d7db7ca8c.104.js +1 -0
- package/dist/18d7db7ca8c.176.js +1 -0
- package/dist/{18a02a9c54e.782.js → 18d7db7ca8c.444.js} +1 -1
- package/dist/18d7db7ca8c.508.js +1 -0
- package/dist/18d7db7ca8c.672.js +1 -0
- package/dist/18d7db7ca8c.756.js +1 -0
- package/dist/18d7db7ca8c.792.js +1 -0
- package/dist/18d7db7ca8c.928.js +1 -0
- package/dist/18d7db7ca8c.app.js +1 -0
- package/dist/{18a02a9c54e.index.html → 18d7db7ca8c.index.html} +4 -4
- package/dist/{18a02a9c54e.library.html → 18d7db7ca8c.library.html} +4 -4
- package/dist/18d7db7ca8c.library.js +1 -0
- package/dist/{18a02a9c54e.preview.html → 18d7db7ca8c.preview.html} +1 -1
- package/dist/18d7db7ca8c.preview.js +1 -0
- package/dist/18d7db7ca8c.screenshoot.js +1 -0
- package/dist/18d7db7ca8c.webview.js +1 -0
- package/dist/{782.js → 444.js} +7 -7
- package/dist/{335.js → 508.js} +34 -34
- package/dist/{678.js → 672.js} +6 -6
- package/dist/{362.js → 756.js} +7 -7
- package/dist/{213.js → 792.js} +143 -127
- package/dist/{132.js → 928.js} +817 -793
- package/dist/HASH +1 -1
- package/dist/malicious-app.js +9 -3
- package/dist/screenshoot.html +1 -1
- package/dist/screenshoot.js +615 -691
- package/malicious-app.js +4 -8
- package/package.json +10 -10
- package/dist/18a02a9c54e.132.js +0 -1
- package/dist/18a02a9c54e.178.js +0 -1
- package/dist/18a02a9c54e.213.js +0 -1
- package/dist/18a02a9c54e.335.js +0 -1
- package/dist/18a02a9c54e.362.js +0 -1
- package/dist/18a02a9c54e.441.js +0 -1
- package/dist/18a02a9c54e.605.js +0 -1
- package/dist/18a02a9c54e.678.js +0 -1
- package/dist/18a02a9c54e.app.js +0 -1
- package/dist/18a02a9c54e.library.js +0 -1
- package/dist/18a02a9c54e.preview.js +0 -1
- package/dist/18a02a9c54e.screenshoot.js +0 -1
- package/dist/18a02a9c54e.webview.js +0 -1
- package/dist/441.js +0 -2855
package/dist/{132.js → 928.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(self["webpackChunk_subiz_widget_v4"] = self["webpackChunk_subiz_widget_v4"] || []).push([[
|
|
1
|
+
(self["webpackChunk_subiz_widget_v4"] = self["webpackChunk_subiz_widget_v4"] || []).push([[928],{
|
|
2
2
|
|
|
3
|
-
/***/
|
|
3
|
+
/***/ 3928:
|
|
4
4
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
@@ -13,19 +13,19 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
// EXTERNAL MODULE: ./src/util/index.js + 3 modules
|
|
16
|
-
var util = __webpack_require__(
|
|
16
|
+
var util = __webpack_require__(5780);
|
|
17
17
|
// EXTERNAL MODULE: ./src/common.js
|
|
18
|
-
var common = __webpack_require__(
|
|
18
|
+
var common = __webpack_require__(6304);
|
|
19
19
|
// EXTERNAL MODULE: ./node_modules/preact/dist/preact.module.js
|
|
20
|
-
var preact_module = __webpack_require__(
|
|
20
|
+
var preact_module = __webpack_require__(4284);
|
|
21
21
|
;// CONCATENATED MODULE: ./src/chatbox/Emoji.js
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
class Emoji extends common/* Com */.
|
|
25
|
+
class Emoji extends common/* Com */.Sq {
|
|
26
26
|
render() {
|
|
27
27
|
var emojiCode = this.props.emojiCode;
|
|
28
|
-
if (util/* default
|
|
28
|
+
if (util/* default */.c.size(emojiCode) < 3) return null;
|
|
29
29
|
var emojiText = emojiCode.replace(/:/g, '');
|
|
30
30
|
return (0,preact_module.h)("i", {
|
|
31
31
|
"data-tooltip": emojiCode,
|
|
@@ -36,11 +36,11 @@ class Emoji extends common/* Com */.up {
|
|
|
36
36
|
;// CONCATENATED MODULE: ./src/chatbox/ChatButton.js
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
var defaultBubble = __webpack_require__(
|
|
40
|
-
let defaultAvatar = __webpack_require__(
|
|
39
|
+
var defaultBubble = __webpack_require__(5671);
|
|
40
|
+
let defaultAvatar = __webpack_require__(9460);
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
class ChatButton extends common/* Com */.
|
|
43
|
+
class ChatButton extends common/* Com */.Sq {
|
|
44
44
|
constructor(props) {
|
|
45
45
|
super(props);
|
|
46
46
|
this.setState({
|
|
@@ -51,11 +51,11 @@ class ChatButton extends common/* Com */.up {
|
|
|
51
51
|
this.loadGreeting();
|
|
52
52
|
this.props.store.onUpdate(this, _ => this.forceUpdate());
|
|
53
53
|
this.props.store.onConvoEvent(this, ev => {
|
|
54
|
-
if (util/* default
|
|
55
|
-
let bytype = util/* default
|
|
54
|
+
if (util/* default */.c.get(ev, 'type') !== 'message_sent') return;
|
|
55
|
+
let bytype = util/* default */.c.get(ev, 'by.type');
|
|
56
56
|
if (bytype !== 'system' && bytype !== 'agent') return;
|
|
57
57
|
let isquickreplies = false;
|
|
58
|
-
util/* default
|
|
58
|
+
util/* default */.c.map(util/* default */.c.get(ev, 'data.message.attachments', []), att => {
|
|
59
59
|
if (!att) return;
|
|
60
60
|
if (att.type === 'quick_replies') {
|
|
61
61
|
isquickreplies = true;
|
|
@@ -69,30 +69,30 @@ class ChatButton extends common/* Com */.up {
|
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
fixMissingSetting(chatbox) {
|
|
72
|
-
chatbox = util/* default
|
|
73
|
-
if (util/* default
|
|
72
|
+
chatbox = util/* default */.c.cloneDeep(chatbox);
|
|
73
|
+
if (util/* default */.c.get(chatbox, 'desktop_button.background_image_url')) {
|
|
74
74
|
chatbox.desktop_button.background_image_url = this.props.store.replaceFileUrl(chatbox.desktop_button.background_image_url);
|
|
75
75
|
}
|
|
76
|
-
if (util/* default
|
|
76
|
+
if (util/* default */.c.get(chatbox, 'desktop_button.background_mask_url')) {
|
|
77
77
|
chatbox.desktop_button.background_mask_url = this.props.store.replaceFileUrl(chatbox.desktop_button.background_mask_url);
|
|
78
78
|
}
|
|
79
|
-
if (util/* default
|
|
79
|
+
if (util/* default */.c.get(chatbox, 'mobile_button.background_image_url')) {
|
|
80
80
|
chatbox.mobile_button.background_image_url = this.props.store.replaceFileUrl(chatbox.mobile_button.background_image_url);
|
|
81
81
|
}
|
|
82
|
-
if (util/* default
|
|
82
|
+
if (util/* default */.c.get(chatbox, 'mobile_button.background_mask_url')) {
|
|
83
83
|
chatbox.mobile_button.background_mask_url = this.props.store.replaceFileUrl(chatbox.mobile_button.background_mask_url);
|
|
84
84
|
}
|
|
85
85
|
return chatbox;
|
|
86
86
|
}
|
|
87
87
|
render() {
|
|
88
88
|
let accountSetting = this.props.plugin.chatbox;
|
|
89
|
-
let position = util/* default
|
|
89
|
+
let position = util/* default */.c.get(accountSetting, 'desktop_button.position') || 'right';
|
|
90
90
|
if (this.props.store.isMobile()) {
|
|
91
|
-
position = util/* default
|
|
92
|
-
let hiddenButtonMobile = util/* default
|
|
91
|
+
position = util/* default */.c.get(accountSetting, 'mobile_button.position') || position;
|
|
92
|
+
let hiddenButtonMobile = util/* default */.c.get(accountSetting, 'mobile_button.hidden');
|
|
93
93
|
if (hiddenButtonMobile) return null;
|
|
94
94
|
}
|
|
95
|
-
let hiddenButtonDesktop = util/* default
|
|
95
|
+
let hiddenButtonDesktop = util/* default */.c.get(accountSetting, 'desktop_button.hidden');
|
|
96
96
|
if (hiddenButtonDesktop) return null;
|
|
97
97
|
let cls = 'widget-layout widget-layout--' + position;
|
|
98
98
|
let opacity = this.state.opacity;
|
|
@@ -111,11 +111,15 @@ class ChatButton extends common/* Com */.up {
|
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
ShowGreeting() {
|
|
114
|
-
|
|
114
|
+
if (this.props.store.isMobile()) {
|
|
115
|
+
let accid = util/* default */.c.get(this.props.plugin, 'chatbox.account_id', {});
|
|
116
|
+
if (accid === 'acqjeefqeaoiagyfprap') return;
|
|
117
|
+
}
|
|
118
|
+
let greeting = util/* default */.c.get(this.props.plugin, 'chatbox.greeting', {});
|
|
115
119
|
let agentM = this.props.store.matchAgent('*');
|
|
116
120
|
let byid = greeting.agent_id;
|
|
117
121
|
if (!byid) byid = randomAgent(agentM).id;
|
|
118
|
-
let text = this.props.t.i18n(util/* default
|
|
122
|
+
let text = this.props.t.i18n(util/* default */.c.get(greeting, 'greeting', {})) || greeting.message;
|
|
119
123
|
this.setState({
|
|
120
124
|
previewEvent: {
|
|
121
125
|
by: {
|
|
@@ -139,9 +143,9 @@ class ChatButton extends common/* Com */.up {
|
|
|
139
143
|
}
|
|
140
144
|
loadGreeting() {
|
|
141
145
|
let accountSetting = this.props.plugin.chatbox;
|
|
142
|
-
if (new util/* default
|
|
143
|
-
let greeting = util/* default
|
|
144
|
-
let text = this.props.t.i18n(util/* default
|
|
146
|
+
if (new util/* default */.c.Date().getTime() - this.props.store.matchClosePreviewAt() < Ms30Mins) return;
|
|
147
|
+
let greeting = util/* default */.c.get(accountSetting, 'greeting', {});
|
|
148
|
+
let text = this.props.t.i18n(util/* default */.c.get(greeting, 'greeting', {})) || greeting.message;
|
|
145
149
|
if (!text || !greeting.enabled) {
|
|
146
150
|
this.setState({
|
|
147
151
|
previewEvent: {}
|
|
@@ -152,8 +156,8 @@ class ChatButton extends common/* Com */.up {
|
|
|
152
156
|
}
|
|
153
157
|
onClick() {
|
|
154
158
|
let lastview = this.props.store.matchLastview();
|
|
155
|
-
if (util/* default
|
|
156
|
-
if (lastview.view !== 'list' || util/* default
|
|
159
|
+
if (util/* default */.c.get(lastview, 'view')) {
|
|
160
|
+
if (lastview.view !== 'list' || util/* default */.c.size(this.props.store.matchConvo('*')) > 0) {
|
|
157
161
|
return this.props.onClick && this.props.onClick(Object.assign({}, lastview.opts, {
|
|
158
162
|
view: lastview.view
|
|
159
163
|
}));
|
|
@@ -162,10 +166,10 @@ class ChatButton extends common/* Com */.up {
|
|
|
162
166
|
return this.onPreviewClick();
|
|
163
167
|
}
|
|
164
168
|
onPreviewClick(e) {
|
|
165
|
-
let cid = util/* default
|
|
169
|
+
let cid = util/* default */.c.convoOfEv(this.state.previewEvent);
|
|
166
170
|
if (!cid) {
|
|
167
|
-
let convos = util/* default
|
|
168
|
-
let convo = util/* default
|
|
171
|
+
let convos = util/* default */.c.map(this.props.store.matchConvo('*'));
|
|
172
|
+
let convo = util/* default */.c.find(convos, convo => !util/* default */.c.isConvoSeen(convo, this.props.store.matchUser().id));
|
|
169
173
|
if (!convo) convo = convos[0] || {};
|
|
170
174
|
cid = convo.id;
|
|
171
175
|
}
|
|
@@ -185,24 +189,24 @@ class ChatButton extends common/* Com */.up {
|
|
|
185
189
|
renderPreview() {
|
|
186
190
|
let account = this.props.store.matchAccount();
|
|
187
191
|
let accountSetting = this.props.plugin.chatbox;
|
|
188
|
-
let byid = util/* default
|
|
189
|
-
let agent = util/* default
|
|
190
|
-
agent.fullname = agent.fullname || util/* default
|
|
192
|
+
let byid = util/* default */.c.get(this.state.previewEvent, 'by.display_id', util/* default */.c.get(this.state.previewEvent, 'by.id'));
|
|
193
|
+
let agent = util/* default */.c.cloneDeep(this.props.store.matchAgent(byid)) || {};
|
|
194
|
+
agent.fullname = agent.fullname || util/* default */.c.get(account, 'name') || this.props.t('agent');
|
|
191
195
|
agent.avatar_url = agent.avatar_url || defaultAvatar;
|
|
192
|
-
let position = util/* default
|
|
196
|
+
let position = util/* default */.c.get(accountSetting, 'desktop_button.position') || 'right';
|
|
193
197
|
if (this.props.store.isMobile()) {
|
|
194
|
-
position = util/* default
|
|
198
|
+
position = util/* default */.c.get(accountSetting, 'mobile_button.position') || position;
|
|
195
199
|
}
|
|
196
200
|
if (accountSetting && accountSetting.hide_agent_profile) {
|
|
197
201
|
agent = Object.assign({}, account, {
|
|
198
|
-
avatar_url: account.logo_url || __webpack_require__(
|
|
202
|
+
avatar_url: account.logo_url || __webpack_require__(6980),
|
|
199
203
|
fullname: account.name || this.props.t('agent')
|
|
200
204
|
});
|
|
201
205
|
}
|
|
202
206
|
let cls = 'widget-preview widget-preview--' + position;
|
|
203
207
|
if (!this.state.displayPreview) cls += ' widget-preview--hidden';
|
|
204
208
|
var tags = this.renderMessagePreview(this.state.previewEvent, this.props.t('sent_you_a_message'));
|
|
205
|
-
if (util/* default
|
|
209
|
+
if (util/* default */.c.size(tags) === 0) cls += ' widget-preview--hidden';
|
|
206
210
|
return (0,preact_module.h)("div", {
|
|
207
211
|
class: cls
|
|
208
212
|
}, (0,preact_module.h)("div", {
|
|
@@ -245,16 +249,20 @@ class ChatButton extends common/* Com */.up {
|
|
|
245
249
|
renderButton() {
|
|
246
250
|
let accountSetting = this.props.plugin.chatbox;
|
|
247
251
|
accountSetting = this.fixMissingSetting(accountSetting);
|
|
248
|
-
let imgsrc = util/* default
|
|
249
|
-
let background = util/* default
|
|
250
|
-
let position = util/* default
|
|
251
|
-
let imgurl = util/* default
|
|
252
|
-
let maskurl = util/* default
|
|
252
|
+
let imgsrc = util/* default */.c.get(accountSetting, 'desktop_button.background_image_url') || util/* default */.c.get(accountSetting, 'desktop_button.background_mask_url') || defaultBubble;
|
|
253
|
+
let background = util/* default */.c.get(accountSetting, 'background') || DEF_BG;
|
|
254
|
+
let position = util/* default */.c.get(accountSetting, 'desktop_button.position') || 'right';
|
|
255
|
+
let imgurl = util/* default */.c.get(accountSetting, 'desktop_button.background_image_url');
|
|
256
|
+
let maskurl = util/* default */.c.get(accountSetting, 'desktop_button.background_mask_url');
|
|
257
|
+
let imgwidth = util/* default */.c.get(accountSetting, 'desktop_button.width') || 70;
|
|
258
|
+
let imgheight = util/* default */.c.get(accountSetting, 'desktop_button.height') || 70;
|
|
253
259
|
if (this.props.store.isMobile()) {
|
|
254
|
-
imgsrc = util/* default
|
|
255
|
-
position = util/* default
|
|
256
|
-
let mobileimgurl = util/* default
|
|
257
|
-
let mobilemaskurl = util/* default
|
|
260
|
+
imgsrc = util/* default */.c.get(accountSetting, 'mobile_button.background_image_url') || util/* default */.c.get(accountSetting, 'mobile_button.background_mask_url') || imgsrc;
|
|
261
|
+
position = util/* default */.c.get(accountSetting, 'mobile_button.position') || position;
|
|
262
|
+
let mobileimgurl = util/* default */.c.get(accountSetting, 'mobile_button.background_image_url');
|
|
263
|
+
let mobilemaskurl = util/* default */.c.get(accountSetting, 'mobile_button.background_mask_url');
|
|
264
|
+
imgwidth = util/* default */.c.get(accountSetting, 'mobile_button.width') || 70;
|
|
265
|
+
imgheight = util/* default */.c.get(accountSetting, 'mobile_button.height') || 70;
|
|
258
266
|
if (mobileimgurl || mobilemaskurl) {
|
|
259
267
|
imgurl = mobileimgurl;
|
|
260
268
|
maskurl = mobilemaskurl;
|
|
@@ -273,8 +281,9 @@ class ChatButton extends common/* Com */.up {
|
|
|
273
281
|
-o-mask-image: url("${encodeURI(DEF_BG_URL)}") !important;
|
|
274
282
|
-moz-mask-image: url("${encodeURI(DEF_BG_URL)}") !important;
|
|
275
283
|
mask-image: url("${encodeURI(DEF_BG_URL)}") !important;
|
|
276
|
-
height:
|
|
277
|
-
width:
|
|
284
|
+
height: ${imgheight}px !important;
|
|
285
|
+
width: ${imgwidth}px !important;
|
|
286
|
+
background: ${background} !important;
|
|
278
287
|
background: ${background} !important;
|
|
279
288
|
mask-size: cover !important;
|
|
280
289
|
-webkit-mask-size: cover !important;
|
|
@@ -309,8 +318,8 @@ class ChatButton extends common/* Com */.up {
|
|
|
309
318
|
-o-mask-image: url("${encodeURI(maskurl)}") !important;
|
|
310
319
|
-moz-mask-image: url("${encodeURI(maskurl)}") !important;
|
|
311
320
|
mask-image: url("${encodeURI(maskurl)}") !important;
|
|
312
|
-
height:
|
|
313
|
-
width:
|
|
321
|
+
height: ${imgheight}px !important;
|
|
322
|
+
width: ${imgwidth}px !important;
|
|
314
323
|
background: ${background} !important;
|
|
315
324
|
-webkit-mask-size: cover !important;
|
|
316
325
|
-o-mask-size: cover !important;
|
|
@@ -319,11 +328,17 @@ class ChatButton extends common/* Com */.up {
|
|
|
319
328
|
`;
|
|
320
329
|
}
|
|
321
330
|
let cls = 'chat-button chat-button--' + position;
|
|
331
|
+
let whiteBgStyle = `
|
|
332
|
+
width: ${imgwidth - 4}px !important;
|
|
333
|
+
height: ${imgheight - 4}px !important;
|
|
334
|
+
|
|
335
|
+
`;
|
|
322
336
|
return (0,preact_module.h)("div", {
|
|
323
337
|
class: cls,
|
|
324
338
|
onClick: e => this.onClick(e)
|
|
325
339
|
}, (0,preact_module.h)("div", {
|
|
326
|
-
class: whitebgcls
|
|
340
|
+
class: whitebgcls,
|
|
341
|
+
style: whiteBgStyle
|
|
327
342
|
}), (0,preact_module.h)("div", {
|
|
328
343
|
class: "chat-button--img-container",
|
|
329
344
|
style: imgcontainerstyle
|
|
@@ -350,14 +365,14 @@ class ChatButton extends common/* Com */.up {
|
|
|
350
365
|
}
|
|
351
366
|
renderMessagePreview(ev, defmsg) {
|
|
352
367
|
defmsg = defmsg || 'Sent you a message';
|
|
353
|
-
let message = util/* default
|
|
354
|
-
var format = util/* default
|
|
368
|
+
let message = util/* default */.c.get(ev, 'data.message.text');
|
|
369
|
+
var format = util/* default */.c.get(ev, 'data.message.format');
|
|
355
370
|
if (format === 'delta') return this.renderDeltaMessagePreview(ev, defmsg);
|
|
356
371
|
if (format && format !== 'plaintext') message = defmsg;
|
|
357
|
-
if (!message && util/* default
|
|
372
|
+
if (!message && util/* default */.c.size(util/* default */.c.get(ev, 'data.message.attachments')) > 0) message = defmsg;
|
|
358
373
|
if (!message) return null;
|
|
359
|
-
let byType = util/* default
|
|
360
|
-
var tags = util/* default
|
|
374
|
+
let byType = util/* default */.c.get(ev, 'by.type');
|
|
375
|
+
var tags = util/* default */.c.extractText(message).map(tag => {
|
|
361
376
|
if (tag.type === 'emoji') return (0,preact_module.h)(Emoji, {
|
|
362
377
|
emojiCode: tag.text,
|
|
363
378
|
byType: byType
|
|
@@ -368,17 +383,17 @@ class ChatButton extends common/* Com */.up {
|
|
|
368
383
|
}
|
|
369
384
|
renderDeltaMessagePreview(ev, defmsg) {
|
|
370
385
|
defmsg = defmsg || 'Sent you a message';
|
|
371
|
-
let message = util/* default
|
|
372
|
-
if (!message && util/* default
|
|
386
|
+
let message = util/* default */.c.get(ev, 'data.message.quill_delta');
|
|
387
|
+
if (!message && util/* default */.c.size(util/* default */.c.get(ev, 'data.message.attachments')) > 0) message = defmsg;
|
|
373
388
|
if (!message) return;
|
|
374
|
-
let quilldeltas = util/* default
|
|
375
|
-
if (!quilldeltas || util/* default
|
|
376
|
-
let $deltas = util/* default
|
|
389
|
+
let quilldeltas = util/* default */.c.parseJSON(message) || {};
|
|
390
|
+
if (!quilldeltas || util/* default */.c.size(quilldeltas.ops) === 0) return null;
|
|
391
|
+
let $deltas = util/* default */.c.map(quilldeltas.ops, delta => {
|
|
377
392
|
let html = '';
|
|
378
393
|
let insert = delta.insert;
|
|
379
394
|
let attributes = delta.attributes;
|
|
380
395
|
if (insert.dynamicField) {
|
|
381
|
-
return util/* default
|
|
396
|
+
return util/* default */.c.get(insert, 'dynamicField.text', '');
|
|
382
397
|
}
|
|
383
398
|
if (insert.emoji) return (0,preact_module.h)(Emoji, {
|
|
384
399
|
emojiCode: `:${insert.emoji}:`
|
|
@@ -403,37 +418,37 @@ class ChatButton extends common/* Com */.up {
|
|
|
403
418
|
}
|
|
404
419
|
}
|
|
405
420
|
function randomAgent(agentM) {
|
|
406
|
-
var agents = util/* default
|
|
407
|
-
return agents[Math.floor(Math.random() * util/* default
|
|
421
|
+
var agents = util/* default */.c.filter(agentM, ag => ag.type === 'agent');
|
|
422
|
+
return agents[Math.floor(Math.random() * util/* default */.c.size(agents))] || {};
|
|
408
423
|
}
|
|
409
424
|
const Ms30Mins = 30 * 60 * 1000;
|
|
410
425
|
const DEF_BG_URL = 'https://vcdn.subiz-cdn.com/file/bubble_11.svg?v=5';
|
|
411
426
|
const DEF_BG = 'linear-gradient(280.16deg, #0053d3 22.03%, #0265ff 78.2%)';
|
|
412
427
|
;// CONCATENATED MODULE: ./src/chatbox/PoweredBy.js
|
|
413
|
-
var logo = __webpack_require__(
|
|
428
|
+
var logo = __webpack_require__(2560);
|
|
414
429
|
|
|
415
430
|
|
|
416
|
-
class PoweredBy extends common/* Com */.
|
|
431
|
+
class PoweredBy extends common/* Com */.Sq {
|
|
417
432
|
constructor(props) {
|
|
418
433
|
super(props);
|
|
419
434
|
}
|
|
420
435
|
render() {
|
|
421
436
|
if (this.props.store.isMobile()) return null;
|
|
422
437
|
let user = this.props.store.matchUser() || {};
|
|
423
|
-
var link = `https://subiz.com.vn/?utm_source
|
|
438
|
+
var link = `https://subiz.com.vn/?utm_source=${window.location.host || `id-${user.account_id}`}&utm_medium=widget&utm_campaign=widget_referral`;
|
|
424
439
|
return (0,preact_module.h)("div", {
|
|
425
440
|
class: "poweredby"
|
|
426
441
|
}, (0,preact_module.h)("a", {
|
|
427
442
|
href: link,
|
|
428
443
|
class: "poweredby--text",
|
|
429
444
|
target: "_blank",
|
|
430
|
-
|
|
445
|
+
title: "Subiz"
|
|
431
446
|
}, (0,preact_module.h)("img", {
|
|
432
447
|
width: "14",
|
|
433
448
|
height: "10",
|
|
434
449
|
class: "poweredby--subiz-logo",
|
|
435
450
|
src: logo,
|
|
436
|
-
alt: "power by"
|
|
451
|
+
alt: "power by subiz"
|
|
437
452
|
}), " Subiz"));
|
|
438
453
|
}
|
|
439
454
|
}
|
|
@@ -441,7 +456,7 @@ class PoweredBy extends common/* Com */.up {
|
|
|
441
456
|
|
|
442
457
|
|
|
443
458
|
|
|
444
|
-
class AgentsAvatar extends common/* Com */.
|
|
459
|
+
class AgentsAvatar extends common/* Com */.Sq {
|
|
445
460
|
constructor(props) {
|
|
446
461
|
super(props);
|
|
447
462
|
}
|
|
@@ -462,21 +477,21 @@ class AgentsAvatar extends common/* Com */.up {
|
|
|
462
477
|
height: 35,
|
|
463
478
|
alt: "agent avatar left",
|
|
464
479
|
class: "avatar group-avatar--agent-left",
|
|
465
|
-
src: this.props.store.replaceFileUrl(acc.logo_url) || __webpack_require__(
|
|
480
|
+
src: this.props.store.replaceFileUrl(acc.logo_url) || __webpack_require__(6980)
|
|
466
481
|
})));
|
|
467
482
|
}
|
|
468
483
|
let agentM = this.props.store.matchAgent('*');
|
|
469
|
-
var agents = util/* default
|
|
470
|
-
if (this.props.agent_ids === undefined || util/* default
|
|
471
|
-
var agids = util/* default
|
|
472
|
-
agids = util/* default
|
|
484
|
+
var agents = util/* default */.c.map(this.props.agent_ids, id => agentM[id]);
|
|
485
|
+
if (this.props.agent_ids === undefined || util/* default */.c.size(this.props.agent_ids) === 0) {
|
|
486
|
+
var agids = util/* default */.c.get(accountSetting, 'header.agent_ids', []);
|
|
487
|
+
agids = util/* default */.c.filter(agids, id => !!agentM[id]);
|
|
473
488
|
if (agids.length !== 0) {
|
|
474
|
-
agents = util/* default
|
|
489
|
+
agents = util/* default */.c.map(agids, id => agentM[id]);
|
|
475
490
|
} else {
|
|
476
|
-
agents = util/* default
|
|
491
|
+
agents = util/* default */.c.filter(agentM, agent => agent.type === 'agent');
|
|
477
492
|
}
|
|
478
493
|
}
|
|
479
|
-
agents = util/* default
|
|
494
|
+
agents = util/* default */.c.filter(agents, ag => !!ag);
|
|
480
495
|
if (agents.length === 0) {
|
|
481
496
|
return (0,preact_module.h)("div", {
|
|
482
497
|
class: `group-avatar group-avatar--${mode}`
|
|
@@ -489,7 +504,7 @@ class AgentsAvatar extends common/* Com */.up {
|
|
|
489
504
|
height: 35,
|
|
490
505
|
alt: "agent avatar left",
|
|
491
506
|
class: "avatar group-avatar--agent-left",
|
|
492
|
-
src: this.props.store.replaceFileUrl(acc.logo_url) || __webpack_require__(
|
|
507
|
+
src: this.props.store.replaceFileUrl(acc.logo_url) || __webpack_require__(6980)
|
|
493
508
|
})));
|
|
494
509
|
}
|
|
495
510
|
if (agents.length === 1) {
|
|
@@ -506,7 +521,7 @@ class AgentsAvatar extends common/* Com */.up {
|
|
|
506
521
|
height: 35,
|
|
507
522
|
class: `avatar ${groupClass}`,
|
|
508
523
|
alt: "agent avatar",
|
|
509
|
-
src: this.props.store.replaceFileUrl(agent.avatar_url) || __webpack_require__(
|
|
524
|
+
src: this.props.store.replaceFileUrl(agent.avatar_url) || __webpack_require__(9460)
|
|
510
525
|
})));
|
|
511
526
|
}
|
|
512
527
|
if (agents.length === 2) {
|
|
@@ -523,7 +538,7 @@ class AgentsAvatar extends common/* Com */.up {
|
|
|
523
538
|
height: 35,
|
|
524
539
|
alt: "agent avatar left",
|
|
525
540
|
class: "avatar group-avatar--agent-left",
|
|
526
|
-
src: this.props.store.replaceFileUrl(leftAgent.avatar_url) || __webpack_require__(
|
|
541
|
+
src: this.props.store.replaceFileUrl(leftAgent.avatar_url) || __webpack_require__(9460)
|
|
527
542
|
})), (0,preact_module.h)("div", {
|
|
528
543
|
class: "d-inline-block pos-relative",
|
|
529
544
|
"data-tooltip": rightAgent.fullname || acc.name,
|
|
@@ -533,7 +548,7 @@ class AgentsAvatar extends common/* Com */.up {
|
|
|
533
548
|
width: 35,
|
|
534
549
|
height: 35,
|
|
535
550
|
class: "avatar group-avatar--agent-right",
|
|
536
|
-
src: this.props.store.replaceFileUrl(rightAgent.avatar_url) || __webpack_require__(
|
|
551
|
+
src: this.props.store.replaceFileUrl(rightAgent.avatar_url) || __webpack_require__(9460)
|
|
537
552
|
})));
|
|
538
553
|
}
|
|
539
554
|
let leftAgent = agents[0];
|
|
@@ -550,7 +565,7 @@ class AgentsAvatar extends common/* Com */.up {
|
|
|
550
565
|
height: 35,
|
|
551
566
|
alt: "agent avatar left",
|
|
552
567
|
class: "avatar group-avatar--agent-left",
|
|
553
|
-
src: this.props.store.replaceFileUrl(leftAgent.avatar_url) || __webpack_require__(
|
|
568
|
+
src: this.props.store.replaceFileUrl(leftAgent.avatar_url) || __webpack_require__(9460)
|
|
554
569
|
})), (0,preact_module.h)("div", {
|
|
555
570
|
class: "d-inline-block pos-relative",
|
|
556
571
|
"data-tooltip": middleAgent.fullname || acc.name,
|
|
@@ -560,7 +575,7 @@ class AgentsAvatar extends common/* Com */.up {
|
|
|
560
575
|
width: 35,
|
|
561
576
|
height: 35,
|
|
562
577
|
class: "avatar group-avatar--agent-middle",
|
|
563
|
-
src: this.props.store.replaceFileUrl(middleAgent.avatar_url) || __webpack_require__(
|
|
578
|
+
src: this.props.store.replaceFileUrl(middleAgent.avatar_url) || __webpack_require__(9460)
|
|
564
579
|
})), (0,preact_module.h)("div", {
|
|
565
580
|
class: "d-inline-block pos-relative",
|
|
566
581
|
"data-tooltip": rightAgent.fullname || acc.name,
|
|
@@ -570,7 +585,7 @@ class AgentsAvatar extends common/* Com */.up {
|
|
|
570
585
|
height: 35,
|
|
571
586
|
alt: "agent avatar right",
|
|
572
587
|
class: "avatar group-avatar--agent-right",
|
|
573
|
-
src: this.props.store.replaceFileUrl(rightAgent.avatar_url) || __webpack_require__(
|
|
588
|
+
src: this.props.store.replaceFileUrl(rightAgent.avatar_url) || __webpack_require__(9460)
|
|
574
589
|
})));
|
|
575
590
|
}
|
|
576
591
|
}
|
|
@@ -580,7 +595,7 @@ class AgentsAvatar extends common/* Com */.up {
|
|
|
580
595
|
|
|
581
596
|
|
|
582
597
|
|
|
583
|
-
class Header extends common/* Com */.
|
|
598
|
+
class Header extends common/* Com */.Sq {
|
|
584
599
|
constructor(props) {
|
|
585
600
|
super(props);
|
|
586
601
|
}
|
|
@@ -590,7 +605,7 @@ class Header extends common/* Com */.up {
|
|
|
590
605
|
let renderSocial = false;
|
|
591
606
|
let renderTeam = false;
|
|
592
607
|
let accSetting = this.props.plugin.chatbox || {};
|
|
593
|
-
let layout = util/* default
|
|
608
|
+
let layout = util/* default */.c.get(accSetting, 'header.layout');
|
|
594
609
|
let renderCollapsed = this.props.view !== 'list' && headerMode === 'collapsed';
|
|
595
610
|
let renderClassic = !renderCollapsed && layout === 'classic';
|
|
596
611
|
if (renderCollapsed || layout == 'classic') {
|
|
@@ -608,9 +623,9 @@ class Header extends common/* Com */.up {
|
|
|
608
623
|
let accSetting = this.props.plugin.chatbox || {};
|
|
609
624
|
let acc = this.props.store.matchAccount() || {};
|
|
610
625
|
let state = acc.is_online ? this.props.t('agent_online') : this.props.t('agent_offline');
|
|
611
|
-
let tagline = util/* default
|
|
626
|
+
let tagline = util/* default */.c.get(accSetting, `tagline`, {});
|
|
612
627
|
let desc = this.props.t.i18n(tagline) || accSetting.introduction || state;
|
|
613
|
-
let agentIdsJoined = util/* default
|
|
628
|
+
let agentIdsJoined = util/* default */.c.map(this.getAgentJoined(this.props.cid), agent => agent.id);
|
|
614
629
|
let cls = 'widget-header--inner widget-header--inner--collapsed';
|
|
615
630
|
if (!show) cls += ' widget-header--inner--hidden';
|
|
616
631
|
let $back = null;
|
|
@@ -636,8 +651,8 @@ class Header extends common/* Com */.up {
|
|
|
636
651
|
renderSocial(show) {
|
|
637
652
|
let accSetting = this.props.plugin.chatbox || {};
|
|
638
653
|
let acc = this.props.store.matchAccount() || {};
|
|
639
|
-
let links = util/* default
|
|
640
|
-
let $links = util/* default
|
|
654
|
+
let links = util/* default */.c.get(accSetting, 'header.links') || [];
|
|
655
|
+
let $links = util/* default */.c.map(links, link => {
|
|
641
656
|
if (!link.url || !link.type || link.type === 'subiz') return null;
|
|
642
657
|
if (link.type === 'email') {
|
|
643
658
|
return (0,preact_module.h)("div", null, (0,preact_module.h)("a", {
|
|
@@ -650,17 +665,16 @@ class Header extends common/* Com */.up {
|
|
|
650
665
|
return (0,preact_module.h)("div", null, (0,preact_module.h)("a", {
|
|
651
666
|
href: link.url,
|
|
652
667
|
target: "_blank",
|
|
653
|
-
title: link.url
|
|
654
|
-
rel: "noreferrer"
|
|
668
|
+
title: link.url
|
|
655
669
|
}, (0,preact_module.h)("i", {
|
|
656
670
|
class: `social__links-logo social__links-logo--${link.type}`
|
|
657
671
|
})));
|
|
658
672
|
});
|
|
659
673
|
const DEFTEAMINTO = `Chúng tôi sẵn sàng trợ giúp :wave:.
|
|
660
674
|
Vui lòng hỏi chúng tôi bất cứ điều gì hoặc chia sẻ phản hồi của bạn`;
|
|
661
|
-
let tagline = util/* default
|
|
675
|
+
let tagline = util/* default */.c.get(accSetting, `tagline`, {});
|
|
662
676
|
var teamintro = this.props.t.i18n(tagline) || accSetting.introduction || this.props.t('team_intro') || DEFTEAMINTO;
|
|
663
|
-
var tags = util/* default
|
|
677
|
+
var tags = util/* default */.c.extractText(teamintro).map(tag => {
|
|
664
678
|
if (tag.type === 'emoji') return (0,preact_module.h)(Emoji, {
|
|
665
679
|
emojiCode: tag.text
|
|
666
680
|
});
|
|
@@ -681,7 +695,7 @@ Vui lòng hỏi chúng tôi bất cứ điều gì hoặc chia sẻ phản hồi
|
|
|
681
695
|
}, (0,preact_module.h)("img", {
|
|
682
696
|
alt: "logo",
|
|
683
697
|
class: "social__account_logo",
|
|
684
|
-
src: this.props.store.replaceFileUrl(util/* default
|
|
698
|
+
src: this.props.store.replaceFileUrl(util/* default */.c.get(acc, 'logo_url'))
|
|
685
699
|
}), (0,preact_module.h)("div", null, (0,preact_module.h)("div", {
|
|
686
700
|
class: "social__introduction"
|
|
687
701
|
}, tags), (0,preact_module.h)("div", {
|
|
@@ -692,9 +706,9 @@ Vui lòng hỏi chúng tôi bất cứ điều gì hoặc chia sẻ phản hồi
|
|
|
692
706
|
let accSetting = this.props.plugin.chatbox || {};
|
|
693
707
|
const DEFTEAMINTO = `Chúng tôi sẵn sàng trợ giúp :wave:.
|
|
694
708
|
Vui lòng hỏi chúng tôi bất cứ điều gì hoặc chia sẻ phản hồi của bạn`;
|
|
695
|
-
let tagline = util/* default
|
|
709
|
+
let tagline = util/* default */.c.get(accSetting, `tagline`, {});
|
|
696
710
|
var teamintro = this.props.t.i18n(tagline) || accSetting.introduction || this.props.t('team_intro') || DEFTEAMINTO;
|
|
697
|
-
var tags = util/* default
|
|
711
|
+
var tags = util/* default */.c.extractText(teamintro).map(tag => {
|
|
698
712
|
if (tag.type === 'emoji') return (0,preact_module.h)(Emoji, {
|
|
699
713
|
emojiCode: tag.text
|
|
700
714
|
});
|
|
@@ -728,19 +742,19 @@ Vui lòng hỏi chúng tôi bất cứ điều gì hoặc chia sẻ phản hồi
|
|
|
728
742
|
let accSetting = this.props.plugin.chatbox || {};
|
|
729
743
|
let acc = this.props.store.matchAccount() || {};
|
|
730
744
|
let agentsJoined = this.getAgentJoined(this.props.cid);
|
|
731
|
-
let caption = util/* default
|
|
745
|
+
let caption = util/* default */.c.get(this.props.plugin, 'chatbox.caption', {});
|
|
732
746
|
let title = this.props.t.i18n(caption) || accSetting.title;
|
|
733
747
|
return getJoinedNameMember(agentsJoined) || title || acc.name || this.props.t('widget_title');
|
|
734
748
|
}
|
|
735
749
|
renderBackButton() {
|
|
736
750
|
let allconvos = this.props.store.matchConvo('*');
|
|
737
|
-
if (util/* default
|
|
751
|
+
if (util/* default */.c.size(allconvos) === 0) return null;
|
|
738
752
|
var $unreadcount = null;
|
|
739
753
|
let user = this.props.store.matchUser();
|
|
740
754
|
let unreadcount = 0;
|
|
741
|
-
util/* default
|
|
755
|
+
util/* default */.c.map(allconvos, convo => {
|
|
742
756
|
if (convo.id == this.props.cid) return;
|
|
743
|
-
if (!util/* default
|
|
757
|
+
if (!util/* default */.c.isConvoSeen(convo, user.id)) unreadcount++;
|
|
744
758
|
});
|
|
745
759
|
if (unreadcount !== 0) {
|
|
746
760
|
$unreadcount = (0,preact_module.h)("span", {
|
|
@@ -779,42 +793,42 @@ Vui lòng hỏi chúng tôi bất cứ điều gì hoặc chia sẻ phản hồi
|
|
|
779
793
|
}
|
|
780
794
|
getAgentJoined(cid) {
|
|
781
795
|
var convo = this.props.store.matchConvo(cid) || {};
|
|
782
|
-
let joined = util/* default
|
|
796
|
+
let joined = util/* default */.c.filter(convo.members, mem => mem.type === 'agent' && mem.membership === 'active');
|
|
783
797
|
return joined;
|
|
784
798
|
}
|
|
785
799
|
}
|
|
786
800
|
let getJoinedNameMember = agents => {
|
|
787
|
-
agents = util/* default
|
|
801
|
+
agents = util/* default */.c.filter(agents, agent => util/* default */.c.trim(agent.fullname));
|
|
788
802
|
if (!agents.length) return null;
|
|
789
|
-
return util/* default
|
|
803
|
+
return util/* default */.c.map(agents, agent => agent.fullname).join(', ');
|
|
790
804
|
};
|
|
791
805
|
;// CONCATENATED MODULE: ./src/chatbox/MessageInput.js
|
|
792
806
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
793
|
-
function _toPropertyKey(
|
|
794
|
-
function _toPrimitive(
|
|
807
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
808
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
795
809
|
|
|
796
810
|
|
|
797
811
|
|
|
798
812
|
|
|
799
|
-
class MessageInput extends common/* Com */.
|
|
813
|
+
class MessageInput extends common/* Com */.Sq {
|
|
800
814
|
constructor(props) {
|
|
801
815
|
super(props);
|
|
802
|
-
_defineProperty(this, "onEnter", util/* default
|
|
816
|
+
_defineProperty(this, "onEnter", util/* default */.c.throttle(function () {
|
|
803
817
|
this.submitMessage();
|
|
804
818
|
}, 50));
|
|
805
|
-
this.refFileInput = (0,preact_module/* createRef */.
|
|
806
|
-
this.refMessageInput = (0,preact_module/* createRef */.
|
|
819
|
+
this.refFileInput = (0,preact_module/* createRef */.Yn)();
|
|
820
|
+
this.refMessageInput = (0,preact_module/* createRef */.Yn)();
|
|
807
821
|
this.props.store.onUpdate(this, _ => this.forceUpdate());
|
|
808
822
|
this.props.store.onConvoEvent(this, ev => {
|
|
809
|
-
var evcid = util/* default
|
|
823
|
+
var evcid = util/* default */.c.convoOfEv(ev);
|
|
810
824
|
if (evcid !== this.props.cid) return;
|
|
811
825
|
this.forceUpdate();
|
|
812
826
|
});
|
|
813
827
|
this.focus();
|
|
814
|
-
this._forceUpdate = util/* default
|
|
828
|
+
this._forceUpdate = util/* default */.c.throttle(() => {
|
|
815
829
|
this.forceUpdate();
|
|
816
830
|
}, 500);
|
|
817
|
-
this.resizeInput = util/* default
|
|
831
|
+
this.resizeInput = util/* default */.c.throttle(function () {
|
|
818
832
|
const input = this.refMessageInput.current;
|
|
819
833
|
input.style.setProperty('height', '1em', 'important');
|
|
820
834
|
const height = Math.min(200, input.scrollHeight);
|
|
@@ -834,7 +848,7 @@ class MessageInput extends common/* Com */.up {
|
|
|
834
848
|
class: "message-input--button message-input--attachment-button",
|
|
835
849
|
onClick: e => this.selectFile(e)
|
|
836
850
|
}));
|
|
837
|
-
var msg = util/* default
|
|
851
|
+
var msg = util/* default */.c.trim(this.refMessageInput.current && this.refMessageInput.current.value);
|
|
838
852
|
if (msg.length > 0) {
|
|
839
853
|
buttons = (0,preact_module.h)("div", {
|
|
840
854
|
class: "d-flex flex-row align-self-end"
|
|
@@ -873,30 +887,30 @@ class MessageInput extends common/* Com */.up {
|
|
|
873
887
|
}
|
|
874
888
|
hasUnfinishRequiredFormOrLock() {
|
|
875
889
|
let convo = this.props.store.matchConvo(this.props.cid);
|
|
876
|
-
if (util/* default
|
|
890
|
+
if (util/* default */.c.get(convo, 'state') === 'ended') return false;
|
|
877
891
|
let events = this.props.store.listEvents(this.props.cid);
|
|
878
|
-
events = util/* default
|
|
879
|
-
let attachments = util/* default
|
|
880
|
-
let lock = util/* default
|
|
892
|
+
events = util/* default */.c.orderBy(events, 'created', 'desc').filter(ev => ev.type === 'message_sent');
|
|
893
|
+
let attachments = util/* default */.c.get(events[0], 'data.message.attachments', []);
|
|
894
|
+
let lock = util/* default */.c.find(attachments, att => util/* default */.c.get(att, 'lock_input'));
|
|
881
895
|
if (lock) return true;
|
|
882
896
|
var last_agent_sent;
|
|
883
897
|
for (let ev of events) {
|
|
884
|
-
if (util/* default
|
|
898
|
+
if (util/* default */.c.get(ev, 'by.type') === 'user') continue;
|
|
885
899
|
last_agent_sent = ev;
|
|
886
900
|
break;
|
|
887
901
|
}
|
|
888
|
-
attachments = util/* default
|
|
889
|
-
let pendingForms = util/* default
|
|
902
|
+
attachments = util/* default */.c.get(last_agent_sent, 'data.message.attachments', []);
|
|
903
|
+
let pendingForms = util/* default */.c.filter(attachments, att => {
|
|
890
904
|
if (!att) return false;
|
|
891
905
|
if (att.type !== 'form' && att.type !== 'ask_info_form') return false;
|
|
892
906
|
var form = att.form;
|
|
893
907
|
if (!form) return false;
|
|
894
|
-
var state = util/* default
|
|
908
|
+
var state = util/* default */.c.parseJSON(form.state) || {};
|
|
895
909
|
if (!state.require_finished && att.type !== 'ask_info_form') return false;
|
|
896
910
|
if (isSummited(att.form)) return false;
|
|
897
911
|
return true;
|
|
898
912
|
});
|
|
899
|
-
return util/* default
|
|
913
|
+
return util/* default */.c.size(pendingForms) > 0;
|
|
900
914
|
}
|
|
901
915
|
renderEmojiPopup() {
|
|
902
916
|
if (!this.state.openEmoji) return null;
|
|
@@ -1000,10 +1014,10 @@ class MessageInput extends common/* Com */.up {
|
|
|
1000
1014
|
focus() {
|
|
1001
1015
|
if (this.props.disabled) return;
|
|
1002
1016
|
this.refMessageInput.current && this.refMessageInput.current.focus();
|
|
1003
|
-
util/* default
|
|
1017
|
+
util/* default */.c.setTimeout(() => {
|
|
1004
1018
|
this.refMessageInput.current && this.refMessageInput.current.focus();
|
|
1005
1019
|
});
|
|
1006
|
-
util/* default
|
|
1020
|
+
util/* default */.c.setTimeout(() => {
|
|
1007
1021
|
this.refMessageInput.current && this.refMessageInput.current.focus();
|
|
1008
1022
|
}, 100);
|
|
1009
1023
|
}
|
|
@@ -1053,9 +1067,9 @@ class MessageInput extends common/* Com */.up {
|
|
|
1053
1067
|
$input.value = '';
|
|
1054
1068
|
}
|
|
1055
1069
|
_sendFile(files) {
|
|
1056
|
-
if (util/* default
|
|
1070
|
+
if (util/* default */.c.size(files) === 0) return;
|
|
1057
1071
|
if (this.props.disabled) return;
|
|
1058
|
-
let attachments = util/* default
|
|
1072
|
+
let attachments = util/* default */.c.map(files, file => {
|
|
1059
1073
|
return {
|
|
1060
1074
|
type: 'file',
|
|
1061
1075
|
mimetype: file.type,
|
|
@@ -1069,7 +1083,7 @@ class MessageInput extends common/* Com */.up {
|
|
|
1069
1083
|
});
|
|
1070
1084
|
}
|
|
1071
1085
|
async submitMessage(msg) {
|
|
1072
|
-
msg = msg || util/* default
|
|
1086
|
+
msg = msg || util/* default */.c.trim(this.refMessageInput.current.value) || '';
|
|
1073
1087
|
if (!msg) return;
|
|
1074
1088
|
if (this.props.disabled) return;
|
|
1075
1089
|
this.refMessageInput.current.value = '';
|
|
@@ -1088,7 +1102,7 @@ class MessageInput extends common/* Com */.up {
|
|
|
1088
1102
|
}
|
|
1089
1103
|
pasteImage(event) {
|
|
1090
1104
|
if (!window.File || !window.FileReader || !window.FileList || !window.Blob) return;
|
|
1091
|
-
let now = new util/* default
|
|
1105
|
+
let now = new util/* default */.c.Date();
|
|
1092
1106
|
let year = now.getFullYear();
|
|
1093
1107
|
let month = now.getMonth() + 1;
|
|
1094
1108
|
let date = now.getDate();
|
|
@@ -1110,24 +1124,124 @@ class MessageInput extends common/* Com */.up {
|
|
|
1110
1124
|
}
|
|
1111
1125
|
}
|
|
1112
1126
|
function isSummited(form) {
|
|
1113
|
-
let fields = util/* default
|
|
1114
|
-
return util/* default
|
|
1127
|
+
let fields = util/* default */.c.get(form, 'fields') || [];
|
|
1128
|
+
return util/* default */.c.find(fields, field => !!field.answered);
|
|
1115
1129
|
}
|
|
1116
1130
|
;// CONCATENATED MODULE: ./src/chatbox/ImageAttachments.js
|
|
1131
|
+
function ImageAttachments_defineProperty(obj, key, value) { key = ImageAttachments_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1132
|
+
function ImageAttachments_toPropertyKey(t) { var i = ImageAttachments_toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
1133
|
+
function ImageAttachments_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
1117
1134
|
|
|
1118
1135
|
|
|
1119
1136
|
|
|
1120
|
-
class ImageAttachment extends common/* Com */.
|
|
1137
|
+
class ImageAttachment extends common/* Com */.Sq {
|
|
1121
1138
|
constructor(props) {
|
|
1122
1139
|
super(props);
|
|
1140
|
+
ImageAttachments_defineProperty(this, "containerRef", (0,preact_module/* createRef */.Yn)());
|
|
1141
|
+
this.setState({
|
|
1142
|
+
ready: false,
|
|
1143
|
+
errorIndecies: []
|
|
1144
|
+
});
|
|
1145
|
+
}
|
|
1146
|
+
componentDidMount() {
|
|
1147
|
+
this.setImageFrameDimension();
|
|
1148
|
+
}
|
|
1149
|
+
setImageFrameDimension() {
|
|
1150
|
+
const MAX_HEIGHT = 240;
|
|
1151
|
+
const DEFAULT_MAX_WIDTH = 267;
|
|
1152
|
+
let $container = this.containerRef.current;
|
|
1153
|
+
this.frameWidth = $container ? $container.offsetWidth : DEFAULT_MAX_WIDTH;
|
|
1154
|
+
this.frameHeight = MAX_HEIGHT;
|
|
1155
|
+
this.setState({
|
|
1156
|
+
ready: true
|
|
1157
|
+
});
|
|
1158
|
+
}
|
|
1159
|
+
onErrorImage(index) {
|
|
1160
|
+
let indecies = this.state.errorIndecies || [];
|
|
1161
|
+
indecies.push(index);
|
|
1162
|
+
indecies = [...indecies];
|
|
1163
|
+
this.setState({
|
|
1164
|
+
errorIndecies: indecies
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
calculateImageDimension(image) {
|
|
1168
|
+
if (!image.width || !image.height) return {
|
|
1169
|
+
width: this.frameWidth,
|
|
1170
|
+
height: this.frameHeight
|
|
1171
|
+
};
|
|
1172
|
+
let ratio = image.width / image.height - this.frameWidth / this.frameHeight;
|
|
1173
|
+
if (ratio >= 0) {
|
|
1174
|
+
let width = this.frameWidth;
|
|
1175
|
+
let height = image.height * this.frameWidth / image.width;
|
|
1176
|
+
height = Math.round(height);
|
|
1177
|
+
return {
|
|
1178
|
+
width,
|
|
1179
|
+
height
|
|
1180
|
+
};
|
|
1181
|
+
} else {
|
|
1182
|
+
let height = this.frameHeight;
|
|
1183
|
+
let width = image.width * this.frameHeight / image.height;
|
|
1184
|
+
width = Math.round(width);
|
|
1185
|
+
return {
|
|
1186
|
+
width,
|
|
1187
|
+
height
|
|
1188
|
+
};
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
renderImage(image, index) {
|
|
1192
|
+
if (!this.state.ready) {
|
|
1193
|
+
return;
|
|
1194
|
+
}
|
|
1195
|
+
let byType = util/* default */.c.get(this.props.ev, 'by.type');
|
|
1196
|
+
if (!image.width || !image.height) {
|
|
1197
|
+
return (0,preact_module.h)("div", {
|
|
1198
|
+
class: `image-attachment image-attachment--${byType}`
|
|
1199
|
+
}, (0,preact_module.h)("a", {
|
|
1200
|
+
href: this.props.store.replaceFileUrl(image.url),
|
|
1201
|
+
target: "_blank"
|
|
1202
|
+
}, (0,preact_module.h)("img", {
|
|
1203
|
+
alt: true,
|
|
1204
|
+
class: "image-attachment__img",
|
|
1205
|
+
src: this.props.store.replaceFileUrl(image.thumbnail_url || image.url),
|
|
1206
|
+
onload: e => this.props.onLoad && this.props.onLoad()
|
|
1207
|
+
})));
|
|
1208
|
+
}
|
|
1209
|
+
let {
|
|
1210
|
+
width,
|
|
1211
|
+
height
|
|
1212
|
+
} = this.calculateImageDimension(image);
|
|
1213
|
+
let url = this.props.store.replaceFileUrl(image.thumbnail_url || image.url);
|
|
1214
|
+
let trueUrl = this.props.store.replaceFileUrl(image.url);
|
|
1215
|
+
if (this.state.errorIndecies.includes(index)) {
|
|
1216
|
+
url = __webpack_require__(4824);
|
|
1217
|
+
trueUrl = url;
|
|
1218
|
+
}
|
|
1219
|
+
return (0,preact_module.h)("div", {
|
|
1220
|
+
class: `image-attachment image-attachment--${byType}`
|
|
1221
|
+
}, (0,preact_module.h)("a", {
|
|
1222
|
+
href: trueUrl,
|
|
1223
|
+
target: "_blank"
|
|
1224
|
+
}, (0,preact_module.h)("img", {
|
|
1225
|
+
alt: true,
|
|
1226
|
+
ref: el => {
|
|
1227
|
+
if (el) {
|
|
1228
|
+
el.style.setProperty('width', `${width}px`, 'important');
|
|
1229
|
+
el.style.setProperty('height', `${height}px`, 'important');
|
|
1230
|
+
}
|
|
1231
|
+
},
|
|
1232
|
+
class: "image-attachment__img",
|
|
1233
|
+
src: url,
|
|
1234
|
+
onload: e => this.props.onLoad && this.props.onLoad(),
|
|
1235
|
+
onerror: e => this.onErrorImage(index)
|
|
1236
|
+
})));
|
|
1123
1237
|
}
|
|
1124
1238
|
render() {
|
|
1125
|
-
var attachments = util/* default
|
|
1239
|
+
var attachments = util/* default */.c.get(this.props.ev, 'data.message.attachments', []);
|
|
1126
1240
|
var images = [];
|
|
1127
|
-
let byType = util/* default
|
|
1128
|
-
util/* default
|
|
1241
|
+
let byType = util/* default */.c.get(this.props.ev, 'by.type');
|
|
1242
|
+
util/* default */.c.each(attachments, (att, i) => {
|
|
1129
1243
|
if (!att) return;
|
|
1130
|
-
if (!util/* default
|
|
1244
|
+
if (!util/* default */.c.includes(att.mimetype, 'image')) return;
|
|
1131
1245
|
if (!att.url) return;
|
|
1132
1246
|
var uri = att.url;
|
|
1133
1247
|
if (!uri.startsWith('https://') && !uri.startsWith('http://') && !uri.startsWith('content://') && !uri.startsWith('data:')) {
|
|
@@ -1136,24 +1250,16 @@ class ImageAttachment extends common/* Com */.up {
|
|
|
1136
1250
|
images.push(att);
|
|
1137
1251
|
});
|
|
1138
1252
|
if (images.length === 0) return null;
|
|
1139
|
-
|
|
1140
|
-
class: `image-attachment image-attachment--${byType}`
|
|
1141
|
-
}, (0,preact_module.h)("a", {
|
|
1142
|
-
href: this.props.store.replaceFileUrl(image.thumbnail_url || image.url),
|
|
1143
|
-
target: "_blank"
|
|
1144
|
-
}, (0,preact_module.h)("img", {
|
|
1145
|
-
alt: true,
|
|
1146
|
-
class: "image-attachment__img",
|
|
1147
|
-
src: this.props.store.replaceFileUrl(image.thumbnail_url || image.url),
|
|
1148
|
-
onload: e => this.props.onLoad && this.props.onLoad()
|
|
1149
|
-
}))));
|
|
1253
|
+
let $images = util/* default */.c.map(images, (image, index) => this.renderImage(image, index));
|
|
1150
1254
|
if (byType === 'agent') {
|
|
1151
1255
|
return (0,preact_module.h)("div", {
|
|
1152
|
-
class: "message-agent"
|
|
1256
|
+
class: "message-agent",
|
|
1257
|
+
ref: this.containerRef
|
|
1153
1258
|
}, $images);
|
|
1154
1259
|
} else {
|
|
1155
1260
|
return (0,preact_module.h)("div", {
|
|
1156
|
-
class: "message-user"
|
|
1261
|
+
class: "message-user message-user-images-container",
|
|
1262
|
+
ref: this.containerRef
|
|
1157
1263
|
}, $images);
|
|
1158
1264
|
}
|
|
1159
1265
|
}
|
|
@@ -1162,20 +1268,20 @@ class ImageAttachment extends common/* Com */.up {
|
|
|
1162
1268
|
|
|
1163
1269
|
|
|
1164
1270
|
|
|
1165
|
-
class AudioAttachments extends common/* Com */.
|
|
1271
|
+
class AudioAttachments extends common/* Com */.Sq {
|
|
1166
1272
|
constructor(props) {
|
|
1167
1273
|
super(props);
|
|
1168
1274
|
}
|
|
1169
1275
|
render() {
|
|
1170
|
-
let byType = util/* default
|
|
1171
|
-
var attachments = util/* default
|
|
1276
|
+
let byType = util/* default */.c.get(this.props.ev, 'by.type');
|
|
1277
|
+
var attachments = util/* default */.c.get(this.props.ev, 'data.message.attachments', []);
|
|
1172
1278
|
var audios = [];
|
|
1173
|
-
util/* default
|
|
1279
|
+
util/* default */.c.each(attachments, (att, i) => {
|
|
1174
1280
|
if (!att) return;
|
|
1175
|
-
if (util/* default
|
|
1281
|
+
if (util/* default */.c.includes(att.mimetype, 'audio')) audios.push(att);
|
|
1176
1282
|
});
|
|
1177
1283
|
if (audios.length === 0) return null;
|
|
1178
|
-
var $audios = util/* default
|
|
1284
|
+
var $audios = util/* default */.c.map(audios, (audio, index) => {
|
|
1179
1285
|
return (0,preact_module.h)("div", {
|
|
1180
1286
|
key: index,
|
|
1181
1287
|
class: `audio-attachment audio-attachment--${byType}`
|
|
@@ -1196,20 +1302,20 @@ class AudioAttachments extends common/* Com */.up {
|
|
|
1196
1302
|
|
|
1197
1303
|
|
|
1198
1304
|
|
|
1199
|
-
class FileAttachments extends common/* Com */.
|
|
1305
|
+
class FileAttachments extends common/* Com */.Sq {
|
|
1200
1306
|
render() {
|
|
1201
|
-
var byType = util/* default
|
|
1202
|
-
var attachments = util/* default
|
|
1307
|
+
var byType = util/* default */.c.get(this.props.ev, 'by.type', 'agent');
|
|
1308
|
+
var attachments = util/* default */.c.get(this.props.ev, 'data.message.attachments', []);
|
|
1203
1309
|
var files = [];
|
|
1204
|
-
util/* default
|
|
1310
|
+
util/* default */.c.each(attachments, att => {
|
|
1205
1311
|
if (!att) return;
|
|
1206
1312
|
if (!att.url && !att._file) return;
|
|
1207
|
-
if (!util/* default
|
|
1313
|
+
if (!util/* default */.c.includes(att.mimetype, 'video') && !util/* default */.c.includes(att.mimetype, 'audio') && !util/* default */.c.includes(att.mimetype, 'image') && att.type !== 'button' && att.type !== 'quick_replies' && att.type !== 'form' && att.type !== 'form_submit') {
|
|
1208
1314
|
files.push(att);
|
|
1209
1315
|
}
|
|
1210
1316
|
});
|
|
1211
1317
|
if (files.length === 0) return null;
|
|
1212
|
-
var $files = util/* default
|
|
1318
|
+
var $files = util/* default */.c.map(files, (file, index) => {
|
|
1213
1319
|
return (0,preact_module.h)("div", {
|
|
1214
1320
|
key: index,
|
|
1215
1321
|
class: `file-attachment file-attachment--${byType}`
|
|
@@ -1232,13 +1338,13 @@ class FileAttachments extends common/* Com */.up {
|
|
|
1232
1338
|
|
|
1233
1339
|
|
|
1234
1340
|
|
|
1235
|
-
class Buttons extends common/* Com */.
|
|
1341
|
+
class Buttons extends common/* Com */.Sq {
|
|
1236
1342
|
constructor(props) {
|
|
1237
1343
|
super(props);
|
|
1238
1344
|
}
|
|
1239
1345
|
render() {
|
|
1240
|
-
if (util/* default
|
|
1241
|
-
var $buttons = util/* default
|
|
1346
|
+
if (util/* default */.c.size(this.props.buttons) === 0) return null;
|
|
1347
|
+
var $buttons = util/* default */.c.map(this.props.buttons, (button, index) => {
|
|
1242
1348
|
if (button.type === 'call_button') {
|
|
1243
1349
|
return (0,preact_module.h)("a", {
|
|
1244
1350
|
class: "url-button-attachment",
|
|
@@ -1277,18 +1383,18 @@ class Buttons extends common/* Com */.up {
|
|
|
1277
1383
|
|
|
1278
1384
|
|
|
1279
1385
|
|
|
1280
|
-
class ButtonAttachments extends common/* Com */.
|
|
1386
|
+
class ButtonAttachments extends common/* Com */.Sq {
|
|
1281
1387
|
constructor(props) {
|
|
1282
1388
|
super(props);
|
|
1283
1389
|
}
|
|
1284
1390
|
render() {
|
|
1285
|
-
let byType = util/* default
|
|
1391
|
+
let byType = util/* default */.c.get(this.props.ev, 'by.type');
|
|
1286
1392
|
if (byType === 'user') return null;
|
|
1287
1393
|
let buttons = [];
|
|
1288
|
-
let attachments = util/* default
|
|
1289
|
-
util/* default
|
|
1290
|
-
if (!att || util/* default
|
|
1291
|
-
util/* default
|
|
1394
|
+
let attachments = util/* default */.c.get(this.props.ev, 'data.message.attachments', []);
|
|
1395
|
+
util/* default */.c.each(attachments, (att, i) => {
|
|
1396
|
+
if (!att || util/* default */.c.get(att, 'type') !== 'button') return;
|
|
1397
|
+
util/* default */.c.each(util/* default */.c.get(att, 'buttons') || [], btn => buttons.push(btn));
|
|
1292
1398
|
});
|
|
1293
1399
|
return (0,preact_module.h)(Buttons, {
|
|
1294
1400
|
store: this.props.store,
|
|
@@ -1301,26 +1407,26 @@ class ButtonAttachments extends common/* Com */.up {
|
|
|
1301
1407
|
|
|
1302
1408
|
|
|
1303
1409
|
|
|
1304
|
-
class QuickReplies extends common/* Com */.
|
|
1410
|
+
class QuickReplies extends common/* Com */.Sq {
|
|
1305
1411
|
constructor(props) {
|
|
1306
1412
|
super(props);
|
|
1307
1413
|
}
|
|
1308
1414
|
render() {
|
|
1309
|
-
if (util/* default
|
|
1415
|
+
if (util/* default */.c.get(this.props.ev, 'by.type') === 'user') return null;
|
|
1310
1416
|
let quickreplies = [];
|
|
1311
|
-
util/* default
|
|
1417
|
+
util/* default */.c.map(util/* default */.c.get(this.props.ev, 'data.message.attachments', []), att => {
|
|
1312
1418
|
if (!att) return;
|
|
1313
1419
|
if (att.type === 'quick_replies') {
|
|
1314
|
-
quickreplies = util/* default
|
|
1420
|
+
quickreplies = util/* default */.c.get(att, 'quick_replies', []);
|
|
1315
1421
|
}
|
|
1316
1422
|
});
|
|
1317
|
-
quickreplies = util/* default
|
|
1423
|
+
quickreplies = util/* default */.c.filter(quickreplies, r => r.title);
|
|
1318
1424
|
if (quickreplies.length === 0) return null;
|
|
1319
|
-
let cid = util/* default
|
|
1425
|
+
let cid = util/* default */.c.convoOfEv(this.props.ev);
|
|
1320
1426
|
let convo = this.props.store.matchConvo(cid);
|
|
1321
|
-
if (util/* default
|
|
1322
|
-
let events = util/* default
|
|
1323
|
-
events = util/* default
|
|
1427
|
+
if (util/* default */.c.get(convo, 'state') === 'ended') return null;
|
|
1428
|
+
let events = util/* default */.c.map(this.props.store.listEvents(cid));
|
|
1429
|
+
events = util/* default */.c.orderBy(events, 'created', 'asc').filter(ev => ev.type === 'message_sent');
|
|
1324
1430
|
let evindex = 0;
|
|
1325
1431
|
for (var i = 0; i < events.length; i++) {
|
|
1326
1432
|
if (events[i].id === this.props.ev.id) {
|
|
@@ -1329,9 +1435,9 @@ class QuickReplies extends common/* Com */.up {
|
|
|
1329
1435
|
}
|
|
1330
1436
|
}
|
|
1331
1437
|
for (var i = evindex + 1; i < events.length; i++) {
|
|
1332
|
-
if (util/* default
|
|
1438
|
+
if (util/* default */.c.get(events[i], 'by.type') === 'user') return null;
|
|
1333
1439
|
}
|
|
1334
|
-
let $replies = util/* default
|
|
1440
|
+
let $replies = util/* default */.c.map(quickreplies, r => (0,preact_module.h)("div", {
|
|
1335
1441
|
class: "message_quick_reply",
|
|
1336
1442
|
onClick: e => this.props.onSelect(r)
|
|
1337
1443
|
}, r.title));
|
|
@@ -1344,7 +1450,7 @@ class QuickReplies extends common/* Com */.up {
|
|
|
1344
1450
|
|
|
1345
1451
|
|
|
1346
1452
|
|
|
1347
|
-
class ListField extends common/* Com */.
|
|
1453
|
+
class ListField extends common/* Com */.Sq {
|
|
1348
1454
|
constructor(props) {
|
|
1349
1455
|
super(props);
|
|
1350
1456
|
this.setState({
|
|
@@ -1353,18 +1459,18 @@ class ListField extends common/* Com */.up {
|
|
|
1353
1459
|
});
|
|
1354
1460
|
}
|
|
1355
1461
|
render() {
|
|
1356
|
-
let fields = util/* default
|
|
1462
|
+
let fields = util/* default */.c.filter(this.props.items, item => {
|
|
1357
1463
|
let search = this.state.search.toLowerCase();
|
|
1358
1464
|
let name = item || '';
|
|
1359
1465
|
return name.toLowerCase().indexOf(search) > -1;
|
|
1360
1466
|
});
|
|
1361
|
-
let $fields = util/* default
|
|
1467
|
+
let $fields = util/* default */.c.map(fields, field => {
|
|
1362
1468
|
return (0,preact_module.h)("li", {
|
|
1363
1469
|
class: "custom-select--item-options",
|
|
1364
1470
|
onClick: () => this.add(field)
|
|
1365
1471
|
}, field);
|
|
1366
1472
|
});
|
|
1367
|
-
let $selected = util/* default
|
|
1473
|
+
let $selected = util/* default */.c.map(this.props.selected, (item, i) => {
|
|
1368
1474
|
return (0,preact_module.h)("div", {
|
|
1369
1475
|
class: "custom-select--selected-item",
|
|
1370
1476
|
onClick: e => this.remove(e, i)
|
|
@@ -1397,7 +1503,7 @@ class ListField extends common/* Com */.up {
|
|
|
1397
1503
|
}
|
|
1398
1504
|
return (0,preact_module.h)("div", {
|
|
1399
1505
|
class: "form-control custom-select"
|
|
1400
|
-
}, (0,preact_module.h)(common/* Clickaway */.
|
|
1506
|
+
}, (0,preact_module.h)(common/* Clickaway */.C3, {
|
|
1401
1507
|
onClickaway: e => this.clickaway()
|
|
1402
1508
|
}, (0,preact_module.h)("div", {
|
|
1403
1509
|
class: "custom-select--wrap-selected",
|
|
@@ -1440,21 +1546,21 @@ class ListField extends common/* Com */.up {
|
|
|
1440
1546
|
|
|
1441
1547
|
|
|
1442
1548
|
|
|
1443
|
-
class FormAttachment extends common/* Com */.
|
|
1549
|
+
class FormAttachment extends common/* Com */.Sq {
|
|
1444
1550
|
constructor(props) {
|
|
1445
1551
|
super(props);
|
|
1446
1552
|
this.props.store.onUpdate(this, _ => this.forceUpdate());
|
|
1447
1553
|
let user = this.props.store.matchUser();
|
|
1448
|
-
let fields = util/* default
|
|
1449
|
-
let formData = util/* default
|
|
1554
|
+
let fields = util/* default */.c.get(this.props.form, 'fields') || [];
|
|
1555
|
+
let formData = util/* default */.c.map(fields, field => {
|
|
1450
1556
|
let is_required = field.is_required || false;
|
|
1451
|
-
var state = util/* default
|
|
1557
|
+
var state = util/* default */.c.parseJSON(field.state) || {};
|
|
1452
1558
|
if (!is_required) is_required = state.require || false;
|
|
1453
|
-
var userattr = util/* default
|
|
1559
|
+
var userattr = util/* default */.c.getUserAttr(user, field.name, state.type || 'text');
|
|
1454
1560
|
return {
|
|
1455
1561
|
name: field.name,
|
|
1456
1562
|
items: field.items,
|
|
1457
|
-
value: util/* default
|
|
1563
|
+
value: util/* default */.c.parseJSON(field.answer) || util/* default */.c.parseJSON(field.default_answer) || userattr,
|
|
1458
1564
|
is_required,
|
|
1459
1565
|
label: field.title,
|
|
1460
1566
|
type: field.input_type
|
|
@@ -1465,13 +1571,13 @@ class FormAttachment extends common/* Com */.up {
|
|
|
1465
1571
|
});
|
|
1466
1572
|
}
|
|
1467
1573
|
isSummited() {
|
|
1468
|
-
let found = util/* default
|
|
1574
|
+
let found = util/* default */.c.find(this.state.formData, field => !!field.answered);
|
|
1469
1575
|
if (found) return true;
|
|
1470
|
-
let convo = this.props.store.matchConvo(util/* default
|
|
1576
|
+
let convo = this.props.store.matchConvo(util/* default */.c.convoOfEv(this.props.ev));
|
|
1471
1577
|
return convo.state === 'ended';
|
|
1472
1578
|
}
|
|
1473
1579
|
render() {
|
|
1474
|
-
if (util/* default
|
|
1580
|
+
if (util/* default */.c.size(this.state.formData) === 0) return null;
|
|
1475
1581
|
let $fields = this.renderFields();
|
|
1476
1582
|
let $submitbutton = null;
|
|
1477
1583
|
if (!this.isSummited()) {
|
|
@@ -1490,11 +1596,11 @@ class FormAttachment extends common/* Com */.up {
|
|
|
1490
1596
|
}
|
|
1491
1597
|
focus() {
|
|
1492
1598
|
if (this.props.store.isPreview) return;
|
|
1493
|
-
if (util/* default
|
|
1599
|
+
if (util/* default */.c.size(this.state.formData) === 0) return;
|
|
1494
1600
|
let $field;
|
|
1495
1601
|
if (this.isFormFilled()) {
|
|
1496
1602
|
var keys = Object.keys(this.state.formData);
|
|
1497
|
-
var lastkey = keys[util/* default
|
|
1603
|
+
var lastkey = keys[util/* default */.c.size(keys) - 1];
|
|
1498
1604
|
var lastfield = this.state.formData[lastkey];
|
|
1499
1605
|
$field = this['field.' + encode(lastfield.name)];
|
|
1500
1606
|
} else {
|
|
@@ -1505,20 +1611,20 @@ class FormAttachment extends common/* Com */.up {
|
|
|
1505
1611
|
if ($field) $field.focus();
|
|
1506
1612
|
}
|
|
1507
1613
|
firstUnfilledField() {
|
|
1508
|
-
return util/* default
|
|
1614
|
+
return util/* default */.c.find(this.state.formData, field => field.value == null || field.value === '');
|
|
1509
1615
|
}
|
|
1510
1616
|
isFormFilled() {
|
|
1511
|
-
return !util/* default
|
|
1617
|
+
return !util/* default */.c.find(this.state.formData, field => field.value == null || field.value === '');
|
|
1512
1618
|
}
|
|
1513
1619
|
onInputChange(index, val) {
|
|
1514
|
-
let formData = util/* default
|
|
1620
|
+
let formData = util/* default */.c.cloneDeep(this.state.formData);
|
|
1515
1621
|
formData[index].value = val;
|
|
1516
1622
|
this.setState({
|
|
1517
1623
|
formData
|
|
1518
1624
|
});
|
|
1519
1625
|
}
|
|
1520
1626
|
onListAddItem(index, val) {
|
|
1521
|
-
let formData = util/* default
|
|
1627
|
+
let formData = util/* default */.c.cloneDeep(this.state.formData);
|
|
1522
1628
|
let field = formData[index];
|
|
1523
1629
|
field.value = field.value || [];
|
|
1524
1630
|
field.value.push(val);
|
|
@@ -1527,7 +1633,7 @@ class FormAttachment extends common/* Com */.up {
|
|
|
1527
1633
|
});
|
|
1528
1634
|
}
|
|
1529
1635
|
onListRemoveItem(index, vindex) {
|
|
1530
|
-
let formData = util/* default
|
|
1636
|
+
let formData = util/* default */.c.cloneDeep(this.state.formData);
|
|
1531
1637
|
let field = formData[index];
|
|
1532
1638
|
field.value = field.value || [];
|
|
1533
1639
|
field.value.splice(vindex, 1);
|
|
@@ -1536,9 +1642,9 @@ class FormAttachment extends common/* Com */.up {
|
|
|
1536
1642
|
});
|
|
1537
1643
|
}
|
|
1538
1644
|
renderFields() {
|
|
1539
|
-
if (util/* default
|
|
1645
|
+
if (util/* default */.c.size(this.state.formData) === 0) return null;
|
|
1540
1646
|
let $fields = null;
|
|
1541
|
-
$fields = util/* default
|
|
1647
|
+
$fields = util/* default */.c.map(this.state.formData, (field, index) => {
|
|
1542
1648
|
let $field = null;
|
|
1543
1649
|
var errclass = field.error ? 'input--error' : '';
|
|
1544
1650
|
if (field.type === 'text') {
|
|
@@ -1614,7 +1720,7 @@ class FormAttachment extends common/* Com */.up {
|
|
|
1614
1720
|
}, (0,preact_module.h)("div", null)));
|
|
1615
1721
|
} else if (field.type === 'list') {
|
|
1616
1722
|
let selected = field.value || [];
|
|
1617
|
-
let items = util/* default
|
|
1723
|
+
let items = util/* default */.c.filter(util/* default */.c.get(field, 'items', []), item => !selected.includes(item));
|
|
1618
1724
|
$field = (0,preact_module.h)(ListField, {
|
|
1619
1725
|
selected: selected,
|
|
1620
1726
|
items: items,
|
|
@@ -1652,15 +1758,15 @@ class FormAttachment extends common/* Com */.up {
|
|
|
1652
1758
|
}
|
|
1653
1759
|
async submit() {
|
|
1654
1760
|
var hasError = false;
|
|
1655
|
-
util/* default
|
|
1656
|
-
if (field.is_required && (field.value === undefined || field.value === '' || util/* default
|
|
1761
|
+
util/* default */.c.map(this.state.formData, field => {
|
|
1762
|
+
if (field.is_required && (field.value === undefined || field.value === '' || util/* default */.c.size(field.value) === 0 && Array.isArray(field.value))) {
|
|
1657
1763
|
field.error = this.props.t('error_empty');
|
|
1658
1764
|
hasError = true;
|
|
1659
1765
|
} else {
|
|
1660
1766
|
field.error = '';
|
|
1661
1767
|
}
|
|
1662
1768
|
if (field.name === 'emails' && field.value) {
|
|
1663
|
-
if (!util/* default
|
|
1769
|
+
if (!util/* default */.c.isEmail(field.value)) {
|
|
1664
1770
|
field.error = this.props.t('error_email_invalid');
|
|
1665
1771
|
hasError = true;
|
|
1666
1772
|
}
|
|
@@ -1669,32 +1775,32 @@ class FormAttachment extends common/* Com */.up {
|
|
|
1669
1775
|
this.forceUpdate();
|
|
1670
1776
|
if (hasError) return;
|
|
1671
1777
|
let user = {};
|
|
1672
|
-
let formData = util/* default
|
|
1673
|
-
util/* default
|
|
1778
|
+
let formData = util/* default */.c.cloneDeep(this.state.formData);
|
|
1779
|
+
util/* default */.c.map(formData, field => {
|
|
1674
1780
|
var attr = {
|
|
1675
1781
|
key: field.name
|
|
1676
1782
|
};
|
|
1677
|
-
field.answered = new util/* default
|
|
1783
|
+
field.answered = new util/* default */.c.Date().getTime();
|
|
1678
1784
|
if (field.type === 'number') {
|
|
1679
1785
|
attr.number = parseInt(field.value);
|
|
1680
|
-
field.answer = util/* default
|
|
1786
|
+
field.answer = util/* default */.c.stringify(attr.number);
|
|
1681
1787
|
}
|
|
1682
1788
|
if (field.type === 'datetime') {
|
|
1683
|
-
attr.datetime = new util/* default
|
|
1684
|
-
field.answer = util/* default
|
|
1789
|
+
attr.datetime = new util/* default */.c.Date(field.value).toISOString();
|
|
1790
|
+
field.answer = util/* default */.c.stringify(attr.datetime);
|
|
1685
1791
|
}
|
|
1686
1792
|
if (field.type === 'list') {
|
|
1687
1793
|
attr.list = field.value;
|
|
1688
|
-
field.answer = util/* default
|
|
1794
|
+
field.answer = util/* default */.c.stringify(attr.list);
|
|
1689
1795
|
}
|
|
1690
1796
|
if (field.type === 'text' || field.type === 'boolean') {
|
|
1691
1797
|
attr[field.type] = field.value;
|
|
1692
|
-
field.answer = util/* default
|
|
1798
|
+
field.answer = util/* default */.c.stringify(field.value);
|
|
1693
1799
|
}
|
|
1694
|
-
util/* default
|
|
1800
|
+
util/* default */.c.setUserAttr(user, attr);
|
|
1695
1801
|
});
|
|
1696
|
-
util/* default
|
|
1697
|
-
let ffield = util/* default
|
|
1802
|
+
util/* default */.c.map(formData, field => {
|
|
1803
|
+
let ffield = util/* default */.c.find(this.props.form.fields, ffield => ffield.name === field.name);
|
|
1698
1804
|
if (!ffield) return;
|
|
1699
1805
|
ffield.answered = field.answered;
|
|
1700
1806
|
});
|
|
@@ -1707,12 +1813,12 @@ class FormAttachment extends common/* Com */.up {
|
|
|
1707
1813
|
type: 'form_submit',
|
|
1708
1814
|
form_submit: {
|
|
1709
1815
|
state: '{"user_id":"' + this.props.store.matchUser().id + '"}',
|
|
1710
|
-
form_message_id: util/* default
|
|
1816
|
+
form_message_id: util/* default */.c.get(this.props.ev, 'id'),
|
|
1711
1817
|
fields: formData
|
|
1712
1818
|
}
|
|
1713
1819
|
}]
|
|
1714
1820
|
};
|
|
1715
|
-
let cid = util/* default
|
|
1821
|
+
let cid = util/* default */.c.convoOfEv(this.props.ev);
|
|
1716
1822
|
this.props.store.sendConvoEvent(cid, 'message_sent', {
|
|
1717
1823
|
message
|
|
1718
1824
|
});
|
|
@@ -1727,22 +1833,22 @@ function encode(key) {
|
|
|
1727
1833
|
|
|
1728
1834
|
|
|
1729
1835
|
|
|
1730
|
-
class FormAttachments extends common/* Com */.
|
|
1836
|
+
class FormAttachments extends common/* Com */.Sq {
|
|
1731
1837
|
constructor(props) {
|
|
1732
1838
|
super(props);
|
|
1733
1839
|
}
|
|
1734
1840
|
render() {
|
|
1735
|
-
let byType = util/* default
|
|
1841
|
+
let byType = util/* default */.c.get(this.props.ev, 'by.type');
|
|
1736
1842
|
if (byType === 'user') return;
|
|
1737
1843
|
let forms = [];
|
|
1738
|
-
let attachments = util/* default
|
|
1739
|
-
util/* default
|
|
1844
|
+
let attachments = util/* default */.c.get(this.props.ev, 'data.message.attachments') || [];
|
|
1845
|
+
util/* default */.c.each(attachments, att => {
|
|
1740
1846
|
if (!att) return;
|
|
1741
1847
|
if (att.type !== 'form' && att.type !== 'ask_info_form') return;
|
|
1742
1848
|
att.form._type = att.type;
|
|
1743
1849
|
forms.push(att.form);
|
|
1744
1850
|
});
|
|
1745
|
-
let $forms = util/* default
|
|
1851
|
+
let $forms = util/* default */.c.map(forms, (form, formIndex) => {
|
|
1746
1852
|
return (0,preact_module.h)(FormAttachment, {
|
|
1747
1853
|
store: this.props.store,
|
|
1748
1854
|
onSubmit: this.props.onSubmit,
|
|
@@ -1769,21 +1875,21 @@ class FormAttachments extends common/* Com */.up {
|
|
|
1769
1875
|
|
|
1770
1876
|
|
|
1771
1877
|
|
|
1772
|
-
class FormSubmitAttachments extends common/* Com */.
|
|
1878
|
+
class FormSubmitAttachments extends common/* Com */.Sq {
|
|
1773
1879
|
constructor(props) {
|
|
1774
1880
|
super(props);
|
|
1775
1881
|
}
|
|
1776
1882
|
render() {
|
|
1777
1883
|
return null;
|
|
1778
1884
|
let submits = [];
|
|
1779
|
-
let attachments = util/* default
|
|
1780
|
-
util/* default
|
|
1885
|
+
let attachments = util/* default */.c.get(this.props.ev, 'data.message.attachments') || [];
|
|
1886
|
+
util/* default */.c.each(attachments, att => {
|
|
1781
1887
|
if (!att) return;
|
|
1782
1888
|
if (att.type !== 'form_submit') return;
|
|
1783
1889
|
if (!att.form_submit) return;
|
|
1784
1890
|
submits.push(att.form_submit);
|
|
1785
1891
|
});
|
|
1786
|
-
let $submits = util/* default
|
|
1892
|
+
let $submits = util/* default */.c.map(submits, (submit, index) => (0,preact_module.h)("div", {
|
|
1787
1893
|
class: "info-message"
|
|
1788
1894
|
}, (0,preact_module.h)("span", null, this.props.tt('prechat_form_thanks'))));
|
|
1789
1895
|
return (0,preact_module.h)("div", null, $submits);
|
|
@@ -1834,13 +1940,13 @@ function getFirstTouch(ev) {
|
|
|
1834
1940
|
|
|
1835
1941
|
|
|
1836
1942
|
|
|
1837
|
-
class GenericTemplateAttachments extends common/* Com */.
|
|
1943
|
+
class GenericTemplateAttachments extends common/* Com */.Sq {
|
|
1838
1944
|
constructor(props) {
|
|
1839
1945
|
super(props);
|
|
1840
1946
|
this.state = {
|
|
1841
1947
|
focusing: 0
|
|
1842
1948
|
};
|
|
1843
|
-
this.galleryRef = (0,preact_module/* createRef */.
|
|
1949
|
+
this.galleryRef = (0,preact_module/* createRef */.Yn)();
|
|
1844
1950
|
}
|
|
1845
1951
|
componentDidMount() {
|
|
1846
1952
|
this.bindDrag();
|
|
@@ -1855,13 +1961,13 @@ class GenericTemplateAttachments extends common/* Com */.up {
|
|
|
1855
1961
|
});
|
|
1856
1962
|
}
|
|
1857
1963
|
render() {
|
|
1858
|
-
let byType = util/* default
|
|
1964
|
+
let byType = util/* default */.c.get(this.props.ev, 'by.type');
|
|
1859
1965
|
if (byType === 'user') return null;
|
|
1860
|
-
let attachments = util/* default
|
|
1861
|
-
let generics = util/* default
|
|
1966
|
+
let attachments = util/* default */.c.get(this.props.ev, 'data.message.attachments', []);
|
|
1967
|
+
let generics = util/* default */.c.filter(attachments, att => util/* default */.c.get(att, 'type') === 'generic');
|
|
1862
1968
|
if (generics.length === 0) return null;
|
|
1863
|
-
var $generics = util/* default
|
|
1864
|
-
var $eles = util/* default
|
|
1969
|
+
var $generics = util/* default */.c.map(generics, (gen, index) => {
|
|
1970
|
+
var $eles = util/* default */.c.map(gen.elements, ele => {
|
|
1865
1971
|
let title = this.props.t.i18n(ele.i18n_title) || ele.title;
|
|
1866
1972
|
let subtitle = this.props.t.i18n(ele.i18n_subtitle) || ele.subtitle;
|
|
1867
1973
|
let $title = title ? (0,preact_module.h)("div", {
|
|
@@ -1872,7 +1978,7 @@ class GenericTemplateAttachments extends common/* Com */.up {
|
|
|
1872
1978
|
}, subtitle) : null;
|
|
1873
1979
|
let imgsrc = this.props.store.replaceFileUrl(ele.image_url);
|
|
1874
1980
|
if (!ele.image_url) {
|
|
1875
|
-
imgsrc = __webpack_require__(
|
|
1981
|
+
imgsrc = __webpack_require__(4824);
|
|
1876
1982
|
}
|
|
1877
1983
|
return (0,preact_module.h)("div", {
|
|
1878
1984
|
class: "generic-attachment--element swiper-slide"
|
|
@@ -1888,7 +1994,7 @@ class GenericTemplateAttachments extends common/* Com */.up {
|
|
|
1888
1994
|
t: this.props.t
|
|
1889
1995
|
}));
|
|
1890
1996
|
});
|
|
1891
|
-
let elements = util/* default
|
|
1997
|
+
let elements = util/* default */.c.get(attachments, '0.elements', []);
|
|
1892
1998
|
let leftNavigatorCls = 'generic-attachment-navigator generic-attachment-navigator--left';
|
|
1893
1999
|
let rightNavigatorCls = 'generic-attachment-navigator generic-attachment-navigator--right';
|
|
1894
2000
|
if (this.state.focusing === 0) leftNavigatorCls += ' generic-attachment-navigator--disabled';
|
|
@@ -1898,7 +2004,7 @@ class GenericTemplateAttachments extends common/* Com */.up {
|
|
|
1898
2004
|
}, (0,preact_module.h)("div", {
|
|
1899
2005
|
class: "generic-attachment",
|
|
1900
2006
|
ref: this.galleryRef
|
|
1901
|
-
}, $eles), !this.props.store.isMobile() && (0,preact_module.h)(preact_module/* Fragment */.
|
|
2007
|
+
}, $eles), !this.props.store.isMobile() && (0,preact_module.h)(preact_module/* Fragment */.ae, null, (0,preact_module.h)("div", {
|
|
1902
2008
|
class: leftNavigatorCls,
|
|
1903
2009
|
onClick: _ => this.focus(this.state.focusing - 1)
|
|
1904
2010
|
}, (0,preact_module.h)("span", {
|
|
@@ -1915,38 +2021,38 @@ class GenericTemplateAttachments extends common/* Com */.up {
|
|
|
1915
2021
|
bindDrag() {
|
|
1916
2022
|
if (!this.props.store.isMobile()) return;
|
|
1917
2023
|
let eles = document.getElementsByClassName('generic-attachment');
|
|
1918
|
-
util/* default
|
|
2024
|
+
util/* default */.c.map(eles, ele => bind(ele, () => {}));
|
|
1919
2025
|
}
|
|
1920
2026
|
}
|
|
1921
2027
|
;// CONCATENATED MODULE: ./src/chatbox/ProductAttachments.js
|
|
1922
2028
|
|
|
1923
2029
|
|
|
1924
2030
|
|
|
1925
|
-
class ProductAttachments extends common/* Com */.
|
|
2031
|
+
class ProductAttachments extends common/* Com */.Sq {
|
|
1926
2032
|
render() {
|
|
1927
|
-
let byType = util/* default
|
|
2033
|
+
let byType = util/* default */.c.get(this.props.ev, 'by.type');
|
|
1928
2034
|
if (byType === 'user') return null;
|
|
1929
|
-
let attachments = util/* default
|
|
1930
|
-
let products = util/* default
|
|
2035
|
+
let attachments = util/* default */.c.get(this.props.ev, 'data.message.attachments', []);
|
|
2036
|
+
let products = util/* default */.c.filter(attachments, att => util/* default */.c.get(att, 'type') === 'product' || util/* default */.c.get(att, 'type') === 'product_preview');
|
|
1931
2037
|
products = products.filter(product => product.product && product.product.name);
|
|
1932
2038
|
if (products.length === 0) return null;
|
|
1933
2039
|
let acc = this.props.store.matchAccount();
|
|
1934
|
-
let $products = util/* default
|
|
2040
|
+
let $products = util/* default */.c.map(products, (att, index) => {
|
|
1935
2041
|
let product = att.product;
|
|
1936
2042
|
let $detailbtns = [];
|
|
1937
2043
|
let url = product.url || product.mobile_url;
|
|
1938
2044
|
if (this.props.store.isMobile()) url = product.mobile_url || product.url;
|
|
1939
|
-
if (url && util/* default
|
|
2045
|
+
if (url && util/* default */.c.size(product.buttons) == 0) $detailbtns.push((0,preact_module.h)("a", {
|
|
1940
2046
|
class: "product_attachment__btn",
|
|
1941
2047
|
href: url,
|
|
1942
2048
|
target: "_blank"
|
|
1943
2049
|
}, this.props.t('detail'), (0,preact_module.h)("img", {
|
|
1944
|
-
src: __webpack_require__(
|
|
2050
|
+
src: __webpack_require__(928),
|
|
1945
2051
|
class: "product_attachment__btn_external_link"
|
|
1946
2052
|
})));
|
|
1947
2053
|
console.log('P', product);
|
|
1948
|
-
if (util/* default
|
|
1949
|
-
$detailbtns = $detailbtns.concat(util/* default
|
|
2054
|
+
if (util/* default */.c.size(product.buttons) > 0) {
|
|
2055
|
+
$detailbtns = $detailbtns.concat(util/* default */.c.map(product.buttons, (button, index) => {
|
|
1950
2056
|
if (button.type === 'call_button') {
|
|
1951
2057
|
return (0,preact_module.h)("a", {
|
|
1952
2058
|
class: "product_attachment__btn",
|
|
@@ -1963,7 +2069,7 @@ class ProductAttachments extends common/* Com */.up {
|
|
|
1963
2069
|
key: index,
|
|
1964
2070
|
title: button.title
|
|
1965
2071
|
}, this.props.t.i18n(button.i18n_title) || button.title || this.props.t('detail'), ' ', (0,preact_module.h)("img", {
|
|
1966
|
-
src: __webpack_require__(
|
|
2072
|
+
src: __webpack_require__(928),
|
|
1967
2073
|
class: "product_attachment__btn_external_link"
|
|
1968
2074
|
}));
|
|
1969
2075
|
}
|
|
@@ -1986,16 +2092,16 @@ class ProductAttachments extends common/* Com */.up {
|
|
|
1986
2092
|
if (desc) $subtitle = (0,preact_module.h)("div", {
|
|
1987
2093
|
class: "product_attachment__subtitle"
|
|
1988
2094
|
}, desc);
|
|
1989
|
-
let currency = product.currency || util/* default
|
|
2095
|
+
let currency = product.currency || util/* default */.c.get(acc, 'currency', 'VND');
|
|
1990
2096
|
let $price = null;
|
|
1991
2097
|
if (product.price) {
|
|
1992
2098
|
$price = (0,preact_module.h)("div", {
|
|
1993
2099
|
class: "product_attachment__price"
|
|
1994
|
-
}, util/* default
|
|
2100
|
+
}, util/* default */.c.formatCurrency(product.price, currency));
|
|
1995
2101
|
}
|
|
1996
2102
|
let imgsrc = this.props.store.replaceFileUrl(product.image);
|
|
1997
2103
|
if (!product.image) {
|
|
1998
|
-
imgsrc = __webpack_require__(
|
|
2104
|
+
imgsrc = __webpack_require__(4824);
|
|
1999
2105
|
}
|
|
2000
2106
|
return (0,preact_module.h)("div", {
|
|
2001
2107
|
class: 'product_attachment product_attachment__' + byType
|
|
@@ -2016,16 +2122,16 @@ class ProductAttachments extends common/* Com */.up {
|
|
|
2016
2122
|
|
|
2017
2123
|
|
|
2018
2124
|
|
|
2019
|
-
class OrderAttachments_ProductAttachments extends common/* Com */.
|
|
2125
|
+
class OrderAttachments_ProductAttachments extends common/* Com */.Sq {
|
|
2020
2126
|
render() {
|
|
2021
|
-
let byType = util/* default
|
|
2127
|
+
let byType = util/* default */.c.get(this.props.ev, 'by.type');
|
|
2022
2128
|
if (byType === 'user') return null;
|
|
2023
2129
|
let acc = this.props.store.matchAccount();
|
|
2024
|
-
var attachments = util/* default
|
|
2025
|
-
let orders = util/* default
|
|
2130
|
+
var attachments = util/* default */.c.get(this.props.ev, 'data.message.attachments', []);
|
|
2131
|
+
let orders = util/* default */.c.filter(attachments, att => att.type === 'order' && att.order).map(att => att.order);
|
|
2026
2132
|
if (orders.length === 0) return null;
|
|
2027
|
-
let $orders = util/* default
|
|
2028
|
-
util/* default
|
|
2133
|
+
let $orders = util/* default */.c.map(orders, (order, index) => {
|
|
2134
|
+
util/* default */.c.calcOrderTotal(order);
|
|
2029
2135
|
let $note = null;
|
|
2030
2136
|
if (order.note) {
|
|
2031
2137
|
$note = (0,preact_module.h)("div", null, (0,preact_module.h)("div", {
|
|
@@ -2036,17 +2142,17 @@ class OrderAttachments_ProductAttachments extends common/* Com */.up {
|
|
|
2036
2142
|
}, order.note));
|
|
2037
2143
|
}
|
|
2038
2144
|
let $products = null;
|
|
2039
|
-
if (util/* default
|
|
2145
|
+
if (util/* default */.c.size(order.items) > 0) {
|
|
2040
2146
|
$products = (0,preact_module.h)("div", null, (0,preact_module.h)("div", {
|
|
2041
2147
|
class: "order_attachment__label"
|
|
2042
|
-
}, this.props.t('product')), util/* default
|
|
2148
|
+
}, this.props.t('product')), util/* default */.c.map(order.items, item => {
|
|
2043
2149
|
let product = item.product || {};
|
|
2044
2150
|
return (0,preact_module.h)("div", {
|
|
2045
2151
|
class: "order_attachment__product"
|
|
2046
2152
|
}, (0,preact_module.h)("img", {
|
|
2047
2153
|
class: "order_attachment__product_img",
|
|
2048
|
-
alt: '' + util/* default
|
|
2049
|
-
src: util/* default
|
|
2154
|
+
alt: '' + util/* default */.c.get(product, 'id'),
|
|
2155
|
+
src: util/* default */.c.get(product, 'image', __webpack_require__(4824))
|
|
2050
2156
|
}), (0,preact_module.h)("div", {
|
|
2051
2157
|
style: "overflow: hidden !important;"
|
|
2052
2158
|
}, (0,preact_module.h)("div", {
|
|
@@ -2054,9 +2160,9 @@ class OrderAttachments_ProductAttachments extends common/* Com */.up {
|
|
|
2054
2160
|
title: this.props.t.i18n(product.i18n_name) || product.name
|
|
2055
2161
|
}, this.props.t.i18n(product.i18n_name) || product.name), (0,preact_module.h)("div", {
|
|
2056
2162
|
class: "order_attachment__product_desc"
|
|
2057
|
-
}, util/* default
|
|
2163
|
+
}, util/* default */.c.getProductPropName(product, ' / ')), (0,preact_module.h)("div", {
|
|
2058
2164
|
class: "order_attachment__product_desc"
|
|
2059
|
-
}, this.props.t('qty'), " ", item.quantity, "\xA0\xB7\xA0", util/* default
|
|
2165
|
+
}, this.props.t('qty'), " ", item.quantity, "\xA0\xB7\xA0", util/* default */.c.formatCurrency(product.price))));
|
|
2060
2166
|
}));
|
|
2061
2167
|
}
|
|
2062
2168
|
let $total = (0,preact_module.h)("div", {
|
|
@@ -2065,19 +2171,19 @@ class OrderAttachments_ProductAttachments extends common/* Com */.up {
|
|
|
2065
2171
|
class: "d-flex align-items-center justify-content-between"
|
|
2066
2172
|
}, (0,preact_module.h)("div", null, this.props.t('total')), ' ', (0,preact_module.h)("div", null, (0,preact_module.h)("b", {
|
|
2067
2173
|
class: "order_attachment__total"
|
|
2068
|
-
}, util/* default
|
|
2069
|
-
let phoneattr = util/* default
|
|
2174
|
+
}, util/* default */.c.formatCurrency(order.total)))));
|
|
2175
|
+
let phoneattr = util/* default */.c.find(util/* default */.c.get(order, 'user.attributes', []), attr => attr.key === 'phones') || {
|
|
2070
2176
|
key: 'phones',
|
|
2071
2177
|
text: ''
|
|
2072
2178
|
};
|
|
2073
|
-
let phone = util/* default
|
|
2074
|
-
phone = phone || util/* default
|
|
2179
|
+
let phone = util/* default */.c.get(order, 'shipping.address.phone', '').trim();
|
|
2180
|
+
phone = phone || util/* default */.c.trim(phoneattr.text);
|
|
2075
2181
|
if (phone) phone = this.props.t('phn') + ': ' + phone;
|
|
2076
2182
|
let $shipto = null;
|
|
2077
|
-
if (util/* default
|
|
2183
|
+
if (util/* default */.c.displayOrderShippingAddress(order) || phone) {
|
|
2078
2184
|
$shipto = (0,preact_module.h)("div", null, (0,preact_module.h)("div", {
|
|
2079
2185
|
class: "order_attachment__label"
|
|
2080
|
-
}, this.props.t('ship_to')), (0,preact_module.h)("div", null, util/* default
|
|
2186
|
+
}, this.props.t('ship_to')), (0,preact_module.h)("div", null, util/* default */.c.displayOrderShippingAddress(order)), (0,preact_module.h)("div", {
|
|
2081
2187
|
class: "order_attachment__text_truncate"
|
|
2082
2188
|
}, phone));
|
|
2083
2189
|
}
|
|
@@ -2089,11 +2195,11 @@ class OrderAttachments_ProductAttachments extends common/* Com */.up {
|
|
|
2089
2195
|
class: "d-flex align-items-center justify-content-between"
|
|
2090
2196
|
}, (0,preact_module.h)("div", {
|
|
2091
2197
|
class: "order_attachment__label no_margin"
|
|
2092
|
-
}, this.props.t('subtotal_before_tax')), ' ', (0,preact_module.h)("div", null, util/* default
|
|
2198
|
+
}, this.props.t('subtotal_before_tax')), ' ', (0,preact_module.h)("div", null, util/* default */.c.formatCurrency(order._order_value))), (0,preact_module.h)("div", {
|
|
2093
2199
|
class: "d-flex align-items-center justify-content-between"
|
|
2094
2200
|
}, (0,preact_module.h)("div", {
|
|
2095
2201
|
class: "order_attachment__label no_margin"
|
|
2096
|
-
}, this.props.t('discount_before_tax')), ' ', (0,preact_module.h)("div", null, "-", util/* default
|
|
2202
|
+
}, this.props.t('discount_before_tax')), ' ', (0,preact_module.h)("div", null, "-", util/* default */.c.formatCurrency(order._discount_before_tax))));
|
|
2097
2203
|
}
|
|
2098
2204
|
let $subtotal = (0,preact_module.h)("div", {
|
|
2099
2205
|
class: "d-flex align-items-center justify-content-between"
|
|
@@ -2101,12 +2207,12 @@ class OrderAttachments_ProductAttachments extends common/* Com */.up {
|
|
|
2101
2207
|
class: "order_attachment__label no_margin"
|
|
2102
2208
|
}, this.props.t('subtotal')), ' ', (0,preact_module.h)("div", {
|
|
2103
2209
|
style: ""
|
|
2104
|
-
}, util/* default
|
|
2210
|
+
}, util/* default */.c.formatCurrency(order.subtotal)));
|
|
2105
2211
|
let $tax = null;
|
|
2106
2212
|
if (order.total_tax) {
|
|
2107
2213
|
let taxname = '';
|
|
2108
|
-
if (util/* default
|
|
2109
|
-
let tax = util/* default
|
|
2214
|
+
if (util/* default */.c.size(order._taxM) === 1) {
|
|
2215
|
+
let tax = util/* default */.c.get(order._taxM, '0.tax', {});
|
|
2110
2216
|
if (tax.name && tax.percentage) taxname = `(${tax.name} ${Math.round(tax.percentage || 0) / 100}%)`;
|
|
2111
2217
|
}
|
|
2112
2218
|
$tax = (0,preact_module.h)("div", {
|
|
@@ -2115,7 +2221,7 @@ class OrderAttachments_ProductAttachments extends common/* Com */.up {
|
|
|
2115
2221
|
class: "order_attachment__label no_margin"
|
|
2116
2222
|
}, this.props.t('tax'), " ", taxname), (0,preact_module.h)("div", {
|
|
2117
2223
|
style: ""
|
|
2118
|
-
}, util/* default
|
|
2224
|
+
}, util/* default */.c.formatCurrency(order.total_tax)));
|
|
2119
2225
|
}
|
|
2120
2226
|
let $discount = null;
|
|
2121
2227
|
if (order.discount_type === 'percentage' && order.discount_percentage) {
|
|
@@ -2125,7 +2231,7 @@ class OrderAttachments_ProductAttachments extends common/* Com */.up {
|
|
|
2125
2231
|
class: "order_attachment__label no_margin"
|
|
2126
2232
|
}, this.props.t('discount_after_tax'), " (", Math.round(order.discount_percentage / 100), "%)"), ' ', (0,preact_module.h)("div", {
|
|
2127
2233
|
style: ""
|
|
2128
|
-
}, "-", util/* default
|
|
2234
|
+
}, "-", util/* default */.c.formatCurrency(order._computed_discount)));
|
|
2129
2235
|
}
|
|
2130
2236
|
if (order.discount_type === 'amount' && order.discount_amount) {
|
|
2131
2237
|
$discount = (0,preact_module.h)("div", {
|
|
@@ -2134,17 +2240,17 @@ class OrderAttachments_ProductAttachments extends common/* Com */.up {
|
|
|
2134
2240
|
class: "order_attachment__label no_margin"
|
|
2135
2241
|
}, this.props.t('discount_after_tax')), ' ', (0,preact_module.h)("div", {
|
|
2136
2242
|
class: "no-shrink"
|
|
2137
|
-
}, "-", util/* default
|
|
2243
|
+
}, "-", util/* default */.c.formatCurrency(order._computed_discount)));
|
|
2138
2244
|
}
|
|
2139
2245
|
let $shipping = null;
|
|
2140
|
-
if (util/* default
|
|
2246
|
+
if (util/* default */.c.get(order, 'shipping.nominal_fee')) {
|
|
2141
2247
|
$shipping = (0,preact_module.h)("div", {
|
|
2142
2248
|
class: "d-flex align-items-center justify-content-between"
|
|
2143
2249
|
}, (0,preact_module.h)("div", {
|
|
2144
2250
|
class: "order_attachment__label no_margin"
|
|
2145
2251
|
}, this.props.t('shipping_fee')), ' ', (0,preact_module.h)("div", {
|
|
2146
2252
|
style: ""
|
|
2147
|
-
}, util/* default
|
|
2253
|
+
}, util/* default */.c.formatCurrency(util/* default */.c.get(order, 'shipping.nominal_fee', 0))));
|
|
2148
2254
|
}
|
|
2149
2255
|
let $adjustment = null;
|
|
2150
2256
|
if (order.adjustment) {
|
|
@@ -2154,7 +2260,7 @@ class OrderAttachments_ProductAttachments extends common/* Com */.up {
|
|
|
2154
2260
|
class: "order_attachment__label no_margin"
|
|
2155
2261
|
}, order.adjustment_description), ' ', (0,preact_module.h)("div", {
|
|
2156
2262
|
class: "no-shrink"
|
|
2157
|
-
}, util/* default
|
|
2263
|
+
}, util/* default */.c.formatCurrency(order.adjustment)));
|
|
2158
2264
|
}
|
|
2159
2265
|
$subtotal = (0,preact_module.h)("div", {
|
|
2160
2266
|
class: "order_attachment__footer"
|
|
@@ -2168,7 +2274,7 @@ class OrderAttachments_ProductAttachments extends common/* Com */.up {
|
|
|
2168
2274
|
class: "order_attachment__header"
|
|
2169
2275
|
}, this.props.t('order'), (0,preact_module.h)("span", {
|
|
2170
2276
|
class: "order_attachment__text_muted order_attachment__text_sm"
|
|
2171
|
-
}, util/* default
|
|
2277
|
+
}, util/* default */.c.getOrderDisplayName(order))), $products, $shipto, $note, $beforeTax, $subtotal, $total);
|
|
2172
2278
|
});
|
|
2173
2279
|
return $orders;
|
|
2174
2280
|
}
|
|
@@ -2177,20 +2283,20 @@ class OrderAttachments_ProductAttachments extends common/* Com */.up {
|
|
|
2177
2283
|
|
|
2178
2284
|
|
|
2179
2285
|
|
|
2180
|
-
class VideoAttachments extends common/* Com */.
|
|
2286
|
+
class VideoAttachments extends common/* Com */.Sq {
|
|
2181
2287
|
constructor(props) {
|
|
2182
2288
|
super(props);
|
|
2183
2289
|
}
|
|
2184
2290
|
render() {
|
|
2185
|
-
let byType = util/* default
|
|
2186
|
-
var attachments = util/* default
|
|
2291
|
+
let byType = util/* default */.c.get(this.props.ev, 'by.type');
|
|
2292
|
+
var attachments = util/* default */.c.get(this.props.ev, 'data.message.attachments', []);
|
|
2187
2293
|
var videos = [];
|
|
2188
|
-
util/* default
|
|
2294
|
+
util/* default */.c.each(attachments, (att, i) => {
|
|
2189
2295
|
if (!att) return;
|
|
2190
|
-
if (util/* default
|
|
2296
|
+
if (util/* default */.c.includes(att.mimetype, 'video')) videos.push(att);
|
|
2191
2297
|
});
|
|
2192
2298
|
if (videos.length === 0) return null;
|
|
2193
|
-
var $videos = util/* default
|
|
2299
|
+
var $videos = util/* default */.c.map(videos, (video, index) => {
|
|
2194
2300
|
return (0,preact_module.h)("div", {
|
|
2195
2301
|
class: `video-attachment video-attachment--${byType}`
|
|
2196
2302
|
}, (0,preact_module.h)("video", {
|
|
@@ -2200,8 +2306,7 @@ class VideoAttachments extends common/* Com */.up {
|
|
|
2200
2306
|
height: "",
|
|
2201
2307
|
poster: this.props.store.replaceFileUrl(video.thumbnail_url),
|
|
2202
2308
|
controls: "controls",
|
|
2203
|
-
preload: "metadata"
|
|
2204
|
-
onclick: "this.play()"
|
|
2309
|
+
preload: "metadata"
|
|
2205
2310
|
}));
|
|
2206
2311
|
});
|
|
2207
2312
|
return (0,preact_module.h)("div", {
|
|
@@ -2209,73 +2314,23 @@ class VideoAttachments extends common/* Com */.up {
|
|
|
2209
2314
|
}, $videos);
|
|
2210
2315
|
}
|
|
2211
2316
|
}
|
|
2212
|
-
;// CONCATENATED MODULE: ./src/chatbox/ShadowDomRoot.js
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
class ShadowDomRoot extends common/* Com */.up {
|
|
2216
|
-
constructor(props) {
|
|
2217
|
-
super(props);
|
|
2218
|
-
this.ref = (0,preact_module/* createRef */.Vf)();
|
|
2219
|
-
}
|
|
2220
|
-
componentDidMount() {
|
|
2221
|
-
this.shadowRoot = this.ref.current.attachShadow({
|
|
2222
|
-
mode: 'open'
|
|
2223
|
-
});
|
|
2224
|
-
this.update(this.props.html);
|
|
2225
|
-
}
|
|
2226
|
-
update(html) {
|
|
2227
|
-
this.shadowRoot.innerHTML = `<style type="text/css">
|
|
2228
|
-
body { font-family: 'Inter', sans-serif!important; font-size: 14px!important; line-height: 20px; overflow-y: hidden; margin:0 }
|
|
2229
|
-
h{ font-size: 14/18px!important; }
|
|
2230
|
-
a { text-decoration: none;}
|
|
2231
|
-
img { max-width: 100%; display: block; margin: 10px auto; }
|
|
2232
|
-
* { white-space: normal }
|
|
2233
|
-
ul > li { margin-bottom: 5px }
|
|
2234
|
-
ul:last-child { margin-bottom: 0 }
|
|
2235
|
-
p { margin-bottom: 0; margin-top: 0;}
|
|
2236
|
-
</style>
|
|
2237
|
-
<div>${html}</div>`;
|
|
2238
|
-
let links = this.shadowRoot.querySelectorAll('a');
|
|
2239
|
-
for (var i = 0; i < links.length; i++) links[i].target = '_blank';
|
|
2240
|
-
}
|
|
2241
|
-
render() {
|
|
2242
|
-
return (0,preact_module.h)("div", {
|
|
2243
|
-
ref: this.ref,
|
|
2244
|
-
style: "white-space: normal !important"
|
|
2245
|
-
});
|
|
2246
|
-
}
|
|
2247
|
-
}
|
|
2248
2317
|
;// CONCATENATED MODULE: ./src/chatbox/TextMessage.js
|
|
2249
2318
|
|
|
2250
|
-
let mustrerender = [];
|
|
2251
|
-
let marked = (obj, text) => {
|
|
2252
|
-
mustrerender.push(obj);
|
|
2253
|
-
return '';
|
|
2254
|
-
};
|
|
2255
|
-
const loadMarked = () => __webpack_require__.e(/* import() */ 441).then(__webpack_require__.bind(__webpack_require__, 7441));
|
|
2256
|
-
(async () => {
|
|
2257
|
-
let markedf = (await loadMarked()).marked;
|
|
2258
|
-
marked = (obj, text) => markedf(text);
|
|
2259
|
-
util/* default.map */.Z.map(mustrerender, obj => obj.forceUpdate());
|
|
2260
|
-
mustrerender = [];
|
|
2261
|
-
})();
|
|
2262
|
-
|
|
2263
2319
|
|
|
2264
2320
|
|
|
2265
2321
|
|
|
2266
|
-
class TextMessage extends common/* Com */.
|
|
2322
|
+
class TextMessage extends common/* Com */.Sq {
|
|
2267
2323
|
render() {
|
|
2268
|
-
var format = util/* default
|
|
2269
|
-
if (format === 'markdown') return this.renderMarkdown();
|
|
2324
|
+
var format = util/* default */.c.get(this.props.ev, 'data.message.format', 'plaintext');
|
|
2270
2325
|
if (format === 'delta') return this.renderDelta();
|
|
2271
2326
|
return this.renderPlainText();
|
|
2272
2327
|
}
|
|
2273
2328
|
renderPlainText() {
|
|
2274
|
-
var text = util/* default
|
|
2275
|
-
text = util/* default
|
|
2276
|
-
if (util/* default
|
|
2277
|
-
let byType = util/* default
|
|
2278
|
-
var tags = util/* default
|
|
2329
|
+
var text = util/* default */.c.get(this.props.ev, 'data.message.text');
|
|
2330
|
+
text = util/* default */.c.trim(text);
|
|
2331
|
+
if (util/* default */.c.size(text) === 0) return null;
|
|
2332
|
+
let byType = util/* default */.c.get(this.props.ev, 'by.type');
|
|
2333
|
+
var tags = util/* default */.c.extractText(text).map(tag => {
|
|
2279
2334
|
if (tag.type === 'emoji') return (0,preact_module.h)(Emoji, {
|
|
2280
2335
|
emojiCode: tag.text,
|
|
2281
2336
|
byType: byType
|
|
@@ -2299,7 +2354,7 @@ class TextMessage extends common/* Com */.up {
|
|
|
2299
2354
|
}, tag.text);
|
|
2300
2355
|
return tag.text;
|
|
2301
2356
|
});
|
|
2302
|
-
if (util/* default
|
|
2357
|
+
if (util/* default */.c.size(tags) === 0) return null;
|
|
2303
2358
|
if (byType === 'agent') {
|
|
2304
2359
|
return (0,preact_module.h)("div", {
|
|
2305
2360
|
class: "message-agent message-text--agent"
|
|
@@ -2310,16 +2365,16 @@ class TextMessage extends common/* Com */.up {
|
|
|
2310
2365
|
}, tags);
|
|
2311
2366
|
}
|
|
2312
2367
|
renderDelta() {
|
|
2313
|
-
let deltas = util/* default
|
|
2314
|
-
let quilldeltas = util/* default
|
|
2368
|
+
let deltas = util/* default */.c.get(this.props.ev, 'data.message.quill_delta') || util/* default */.c.get(this.props.ev, 'data.message.text');
|
|
2369
|
+
let quilldeltas = util/* default */.c.parseJSON(deltas) || {};
|
|
2315
2370
|
quilldeltas = trimQuillDelta(quilldeltas);
|
|
2316
|
-
if (!quilldeltas || util/* default
|
|
2317
|
-
let $deltas = util/* default
|
|
2371
|
+
if (!quilldeltas || util/* default */.c.size(quilldeltas.ops) === 0) return null;
|
|
2372
|
+
let $deltas = util/* default */.c.map(quilldeltas.ops, delta => {
|
|
2318
2373
|
let html = '';
|
|
2319
2374
|
let insert = delta.insert;
|
|
2320
2375
|
let attributes = delta.attributes;
|
|
2321
2376
|
if (insert.dynamicField) {
|
|
2322
|
-
return util/* default
|
|
2377
|
+
return util/* default */.c.get(insert, 'dynamicField.text', '');
|
|
2323
2378
|
}
|
|
2324
2379
|
if (insert.mention) {
|
|
2325
2380
|
if (insert.mention.id == '*' || insert.mention.id == 'all') {
|
|
@@ -2328,7 +2383,7 @@ class TextMessage extends common/* Com */.up {
|
|
|
2328
2383
|
}, "@", this.$t('all'));
|
|
2329
2384
|
}
|
|
2330
2385
|
let ag = store.matchAgent(insert.mention.id);
|
|
2331
|
-
let name = util/* default
|
|
2386
|
+
let name = util/* default */.c.getAgentDisplayName(ag, insert.mention.fullname);
|
|
2332
2387
|
return (0,preact_module.h)("span", {
|
|
2333
2388
|
class: "mention",
|
|
2334
2389
|
"data-agent-id": ag.id,
|
|
@@ -2339,7 +2394,7 @@ class TextMessage extends common/* Com */.up {
|
|
|
2339
2394
|
emojiCode: `:${insert.emoji}:`
|
|
2340
2395
|
});
|
|
2341
2396
|
if (typeof insert === 'string') {
|
|
2342
|
-
let $tags = util/* default
|
|
2397
|
+
let $tags = util/* default */.c.extractText(insert).map((tag, i) => {
|
|
2343
2398
|
if (tag.type === 'link') {
|
|
2344
2399
|
return (0,preact_module.h)("a", {
|
|
2345
2400
|
href: absLink(tag.text),
|
|
@@ -2363,9 +2418,9 @@ class TextMessage extends common/* Com */.up {
|
|
|
2363
2418
|
}
|
|
2364
2419
|
return null;
|
|
2365
2420
|
});
|
|
2366
|
-
let byType = util/* default
|
|
2421
|
+
let byType = util/* default */.c.get(this.ev, 'by.type');
|
|
2367
2422
|
if (byType !== 'user') byType = 'agent';
|
|
2368
|
-
if (util/* default
|
|
2423
|
+
if (util/* default */.c.size($deltas) === 0) return null;
|
|
2369
2424
|
if (byType === 'agent') {
|
|
2370
2425
|
return (0,preact_module.h)("div", {
|
|
2371
2426
|
class: "message-agent message-text--agent"
|
|
@@ -2375,46 +2430,6 @@ class TextMessage extends common/* Com */.up {
|
|
|
2375
2430
|
class: "message-user message-text--user"
|
|
2376
2431
|
}, $deltas);
|
|
2377
2432
|
}
|
|
2378
|
-
renderMarkdown(text) {
|
|
2379
|
-
if (!text) text = util/* default.get */.Z.get(this.props.ev, 'data.message.text');
|
|
2380
|
-
if (util/* default.size */.Z.size(text) === 0) return null;
|
|
2381
|
-
let byType = util/* default.get */.Z.get(this.props.ev, 'by.type');
|
|
2382
|
-
text = util/* default.trim */.Z.trim(text);
|
|
2383
|
-
if (util/* default.size */.Z.size(text) === 0) return null;
|
|
2384
|
-
if (byType === 'agent') {
|
|
2385
|
-
return (0,preact_module.h)("div", {
|
|
2386
|
-
class: "markdown-message message-agent message-text--agent"
|
|
2387
|
-
}, (0,preact_module.h)(ShadowDomRoot, {
|
|
2388
|
-
html: marked(this, text)
|
|
2389
|
-
}));
|
|
2390
|
-
}
|
|
2391
|
-
return (0,preact_module.h)("div", {
|
|
2392
|
-
class: "d-flex flex-column align-items-end"
|
|
2393
|
-
}, (0,preact_module.h)("div", {
|
|
2394
|
-
class: "markdown-message message-user message-text--user"
|
|
2395
|
-
}, (0,preact_module.h)(ShadowDomRoot, {
|
|
2396
|
-
html: marked(this, text)
|
|
2397
|
-
})));
|
|
2398
|
-
}
|
|
2399
|
-
}
|
|
2400
|
-
function deltaToMarkdown(deltas) {
|
|
2401
|
-
let output = '';
|
|
2402
|
-
sb.each(deltas, (delta, idx) => {
|
|
2403
|
-
let text = '';
|
|
2404
|
-
let insert = delta.insert;
|
|
2405
|
-
let attributes = delta.attributes;
|
|
2406
|
-
if (insert.emoji) text = emojiCodes[insert.emoji] || '';
|
|
2407
|
-
if (attributes) {
|
|
2408
|
-
if (attributes.italic && attributes.bold) text = `*__${insert}__*`;else if (attributes.italic) text = `*${insert}*`;else if (attributes.bold) text = `**${insert}**`;else text = insert;
|
|
2409
|
-
}
|
|
2410
|
-
if (insert.dynamicField) text = `${sb.get(insert, 'dynamicField.text', '')}`;
|
|
2411
|
-
if (!insert.emoji && !attributes && !insert.dynamicField) {
|
|
2412
|
-
text = insert || '';
|
|
2413
|
-
text = text.replace(/\n/g, '<br/>');
|
|
2414
|
-
}
|
|
2415
|
-
output += text;
|
|
2416
|
-
});
|
|
2417
|
-
return output;
|
|
2418
2433
|
}
|
|
2419
2434
|
const emojiCodes = {
|
|
2420
2435
|
like: '👍',
|
|
@@ -2463,11 +2478,11 @@ function absLink(url) {
|
|
|
2463
2478
|
}
|
|
2464
2479
|
;// CONCATENATED MODULE: ./src/chatbox/time.js
|
|
2465
2480
|
|
|
2466
|
-
var g_pub = new util/* default
|
|
2467
|
-
util/* default
|
|
2481
|
+
var g_pub = new util/* default */.c.Pubsub();
|
|
2482
|
+
util/* default */.c.setInterval(() => g_pub.publish('time'), 20 * 1000);
|
|
2468
2483
|
|
|
2469
2484
|
|
|
2470
|
-
class Time extends common/* Com */.
|
|
2485
|
+
class Time extends common/* Com */.Sq {
|
|
2471
2486
|
constructor(props) {
|
|
2472
2487
|
super(props);
|
|
2473
2488
|
this.setState({
|
|
@@ -2479,10 +2494,10 @@ class Time extends common/* Com */.up {
|
|
|
2479
2494
|
var t = '';
|
|
2480
2495
|
if (this.props.ago) {
|
|
2481
2496
|
if (this.props.short) {
|
|
2482
|
-
if (Math.abs(this.props.time - new util/* default
|
|
2483
|
-
let tim = new util/* default
|
|
2497
|
+
if (Math.abs(this.props.time - new util/* default */.c.Date().getTime()) > 86400000 * 10) {
|
|
2498
|
+
let tim = new util/* default */.c.Date(this.props.time);
|
|
2484
2499
|
let tzyear = tim.getFullYear();
|
|
2485
|
-
let locale = util/* default
|
|
2500
|
+
let locale = util/* default */.c.get(navigator, 'languages.0', 'en-US');
|
|
2486
2501
|
let tzmonthname = tim.toLocaleDateString(locale, {
|
|
2487
2502
|
month: 'short'
|
|
2488
2503
|
});
|
|
@@ -2490,8 +2505,8 @@ class Time extends common/* Com */.up {
|
|
|
2490
2505
|
t = tzdate + ' ' + tzmonthname + ' ' + tzyear;
|
|
2491
2506
|
}
|
|
2492
2507
|
}
|
|
2493
|
-
if (!t && this.props.time > 0) t = ago(this.props.time, new util/* default
|
|
2494
|
-
} else t = util/* default
|
|
2508
|
+
if (!t && this.props.time > 0) t = ago(this.props.time, new util/* default */.c.Date().getTime());
|
|
2509
|
+
} else t = util/* default */.c.shortTime(this.props.time, this.props.tzoffset);
|
|
2495
2510
|
if (this.props.uppercase) t = t.toUpperCase();
|
|
2496
2511
|
if (t === this.state.t) return;
|
|
2497
2512
|
this.setState({
|
|
@@ -2590,7 +2605,7 @@ function getRateLang(rating) {
|
|
|
2590
2605
|
|
|
2591
2606
|
|
|
2592
2607
|
|
|
2593
|
-
class InfoMessage extends common/* Com */.
|
|
2608
|
+
class InfoMessage extends common/* Com */.Sq {
|
|
2594
2609
|
render() {
|
|
2595
2610
|
let ev = this.props.ev.ev;
|
|
2596
2611
|
var $time = null;
|
|
@@ -2602,7 +2617,7 @@ class InfoMessage extends common/* Com */.up {
|
|
|
2602
2617
|
}));
|
|
2603
2618
|
}
|
|
2604
2619
|
if (ev.type === 'conversation_rated') {
|
|
2605
|
-
var rating = util/* default
|
|
2620
|
+
var rating = util/* default */.c.get(ev, 'data.conversation.ratings.0', {
|
|
2606
2621
|
no_rating: true,
|
|
2607
2622
|
rating: 0
|
|
2608
2623
|
});
|
|
@@ -2613,7 +2628,7 @@ class InfoMessage extends common/* Com */.up {
|
|
|
2613
2628
|
class: "info-message"
|
|
2614
2629
|
}, this.props.t('rated_as') + ' ' + this.props.t(getRateLang(rating.rating)).toLowerCase()));
|
|
2615
2630
|
}
|
|
2616
|
-
if (ev.type === 'conversation_state_updated' && util/* default
|
|
2631
|
+
if (ev.type === 'conversation_state_updated' && util/* default */.c.get(ev, 'data.conversation.state') === 'ended') {
|
|
2617
2632
|
return (0,preact_module.h)("div", {
|
|
2618
2633
|
class: "convo-event"
|
|
2619
2634
|
}, $time, (0,preact_module.h)("div", {
|
|
@@ -2641,13 +2656,13 @@ class InfoMessage extends common/* Com */.up {
|
|
|
2641
2656
|
|
|
2642
2657
|
|
|
2643
2658
|
|
|
2644
|
-
class Event extends common/* Com */.
|
|
2659
|
+
class Event extends common/* Com */.Sq {
|
|
2645
2660
|
constructor(props) {
|
|
2646
2661
|
super(props);
|
|
2647
|
-
this.refForm = (0,preact_module/* createRef */.
|
|
2662
|
+
this.refForm = (0,preact_module/* createRef */.Yn)();
|
|
2648
2663
|
}
|
|
2649
2664
|
render() {
|
|
2650
|
-
var ev = util/* default
|
|
2665
|
+
var ev = util/* default */.c.get(this.props.event, 'ev', {});
|
|
2651
2666
|
switch (ev.type) {
|
|
2652
2667
|
case 'conversation_joined':
|
|
2653
2668
|
break;
|
|
@@ -2656,7 +2671,7 @@ class Event extends common/* Com */.up {
|
|
|
2656
2671
|
case 'conversation_state_updated':
|
|
2657
2672
|
case 'conversation_rating_requested':
|
|
2658
2673
|
case 'conversation_rated':
|
|
2659
|
-
if (!util/* default
|
|
2674
|
+
if (!util/* default */.c.startsWith(ev.id, 'ev')) return null;
|
|
2660
2675
|
return (0,preact_module.h)(InfoMessage, {
|
|
2661
2676
|
t: this.props.t,
|
|
2662
2677
|
store: this.props.store,
|
|
@@ -2669,7 +2684,7 @@ class Event extends common/* Com */.up {
|
|
|
2669
2684
|
this.refForm.current && this.refForm.current.focus();
|
|
2670
2685
|
}
|
|
2671
2686
|
chooseQuickReply(reply) {
|
|
2672
|
-
let ev = util/* default
|
|
2687
|
+
let ev = util/* default */.c.get(this.props.event, 'ev', {});
|
|
2673
2688
|
let message = {
|
|
2674
2689
|
text: reply.title,
|
|
2675
2690
|
format: 'plaintext'
|
|
@@ -2686,7 +2701,7 @@ class Event extends common/* Com */.up {
|
|
|
2686
2701
|
this.props.onSend(message);
|
|
2687
2702
|
}
|
|
2688
2703
|
choosePostbackBtn(button) {
|
|
2689
|
-
let ev = util/* default
|
|
2704
|
+
let ev = util/* default */.c.get(this.props.event, 'ev', {});
|
|
2690
2705
|
let message = {
|
|
2691
2706
|
text: button.title,
|
|
2692
2707
|
format: 'plaintext'
|
|
@@ -2703,13 +2718,13 @@ class Event extends common/* Com */.up {
|
|
|
2703
2718
|
this.props.onSend(message);
|
|
2704
2719
|
}
|
|
2705
2720
|
renderAgentAvatar(ev) {
|
|
2706
|
-
let bytype = util/* default
|
|
2707
|
-
let byid = util/* default
|
|
2721
|
+
let bytype = util/* default */.c.get(ev, 'by.type');
|
|
2722
|
+
let byid = util/* default */.c.get(ev, 'by.display_id', util/* default */.c.get(ev, 'by.id'));
|
|
2708
2723
|
if (bytype === 'user') return null;
|
|
2709
2724
|
var senderName = this.getSenderName(ev);
|
|
2710
2725
|
let acc = this.props.store.matchAccount();
|
|
2711
|
-
var uri = acc.logo_url || __webpack_require__(
|
|
2712
|
-
if (util/* default
|
|
2726
|
+
var uri = acc.logo_url || __webpack_require__(6980);
|
|
2727
|
+
if (util/* default */.c.get(this.props, 'chatbox.hide_agent_profile')) {
|
|
2713
2728
|
return (0,preact_module.h)("div", {
|
|
2714
2729
|
class: "message-sender"
|
|
2715
2730
|
}, (0,preact_module.h)("img", {
|
|
@@ -2722,7 +2737,7 @@ class Event extends common/* Com */.up {
|
|
|
2722
2737
|
}
|
|
2723
2738
|
let agentM = this.props.store.matchAgent('*');
|
|
2724
2739
|
if (byid !== 'system' && bytype !== 'dummy' && bytype !== 'workflow') {
|
|
2725
|
-
uri = util/* default
|
|
2740
|
+
uri = util/* default */.c.get(agentM[byid], 'avatar_url') || acc.logo_url || __webpack_require__(9460);
|
|
2726
2741
|
}
|
|
2727
2742
|
return (0,preact_module.h)("div", {
|
|
2728
2743
|
class: "message-sender"
|
|
@@ -2744,8 +2759,8 @@ class Event extends common/* Com */.up {
|
|
|
2744
2759
|
time: ev.created
|
|
2745
2760
|
}));
|
|
2746
2761
|
}
|
|
2747
|
-
let t = new util/* default
|
|
2748
|
-
if (util/* default
|
|
2762
|
+
let t = new util/* default */.c.Date(ev.created).toLocaleString();
|
|
2763
|
+
if (util/* default */.c.get(ev, 'by.type') !== 'user') {
|
|
2749
2764
|
let $sender = null;
|
|
2750
2765
|
if (this.props.event.mode === 'lead') $sender = this.renderAgentAvatar(ev);
|
|
2751
2766
|
return (0,preact_module.h)("div", {
|
|
@@ -2801,15 +2816,15 @@ class Event extends common/* Com */.up {
|
|
|
2801
2816
|
onSelect: e => this.chooseQuickReply(e)
|
|
2802
2817
|
}));
|
|
2803
2818
|
}
|
|
2804
|
-
if (util/* default
|
|
2805
|
-
util/* default
|
|
2819
|
+
if (util/* default */.c.getMsgField(ev, 'idempotency') === ev.id && this.props.store.now() - ev.created < 900) {
|
|
2820
|
+
util/* default */.c.setTimeout(() => this.setState({
|
|
2806
2821
|
refresh: this.state.refresh
|
|
2807
2822
|
}), 1000);
|
|
2808
2823
|
}
|
|
2809
2824
|
let $dot = (0,preact_module.h)("div", {
|
|
2810
2825
|
class: "sending_dot"
|
|
2811
2826
|
});
|
|
2812
|
-
if (this.props.store.now() - ev.created < 900 || util/* default
|
|
2827
|
+
if (this.props.store.now() - ev.created < 900 || util/* default */.c.getMsgField(ev, 'idempotency') !== ev.id) {
|
|
2813
2828
|
$dot = (0,preact_module.h)("div", {
|
|
2814
2829
|
class: "sending_dot sending_dot__hide"
|
|
2815
2830
|
});
|
|
@@ -2873,7 +2888,7 @@ class Event extends common/* Com */.up {
|
|
|
2873
2888
|
})), $error);
|
|
2874
2889
|
}
|
|
2875
2890
|
renderUpdateConvo(ev) {
|
|
2876
|
-
var state = util/* default
|
|
2891
|
+
var state = util/* default */.c.get(ev, 'data.conversation.state');
|
|
2877
2892
|
if (state === 'active') return null;
|
|
2878
2893
|
if (state === 'pending') return null;
|
|
2879
2894
|
return (0,preact_module.h)("div", {
|
|
@@ -2883,27 +2898,27 @@ class Event extends common/* Com */.up {
|
|
|
2883
2898
|
}));
|
|
2884
2899
|
}
|
|
2885
2900
|
resendMessage() {
|
|
2886
|
-
let cid = util/* default
|
|
2887
|
-
const message = util/* default
|
|
2901
|
+
let cid = util/* default */.c.convoOfEv(this.props.event.ev);
|
|
2902
|
+
const message = util/* default */.c.get(this.props.event, 'ev.data.message');
|
|
2888
2903
|
this.props.store.sendConvoEvent(cid, 'message_sent', {
|
|
2889
2904
|
message
|
|
2890
2905
|
});
|
|
2891
2906
|
}
|
|
2892
2907
|
getSenderName(ev) {
|
|
2893
|
-
let bytype = util/* default
|
|
2894
|
-
let byid = util/* default
|
|
2895
|
-
if (bytype === 'user') return util/* default
|
|
2908
|
+
let bytype = util/* default */.c.get(ev, 'by.type');
|
|
2909
|
+
let byid = util/* default */.c.get(ev, 'by.display_id', util/* default */.c.get(ev, 'by.id'));
|
|
2910
|
+
if (bytype === 'user') return util/* default */.c.getUserDisplayName(this.props.store.matchUser());
|
|
2896
2911
|
let acc = this.props.store.matchAccount();
|
|
2897
|
-
if (bytype === 'agent') return util/* default
|
|
2912
|
+
if (bytype === 'agent') return util/* default */.c.getAgentDisplayName(acc, this.props.store.matchAgent(byid));
|
|
2898
2913
|
if (byid === 'system' || bytype === 'dummy' || bytype === 'workflow') return acc.name || 'system';
|
|
2899
2914
|
return '';
|
|
2900
2915
|
}
|
|
2901
2916
|
}
|
|
2902
2917
|
;// CONCATENATED MODULE: ./src/chatbox/spinner.js
|
|
2903
|
-
const loadingimg = __webpack_require__(
|
|
2918
|
+
const loadingimg = __webpack_require__(8860);
|
|
2904
2919
|
|
|
2905
2920
|
|
|
2906
|
-
class Spinner extends common/* Com */.
|
|
2921
|
+
class Spinner extends common/* Com */.Sq {
|
|
2907
2922
|
render() {
|
|
2908
2923
|
let mode = (this.props.mode + '').toLowerCase();
|
|
2909
2924
|
let mainColor = mode === 'dark' ? '#000000dd' : mode === 'blue' ? 'rgba(52, 152, 220, .8)' : mode;
|
|
@@ -2929,19 +2944,19 @@ class Spinner extends common/* Com */.up {
|
|
|
2929
2944
|
;// CONCATENATED MODULE: ./src/chatbox/Events.js
|
|
2930
2945
|
|
|
2931
2946
|
|
|
2932
|
-
const convoemptyimg = __webpack_require__(
|
|
2947
|
+
const convoemptyimg = __webpack_require__(5580);
|
|
2933
2948
|
|
|
2934
2949
|
|
|
2935
2950
|
|
|
2936
2951
|
|
|
2937
|
-
class Events extends common/* Com */.
|
|
2952
|
+
class Events extends common/* Com */.Sq {
|
|
2938
2953
|
constructor(props) {
|
|
2939
2954
|
super(props);
|
|
2940
2955
|
this.props.store.onUpdate(this, _ => this.forceUpdate());
|
|
2941
2956
|
this.props.store.onConvoEvent(this, ev => this.onEvent(ev));
|
|
2942
2957
|
this.loadConvo();
|
|
2943
2958
|
this.refBody = null;
|
|
2944
|
-
this.checkAndSeen = util/* default
|
|
2959
|
+
this.checkAndSeen = util/* default */.c.throttle(() => {
|
|
2945
2960
|
if (this.props.isShow && this.isBottom() && this.props.store.browserVisibility === 'visible' && document.hasFocus()) {
|
|
2946
2961
|
this.props.store.seenConvo(this.props.cid);
|
|
2947
2962
|
}
|
|
@@ -2953,8 +2968,8 @@ class Events extends common/* Com */.up {
|
|
|
2953
2968
|
}
|
|
2954
2969
|
render() {
|
|
2955
2970
|
if (this.state.error) return this.renderError();
|
|
2956
|
-
let events = util/* default
|
|
2957
|
-
if (!this.state.loading && util/* default
|
|
2971
|
+
let events = util/* default */.c.map(this.props.store.listEvents(this.props.cid));
|
|
2972
|
+
if (!this.state.loading && util/* default */.c.size(events) === 0) {
|
|
2958
2973
|
return (0,preact_module.h)("div", {
|
|
2959
2974
|
ref: ref => this.refBody = ref,
|
|
2960
2975
|
class: "widget-body--events-container"
|
|
@@ -2968,13 +2983,13 @@ class Events extends common/* Com */.up {
|
|
|
2968
2983
|
store: this.props.store
|
|
2969
2984
|
}));
|
|
2970
2985
|
}
|
|
2971
|
-
events = util/* default
|
|
2986
|
+
events = util/* default */.c.orderBy(events, 'created', 'asc');
|
|
2972
2987
|
let convo = this.props.store.matchConvo(this.props.cid);
|
|
2973
|
-
events = util/* default
|
|
2988
|
+
events = util/* default */.c.map(events, ev => ({
|
|
2974
2989
|
ev: ev
|
|
2975
2990
|
}));
|
|
2976
2991
|
processEvents(convo, events);
|
|
2977
|
-
let $events = util/* default
|
|
2992
|
+
let $events = util/* default */.c.map(events, ev => (0,preact_module.h)(Event, {
|
|
2978
2993
|
chatbox: this.props.chatbox,
|
|
2979
2994
|
onLink: this.props.onLink,
|
|
2980
2995
|
store: this.props.store,
|
|
@@ -2990,13 +3005,13 @@ class Events extends common/* Com */.up {
|
|
|
2990
3005
|
if (this.state.loading || this.props.creating) {
|
|
2991
3006
|
$loading = (0,preact_module.h)(Spinner, {
|
|
2992
3007
|
static: true,
|
|
2993
|
-
mode: util/* default
|
|
3008
|
+
mode: util/* default */.c.get(this.props.chatbox, 'primary_color', 'dark'),
|
|
2994
3009
|
size: "120",
|
|
2995
3010
|
center: true
|
|
2996
3011
|
});
|
|
2997
3012
|
style = 'opacity: 0 !important';
|
|
2998
3013
|
}
|
|
2999
|
-
return (0,preact_module.h)(preact_module/* Fragment */.
|
|
3014
|
+
return (0,preact_module.h)(preact_module/* Fragment */.ae, null, $loading, (0,preact_module.h)("div", {
|
|
3000
3015
|
style: style,
|
|
3001
3016
|
ref: ref => this.refBody = ref,
|
|
3002
3017
|
class: "widget-body--events-container",
|
|
@@ -3029,23 +3044,23 @@ class Events extends common/* Com */.up {
|
|
|
3029
3044
|
}
|
|
3030
3045
|
focus() {
|
|
3031
3046
|
let events = this.props.store.listEvents(this.props.cid);
|
|
3032
|
-
events = util/* default
|
|
3047
|
+
events = util/* default */.c.orderBy(util/* default */.c.map(events), 'created', 'desc');
|
|
3033
3048
|
var last_agent_sent;
|
|
3034
3049
|
for (let ev of events) {
|
|
3035
|
-
if (util/* default
|
|
3036
|
-
if (util/* default
|
|
3050
|
+
if (util/* default */.c.get(ev, 'type') !== 'message_sent') continue;
|
|
3051
|
+
if (util/* default */.c.get(ev, 'by.type') === 'user') continue;
|
|
3037
3052
|
last_agent_sent = ev;
|
|
3038
3053
|
break;
|
|
3039
3054
|
}
|
|
3040
|
-
if (util/* default
|
|
3041
|
-
let attachments = util/* default
|
|
3055
|
+
if (util/* default */.c.get(last_agent_sent, 'by.type') === 'user') last_agent_sent = null;
|
|
3056
|
+
let attachments = util/* default */.c.get(last_agent_sent, 'data.message.attachments', []);
|
|
3042
3057
|
let convo = this.props.store.matchConvo(this.props.cid);
|
|
3043
|
-
let pendingForms = util/* default
|
|
3058
|
+
let pendingForms = util/* default */.c.filter(attachments, att => {
|
|
3044
3059
|
if (!att) return false;
|
|
3045
3060
|
if (att.type !== 'form' && att.type !== 'ask_info_form') return false;
|
|
3046
3061
|
var form = att.form;
|
|
3047
3062
|
if (!form) return false;
|
|
3048
|
-
var state = util/* default
|
|
3063
|
+
var state = util/* default */.c.parseJSON(form.state) || {};
|
|
3049
3064
|
if (!state.require_finished && att.type !== 'ask_info_form') return false;
|
|
3050
3065
|
if (Events_isSummited(att.form)) return false;
|
|
3051
3066
|
if (convo.state === 'ended') return false;
|
|
@@ -3053,10 +3068,10 @@ class Events extends common/* Com */.up {
|
|
|
3053
3068
|
});
|
|
3054
3069
|
}
|
|
3055
3070
|
onEvent(newev) {
|
|
3056
|
-
if (util/* default
|
|
3071
|
+
if (util/* default */.c.convoOfEv(newev) !== this.props.cid) return;
|
|
3057
3072
|
let isBottom = this.isBottom();
|
|
3058
3073
|
var byme = false;
|
|
3059
|
-
if (util/* default
|
|
3074
|
+
if (util/* default */.c.get(newev, 'type') === 'message_sent' && newev.id === util/* default */.c.getMsgField(newev, 'idempotency')) byme = true;
|
|
3060
3075
|
if (byme || isBottom) this.scrollToBottom();
|
|
3061
3076
|
}
|
|
3062
3077
|
async loadConvo() {
|
|
@@ -3066,7 +3081,7 @@ class Events extends common/* Com */.up {
|
|
|
3066
3081
|
loading: true
|
|
3067
3082
|
});
|
|
3068
3083
|
let events = this.props.store.listEvents(this.props.cid);
|
|
3069
|
-
if (util/* default
|
|
3084
|
+
if (util/* default */.c.size(events) === 0) {
|
|
3070
3085
|
let cid = this.props.cid;
|
|
3071
3086
|
let {
|
|
3072
3087
|
error
|
|
@@ -3090,7 +3105,7 @@ class Events extends common/* Com */.up {
|
|
|
3090
3105
|
error: false
|
|
3091
3106
|
});
|
|
3092
3107
|
this.scrollToBottom();
|
|
3093
|
-
util/* default
|
|
3108
|
+
util/* default */.c.setTimeout(() => this.setState({
|
|
3094
3109
|
loading: false
|
|
3095
3110
|
}), 50);
|
|
3096
3111
|
}
|
|
@@ -3100,11 +3115,11 @@ class Events extends common/* Com */.up {
|
|
|
3100
3115
|
return $container.scrollHeight < $container.scrollTop + $container.offsetHeight + 50;
|
|
3101
3116
|
}
|
|
3102
3117
|
scrollToBottom() {
|
|
3103
|
-
util/* default
|
|
3118
|
+
util/* default */.c.setTimeout(() => {
|
|
3104
3119
|
const $div = this.refBody;
|
|
3105
3120
|
if ($div) $div.scrollTop = $div.scrollHeight;
|
|
3106
3121
|
});
|
|
3107
|
-
util/* default
|
|
3122
|
+
util/* default */.c.setTimeout(() => {
|
|
3108
3123
|
const $div = this.refBody;
|
|
3109
3124
|
if ($div) $div.scrollTop = $div.scrollHeight;
|
|
3110
3125
|
}, 200);
|
|
@@ -3122,13 +3137,13 @@ function processEvents(convo, events) {
|
|
|
3122
3137
|
let curEvent = events[i];
|
|
3123
3138
|
let lastEvent = events[i - 1];
|
|
3124
3139
|
if (visibleEvent(curEvent.ev)) {
|
|
3125
|
-
let elapsedSec = util/* default
|
|
3140
|
+
let elapsedSec = util/* default */.c.unixSec(curEvent.ev.created) - util/* default */.c.unixSec(lastEvent.ev.created);
|
|
3126
3141
|
if (elapsedSec > 120) curEvent.show_time = true;
|
|
3127
3142
|
}
|
|
3128
3143
|
}
|
|
3129
3144
|
for (var i = 0; i < events.length; i++) {
|
|
3130
3145
|
let curEvent = events[i];
|
|
3131
|
-
if (util/* default
|
|
3146
|
+
if (util/* default */.c.get(curEvent, 'ev.type') === 'message_sent') {
|
|
3132
3147
|
curEvent.show_time = true;
|
|
3133
3148
|
break;
|
|
3134
3149
|
}
|
|
@@ -3138,7 +3153,7 @@ function processEvents(convo, events) {
|
|
|
3138
3153
|
let prevEvent = events[i - 1];
|
|
3139
3154
|
if (curEvent.ev.type === 'message_sent') {
|
|
3140
3155
|
curEvent.mode = 'lead';
|
|
3141
|
-
if (util/* default
|
|
3156
|
+
if (util/* default */.c.get(prevEvent, 'ev.type') === 'message_sent' && util/* default */.c.get(prevEvent, 'ev.by.id') === util/* default */.c.get(curEvent, 'ev.by.id')) {
|
|
3142
3157
|
curEvent.mode = 'follow';
|
|
3143
3158
|
}
|
|
3144
3159
|
continue;
|
|
@@ -3146,18 +3161,18 @@ function processEvents(convo, events) {
|
|
|
3146
3161
|
}
|
|
3147
3162
|
}
|
|
3148
3163
|
function visibleEvent(ev) {
|
|
3149
|
-
let type = util/* default
|
|
3164
|
+
let type = util/* default */.c.get(ev, 'type');
|
|
3150
3165
|
return type === 'message_sent' || type === 'conversation_state_updated';
|
|
3151
3166
|
}
|
|
3152
3167
|
function Events_isSummited(form) {
|
|
3153
|
-
let fields = util/* default
|
|
3154
|
-
return util/* default
|
|
3168
|
+
let fields = util/* default */.c.get(form, 'fields') || [];
|
|
3169
|
+
return util/* default */.c.find(fields, field => !!field.answered);
|
|
3155
3170
|
}
|
|
3156
3171
|
;// CONCATENATED MODULE: ./src/chatbox/Typing.js
|
|
3157
3172
|
|
|
3158
3173
|
|
|
3159
3174
|
|
|
3160
|
-
class Typing extends common/* Com */.
|
|
3175
|
+
class Typing extends common/* Com */.Sq {
|
|
3161
3176
|
constructor(props) {
|
|
3162
3177
|
super(props);
|
|
3163
3178
|
}
|
|
@@ -3167,29 +3182,29 @@ class Typing extends common/* Com */.up {
|
|
|
3167
3182
|
ev: {}
|
|
3168
3183
|
});
|
|
3169
3184
|
this.props.store.onConvoEvent(this, ev => {
|
|
3170
|
-
if (util/* default
|
|
3185
|
+
if (util/* default */.c.convoOfEv(ev) !== this.props.cid) return;
|
|
3171
3186
|
let user = this.props.store.matchUser();
|
|
3172
|
-
if (util/* default
|
|
3173
|
-
let oldby = util/* default
|
|
3174
|
-
if (oldby && util/* default
|
|
3175
|
-
if (util/* default
|
|
3176
|
-
if (this.timer) util/* default
|
|
3187
|
+
if (util/* default */.c.get(ev, 'by.id') === user.id) return;
|
|
3188
|
+
let oldby = util/* default */.c.get(this.state.ev, 'by.id');
|
|
3189
|
+
if (oldby && util/* default */.c.get(ev, 'by.id') !== oldby) return;
|
|
3190
|
+
if (util/* default */.c.get(ev, 'type') === 'message_sent') {
|
|
3191
|
+
if (this.timer) util/* default */.c.clearTimeout(this.timer);
|
|
3177
3192
|
this.timer = null;
|
|
3178
3193
|
this.setState({
|
|
3179
3194
|
isShow: false
|
|
3180
3195
|
});
|
|
3181
3196
|
return;
|
|
3182
3197
|
}
|
|
3183
|
-
|
|
3198
|
+
if (util/* default */.c.get(ev, 'type') !== 'conversation_typing') return;
|
|
3199
|
+
let ag = this.props.store.matchAgent(util/* default */.c.get(ev, 'by.id')) || {};
|
|
3184
3200
|
if (ag.type == 'agent') return;
|
|
3185
|
-
if (util/* default.get */.Z.get(ev, 'type') !== 'conversation_typing') return;
|
|
3186
3201
|
this.setState({
|
|
3187
3202
|
ev: ev,
|
|
3188
3203
|
isShow: true
|
|
3189
3204
|
});
|
|
3190
|
-
if (this.timer) util/* default
|
|
3191
|
-
this.timer = util/* default
|
|
3192
|
-
if (util/* default
|
|
3205
|
+
if (this.timer) util/* default */.c.clearTimeout(this.timer);
|
|
3206
|
+
this.timer = util/* default */.c.setTimeout(() => {
|
|
3207
|
+
if (util/* default */.c.convoOfEv(ev) !== this.props.cid) return;
|
|
3193
3208
|
this.timer = null;
|
|
3194
3209
|
this.setState({
|
|
3195
3210
|
isShow: false
|
|
@@ -3200,8 +3215,8 @@ class Typing extends common/* Com */.up {
|
|
|
3200
3215
|
render() {
|
|
3201
3216
|
let account = this.props.store.matchAccount();
|
|
3202
3217
|
var cls = this.state.isShow ? '' : 'typing--hidden';
|
|
3203
|
-
let byid = util/* default
|
|
3204
|
-
let agentName = util/* default
|
|
3218
|
+
let byid = util/* default */.c.get(this.state.ev, 'by.display_id', util/* default */.c.get(this.state.ev, 'by.id'));
|
|
3219
|
+
let agentName = util/* default */.c.getAgentDisplayName(account, this.props.store.matchAgent(byid));
|
|
3205
3220
|
return (0,preact_module.h)("div", {
|
|
3206
3221
|
class: `typing ${cls}`
|
|
3207
3222
|
}, agentName, " ", this.props.t('typing'));
|
|
@@ -3220,7 +3235,7 @@ class Typing extends common/* Com */.up {
|
|
|
3220
3235
|
this.stop();
|
|
3221
3236
|
var t0;
|
|
3222
3237
|
var run = t => {
|
|
3223
|
-
if (!t) t = new util/* default
|
|
3238
|
+
if (!t) t = new util/* default */.c.Date().getTime();
|
|
3224
3239
|
var deltaT = t - t0;
|
|
3225
3240
|
var [newy, done] = this.calcY(v, y0, deltaT);
|
|
3226
3241
|
cb(newy);
|
|
@@ -3228,7 +3243,7 @@ class Typing extends common/* Com */.up {
|
|
|
3228
3243
|
this.animationframe = window.requestAnimationFrame(run);
|
|
3229
3244
|
};
|
|
3230
3245
|
this.animationframe = window.requestAnimationFrame(t => {
|
|
3231
|
-
t0 = t || new util/* default
|
|
3246
|
+
t0 = t || new util/* default */.c.Date().getTime();
|
|
3232
3247
|
run(t0);
|
|
3233
3248
|
});
|
|
3234
3249
|
}
|
|
@@ -3263,8 +3278,8 @@ function eqFloat(a, b) {
|
|
|
3263
3278
|
}
|
|
3264
3279
|
;// CONCATENATED MODULE: ./src/chatbox/Rating.js
|
|
3265
3280
|
function Rating_defineProperty(obj, key, value) { key = Rating_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3266
|
-
function Rating_toPropertyKey(
|
|
3267
|
-
function Rating_toPrimitive(
|
|
3281
|
+
function Rating_toPropertyKey(t) { var i = Rating_toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
3282
|
+
function Rating_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
3268
3283
|
|
|
3269
3284
|
|
|
3270
3285
|
const POPUP_MAX_HEIGHT = 400;
|
|
@@ -3272,7 +3287,7 @@ const POPUP_HARD_MAX_HEIGHT = 500;
|
|
|
3272
3287
|
const POPUP_MIN_HEIGHT = 0;
|
|
3273
3288
|
|
|
3274
3289
|
|
|
3275
|
-
class Rating extends common/* Com */.
|
|
3290
|
+
class Rating extends common/* Com */.Sq {
|
|
3276
3291
|
constructor(props) {
|
|
3277
3292
|
super(props);
|
|
3278
3293
|
Rating_defineProperty(this, "state", {
|
|
@@ -3281,16 +3296,16 @@ class Rating extends common/* Com */.up {
|
|
|
3281
3296
|
overlayOpacity: 0.3,
|
|
3282
3297
|
comment: ''
|
|
3283
3298
|
});
|
|
3284
|
-
this.refComment = (0,preact_module/* createRef */.
|
|
3285
|
-
this.refRating = (0,preact_module/* createRef */.
|
|
3286
|
-
this.refHandle = (0,preact_module/* createRef */.
|
|
3299
|
+
this.refComment = (0,preact_module/* createRef */.Yn)();
|
|
3300
|
+
this.refRating = (0,preact_module/* createRef */.Yn)();
|
|
3301
|
+
this.refHandle = (0,preact_module/* createRef */.Yn)();
|
|
3287
3302
|
}
|
|
3288
3303
|
componentDidMount() {
|
|
3289
3304
|
this.props.store.onUpdate(this, () => {
|
|
3290
3305
|
if (this.shoudDisplay()) this.open();
|
|
3291
3306
|
});
|
|
3292
3307
|
this.props.store.onConvoEvent(this, ev => {
|
|
3293
|
-
var cid = util/* default
|
|
3308
|
+
var cid = util/* default */.c.convoOfEv(ev);
|
|
3294
3309
|
if (cid !== this.props.cid) return;
|
|
3295
3310
|
if (this.shoudDisplay()) this.open();
|
|
3296
3311
|
});
|
|
@@ -3369,7 +3384,7 @@ class Rating extends common/* Com */.up {
|
|
|
3369
3384
|
onClick: e => this.onRatingPoor(e)
|
|
3370
3385
|
}, (0,preact_module.h)("img", {
|
|
3371
3386
|
alt: "poor",
|
|
3372
|
-
src: __webpack_require__(
|
|
3387
|
+
src: __webpack_require__(5168)
|
|
3373
3388
|
}), (0,preact_module.h)("p", {
|
|
3374
3389
|
class: "rating-face--text"
|
|
3375
3390
|
}, this.props.t('poor'))), (0,preact_module.h)("div", {
|
|
@@ -3377,7 +3392,7 @@ class Rating extends common/* Com */.up {
|
|
|
3377
3392
|
onClick: e => this.onRatingAverage(e)
|
|
3378
3393
|
}, (0,preact_module.h)("img", {
|
|
3379
3394
|
alt: "average",
|
|
3380
|
-
src: __webpack_require__(
|
|
3395
|
+
src: __webpack_require__(2672)
|
|
3381
3396
|
}), (0,preact_module.h)("p", {
|
|
3382
3397
|
class: "rating-face--text"
|
|
3383
3398
|
}, this.props.t('average'))), (0,preact_module.h)("div", {
|
|
@@ -3385,7 +3400,7 @@ class Rating extends common/* Com */.up {
|
|
|
3385
3400
|
onClick: e => this.onRatingGreat(e)
|
|
3386
3401
|
}, (0,preact_module.h)("img", {
|
|
3387
3402
|
alt: "great",
|
|
3388
|
-
src: __webpack_require__(
|
|
3403
|
+
src: __webpack_require__(1240)
|
|
3389
3404
|
}), (0,preact_module.h)("p", {
|
|
3390
3405
|
class: "rating-face--text"
|
|
3391
3406
|
}, this.props.t('great')))), (0,preact_module.h)("div", {
|
|
@@ -3399,12 +3414,12 @@ class Rating extends common/* Com */.up {
|
|
|
3399
3414
|
var rated;
|
|
3400
3415
|
var ended;
|
|
3401
3416
|
let user = this.props.store.matchUser();
|
|
3402
|
-
util/* default
|
|
3403
|
-
if (util/* default
|
|
3417
|
+
util/* default */.c.map(this.props.store.listEvents(this.props.cid), ev => {
|
|
3418
|
+
if (util/* default */.c.get(ev, 'type') === 'conversation_state_updated' && util/* default */.c.get(ev, 'data.conversation.state') === 'ended') {
|
|
3404
3419
|
ended = ev;
|
|
3405
3420
|
}
|
|
3406
|
-
if (util/* default
|
|
3407
|
-
if (util/* default
|
|
3421
|
+
if (util/* default */.c.get(ev, 'type') === 'conversation_rating_requested') requested = ev;
|
|
3422
|
+
if (util/* default */.c.get(ev, 'type') === 'conversation_rated' && util/* default */.c.get(ev, 'by.id') === user.id) rated = ev;
|
|
3408
3423
|
});
|
|
3409
3424
|
if (rated) return false;
|
|
3410
3425
|
let accountSetting = this.props.plugin.chatbox;
|
|
@@ -3445,7 +3460,7 @@ class Rating extends common/* Com */.up {
|
|
|
3445
3460
|
hide: false
|
|
3446
3461
|
});
|
|
3447
3462
|
if (!this.refRating.current) return;
|
|
3448
|
-
util/* default
|
|
3463
|
+
util/* default */.c.setTimeout(() => {
|
|
3449
3464
|
if (this.refComment.current) this.refComment.current.focus();
|
|
3450
3465
|
}, 400);
|
|
3451
3466
|
this.refComment.current.value = '';
|
|
@@ -3528,21 +3543,21 @@ class Rating extends common/* Com */.up {
|
|
|
3528
3543
|
}
|
|
3529
3544
|
;// CONCATENATED MODULE: ./src/chatbox/DropdownSelect.js
|
|
3530
3545
|
function DropdownSelect_defineProperty(obj, key, value) { key = DropdownSelect_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3531
|
-
function DropdownSelect_toPropertyKey(
|
|
3532
|
-
function DropdownSelect_toPrimitive(
|
|
3546
|
+
function DropdownSelect_toPropertyKey(t) { var i = DropdownSelect_toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
3547
|
+
function DropdownSelect_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
3533
3548
|
|
|
3534
3549
|
|
|
3535
3550
|
|
|
3536
3551
|
|
|
3537
|
-
class DropdownSelect extends common/* Com */.
|
|
3552
|
+
class DropdownSelect extends common/* Com */.Sq {
|
|
3538
3553
|
constructor(props) {
|
|
3539
3554
|
super(props);
|
|
3540
3555
|
DropdownSelect_defineProperty(this, "state", {
|
|
3541
3556
|
show: false,
|
|
3542
3557
|
searchValue: ''
|
|
3543
3558
|
});
|
|
3544
|
-
DropdownSelect_defineProperty(this, "filterRef", (0,preact_module/* createRef */.
|
|
3545
|
-
DropdownSelect_defineProperty(this, "overlayRef", (0,preact_module/* createRef */.
|
|
3559
|
+
DropdownSelect_defineProperty(this, "filterRef", (0,preact_module/* createRef */.Yn)());
|
|
3560
|
+
DropdownSelect_defineProperty(this, "overlayRef", (0,preact_module/* createRef */.Yn)());
|
|
3546
3561
|
DropdownSelect_defineProperty(this, "onTouchMove", e => {
|
|
3547
3562
|
if (e.target === this.overlayRef.current) {
|
|
3548
3563
|
e.preventDefault();
|
|
@@ -3567,15 +3582,15 @@ class DropdownSelect extends common/* Com */.up {
|
|
|
3567
3582
|
});
|
|
3568
3583
|
DropdownSelect_defineProperty(this, "hasSearch", () => {
|
|
3569
3584
|
if (this.props.has_search) return true;
|
|
3570
|
-
return util/* default
|
|
3585
|
+
return util/* default */.c.size(this.props.items) >= 10;
|
|
3571
3586
|
});
|
|
3572
3587
|
DropdownSelect_defineProperty(this, "getFilteredOptions", () => {
|
|
3573
3588
|
let items = this.props.items;
|
|
3574
3589
|
if (this.state.searchValue && this.hasSearch()) {
|
|
3575
|
-
items = util/* default
|
|
3576
|
-
let optionName = util/* default
|
|
3577
|
-
let optionDesc = util/* default
|
|
3578
|
-
let searchValue = util/* default
|
|
3590
|
+
items = util/* default */.c.filter(items, item => {
|
|
3591
|
+
let optionName = util/* default */.c.unicodeToAscii(item.name).toLowerCase().replace(/ /g, '');
|
|
3592
|
+
let optionDesc = util/* default */.c.unicodeToAscii(item.desc).toLowerCase().replace(/ /g, '');
|
|
3593
|
+
let searchValue = util/* default */.c.unicodeToAscii(this.state.searchValue).toLowerCase().replace(/ /g, '');
|
|
3579
3594
|
return optionName.indexOf(searchValue) != -1 || optionDesc.indexOf(searchValue) != -1;
|
|
3580
3595
|
});
|
|
3581
3596
|
}
|
|
@@ -3614,7 +3629,7 @@ class DropdownSelect extends common/* Com */.up {
|
|
|
3614
3629
|
class: "dropdown_select_filter__empty"
|
|
3615
3630
|
}, (0,preact_module.h)("img", {
|
|
3616
3631
|
class: "dropdown_select_filter__empty_img",
|
|
3617
|
-
src: __webpack_require__(
|
|
3632
|
+
src: __webpack_require__(864)
|
|
3618
3633
|
}), (0,preact_module.h)("div", {
|
|
3619
3634
|
class: "muted",
|
|
3620
3635
|
style: "text-align: center !important;"
|
|
@@ -3634,7 +3649,7 @@ class DropdownSelect extends common/* Com */.up {
|
|
|
3634
3649
|
focusFilter() {
|
|
3635
3650
|
if (!this.filterRef.current) return;
|
|
3636
3651
|
this.filterRef.current.focus();
|
|
3637
|
-
util/* default
|
|
3652
|
+
util/* default */.c.setTimeout(() => {
|
|
3638
3653
|
if (!this.filterRef.current) return;
|
|
3639
3654
|
this.filterRef.current.focus();
|
|
3640
3655
|
}, 100);
|
|
@@ -3642,7 +3657,7 @@ class DropdownSelect extends common/* Com */.up {
|
|
|
3642
3657
|
renderDropdown() {
|
|
3643
3658
|
if (!this.state.show) return null;
|
|
3644
3659
|
let items = this.getFilteredOptions();
|
|
3645
|
-
let $items = util/* default
|
|
3660
|
+
let $items = util/* default */.c.map(items, item => {
|
|
3646
3661
|
return (0,preact_module.h)("div", {
|
|
3647
3662
|
class: "dropdown_select__item",
|
|
3648
3663
|
onClick: _ => this.onSelect(item)
|
|
@@ -3652,12 +3667,12 @@ class DropdownSelect extends common/* Com */.up {
|
|
|
3652
3667
|
if (this.hasSearch()) {
|
|
3653
3668
|
let $img = (0,preact_module.h)("img", {
|
|
3654
3669
|
class: "dropdown_select_filter__icon",
|
|
3655
|
-
src: __webpack_require__(
|
|
3670
|
+
src: __webpack_require__(6528)
|
|
3656
3671
|
});
|
|
3657
3672
|
if (this.props.loading) {
|
|
3658
3673
|
$img = (0,preact_module.h)("img", {
|
|
3659
3674
|
class: "dropdown_select_filter__icon",
|
|
3660
|
-
src: __webpack_require__(
|
|
3675
|
+
src: __webpack_require__(5616)
|
|
3661
3676
|
});
|
|
3662
3677
|
}
|
|
3663
3678
|
$filter = (0,preact_module.h)("div", {
|
|
@@ -3703,17 +3718,17 @@ class DropdownSelect extends common/* Com */.up {
|
|
|
3703
3718
|
class: "muted text-truncate",
|
|
3704
3719
|
style: "flex: 1 !important;"
|
|
3705
3720
|
}, "Ch\u1ECDn m\u1ED9t ph\u1EA7n t\u1EED");
|
|
3706
|
-
if (util/* default
|
|
3721
|
+
if (util/* default */.c.get(this.props, 'selected.name')) $name = (0,preact_module.h)("div", {
|
|
3707
3722
|
class: "text-truncate",
|
|
3708
3723
|
style: "flex: 1 !important;"
|
|
3709
|
-
}, util/* default
|
|
3724
|
+
}, util/* default */.c.get(this.props, 'selected.name'));
|
|
3710
3725
|
let style = 'position: relative !important;';
|
|
3711
3726
|
if (this.props.full) {
|
|
3712
3727
|
style = '';
|
|
3713
3728
|
}
|
|
3714
3729
|
return (0,preact_module.h)("div", {
|
|
3715
3730
|
style: style
|
|
3716
|
-
}, (0,preact_module.h)(common/* Clickaway */.
|
|
3731
|
+
}, (0,preact_module.h)(common/* Clickaway */.C3, {
|
|
3717
3732
|
onClickaway: this.hideDropdown
|
|
3718
3733
|
}, (0,preact_module.h)("div", {
|
|
3719
3734
|
type: "text",
|
|
@@ -3721,19 +3736,19 @@ class DropdownSelect extends common/* Com */.up {
|
|
|
3721
3736
|
onClick: this.toogleDropdown
|
|
3722
3737
|
}, $name, "\xA0", (0,preact_module.h)("img", {
|
|
3723
3738
|
class: "dropdown_select__caret",
|
|
3724
|
-
src: __webpack_require__(
|
|
3739
|
+
src: __webpack_require__(744)
|
|
3725
3740
|
})), this.renderDropdown()));
|
|
3726
3741
|
}
|
|
3727
3742
|
}
|
|
3728
3743
|
;// CONCATENATED MODULE: ./src/order/address_picker.js
|
|
3729
3744
|
function address_picker_defineProperty(obj, key, value) { key = address_picker_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3730
|
-
function address_picker_toPropertyKey(
|
|
3731
|
-
function address_picker_toPrimitive(
|
|
3745
|
+
function address_picker_toPropertyKey(t) { var i = address_picker_toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
3746
|
+
function address_picker_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
3732
3747
|
|
|
3733
3748
|
|
|
3734
3749
|
|
|
3735
3750
|
|
|
3736
|
-
class AddressPicker extends common/* Com */.
|
|
3751
|
+
class AddressPicker extends common/* Com */.Sq {
|
|
3737
3752
|
constructor(props) {
|
|
3738
3753
|
super(props);
|
|
3739
3754
|
address_picker_defineProperty(this, "state", {
|
|
@@ -3741,8 +3756,8 @@ class AddressPicker extends common/* Com */.up {
|
|
|
3741
3756
|
searchValue: '',
|
|
3742
3757
|
addresses: []
|
|
3743
3758
|
});
|
|
3744
|
-
address_picker_defineProperty(this, "filterRef", (0,preact_module/* createRef */.
|
|
3745
|
-
address_picker_defineProperty(this, "overlayRef", (0,preact_module/* createRef */.
|
|
3759
|
+
address_picker_defineProperty(this, "filterRef", (0,preact_module/* createRef */.Yn)());
|
|
3760
|
+
address_picker_defineProperty(this, "overlayRef", (0,preact_module/* createRef */.Yn)());
|
|
3746
3761
|
address_picker_defineProperty(this, "onTouchMove", e => {
|
|
3747
3762
|
if (e.target === this.overlayRef.current) {
|
|
3748
3763
|
e.preventDefault();
|
|
@@ -3766,13 +3781,13 @@ class AddressPicker extends common/* Com */.up {
|
|
|
3766
3781
|
}
|
|
3767
3782
|
if (e.key == 'Enter') {}
|
|
3768
3783
|
});
|
|
3769
|
-
address_picker_defineProperty(this, "doSearch", util/* default
|
|
3784
|
+
address_picker_defineProperty(this, "doSearch", util/* default */.c.throttle(async () => {
|
|
3770
3785
|
let requestId = Date.now();
|
|
3771
3786
|
this.requestId = requestId;
|
|
3772
3787
|
let res = await this.props.store.suggest_addresses(this.state.searchValue);
|
|
3773
3788
|
if (this.requestId !== requestId) return;
|
|
3774
3789
|
this.setState({
|
|
3775
|
-
addresses: util/* default
|
|
3790
|
+
addresses: util/* default */.c.get(res, 'body.addresses', [])
|
|
3776
3791
|
});
|
|
3777
3792
|
}, 100));
|
|
3778
3793
|
address_picker_defineProperty(this, "onChangeSearchValue", e => {
|
|
@@ -3809,7 +3824,7 @@ class AddressPicker extends common/* Com */.up {
|
|
|
3809
3824
|
class: "dropdown_select_filter__empty"
|
|
3810
3825
|
}, (0,preact_module.h)("img", {
|
|
3811
3826
|
class: "dropdown_select_filter__empty_img",
|
|
3812
|
-
src: __webpack_require__(
|
|
3827
|
+
src: __webpack_require__(864)
|
|
3813
3828
|
}), (0,preact_module.h)("div", {
|
|
3814
3829
|
class: "muted",
|
|
3815
3830
|
style: "text-align: center !important;"
|
|
@@ -3829,14 +3844,14 @@ class AddressPicker extends common/* Com */.up {
|
|
|
3829
3844
|
focusFilter() {
|
|
3830
3845
|
if (!this.filterRef.current) return;
|
|
3831
3846
|
this.filterRef.current.focus();
|
|
3832
|
-
util/* default
|
|
3847
|
+
util/* default */.c.setTimeout(() => {
|
|
3833
3848
|
if (!this.filterRef.current) return;
|
|
3834
3849
|
this.filterRef.current.focus();
|
|
3835
3850
|
}, 100);
|
|
3836
3851
|
}
|
|
3837
3852
|
renderDropdown() {
|
|
3838
3853
|
if (!this.state.show) return null;
|
|
3839
|
-
let $items = util/* default
|
|
3854
|
+
let $items = util/* default */.c.map(this.state.addresses, (addr, i) => {
|
|
3840
3855
|
let label = [((addr.address || '') + ' ' + normalize(addr.street)).trim()].join(', ');
|
|
3841
3856
|
let desc = [normalize(addr.ward), normalize(addr.district), normalize(addr.province)].join(', ');
|
|
3842
3857
|
return (0,preact_module.h)("div", {
|
|
@@ -3850,12 +3865,12 @@ class AddressPicker extends common/* Com */.up {
|
|
|
3850
3865
|
let $filter = null;
|
|
3851
3866
|
let $img = (0,preact_module.h)("img", {
|
|
3852
3867
|
class: "dropdown_select_filter__icon",
|
|
3853
|
-
src: __webpack_require__(
|
|
3868
|
+
src: __webpack_require__(6528)
|
|
3854
3869
|
});
|
|
3855
3870
|
if (this.props.loading) {
|
|
3856
3871
|
$img = (0,preact_module.h)("img", {
|
|
3857
3872
|
class: "dropdown_select_filter__icon",
|
|
3858
|
-
src: __webpack_require__(
|
|
3873
|
+
src: __webpack_require__(5616)
|
|
3859
3874
|
});
|
|
3860
3875
|
}
|
|
3861
3876
|
$filter = (0,preact_module.h)("div", {
|
|
@@ -3906,7 +3921,7 @@ class AddressPicker extends common/* Com */.up {
|
|
|
3906
3921
|
}
|
|
3907
3922
|
return (0,preact_module.h)("div", {
|
|
3908
3923
|
style: style
|
|
3909
|
-
}, (0,preact_module.h)(common/* Clickaway */.
|
|
3924
|
+
}, (0,preact_module.h)(common/* Clickaway */.C3, {
|
|
3910
3925
|
onClickaway: this.hideDropdown
|
|
3911
3926
|
}, (0,preact_module.h)("div", {
|
|
3912
3927
|
type: "text",
|
|
@@ -3933,45 +3948,45 @@ function normalize(s) {
|
|
|
3933
3948
|
}
|
|
3934
3949
|
;// CONCATENATED MODULE: ./src/order/icon.js
|
|
3935
3950
|
|
|
3936
|
-
let promiseMainCSS = (() => __webpack_require__.e(/* import() */
|
|
3951
|
+
let promiseMainCSS = (() => __webpack_require__.e(/* import() */ 176).then(__webpack_require__.bind(__webpack_require__, 6176)))();
|
|
3937
3952
|
var $link = document.createElement('link');
|
|
3938
3953
|
$link.href = 'https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap';
|
|
3939
3954
|
$link.rel = 'stylesheet';
|
|
3940
3955
|
document.head.append($link);
|
|
3941
|
-
util/* default
|
|
3956
|
+
util/* default */.c.preloadWebfonts(['Roboto'], [400, 500]);
|
|
3942
3957
|
|
|
3943
|
-
let icon_defaultAvatar = __webpack_require__(
|
|
3958
|
+
let icon_defaultAvatar = __webpack_require__(9460);
|
|
3944
3959
|
|
|
3945
3960
|
|
|
3946
3961
|
|
|
3947
|
-
class Icon extends common/* Com */.
|
|
3962
|
+
class Icon extends common/* Com */.Sq {
|
|
3948
3963
|
render() {
|
|
3949
3964
|
if (this.props.name == 'package') {
|
|
3950
3965
|
if (this.props.active) return (0,preact_module.h)("img", {
|
|
3951
3966
|
style: "width: 18px !important;",
|
|
3952
|
-
src: __webpack_require__(
|
|
3967
|
+
src: __webpack_require__(8224)
|
|
3953
3968
|
});
|
|
3954
3969
|
return (0,preact_module.h)("img", {
|
|
3955
3970
|
style: "width: 18px !important;",
|
|
3956
|
-
src: __webpack_require__(
|
|
3971
|
+
src: __webpack_require__(7848)
|
|
3957
3972
|
});
|
|
3958
3973
|
}
|
|
3959
3974
|
if (this.props.name === 'shop') {
|
|
3960
3975
|
if (this.props.active) return (0,preact_module.h)("img", {
|
|
3961
3976
|
style: "width: 18px !important;",
|
|
3962
|
-
src: __webpack_require__(
|
|
3977
|
+
src: __webpack_require__(428)
|
|
3963
3978
|
});
|
|
3964
3979
|
return (0,preact_module.h)("img", {
|
|
3965
3980
|
style: "width: 18px !important;",
|
|
3966
|
-
src: __webpack_require__(
|
|
3981
|
+
src: __webpack_require__(6083)
|
|
3967
3982
|
});
|
|
3968
3983
|
}
|
|
3969
3984
|
}
|
|
3970
3985
|
}
|
|
3971
3986
|
;// CONCATENATED MODULE: ./src/order/order.js
|
|
3972
3987
|
function order_defineProperty(obj, key, value) { key = order_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3973
|
-
function order_toPropertyKey(
|
|
3974
|
-
function order_toPrimitive(
|
|
3988
|
+
function order_toPropertyKey(t) { var i = order_toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
3989
|
+
function order_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
3975
3990
|
|
|
3976
3991
|
|
|
3977
3992
|
|
|
@@ -3980,9 +3995,9 @@ function order_toPrimitive(input, hint) { if (typeof input !== "object" || input
|
|
|
3980
3995
|
|
|
3981
3996
|
|
|
3982
3997
|
|
|
3983
|
-
var checkedimg = __webpack_require__(
|
|
3984
|
-
var ximg = __webpack_require__(
|
|
3985
|
-
class order_Order extends common/* Com */.
|
|
3998
|
+
var checkedimg = __webpack_require__(4548);
|
|
3999
|
+
var ximg = __webpack_require__(7400);
|
|
4000
|
+
class order_Order extends common/* Com */.Sq {
|
|
3986
4001
|
constructor(props) {
|
|
3987
4002
|
super(props);
|
|
3988
4003
|
order_defineProperty(this, "state", {
|
|
@@ -4045,7 +4060,7 @@ class order_Order extends common/* Com */.up {
|
|
|
4045
4060
|
loadDistrict: false
|
|
4046
4061
|
});
|
|
4047
4062
|
if (!out.error) this.setState({
|
|
4048
|
-
districts: util/* default
|
|
4063
|
+
districts: util/* default */.c.get(out, 'body.addresses')
|
|
4049
4064
|
});
|
|
4050
4065
|
});
|
|
4051
4066
|
order_defineProperty(this, "onSelectDistrict", async item => {
|
|
@@ -4064,7 +4079,7 @@ class order_Order extends common/* Com */.up {
|
|
|
4064
4079
|
loadWard: false
|
|
4065
4080
|
});
|
|
4066
4081
|
if (!out.error) this.setState({
|
|
4067
|
-
wards: util/* default
|
|
4082
|
+
wards: util/* default */.c.get(out, 'body.addresses')
|
|
4068
4083
|
});
|
|
4069
4084
|
});
|
|
4070
4085
|
order_defineProperty(this, "onSelectWard", item => this.setState({
|
|
@@ -4085,7 +4100,7 @@ class order_Order extends common/* Com */.up {
|
|
|
4085
4100
|
order_defineProperty(this, "onSelectAddress", addr => {
|
|
4086
4101
|
if (!addr) return;
|
|
4087
4102
|
this.setState({
|
|
4088
|
-
address: [util/* default
|
|
4103
|
+
address: [util/* default */.c.trim(addr.address), util/* default */.c.trim(addr.street)].join(' ').trim(),
|
|
4089
4104
|
street: addr.street,
|
|
4090
4105
|
err: {},
|
|
4091
4106
|
g_err: ''
|
|
@@ -4132,36 +4147,36 @@ class order_Order extends common/* Com */.up {
|
|
|
4132
4147
|
});
|
|
4133
4148
|
}
|
|
4134
4149
|
if (this.state.shipping === 'shop') {
|
|
4135
|
-
if (!util/* default
|
|
4150
|
+
if (!util/* default */.c.isPhone(this.state.phone)) {
|
|
4136
4151
|
err.phone = true;
|
|
4137
4152
|
}
|
|
4138
|
-
if (!util/* default
|
|
4153
|
+
if (!util/* default */.c.trim(this.state.fullname)) {
|
|
4139
4154
|
err.name = true;
|
|
4140
4155
|
}
|
|
4141
|
-
if (!util/* default
|
|
4156
|
+
if (!util/* default */.c.trim(this.state.email)) {
|
|
4142
4157
|
err.email = true;
|
|
4143
4158
|
}
|
|
4144
4159
|
} else if (this.state.shipping_address == 'new') {
|
|
4145
|
-
if (!util/* default
|
|
4160
|
+
if (!util/* default */.c.isPhone(this.state.phone)) {
|
|
4146
4161
|
err.phone = true;
|
|
4147
4162
|
}
|
|
4148
|
-
if (!util/* default
|
|
4163
|
+
if (!util/* default */.c.trim(this.state.fullname)) {
|
|
4149
4164
|
err.name = true;
|
|
4150
4165
|
}
|
|
4151
|
-
if (!util/* default
|
|
4166
|
+
if (!util/* default */.c.trim(this.state.address)) {
|
|
4152
4167
|
err.address = true;
|
|
4153
4168
|
}
|
|
4154
|
-
if (util/* default
|
|
4169
|
+
if (util/* default */.c.size(this.state.selectedWard) == 0) {
|
|
4155
4170
|
err.ward = true;
|
|
4156
4171
|
}
|
|
4157
|
-
if (util/* default
|
|
4172
|
+
if (util/* default */.c.size(this.state.selectedDistrict) == 0) {
|
|
4158
4173
|
err.district = true;
|
|
4159
4174
|
}
|
|
4160
|
-
if (util/* default
|
|
4175
|
+
if (util/* default */.c.size(this.state.selectedProvince) == 0) {
|
|
4161
4176
|
err.province = true;
|
|
4162
4177
|
}
|
|
4163
4178
|
}
|
|
4164
|
-
if (util/* default
|
|
4179
|
+
if (util/* default */.c.size(err) > 0) {
|
|
4165
4180
|
this.setState({
|
|
4166
4181
|
err,
|
|
4167
4182
|
g_err: this.props.t('input_shipping_info_err')
|
|
@@ -4169,15 +4184,15 @@ class order_Order extends common/* Com */.up {
|
|
|
4169
4184
|
return;
|
|
4170
4185
|
}
|
|
4171
4186
|
let user = this.props.store.matchUser();
|
|
4172
|
-
let ufullname = util/* default
|
|
4173
|
-
let uemail = util/* default
|
|
4174
|
-
let uphone = util/* default
|
|
4175
|
-
let order = util/* default
|
|
4187
|
+
let ufullname = util/* default */.c.getUserAttr(user, 'fullname', 'text');
|
|
4188
|
+
let uemail = util/* default */.c.getUserAttr(user, 'emails', 'text');
|
|
4189
|
+
let uphone = util/* default */.c.getUserAttr(user, 'phones', 'text');
|
|
4190
|
+
let order = util/* default */.c.cloneDeep(this.state.order);
|
|
4176
4191
|
if (this.state.shipping === 'shop') {
|
|
4177
|
-
util/* default
|
|
4178
|
-
util/* default
|
|
4179
|
-
util/* default
|
|
4180
|
-
util/* default
|
|
4192
|
+
util/* default */.c.set(order, 'shipping.pickup_at_shop', true);
|
|
4193
|
+
util/* default */.c.set(order, 'shipping.address.phone', this.state.phone);
|
|
4194
|
+
util/* default */.c.set(order, 'shipping.address.fullname', this.state.fullname);
|
|
4195
|
+
util/* default */.c.set(order, 'shipping.address.email', this.state.email);
|
|
4181
4196
|
} else {
|
|
4182
4197
|
if (this.state.shipping_address == 'new') {
|
|
4183
4198
|
let out = await this.props.store.createShippingAddress({
|
|
@@ -4197,37 +4212,37 @@ class order_Order extends common/* Com */.up {
|
|
|
4197
4212
|
if (out.error) return this.setState({
|
|
4198
4213
|
g_err: this.props.t('update_failed')
|
|
4199
4214
|
});
|
|
4200
|
-
util/* default
|
|
4215
|
+
util/* default */.c.set(order, 'shipping.address', out.body);
|
|
4201
4216
|
} else {
|
|
4202
4217
|
let addresses = this.props.store.matchShippingAddresses();
|
|
4203
|
-
let sa = util/* default
|
|
4218
|
+
let sa = util/* default */.c.find(addresses, addr => addr.id === this.state.shipping_address);
|
|
4204
4219
|
if (!sa) {
|
|
4205
4220
|
return this.setState({
|
|
4206
4221
|
err,
|
|
4207
4222
|
g_err: this.props.t('input_shipping_info_err')
|
|
4208
4223
|
});
|
|
4209
4224
|
}
|
|
4210
|
-
util/* default
|
|
4225
|
+
util/* default */.c.set(order, 'shipping.address', sa);
|
|
4211
4226
|
}
|
|
4212
4227
|
}
|
|
4213
4228
|
let changeduser = false;
|
|
4214
4229
|
if (!ufullname && this.state.fullname) {
|
|
4215
4230
|
changeduser = true;
|
|
4216
|
-
util/* default
|
|
4231
|
+
util/* default */.c.setUserAttr(user, {
|
|
4217
4232
|
key: 'fullname',
|
|
4218
4233
|
text: this.state.fullname
|
|
4219
4234
|
});
|
|
4220
4235
|
}
|
|
4221
4236
|
if (!uemail && this.state.email) {
|
|
4222
4237
|
changeduser = true;
|
|
4223
|
-
util/* default
|
|
4238
|
+
util/* default */.c.setUserAttr(user, {
|
|
4224
4239
|
key: 'emails',
|
|
4225
4240
|
text: this.state.email
|
|
4226
4241
|
});
|
|
4227
4242
|
}
|
|
4228
4243
|
if (!uphone && this.state.phone) {
|
|
4229
4244
|
changeduser = true;
|
|
4230
|
-
util/* default
|
|
4245
|
+
util/* default */.c.setUserAttr(user, {
|
|
4231
4246
|
key: 'phones',
|
|
4232
4247
|
text: this.state.phone
|
|
4233
4248
|
});
|
|
@@ -4254,7 +4269,7 @@ class order_Order extends common/* Com */.up {
|
|
|
4254
4269
|
order_defineProperty(this, "onCancel", () => {
|
|
4255
4270
|
if (this.props.onResponse) this.props.onResponse('rejected');
|
|
4256
4271
|
if (this.props.cid && !this.state.order.user_confirmation) {
|
|
4257
|
-
let order = util/* default
|
|
4272
|
+
let order = util/* default */.c.cloneDeep(this.state.order);
|
|
4258
4273
|
order.user_confirmation = 'rejected';
|
|
4259
4274
|
this.props.store.updateOrder(order);
|
|
4260
4275
|
}
|
|
@@ -4281,10 +4296,10 @@ class order_Order extends common/* Com */.up {
|
|
|
4281
4296
|
});
|
|
4282
4297
|
}
|
|
4283
4298
|
let user = this.props.store.matchUser();
|
|
4284
|
-
let attributes = util/* default
|
|
4285
|
-
let fullname = util/* default
|
|
4286
|
-
let email = util/* default
|
|
4287
|
-
let phone = util/* default
|
|
4299
|
+
let attributes = util/* default */.c.get(this.props.store.matchUser(), 'attributes', []);
|
|
4300
|
+
let fullname = util/* default */.c.get(util/* default */.c.find(attributes, att => att.key === 'fullname'), 'text');
|
|
4301
|
+
let email = util/* default */.c.get(util/* default */.c.find(attributes, att => att.key === 'emails'), 'text');
|
|
4302
|
+
let phone = util/* default */.c.get(util/* default */.c.find(attributes, att => att.key === 'phones'), 'text');
|
|
4288
4303
|
this.setState({
|
|
4289
4304
|
fullname,
|
|
4290
4305
|
email,
|
|
@@ -4296,7 +4311,7 @@ class order_Order extends common/* Com */.up {
|
|
|
4296
4311
|
loadProvince: false
|
|
4297
4312
|
});
|
|
4298
4313
|
if (!out.error) this.setState({
|
|
4299
|
-
provinces: util/* default
|
|
4314
|
+
provinces: util/* default */.c.get(out, 'body.addresses')
|
|
4300
4315
|
});
|
|
4301
4316
|
}
|
|
4302
4317
|
isMobile() {
|
|
@@ -4326,7 +4341,7 @@ class order_Order extends common/* Com */.up {
|
|
|
4326
4341
|
}
|
|
4327
4342
|
if (editmode) {
|
|
4328
4343
|
let pms = this.props.store.matchPaymentMethods();
|
|
4329
|
-
let $pms = util/* default
|
|
4344
|
+
let $pms = util/* default */.c.map(pms, pm => {
|
|
4330
4345
|
let $name = pm.description;
|
|
4331
4346
|
if (pm.method == 'bank_transfer') {
|
|
4332
4347
|
$name = pm.description + ' ' + pm.bank_name + ' ' + pm.bank_branch;
|
|
@@ -4368,7 +4383,7 @@ class order_Order extends common/* Com */.up {
|
|
|
4368
4383
|
});
|
|
4369
4384
|
let seccls = 'card_section';
|
|
4370
4385
|
if (this.isMobile()) seccls = 'order_section';
|
|
4371
|
-
return (0,preact_module.h)(preact_module/* Fragment */.
|
|
4386
|
+
return (0,preact_module.h)(preact_module/* Fragment */.ae, null, (0,preact_module.h)("div", {
|
|
4372
4387
|
class: "order_section__line"
|
|
4373
4388
|
}), (0,preact_module.h)("div", {
|
|
4374
4389
|
class: seccls
|
|
@@ -4395,7 +4410,7 @@ class order_Order extends common/* Com */.up {
|
|
|
4395
4410
|
}, "S\u1ED1 t\xE0i kho\u1EA3n: ", pm.bank_number));
|
|
4396
4411
|
}
|
|
4397
4412
|
if (!$body) return null;
|
|
4398
|
-
return (0,preact_module.h)(preact_module/* Fragment */.
|
|
4413
|
+
return (0,preact_module.h)(preact_module/* Fragment */.ae, null, (0,preact_module.h)("div", {
|
|
4399
4414
|
class: "order_label"
|
|
4400
4415
|
}, this.props.t('payment')), $body);
|
|
4401
4416
|
}
|
|
@@ -4407,15 +4422,15 @@ class order_Order extends common/* Com */.up {
|
|
|
4407
4422
|
let user = this.props.store.matchUser();
|
|
4408
4423
|
if (editmode) {
|
|
4409
4424
|
let addresses = this.props.store.matchShippingAddresses();
|
|
4410
|
-
let provinces = util/* default
|
|
4425
|
+
let provinces = util/* default */.c.map(this.state.provinces, province => ({
|
|
4411
4426
|
id: province.id,
|
|
4412
4427
|
name: province.province
|
|
4413
4428
|
}));
|
|
4414
|
-
let districts = util/* default
|
|
4429
|
+
let districts = util/* default */.c.map(this.state.districts, district => ({
|
|
4415
4430
|
id: district.id,
|
|
4416
4431
|
name: district.district
|
|
4417
4432
|
}));
|
|
4418
|
-
let wards = util/* default
|
|
4433
|
+
let wards = util/* default */.c.map(this.state.wards, ward => ({
|
|
4419
4434
|
id: ward.id,
|
|
4420
4435
|
name: ward.ward
|
|
4421
4436
|
}));
|
|
@@ -4424,11 +4439,11 @@ class order_Order extends common/* Com */.up {
|
|
|
4424
4439
|
let ship_icon_active = false;
|
|
4425
4440
|
if (this.state.shipping === 'ship') {
|
|
4426
4441
|
ship_icon_active = true;
|
|
4427
|
-
let $preaddrs = util/* default
|
|
4442
|
+
let $preaddrs = util/* default */.c.map(addresses, addr => {
|
|
4428
4443
|
let fulladdr = [addr.street, addr.ward, addr.district, addr.region, addr.country].filter(a => a).join(', ');
|
|
4429
4444
|
let $phone = null;
|
|
4430
4445
|
if (addr.phone) {
|
|
4431
|
-
$phone = (0,preact_module.h)(preact_module/* Fragment */.
|
|
4446
|
+
$phone = (0,preact_module.h)(preact_module/* Fragment */.ae, null, "\xA0\xB7\xA0", this.props.t('phn'), " ", addr.phone);
|
|
4432
4447
|
}
|
|
4433
4448
|
return (0,preact_module.h)("div", {
|
|
4434
4449
|
style: "margin-bottom: 15px !important"
|
|
@@ -4556,7 +4571,7 @@ class order_Order extends common/* Com */.up {
|
|
|
4556
4571
|
style: "flex: 1 !important; margin-left: 7px !important;"
|
|
4557
4572
|
})));
|
|
4558
4573
|
cls += ' ship_card__active';
|
|
4559
|
-
if (util/* default
|
|
4574
|
+
if (util/* default */.c.size(addresses) == 0) {
|
|
4560
4575
|
$body = (0,preact_module.h)("div", null, (0,preact_module.h)("div", {
|
|
4561
4576
|
class: 'mt-3 mb-2 '
|
|
4562
4577
|
}, this.props.t('input_shipping_info')), $new);
|
|
@@ -4608,7 +4623,7 @@ class order_Order extends common/* Com */.up {
|
|
|
4608
4623
|
}
|
|
4609
4624
|
let seccls = 'card_section';
|
|
4610
4625
|
if (this.isMobile()) seccls = 'order_section';
|
|
4611
|
-
return (0,preact_module.h)(preact_module/* Fragment */.
|
|
4626
|
+
return (0,preact_module.h)(preact_module/* Fragment */.ae, null, (0,preact_module.h)("div", {
|
|
4612
4627
|
class: "order_section__line"
|
|
4613
4628
|
}), (0,preact_module.h)("div", {
|
|
4614
4629
|
class: seccls
|
|
@@ -4634,13 +4649,13 @@ class order_Order extends common/* Com */.up {
|
|
|
4634
4649
|
class: "ml-2"
|
|
4635
4650
|
}, "Giao h\xE0ng cho t\xF4i"))), $body));
|
|
4636
4651
|
}
|
|
4637
|
-
let addr = util/* default
|
|
4652
|
+
let addr = util/* default */.c.get(order, 'shipping.address') || {};
|
|
4638
4653
|
let fulladdr = [addr.address, addr.ward, addr.district, addr.region, addr.country].filter(a => a).join(', ');
|
|
4639
4654
|
let $phone = null;
|
|
4640
4655
|
if (addr.phone) $phone = (0,preact_module.h)("div", {
|
|
4641
4656
|
class: "mt-1 muted"
|
|
4642
4657
|
}, this.props.t('phn'), ":\xA0", addr.phone);
|
|
4643
|
-
if (util/* default
|
|
4658
|
+
if (util/* default */.c.get(order, 'shipping.pickup_at_shop')) {
|
|
4644
4659
|
fulladdr = 'Nhận hàng tại cửa hàng';
|
|
4645
4660
|
}
|
|
4646
4661
|
let $addr = fulladdr ? (0,preact_module.h)("div", null, fulladdr) : (0,preact_module.h)("i", {
|
|
@@ -4659,28 +4674,28 @@ class order_Order extends common/* Com */.up {
|
|
|
4659
4674
|
if (order.deposit > 0) {
|
|
4660
4675
|
$deposit = (0,preact_module.h)("span", {
|
|
4661
4676
|
class: "muted"
|
|
4662
|
-
}, "(c\u1ECDc ", util/* default
|
|
4677
|
+
}, "(c\u1ECDc ", util/* default */.c.formatCurrency(order.deposit), ")");
|
|
4663
4678
|
}
|
|
4664
4679
|
let $discount = null;
|
|
4665
4680
|
if (order.total_discount > 0) {
|
|
4666
4681
|
$discount = (0,preact_module.h)("div", {
|
|
4667
4682
|
class: "order_summary_line"
|
|
4668
|
-
}, (0,preact_module.h)("div", null, "Gi\u1EA3m gi\xE1"), (0,preact_module.h)("div", null, util/* default
|
|
4683
|
+
}, (0,preact_module.h)("div", null, "Gi\u1EA3m gi\xE1"), (0,preact_module.h)("div", null, util/* default */.c.formatCurrency(order.total_discount)));
|
|
4669
4684
|
}
|
|
4670
4685
|
let $pay = null;
|
|
4671
4686
|
if ($deposit || order.payment_made) {
|
|
4672
|
-
$pay = (0,preact_module.h)(preact_module/* Fragment */.
|
|
4687
|
+
$pay = (0,preact_module.h)(preact_module/* Fragment */.ae, null, (0,preact_module.h)("div", {
|
|
4673
4688
|
class: "order_summary_line"
|
|
4674
|
-
}, (0,preact_module.h)("div", null, "B\u1EA1n \u0111\xE3 tr\u1EA3"), (0,preact_module.h)("div", null, $deposit, " ", util/* default
|
|
4689
|
+
}, (0,preact_module.h)("div", null, "B\u1EA1n \u0111\xE3 tr\u1EA3"), (0,preact_module.h)("div", null, $deposit, " ", util/* default */.c.formatCurrency(order.payment_made))), (0,preact_module.h)("div", {
|
|
4675
4690
|
class: "order_summary_line"
|
|
4676
|
-
}, (0,preact_module.h)("div", null, "B\u1EA1n ch\u01B0a tr\u1EA3"), (0,preact_module.h)("div", null, util/* default
|
|
4691
|
+
}, (0,preact_module.h)("div", null, "B\u1EA1n ch\u01B0a tr\u1EA3"), (0,preact_module.h)("div", null, util/* default */.c.formatCurrency((order.total || 0) - (order.payment_made || 0)))));
|
|
4677
4692
|
}
|
|
4678
4693
|
let $tax = (0,preact_module.h)("div", {
|
|
4679
4694
|
class: "order_summary_line"
|
|
4680
|
-
}, (0,preact_module.h)("div", null, "Ti\u1EC1n thu\u1EBF"), (0,preact_module.h)("div", null, util/* default
|
|
4695
|
+
}, (0,preact_module.h)("div", null, "Ti\u1EC1n thu\u1EBF"), (0,preact_module.h)("div", null, util/* default */.c.formatCurrency(order.total_tax)));
|
|
4681
4696
|
let $ship = (0,preact_module.h)("div", {
|
|
4682
4697
|
class: "order_summary_line"
|
|
4683
|
-
}, (0,preact_module.h)("div", null, "Ph\xED v\u1EADn chuy\u1EC3n"), (0,preact_module.h)("div", null, util/* default
|
|
4698
|
+
}, (0,preact_module.h)("div", null, "Ph\xED v\u1EADn chuy\u1EC3n"), (0,preact_module.h)("div", null, util/* default */.c.get(order, 'shipping.fee', 0), " d"));
|
|
4684
4699
|
let editmode = false;
|
|
4685
4700
|
if (!order.status || order.status == 'open') {
|
|
4686
4701
|
editmode = !order.user_confirmation;
|
|
@@ -4693,12 +4708,12 @@ class order_Order extends common/* Com */.up {
|
|
|
4693
4708
|
class: "muted"
|
|
4694
4709
|
}, (0,preact_module.h)("img", {
|
|
4695
4710
|
class: "order_ship_icon",
|
|
4696
|
-
src: __webpack_require__(
|
|
4711
|
+
src: __webpack_require__(3576)
|
|
4697
4712
|
}), "\xA0 Ch\u01B0a bao g\u1ED3m thu\u1EBF v\xE0 ph\xED v\u1EADn chuy\u1EC3n");
|
|
4698
4713
|
}
|
|
4699
4714
|
let seccls = '';
|
|
4700
4715
|
if (this.isMobile()) seccls = 'order_section';
|
|
4701
|
-
return (0,preact_module.h)(preact_module/* Fragment */.
|
|
4716
|
+
return (0,preact_module.h)(preact_module/* Fragment */.ae, null, (0,preact_module.h)("div", {
|
|
4702
4717
|
class: "order_section__line"
|
|
4703
4718
|
}), (0,preact_module.h)("div", {
|
|
4704
4719
|
class: seccls
|
|
@@ -4706,12 +4721,12 @@ class order_Order extends common/* Com */.up {
|
|
|
4706
4721
|
class: "order_label"
|
|
4707
4722
|
}, "T\xF3m t\u1EAFt"), (0,preact_module.h)("div", {
|
|
4708
4723
|
class: "order_summary_line"
|
|
4709
|
-
}, (0,preact_module.h)("div", null, "T\u1ED5ng ti\u1EC1n h\xE0ng"), (0,preact_module.h)("div", null, util/* default
|
|
4724
|
+
}, (0,preact_module.h)("div", null, "T\u1ED5ng ti\u1EC1n h\xE0ng"), (0,preact_module.h)("div", null, util/* default */.c.formatCurrency(order.subtotal))), $tax, $discount, $ship, $note, (0,preact_module.h)("div", {
|
|
4710
4725
|
class: "order_summary_line",
|
|
4711
4726
|
style: "margin-top: 10px !important; padding-top: 15px !important; border-top: 1px solid #eee !important"
|
|
4712
4727
|
}, (0,preact_module.h)("div", null, "B\u1EA1n ph\u1EA3i tr\u1EA3"), (0,preact_module.h)("div", {
|
|
4713
4728
|
class: "order__total"
|
|
4714
|
-
}, util/* default
|
|
4729
|
+
}, util/* default */.c.formatCurrency(order.total))), $pay));
|
|
4715
4730
|
}
|
|
4716
4731
|
renderStatusBadge(order) {
|
|
4717
4732
|
let status = order.status || 'open';
|
|
@@ -4722,9 +4737,9 @@ class order_Order extends common/* Com */.up {
|
|
|
4722
4737
|
}
|
|
4723
4738
|
renderShippingInfo(order) {
|
|
4724
4739
|
if (order.status != 'open' || order.user_confirmation) {}
|
|
4725
|
-
let shipping_provider = util/* default
|
|
4740
|
+
let shipping_provider = util/* default */.c.get(order, 'shipping.shipping_provider');
|
|
4726
4741
|
if (!shipping_provider) return null;
|
|
4727
|
-
let shipping_code = util/* default
|
|
4742
|
+
let shipping_code = util/* default */.c.get(order, 'shipping.shipping_code');
|
|
4728
4743
|
let $tracking_code = null;
|
|
4729
4744
|
if (shipping_code) $tracking_code = (0,preact_module.h)("div", {
|
|
4730
4745
|
class: "muted",
|
|
@@ -4735,7 +4750,7 @@ class order_Order extends common/* Com */.up {
|
|
|
4735
4750
|
href: 'https://giaohangtietkiem.vn/tra-cuu-van-don/' + shipping_code
|
|
4736
4751
|
}, shipping_code, "\xA0", (0,preact_module.h)("img", {
|
|
4737
4752
|
class: "order_tracking_link_icon",
|
|
4738
|
-
src: __webpack_require__(
|
|
4753
|
+
src: __webpack_require__(928)
|
|
4739
4754
|
})));
|
|
4740
4755
|
if (shipping_provider == 'ghtk') {
|
|
4741
4756
|
return (0,preact_module.h)("div", {
|
|
@@ -4752,9 +4767,9 @@ class order_Order extends common/* Com */.up {
|
|
|
4752
4767
|
return null;
|
|
4753
4768
|
}
|
|
4754
4769
|
renderDesktopShippingInfo(order) {
|
|
4755
|
-
let shipping_provider = util/* default
|
|
4770
|
+
let shipping_provider = util/* default */.c.get(order, 'shipping.shipping_provider');
|
|
4756
4771
|
if (!shipping_provider) return null;
|
|
4757
|
-
let shipping_code = util/* default
|
|
4772
|
+
let shipping_code = util/* default */.c.get(order, 'shipping.shipping_code');
|
|
4758
4773
|
let $tracking_code = null;
|
|
4759
4774
|
if (shipping_code) $tracking_code = (0,preact_module.h)("div", {
|
|
4760
4775
|
class: "muted",
|
|
@@ -4765,10 +4780,10 @@ class order_Order extends common/* Com */.up {
|
|
|
4765
4780
|
href: 'https://giaohangtietkiem.vn/tra-cuu-van-don/' + shipping_code
|
|
4766
4781
|
}, shipping_code, "\xA0", (0,preact_module.h)("img", {
|
|
4767
4782
|
class: "order_tracking_link_icon",
|
|
4768
|
-
src: __webpack_require__(
|
|
4783
|
+
src: __webpack_require__(928)
|
|
4769
4784
|
})));
|
|
4770
4785
|
if (shipping_provider == 'ghtk') {
|
|
4771
|
-
return (0,preact_module.h)(preact_module/* Fragment */.
|
|
4786
|
+
return (0,preact_module.h)(preact_module/* Fragment */.ae, null, (0,preact_module.h)("div", {
|
|
4772
4787
|
class: "order_label"
|
|
4773
4788
|
}, "\u0110\u01A1n v\u1ECB v\u1EADn chuy\u1EC3n"), (0,preact_module.h)("div", {
|
|
4774
4789
|
class: "d-flex align-items-center"
|
|
@@ -4781,7 +4796,7 @@ class order_Order extends common/* Com */.up {
|
|
|
4781
4796
|
}
|
|
4782
4797
|
renderProducts(order) {
|
|
4783
4798
|
let $products = null;
|
|
4784
|
-
$products = util/* default
|
|
4799
|
+
$products = util/* default */.c.map(order.items, item => {
|
|
4785
4800
|
if (!item || !item.product) return null;
|
|
4786
4801
|
let product = item.product;
|
|
4787
4802
|
return (0,preact_module.h)("div", {
|
|
@@ -4789,7 +4804,7 @@ class order_Order extends common/* Com */.up {
|
|
|
4789
4804
|
}, (0,preact_module.h)("img", {
|
|
4790
4805
|
class: "order_attachment__product_img",
|
|
4791
4806
|
alt: '' + product.id,
|
|
4792
|
-
src: util/* default
|
|
4807
|
+
src: util/* default */.c.get(product, 'images.0') || __webpack_require__(4824)
|
|
4793
4808
|
}), (0,preact_module.h)("div", {
|
|
4794
4809
|
style: "overflow: hidden !important;"
|
|
4795
4810
|
}, (0,preact_module.h)("div", {
|
|
@@ -4798,7 +4813,7 @@ class order_Order extends common/* Com */.up {
|
|
|
4798
4813
|
class: "order_attachment__product_desc"
|
|
4799
4814
|
}, product.description || product.long_description), (0,preact_module.h)("div", {
|
|
4800
4815
|
class: "order_attachment__product_desc"
|
|
4801
|
-
}, this.props.t('qty'), " ", item.quantity, "\xA0\xB7\xA0", util/* default
|
|
4816
|
+
}, this.props.t('qty'), " ", item.quantity, "\xA0\xB7\xA0", util/* default */.c.formatCurrency(product.price))));
|
|
4802
4817
|
});
|
|
4803
4818
|
if (!this.isMobile()) return (0,preact_module.h)("div", null, (0,preact_module.h)("div", {
|
|
4804
4819
|
class: "order_label"
|
|
@@ -4816,7 +4831,7 @@ class order_Order extends common/* Com */.up {
|
|
|
4816
4831
|
editmode = !order.user_confirmation;
|
|
4817
4832
|
}
|
|
4818
4833
|
if (editmode) {
|
|
4819
|
-
$products = util/* default
|
|
4834
|
+
$products = util/* default */.c.map(order.items, item => {
|
|
4820
4835
|
if (!item || !item.product) return null;
|
|
4821
4836
|
let product = item.product;
|
|
4822
4837
|
return (0,preact_module.h)("div", {
|
|
@@ -4824,7 +4839,7 @@ class order_Order extends common/* Com */.up {
|
|
|
4824
4839
|
}, (0,preact_module.h)("img", {
|
|
4825
4840
|
class: "order_attachment__product_img",
|
|
4826
4841
|
alt: '' + product.id,
|
|
4827
|
-
src: util/* default
|
|
4842
|
+
src: util/* default */.c.get(product, 'images.0') || __webpack_require__(4824)
|
|
4828
4843
|
}), (0,preact_module.h)("div", {
|
|
4829
4844
|
style: "overflow: hidden !important; flex: 1 !important"
|
|
4830
4845
|
}, (0,preact_module.h)("div", {
|
|
@@ -4833,7 +4848,7 @@ class order_Order extends common/* Com */.up {
|
|
|
4833
4848
|
class: "order_attachment__product_desc"
|
|
4834
4849
|
}, product.description || product.long_description), (0,preact_module.h)("div", {
|
|
4835
4850
|
class: "order_attachment__product_desc"
|
|
4836
|
-
}, util/* default
|
|
4851
|
+
}, util/* default */.c.formatCurrency(product.price))), (0,preact_module.h)("input", {
|
|
4837
4852
|
class: "form-control",
|
|
4838
4853
|
style: "text-align: center !important; font-weight: 400 !important; width: 50px !important",
|
|
4839
4854
|
value: item.quantity,
|
|
@@ -4841,10 +4856,10 @@ class order_Order extends common/* Com */.up {
|
|
|
4841
4856
|
type: "text"
|
|
4842
4857
|
}), (0,preact_module.h)("div", {
|
|
4843
4858
|
style: "width: 80px !important; text-align: right !important; "
|
|
4844
|
-
}, (0,preact_module.h)("b", null, util/* default
|
|
4859
|
+
}, (0,preact_module.h)("b", null, util/* default */.c.formatCurrency(item.quantity * product.price))));
|
|
4845
4860
|
});
|
|
4846
4861
|
} else {
|
|
4847
|
-
$products = util/* default
|
|
4862
|
+
$products = util/* default */.c.map(order.items, item => {
|
|
4848
4863
|
if (!item || !item.product) return null;
|
|
4849
4864
|
let product = item.product;
|
|
4850
4865
|
return (0,preact_module.h)("div", {
|
|
@@ -4852,7 +4867,7 @@ class order_Order extends common/* Com */.up {
|
|
|
4852
4867
|
}, (0,preact_module.h)("img", {
|
|
4853
4868
|
class: "order_attachment__product_img",
|
|
4854
4869
|
alt: '' + product.id,
|
|
4855
|
-
src: util/* default
|
|
4870
|
+
src: util/* default */.c.get(product, 'images.0') || __webpack_require__(4824)
|
|
4856
4871
|
}), (0,preact_module.h)("div", {
|
|
4857
4872
|
style: "overflow: hidden !important; flex: 1 !important"
|
|
4858
4873
|
}, (0,preact_module.h)("div", {
|
|
@@ -4861,11 +4876,11 @@ class order_Order extends common/* Com */.up {
|
|
|
4861
4876
|
class: "order_attachment__product_desc"
|
|
4862
4877
|
}, product.description || product.long_description), (0,preact_module.h)("div", {
|
|
4863
4878
|
class: "order_attachment__product_desc"
|
|
4864
|
-
}, util/* default
|
|
4879
|
+
}, util/* default */.c.formatCurrency(product.price))), (0,preact_module.h)("div", {
|
|
4865
4880
|
style: "text-align: center !important; font-weight: 400 !important; width: 50px !important"
|
|
4866
4881
|
}, item.quantity), (0,preact_module.h)("div", {
|
|
4867
4882
|
style: "width: 80px !important; text-align: right !important; "
|
|
4868
|
-
}, (0,preact_module.h)("b", null, util/* default
|
|
4883
|
+
}, (0,preact_module.h)("b", null, util/* default */.c.formatCurrency(item.total))));
|
|
4869
4884
|
});
|
|
4870
4885
|
}
|
|
4871
4886
|
return (0,preact_module.h)("div", {
|
|
@@ -4973,7 +4988,7 @@ class order_Order extends common/* Com */.up {
|
|
|
4973
4988
|
}
|
|
4974
4989
|
renderDesktop(order) {
|
|
4975
4990
|
let acc = this.props.store.matchAccount();
|
|
4976
|
-
var uri = acc.logo_url || __webpack_require__(
|
|
4991
|
+
var uri = acc.logo_url || __webpack_require__(6980);
|
|
4977
4992
|
return (0,preact_module.h)("div", {
|
|
4978
4993
|
class: "desktop order"
|
|
4979
4994
|
}, (0,preact_module.h)("div", {
|
|
@@ -5019,7 +5034,7 @@ class order_Order extends common/* Com */.up {
|
|
|
5019
5034
|
class: "order_error"
|
|
5020
5035
|
}, (0,preact_module.h)("img", {
|
|
5021
5036
|
class: "mt-3",
|
|
5022
|
-
src: __webpack_require__(
|
|
5037
|
+
src: __webpack_require__(1020)
|
|
5023
5038
|
}), (0,preact_module.h)("div", {
|
|
5024
5039
|
class: "mt-3"
|
|
5025
5040
|
}, this.props.t('order_load_error')));
|
|
@@ -5031,28 +5046,28 @@ class order_Order extends common/* Com */.up {
|
|
|
5031
5046
|
let ShippingProvider = {
|
|
5032
5047
|
ghtk: {
|
|
5033
5048
|
name: 'Giao hàng tiết kiệm',
|
|
5034
|
-
logo: __webpack_require__(
|
|
5049
|
+
logo: __webpack_require__(9256)
|
|
5035
5050
|
},
|
|
5036
5051
|
ghn: {
|
|
5037
5052
|
name: 'Giao hàng nhanh',
|
|
5038
|
-
logo: __webpack_require__(
|
|
5053
|
+
logo: __webpack_require__(3964)
|
|
5039
5054
|
}
|
|
5040
5055
|
};
|
|
5041
5056
|
;// CONCATENATED MODULE: ./src/chatbox/Order.js
|
|
5042
5057
|
function Order_defineProperty(obj, key, value) { key = Order_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5043
|
-
function Order_toPropertyKey(
|
|
5044
|
-
function Order_toPrimitive(
|
|
5058
|
+
function Order_toPropertyKey(t) { var i = Order_toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
5059
|
+
function Order_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5045
5060
|
|
|
5046
5061
|
|
|
5047
5062
|
|
|
5048
5063
|
const Order_POPUP_MAX_HEIGHT = 400;
|
|
5049
5064
|
const Order_POPUP_HARD_MAX_HEIGHT = 500;
|
|
5050
5065
|
const Order_POPUP_MIN_HEIGHT = 0;
|
|
5051
|
-
let Order_defaultAvatar = __webpack_require__(
|
|
5066
|
+
let Order_defaultAvatar = __webpack_require__(9460);
|
|
5052
5067
|
|
|
5053
5068
|
|
|
5054
5069
|
|
|
5055
|
-
class Order extends common/* Com */.
|
|
5070
|
+
class Order extends common/* Com */.Sq {
|
|
5056
5071
|
constructor(props) {
|
|
5057
5072
|
super(props);
|
|
5058
5073
|
Order_defineProperty(this, "state", {
|
|
@@ -5083,7 +5098,7 @@ class Order extends common/* Com */.up {
|
|
|
5083
5098
|
});
|
|
5084
5099
|
});
|
|
5085
5100
|
Order_defineProperty(this, "close", async () => {
|
|
5086
|
-
await util/* default
|
|
5101
|
+
await util/* default */.c.sleep(100);
|
|
5087
5102
|
if (this.state.response === 'confirmed') {
|
|
5088
5103
|
this.props.store.sendConvoEvent(this.props.cid, 'message_sent', {
|
|
5089
5104
|
message: {
|
|
@@ -5139,8 +5154,8 @@ class Order extends common/* Com */.up {
|
|
|
5139
5154
|
});
|
|
5140
5155
|
this.props.onClose();
|
|
5141
5156
|
});
|
|
5142
|
-
this.refRating = (0,preact_module/* createRef */.
|
|
5143
|
-
this.refHandle = (0,preact_module/* createRef */.
|
|
5157
|
+
this.refRating = (0,preact_module/* createRef */.Yn)();
|
|
5158
|
+
this.refHandle = (0,preact_module/* createRef */.Yn)();
|
|
5144
5159
|
}
|
|
5145
5160
|
componentDidMount() {
|
|
5146
5161
|
this.mouseUp = e => this.onMouseUp(e);
|
|
@@ -5184,7 +5199,7 @@ class Order extends common/* Com */.up {
|
|
|
5184
5199
|
render() {
|
|
5185
5200
|
if (this._show != this.props.show) {
|
|
5186
5201
|
this._show = this.props.show;
|
|
5187
|
-
util/* default
|
|
5202
|
+
util/* default */.c.setTimeout(() => {
|
|
5188
5203
|
if (!this._show) this.close();else this.open();
|
|
5189
5204
|
});
|
|
5190
5205
|
}
|
|
@@ -5285,16 +5300,16 @@ class Order extends common/* Com */.up {
|
|
|
5285
5300
|
}
|
|
5286
5301
|
;// CONCATENATED MODULE: ./src/chatbox/Widget.js
|
|
5287
5302
|
function Widget_defineProperty(obj, key, value) { key = Widget_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5288
|
-
function Widget_toPropertyKey(
|
|
5289
|
-
function Widget_toPrimitive(
|
|
5303
|
+
function Widget_toPropertyKey(t) { var i = Widget_toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
5304
|
+
function Widget_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5290
5305
|
|
|
5291
5306
|
|
|
5292
5307
|
|
|
5293
5308
|
|
|
5294
5309
|
|
|
5295
|
-
var send = __webpack_require__(
|
|
5296
|
-
var Widget_checkedimg = __webpack_require__(
|
|
5297
|
-
var empty = __webpack_require__(
|
|
5310
|
+
var send = __webpack_require__(7808);
|
|
5311
|
+
var Widget_checkedimg = __webpack_require__(5856);
|
|
5312
|
+
var empty = __webpack_require__(2160);
|
|
5298
5313
|
|
|
5299
5314
|
|
|
5300
5315
|
|
|
@@ -5306,12 +5321,12 @@ const Widget_defaultAvatar = 'https://file-subiz.com/fiqoahedjbgwclpouoml-avatar
|
|
|
5306
5321
|
|
|
5307
5322
|
|
|
5308
5323
|
|
|
5309
|
-
class Widget extends common/* Com */.
|
|
5324
|
+
class Widget extends common/* Com */.Sq {
|
|
5310
5325
|
constructor(props) {
|
|
5311
5326
|
super(props);
|
|
5312
|
-
Widget_defineProperty(this, "msgInput", (0,preact_module/* createRef */.
|
|
5327
|
+
Widget_defineProperty(this, "msgInput", (0,preact_module/* createRef */.Yn)());
|
|
5313
5328
|
Widget_defineProperty(this, "sendMessage", async message => {
|
|
5314
|
-
let hasPostback = util/* default
|
|
5329
|
+
let hasPostback = util/* default */.c.find(message.attachments, att => att.type === 'postback');
|
|
5315
5330
|
if (this.isFormRequired() && hasPostback) {
|
|
5316
5331
|
this.onStartConvoClick();
|
|
5317
5332
|
this.fillQuickReplyToQuestion(message);
|
|
@@ -5390,7 +5405,7 @@ class Widget extends common/* Com */.up {
|
|
|
5390
5405
|
clickedJoin: false,
|
|
5391
5406
|
quickReplyMessage: {}
|
|
5392
5407
|
});
|
|
5393
|
-
util/* default
|
|
5408
|
+
util/* default */.c.setTimeout(() => {
|
|
5394
5409
|
this.events && this.events.focus();
|
|
5395
5410
|
if (!this.props.store.isMobile()) this.focusInput();
|
|
5396
5411
|
}, 100);
|
|
@@ -5401,10 +5416,10 @@ class Widget extends common/* Com */.up {
|
|
|
5401
5416
|
let form;
|
|
5402
5417
|
let accountSetting = this.props.plugin.chatbox || {};
|
|
5403
5418
|
let acc = this.props.store.matchAccount() || {};
|
|
5404
|
-
if (util/* default
|
|
5405
|
-
let offlineEnabled = util/* default
|
|
5419
|
+
if (util/* default */.c.get(accountSetting, 'prechat_form.enabled')) form = accountSetting.prechat_form;
|
|
5420
|
+
let offlineEnabled = util/* default */.c.get(accountSetting, 'offline_form.enabled');
|
|
5406
5421
|
if (this.isOffline(acc, accountSetting) && offlineEnabled) form = accountSetting.offline_form;
|
|
5407
|
-
if (!this.hasSentMessage(this.props.cid) && form && (util/* default
|
|
5422
|
+
if (!this.hasSentMessage(this.props.cid) && form && (util/* default */.c.size(form.groups) || form.group_required)) return true;
|
|
5408
5423
|
let formRequired = this.isFormRequired();
|
|
5409
5424
|
return formRequired && !this.props.cid || formRequired && this.props.cid && this.state.clickedJoin;
|
|
5410
5425
|
}
|
|
@@ -5414,8 +5429,8 @@ class Widget extends common/* Com */.up {
|
|
|
5414
5429
|
let accountSetting = this.props.plugin.chatbox || {};
|
|
5415
5430
|
let acc = this.props.store.matchAccount() || {};
|
|
5416
5431
|
let submitLabel = this.props.t('prechat_form_btn');
|
|
5417
|
-
if (util/* default
|
|
5418
|
-
let offlineEnabled = util/* default
|
|
5432
|
+
if (util/* default */.c.get(accountSetting, 'prechat_form.enabled')) form = accountSetting.prechat_form;
|
|
5433
|
+
let offlineEnabled = util/* default */.c.get(accountSetting, 'offline_form.enabled');
|
|
5419
5434
|
if (this.isOffline(acc, accountSetting) && offlineEnabled) {
|
|
5420
5435
|
form = accountSetting.offline_form;
|
|
5421
5436
|
submitLabel = this.props.t('offline_form_btn');
|
|
@@ -5432,9 +5447,10 @@ class Widget extends common/* Com */.up {
|
|
|
5432
5447
|
}
|
|
5433
5448
|
let $body = null;
|
|
5434
5449
|
if (this.props.view === 'list') $body = this.renderConvoList();else if (showform) $body = this.renderForm(form, submitLabel);else $body = this.renderChat();
|
|
5435
|
-
let position = util/* default
|
|
5436
|
-
if (this.props.store.isMobile()) position = util/* default
|
|
5450
|
+
let position = util/* default */.c.get(accountSetting, 'desktop_button.position') || 'right';
|
|
5451
|
+
if (this.props.store.isMobile()) position = util/* default */.c.get(accountSetting, 'mobile_button.position', position);
|
|
5437
5452
|
let cls = 'widget-container widget-container--' + position;
|
|
5453
|
+
if (!this.props.store.isMobile() && util/* default */.c.get(accountSetting, 'window_mode') === 'full') cls += ' widget-container--full';
|
|
5438
5454
|
if (!this.props.isShow) cls += ' widget-container--hide';
|
|
5439
5455
|
return (0,preact_module.h)("div", {
|
|
5440
5456
|
class: cls
|
|
@@ -5452,42 +5468,42 @@ class Widget extends common/* Com */.up {
|
|
|
5452
5468
|
}
|
|
5453
5469
|
async submitPrechatForm(form) {
|
|
5454
5470
|
var hasError = false;
|
|
5455
|
-
util/* default
|
|
5456
|
-
if (field.is_required && (field.value === undefined || field.value === '' || util/* default
|
|
5471
|
+
util/* default */.c.map(this.state.formData, (field, key) => {
|
|
5472
|
+
if (field.is_required && (field.value === undefined || field.value === '' || util/* default */.c.size(field.value) === 0 && Array.isArray(field.value))) {
|
|
5457
5473
|
field.error = this.props.t('error_empty');
|
|
5458
5474
|
hasError = true;
|
|
5459
5475
|
} else field.error = '';
|
|
5460
|
-
if (key.substr(5) === 'emails' && !util/* default
|
|
5476
|
+
if (key.substr(5) === 'emails' && !util/* default */.c.isEmail(field.value) && field.is_required) {
|
|
5461
5477
|
field.error = this.props.t('error_email_invalid');
|
|
5462
5478
|
hasError = true;
|
|
5463
5479
|
}
|
|
5464
|
-
if (key.substr(5) === 'phones' && !util/* default
|
|
5480
|
+
if (key.substr(5) === 'phones' && !util/* default */.c.isPhone(field.value) && field.is_required) {
|
|
5465
5481
|
field.error = this.props.t('error_phone_invalid');
|
|
5466
5482
|
hasError = true;
|
|
5467
5483
|
}
|
|
5468
5484
|
});
|
|
5469
5485
|
if (hasError) return this.forceUpdate();
|
|
5470
|
-
let data = util/* default
|
|
5471
|
-
let user = util/* default
|
|
5486
|
+
let data = util/* default */.c.cloneDeep(this.state.formData);
|
|
5487
|
+
let user = util/* default */.c.cloneDeep(this.props.store.matchUser());
|
|
5472
5488
|
let is_lead = false;
|
|
5473
|
-
util/* default
|
|
5489
|
+
util/* default */.c.map(data, (field, key) => {
|
|
5474
5490
|
if (!key.startsWith('attr:')) return;
|
|
5475
5491
|
var attr = {
|
|
5476
5492
|
key: key.substr(5)
|
|
5477
5493
|
};
|
|
5478
5494
|
is_lead = is_lead || key == 'emails' || key == 'phones';
|
|
5479
5495
|
if (field.type === 'number') attr.number = parseInt(field.value);
|
|
5480
|
-
if (field.type === 'datetime') attr.datetime = new util/* default
|
|
5496
|
+
if (field.type === 'datetime') attr.datetime = new util/* default */.c.Date(field.value).toISOString();
|
|
5481
5497
|
if (field.type === 'list') attr.text = field.value;
|
|
5482
5498
|
if (field.type === 'text' || field.type === 'boolean') attr[field.type] = field.value;
|
|
5483
|
-
util/* default
|
|
5499
|
+
util/* default */.c.setUserAttr(user, attr);
|
|
5484
5500
|
});
|
|
5485
|
-
if (is_lead) util/* default
|
|
5501
|
+
if (is_lead) util/* default */.c.setUserAttr(user, {
|
|
5486
5502
|
key: 'lead_source',
|
|
5487
5503
|
text: 'widget'
|
|
5488
5504
|
});
|
|
5489
|
-
let firstmsg = util/* default
|
|
5490
|
-
let groupid = util/* default
|
|
5505
|
+
let firstmsg = util/* default */.c.get(data, 'question.value');
|
|
5506
|
+
let groupid = util/* default */.c.get(data, 'group.value', '');
|
|
5491
5507
|
if (this.props.cid) {
|
|
5492
5508
|
this.props.store.setUser(user);
|
|
5493
5509
|
this.setState({
|
|
@@ -5499,7 +5515,7 @@ class Widget extends common/* Com */.up {
|
|
|
5499
5515
|
format: 'plaintext',
|
|
5500
5516
|
fields: [{
|
|
5501
5517
|
key: 'to_agent_group',
|
|
5502
|
-
value: util/* default
|
|
5518
|
+
value: util/* default */.c.stringify(groupid)
|
|
5503
5519
|
}],
|
|
5504
5520
|
attachments: this.state.quickReplyMessage.attachments
|
|
5505
5521
|
}
|
|
@@ -5559,7 +5575,7 @@ class Widget extends common/* Com */.up {
|
|
|
5559
5575
|
formData['question'] = {
|
|
5560
5576
|
key: 'question',
|
|
5561
5577
|
is_required: true,
|
|
5562
|
-
label: this.props.t.i18n(util/* default
|
|
5578
|
+
label: this.props.t.i18n(util/* default */.c.get(form, `i18n_question_label`, {})) || form.question_label,
|
|
5563
5579
|
type: 'text',
|
|
5564
5580
|
value: this.state.quickReplyMessage.text
|
|
5565
5581
|
};
|
|
@@ -5570,8 +5586,8 @@ class Widget extends common/* Com */.up {
|
|
|
5570
5586
|
}
|
|
5571
5587
|
onBooleanChange(key, e) {
|
|
5572
5588
|
this.wasFormInputed = true;
|
|
5573
|
-
let formData = util/* default
|
|
5574
|
-
let field = util/* default
|
|
5589
|
+
let formData = util/* default */.c.cloneDeep(this.state.formData);
|
|
5590
|
+
let field = util/* default */.c.find(formData, (_, fkkey) => fkkey === key);
|
|
5575
5591
|
if (!field) return;
|
|
5576
5592
|
field.value = e.target.checked;
|
|
5577
5593
|
this.setState({
|
|
@@ -5580,8 +5596,8 @@ class Widget extends common/* Com */.up {
|
|
|
5580
5596
|
}
|
|
5581
5597
|
onInputChange(key, val) {
|
|
5582
5598
|
this.wasFormInputed = true;
|
|
5583
|
-
let formData = util/* default
|
|
5584
|
-
let field = util/* default
|
|
5599
|
+
let formData = util/* default */.c.cloneDeep(this.state.formData);
|
|
5600
|
+
let field = util/* default */.c.find(formData, (_, fkkey) => fkkey === key);
|
|
5585
5601
|
if (!field) return;
|
|
5586
5602
|
field.value = val;
|
|
5587
5603
|
this.setState({
|
|
@@ -5590,8 +5606,8 @@ class Widget extends common/* Com */.up {
|
|
|
5590
5606
|
}
|
|
5591
5607
|
onListAddItem(key, val) {
|
|
5592
5608
|
this.wasFormInputed = true;
|
|
5593
|
-
let formData = util/* default
|
|
5594
|
-
let field = util/* default
|
|
5609
|
+
let formData = util/* default */.c.cloneDeep(this.state.formData);
|
|
5610
|
+
let field = util/* default */.c.find(formData, (_, fkkey) => fkkey === key);
|
|
5595
5611
|
if (!field) return;
|
|
5596
5612
|
field.value = field.value || [];
|
|
5597
5613
|
field.value.push(val);
|
|
@@ -5601,8 +5617,8 @@ class Widget extends common/* Com */.up {
|
|
|
5601
5617
|
}
|
|
5602
5618
|
onListRemoveItem(key, index) {
|
|
5603
5619
|
this.wasFormInputed = true;
|
|
5604
|
-
let formData = util/* default
|
|
5605
|
-
let field = util/* default
|
|
5620
|
+
let formData = util/* default */.c.cloneDeep(this.state.formData);
|
|
5621
|
+
let field = util/* default */.c.find(formData, (_, fkkey) => fkkey === key);
|
|
5606
5622
|
if (!field) return;
|
|
5607
5623
|
field.value = field.value || [];
|
|
5608
5624
|
field.value.splice(index, 1);
|
|
@@ -5611,11 +5627,11 @@ class Widget extends common/* Com */.up {
|
|
|
5611
5627
|
});
|
|
5612
5628
|
}
|
|
5613
5629
|
renderCheckboxField(field) {
|
|
5614
|
-
let items = util/* default
|
|
5630
|
+
let items = util/* default */.c.get(field, 'def.items', []);
|
|
5615
5631
|
let values = [];
|
|
5616
5632
|
let value = field.value || '';
|
|
5617
5633
|
if (value) values = value.split(',');
|
|
5618
|
-
return (0,preact_module.h)("div", null, util/* default
|
|
5634
|
+
return (0,preact_module.h)("div", null, util/* default */.c.map(items, item => {
|
|
5619
5635
|
return (0,preact_module.h)("div", {
|
|
5620
5636
|
class: "checkbox"
|
|
5621
5637
|
}, (0,preact_module.h)("input", {
|
|
@@ -5633,14 +5649,14 @@ class Widget extends common/* Com */.up {
|
|
|
5633
5649
|
}
|
|
5634
5650
|
toggleCheckboxField(key, v) {
|
|
5635
5651
|
this.wasFormInputed = true;
|
|
5636
|
-
let formData = util/* default
|
|
5637
|
-
let field = util/* default
|
|
5652
|
+
let formData = util/* default */.c.cloneDeep(this.state.formData);
|
|
5653
|
+
let field = util/* default */.c.find(formData, (f, fkkey) => f.key === key);
|
|
5638
5654
|
if (!field) return;
|
|
5639
5655
|
let value = field.value || '';
|
|
5640
5656
|
let values = [];
|
|
5641
5657
|
if (value) values = value.split(',');
|
|
5642
5658
|
if (values.includes(v)) {
|
|
5643
|
-
values = util/* default
|
|
5659
|
+
values = util/* default */.c.filter(values, value => value !== v);
|
|
5644
5660
|
} else {
|
|
5645
5661
|
values.push(v);
|
|
5646
5662
|
}
|
|
@@ -5650,9 +5666,9 @@ class Widget extends common/* Com */.up {
|
|
|
5650
5666
|
});
|
|
5651
5667
|
}
|
|
5652
5668
|
renderRadioField(field) {
|
|
5653
|
-
let items = util/* default
|
|
5669
|
+
let items = util/* default */.c.get(field, 'def.items', []);
|
|
5654
5670
|
let value = field.value || '';
|
|
5655
|
-
return (0,preact_module.h)("div", null, util/* default
|
|
5671
|
+
return (0,preact_module.h)("div", null, util/* default */.c.map(items, item => {
|
|
5656
5672
|
return (0,preact_module.h)("div", {
|
|
5657
5673
|
class: "radio"
|
|
5658
5674
|
}, (0,preact_module.h)("input", {
|
|
@@ -5671,8 +5687,8 @@ class Widget extends common/* Com */.up {
|
|
|
5671
5687
|
}
|
|
5672
5688
|
toggleRadioField(key, v) {
|
|
5673
5689
|
this.wasFormInputed = true;
|
|
5674
|
-
let formData = util/* default
|
|
5675
|
-
let field = util/* default
|
|
5690
|
+
let formData = util/* default */.c.cloneDeep(this.state.formData);
|
|
5691
|
+
let field = util/* default */.c.find(formData, (f, fkkey) => f.key === key);
|
|
5676
5692
|
if (!field) return;
|
|
5677
5693
|
field.value = v;
|
|
5678
5694
|
this.setState({
|
|
@@ -5681,8 +5697,8 @@ class Widget extends common/* Com */.up {
|
|
|
5681
5697
|
}
|
|
5682
5698
|
selectDropdownField(key, v) {
|
|
5683
5699
|
this.wasFormInputed = true;
|
|
5684
|
-
let formData = util/* default
|
|
5685
|
-
let field = util/* default
|
|
5700
|
+
let formData = util/* default */.c.cloneDeep(this.state.formData);
|
|
5701
|
+
let field = util/* default */.c.find(formData, (f, fkkey) => f.key === key);
|
|
5686
5702
|
if (!field) return;
|
|
5687
5703
|
field.value = v;
|
|
5688
5704
|
this.setState({
|
|
@@ -5690,20 +5706,20 @@ class Widget extends common/* Com */.up {
|
|
|
5690
5706
|
});
|
|
5691
5707
|
}
|
|
5692
5708
|
renderDropdownField(field) {
|
|
5693
|
-
let items = util/* default
|
|
5709
|
+
let items = util/* default */.c.get(field, 'def.items', []);
|
|
5694
5710
|
return (0,preact_module.h)("select", {
|
|
5695
5711
|
class: "form-control",
|
|
5696
5712
|
value: field.value,
|
|
5697
5713
|
onChange: e => this.selectDropdownField(field.key, e.target.value)
|
|
5698
5714
|
}, (0,preact_module.h)("option", {
|
|
5699
5715
|
value: ""
|
|
5700
|
-
}, "-- ", this.props.t('no_select'), " --"), util/* default
|
|
5716
|
+
}, "-- ", this.props.t('no_select'), " --"), util/* default */.c.map(items, item => (0,preact_module.h)("option", {
|
|
5701
5717
|
value: item.value
|
|
5702
5718
|
}, this.props.t.i18n(item.i18n_label) || item.label || item.value)));
|
|
5703
5719
|
}
|
|
5704
5720
|
renderFields() {
|
|
5705
|
-
if (util/* default
|
|
5706
|
-
let $fields = util/* default
|
|
5721
|
+
if (util/* default */.c.size(this.state.formData) === 0) return null;
|
|
5722
|
+
let $fields = util/* default */.c.map(this.state.formData, (field, key) => {
|
|
5707
5723
|
if (this.state.quickReplyMessage.text && key === 'question') return null;
|
|
5708
5724
|
let $field = null;
|
|
5709
5725
|
var errclass = field.error ? 'input--error' : '';
|
|
@@ -5719,13 +5735,13 @@ class Widget extends common/* Com */.up {
|
|
|
5719
5735
|
row: "4",
|
|
5720
5736
|
class: "form-control"
|
|
5721
5737
|
});
|
|
5722
|
-
} else if (util/* default
|
|
5738
|
+
} else if (util/* default */.c.get(field, 'def.select') === 'checkbox') {
|
|
5723
5739
|
$field = this.renderCheckboxField(field);
|
|
5724
|
-
} else if (util/* default
|
|
5740
|
+
} else if (util/* default */.c.get(field, 'def.select') === 'radio') {
|
|
5725
5741
|
$field = this.renderRadioField(field);
|
|
5726
|
-
} else if (util/* default
|
|
5742
|
+
} else if (util/* default */.c.get(field, 'def.select') === 'dropdown') {
|
|
5727
5743
|
$field = this.renderDropdownField(field);
|
|
5728
|
-
} else if (util/* default
|
|
5744
|
+
} else if (util/* default */.c.get(field, 'def.multiple_line')) {
|
|
5729
5745
|
$field = (0,preact_module.h)("textarea", {
|
|
5730
5746
|
class: "form-control",
|
|
5731
5747
|
ref: ref => {
|
|
@@ -5772,7 +5788,7 @@ class Widget extends common/* Com */.up {
|
|
|
5772
5788
|
class: "checkbox--check"
|
|
5773
5789
|
}, (0,preact_module.h)("div", null)));
|
|
5774
5790
|
} else if (field.type === 'group') {
|
|
5775
|
-
$field = util/* default
|
|
5791
|
+
$field = util/* default */.c.map(field.list, item => (0,preact_module.h)("div", {
|
|
5776
5792
|
class: "radio"
|
|
5777
5793
|
}, (0,preact_module.h)("input", {
|
|
5778
5794
|
type: "radio",
|
|
@@ -5789,8 +5805,8 @@ class Widget extends common/* Com */.up {
|
|
|
5789
5805
|
}))));
|
|
5790
5806
|
} else if (field.type === 'list') {
|
|
5791
5807
|
let selected = this.state.formData[key].value || [];
|
|
5792
|
-
let items = util/* default
|
|
5793
|
-
return !util/* default
|
|
5808
|
+
let items = util/* default */.c.filter(util/* default */.c.get(field, 'list', []), item => {
|
|
5809
|
+
return !util/* default */.c.includes(selected, item);
|
|
5794
5810
|
});
|
|
5795
5811
|
$field = (0,preact_module.h)(ListField, {
|
|
5796
5812
|
selected: selected,
|
|
@@ -5838,8 +5854,8 @@ class Widget extends common/* Com */.up {
|
|
|
5838
5854
|
size: "16",
|
|
5839
5855
|
mode: "white"
|
|
5840
5856
|
}));
|
|
5841
|
-
let title = this.props.t.i18n(util/* default
|
|
5842
|
-
if (!title) title = util/* default
|
|
5857
|
+
let title = this.props.t.i18n(util/* default */.c.get(form, `i18n_title`, {}));
|
|
5858
|
+
if (!title) title = util/* default */.c.get(form, 'title', this.props.t('capture_lead_title'));
|
|
5843
5859
|
title = title.replace('↵', '');
|
|
5844
5860
|
return (0,preact_module.h)("div", {
|
|
5845
5861
|
class: "widget-body"
|
|
@@ -5870,15 +5886,15 @@ class Widget extends common/* Com */.up {
|
|
|
5870
5886
|
}
|
|
5871
5887
|
renderConvoList() {
|
|
5872
5888
|
let convoM = this.props.store.matchConvo('*');
|
|
5873
|
-
var convos = util/* default
|
|
5874
|
-
convos = util/* default
|
|
5875
|
-
convos = util/* default
|
|
5876
|
-
var $convos = util/* default
|
|
5877
|
-
let ags = util/* default
|
|
5889
|
+
var convos = util/* default */.c.map(convoM, convo => this.props.store.matchConvo(convo.id));
|
|
5890
|
+
convos = util/* default */.c.filter(convos, convo => !!convo);
|
|
5891
|
+
convos = util/* default */.c.orderByF(convos, convo => util/* default */.c.get(convo, 'last_message_sent.created', convo.actived), 'desc');
|
|
5892
|
+
var $convos = util/* default */.c.map(convos, convo => {
|
|
5893
|
+
let ags = util/* default */.c.filter(convo.members, m => {
|
|
5878
5894
|
return (m.type === 'agent' || m.type === 'bot') && m.membership === 'active';
|
|
5879
5895
|
});
|
|
5880
|
-
let agentids = util/* default
|
|
5881
|
-
agentids = agentids || util/* default
|
|
5896
|
+
let agentids = util/* default */.c.map(ags, m => m.id);
|
|
5897
|
+
agentids = agentids || util/* default */.c.agentsOfConvo(convo)[0];
|
|
5882
5898
|
return (0,preact_module.h)("div", {
|
|
5883
5899
|
class: "convo-list--item",
|
|
5884
5900
|
onClick: () => this.goToConvo(convo.id),
|
|
@@ -5895,7 +5911,7 @@ class Widget extends common/* Com */.up {
|
|
|
5895
5911
|
let $body = (0,preact_module.h)("div", {
|
|
5896
5912
|
class: "convo-list--list"
|
|
5897
5913
|
}, $convos);
|
|
5898
|
-
if (util/* default
|
|
5914
|
+
if (util/* default */.c.size(convos) === 0) {
|
|
5899
5915
|
$body = (0,preact_module.h)("div", {
|
|
5900
5916
|
class: "convo-list--list"
|
|
5901
5917
|
}, (0,preact_module.h)("div", {
|
|
@@ -5931,19 +5947,19 @@ class Widget extends common/* Com */.up {
|
|
|
5931
5947
|
if (this.props.store.isPreview) return;
|
|
5932
5948
|
var $input = this.msgInput.current;
|
|
5933
5949
|
if (!$input) return;
|
|
5934
|
-
util/* default
|
|
5935
|
-
util/* default
|
|
5950
|
+
util/* default */.c.setTimeout(() => $input && $input.blur());
|
|
5951
|
+
util/* default */.c.setTimeout(() => $input && $input.blur(), 300);
|
|
5936
5952
|
}
|
|
5937
5953
|
focusInput() {
|
|
5938
5954
|
if (this.props.store.isPreview) return;
|
|
5939
5955
|
if (this.shouldShowForm()) {
|
|
5940
5956
|
let firstemptykey = '';
|
|
5941
|
-
util/* default
|
|
5957
|
+
util/* default */.c.map(this.state.formData, (field, key) => {
|
|
5942
5958
|
if (field.type !== 'text') return;
|
|
5943
5959
|
if (firstemptykey) return;
|
|
5944
5960
|
if (!field.value) firstemptykey = key;
|
|
5945
5961
|
});
|
|
5946
|
-
util/* default
|
|
5962
|
+
util/* default */.c.setTimeout(() => {
|
|
5947
5963
|
var $input = this['form_' + Widget_encode(firstemptykey)];
|
|
5948
5964
|
if (!$input) return;
|
|
5949
5965
|
$input.focus();
|
|
@@ -5952,8 +5968,8 @@ class Widget extends common/* Com */.up {
|
|
|
5952
5968
|
}
|
|
5953
5969
|
var $input = this.msgInput.current;
|
|
5954
5970
|
if (!$input) return;
|
|
5955
|
-
util/* default
|
|
5956
|
-
util/* default
|
|
5971
|
+
util/* default */.c.setTimeout(() => $input.focus());
|
|
5972
|
+
util/* default */.c.setTimeout(() => $input.focus(), 300);
|
|
5957
5973
|
}
|
|
5958
5974
|
onRate(rating) {
|
|
5959
5975
|
if (!this.props.cid) return;
|
|
@@ -5967,7 +5983,7 @@ class Widget extends common/* Com */.up {
|
|
|
5967
5983
|
fillQuickReplyToQuestion(message) {
|
|
5968
5984
|
let formData = this.state.formData;
|
|
5969
5985
|
if (formData) {
|
|
5970
|
-
util/* default
|
|
5986
|
+
util/* default */.c.set(formData, 'question.value', message.text);
|
|
5971
5987
|
}
|
|
5972
5988
|
this.setState({
|
|
5973
5989
|
formData,
|
|
@@ -6060,8 +6076,8 @@ class Widget extends common/* Com */.up {
|
|
|
6060
6076
|
let form;
|
|
6061
6077
|
let accountSetting = this.props.plugin.chatbox || {};
|
|
6062
6078
|
let acc = this.props.store.matchAccount() || {};
|
|
6063
|
-
if (util/* default
|
|
6064
|
-
let offlineEnabled = util/* default
|
|
6079
|
+
if (util/* default */.c.get(accountSetting, 'prechat_form.enabled')) form = accountSetting.prechat_form;
|
|
6080
|
+
let offlineEnabled = util/* default */.c.get(accountSetting, 'offline_form.enabled');
|
|
6065
6081
|
if (this.isOffline(acc, accountSetting) && offlineEnabled) form = accountSetting.offline_form;
|
|
6066
6082
|
if (!form) return false;
|
|
6067
6083
|
let formData = this.fillForm(form);
|
|
@@ -6069,34 +6085,34 @@ class Widget extends common/* Com */.up {
|
|
|
6069
6085
|
if (convo.state === 'ended') return true;
|
|
6070
6086
|
if (convo.state && convo.state !== 'pending') delete formData.group;
|
|
6071
6087
|
let isAllFiledEmpty = true;
|
|
6072
|
-
util/* default
|
|
6088
|
+
util/* default */.c.each(formData, field => {
|
|
6073
6089
|
if (field.value) isAllFiledEmpty = false;
|
|
6074
6090
|
});
|
|
6075
6091
|
if (isAllFiledEmpty && !this.userHasSent(this.props.cid)) return true;
|
|
6076
|
-
return !!util/* default
|
|
6092
|
+
return !!util/* default */.c.find(formData, field => field.is_required && (field.value == null || field.value === ''));
|
|
6077
6093
|
}
|
|
6078
6094
|
renderConvoSummary(convo) {
|
|
6079
6095
|
let accountSetting = this.props.plugin.chatbox || {};
|
|
6080
6096
|
let agentM = this.props.store.matchAgent('*');
|
|
6081
|
-
let ags = util/* default
|
|
6097
|
+
let ags = util/* default */.c.filter(convo.members, m => {
|
|
6082
6098
|
return (m.type === 'agent' || m.type === 'bot') && m.membership === 'active';
|
|
6083
6099
|
});
|
|
6084
|
-
let agentids = util/* default
|
|
6085
|
-
agentids = agentids || util/* default
|
|
6086
|
-
let agents = util/* default
|
|
6100
|
+
let agentids = util/* default */.c.map(ags, m => m.id);
|
|
6101
|
+
agentids = agentids || util/* default */.c.agentsOfConvo(convo)[0];
|
|
6102
|
+
let agents = util/* default */.c.map(agentids, id => agentM[id] || {
|
|
6087
6103
|
avatar_url: Widget_defaultAvatar,
|
|
6088
6104
|
fullname: 'Offline Agent'
|
|
6089
6105
|
});
|
|
6090
|
-
var name = util/* default
|
|
6106
|
+
var name = util/* default */.c.each(agents, ag => ag.fullname).join(', ');
|
|
6091
6107
|
if (accountSetting.hide_agent_profile || !name) name = this.props.store.matchAccount().name;
|
|
6092
6108
|
if (!name) name = this.props.t('agent');
|
|
6093
6109
|
var $you = null;
|
|
6094
6110
|
if (convo.lastSenderType === 'user') {
|
|
6095
6111
|
$you = (0,preact_module.h)("span", null, this.props.t('you'), ":");
|
|
6096
6112
|
}
|
|
6097
|
-
let seen = util/* default
|
|
6113
|
+
let seen = util/* default */.c.isConvoSeen(convo, this.props.store.matchUser().id);
|
|
6098
6114
|
var lastmsg = this.renderMessagePreview(convo.last_message_sent);
|
|
6099
|
-
var time = util/* default
|
|
6115
|
+
var time = util/* default */.c.getMs(util/* default */.c.get(convo, 'last_message_sent.created')) || util/* default */.c.getMs(convo.created);
|
|
6100
6116
|
let $unread = seen ? null : (0,preact_module.h)("div", {
|
|
6101
6117
|
class: "convo-list--item-unread"
|
|
6102
6118
|
});
|
|
@@ -6129,23 +6145,23 @@ class Widget extends common/* Com */.up {
|
|
|
6129
6145
|
}
|
|
6130
6146
|
agentsOfConvo(convo) {
|
|
6131
6147
|
let agentM = this.props.store.matchAgent('*');
|
|
6132
|
-
var agentids = util/* default
|
|
6133
|
-
return util/* default
|
|
6148
|
+
var agentids = util/* default */.c.agentsOfConvo(convo, true);
|
|
6149
|
+
return util/* default */.c.map(agentids, id => agentM[id] || {
|
|
6134
6150
|
avatar_url: Widget_defaultAvatar,
|
|
6135
6151
|
fullname: 'Offline Agent'
|
|
6136
6152
|
});
|
|
6137
6153
|
}
|
|
6138
6154
|
renderMessagePreview(ev) {
|
|
6139
6155
|
let defmsg = this.props.t('sent_you_a_message');
|
|
6140
|
-
let message = util/* default
|
|
6141
|
-
var format = util/* default
|
|
6156
|
+
let message = util/* default */.c.get(ev, 'data.message.text');
|
|
6157
|
+
var format = util/* default */.c.get(ev, 'data.message.format');
|
|
6142
6158
|
if (format !== 'plaintext') message = defmsg;
|
|
6143
|
-
if (!message && util/* default
|
|
6159
|
+
if (!message && util/* default */.c.size(util/* default */.c.get(ev, 'data.message.attachments')) > 0) message = defmsg;
|
|
6144
6160
|
if (!message) return null;
|
|
6145
|
-
let byType = util/* default
|
|
6161
|
+
let byType = util/* default */.c.get(ev, 'by.type');
|
|
6146
6162
|
return (0,preact_module.h)("div", {
|
|
6147
6163
|
class: "convo-list--convo-last-mes"
|
|
6148
|
-
}, util/* default
|
|
6164
|
+
}, util/* default */.c.map(util/* default */.c.extractText(message), tag => {
|
|
6149
6165
|
if (tag.type === 'emoji') return (0,preact_module.h)(Emoji, {
|
|
6150
6166
|
emojiCode: tag.text,
|
|
6151
6167
|
byType: byType
|
|
@@ -6157,19 +6173,19 @@ class Widget extends common/* Com */.up {
|
|
|
6157
6173
|
var convo = this.props.store.matchConvo(cid) || {};
|
|
6158
6174
|
let user = this.props.store.matchUser();
|
|
6159
6175
|
if (this.userSent[cid]) return true;
|
|
6160
|
-
let joined = util/* default
|
|
6176
|
+
let joined = util/* default */.c.find(convo.members, mem => mem.id === user.id && (mem.membership === 'active' || mem.last_sent > 0));
|
|
6161
6177
|
return joined;
|
|
6162
6178
|
}
|
|
6163
6179
|
hasSentMessage(cid) {
|
|
6164
6180
|
let convo = this.props.store.matchConvo(cid) || {};
|
|
6165
|
-
let joined = util/* default
|
|
6181
|
+
let joined = util/* default */.c.find(convo.members, mem => {
|
|
6166
6182
|
if (mem.type === 'bot') return true;
|
|
6167
6183
|
return mem.last_sent;
|
|
6168
6184
|
});
|
|
6169
6185
|
return joined;
|
|
6170
6186
|
}
|
|
6171
6187
|
isOffline(acc, accSetting) {
|
|
6172
|
-
let enableWhen = util/* default
|
|
6188
|
+
let enableWhen = util/* default */.c.get(accSetting, 'offline_form.enable_when');
|
|
6173
6189
|
let isonline = true;
|
|
6174
6190
|
if (enableWhen === 'all_agents_offline') isonline = acc.is_online;
|
|
6175
6191
|
if (enableWhen === 'out_of_bussiness_hour') isonline = acc.is_in_business_hour;
|
|
@@ -6179,8 +6195,8 @@ class Widget extends common/* Com */.up {
|
|
|
6179
6195
|
let form;
|
|
6180
6196
|
let accountSetting = this.props.plugin.chatbox || {};
|
|
6181
6197
|
let acc = this.props.store.matchAccount() || {};
|
|
6182
|
-
if (util/* default
|
|
6183
|
-
let offlineEnabled = util/* default
|
|
6198
|
+
if (util/* default */.c.get(accountSetting, 'prechat_form.enabled')) form = accountSetting.prechat_form;
|
|
6199
|
+
let offlineEnabled = util/* default */.c.get(accountSetting, 'offline_form.enabled');
|
|
6184
6200
|
if (this.isOffline(acc, accountSetting) && offlineEnabled) {
|
|
6185
6201
|
form = accountSetting.offline_form;
|
|
6186
6202
|
}
|
|
@@ -6190,23 +6206,23 @@ class Widget extends common/* Com */.up {
|
|
|
6190
6206
|
if (this.props.view === 'prechat_form') {
|
|
6191
6207
|
form = accountSetting.prechat_form;
|
|
6192
6208
|
}
|
|
6193
|
-
if (util/* default
|
|
6209
|
+
if (util/* default */.c.size(form) === 0) return [];
|
|
6194
6210
|
var data = {};
|
|
6195
|
-
util/* default
|
|
6211
|
+
util/* default */.c.each(form.fields, f => {
|
|
6196
6212
|
var newf = Object.assign({}, f);
|
|
6197
6213
|
if (f.type === 'list') {
|
|
6198
6214
|
newf.list = f.list;
|
|
6199
6215
|
}
|
|
6200
|
-
newf.label = this.props.t.i18n(util/* default
|
|
6216
|
+
newf.label = this.props.t.i18n(util/* default */.c.get(f, `i18n_label`, {})) || f.label;
|
|
6201
6217
|
data['attr:' + f.key] = newf;
|
|
6202
6218
|
});
|
|
6203
|
-
if (form.group_required && util/* default
|
|
6219
|
+
if (form.group_required && util/* default */.c.size(form.groups) > 0) {
|
|
6204
6220
|
data['group'] = {
|
|
6205
6221
|
key: 'group',
|
|
6206
6222
|
is_required: !!form.group_required,
|
|
6207
|
-
label: this.props.t.i18n(util/* default
|
|
6223
|
+
label: this.props.t.i18n(util/* default */.c.get(form, `i18n_group_label`, {})) || form.group_label,
|
|
6208
6224
|
type: 'group',
|
|
6209
|
-
list: util/* default
|
|
6225
|
+
list: util/* default */.c.map(form.groups, group => ({
|
|
6210
6226
|
value: group.id,
|
|
6211
6227
|
label: group.name
|
|
6212
6228
|
}))
|
|
@@ -6215,7 +6231,7 @@ class Widget extends common/* Com */.up {
|
|
|
6215
6231
|
data['question'] = {
|
|
6216
6232
|
key: 'question',
|
|
6217
6233
|
is_required: true,
|
|
6218
|
-
label: this.props.t.i18n(util/* default
|
|
6234
|
+
label: this.props.t.i18n(util/* default */.c.get(form, `i18n_question_label`, {})) || form.question_label,
|
|
6219
6235
|
type: 'text'
|
|
6220
6236
|
};
|
|
6221
6237
|
if (this.isFormChanged(this.state.formData, data)) {
|
|
@@ -6229,38 +6245,44 @@ class Widget extends common/* Com */.up {
|
|
|
6229
6245
|
let newKeys = Object.keys(newForm);
|
|
6230
6246
|
if (oldKeys.length !== newKeys.length) return true;
|
|
6231
6247
|
for (let i = 0; i < oldKeys.length; i++) {
|
|
6232
|
-
if (util/* default
|
|
6233
|
-
if (util/* default
|
|
6234
|
-
if (util/* default
|
|
6248
|
+
if (util/* default */.c.get(oldForm, `${oldKeys[i]}.label`) !== util/* default */.c.get(newForm, `${newKeys[i]}.label`)) return true;
|
|
6249
|
+
if (util/* default */.c.get(oldForm, `${oldKeys[i]}.is_required`) !== util/* default */.c.get(newForm, `${newKeys[i]}.is_required`)) return true;
|
|
6250
|
+
if (util/* default */.c.stringify(util/* default */.c.get(oldForm, `${oldKeys[i]}.list`)) !== util/* default */.c.stringify(util/* default */.c.get(newForm, `${newKeys[i]}.list`))) {
|
|
6235
6251
|
return true;
|
|
6236
6252
|
}
|
|
6237
6253
|
}
|
|
6238
6254
|
return false;
|
|
6239
6255
|
}
|
|
6240
6256
|
fillForm(form) {
|
|
6241
|
-
if (util/* default
|
|
6257
|
+
if (util/* default */.c.size(form) === 0) return [];
|
|
6242
6258
|
var data = {};
|
|
6243
6259
|
let user = this.props.store.matchUser();
|
|
6244
|
-
util/* default
|
|
6260
|
+
util/* default */.c.each(form.fields, f => {
|
|
6245
6261
|
var newf = Object.assign({}, f);
|
|
6246
|
-
newf.value = util/* default
|
|
6262
|
+
newf.value = util/* default */.c.getUserAttr(user, f.key, f.type);
|
|
6263
|
+
if (newf.key == 'emails' && !newf.value) {
|
|
6264
|
+
newf.value = util/* default */.c.getUserAttr(user, 'related_email', 'text');
|
|
6265
|
+
}
|
|
6266
|
+
if (newf.key == 'phones' && !newf.value) {
|
|
6267
|
+
newf.value = util/* default */.c.getUserAttr(user, 'related_phone', 'text');
|
|
6268
|
+
}
|
|
6247
6269
|
if (f.type === 'boolean' && !newf.value) newf.value = false;
|
|
6248
6270
|
if (f.type === 'datetime' && newf.value) {
|
|
6249
|
-
newf.value = new util/* default
|
|
6271
|
+
newf.value = new util/* default */.c.Date(data.value).toLocaleDateString('en-CA');
|
|
6250
6272
|
}
|
|
6251
6273
|
if (f.type === 'list') {
|
|
6252
6274
|
newf.list = f.list;
|
|
6253
6275
|
}
|
|
6254
|
-
newf.label = this.props.t.i18n(util/* default
|
|
6276
|
+
newf.label = this.props.t.i18n(util/* default */.c.get(f, `i18n_label`, {})) || f.label;
|
|
6255
6277
|
data['attr:' + f.key] = newf;
|
|
6256
6278
|
});
|
|
6257
|
-
if (form.group_required && util/* default
|
|
6279
|
+
if (form.group_required && util/* default */.c.size(form.groups) > 0) {
|
|
6258
6280
|
data['group'] = {
|
|
6259
6281
|
key: 'group',
|
|
6260
6282
|
is_required: !!form.group_required,
|
|
6261
|
-
label: this.props.t.i18n(util/* default
|
|
6283
|
+
label: this.props.t.i18n(util/* default */.c.get(form, `i18n_group_label`, {})) || form.group_label,
|
|
6262
6284
|
type: 'group',
|
|
6263
|
-
list: util/* default
|
|
6285
|
+
list: util/* default */.c.map(form.groups, group => ({
|
|
6264
6286
|
value: group.id,
|
|
6265
6287
|
label: group.name
|
|
6266
6288
|
}))
|
|
@@ -6269,7 +6291,7 @@ class Widget extends common/* Com */.up {
|
|
|
6269
6291
|
return data;
|
|
6270
6292
|
}
|
|
6271
6293
|
}
|
|
6272
|
-
class FormMounter extends common/* Com */.
|
|
6294
|
+
class FormMounter extends common/* Com */.Sq {
|
|
6273
6295
|
componentDidMount() {
|
|
6274
6296
|
this.props.onMount(this.props.form);
|
|
6275
6297
|
}
|
|
@@ -6283,23 +6305,23 @@ function Widget_encode(key) {
|
|
|
6283
6305
|
|
|
6284
6306
|
|
|
6285
6307
|
|
|
6286
|
-
let main_promiseMainCSS = (() => __webpack_require__.e(/* import() */
|
|
6287
|
-
class Main extends common/* Com */.
|
|
6308
|
+
let main_promiseMainCSS = (() => __webpack_require__.e(/* import() */ 176).then(__webpack_require__.bind(__webpack_require__, 6176)))();
|
|
6309
|
+
class Main extends common/* Com */.Sq {
|
|
6288
6310
|
constructor(props) {
|
|
6289
6311
|
super(props);
|
|
6290
|
-
this.refButton = (0,preact_module/* createRef */.
|
|
6291
|
-
this.refWidget = (0,preact_module/* createRef */.
|
|
6312
|
+
this.refButton = (0,preact_module/* createRef */.Yn)();
|
|
6313
|
+
this.refWidget = (0,preact_module/* createRef */.Yn)();
|
|
6292
6314
|
}
|
|
6293
6315
|
async refreshCSS() {
|
|
6294
6316
|
let plugins = this.props.store.matchPlugin();
|
|
6295
|
-
let found = util/* default
|
|
6317
|
+
let found = util/* default */.c.find(plugins, plugin => plugin.id === this.props.plugin.id);
|
|
6296
6318
|
if (!found) return;
|
|
6297
6319
|
let css = (await main_promiseMainCSS).default.default.toString();
|
|
6298
|
-
var outcss = util/* default
|
|
6299
|
-
util/* default
|
|
6320
|
+
var outcss = util/* default */.c.replaceCssVariable(css, found.chatbox);
|
|
6321
|
+
util/* default */.c.setCss(this.props.plugin.id, this.$cssStyleDiv, outcss);
|
|
6300
6322
|
}
|
|
6301
6323
|
componentWillUnmount() {
|
|
6302
|
-
util/* default
|
|
6324
|
+
util/* default */.c.setCss(this.props.plugin.id, this.$cssStyleDiv, '');
|
|
6303
6325
|
}
|
|
6304
6326
|
async componentDidMount() {
|
|
6305
6327
|
this.$cssStyleDiv = document.getElementById('subiz-style-for-' + this.props.plugin.id);
|
|
@@ -6335,7 +6357,7 @@ class Main extends common/* Com */.up {
|
|
|
6335
6357
|
}
|
|
6336
6358
|
render() {
|
|
6337
6359
|
if (!this.state.cssready) return null;
|
|
6338
|
-
if (util/* default
|
|
6360
|
+
if (util/* default */.c.isUserBanned(this.props.store.matchUser())) return null;
|
|
6339
6361
|
if (!this.props.t) return null;
|
|
6340
6362
|
return (0,preact_module.h)("div", {
|
|
6341
6363
|
class: this.props.store.isMobile() ? 'mobile' : 'desktop'
|
|
@@ -6369,10 +6391,10 @@ class Main extends common/* Com */.up {
|
|
|
6369
6391
|
if ($widget.wasFormInputed) return;
|
|
6370
6392
|
if (ev.type !== 'message_sent') return;
|
|
6371
6393
|
if (!this.state.isShowWidget) return;
|
|
6372
|
-
let byType = util/* default
|
|
6373
|
-
let byid = util/* default
|
|
6394
|
+
let byType = util/* default */.c.get(ev, 'by.type');
|
|
6395
|
+
let byid = util/* default */.c.get(ev, 'by.id') || '';
|
|
6374
6396
|
if (!byid.startsWith('bb') || byType !== 'agent') return;
|
|
6375
|
-
let cid = util/* default
|
|
6397
|
+
let cid = util/* default */.c.get(ev, 'data.message.conversation_id');
|
|
6376
6398
|
if (!cid) return;
|
|
6377
6399
|
this.showWidget({
|
|
6378
6400
|
cid,
|
|
@@ -6384,7 +6406,7 @@ class Main extends common/* Com */.up {
|
|
|
6384
6406
|
if (this.props.plugin._no_auto_expand) return;
|
|
6385
6407
|
if (this.props.store.matchHasManuallyClosed()) return;
|
|
6386
6408
|
let convoM = this.props.store.matchConvo('*');
|
|
6387
|
-
let redconvo = util/* default
|
|
6409
|
+
let redconvo = util/* default */.c.find(convoM, convo => !util/* default */.c.isConvoSeen(convo, this.props.store.matchUser().id));
|
|
6388
6410
|
if (!redconvo || !redconvo.id) return;
|
|
6389
6411
|
if (!this.state.isShowWidget) this.showWidget({
|
|
6390
6412
|
view: 'chat',
|
|
@@ -6402,14 +6424,14 @@ class Main extends common/* Com */.up {
|
|
|
6402
6424
|
this.refButton.current && this.refButton.current.ClearPreview();
|
|
6403
6425
|
if (!p.view) {
|
|
6404
6426
|
let lastview = this.props.store.matchLastview() || {};
|
|
6405
|
-
p.view = util/* default
|
|
6406
|
-
p.cid = util/* default
|
|
6427
|
+
p.view = util/* default */.c.get(lastview, 'view');
|
|
6428
|
+
p.cid = util/* default */.c.get(lastview, 'opts.cid');
|
|
6407
6429
|
}
|
|
6408
6430
|
p = p || {};
|
|
6409
6431
|
if (!p.view && !p.cid) {
|
|
6410
6432
|
let convoM = this.props.store.matchConvo('*');
|
|
6411
|
-
let redconvo = util/* default
|
|
6412
|
-
p.cid = util/* default
|
|
6433
|
+
let redconvo = util/* default */.c.find(convoM, convo => !util/* default */.c.isConvoSeen(convo, this.props.store.matchUser().id));
|
|
6434
|
+
p.cid = util/* default */.c.get(redconvo, 'id', util/* default */.c.get(convoM, '0.id'));
|
|
6413
6435
|
p.view = 'chat';
|
|
6414
6436
|
}
|
|
6415
6437
|
if (this.props.store.isMobile()) modifyViewport();
|
|
@@ -6447,11 +6469,13 @@ class Main extends common/* Com */.up {
|
|
|
6447
6469
|
}
|
|
6448
6470
|
function restoreViewport() {
|
|
6449
6471
|
if (document.body && document.body.classList) document.body.classList.remove('sbz_no_scroll');
|
|
6472
|
+
if (document.documentElement && document.documentElement.classList) document.documentElement.classList.remove('sbz_no_scroll');
|
|
6450
6473
|
let metatag = document.getElementById('subiz-meta-viewport');
|
|
6451
6474
|
if (metatag) metatag.remove();
|
|
6452
6475
|
}
|
|
6453
6476
|
function modifyViewport() {
|
|
6454
6477
|
if (document.body && document.body.classList) document.body.classList.add('sbz_no_scroll');
|
|
6478
|
+
if (document.documentElement && document.documentElement.classList) document.documentElement.classList.add('sbz_no_scroll');
|
|
6455
6479
|
let metatag = document.createElement('meta');
|
|
6456
6480
|
metatag.httpEquiv = 'X-UA-Compatible';
|
|
6457
6481
|
metatag.name = 'viewport';
|
|
@@ -6462,196 +6486,196 @@ function modifyViewport() {
|
|
|
6462
6486
|
|
|
6463
6487
|
/***/ }),
|
|
6464
6488
|
|
|
6465
|
-
/***/
|
|
6489
|
+
/***/ 5671:
|
|
6466
6490
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6467
6491
|
|
|
6468
6492
|
module.exports = __webpack_require__.p + "assets/img/bubble_default.7d5e4ab.svg";
|
|
6469
6493
|
|
|
6470
6494
|
/***/ }),
|
|
6471
6495
|
|
|
6472
|
-
/***/
|
|
6496
|
+
/***/ 744:
|
|
6473
6497
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6474
6498
|
|
|
6475
6499
|
module.exports = __webpack_require__.p + "assets/img/caret.998eb8f.svg";
|
|
6476
6500
|
|
|
6477
6501
|
/***/ }),
|
|
6478
6502
|
|
|
6479
|
-
/***/
|
|
6503
|
+
/***/ 5580:
|
|
6480
6504
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6481
6505
|
|
|
6482
6506
|
module.exports = __webpack_require__.p + "assets/img/convos_empty.2353007.svg";
|
|
6483
6507
|
|
|
6484
6508
|
/***/ }),
|
|
6485
6509
|
|
|
6486
|
-
/***/
|
|
6510
|
+
/***/ 4824:
|
|
6487
6511
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6488
6512
|
|
|
6489
6513
|
module.exports = __webpack_require__.p + "assets/img/default.06e6ee0.jpg";
|
|
6490
6514
|
|
|
6491
6515
|
/***/ }),
|
|
6492
6516
|
|
|
6493
|
-
/***/
|
|
6517
|
+
/***/ 9460:
|
|
6494
6518
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6495
6519
|
|
|
6496
6520
|
module.exports = __webpack_require__.p + "assets/img/default_avatar.5b74dc1.png";
|
|
6497
6521
|
|
|
6498
6522
|
/***/ }),
|
|
6499
6523
|
|
|
6500
|
-
/***/
|
|
6524
|
+
/***/ 5856:
|
|
6501
6525
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6502
6526
|
|
|
6503
6527
|
module.exports = __webpack_require__.p + "assets/img/done_gray.d7e8203.svg";
|
|
6504
6528
|
|
|
6505
6529
|
/***/ }),
|
|
6506
6530
|
|
|
6507
|
-
/***/
|
|
6531
|
+
/***/ 4548:
|
|
6508
6532
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6509
6533
|
|
|
6510
6534
|
module.exports = __webpack_require__.p + "assets/img/done_green.b817fd4.svg";
|
|
6511
6535
|
|
|
6512
6536
|
/***/ }),
|
|
6513
6537
|
|
|
6514
|
-
/***/
|
|
6538
|
+
/***/ 2160:
|
|
6515
6539
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6516
6540
|
|
|
6517
6541
|
module.exports = __webpack_require__.p + "assets/img/empty.29bed2d.svg";
|
|
6518
6542
|
|
|
6519
6543
|
/***/ }),
|
|
6520
6544
|
|
|
6521
|
-
/***/
|
|
6545
|
+
/***/ 1020:
|
|
6522
6546
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6523
6547
|
|
|
6524
6548
|
module.exports = __webpack_require__.p + "assets/img/empty_1.0b98af0.svg";
|
|
6525
6549
|
|
|
6526
6550
|
/***/ }),
|
|
6527
6551
|
|
|
6528
|
-
/***/
|
|
6552
|
+
/***/ 928:
|
|
6529
6553
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6530
6554
|
|
|
6531
6555
|
module.exports = __webpack_require__.p + "assets/img/external-link.90577cc.svg";
|
|
6532
6556
|
|
|
6533
6557
|
/***/ }),
|
|
6534
6558
|
|
|
6535
|
-
/***/
|
|
6559
|
+
/***/ 3964:
|
|
6536
6560
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6537
6561
|
|
|
6538
6562
|
module.exports = __webpack_require__.p + "assets/img/ghn.070f8e3.svg";
|
|
6539
6563
|
|
|
6540
6564
|
/***/ }),
|
|
6541
6565
|
|
|
6542
|
-
/***/
|
|
6566
|
+
/***/ 9256:
|
|
6543
6567
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6544
6568
|
|
|
6545
6569
|
module.exports = __webpack_require__.p + "assets/img/ghtk.326eac1.svg";
|
|
6546
6570
|
|
|
6547
6571
|
/***/ }),
|
|
6548
6572
|
|
|
6549
|
-
/***/
|
|
6573
|
+
/***/ 6980:
|
|
6550
6574
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6551
6575
|
|
|
6552
6576
|
module.exports = __webpack_require__.p + "assets/img/image_default.be0698b.png";
|
|
6553
6577
|
|
|
6554
6578
|
/***/ }),
|
|
6555
6579
|
|
|
6556
|
-
/***/
|
|
6580
|
+
/***/ 3576:
|
|
6557
6581
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6558
6582
|
|
|
6559
6583
|
module.exports = __webpack_require__.p + "assets/img/info.ebce7ea.svg";
|
|
6560
6584
|
|
|
6561
6585
|
/***/ }),
|
|
6562
6586
|
|
|
6563
|
-
/***/
|
|
6587
|
+
/***/ 5616:
|
|
6564
6588
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6565
6589
|
|
|
6566
6590
|
module.exports = __webpack_require__.p + "assets/img/loader.37000a7.svg";
|
|
6567
6591
|
|
|
6568
6592
|
/***/ }),
|
|
6569
6593
|
|
|
6570
|
-
/***/
|
|
6594
|
+
/***/ 8860:
|
|
6571
6595
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6572
6596
|
|
|
6573
6597
|
module.exports = __webpack_require__.p + "assets/img/loading_static.a27f0ac.svg";
|
|
6574
6598
|
|
|
6575
6599
|
/***/ }),
|
|
6576
6600
|
|
|
6577
|
-
/***/
|
|
6601
|
+
/***/ 864:
|
|
6578
6602
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6579
6603
|
|
|
6580
6604
|
module.exports = __webpack_require__.p + "assets/img/not_found_search.2ddb8d1.png";
|
|
6581
6605
|
|
|
6582
6606
|
/***/ }),
|
|
6583
6607
|
|
|
6584
|
-
/***/
|
|
6608
|
+
/***/ 8224:
|
|
6585
6609
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6586
6610
|
|
|
6587
6611
|
module.exports = __webpack_require__.p + "assets/img/package.8d37d0f.svg";
|
|
6588
6612
|
|
|
6589
6613
|
/***/ }),
|
|
6590
6614
|
|
|
6591
|
-
/***/
|
|
6615
|
+
/***/ 7848:
|
|
6592
6616
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6593
6617
|
|
|
6594
6618
|
module.exports = __webpack_require__.p + "assets/img/package_fade.763c001.svg";
|
|
6595
6619
|
|
|
6596
6620
|
/***/ }),
|
|
6597
6621
|
|
|
6598
|
-
/***/
|
|
6622
|
+
/***/ 2672:
|
|
6599
6623
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6600
6624
|
|
|
6601
6625
|
module.exports = __webpack_require__.p + "assets/img/rating--average.1ea492c.svg";
|
|
6602
6626
|
|
|
6603
6627
|
/***/ }),
|
|
6604
6628
|
|
|
6605
|
-
/***/
|
|
6629
|
+
/***/ 1240:
|
|
6606
6630
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6607
6631
|
|
|
6608
6632
|
module.exports = __webpack_require__.p + "assets/img/rating--great.e3d712e.svg";
|
|
6609
6633
|
|
|
6610
6634
|
/***/ }),
|
|
6611
6635
|
|
|
6612
|
-
/***/
|
|
6636
|
+
/***/ 5168:
|
|
6613
6637
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6614
6638
|
|
|
6615
6639
|
module.exports = __webpack_require__.p + "assets/img/rating--poor.2938a25.svg";
|
|
6616
6640
|
|
|
6617
6641
|
/***/ }),
|
|
6618
6642
|
|
|
6619
|
-
/***/
|
|
6643
|
+
/***/ 6528:
|
|
6620
6644
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6621
6645
|
|
|
6622
6646
|
module.exports = __webpack_require__.p + "assets/img/search.f9705ff.svg";
|
|
6623
6647
|
|
|
6624
6648
|
/***/ }),
|
|
6625
6649
|
|
|
6626
|
-
/***/
|
|
6650
|
+
/***/ 7808:
|
|
6627
6651
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6628
6652
|
|
|
6629
6653
|
module.exports = __webpack_require__.p + "assets/img/send.6db52a9.svg";
|
|
6630
6654
|
|
|
6631
6655
|
/***/ }),
|
|
6632
6656
|
|
|
6633
|
-
/***/
|
|
6657
|
+
/***/ 428:
|
|
6634
6658
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6635
6659
|
|
|
6636
6660
|
module.exports = __webpack_require__.p + "assets/img/shop.f7dc7d8.svg";
|
|
6637
6661
|
|
|
6638
6662
|
/***/ }),
|
|
6639
6663
|
|
|
6640
|
-
/***/
|
|
6664
|
+
/***/ 6083:
|
|
6641
6665
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6642
6666
|
|
|
6643
6667
|
module.exports = __webpack_require__.p + "assets/img/shop_faded.df7845a.svg";
|
|
6644
6668
|
|
|
6645
6669
|
/***/ }),
|
|
6646
6670
|
|
|
6647
|
-
/***/
|
|
6671
|
+
/***/ 2560:
|
|
6648
6672
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6649
6673
|
|
|
6650
6674
|
module.exports = __webpack_require__.p + "assets/img/subiz-mono.877e9f5.svg";
|
|
6651
6675
|
|
|
6652
6676
|
/***/ }),
|
|
6653
6677
|
|
|
6654
|
-
/***/
|
|
6678
|
+
/***/ 7400:
|
|
6655
6679
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6656
6680
|
|
|
6657
6681
|
module.exports = __webpack_require__.p + "assets/img/x.26fdfa3.svg";
|