@subiz/widget-v4 4.1.62 → 4.1.63
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/README.md +10 -0
- package/assets/less/widget.less +16 -7
- package/dist/{792.js → 132.js} +121 -121
- package/dist/18dd22fb422.132.js +1 -0
- package/dist/18dd22fb422.27.js +1 -0
- package/dist/18dd22fb422.278.js +1 -0
- package/dist/{18d7db7ca8c.756.js → 18dd22fb422.459.js} +1 -1
- package/dist/18dd22fb422.490.js +1 -0
- package/dist/18dd22fb422.497.js +1 -0
- package/dist/18dd22fb422.74.js +1 -0
- package/dist/18dd22fb422.997.js +1 -0
- package/dist/18dd22fb422.app.js +1 -0
- package/dist/{18d7db7ca8c.index.html → 18dd22fb422.index.html} +1 -1
- package/dist/{18d7db7ca8c.library.html → 18dd22fb422.library.html} +1 -1
- package/dist/18dd22fb422.library.js +1 -0
- package/dist/{18d7db7ca8c.preview.html → 18dd22fb422.preview.html} +1 -1
- package/dist/18dd22fb422.preview.js +1 -0
- package/dist/18dd22fb422.screenshoot.js +1 -0
- package/dist/18dd22fb422.webview.js +1 -0
- package/dist/{444.js → 27.js} +6 -6
- package/dist/{176.js → 278.js} +54 -54
- package/dist/{756.js → 459.js} +6 -6
- package/dist/{104.js → 490.js} +57 -57
- package/dist/{928.js → 497.js} +676 -676
- package/dist/{508.js → 74.js} +30 -30
- package/dist/{672.js → 997.js} +6 -6
- package/dist/HASH +1 -1
- package/dist/malicious-app.js +4 -8
- package/dist/screenshoot.html +1 -1
- package/dist/screenshoot.js +292 -292
- package/package.json +2 -2
- package/src/chatbox/Widget.js +56 -32
- package/src/store/api.js +17 -0
- package/src/store/api_fake.js +3 -0
- package/src/store/store.js +16 -50
- package/dist/18d7db7ca8c.104.js +0 -1
- package/dist/18d7db7ca8c.176.js +0 -1
- package/dist/18d7db7ca8c.444.js +0 -1
- package/dist/18d7db7ca8c.508.js +0 -1
- package/dist/18d7db7ca8c.672.js +0 -1
- package/dist/18d7db7ca8c.792.js +0 -1
- package/dist/18d7db7ca8c.928.js +0 -1
- package/dist/18d7db7ca8c.app.js +0 -1
- package/dist/18d7db7ca8c.library.js +0 -1
- package/dist/18d7db7ca8c.preview.js +0 -1
- package/dist/18d7db7ca8c.screenshoot.js +0 -1
- package/dist/18d7db7ca8c.webview.js +0 -1
package/dist/{928.js → 497.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([[497],{
|
|
2
2
|
|
|
3
|
-
/***/
|
|
3
|
+
/***/ 1497:
|
|
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__(1405);
|
|
17
17
|
// EXTERNAL MODULE: ./src/common.js
|
|
18
|
-
var common = __webpack_require__(
|
|
18
|
+
var common = __webpack_require__(2840);
|
|
19
19
|
// EXTERNAL MODULE: ./node_modules/preact/dist/preact.module.js
|
|
20
|
-
var preact_module = __webpack_require__(
|
|
20
|
+
var preact_module = __webpack_require__(172);
|
|
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 */.Mw {
|
|
26
26
|
render() {
|
|
27
27
|
var emojiCode = this.props.emojiCode;
|
|
28
|
-
if (util/* default */.
|
|
28
|
+
if (util/* default */.A.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 */.Sq {
|
|
|
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__(1108);
|
|
40
|
+
let defaultAvatar = __webpack_require__(2538);
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
class ChatButton extends common/* Com */.
|
|
43
|
+
class ChatButton extends common/* Com */.Mw {
|
|
44
44
|
constructor(props) {
|
|
45
45
|
super(props);
|
|
46
46
|
this.setState({
|
|
@@ -51,11 +51,11 @@ class ChatButton extends common/* Com */.Sq {
|
|
|
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 */.A.get(ev, 'type') !== 'message_sent') return;
|
|
55
|
+
let bytype = util/* default */.A.get(ev, 'by.type');
|
|
56
56
|
if (bytype !== 'system' && bytype !== 'agent') return;
|
|
57
57
|
let isquickreplies = false;
|
|
58
|
-
util/* default */.
|
|
58
|
+
util/* default */.A.map(util/* default */.A.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 */.Sq {
|
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
fixMissingSetting(chatbox) {
|
|
72
|
-
chatbox = util/* default */.
|
|
73
|
-
if (util/* default */.
|
|
72
|
+
chatbox = util/* default */.A.cloneDeep(chatbox);
|
|
73
|
+
if (util/* default */.A.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 */.A.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 */.A.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 */.A.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 */.A.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 */.A.get(accountSetting, 'mobile_button.position') || position;
|
|
92
|
+
let hiddenButtonMobile = util/* default */.A.get(accountSetting, 'mobile_button.hidden');
|
|
93
93
|
if (hiddenButtonMobile) return null;
|
|
94
94
|
}
|
|
95
|
-
let hiddenButtonDesktop = util/* default */.
|
|
95
|
+
let hiddenButtonDesktop = util/* default */.A.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;
|
|
@@ -112,14 +112,14 @@ class ChatButton extends common/* Com */.Sq {
|
|
|
112
112
|
}
|
|
113
113
|
ShowGreeting() {
|
|
114
114
|
if (this.props.store.isMobile()) {
|
|
115
|
-
let accid = util/* default */.
|
|
115
|
+
let accid = util/* default */.A.get(this.props.plugin, 'chatbox.account_id', {});
|
|
116
116
|
if (accid === 'acqjeefqeaoiagyfprap') return;
|
|
117
117
|
}
|
|
118
|
-
let greeting = util/* default */.
|
|
118
|
+
let greeting = util/* default */.A.get(this.props.plugin, 'chatbox.greeting', {});
|
|
119
119
|
let agentM = this.props.store.matchAgent('*');
|
|
120
120
|
let byid = greeting.agent_id;
|
|
121
121
|
if (!byid) byid = randomAgent(agentM).id;
|
|
122
|
-
let text = this.props.t.i18n(util/* default */.
|
|
122
|
+
let text = this.props.t.i18n(util/* default */.A.get(greeting, 'greeting', {})) || greeting.message;
|
|
123
123
|
this.setState({
|
|
124
124
|
previewEvent: {
|
|
125
125
|
by: {
|
|
@@ -143,9 +143,9 @@ class ChatButton extends common/* Com */.Sq {
|
|
|
143
143
|
}
|
|
144
144
|
loadGreeting() {
|
|
145
145
|
let accountSetting = this.props.plugin.chatbox;
|
|
146
|
-
if (new util/* default */.
|
|
147
|
-
let greeting = util/* default */.
|
|
148
|
-
let text = this.props.t.i18n(util/* default */.
|
|
146
|
+
if (new util/* default */.A.Date().getTime() - this.props.store.matchClosePreviewAt() < Ms30Mins) return;
|
|
147
|
+
let greeting = util/* default */.A.get(accountSetting, 'greeting', {});
|
|
148
|
+
let text = this.props.t.i18n(util/* default */.A.get(greeting, 'greeting', {})) || greeting.message;
|
|
149
149
|
if (!text || !greeting.enabled) {
|
|
150
150
|
this.setState({
|
|
151
151
|
previewEvent: {}
|
|
@@ -156,8 +156,8 @@ class ChatButton extends common/* Com */.Sq {
|
|
|
156
156
|
}
|
|
157
157
|
onClick() {
|
|
158
158
|
let lastview = this.props.store.matchLastview();
|
|
159
|
-
if (util/* default */.
|
|
160
|
-
if (lastview.view !== 'list' || util/* default */.
|
|
159
|
+
if (util/* default */.A.get(lastview, 'view')) {
|
|
160
|
+
if (lastview.view !== 'list' || util/* default */.A.size(this.props.store.matchConvo('*')) > 0) {
|
|
161
161
|
return this.props.onClick && this.props.onClick(Object.assign({}, lastview.opts, {
|
|
162
162
|
view: lastview.view
|
|
163
163
|
}));
|
|
@@ -166,10 +166,10 @@ class ChatButton extends common/* Com */.Sq {
|
|
|
166
166
|
return this.onPreviewClick();
|
|
167
167
|
}
|
|
168
168
|
onPreviewClick(e) {
|
|
169
|
-
let cid = util/* default */.
|
|
169
|
+
let cid = util/* default */.A.convoOfEv(this.state.previewEvent);
|
|
170
170
|
if (!cid) {
|
|
171
|
-
let convos = util/* default */.
|
|
172
|
-
let convo = util/* default */.
|
|
171
|
+
let convos = util/* default */.A.map(this.props.store.matchConvo('*'));
|
|
172
|
+
let convo = util/* default */.A.find(convos, convo => !util/* default */.A.isConvoSeen(convo, this.props.store.matchUser().id));
|
|
173
173
|
if (!convo) convo = convos[0] || {};
|
|
174
174
|
cid = convo.id;
|
|
175
175
|
}
|
|
@@ -189,24 +189,24 @@ class ChatButton extends common/* Com */.Sq {
|
|
|
189
189
|
renderPreview() {
|
|
190
190
|
let account = this.props.store.matchAccount();
|
|
191
191
|
let accountSetting = this.props.plugin.chatbox;
|
|
192
|
-
let byid = util/* default */.
|
|
193
|
-
let agent = util/* default */.
|
|
194
|
-
agent.fullname = agent.fullname || util/* default */.
|
|
192
|
+
let byid = util/* default */.A.get(this.state.previewEvent, 'by.display_id', util/* default */.A.get(this.state.previewEvent, 'by.id'));
|
|
193
|
+
let agent = util/* default */.A.cloneDeep(this.props.store.matchAgent(byid)) || {};
|
|
194
|
+
agent.fullname = agent.fullname || util/* default */.A.get(account, 'name') || this.props.t('agent');
|
|
195
195
|
agent.avatar_url = agent.avatar_url || defaultAvatar;
|
|
196
|
-
let position = util/* default */.
|
|
196
|
+
let position = util/* default */.A.get(accountSetting, 'desktop_button.position') || 'right';
|
|
197
197
|
if (this.props.store.isMobile()) {
|
|
198
|
-
position = util/* default */.
|
|
198
|
+
position = util/* default */.A.get(accountSetting, 'mobile_button.position') || position;
|
|
199
199
|
}
|
|
200
200
|
if (accountSetting && accountSetting.hide_agent_profile) {
|
|
201
201
|
agent = Object.assign({}, account, {
|
|
202
|
-
avatar_url: account.logo_url || __webpack_require__(
|
|
202
|
+
avatar_url: account.logo_url || __webpack_require__(3582),
|
|
203
203
|
fullname: account.name || this.props.t('agent')
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
206
|
let cls = 'widget-preview widget-preview--' + position;
|
|
207
207
|
if (!this.state.displayPreview) cls += ' widget-preview--hidden';
|
|
208
208
|
var tags = this.renderMessagePreview(this.state.previewEvent, this.props.t('sent_you_a_message'));
|
|
209
|
-
if (util/* default */.
|
|
209
|
+
if (util/* default */.A.size(tags) === 0) cls += ' widget-preview--hidden';
|
|
210
210
|
return (0,preact_module.h)("div", {
|
|
211
211
|
class: cls
|
|
212
212
|
}, (0,preact_module.h)("div", {
|
|
@@ -249,20 +249,20 @@ class ChatButton extends common/* Com */.Sq {
|
|
|
249
249
|
renderButton() {
|
|
250
250
|
let accountSetting = this.props.plugin.chatbox;
|
|
251
251
|
accountSetting = this.fixMissingSetting(accountSetting);
|
|
252
|
-
let imgsrc = util/* default */.
|
|
253
|
-
let background = util/* default */.
|
|
254
|
-
let position = util/* default */.
|
|
255
|
-
let imgurl = util/* default */.
|
|
256
|
-
let maskurl = util/* default */.
|
|
257
|
-
let imgwidth = util/* default */.
|
|
258
|
-
let imgheight = util/* default */.
|
|
252
|
+
let imgsrc = util/* default */.A.get(accountSetting, 'desktop_button.background_image_url') || util/* default */.A.get(accountSetting, 'desktop_button.background_mask_url') || defaultBubble;
|
|
253
|
+
let background = util/* default */.A.get(accountSetting, 'background') || DEF_BG;
|
|
254
|
+
let position = util/* default */.A.get(accountSetting, 'desktop_button.position') || 'right';
|
|
255
|
+
let imgurl = util/* default */.A.get(accountSetting, 'desktop_button.background_image_url');
|
|
256
|
+
let maskurl = util/* default */.A.get(accountSetting, 'desktop_button.background_mask_url');
|
|
257
|
+
let imgwidth = util/* default */.A.get(accountSetting, 'desktop_button.width') || 70;
|
|
258
|
+
let imgheight = util/* default */.A.get(accountSetting, 'desktop_button.height') || 70;
|
|
259
259
|
if (this.props.store.isMobile()) {
|
|
260
|
-
imgsrc = util/* default */.
|
|
261
|
-
position = util/* default */.
|
|
262
|
-
let mobileimgurl = util/* default */.
|
|
263
|
-
let mobilemaskurl = util/* default */.
|
|
264
|
-
imgwidth = util/* default */.
|
|
265
|
-
imgheight = util/* default */.
|
|
260
|
+
imgsrc = util/* default */.A.get(accountSetting, 'mobile_button.background_image_url') || util/* default */.A.get(accountSetting, 'mobile_button.background_mask_url') || imgsrc;
|
|
261
|
+
position = util/* default */.A.get(accountSetting, 'mobile_button.position') || position;
|
|
262
|
+
let mobileimgurl = util/* default */.A.get(accountSetting, 'mobile_button.background_image_url');
|
|
263
|
+
let mobilemaskurl = util/* default */.A.get(accountSetting, 'mobile_button.background_mask_url');
|
|
264
|
+
imgwidth = util/* default */.A.get(accountSetting, 'mobile_button.width') || 70;
|
|
265
|
+
imgheight = util/* default */.A.get(accountSetting, 'mobile_button.height') || 70;
|
|
266
266
|
if (mobileimgurl || mobilemaskurl) {
|
|
267
267
|
imgurl = mobileimgurl;
|
|
268
268
|
maskurl = mobilemaskurl;
|
|
@@ -365,14 +365,14 @@ class ChatButton extends common/* Com */.Sq {
|
|
|
365
365
|
}
|
|
366
366
|
renderMessagePreview(ev, defmsg) {
|
|
367
367
|
defmsg = defmsg || 'Sent you a message';
|
|
368
|
-
let message = util/* default */.
|
|
369
|
-
var format = util/* default */.
|
|
368
|
+
let message = util/* default */.A.get(ev, 'data.message.text');
|
|
369
|
+
var format = util/* default */.A.get(ev, 'data.message.format');
|
|
370
370
|
if (format === 'delta') return this.renderDeltaMessagePreview(ev, defmsg);
|
|
371
371
|
if (format && format !== 'plaintext') message = defmsg;
|
|
372
|
-
if (!message && util/* default */.
|
|
372
|
+
if (!message && util/* default */.A.size(util/* default */.A.get(ev, 'data.message.attachments')) > 0) message = defmsg;
|
|
373
373
|
if (!message) return null;
|
|
374
|
-
let byType = util/* default */.
|
|
375
|
-
var tags = util/* default */.
|
|
374
|
+
let byType = util/* default */.A.get(ev, 'by.type');
|
|
375
|
+
var tags = util/* default */.A.extractText(message).map(tag => {
|
|
376
376
|
if (tag.type === 'emoji') return (0,preact_module.h)(Emoji, {
|
|
377
377
|
emojiCode: tag.text,
|
|
378
378
|
byType: byType
|
|
@@ -383,17 +383,17 @@ class ChatButton extends common/* Com */.Sq {
|
|
|
383
383
|
}
|
|
384
384
|
renderDeltaMessagePreview(ev, defmsg) {
|
|
385
385
|
defmsg = defmsg || 'Sent you a message';
|
|
386
|
-
let message = util/* default */.
|
|
387
|
-
if (!message && util/* default */.
|
|
386
|
+
let message = util/* default */.A.get(ev, 'data.message.quill_delta');
|
|
387
|
+
if (!message && util/* default */.A.size(util/* default */.A.get(ev, 'data.message.attachments')) > 0) message = defmsg;
|
|
388
388
|
if (!message) return;
|
|
389
|
-
let quilldeltas = util/* default */.
|
|
390
|
-
if (!quilldeltas || util/* default */.
|
|
391
|
-
let $deltas = util/* default */.
|
|
389
|
+
let quilldeltas = util/* default */.A.parseJSON(message) || {};
|
|
390
|
+
if (!quilldeltas || util/* default */.A.size(quilldeltas.ops) === 0) return null;
|
|
391
|
+
let $deltas = util/* default */.A.map(quilldeltas.ops, delta => {
|
|
392
392
|
let html = '';
|
|
393
393
|
let insert = delta.insert;
|
|
394
394
|
let attributes = delta.attributes;
|
|
395
395
|
if (insert.dynamicField) {
|
|
396
|
-
return util/* default */.
|
|
396
|
+
return util/* default */.A.get(insert, 'dynamicField.text', '');
|
|
397
397
|
}
|
|
398
398
|
if (insert.emoji) return (0,preact_module.h)(Emoji, {
|
|
399
399
|
emojiCode: `:${insert.emoji}:`
|
|
@@ -418,17 +418,17 @@ class ChatButton extends common/* Com */.Sq {
|
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
420
|
function randomAgent(agentM) {
|
|
421
|
-
var agents = util/* default */.
|
|
422
|
-
return agents[Math.floor(Math.random() * util/* default */.
|
|
421
|
+
var agents = util/* default */.A.filter(agentM, ag => ag.type === 'agent');
|
|
422
|
+
return agents[Math.floor(Math.random() * util/* default */.A.size(agents))] || {};
|
|
423
423
|
}
|
|
424
424
|
const Ms30Mins = 30 * 60 * 1000;
|
|
425
425
|
const DEF_BG_URL = 'https://vcdn.subiz-cdn.com/file/bubble_11.svg?v=5';
|
|
426
426
|
const DEF_BG = 'linear-gradient(280.16deg, #0053d3 22.03%, #0265ff 78.2%)';
|
|
427
427
|
;// CONCATENATED MODULE: ./src/chatbox/PoweredBy.js
|
|
428
|
-
var logo = __webpack_require__(
|
|
428
|
+
var logo = __webpack_require__(9529);
|
|
429
429
|
|
|
430
430
|
|
|
431
|
-
class PoweredBy extends common/* Com */.
|
|
431
|
+
class PoweredBy extends common/* Com */.Mw {
|
|
432
432
|
constructor(props) {
|
|
433
433
|
super(props);
|
|
434
434
|
}
|
|
@@ -456,7 +456,7 @@ class PoweredBy extends common/* Com */.Sq {
|
|
|
456
456
|
|
|
457
457
|
|
|
458
458
|
|
|
459
|
-
class AgentsAvatar extends common/* Com */.
|
|
459
|
+
class AgentsAvatar extends common/* Com */.Mw {
|
|
460
460
|
constructor(props) {
|
|
461
461
|
super(props);
|
|
462
462
|
}
|
|
@@ -477,21 +477,21 @@ class AgentsAvatar extends common/* Com */.Sq {
|
|
|
477
477
|
height: 35,
|
|
478
478
|
alt: "agent avatar left",
|
|
479
479
|
class: "avatar group-avatar--agent-left",
|
|
480
|
-
src: this.props.store.replaceFileUrl(acc.logo_url) || __webpack_require__(
|
|
480
|
+
src: this.props.store.replaceFileUrl(acc.logo_url) || __webpack_require__(3582)
|
|
481
481
|
})));
|
|
482
482
|
}
|
|
483
483
|
let agentM = this.props.store.matchAgent('*');
|
|
484
|
-
var agents = util/* default */.
|
|
485
|
-
if (this.props.agent_ids === undefined || util/* default */.
|
|
486
|
-
var agids = util/* default */.
|
|
487
|
-
agids = util/* default */.
|
|
484
|
+
var agents = util/* default */.A.map(this.props.agent_ids, id => agentM[id]);
|
|
485
|
+
if (this.props.agent_ids === undefined || util/* default */.A.size(this.props.agent_ids) === 0) {
|
|
486
|
+
var agids = util/* default */.A.get(accountSetting, 'header.agent_ids', []);
|
|
487
|
+
agids = util/* default */.A.filter(agids, id => !!agentM[id]);
|
|
488
488
|
if (agids.length !== 0) {
|
|
489
|
-
agents = util/* default */.
|
|
489
|
+
agents = util/* default */.A.map(agids, id => agentM[id]);
|
|
490
490
|
} else {
|
|
491
|
-
agents = util/* default */.
|
|
491
|
+
agents = util/* default */.A.filter(agentM, agent => agent.type === 'agent');
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
|
-
agents = util/* default */.
|
|
494
|
+
agents = util/* default */.A.filter(agents, ag => !!ag);
|
|
495
495
|
if (agents.length === 0) {
|
|
496
496
|
return (0,preact_module.h)("div", {
|
|
497
497
|
class: `group-avatar group-avatar--${mode}`
|
|
@@ -504,7 +504,7 @@ class AgentsAvatar extends common/* Com */.Sq {
|
|
|
504
504
|
height: 35,
|
|
505
505
|
alt: "agent avatar left",
|
|
506
506
|
class: "avatar group-avatar--agent-left",
|
|
507
|
-
src: this.props.store.replaceFileUrl(acc.logo_url) || __webpack_require__(
|
|
507
|
+
src: this.props.store.replaceFileUrl(acc.logo_url) || __webpack_require__(3582)
|
|
508
508
|
})));
|
|
509
509
|
}
|
|
510
510
|
if (agents.length === 1) {
|
|
@@ -521,7 +521,7 @@ class AgentsAvatar extends common/* Com */.Sq {
|
|
|
521
521
|
height: 35,
|
|
522
522
|
class: `avatar ${groupClass}`,
|
|
523
523
|
alt: "agent avatar",
|
|
524
|
-
src: this.props.store.replaceFileUrl(agent.avatar_url) || __webpack_require__(
|
|
524
|
+
src: this.props.store.replaceFileUrl(agent.avatar_url) || __webpack_require__(2538)
|
|
525
525
|
})));
|
|
526
526
|
}
|
|
527
527
|
if (agents.length === 2) {
|
|
@@ -538,7 +538,7 @@ class AgentsAvatar extends common/* Com */.Sq {
|
|
|
538
538
|
height: 35,
|
|
539
539
|
alt: "agent avatar left",
|
|
540
540
|
class: "avatar group-avatar--agent-left",
|
|
541
|
-
src: this.props.store.replaceFileUrl(leftAgent.avatar_url) || __webpack_require__(
|
|
541
|
+
src: this.props.store.replaceFileUrl(leftAgent.avatar_url) || __webpack_require__(2538)
|
|
542
542
|
})), (0,preact_module.h)("div", {
|
|
543
543
|
class: "d-inline-block pos-relative",
|
|
544
544
|
"data-tooltip": rightAgent.fullname || acc.name,
|
|
@@ -548,7 +548,7 @@ class AgentsAvatar extends common/* Com */.Sq {
|
|
|
548
548
|
width: 35,
|
|
549
549
|
height: 35,
|
|
550
550
|
class: "avatar group-avatar--agent-right",
|
|
551
|
-
src: this.props.store.replaceFileUrl(rightAgent.avatar_url) || __webpack_require__(
|
|
551
|
+
src: this.props.store.replaceFileUrl(rightAgent.avatar_url) || __webpack_require__(2538)
|
|
552
552
|
})));
|
|
553
553
|
}
|
|
554
554
|
let leftAgent = agents[0];
|
|
@@ -565,7 +565,7 @@ class AgentsAvatar extends common/* Com */.Sq {
|
|
|
565
565
|
height: 35,
|
|
566
566
|
alt: "agent avatar left",
|
|
567
567
|
class: "avatar group-avatar--agent-left",
|
|
568
|
-
src: this.props.store.replaceFileUrl(leftAgent.avatar_url) || __webpack_require__(
|
|
568
|
+
src: this.props.store.replaceFileUrl(leftAgent.avatar_url) || __webpack_require__(2538)
|
|
569
569
|
})), (0,preact_module.h)("div", {
|
|
570
570
|
class: "d-inline-block pos-relative",
|
|
571
571
|
"data-tooltip": middleAgent.fullname || acc.name,
|
|
@@ -575,7 +575,7 @@ class AgentsAvatar extends common/* Com */.Sq {
|
|
|
575
575
|
width: 35,
|
|
576
576
|
height: 35,
|
|
577
577
|
class: "avatar group-avatar--agent-middle",
|
|
578
|
-
src: this.props.store.replaceFileUrl(middleAgent.avatar_url) || __webpack_require__(
|
|
578
|
+
src: this.props.store.replaceFileUrl(middleAgent.avatar_url) || __webpack_require__(2538)
|
|
579
579
|
})), (0,preact_module.h)("div", {
|
|
580
580
|
class: "d-inline-block pos-relative",
|
|
581
581
|
"data-tooltip": rightAgent.fullname || acc.name,
|
|
@@ -585,7 +585,7 @@ class AgentsAvatar extends common/* Com */.Sq {
|
|
|
585
585
|
height: 35,
|
|
586
586
|
alt: "agent avatar right",
|
|
587
587
|
class: "avatar group-avatar--agent-right",
|
|
588
|
-
src: this.props.store.replaceFileUrl(rightAgent.avatar_url) || __webpack_require__(
|
|
588
|
+
src: this.props.store.replaceFileUrl(rightAgent.avatar_url) || __webpack_require__(2538)
|
|
589
589
|
})));
|
|
590
590
|
}
|
|
591
591
|
}
|
|
@@ -595,7 +595,7 @@ class AgentsAvatar extends common/* Com */.Sq {
|
|
|
595
595
|
|
|
596
596
|
|
|
597
597
|
|
|
598
|
-
class Header extends common/* Com */.
|
|
598
|
+
class Header extends common/* Com */.Mw {
|
|
599
599
|
constructor(props) {
|
|
600
600
|
super(props);
|
|
601
601
|
}
|
|
@@ -605,7 +605,7 @@ class Header extends common/* Com */.Sq {
|
|
|
605
605
|
let renderSocial = false;
|
|
606
606
|
let renderTeam = false;
|
|
607
607
|
let accSetting = this.props.plugin.chatbox || {};
|
|
608
|
-
let layout = util/* default */.
|
|
608
|
+
let layout = util/* default */.A.get(accSetting, 'header.layout');
|
|
609
609
|
let renderCollapsed = this.props.view !== 'list' && headerMode === 'collapsed';
|
|
610
610
|
let renderClassic = !renderCollapsed && layout === 'classic';
|
|
611
611
|
if (renderCollapsed || layout == 'classic') {
|
|
@@ -623,9 +623,9 @@ class Header extends common/* Com */.Sq {
|
|
|
623
623
|
let accSetting = this.props.plugin.chatbox || {};
|
|
624
624
|
let acc = this.props.store.matchAccount() || {};
|
|
625
625
|
let state = acc.is_online ? this.props.t('agent_online') : this.props.t('agent_offline');
|
|
626
|
-
let tagline = util/* default */.
|
|
626
|
+
let tagline = util/* default */.A.get(accSetting, `tagline`, {});
|
|
627
627
|
let desc = this.props.t.i18n(tagline) || accSetting.introduction || state;
|
|
628
|
-
let agentIdsJoined = util/* default */.
|
|
628
|
+
let agentIdsJoined = util/* default */.A.map(this.getAgentJoined(this.props.cid), agent => agent.id);
|
|
629
629
|
let cls = 'widget-header--inner widget-header--inner--collapsed';
|
|
630
630
|
if (!show) cls += ' widget-header--inner--hidden';
|
|
631
631
|
let $back = null;
|
|
@@ -651,8 +651,8 @@ class Header extends common/* Com */.Sq {
|
|
|
651
651
|
renderSocial(show) {
|
|
652
652
|
let accSetting = this.props.plugin.chatbox || {};
|
|
653
653
|
let acc = this.props.store.matchAccount() || {};
|
|
654
|
-
let links = util/* default */.
|
|
655
|
-
let $links = util/* default */.
|
|
654
|
+
let links = util/* default */.A.get(accSetting, 'header.links') || [];
|
|
655
|
+
let $links = util/* default */.A.map(links, link => {
|
|
656
656
|
if (!link.url || !link.type || link.type === 'subiz') return null;
|
|
657
657
|
if (link.type === 'email') {
|
|
658
658
|
return (0,preact_module.h)("div", null, (0,preact_module.h)("a", {
|
|
@@ -672,9 +672,9 @@ class Header extends common/* Com */.Sq {
|
|
|
672
672
|
});
|
|
673
673
|
const DEFTEAMINTO = `Chúng tôi sẵn sàng trợ giúp :wave:.
|
|
674
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`;
|
|
675
|
-
let tagline = util/* default */.
|
|
675
|
+
let tagline = util/* default */.A.get(accSetting, `tagline`, {});
|
|
676
676
|
var teamintro = this.props.t.i18n(tagline) || accSetting.introduction || this.props.t('team_intro') || DEFTEAMINTO;
|
|
677
|
-
var tags = util/* default */.
|
|
677
|
+
var tags = util/* default */.A.extractText(teamintro).map(tag => {
|
|
678
678
|
if (tag.type === 'emoji') return (0,preact_module.h)(Emoji, {
|
|
679
679
|
emojiCode: tag.text
|
|
680
680
|
});
|
|
@@ -695,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
|
|
|
695
695
|
}, (0,preact_module.h)("img", {
|
|
696
696
|
alt: "logo",
|
|
697
697
|
class: "social__account_logo",
|
|
698
|
-
src: this.props.store.replaceFileUrl(util/* default */.
|
|
698
|
+
src: this.props.store.replaceFileUrl(util/* default */.A.get(acc, 'logo_url'))
|
|
699
699
|
}), (0,preact_module.h)("div", null, (0,preact_module.h)("div", {
|
|
700
700
|
class: "social__introduction"
|
|
701
701
|
}, tags), (0,preact_module.h)("div", {
|
|
@@ -706,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
|
|
|
706
706
|
let accSetting = this.props.plugin.chatbox || {};
|
|
707
707
|
const DEFTEAMINTO = `Chúng tôi sẵn sàng trợ giúp :wave:.
|
|
708
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`;
|
|
709
|
-
let tagline = util/* default */.
|
|
709
|
+
let tagline = util/* default */.A.get(accSetting, `tagline`, {});
|
|
710
710
|
var teamintro = this.props.t.i18n(tagline) || accSetting.introduction || this.props.t('team_intro') || DEFTEAMINTO;
|
|
711
|
-
var tags = util/* default */.
|
|
711
|
+
var tags = util/* default */.A.extractText(teamintro).map(tag => {
|
|
712
712
|
if (tag.type === 'emoji') return (0,preact_module.h)(Emoji, {
|
|
713
713
|
emojiCode: tag.text
|
|
714
714
|
});
|
|
@@ -742,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
|
|
|
742
742
|
let accSetting = this.props.plugin.chatbox || {};
|
|
743
743
|
let acc = this.props.store.matchAccount() || {};
|
|
744
744
|
let agentsJoined = this.getAgentJoined(this.props.cid);
|
|
745
|
-
let caption = util/* default */.
|
|
745
|
+
let caption = util/* default */.A.get(this.props.plugin, 'chatbox.caption', {});
|
|
746
746
|
let title = this.props.t.i18n(caption) || accSetting.title;
|
|
747
747
|
return getJoinedNameMember(agentsJoined) || title || acc.name || this.props.t('widget_title');
|
|
748
748
|
}
|
|
749
749
|
renderBackButton() {
|
|
750
750
|
let allconvos = this.props.store.matchConvo('*');
|
|
751
|
-
if (util/* default */.
|
|
751
|
+
if (util/* default */.A.size(allconvos) === 0) return null;
|
|
752
752
|
var $unreadcount = null;
|
|
753
753
|
let user = this.props.store.matchUser();
|
|
754
754
|
let unreadcount = 0;
|
|
755
|
-
util/* default */.
|
|
755
|
+
util/* default */.A.map(allconvos, convo => {
|
|
756
756
|
if (convo.id == this.props.cid) return;
|
|
757
|
-
if (!util/* default */.
|
|
757
|
+
if (!util/* default */.A.isConvoSeen(convo, user.id)) unreadcount++;
|
|
758
758
|
});
|
|
759
759
|
if (unreadcount !== 0) {
|
|
760
760
|
$unreadcount = (0,preact_module.h)("span", {
|
|
@@ -793,14 +793,14 @@ Vui lòng hỏi chúng tôi bất cứ điều gì hoặc chia sẻ phản hồi
|
|
|
793
793
|
}
|
|
794
794
|
getAgentJoined(cid) {
|
|
795
795
|
var convo = this.props.store.matchConvo(cid) || {};
|
|
796
|
-
let joined = util/* default */.
|
|
796
|
+
let joined = util/* default */.A.filter(convo.members, mem => mem.type === 'agent' && mem.membership === 'active');
|
|
797
797
|
return joined;
|
|
798
798
|
}
|
|
799
799
|
}
|
|
800
800
|
let getJoinedNameMember = agents => {
|
|
801
|
-
agents = util/* default */.
|
|
801
|
+
agents = util/* default */.A.filter(agents, agent => util/* default */.A.trim(agent.fullname));
|
|
802
802
|
if (!agents.length) return null;
|
|
803
|
-
return util/* default */.
|
|
803
|
+
return util/* default */.A.map(agents, agent => agent.fullname).join(', ');
|
|
804
804
|
};
|
|
805
805
|
;// CONCATENATED MODULE: ./src/chatbox/MessageInput.js
|
|
806
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; }
|
|
@@ -810,25 +810,25 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
810
810
|
|
|
811
811
|
|
|
812
812
|
|
|
813
|
-
class MessageInput extends common/* Com */.
|
|
813
|
+
class MessageInput extends common/* Com */.Mw {
|
|
814
814
|
constructor(props) {
|
|
815
815
|
super(props);
|
|
816
|
-
_defineProperty(this, "onEnter", util/* default */.
|
|
816
|
+
_defineProperty(this, "onEnter", util/* default */.A.throttle(function () {
|
|
817
817
|
this.submitMessage();
|
|
818
818
|
}, 50));
|
|
819
|
-
this.refFileInput = (0,preact_module/* createRef */.
|
|
820
|
-
this.refMessageInput = (0,preact_module/* createRef */.
|
|
819
|
+
this.refFileInput = (0,preact_module/* createRef */._3)();
|
|
820
|
+
this.refMessageInput = (0,preact_module/* createRef */._3)();
|
|
821
821
|
this.props.store.onUpdate(this, _ => this.forceUpdate());
|
|
822
822
|
this.props.store.onConvoEvent(this, ev => {
|
|
823
|
-
var evcid = util/* default */.
|
|
823
|
+
var evcid = util/* default */.A.convoOfEv(ev);
|
|
824
824
|
if (evcid !== this.props.cid) return;
|
|
825
825
|
this.forceUpdate();
|
|
826
826
|
});
|
|
827
827
|
this.focus();
|
|
828
|
-
this._forceUpdate = util/* default */.
|
|
828
|
+
this._forceUpdate = util/* default */.A.throttle(() => {
|
|
829
829
|
this.forceUpdate();
|
|
830
830
|
}, 500);
|
|
831
|
-
this.resizeInput = util/* default */.
|
|
831
|
+
this.resizeInput = util/* default */.A.throttle(function () {
|
|
832
832
|
const input = this.refMessageInput.current;
|
|
833
833
|
input.style.setProperty('height', '1em', 'important');
|
|
834
834
|
const height = Math.min(200, input.scrollHeight);
|
|
@@ -848,7 +848,7 @@ class MessageInput extends common/* Com */.Sq {
|
|
|
848
848
|
class: "message-input--button message-input--attachment-button",
|
|
849
849
|
onClick: e => this.selectFile(e)
|
|
850
850
|
}));
|
|
851
|
-
var msg = util/* default */.
|
|
851
|
+
var msg = util/* default */.A.trim(this.refMessageInput.current && this.refMessageInput.current.value);
|
|
852
852
|
if (msg.length > 0) {
|
|
853
853
|
buttons = (0,preact_module.h)("div", {
|
|
854
854
|
class: "d-flex flex-row align-self-end"
|
|
@@ -887,30 +887,30 @@ class MessageInput extends common/* Com */.Sq {
|
|
|
887
887
|
}
|
|
888
888
|
hasUnfinishRequiredFormOrLock() {
|
|
889
889
|
let convo = this.props.store.matchConvo(this.props.cid);
|
|
890
|
-
if (util/* default */.
|
|
890
|
+
if (util/* default */.A.get(convo, 'state') === 'ended') return false;
|
|
891
891
|
let events = this.props.store.listEvents(this.props.cid);
|
|
892
|
-
events = util/* default */.
|
|
893
|
-
let attachments = util/* default */.
|
|
894
|
-
let lock = util/* default */.
|
|
892
|
+
events = util/* default */.A.orderBy(events, 'created', 'desc').filter(ev => ev.type === 'message_sent');
|
|
893
|
+
let attachments = util/* default */.A.get(events[0], 'data.message.attachments', []);
|
|
894
|
+
let lock = util/* default */.A.find(attachments, att => util/* default */.A.get(att, 'lock_input'));
|
|
895
895
|
if (lock) return true;
|
|
896
896
|
var last_agent_sent;
|
|
897
897
|
for (let ev of events) {
|
|
898
|
-
if (util/* default */.
|
|
898
|
+
if (util/* default */.A.get(ev, 'by.type') === 'user') continue;
|
|
899
899
|
last_agent_sent = ev;
|
|
900
900
|
break;
|
|
901
901
|
}
|
|
902
|
-
attachments = util/* default */.
|
|
903
|
-
let pendingForms = util/* default */.
|
|
902
|
+
attachments = util/* default */.A.get(last_agent_sent, 'data.message.attachments', []);
|
|
903
|
+
let pendingForms = util/* default */.A.filter(attachments, att => {
|
|
904
904
|
if (!att) return false;
|
|
905
905
|
if (att.type !== 'form' && att.type !== 'ask_info_form') return false;
|
|
906
906
|
var form = att.form;
|
|
907
907
|
if (!form) return false;
|
|
908
|
-
var state = util/* default */.
|
|
908
|
+
var state = util/* default */.A.parseJSON(form.state) || {};
|
|
909
909
|
if (!state.require_finished && att.type !== 'ask_info_form') return false;
|
|
910
910
|
if (isSummited(att.form)) return false;
|
|
911
911
|
return true;
|
|
912
912
|
});
|
|
913
|
-
return util/* default */.
|
|
913
|
+
return util/* default */.A.size(pendingForms) > 0;
|
|
914
914
|
}
|
|
915
915
|
renderEmojiPopup() {
|
|
916
916
|
if (!this.state.openEmoji) return null;
|
|
@@ -1014,10 +1014,10 @@ class MessageInput extends common/* Com */.Sq {
|
|
|
1014
1014
|
focus() {
|
|
1015
1015
|
if (this.props.disabled) return;
|
|
1016
1016
|
this.refMessageInput.current && this.refMessageInput.current.focus();
|
|
1017
|
-
util/* default */.
|
|
1017
|
+
util/* default */.A.setTimeout(() => {
|
|
1018
1018
|
this.refMessageInput.current && this.refMessageInput.current.focus();
|
|
1019
1019
|
});
|
|
1020
|
-
util/* default */.
|
|
1020
|
+
util/* default */.A.setTimeout(() => {
|
|
1021
1021
|
this.refMessageInput.current && this.refMessageInput.current.focus();
|
|
1022
1022
|
}, 100);
|
|
1023
1023
|
}
|
|
@@ -1067,9 +1067,9 @@ class MessageInput extends common/* Com */.Sq {
|
|
|
1067
1067
|
$input.value = '';
|
|
1068
1068
|
}
|
|
1069
1069
|
_sendFile(files) {
|
|
1070
|
-
if (util/* default */.
|
|
1070
|
+
if (util/* default */.A.size(files) === 0) return;
|
|
1071
1071
|
if (this.props.disabled) return;
|
|
1072
|
-
let attachments = util/* default */.
|
|
1072
|
+
let attachments = util/* default */.A.map(files, file => {
|
|
1073
1073
|
return {
|
|
1074
1074
|
type: 'file',
|
|
1075
1075
|
mimetype: file.type,
|
|
@@ -1083,7 +1083,7 @@ class MessageInput extends common/* Com */.Sq {
|
|
|
1083
1083
|
});
|
|
1084
1084
|
}
|
|
1085
1085
|
async submitMessage(msg) {
|
|
1086
|
-
msg = msg || util/* default */.
|
|
1086
|
+
msg = msg || util/* default */.A.trim(this.refMessageInput.current.value) || '';
|
|
1087
1087
|
if (!msg) return;
|
|
1088
1088
|
if (this.props.disabled) return;
|
|
1089
1089
|
this.refMessageInput.current.value = '';
|
|
@@ -1102,7 +1102,7 @@ class MessageInput extends common/* Com */.Sq {
|
|
|
1102
1102
|
}
|
|
1103
1103
|
pasteImage(event) {
|
|
1104
1104
|
if (!window.File || !window.FileReader || !window.FileList || !window.Blob) return;
|
|
1105
|
-
let now = new util/* default */.
|
|
1105
|
+
let now = new util/* default */.A.Date();
|
|
1106
1106
|
let year = now.getFullYear();
|
|
1107
1107
|
let month = now.getMonth() + 1;
|
|
1108
1108
|
let date = now.getDate();
|
|
@@ -1124,8 +1124,8 @@ class MessageInput extends common/* Com */.Sq {
|
|
|
1124
1124
|
}
|
|
1125
1125
|
}
|
|
1126
1126
|
function isSummited(form) {
|
|
1127
|
-
let fields = util/* default */.
|
|
1128
|
-
return util/* default */.
|
|
1127
|
+
let fields = util/* default */.A.get(form, 'fields') || [];
|
|
1128
|
+
return util/* default */.A.find(fields, field => !!field.answered);
|
|
1129
1129
|
}
|
|
1130
1130
|
;// CONCATENATED MODULE: ./src/chatbox/ImageAttachments.js
|
|
1131
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; }
|
|
@@ -1134,10 +1134,10 @@ function ImageAttachments_toPrimitive(t, r) { if ("object" != typeof t || !t) re
|
|
|
1134
1134
|
|
|
1135
1135
|
|
|
1136
1136
|
|
|
1137
|
-
class ImageAttachment extends common/* Com */.
|
|
1137
|
+
class ImageAttachment extends common/* Com */.Mw {
|
|
1138
1138
|
constructor(props) {
|
|
1139
1139
|
super(props);
|
|
1140
|
-
ImageAttachments_defineProperty(this, "containerRef", (0,preact_module/* createRef */.
|
|
1140
|
+
ImageAttachments_defineProperty(this, "containerRef", (0,preact_module/* createRef */._3)());
|
|
1141
1141
|
this.setState({
|
|
1142
1142
|
ready: false,
|
|
1143
1143
|
errorIndecies: []
|
|
@@ -1192,7 +1192,7 @@ class ImageAttachment extends common/* Com */.Sq {
|
|
|
1192
1192
|
if (!this.state.ready) {
|
|
1193
1193
|
return;
|
|
1194
1194
|
}
|
|
1195
|
-
let byType = util/* default */.
|
|
1195
|
+
let byType = util/* default */.A.get(this.props.ev, 'by.type');
|
|
1196
1196
|
if (!image.width || !image.height) {
|
|
1197
1197
|
return (0,preact_module.h)("div", {
|
|
1198
1198
|
class: `image-attachment image-attachment--${byType}`
|
|
@@ -1213,7 +1213,7 @@ class ImageAttachment extends common/* Com */.Sq {
|
|
|
1213
1213
|
let url = this.props.store.replaceFileUrl(image.thumbnail_url || image.url);
|
|
1214
1214
|
let trueUrl = this.props.store.replaceFileUrl(image.url);
|
|
1215
1215
|
if (this.state.errorIndecies.includes(index)) {
|
|
1216
|
-
url = __webpack_require__(
|
|
1216
|
+
url = __webpack_require__(2876);
|
|
1217
1217
|
trueUrl = url;
|
|
1218
1218
|
}
|
|
1219
1219
|
return (0,preact_module.h)("div", {
|
|
@@ -1236,12 +1236,12 @@ class ImageAttachment extends common/* Com */.Sq {
|
|
|
1236
1236
|
})));
|
|
1237
1237
|
}
|
|
1238
1238
|
render() {
|
|
1239
|
-
var attachments = util/* default */.
|
|
1239
|
+
var attachments = util/* default */.A.get(this.props.ev, 'data.message.attachments', []);
|
|
1240
1240
|
var images = [];
|
|
1241
|
-
let byType = util/* default */.
|
|
1242
|
-
util/* default */.
|
|
1241
|
+
let byType = util/* default */.A.get(this.props.ev, 'by.type');
|
|
1242
|
+
util/* default */.A.each(attachments, (att, i) => {
|
|
1243
1243
|
if (!att) return;
|
|
1244
|
-
if (!util/* default */.
|
|
1244
|
+
if (!util/* default */.A.includes(att.mimetype, 'image')) return;
|
|
1245
1245
|
if (!att.url) return;
|
|
1246
1246
|
var uri = att.url;
|
|
1247
1247
|
if (!uri.startsWith('https://') && !uri.startsWith('http://') && !uri.startsWith('content://') && !uri.startsWith('data:')) {
|
|
@@ -1250,7 +1250,7 @@ class ImageAttachment extends common/* Com */.Sq {
|
|
|
1250
1250
|
images.push(att);
|
|
1251
1251
|
});
|
|
1252
1252
|
if (images.length === 0) return null;
|
|
1253
|
-
let $images = util/* default */.
|
|
1253
|
+
let $images = util/* default */.A.map(images, (image, index) => this.renderImage(image, index));
|
|
1254
1254
|
if (byType === 'agent') {
|
|
1255
1255
|
return (0,preact_module.h)("div", {
|
|
1256
1256
|
class: "message-agent",
|
|
@@ -1268,20 +1268,20 @@ class ImageAttachment extends common/* Com */.Sq {
|
|
|
1268
1268
|
|
|
1269
1269
|
|
|
1270
1270
|
|
|
1271
|
-
class AudioAttachments extends common/* Com */.
|
|
1271
|
+
class AudioAttachments extends common/* Com */.Mw {
|
|
1272
1272
|
constructor(props) {
|
|
1273
1273
|
super(props);
|
|
1274
1274
|
}
|
|
1275
1275
|
render() {
|
|
1276
|
-
let byType = util/* default */.
|
|
1277
|
-
var attachments = util/* default */.
|
|
1276
|
+
let byType = util/* default */.A.get(this.props.ev, 'by.type');
|
|
1277
|
+
var attachments = util/* default */.A.get(this.props.ev, 'data.message.attachments', []);
|
|
1278
1278
|
var audios = [];
|
|
1279
|
-
util/* default */.
|
|
1279
|
+
util/* default */.A.each(attachments, (att, i) => {
|
|
1280
1280
|
if (!att) return;
|
|
1281
|
-
if (util/* default */.
|
|
1281
|
+
if (util/* default */.A.includes(att.mimetype, 'audio')) audios.push(att);
|
|
1282
1282
|
});
|
|
1283
1283
|
if (audios.length === 0) return null;
|
|
1284
|
-
var $audios = util/* default */.
|
|
1284
|
+
var $audios = util/* default */.A.map(audios, (audio, index) => {
|
|
1285
1285
|
return (0,preact_module.h)("div", {
|
|
1286
1286
|
key: index,
|
|
1287
1287
|
class: `audio-attachment audio-attachment--${byType}`
|
|
@@ -1302,20 +1302,20 @@ class AudioAttachments extends common/* Com */.Sq {
|
|
|
1302
1302
|
|
|
1303
1303
|
|
|
1304
1304
|
|
|
1305
|
-
class FileAttachments extends common/* Com */.
|
|
1305
|
+
class FileAttachments extends common/* Com */.Mw {
|
|
1306
1306
|
render() {
|
|
1307
|
-
var byType = util/* default */.
|
|
1308
|
-
var attachments = util/* default */.
|
|
1307
|
+
var byType = util/* default */.A.get(this.props.ev, 'by.type', 'agent');
|
|
1308
|
+
var attachments = util/* default */.A.get(this.props.ev, 'data.message.attachments', []);
|
|
1309
1309
|
var files = [];
|
|
1310
|
-
util/* default */.
|
|
1310
|
+
util/* default */.A.each(attachments, att => {
|
|
1311
1311
|
if (!att) return;
|
|
1312
1312
|
if (!att.url && !att._file) return;
|
|
1313
|
-
if (!util/* default */.
|
|
1313
|
+
if (!util/* default */.A.includes(att.mimetype, 'video') && !util/* default */.A.includes(att.mimetype, 'audio') && !util/* default */.A.includes(att.mimetype, 'image') && att.type !== 'button' && att.type !== 'quick_replies' && att.type !== 'form' && att.type !== 'form_submit') {
|
|
1314
1314
|
files.push(att);
|
|
1315
1315
|
}
|
|
1316
1316
|
});
|
|
1317
1317
|
if (files.length === 0) return null;
|
|
1318
|
-
var $files = util/* default */.
|
|
1318
|
+
var $files = util/* default */.A.map(files, (file, index) => {
|
|
1319
1319
|
return (0,preact_module.h)("div", {
|
|
1320
1320
|
key: index,
|
|
1321
1321
|
class: `file-attachment file-attachment--${byType}`
|
|
@@ -1338,13 +1338,13 @@ class FileAttachments extends common/* Com */.Sq {
|
|
|
1338
1338
|
|
|
1339
1339
|
|
|
1340
1340
|
|
|
1341
|
-
class Buttons extends common/* Com */.
|
|
1341
|
+
class Buttons extends common/* Com */.Mw {
|
|
1342
1342
|
constructor(props) {
|
|
1343
1343
|
super(props);
|
|
1344
1344
|
}
|
|
1345
1345
|
render() {
|
|
1346
|
-
if (util/* default */.
|
|
1347
|
-
var $buttons = util/* default */.
|
|
1346
|
+
if (util/* default */.A.size(this.props.buttons) === 0) return null;
|
|
1347
|
+
var $buttons = util/* default */.A.map(this.props.buttons, (button, index) => {
|
|
1348
1348
|
if (button.type === 'call_button') {
|
|
1349
1349
|
return (0,preact_module.h)("a", {
|
|
1350
1350
|
class: "url-button-attachment",
|
|
@@ -1383,18 +1383,18 @@ class Buttons extends common/* Com */.Sq {
|
|
|
1383
1383
|
|
|
1384
1384
|
|
|
1385
1385
|
|
|
1386
|
-
class ButtonAttachments extends common/* Com */.
|
|
1386
|
+
class ButtonAttachments extends common/* Com */.Mw {
|
|
1387
1387
|
constructor(props) {
|
|
1388
1388
|
super(props);
|
|
1389
1389
|
}
|
|
1390
1390
|
render() {
|
|
1391
|
-
let byType = util/* default */.
|
|
1391
|
+
let byType = util/* default */.A.get(this.props.ev, 'by.type');
|
|
1392
1392
|
if (byType === 'user') return null;
|
|
1393
1393
|
let buttons = [];
|
|
1394
|
-
let attachments = util/* default */.
|
|
1395
|
-
util/* default */.
|
|
1396
|
-
if (!att || util/* default */.
|
|
1397
|
-
util/* default */.
|
|
1394
|
+
let attachments = util/* default */.A.get(this.props.ev, 'data.message.attachments', []);
|
|
1395
|
+
util/* default */.A.each(attachments, (att, i) => {
|
|
1396
|
+
if (!att || util/* default */.A.get(att, 'type') !== 'button') return;
|
|
1397
|
+
util/* default */.A.each(util/* default */.A.get(att, 'buttons') || [], btn => buttons.push(btn));
|
|
1398
1398
|
});
|
|
1399
1399
|
return (0,preact_module.h)(Buttons, {
|
|
1400
1400
|
store: this.props.store,
|
|
@@ -1407,26 +1407,26 @@ class ButtonAttachments extends common/* Com */.Sq {
|
|
|
1407
1407
|
|
|
1408
1408
|
|
|
1409
1409
|
|
|
1410
|
-
class QuickReplies extends common/* Com */.
|
|
1410
|
+
class QuickReplies extends common/* Com */.Mw {
|
|
1411
1411
|
constructor(props) {
|
|
1412
1412
|
super(props);
|
|
1413
1413
|
}
|
|
1414
1414
|
render() {
|
|
1415
|
-
if (util/* default */.
|
|
1415
|
+
if (util/* default */.A.get(this.props.ev, 'by.type') === 'user') return null;
|
|
1416
1416
|
let quickreplies = [];
|
|
1417
|
-
util/* default */.
|
|
1417
|
+
util/* default */.A.map(util/* default */.A.get(this.props.ev, 'data.message.attachments', []), att => {
|
|
1418
1418
|
if (!att) return;
|
|
1419
1419
|
if (att.type === 'quick_replies') {
|
|
1420
|
-
quickreplies = util/* default */.
|
|
1420
|
+
quickreplies = util/* default */.A.get(att, 'quick_replies', []);
|
|
1421
1421
|
}
|
|
1422
1422
|
});
|
|
1423
|
-
quickreplies = util/* default */.
|
|
1423
|
+
quickreplies = util/* default */.A.filter(quickreplies, r => r.title);
|
|
1424
1424
|
if (quickreplies.length === 0) return null;
|
|
1425
|
-
let cid = util/* default */.
|
|
1425
|
+
let cid = util/* default */.A.convoOfEv(this.props.ev);
|
|
1426
1426
|
let convo = this.props.store.matchConvo(cid);
|
|
1427
|
-
if (util/* default */.
|
|
1428
|
-
let events = util/* default */.
|
|
1429
|
-
events = util/* default */.
|
|
1427
|
+
if (util/* default */.A.get(convo, 'state') === 'ended') return null;
|
|
1428
|
+
let events = util/* default */.A.map(this.props.store.listEvents(cid));
|
|
1429
|
+
events = util/* default */.A.orderBy(events, 'created', 'asc').filter(ev => ev.type === 'message_sent');
|
|
1430
1430
|
let evindex = 0;
|
|
1431
1431
|
for (var i = 0; i < events.length; i++) {
|
|
1432
1432
|
if (events[i].id === this.props.ev.id) {
|
|
@@ -1435,9 +1435,9 @@ class QuickReplies extends common/* Com */.Sq {
|
|
|
1435
1435
|
}
|
|
1436
1436
|
}
|
|
1437
1437
|
for (var i = evindex + 1; i < events.length; i++) {
|
|
1438
|
-
if (util/* default */.
|
|
1438
|
+
if (util/* default */.A.get(events[i], 'by.type') === 'user') return null;
|
|
1439
1439
|
}
|
|
1440
|
-
let $replies = util/* default */.
|
|
1440
|
+
let $replies = util/* default */.A.map(quickreplies, r => (0,preact_module.h)("div", {
|
|
1441
1441
|
class: "message_quick_reply",
|
|
1442
1442
|
onClick: e => this.props.onSelect(r)
|
|
1443
1443
|
}, r.title));
|
|
@@ -1450,7 +1450,7 @@ class QuickReplies extends common/* Com */.Sq {
|
|
|
1450
1450
|
|
|
1451
1451
|
|
|
1452
1452
|
|
|
1453
|
-
class ListField extends common/* Com */.
|
|
1453
|
+
class ListField extends common/* Com */.Mw {
|
|
1454
1454
|
constructor(props) {
|
|
1455
1455
|
super(props);
|
|
1456
1456
|
this.setState({
|
|
@@ -1459,18 +1459,18 @@ class ListField extends common/* Com */.Sq {
|
|
|
1459
1459
|
});
|
|
1460
1460
|
}
|
|
1461
1461
|
render() {
|
|
1462
|
-
let fields = util/* default */.
|
|
1462
|
+
let fields = util/* default */.A.filter(this.props.items, item => {
|
|
1463
1463
|
let search = this.state.search.toLowerCase();
|
|
1464
1464
|
let name = item || '';
|
|
1465
1465
|
return name.toLowerCase().indexOf(search) > -1;
|
|
1466
1466
|
});
|
|
1467
|
-
let $fields = util/* default */.
|
|
1467
|
+
let $fields = util/* default */.A.map(fields, field => {
|
|
1468
1468
|
return (0,preact_module.h)("li", {
|
|
1469
1469
|
class: "custom-select--item-options",
|
|
1470
1470
|
onClick: () => this.add(field)
|
|
1471
1471
|
}, field);
|
|
1472
1472
|
});
|
|
1473
|
-
let $selected = util/* default */.
|
|
1473
|
+
let $selected = util/* default */.A.map(this.props.selected, (item, i) => {
|
|
1474
1474
|
return (0,preact_module.h)("div", {
|
|
1475
1475
|
class: "custom-select--selected-item",
|
|
1476
1476
|
onClick: e => this.remove(e, i)
|
|
@@ -1503,7 +1503,7 @@ class ListField extends common/* Com */.Sq {
|
|
|
1503
1503
|
}
|
|
1504
1504
|
return (0,preact_module.h)("div", {
|
|
1505
1505
|
class: "form-control custom-select"
|
|
1506
|
-
}, (0,preact_module.h)(common/* Clickaway */.
|
|
1506
|
+
}, (0,preact_module.h)(common/* Clickaway */.tW, {
|
|
1507
1507
|
onClickaway: e => this.clickaway()
|
|
1508
1508
|
}, (0,preact_module.h)("div", {
|
|
1509
1509
|
class: "custom-select--wrap-selected",
|
|
@@ -1546,21 +1546,21 @@ class ListField extends common/* Com */.Sq {
|
|
|
1546
1546
|
|
|
1547
1547
|
|
|
1548
1548
|
|
|
1549
|
-
class FormAttachment extends common/* Com */.
|
|
1549
|
+
class FormAttachment extends common/* Com */.Mw {
|
|
1550
1550
|
constructor(props) {
|
|
1551
1551
|
super(props);
|
|
1552
1552
|
this.props.store.onUpdate(this, _ => this.forceUpdate());
|
|
1553
1553
|
let user = this.props.store.matchUser();
|
|
1554
|
-
let fields = util/* default */.
|
|
1555
|
-
let formData = util/* default */.
|
|
1554
|
+
let fields = util/* default */.A.get(this.props.form, 'fields') || [];
|
|
1555
|
+
let formData = util/* default */.A.map(fields, field => {
|
|
1556
1556
|
let is_required = field.is_required || false;
|
|
1557
|
-
var state = util/* default */.
|
|
1557
|
+
var state = util/* default */.A.parseJSON(field.state) || {};
|
|
1558
1558
|
if (!is_required) is_required = state.require || false;
|
|
1559
|
-
var userattr = util/* default */.
|
|
1559
|
+
var userattr = util/* default */.A.getUserAttr(user, field.name, state.type || 'text');
|
|
1560
1560
|
return {
|
|
1561
1561
|
name: field.name,
|
|
1562
1562
|
items: field.items,
|
|
1563
|
-
value: util/* default */.
|
|
1563
|
+
value: util/* default */.A.parseJSON(field.answer) || util/* default */.A.parseJSON(field.default_answer) || userattr,
|
|
1564
1564
|
is_required,
|
|
1565
1565
|
label: field.title,
|
|
1566
1566
|
type: field.input_type
|
|
@@ -1571,13 +1571,13 @@ class FormAttachment extends common/* Com */.Sq {
|
|
|
1571
1571
|
});
|
|
1572
1572
|
}
|
|
1573
1573
|
isSummited() {
|
|
1574
|
-
let found = util/* default */.
|
|
1574
|
+
let found = util/* default */.A.find(this.state.formData, field => !!field.answered);
|
|
1575
1575
|
if (found) return true;
|
|
1576
|
-
let convo = this.props.store.matchConvo(util/* default */.
|
|
1576
|
+
let convo = this.props.store.matchConvo(util/* default */.A.convoOfEv(this.props.ev));
|
|
1577
1577
|
return convo.state === 'ended';
|
|
1578
1578
|
}
|
|
1579
1579
|
render() {
|
|
1580
|
-
if (util/* default */.
|
|
1580
|
+
if (util/* default */.A.size(this.state.formData) === 0) return null;
|
|
1581
1581
|
let $fields = this.renderFields();
|
|
1582
1582
|
let $submitbutton = null;
|
|
1583
1583
|
if (!this.isSummited()) {
|
|
@@ -1596,11 +1596,11 @@ class FormAttachment extends common/* Com */.Sq {
|
|
|
1596
1596
|
}
|
|
1597
1597
|
focus() {
|
|
1598
1598
|
if (this.props.store.isPreview) return;
|
|
1599
|
-
if (util/* default */.
|
|
1599
|
+
if (util/* default */.A.size(this.state.formData) === 0) return;
|
|
1600
1600
|
let $field;
|
|
1601
1601
|
if (this.isFormFilled()) {
|
|
1602
1602
|
var keys = Object.keys(this.state.formData);
|
|
1603
|
-
var lastkey = keys[util/* default */.
|
|
1603
|
+
var lastkey = keys[util/* default */.A.size(keys) - 1];
|
|
1604
1604
|
var lastfield = this.state.formData[lastkey];
|
|
1605
1605
|
$field = this['field.' + encode(lastfield.name)];
|
|
1606
1606
|
} else {
|
|
@@ -1611,20 +1611,20 @@ class FormAttachment extends common/* Com */.Sq {
|
|
|
1611
1611
|
if ($field) $field.focus();
|
|
1612
1612
|
}
|
|
1613
1613
|
firstUnfilledField() {
|
|
1614
|
-
return util/* default */.
|
|
1614
|
+
return util/* default */.A.find(this.state.formData, field => field.value == null || field.value === '');
|
|
1615
1615
|
}
|
|
1616
1616
|
isFormFilled() {
|
|
1617
|
-
return !util/* default */.
|
|
1617
|
+
return !util/* default */.A.find(this.state.formData, field => field.value == null || field.value === '');
|
|
1618
1618
|
}
|
|
1619
1619
|
onInputChange(index, val) {
|
|
1620
|
-
let formData = util/* default */.
|
|
1620
|
+
let formData = util/* default */.A.cloneDeep(this.state.formData);
|
|
1621
1621
|
formData[index].value = val;
|
|
1622
1622
|
this.setState({
|
|
1623
1623
|
formData
|
|
1624
1624
|
});
|
|
1625
1625
|
}
|
|
1626
1626
|
onListAddItem(index, val) {
|
|
1627
|
-
let formData = util/* default */.
|
|
1627
|
+
let formData = util/* default */.A.cloneDeep(this.state.formData);
|
|
1628
1628
|
let field = formData[index];
|
|
1629
1629
|
field.value = field.value || [];
|
|
1630
1630
|
field.value.push(val);
|
|
@@ -1633,7 +1633,7 @@ class FormAttachment extends common/* Com */.Sq {
|
|
|
1633
1633
|
});
|
|
1634
1634
|
}
|
|
1635
1635
|
onListRemoveItem(index, vindex) {
|
|
1636
|
-
let formData = util/* default */.
|
|
1636
|
+
let formData = util/* default */.A.cloneDeep(this.state.formData);
|
|
1637
1637
|
let field = formData[index];
|
|
1638
1638
|
field.value = field.value || [];
|
|
1639
1639
|
field.value.splice(vindex, 1);
|
|
@@ -1642,9 +1642,9 @@ class FormAttachment extends common/* Com */.Sq {
|
|
|
1642
1642
|
});
|
|
1643
1643
|
}
|
|
1644
1644
|
renderFields() {
|
|
1645
|
-
if (util/* default */.
|
|
1645
|
+
if (util/* default */.A.size(this.state.formData) === 0) return null;
|
|
1646
1646
|
let $fields = null;
|
|
1647
|
-
$fields = util/* default */.
|
|
1647
|
+
$fields = util/* default */.A.map(this.state.formData, (field, index) => {
|
|
1648
1648
|
let $field = null;
|
|
1649
1649
|
var errclass = field.error ? 'input--error' : '';
|
|
1650
1650
|
if (field.type === 'text') {
|
|
@@ -1720,7 +1720,7 @@ class FormAttachment extends common/* Com */.Sq {
|
|
|
1720
1720
|
}, (0,preact_module.h)("div", null)));
|
|
1721
1721
|
} else if (field.type === 'list') {
|
|
1722
1722
|
let selected = field.value || [];
|
|
1723
|
-
let items = util/* default */.
|
|
1723
|
+
let items = util/* default */.A.filter(util/* default */.A.get(field, 'items', []), item => !selected.includes(item));
|
|
1724
1724
|
$field = (0,preact_module.h)(ListField, {
|
|
1725
1725
|
selected: selected,
|
|
1726
1726
|
items: items,
|
|
@@ -1758,15 +1758,15 @@ class FormAttachment extends common/* Com */.Sq {
|
|
|
1758
1758
|
}
|
|
1759
1759
|
async submit() {
|
|
1760
1760
|
var hasError = false;
|
|
1761
|
-
util/* default */.
|
|
1762
|
-
if (field.is_required && (field.value === undefined || field.value === '' || util/* default */.
|
|
1761
|
+
util/* default */.A.map(this.state.formData, field => {
|
|
1762
|
+
if (field.is_required && (field.value === undefined || field.value === '' || util/* default */.A.size(field.value) === 0 && Array.isArray(field.value))) {
|
|
1763
1763
|
field.error = this.props.t('error_empty');
|
|
1764
1764
|
hasError = true;
|
|
1765
1765
|
} else {
|
|
1766
1766
|
field.error = '';
|
|
1767
1767
|
}
|
|
1768
1768
|
if (field.name === 'emails' && field.value) {
|
|
1769
|
-
if (!util/* default */.
|
|
1769
|
+
if (!util/* default */.A.isEmail(field.value)) {
|
|
1770
1770
|
field.error = this.props.t('error_email_invalid');
|
|
1771
1771
|
hasError = true;
|
|
1772
1772
|
}
|
|
@@ -1775,32 +1775,32 @@ class FormAttachment extends common/* Com */.Sq {
|
|
|
1775
1775
|
this.forceUpdate();
|
|
1776
1776
|
if (hasError) return;
|
|
1777
1777
|
let user = {};
|
|
1778
|
-
let formData = util/* default */.
|
|
1779
|
-
util/* default */.
|
|
1778
|
+
let formData = util/* default */.A.cloneDeep(this.state.formData);
|
|
1779
|
+
util/* default */.A.map(formData, field => {
|
|
1780
1780
|
var attr = {
|
|
1781
1781
|
key: field.name
|
|
1782
1782
|
};
|
|
1783
|
-
field.answered = new util/* default */.
|
|
1783
|
+
field.answered = new util/* default */.A.Date().getTime();
|
|
1784
1784
|
if (field.type === 'number') {
|
|
1785
1785
|
attr.number = parseInt(field.value);
|
|
1786
|
-
field.answer = util/* default */.
|
|
1786
|
+
field.answer = util/* default */.A.stringify(attr.number);
|
|
1787
1787
|
}
|
|
1788
1788
|
if (field.type === 'datetime') {
|
|
1789
|
-
attr.datetime = new util/* default */.
|
|
1790
|
-
field.answer = util/* default */.
|
|
1789
|
+
attr.datetime = new util/* default */.A.Date(field.value).toISOString();
|
|
1790
|
+
field.answer = util/* default */.A.stringify(attr.datetime);
|
|
1791
1791
|
}
|
|
1792
1792
|
if (field.type === 'list') {
|
|
1793
1793
|
attr.list = field.value;
|
|
1794
|
-
field.answer = util/* default */.
|
|
1794
|
+
field.answer = util/* default */.A.stringify(attr.list);
|
|
1795
1795
|
}
|
|
1796
1796
|
if (field.type === 'text' || field.type === 'boolean') {
|
|
1797
1797
|
attr[field.type] = field.value;
|
|
1798
|
-
field.answer = util/* default */.
|
|
1798
|
+
field.answer = util/* default */.A.stringify(field.value);
|
|
1799
1799
|
}
|
|
1800
|
-
util/* default */.
|
|
1800
|
+
util/* default */.A.setUserAttr(user, attr);
|
|
1801
1801
|
});
|
|
1802
|
-
util/* default */.
|
|
1803
|
-
let ffield = util/* default */.
|
|
1802
|
+
util/* default */.A.map(formData, field => {
|
|
1803
|
+
let ffield = util/* default */.A.find(this.props.form.fields, ffield => ffield.name === field.name);
|
|
1804
1804
|
if (!ffield) return;
|
|
1805
1805
|
ffield.answered = field.answered;
|
|
1806
1806
|
});
|
|
@@ -1813,12 +1813,12 @@ class FormAttachment extends common/* Com */.Sq {
|
|
|
1813
1813
|
type: 'form_submit',
|
|
1814
1814
|
form_submit: {
|
|
1815
1815
|
state: '{"user_id":"' + this.props.store.matchUser().id + '"}',
|
|
1816
|
-
form_message_id: util/* default */.
|
|
1816
|
+
form_message_id: util/* default */.A.get(this.props.ev, 'id'),
|
|
1817
1817
|
fields: formData
|
|
1818
1818
|
}
|
|
1819
1819
|
}]
|
|
1820
1820
|
};
|
|
1821
|
-
let cid = util/* default */.
|
|
1821
|
+
let cid = util/* default */.A.convoOfEv(this.props.ev);
|
|
1822
1822
|
this.props.store.sendConvoEvent(cid, 'message_sent', {
|
|
1823
1823
|
message
|
|
1824
1824
|
});
|
|
@@ -1833,22 +1833,22 @@ function encode(key) {
|
|
|
1833
1833
|
|
|
1834
1834
|
|
|
1835
1835
|
|
|
1836
|
-
class FormAttachments extends common/* Com */.
|
|
1836
|
+
class FormAttachments extends common/* Com */.Mw {
|
|
1837
1837
|
constructor(props) {
|
|
1838
1838
|
super(props);
|
|
1839
1839
|
}
|
|
1840
1840
|
render() {
|
|
1841
|
-
let byType = util/* default */.
|
|
1841
|
+
let byType = util/* default */.A.get(this.props.ev, 'by.type');
|
|
1842
1842
|
if (byType === 'user') return;
|
|
1843
1843
|
let forms = [];
|
|
1844
|
-
let attachments = util/* default */.
|
|
1845
|
-
util/* default */.
|
|
1844
|
+
let attachments = util/* default */.A.get(this.props.ev, 'data.message.attachments') || [];
|
|
1845
|
+
util/* default */.A.each(attachments, att => {
|
|
1846
1846
|
if (!att) return;
|
|
1847
1847
|
if (att.type !== 'form' && att.type !== 'ask_info_form') return;
|
|
1848
1848
|
att.form._type = att.type;
|
|
1849
1849
|
forms.push(att.form);
|
|
1850
1850
|
});
|
|
1851
|
-
let $forms = util/* default */.
|
|
1851
|
+
let $forms = util/* default */.A.map(forms, (form, formIndex) => {
|
|
1852
1852
|
return (0,preact_module.h)(FormAttachment, {
|
|
1853
1853
|
store: this.props.store,
|
|
1854
1854
|
onSubmit: this.props.onSubmit,
|
|
@@ -1875,21 +1875,21 @@ class FormAttachments extends common/* Com */.Sq {
|
|
|
1875
1875
|
|
|
1876
1876
|
|
|
1877
1877
|
|
|
1878
|
-
class FormSubmitAttachments extends common/* Com */.
|
|
1878
|
+
class FormSubmitAttachments extends common/* Com */.Mw {
|
|
1879
1879
|
constructor(props) {
|
|
1880
1880
|
super(props);
|
|
1881
1881
|
}
|
|
1882
1882
|
render() {
|
|
1883
1883
|
return null;
|
|
1884
1884
|
let submits = [];
|
|
1885
|
-
let attachments = util/* default */.
|
|
1886
|
-
util/* default */.
|
|
1885
|
+
let attachments = util/* default */.A.get(this.props.ev, 'data.message.attachments') || [];
|
|
1886
|
+
util/* default */.A.each(attachments, att => {
|
|
1887
1887
|
if (!att) return;
|
|
1888
1888
|
if (att.type !== 'form_submit') return;
|
|
1889
1889
|
if (!att.form_submit) return;
|
|
1890
1890
|
submits.push(att.form_submit);
|
|
1891
1891
|
});
|
|
1892
|
-
let $submits = util/* default */.
|
|
1892
|
+
let $submits = util/* default */.A.map(submits, (submit, index) => (0,preact_module.h)("div", {
|
|
1893
1893
|
class: "info-message"
|
|
1894
1894
|
}, (0,preact_module.h)("span", null, this.props.tt('prechat_form_thanks'))));
|
|
1895
1895
|
return (0,preact_module.h)("div", null, $submits);
|
|
@@ -1940,13 +1940,13 @@ function getFirstTouch(ev) {
|
|
|
1940
1940
|
|
|
1941
1941
|
|
|
1942
1942
|
|
|
1943
|
-
class GenericTemplateAttachments extends common/* Com */.
|
|
1943
|
+
class GenericTemplateAttachments extends common/* Com */.Mw {
|
|
1944
1944
|
constructor(props) {
|
|
1945
1945
|
super(props);
|
|
1946
1946
|
this.state = {
|
|
1947
1947
|
focusing: 0
|
|
1948
1948
|
};
|
|
1949
|
-
this.galleryRef = (0,preact_module/* createRef */.
|
|
1949
|
+
this.galleryRef = (0,preact_module/* createRef */._3)();
|
|
1950
1950
|
}
|
|
1951
1951
|
componentDidMount() {
|
|
1952
1952
|
this.bindDrag();
|
|
@@ -1961,13 +1961,13 @@ class GenericTemplateAttachments extends common/* Com */.Sq {
|
|
|
1961
1961
|
});
|
|
1962
1962
|
}
|
|
1963
1963
|
render() {
|
|
1964
|
-
let byType = util/* default */.
|
|
1964
|
+
let byType = util/* default */.A.get(this.props.ev, 'by.type');
|
|
1965
1965
|
if (byType === 'user') return null;
|
|
1966
|
-
let attachments = util/* default */.
|
|
1967
|
-
let generics = util/* default */.
|
|
1966
|
+
let attachments = util/* default */.A.get(this.props.ev, 'data.message.attachments', []);
|
|
1967
|
+
let generics = util/* default */.A.filter(attachments, att => util/* default */.A.get(att, 'type') === 'generic');
|
|
1968
1968
|
if (generics.length === 0) return null;
|
|
1969
|
-
var $generics = util/* default */.
|
|
1970
|
-
var $eles = util/* default */.
|
|
1969
|
+
var $generics = util/* default */.A.map(generics, (gen, index) => {
|
|
1970
|
+
var $eles = util/* default */.A.map(gen.elements, ele => {
|
|
1971
1971
|
let title = this.props.t.i18n(ele.i18n_title) || ele.title;
|
|
1972
1972
|
let subtitle = this.props.t.i18n(ele.i18n_subtitle) || ele.subtitle;
|
|
1973
1973
|
let $title = title ? (0,preact_module.h)("div", {
|
|
@@ -1978,7 +1978,7 @@ class GenericTemplateAttachments extends common/* Com */.Sq {
|
|
|
1978
1978
|
}, subtitle) : null;
|
|
1979
1979
|
let imgsrc = this.props.store.replaceFileUrl(ele.image_url);
|
|
1980
1980
|
if (!ele.image_url) {
|
|
1981
|
-
imgsrc = __webpack_require__(
|
|
1981
|
+
imgsrc = __webpack_require__(2876);
|
|
1982
1982
|
}
|
|
1983
1983
|
return (0,preact_module.h)("div", {
|
|
1984
1984
|
class: "generic-attachment--element swiper-slide"
|
|
@@ -1994,7 +1994,7 @@ class GenericTemplateAttachments extends common/* Com */.Sq {
|
|
|
1994
1994
|
t: this.props.t
|
|
1995
1995
|
}));
|
|
1996
1996
|
});
|
|
1997
|
-
let elements = util/* default */.
|
|
1997
|
+
let elements = util/* default */.A.get(attachments, '0.elements', []);
|
|
1998
1998
|
let leftNavigatorCls = 'generic-attachment-navigator generic-attachment-navigator--left';
|
|
1999
1999
|
let rightNavigatorCls = 'generic-attachment-navigator generic-attachment-navigator--right';
|
|
2000
2000
|
if (this.state.focusing === 0) leftNavigatorCls += ' generic-attachment-navigator--disabled';
|
|
@@ -2004,7 +2004,7 @@ class GenericTemplateAttachments extends common/* Com */.Sq {
|
|
|
2004
2004
|
}, (0,preact_module.h)("div", {
|
|
2005
2005
|
class: "generic-attachment",
|
|
2006
2006
|
ref: this.galleryRef
|
|
2007
|
-
}, $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 */.FK, null, (0,preact_module.h)("div", {
|
|
2008
2008
|
class: leftNavigatorCls,
|
|
2009
2009
|
onClick: _ => this.focus(this.state.focusing - 1)
|
|
2010
2010
|
}, (0,preact_module.h)("span", {
|
|
@@ -2021,38 +2021,38 @@ class GenericTemplateAttachments extends common/* Com */.Sq {
|
|
|
2021
2021
|
bindDrag() {
|
|
2022
2022
|
if (!this.props.store.isMobile()) return;
|
|
2023
2023
|
let eles = document.getElementsByClassName('generic-attachment');
|
|
2024
|
-
util/* default */.
|
|
2024
|
+
util/* default */.A.map(eles, ele => bind(ele, () => {}));
|
|
2025
2025
|
}
|
|
2026
2026
|
}
|
|
2027
2027
|
;// CONCATENATED MODULE: ./src/chatbox/ProductAttachments.js
|
|
2028
2028
|
|
|
2029
2029
|
|
|
2030
2030
|
|
|
2031
|
-
class ProductAttachments extends common/* Com */.
|
|
2031
|
+
class ProductAttachments extends common/* Com */.Mw {
|
|
2032
2032
|
render() {
|
|
2033
|
-
let byType = util/* default */.
|
|
2033
|
+
let byType = util/* default */.A.get(this.props.ev, 'by.type');
|
|
2034
2034
|
if (byType === 'user') return null;
|
|
2035
|
-
let attachments = util/* default */.
|
|
2036
|
-
let products = util/* default */.
|
|
2035
|
+
let attachments = util/* default */.A.get(this.props.ev, 'data.message.attachments', []);
|
|
2036
|
+
let products = util/* default */.A.filter(attachments, att => util/* default */.A.get(att, 'type') === 'product' || util/* default */.A.get(att, 'type') === 'product_preview');
|
|
2037
2037
|
products = products.filter(product => product.product && product.product.name);
|
|
2038
2038
|
if (products.length === 0) return null;
|
|
2039
2039
|
let acc = this.props.store.matchAccount();
|
|
2040
|
-
let $products = util/* default */.
|
|
2040
|
+
let $products = util/* default */.A.map(products, (att, index) => {
|
|
2041
2041
|
let product = att.product;
|
|
2042
2042
|
let $detailbtns = [];
|
|
2043
2043
|
let url = product.url || product.mobile_url;
|
|
2044
2044
|
if (this.props.store.isMobile()) url = product.mobile_url || product.url;
|
|
2045
|
-
if (url && util/* default */.
|
|
2045
|
+
if (url && util/* default */.A.size(product.buttons) == 0) $detailbtns.push((0,preact_module.h)("a", {
|
|
2046
2046
|
class: "product_attachment__btn",
|
|
2047
2047
|
href: url,
|
|
2048
2048
|
target: "_blank"
|
|
2049
2049
|
}, this.props.t('detail'), (0,preact_module.h)("img", {
|
|
2050
|
-
src: __webpack_require__(
|
|
2050
|
+
src: __webpack_require__(3266),
|
|
2051
2051
|
class: "product_attachment__btn_external_link"
|
|
2052
2052
|
})));
|
|
2053
2053
|
console.log('P', product);
|
|
2054
|
-
if (util/* default */.
|
|
2055
|
-
$detailbtns = $detailbtns.concat(util/* default */.
|
|
2054
|
+
if (util/* default */.A.size(product.buttons) > 0) {
|
|
2055
|
+
$detailbtns = $detailbtns.concat(util/* default */.A.map(product.buttons, (button, index) => {
|
|
2056
2056
|
if (button.type === 'call_button') {
|
|
2057
2057
|
return (0,preact_module.h)("a", {
|
|
2058
2058
|
class: "product_attachment__btn",
|
|
@@ -2069,7 +2069,7 @@ class ProductAttachments extends common/* Com */.Sq {
|
|
|
2069
2069
|
key: index,
|
|
2070
2070
|
title: button.title
|
|
2071
2071
|
}, this.props.t.i18n(button.i18n_title) || button.title || this.props.t('detail'), ' ', (0,preact_module.h)("img", {
|
|
2072
|
-
src: __webpack_require__(
|
|
2072
|
+
src: __webpack_require__(3266),
|
|
2073
2073
|
class: "product_attachment__btn_external_link"
|
|
2074
2074
|
}));
|
|
2075
2075
|
}
|
|
@@ -2092,16 +2092,16 @@ class ProductAttachments extends common/* Com */.Sq {
|
|
|
2092
2092
|
if (desc) $subtitle = (0,preact_module.h)("div", {
|
|
2093
2093
|
class: "product_attachment__subtitle"
|
|
2094
2094
|
}, desc);
|
|
2095
|
-
let currency = product.currency || util/* default */.
|
|
2095
|
+
let currency = product.currency || util/* default */.A.get(acc, 'currency', 'VND');
|
|
2096
2096
|
let $price = null;
|
|
2097
2097
|
if (product.price) {
|
|
2098
2098
|
$price = (0,preact_module.h)("div", {
|
|
2099
2099
|
class: "product_attachment__price"
|
|
2100
|
-
}, util/* default */.
|
|
2100
|
+
}, util/* default */.A.formatCurrency(product.price, currency));
|
|
2101
2101
|
}
|
|
2102
2102
|
let imgsrc = this.props.store.replaceFileUrl(product.image);
|
|
2103
2103
|
if (!product.image) {
|
|
2104
|
-
imgsrc = __webpack_require__(
|
|
2104
|
+
imgsrc = __webpack_require__(2876);
|
|
2105
2105
|
}
|
|
2106
2106
|
return (0,preact_module.h)("div", {
|
|
2107
2107
|
class: 'product_attachment product_attachment__' + byType
|
|
@@ -2122,16 +2122,16 @@ class ProductAttachments extends common/* Com */.Sq {
|
|
|
2122
2122
|
|
|
2123
2123
|
|
|
2124
2124
|
|
|
2125
|
-
class OrderAttachments_ProductAttachments extends common/* Com */.
|
|
2125
|
+
class OrderAttachments_ProductAttachments extends common/* Com */.Mw {
|
|
2126
2126
|
render() {
|
|
2127
|
-
let byType = util/* default */.
|
|
2127
|
+
let byType = util/* default */.A.get(this.props.ev, 'by.type');
|
|
2128
2128
|
if (byType === 'user') return null;
|
|
2129
2129
|
let acc = this.props.store.matchAccount();
|
|
2130
|
-
var attachments = util/* default */.
|
|
2131
|
-
let orders = util/* default */.
|
|
2130
|
+
var attachments = util/* default */.A.get(this.props.ev, 'data.message.attachments', []);
|
|
2131
|
+
let orders = util/* default */.A.filter(attachments, att => att.type === 'order' && att.order).map(att => att.order);
|
|
2132
2132
|
if (orders.length === 0) return null;
|
|
2133
|
-
let $orders = util/* default */.
|
|
2134
|
-
util/* default */.
|
|
2133
|
+
let $orders = util/* default */.A.map(orders, (order, index) => {
|
|
2134
|
+
util/* default */.A.calcOrderTotal(order);
|
|
2135
2135
|
let $note = null;
|
|
2136
2136
|
if (order.note) {
|
|
2137
2137
|
$note = (0,preact_module.h)("div", null, (0,preact_module.h)("div", {
|
|
@@ -2142,17 +2142,17 @@ class OrderAttachments_ProductAttachments extends common/* Com */.Sq {
|
|
|
2142
2142
|
}, order.note));
|
|
2143
2143
|
}
|
|
2144
2144
|
let $products = null;
|
|
2145
|
-
if (util/* default */.
|
|
2145
|
+
if (util/* default */.A.size(order.items) > 0) {
|
|
2146
2146
|
$products = (0,preact_module.h)("div", null, (0,preact_module.h)("div", {
|
|
2147
2147
|
class: "order_attachment__label"
|
|
2148
|
-
}, this.props.t('product')), util/* default */.
|
|
2148
|
+
}, this.props.t('product')), util/* default */.A.map(order.items, item => {
|
|
2149
2149
|
let product = item.product || {};
|
|
2150
2150
|
return (0,preact_module.h)("div", {
|
|
2151
2151
|
class: "order_attachment__product"
|
|
2152
2152
|
}, (0,preact_module.h)("img", {
|
|
2153
2153
|
class: "order_attachment__product_img",
|
|
2154
|
-
alt: '' + util/* default */.
|
|
2155
|
-
src: util/* default */.
|
|
2154
|
+
alt: '' + util/* default */.A.get(product, 'id'),
|
|
2155
|
+
src: util/* default */.A.get(product, 'image', __webpack_require__(2876))
|
|
2156
2156
|
}), (0,preact_module.h)("div", {
|
|
2157
2157
|
style: "overflow: hidden !important;"
|
|
2158
2158
|
}, (0,preact_module.h)("div", {
|
|
@@ -2160,9 +2160,9 @@ class OrderAttachments_ProductAttachments extends common/* Com */.Sq {
|
|
|
2160
2160
|
title: this.props.t.i18n(product.i18n_name) || product.name
|
|
2161
2161
|
}, this.props.t.i18n(product.i18n_name) || product.name), (0,preact_module.h)("div", {
|
|
2162
2162
|
class: "order_attachment__product_desc"
|
|
2163
|
-
}, util/* default */.
|
|
2163
|
+
}, util/* default */.A.getProductPropName(product, ' / ')), (0,preact_module.h)("div", {
|
|
2164
2164
|
class: "order_attachment__product_desc"
|
|
2165
|
-
}, this.props.t('qty'), " ", item.quantity, "\xA0\xB7\xA0", util/* default */.
|
|
2165
|
+
}, this.props.t('qty'), " ", item.quantity, "\xA0\xB7\xA0", util/* default */.A.formatCurrency(product.price))));
|
|
2166
2166
|
}));
|
|
2167
2167
|
}
|
|
2168
2168
|
let $total = (0,preact_module.h)("div", {
|
|
@@ -2171,19 +2171,19 @@ class OrderAttachments_ProductAttachments extends common/* Com */.Sq {
|
|
|
2171
2171
|
class: "d-flex align-items-center justify-content-between"
|
|
2172
2172
|
}, (0,preact_module.h)("div", null, this.props.t('total')), ' ', (0,preact_module.h)("div", null, (0,preact_module.h)("b", {
|
|
2173
2173
|
class: "order_attachment__total"
|
|
2174
|
-
}, util/* default */.
|
|
2175
|
-
let phoneattr = util/* default */.
|
|
2174
|
+
}, util/* default */.A.formatCurrency(order.total)))));
|
|
2175
|
+
let phoneattr = util/* default */.A.find(util/* default */.A.get(order, 'user.attributes', []), attr => attr.key === 'phones') || {
|
|
2176
2176
|
key: 'phones',
|
|
2177
2177
|
text: ''
|
|
2178
2178
|
};
|
|
2179
|
-
let phone = util/* default */.
|
|
2180
|
-
phone = phone || util/* default */.
|
|
2179
|
+
let phone = util/* default */.A.get(order, 'shipping.address.phone', '').trim();
|
|
2180
|
+
phone = phone || util/* default */.A.trim(phoneattr.text);
|
|
2181
2181
|
if (phone) phone = this.props.t('phn') + ': ' + phone;
|
|
2182
2182
|
let $shipto = null;
|
|
2183
|
-
if (util/* default */.
|
|
2183
|
+
if (util/* default */.A.displayOrderShippingAddress(order) || phone) {
|
|
2184
2184
|
$shipto = (0,preact_module.h)("div", null, (0,preact_module.h)("div", {
|
|
2185
2185
|
class: "order_attachment__label"
|
|
2186
|
-
}, 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 */.A.displayOrderShippingAddress(order)), (0,preact_module.h)("div", {
|
|
2187
2187
|
class: "order_attachment__text_truncate"
|
|
2188
2188
|
}, phone));
|
|
2189
2189
|
}
|
|
@@ -2195,11 +2195,11 @@ class OrderAttachments_ProductAttachments extends common/* Com */.Sq {
|
|
|
2195
2195
|
class: "d-flex align-items-center justify-content-between"
|
|
2196
2196
|
}, (0,preact_module.h)("div", {
|
|
2197
2197
|
class: "order_attachment__label no_margin"
|
|
2198
|
-
}, 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 */.A.formatCurrency(order._order_value))), (0,preact_module.h)("div", {
|
|
2199
2199
|
class: "d-flex align-items-center justify-content-between"
|
|
2200
2200
|
}, (0,preact_module.h)("div", {
|
|
2201
2201
|
class: "order_attachment__label no_margin"
|
|
2202
|
-
}, 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 */.A.formatCurrency(order._discount_before_tax))));
|
|
2203
2203
|
}
|
|
2204
2204
|
let $subtotal = (0,preact_module.h)("div", {
|
|
2205
2205
|
class: "d-flex align-items-center justify-content-between"
|
|
@@ -2207,12 +2207,12 @@ class OrderAttachments_ProductAttachments extends common/* Com */.Sq {
|
|
|
2207
2207
|
class: "order_attachment__label no_margin"
|
|
2208
2208
|
}, this.props.t('subtotal')), ' ', (0,preact_module.h)("div", {
|
|
2209
2209
|
style: ""
|
|
2210
|
-
}, util/* default */.
|
|
2210
|
+
}, util/* default */.A.formatCurrency(order.subtotal)));
|
|
2211
2211
|
let $tax = null;
|
|
2212
2212
|
if (order.total_tax) {
|
|
2213
2213
|
let taxname = '';
|
|
2214
|
-
if (util/* default */.
|
|
2215
|
-
let tax = util/* default */.
|
|
2214
|
+
if (util/* default */.A.size(order._taxM) === 1) {
|
|
2215
|
+
let tax = util/* default */.A.get(order._taxM, '0.tax', {});
|
|
2216
2216
|
if (tax.name && tax.percentage) taxname = `(${tax.name} ${Math.round(tax.percentage || 0) / 100}%)`;
|
|
2217
2217
|
}
|
|
2218
2218
|
$tax = (0,preact_module.h)("div", {
|
|
@@ -2221,7 +2221,7 @@ class OrderAttachments_ProductAttachments extends common/* Com */.Sq {
|
|
|
2221
2221
|
class: "order_attachment__label no_margin"
|
|
2222
2222
|
}, this.props.t('tax'), " ", taxname), (0,preact_module.h)("div", {
|
|
2223
2223
|
style: ""
|
|
2224
|
-
}, util/* default */.
|
|
2224
|
+
}, util/* default */.A.formatCurrency(order.total_tax)));
|
|
2225
2225
|
}
|
|
2226
2226
|
let $discount = null;
|
|
2227
2227
|
if (order.discount_type === 'percentage' && order.discount_percentage) {
|
|
@@ -2231,7 +2231,7 @@ class OrderAttachments_ProductAttachments extends common/* Com */.Sq {
|
|
|
2231
2231
|
class: "order_attachment__label no_margin"
|
|
2232
2232
|
}, this.props.t('discount_after_tax'), " (", Math.round(order.discount_percentage / 100), "%)"), ' ', (0,preact_module.h)("div", {
|
|
2233
2233
|
style: ""
|
|
2234
|
-
}, "-", util/* default */.
|
|
2234
|
+
}, "-", util/* default */.A.formatCurrency(order._computed_discount)));
|
|
2235
2235
|
}
|
|
2236
2236
|
if (order.discount_type === 'amount' && order.discount_amount) {
|
|
2237
2237
|
$discount = (0,preact_module.h)("div", {
|
|
@@ -2240,17 +2240,17 @@ class OrderAttachments_ProductAttachments extends common/* Com */.Sq {
|
|
|
2240
2240
|
class: "order_attachment__label no_margin"
|
|
2241
2241
|
}, this.props.t('discount_after_tax')), ' ', (0,preact_module.h)("div", {
|
|
2242
2242
|
class: "no-shrink"
|
|
2243
|
-
}, "-", util/* default */.
|
|
2243
|
+
}, "-", util/* default */.A.formatCurrency(order._computed_discount)));
|
|
2244
2244
|
}
|
|
2245
2245
|
let $shipping = null;
|
|
2246
|
-
if (util/* default */.
|
|
2246
|
+
if (util/* default */.A.get(order, 'shipping.nominal_fee')) {
|
|
2247
2247
|
$shipping = (0,preact_module.h)("div", {
|
|
2248
2248
|
class: "d-flex align-items-center justify-content-between"
|
|
2249
2249
|
}, (0,preact_module.h)("div", {
|
|
2250
2250
|
class: "order_attachment__label no_margin"
|
|
2251
2251
|
}, this.props.t('shipping_fee')), ' ', (0,preact_module.h)("div", {
|
|
2252
2252
|
style: ""
|
|
2253
|
-
}, util/* default */.
|
|
2253
|
+
}, util/* default */.A.formatCurrency(util/* default */.A.get(order, 'shipping.nominal_fee', 0))));
|
|
2254
2254
|
}
|
|
2255
2255
|
let $adjustment = null;
|
|
2256
2256
|
if (order.adjustment) {
|
|
@@ -2260,7 +2260,7 @@ class OrderAttachments_ProductAttachments extends common/* Com */.Sq {
|
|
|
2260
2260
|
class: "order_attachment__label no_margin"
|
|
2261
2261
|
}, order.adjustment_description), ' ', (0,preact_module.h)("div", {
|
|
2262
2262
|
class: "no-shrink"
|
|
2263
|
-
}, util/* default */.
|
|
2263
|
+
}, util/* default */.A.formatCurrency(order.adjustment)));
|
|
2264
2264
|
}
|
|
2265
2265
|
$subtotal = (0,preact_module.h)("div", {
|
|
2266
2266
|
class: "order_attachment__footer"
|
|
@@ -2274,7 +2274,7 @@ class OrderAttachments_ProductAttachments extends common/* Com */.Sq {
|
|
|
2274
2274
|
class: "order_attachment__header"
|
|
2275
2275
|
}, this.props.t('order'), (0,preact_module.h)("span", {
|
|
2276
2276
|
class: "order_attachment__text_muted order_attachment__text_sm"
|
|
2277
|
-
}, util/* default */.
|
|
2277
|
+
}, util/* default */.A.getOrderDisplayName(order))), $products, $shipto, $note, $beforeTax, $subtotal, $total);
|
|
2278
2278
|
});
|
|
2279
2279
|
return $orders;
|
|
2280
2280
|
}
|
|
@@ -2283,20 +2283,20 @@ class OrderAttachments_ProductAttachments extends common/* Com */.Sq {
|
|
|
2283
2283
|
|
|
2284
2284
|
|
|
2285
2285
|
|
|
2286
|
-
class VideoAttachments extends common/* Com */.
|
|
2286
|
+
class VideoAttachments extends common/* Com */.Mw {
|
|
2287
2287
|
constructor(props) {
|
|
2288
2288
|
super(props);
|
|
2289
2289
|
}
|
|
2290
2290
|
render() {
|
|
2291
|
-
let byType = util/* default */.
|
|
2292
|
-
var attachments = util/* default */.
|
|
2291
|
+
let byType = util/* default */.A.get(this.props.ev, 'by.type');
|
|
2292
|
+
var attachments = util/* default */.A.get(this.props.ev, 'data.message.attachments', []);
|
|
2293
2293
|
var videos = [];
|
|
2294
|
-
util/* default */.
|
|
2294
|
+
util/* default */.A.each(attachments, (att, i) => {
|
|
2295
2295
|
if (!att) return;
|
|
2296
|
-
if (util/* default */.
|
|
2296
|
+
if (util/* default */.A.includes(att.mimetype, 'video')) videos.push(att);
|
|
2297
2297
|
});
|
|
2298
2298
|
if (videos.length === 0) return null;
|
|
2299
|
-
var $videos = util/* default */.
|
|
2299
|
+
var $videos = util/* default */.A.map(videos, (video, index) => {
|
|
2300
2300
|
return (0,preact_module.h)("div", {
|
|
2301
2301
|
class: `video-attachment video-attachment--${byType}`
|
|
2302
2302
|
}, (0,preact_module.h)("video", {
|
|
@@ -2319,18 +2319,18 @@ class VideoAttachments extends common/* Com */.Sq {
|
|
|
2319
2319
|
|
|
2320
2320
|
|
|
2321
2321
|
|
|
2322
|
-
class TextMessage extends common/* Com */.
|
|
2322
|
+
class TextMessage extends common/* Com */.Mw {
|
|
2323
2323
|
render() {
|
|
2324
|
-
var format = util/* default */.
|
|
2324
|
+
var format = util/* default */.A.get(this.props.ev, 'data.message.format', 'plaintext');
|
|
2325
2325
|
if (format === 'delta') return this.renderDelta();
|
|
2326
2326
|
return this.renderPlainText();
|
|
2327
2327
|
}
|
|
2328
2328
|
renderPlainText() {
|
|
2329
|
-
var text = util/* default */.
|
|
2330
|
-
text = util/* default */.
|
|
2331
|
-
if (util/* default */.
|
|
2332
|
-
let byType = util/* default */.
|
|
2333
|
-
var tags = util/* default */.
|
|
2329
|
+
var text = util/* default */.A.get(this.props.ev, 'data.message.text');
|
|
2330
|
+
text = util/* default */.A.trim(text);
|
|
2331
|
+
if (util/* default */.A.size(text) === 0) return null;
|
|
2332
|
+
let byType = util/* default */.A.get(this.props.ev, 'by.type');
|
|
2333
|
+
var tags = util/* default */.A.extractText(text).map(tag => {
|
|
2334
2334
|
if (tag.type === 'emoji') return (0,preact_module.h)(Emoji, {
|
|
2335
2335
|
emojiCode: tag.text,
|
|
2336
2336
|
byType: byType
|
|
@@ -2354,7 +2354,7 @@ class TextMessage extends common/* Com */.Sq {
|
|
|
2354
2354
|
}, tag.text);
|
|
2355
2355
|
return tag.text;
|
|
2356
2356
|
});
|
|
2357
|
-
if (util/* default */.
|
|
2357
|
+
if (util/* default */.A.size(tags) === 0) return null;
|
|
2358
2358
|
if (byType === 'agent') {
|
|
2359
2359
|
return (0,preact_module.h)("div", {
|
|
2360
2360
|
class: "message-agent message-text--agent"
|
|
@@ -2365,16 +2365,16 @@ class TextMessage extends common/* Com */.Sq {
|
|
|
2365
2365
|
}, tags);
|
|
2366
2366
|
}
|
|
2367
2367
|
renderDelta() {
|
|
2368
|
-
let deltas = util/* default */.
|
|
2369
|
-
let quilldeltas = util/* default */.
|
|
2368
|
+
let deltas = util/* default */.A.get(this.props.ev, 'data.message.quill_delta') || util/* default */.A.get(this.props.ev, 'data.message.text');
|
|
2369
|
+
let quilldeltas = util/* default */.A.parseJSON(deltas) || {};
|
|
2370
2370
|
quilldeltas = trimQuillDelta(quilldeltas);
|
|
2371
|
-
if (!quilldeltas || util/* default */.
|
|
2372
|
-
let $deltas = util/* default */.
|
|
2371
|
+
if (!quilldeltas || util/* default */.A.size(quilldeltas.ops) === 0) return null;
|
|
2372
|
+
let $deltas = util/* default */.A.map(quilldeltas.ops, delta => {
|
|
2373
2373
|
let html = '';
|
|
2374
2374
|
let insert = delta.insert;
|
|
2375
2375
|
let attributes = delta.attributes;
|
|
2376
2376
|
if (insert.dynamicField) {
|
|
2377
|
-
return util/* default */.
|
|
2377
|
+
return util/* default */.A.get(insert, 'dynamicField.text', '');
|
|
2378
2378
|
}
|
|
2379
2379
|
if (insert.mention) {
|
|
2380
2380
|
if (insert.mention.id == '*' || insert.mention.id == 'all') {
|
|
@@ -2383,7 +2383,7 @@ class TextMessage extends common/* Com */.Sq {
|
|
|
2383
2383
|
}, "@", this.$t('all'));
|
|
2384
2384
|
}
|
|
2385
2385
|
let ag = store.matchAgent(insert.mention.id);
|
|
2386
|
-
let name = util/* default */.
|
|
2386
|
+
let name = util/* default */.A.getAgentDisplayName(ag, insert.mention.fullname);
|
|
2387
2387
|
return (0,preact_module.h)("span", {
|
|
2388
2388
|
class: "mention",
|
|
2389
2389
|
"data-agent-id": ag.id,
|
|
@@ -2394,7 +2394,7 @@ class TextMessage extends common/* Com */.Sq {
|
|
|
2394
2394
|
emojiCode: `:${insert.emoji}:`
|
|
2395
2395
|
});
|
|
2396
2396
|
if (typeof insert === 'string') {
|
|
2397
|
-
let $tags = util/* default */.
|
|
2397
|
+
let $tags = util/* default */.A.extractText(insert).map((tag, i) => {
|
|
2398
2398
|
if (tag.type === 'link') {
|
|
2399
2399
|
return (0,preact_module.h)("a", {
|
|
2400
2400
|
href: absLink(tag.text),
|
|
@@ -2418,9 +2418,9 @@ class TextMessage extends common/* Com */.Sq {
|
|
|
2418
2418
|
}
|
|
2419
2419
|
return null;
|
|
2420
2420
|
});
|
|
2421
|
-
let byType = util/* default */.
|
|
2421
|
+
let byType = util/* default */.A.get(this.ev, 'by.type');
|
|
2422
2422
|
if (byType !== 'user') byType = 'agent';
|
|
2423
|
-
if (util/* default */.
|
|
2423
|
+
if (util/* default */.A.size($deltas) === 0) return null;
|
|
2424
2424
|
if (byType === 'agent') {
|
|
2425
2425
|
return (0,preact_module.h)("div", {
|
|
2426
2426
|
class: "message-agent message-text--agent"
|
|
@@ -2478,11 +2478,11 @@ function absLink(url) {
|
|
|
2478
2478
|
}
|
|
2479
2479
|
;// CONCATENATED MODULE: ./src/chatbox/time.js
|
|
2480
2480
|
|
|
2481
|
-
var g_pub = new util/* default */.
|
|
2482
|
-
util/* default */.
|
|
2481
|
+
var g_pub = new util/* default */.A.Pubsub();
|
|
2482
|
+
util/* default */.A.setInterval(() => g_pub.publish('time'), 20 * 1000);
|
|
2483
2483
|
|
|
2484
2484
|
|
|
2485
|
-
class Time extends common/* Com */.
|
|
2485
|
+
class Time extends common/* Com */.Mw {
|
|
2486
2486
|
constructor(props) {
|
|
2487
2487
|
super(props);
|
|
2488
2488
|
this.setState({
|
|
@@ -2494,10 +2494,10 @@ class Time extends common/* Com */.Sq {
|
|
|
2494
2494
|
var t = '';
|
|
2495
2495
|
if (this.props.ago) {
|
|
2496
2496
|
if (this.props.short) {
|
|
2497
|
-
if (Math.abs(this.props.time - new util/* default */.
|
|
2498
|
-
let tim = new util/* default */.
|
|
2497
|
+
if (Math.abs(this.props.time - new util/* default */.A.Date().getTime()) > 86400000 * 10) {
|
|
2498
|
+
let tim = new util/* default */.A.Date(this.props.time);
|
|
2499
2499
|
let tzyear = tim.getFullYear();
|
|
2500
|
-
let locale = util/* default */.
|
|
2500
|
+
let locale = util/* default */.A.get(navigator, 'languages.0', 'en-US');
|
|
2501
2501
|
let tzmonthname = tim.toLocaleDateString(locale, {
|
|
2502
2502
|
month: 'short'
|
|
2503
2503
|
});
|
|
@@ -2505,8 +2505,8 @@ class Time extends common/* Com */.Sq {
|
|
|
2505
2505
|
t = tzdate + ' ' + tzmonthname + ' ' + tzyear;
|
|
2506
2506
|
}
|
|
2507
2507
|
}
|
|
2508
|
-
if (!t && this.props.time > 0) t = ago(this.props.time, new util/* default */.
|
|
2509
|
-
} else t = util/* default */.
|
|
2508
|
+
if (!t && this.props.time > 0) t = ago(this.props.time, new util/* default */.A.Date().getTime());
|
|
2509
|
+
} else t = util/* default */.A.shortTime(this.props.time, this.props.tzoffset);
|
|
2510
2510
|
if (this.props.uppercase) t = t.toUpperCase();
|
|
2511
2511
|
if (t === this.state.t) return;
|
|
2512
2512
|
this.setState({
|
|
@@ -2605,7 +2605,7 @@ function getRateLang(rating) {
|
|
|
2605
2605
|
|
|
2606
2606
|
|
|
2607
2607
|
|
|
2608
|
-
class InfoMessage extends common/* Com */.
|
|
2608
|
+
class InfoMessage extends common/* Com */.Mw {
|
|
2609
2609
|
render() {
|
|
2610
2610
|
let ev = this.props.ev.ev;
|
|
2611
2611
|
var $time = null;
|
|
@@ -2617,7 +2617,7 @@ class InfoMessage extends common/* Com */.Sq {
|
|
|
2617
2617
|
}));
|
|
2618
2618
|
}
|
|
2619
2619
|
if (ev.type === 'conversation_rated') {
|
|
2620
|
-
var rating = util/* default */.
|
|
2620
|
+
var rating = util/* default */.A.get(ev, 'data.conversation.ratings.0', {
|
|
2621
2621
|
no_rating: true,
|
|
2622
2622
|
rating: 0
|
|
2623
2623
|
});
|
|
@@ -2628,7 +2628,7 @@ class InfoMessage extends common/* Com */.Sq {
|
|
|
2628
2628
|
class: "info-message"
|
|
2629
2629
|
}, this.props.t('rated_as') + ' ' + this.props.t(getRateLang(rating.rating)).toLowerCase()));
|
|
2630
2630
|
}
|
|
2631
|
-
if (ev.type === 'conversation_state_updated' && util/* default */.
|
|
2631
|
+
if (ev.type === 'conversation_state_updated' && util/* default */.A.get(ev, 'data.conversation.state') === 'ended') {
|
|
2632
2632
|
return (0,preact_module.h)("div", {
|
|
2633
2633
|
class: "convo-event"
|
|
2634
2634
|
}, $time, (0,preact_module.h)("div", {
|
|
@@ -2656,13 +2656,13 @@ class InfoMessage extends common/* Com */.Sq {
|
|
|
2656
2656
|
|
|
2657
2657
|
|
|
2658
2658
|
|
|
2659
|
-
class Event extends common/* Com */.
|
|
2659
|
+
class Event extends common/* Com */.Mw {
|
|
2660
2660
|
constructor(props) {
|
|
2661
2661
|
super(props);
|
|
2662
|
-
this.refForm = (0,preact_module/* createRef */.
|
|
2662
|
+
this.refForm = (0,preact_module/* createRef */._3)();
|
|
2663
2663
|
}
|
|
2664
2664
|
render() {
|
|
2665
|
-
var ev = util/* default */.
|
|
2665
|
+
var ev = util/* default */.A.get(this.props.event, 'ev', {});
|
|
2666
2666
|
switch (ev.type) {
|
|
2667
2667
|
case 'conversation_joined':
|
|
2668
2668
|
break;
|
|
@@ -2671,7 +2671,7 @@ class Event extends common/* Com */.Sq {
|
|
|
2671
2671
|
case 'conversation_state_updated':
|
|
2672
2672
|
case 'conversation_rating_requested':
|
|
2673
2673
|
case 'conversation_rated':
|
|
2674
|
-
if (!util/* default */.
|
|
2674
|
+
if (!util/* default */.A.startsWith(ev.id, 'ev')) return null;
|
|
2675
2675
|
return (0,preact_module.h)(InfoMessage, {
|
|
2676
2676
|
t: this.props.t,
|
|
2677
2677
|
store: this.props.store,
|
|
@@ -2684,7 +2684,7 @@ class Event extends common/* Com */.Sq {
|
|
|
2684
2684
|
this.refForm.current && this.refForm.current.focus();
|
|
2685
2685
|
}
|
|
2686
2686
|
chooseQuickReply(reply) {
|
|
2687
|
-
let ev = util/* default */.
|
|
2687
|
+
let ev = util/* default */.A.get(this.props.event, 'ev', {});
|
|
2688
2688
|
let message = {
|
|
2689
2689
|
text: reply.title,
|
|
2690
2690
|
format: 'plaintext'
|
|
@@ -2701,7 +2701,7 @@ class Event extends common/* Com */.Sq {
|
|
|
2701
2701
|
this.props.onSend(message);
|
|
2702
2702
|
}
|
|
2703
2703
|
choosePostbackBtn(button) {
|
|
2704
|
-
let ev = util/* default */.
|
|
2704
|
+
let ev = util/* default */.A.get(this.props.event, 'ev', {});
|
|
2705
2705
|
let message = {
|
|
2706
2706
|
text: button.title,
|
|
2707
2707
|
format: 'plaintext'
|
|
@@ -2718,13 +2718,13 @@ class Event extends common/* Com */.Sq {
|
|
|
2718
2718
|
this.props.onSend(message);
|
|
2719
2719
|
}
|
|
2720
2720
|
renderAgentAvatar(ev) {
|
|
2721
|
-
let bytype = util/* default */.
|
|
2722
|
-
let byid = util/* default */.
|
|
2721
|
+
let bytype = util/* default */.A.get(ev, 'by.type');
|
|
2722
|
+
let byid = util/* default */.A.get(ev, 'by.display_id', util/* default */.A.get(ev, 'by.id'));
|
|
2723
2723
|
if (bytype === 'user') return null;
|
|
2724
2724
|
var senderName = this.getSenderName(ev);
|
|
2725
2725
|
let acc = this.props.store.matchAccount();
|
|
2726
|
-
var uri = acc.logo_url || __webpack_require__(
|
|
2727
|
-
if (util/* default */.
|
|
2726
|
+
var uri = acc.logo_url || __webpack_require__(3582);
|
|
2727
|
+
if (util/* default */.A.get(this.props, 'chatbox.hide_agent_profile')) {
|
|
2728
2728
|
return (0,preact_module.h)("div", {
|
|
2729
2729
|
class: "message-sender"
|
|
2730
2730
|
}, (0,preact_module.h)("img", {
|
|
@@ -2737,7 +2737,7 @@ class Event extends common/* Com */.Sq {
|
|
|
2737
2737
|
}
|
|
2738
2738
|
let agentM = this.props.store.matchAgent('*');
|
|
2739
2739
|
if (byid !== 'system' && bytype !== 'dummy' && bytype !== 'workflow') {
|
|
2740
|
-
uri = util/* default */.
|
|
2740
|
+
uri = util/* default */.A.get(agentM[byid], 'avatar_url') || acc.logo_url || __webpack_require__(2538);
|
|
2741
2741
|
}
|
|
2742
2742
|
return (0,preact_module.h)("div", {
|
|
2743
2743
|
class: "message-sender"
|
|
@@ -2759,8 +2759,8 @@ class Event extends common/* Com */.Sq {
|
|
|
2759
2759
|
time: ev.created
|
|
2760
2760
|
}));
|
|
2761
2761
|
}
|
|
2762
|
-
let t = new util/* default */.
|
|
2763
|
-
if (util/* default */.
|
|
2762
|
+
let t = new util/* default */.A.Date(ev.created).toLocaleString();
|
|
2763
|
+
if (util/* default */.A.get(ev, 'by.type') !== 'user') {
|
|
2764
2764
|
let $sender = null;
|
|
2765
2765
|
if (this.props.event.mode === 'lead') $sender = this.renderAgentAvatar(ev);
|
|
2766
2766
|
return (0,preact_module.h)("div", {
|
|
@@ -2816,15 +2816,15 @@ class Event extends common/* Com */.Sq {
|
|
|
2816
2816
|
onSelect: e => this.chooseQuickReply(e)
|
|
2817
2817
|
}));
|
|
2818
2818
|
}
|
|
2819
|
-
if (util/* default */.
|
|
2820
|
-
util/* default */.
|
|
2819
|
+
if (util/* default */.A.getMsgField(ev, 'idempotency') === ev.id && this.props.store.now() - ev.created < 900) {
|
|
2820
|
+
util/* default */.A.setTimeout(() => this.setState({
|
|
2821
2821
|
refresh: this.state.refresh
|
|
2822
2822
|
}), 1000);
|
|
2823
2823
|
}
|
|
2824
2824
|
let $dot = (0,preact_module.h)("div", {
|
|
2825
2825
|
class: "sending_dot"
|
|
2826
2826
|
});
|
|
2827
|
-
if (this.props.store.now() - ev.created < 900 || util/* default */.
|
|
2827
|
+
if (this.props.store.now() - ev.created < 900 || util/* default */.A.getMsgField(ev, 'idempotency') !== ev.id) {
|
|
2828
2828
|
$dot = (0,preact_module.h)("div", {
|
|
2829
2829
|
class: "sending_dot sending_dot__hide"
|
|
2830
2830
|
});
|
|
@@ -2888,7 +2888,7 @@ class Event extends common/* Com */.Sq {
|
|
|
2888
2888
|
})), $error);
|
|
2889
2889
|
}
|
|
2890
2890
|
renderUpdateConvo(ev) {
|
|
2891
|
-
var state = util/* default */.
|
|
2891
|
+
var state = util/* default */.A.get(ev, 'data.conversation.state');
|
|
2892
2892
|
if (state === 'active') return null;
|
|
2893
2893
|
if (state === 'pending') return null;
|
|
2894
2894
|
return (0,preact_module.h)("div", {
|
|
@@ -2898,27 +2898,27 @@ class Event extends common/* Com */.Sq {
|
|
|
2898
2898
|
}));
|
|
2899
2899
|
}
|
|
2900
2900
|
resendMessage() {
|
|
2901
|
-
let cid = util/* default */.
|
|
2902
|
-
const message = util/* default */.
|
|
2901
|
+
let cid = util/* default */.A.convoOfEv(this.props.event.ev);
|
|
2902
|
+
const message = util/* default */.A.get(this.props.event, 'ev.data.message');
|
|
2903
2903
|
this.props.store.sendConvoEvent(cid, 'message_sent', {
|
|
2904
2904
|
message
|
|
2905
2905
|
});
|
|
2906
2906
|
}
|
|
2907
2907
|
getSenderName(ev) {
|
|
2908
|
-
let bytype = util/* default */.
|
|
2909
|
-
let byid = util/* default */.
|
|
2910
|
-
if (bytype === 'user') return util/* default */.
|
|
2908
|
+
let bytype = util/* default */.A.get(ev, 'by.type');
|
|
2909
|
+
let byid = util/* default */.A.get(ev, 'by.display_id', util/* default */.A.get(ev, 'by.id'));
|
|
2910
|
+
if (bytype === 'user') return util/* default */.A.getUserDisplayName(this.props.store.matchUser());
|
|
2911
2911
|
let acc = this.props.store.matchAccount();
|
|
2912
|
-
if (bytype === 'agent') return util/* default */.
|
|
2912
|
+
if (bytype === 'agent') return util/* default */.A.getAgentDisplayName(acc, this.props.store.matchAgent(byid));
|
|
2913
2913
|
if (byid === 'system' || bytype === 'dummy' || bytype === 'workflow') return acc.name || 'system';
|
|
2914
2914
|
return '';
|
|
2915
2915
|
}
|
|
2916
2916
|
}
|
|
2917
2917
|
;// CONCATENATED MODULE: ./src/chatbox/spinner.js
|
|
2918
|
-
const loadingimg = __webpack_require__(
|
|
2918
|
+
const loadingimg = __webpack_require__(6973);
|
|
2919
2919
|
|
|
2920
2920
|
|
|
2921
|
-
class Spinner extends common/* Com */.
|
|
2921
|
+
class Spinner extends common/* Com */.Mw {
|
|
2922
2922
|
render() {
|
|
2923
2923
|
let mode = (this.props.mode + '').toLowerCase();
|
|
2924
2924
|
let mainColor = mode === 'dark' ? '#000000dd' : mode === 'blue' ? 'rgba(52, 152, 220, .8)' : mode;
|
|
@@ -2944,19 +2944,19 @@ class Spinner extends common/* Com */.Sq {
|
|
|
2944
2944
|
;// CONCATENATED MODULE: ./src/chatbox/Events.js
|
|
2945
2945
|
|
|
2946
2946
|
|
|
2947
|
-
const convoemptyimg = __webpack_require__(
|
|
2947
|
+
const convoemptyimg = __webpack_require__(1370);
|
|
2948
2948
|
|
|
2949
2949
|
|
|
2950
2950
|
|
|
2951
2951
|
|
|
2952
|
-
class Events extends common/* Com */.
|
|
2952
|
+
class Events extends common/* Com */.Mw {
|
|
2953
2953
|
constructor(props) {
|
|
2954
2954
|
super(props);
|
|
2955
2955
|
this.props.store.onUpdate(this, _ => this.forceUpdate());
|
|
2956
2956
|
this.props.store.onConvoEvent(this, ev => this.onEvent(ev));
|
|
2957
2957
|
this.loadConvo();
|
|
2958
2958
|
this.refBody = null;
|
|
2959
|
-
this.checkAndSeen = util/* default */.
|
|
2959
|
+
this.checkAndSeen = util/* default */.A.throttle(() => {
|
|
2960
2960
|
if (this.props.isShow && this.isBottom() && this.props.store.browserVisibility === 'visible' && document.hasFocus()) {
|
|
2961
2961
|
this.props.store.seenConvo(this.props.cid);
|
|
2962
2962
|
}
|
|
@@ -2968,8 +2968,8 @@ class Events extends common/* Com */.Sq {
|
|
|
2968
2968
|
}
|
|
2969
2969
|
render() {
|
|
2970
2970
|
if (this.state.error) return this.renderError();
|
|
2971
|
-
let events = util/* default */.
|
|
2972
|
-
if (!this.state.loading && util/* default */.
|
|
2971
|
+
let events = util/* default */.A.map(this.props.store.listEvents(this.props.cid));
|
|
2972
|
+
if (!this.state.loading && util/* default */.A.size(events) === 0) {
|
|
2973
2973
|
return (0,preact_module.h)("div", {
|
|
2974
2974
|
ref: ref => this.refBody = ref,
|
|
2975
2975
|
class: "widget-body--events-container"
|
|
@@ -2983,13 +2983,13 @@ class Events extends common/* Com */.Sq {
|
|
|
2983
2983
|
store: this.props.store
|
|
2984
2984
|
}));
|
|
2985
2985
|
}
|
|
2986
|
-
events = util/* default */.
|
|
2986
|
+
events = util/* default */.A.orderBy(events, 'created', 'asc');
|
|
2987
2987
|
let convo = this.props.store.matchConvo(this.props.cid);
|
|
2988
|
-
events = util/* default */.
|
|
2988
|
+
events = util/* default */.A.map(events, ev => ({
|
|
2989
2989
|
ev: ev
|
|
2990
2990
|
}));
|
|
2991
2991
|
processEvents(convo, events);
|
|
2992
|
-
let $events = util/* default */.
|
|
2992
|
+
let $events = util/* default */.A.map(events, ev => (0,preact_module.h)(Event, {
|
|
2993
2993
|
chatbox: this.props.chatbox,
|
|
2994
2994
|
onLink: this.props.onLink,
|
|
2995
2995
|
store: this.props.store,
|
|
@@ -3005,13 +3005,13 @@ class Events extends common/* Com */.Sq {
|
|
|
3005
3005
|
if (this.state.loading || this.props.creating) {
|
|
3006
3006
|
$loading = (0,preact_module.h)(Spinner, {
|
|
3007
3007
|
static: true,
|
|
3008
|
-
mode: util/* default */.
|
|
3008
|
+
mode: util/* default */.A.get(this.props.chatbox, 'primary_color', 'dark'),
|
|
3009
3009
|
size: "120",
|
|
3010
3010
|
center: true
|
|
3011
3011
|
});
|
|
3012
3012
|
style = 'opacity: 0 !important';
|
|
3013
3013
|
}
|
|
3014
|
-
return (0,preact_module.h)(preact_module/* Fragment */.
|
|
3014
|
+
return (0,preact_module.h)(preact_module/* Fragment */.FK, null, $loading, (0,preact_module.h)("div", {
|
|
3015
3015
|
style: style,
|
|
3016
3016
|
ref: ref => this.refBody = ref,
|
|
3017
3017
|
class: "widget-body--events-container",
|
|
@@ -3044,23 +3044,23 @@ class Events extends common/* Com */.Sq {
|
|
|
3044
3044
|
}
|
|
3045
3045
|
focus() {
|
|
3046
3046
|
let events = this.props.store.listEvents(this.props.cid);
|
|
3047
|
-
events = util/* default */.
|
|
3047
|
+
events = util/* default */.A.orderBy(util/* default */.A.map(events), 'created', 'desc');
|
|
3048
3048
|
var last_agent_sent;
|
|
3049
3049
|
for (let ev of events) {
|
|
3050
|
-
if (util/* default */.
|
|
3051
|
-
if (util/* default */.
|
|
3050
|
+
if (util/* default */.A.get(ev, 'type') !== 'message_sent') continue;
|
|
3051
|
+
if (util/* default */.A.get(ev, 'by.type') === 'user') continue;
|
|
3052
3052
|
last_agent_sent = ev;
|
|
3053
3053
|
break;
|
|
3054
3054
|
}
|
|
3055
|
-
if (util/* default */.
|
|
3056
|
-
let attachments = util/* default */.
|
|
3055
|
+
if (util/* default */.A.get(last_agent_sent, 'by.type') === 'user') last_agent_sent = null;
|
|
3056
|
+
let attachments = util/* default */.A.get(last_agent_sent, 'data.message.attachments', []);
|
|
3057
3057
|
let convo = this.props.store.matchConvo(this.props.cid);
|
|
3058
|
-
let pendingForms = util/* default */.
|
|
3058
|
+
let pendingForms = util/* default */.A.filter(attachments, att => {
|
|
3059
3059
|
if (!att) return false;
|
|
3060
3060
|
if (att.type !== 'form' && att.type !== 'ask_info_form') return false;
|
|
3061
3061
|
var form = att.form;
|
|
3062
3062
|
if (!form) return false;
|
|
3063
|
-
var state = util/* default */.
|
|
3063
|
+
var state = util/* default */.A.parseJSON(form.state) || {};
|
|
3064
3064
|
if (!state.require_finished && att.type !== 'ask_info_form') return false;
|
|
3065
3065
|
if (Events_isSummited(att.form)) return false;
|
|
3066
3066
|
if (convo.state === 'ended') return false;
|
|
@@ -3068,10 +3068,10 @@ class Events extends common/* Com */.Sq {
|
|
|
3068
3068
|
});
|
|
3069
3069
|
}
|
|
3070
3070
|
onEvent(newev) {
|
|
3071
|
-
if (util/* default */.
|
|
3071
|
+
if (util/* default */.A.convoOfEv(newev) !== this.props.cid) return;
|
|
3072
3072
|
let isBottom = this.isBottom();
|
|
3073
3073
|
var byme = false;
|
|
3074
|
-
if (util/* default */.
|
|
3074
|
+
if (util/* default */.A.get(newev, 'type') === 'message_sent' && newev.id === util/* default */.A.getMsgField(newev, 'idempotency')) byme = true;
|
|
3075
3075
|
if (byme || isBottom) this.scrollToBottom();
|
|
3076
3076
|
}
|
|
3077
3077
|
async loadConvo() {
|
|
@@ -3081,7 +3081,7 @@ class Events extends common/* Com */.Sq {
|
|
|
3081
3081
|
loading: true
|
|
3082
3082
|
});
|
|
3083
3083
|
let events = this.props.store.listEvents(this.props.cid);
|
|
3084
|
-
if (util/* default */.
|
|
3084
|
+
if (util/* default */.A.size(events) === 0) {
|
|
3085
3085
|
let cid = this.props.cid;
|
|
3086
3086
|
let {
|
|
3087
3087
|
error
|
|
@@ -3105,7 +3105,7 @@ class Events extends common/* Com */.Sq {
|
|
|
3105
3105
|
error: false
|
|
3106
3106
|
});
|
|
3107
3107
|
this.scrollToBottom();
|
|
3108
|
-
util/* default */.
|
|
3108
|
+
util/* default */.A.setTimeout(() => this.setState({
|
|
3109
3109
|
loading: false
|
|
3110
3110
|
}), 50);
|
|
3111
3111
|
}
|
|
@@ -3115,11 +3115,11 @@ class Events extends common/* Com */.Sq {
|
|
|
3115
3115
|
return $container.scrollHeight < $container.scrollTop + $container.offsetHeight + 50;
|
|
3116
3116
|
}
|
|
3117
3117
|
scrollToBottom() {
|
|
3118
|
-
util/* default */.
|
|
3118
|
+
util/* default */.A.setTimeout(() => {
|
|
3119
3119
|
const $div = this.refBody;
|
|
3120
3120
|
if ($div) $div.scrollTop = $div.scrollHeight;
|
|
3121
3121
|
});
|
|
3122
|
-
util/* default */.
|
|
3122
|
+
util/* default */.A.setTimeout(() => {
|
|
3123
3123
|
const $div = this.refBody;
|
|
3124
3124
|
if ($div) $div.scrollTop = $div.scrollHeight;
|
|
3125
3125
|
}, 200);
|
|
@@ -3137,13 +3137,13 @@ function processEvents(convo, events) {
|
|
|
3137
3137
|
let curEvent = events[i];
|
|
3138
3138
|
let lastEvent = events[i - 1];
|
|
3139
3139
|
if (visibleEvent(curEvent.ev)) {
|
|
3140
|
-
let elapsedSec = util/* default */.
|
|
3140
|
+
let elapsedSec = util/* default */.A.unixSec(curEvent.ev.created) - util/* default */.A.unixSec(lastEvent.ev.created);
|
|
3141
3141
|
if (elapsedSec > 120) curEvent.show_time = true;
|
|
3142
3142
|
}
|
|
3143
3143
|
}
|
|
3144
3144
|
for (var i = 0; i < events.length; i++) {
|
|
3145
3145
|
let curEvent = events[i];
|
|
3146
|
-
if (util/* default */.
|
|
3146
|
+
if (util/* default */.A.get(curEvent, 'ev.type') === 'message_sent') {
|
|
3147
3147
|
curEvent.show_time = true;
|
|
3148
3148
|
break;
|
|
3149
3149
|
}
|
|
@@ -3153,7 +3153,7 @@ function processEvents(convo, events) {
|
|
|
3153
3153
|
let prevEvent = events[i - 1];
|
|
3154
3154
|
if (curEvent.ev.type === 'message_sent') {
|
|
3155
3155
|
curEvent.mode = 'lead';
|
|
3156
|
-
if (util/* default */.
|
|
3156
|
+
if (util/* default */.A.get(prevEvent, 'ev.type') === 'message_sent' && util/* default */.A.get(prevEvent, 'ev.by.id') === util/* default */.A.get(curEvent, 'ev.by.id')) {
|
|
3157
3157
|
curEvent.mode = 'follow';
|
|
3158
3158
|
}
|
|
3159
3159
|
continue;
|
|
@@ -3161,18 +3161,18 @@ function processEvents(convo, events) {
|
|
|
3161
3161
|
}
|
|
3162
3162
|
}
|
|
3163
3163
|
function visibleEvent(ev) {
|
|
3164
|
-
let type = util/* default */.
|
|
3164
|
+
let type = util/* default */.A.get(ev, 'type');
|
|
3165
3165
|
return type === 'message_sent' || type === 'conversation_state_updated';
|
|
3166
3166
|
}
|
|
3167
3167
|
function Events_isSummited(form) {
|
|
3168
|
-
let fields = util/* default */.
|
|
3169
|
-
return util/* default */.
|
|
3168
|
+
let fields = util/* default */.A.get(form, 'fields') || [];
|
|
3169
|
+
return util/* default */.A.find(fields, field => !!field.answered);
|
|
3170
3170
|
}
|
|
3171
3171
|
;// CONCATENATED MODULE: ./src/chatbox/Typing.js
|
|
3172
3172
|
|
|
3173
3173
|
|
|
3174
3174
|
|
|
3175
|
-
class Typing extends common/* Com */.
|
|
3175
|
+
class Typing extends common/* Com */.Mw {
|
|
3176
3176
|
constructor(props) {
|
|
3177
3177
|
super(props);
|
|
3178
3178
|
}
|
|
@@ -3182,29 +3182,29 @@ class Typing extends common/* Com */.Sq {
|
|
|
3182
3182
|
ev: {}
|
|
3183
3183
|
});
|
|
3184
3184
|
this.props.store.onConvoEvent(this, ev => {
|
|
3185
|
-
if (util/* default */.
|
|
3185
|
+
if (util/* default */.A.convoOfEv(ev) !== this.props.cid) return;
|
|
3186
3186
|
let user = this.props.store.matchUser();
|
|
3187
|
-
if (util/* default */.
|
|
3188
|
-
let oldby = util/* default */.
|
|
3189
|
-
if (oldby && util/* default */.
|
|
3190
|
-
if (util/* default */.
|
|
3191
|
-
if (this.timer) util/* default */.
|
|
3187
|
+
if (util/* default */.A.get(ev, 'by.id') === user.id) return;
|
|
3188
|
+
let oldby = util/* default */.A.get(this.state.ev, 'by.id');
|
|
3189
|
+
if (oldby && util/* default */.A.get(ev, 'by.id') !== oldby) return;
|
|
3190
|
+
if (util/* default */.A.get(ev, 'type') === 'message_sent') {
|
|
3191
|
+
if (this.timer) util/* default */.A.clearTimeout(this.timer);
|
|
3192
3192
|
this.timer = null;
|
|
3193
3193
|
this.setState({
|
|
3194
3194
|
isShow: false
|
|
3195
3195
|
});
|
|
3196
3196
|
return;
|
|
3197
3197
|
}
|
|
3198
|
-
if (util/* default */.
|
|
3199
|
-
let ag = this.props.store.matchAgent(util/* default */.
|
|
3198
|
+
if (util/* default */.A.get(ev, 'type') !== 'conversation_typing') return;
|
|
3199
|
+
let ag = this.props.store.matchAgent(util/* default */.A.get(ev, 'by.id')) || {};
|
|
3200
3200
|
if (ag.type == 'agent') return;
|
|
3201
3201
|
this.setState({
|
|
3202
3202
|
ev: ev,
|
|
3203
3203
|
isShow: true
|
|
3204
3204
|
});
|
|
3205
|
-
if (this.timer) util/* default */.
|
|
3206
|
-
this.timer = util/* default */.
|
|
3207
|
-
if (util/* default */.
|
|
3205
|
+
if (this.timer) util/* default */.A.clearTimeout(this.timer);
|
|
3206
|
+
this.timer = util/* default */.A.setTimeout(() => {
|
|
3207
|
+
if (util/* default */.A.convoOfEv(ev) !== this.props.cid) return;
|
|
3208
3208
|
this.timer = null;
|
|
3209
3209
|
this.setState({
|
|
3210
3210
|
isShow: false
|
|
@@ -3215,8 +3215,8 @@ class Typing extends common/* Com */.Sq {
|
|
|
3215
3215
|
render() {
|
|
3216
3216
|
let account = this.props.store.matchAccount();
|
|
3217
3217
|
var cls = this.state.isShow ? '' : 'typing--hidden';
|
|
3218
|
-
let byid = util/* default */.
|
|
3219
|
-
let agentName = util/* default */.
|
|
3218
|
+
let byid = util/* default */.A.get(this.state.ev, 'by.display_id', util/* default */.A.get(this.state.ev, 'by.id'));
|
|
3219
|
+
let agentName = util/* default */.A.getAgentDisplayName(account, this.props.store.matchAgent(byid));
|
|
3220
3220
|
return (0,preact_module.h)("div", {
|
|
3221
3221
|
class: `typing ${cls}`
|
|
3222
3222
|
}, agentName, " ", this.props.t('typing'));
|
|
@@ -3235,7 +3235,7 @@ class Typing extends common/* Com */.Sq {
|
|
|
3235
3235
|
this.stop();
|
|
3236
3236
|
var t0;
|
|
3237
3237
|
var run = t => {
|
|
3238
|
-
if (!t) t = new util/* default */.
|
|
3238
|
+
if (!t) t = new util/* default */.A.Date().getTime();
|
|
3239
3239
|
var deltaT = t - t0;
|
|
3240
3240
|
var [newy, done] = this.calcY(v, y0, deltaT);
|
|
3241
3241
|
cb(newy);
|
|
@@ -3243,7 +3243,7 @@ class Typing extends common/* Com */.Sq {
|
|
|
3243
3243
|
this.animationframe = window.requestAnimationFrame(run);
|
|
3244
3244
|
};
|
|
3245
3245
|
this.animationframe = window.requestAnimationFrame(t => {
|
|
3246
|
-
t0 = t || new util/* default */.
|
|
3246
|
+
t0 = t || new util/* default */.A.Date().getTime();
|
|
3247
3247
|
run(t0);
|
|
3248
3248
|
});
|
|
3249
3249
|
}
|
|
@@ -3287,7 +3287,7 @@ const POPUP_HARD_MAX_HEIGHT = 500;
|
|
|
3287
3287
|
const POPUP_MIN_HEIGHT = 0;
|
|
3288
3288
|
|
|
3289
3289
|
|
|
3290
|
-
class Rating extends common/* Com */.
|
|
3290
|
+
class Rating extends common/* Com */.Mw {
|
|
3291
3291
|
constructor(props) {
|
|
3292
3292
|
super(props);
|
|
3293
3293
|
Rating_defineProperty(this, "state", {
|
|
@@ -3296,16 +3296,16 @@ class Rating extends common/* Com */.Sq {
|
|
|
3296
3296
|
overlayOpacity: 0.3,
|
|
3297
3297
|
comment: ''
|
|
3298
3298
|
});
|
|
3299
|
-
this.refComment = (0,preact_module/* createRef */.
|
|
3300
|
-
this.refRating = (0,preact_module/* createRef */.
|
|
3301
|
-
this.refHandle = (0,preact_module/* createRef */.
|
|
3299
|
+
this.refComment = (0,preact_module/* createRef */._3)();
|
|
3300
|
+
this.refRating = (0,preact_module/* createRef */._3)();
|
|
3301
|
+
this.refHandle = (0,preact_module/* createRef */._3)();
|
|
3302
3302
|
}
|
|
3303
3303
|
componentDidMount() {
|
|
3304
3304
|
this.props.store.onUpdate(this, () => {
|
|
3305
3305
|
if (this.shoudDisplay()) this.open();
|
|
3306
3306
|
});
|
|
3307
3307
|
this.props.store.onConvoEvent(this, ev => {
|
|
3308
|
-
var cid = util/* default */.
|
|
3308
|
+
var cid = util/* default */.A.convoOfEv(ev);
|
|
3309
3309
|
if (cid !== this.props.cid) return;
|
|
3310
3310
|
if (this.shoudDisplay()) this.open();
|
|
3311
3311
|
});
|
|
@@ -3384,7 +3384,7 @@ class Rating extends common/* Com */.Sq {
|
|
|
3384
3384
|
onClick: e => this.onRatingPoor(e)
|
|
3385
3385
|
}, (0,preact_module.h)("img", {
|
|
3386
3386
|
alt: "poor",
|
|
3387
|
-
src: __webpack_require__(
|
|
3387
|
+
src: __webpack_require__(9801)
|
|
3388
3388
|
}), (0,preact_module.h)("p", {
|
|
3389
3389
|
class: "rating-face--text"
|
|
3390
3390
|
}, this.props.t('poor'))), (0,preact_module.h)("div", {
|
|
@@ -3392,7 +3392,7 @@ class Rating extends common/* Com */.Sq {
|
|
|
3392
3392
|
onClick: e => this.onRatingAverage(e)
|
|
3393
3393
|
}, (0,preact_module.h)("img", {
|
|
3394
3394
|
alt: "average",
|
|
3395
|
-
src: __webpack_require__(
|
|
3395
|
+
src: __webpack_require__(7134)
|
|
3396
3396
|
}), (0,preact_module.h)("p", {
|
|
3397
3397
|
class: "rating-face--text"
|
|
3398
3398
|
}, this.props.t('average'))), (0,preact_module.h)("div", {
|
|
@@ -3400,7 +3400,7 @@ class Rating extends common/* Com */.Sq {
|
|
|
3400
3400
|
onClick: e => this.onRatingGreat(e)
|
|
3401
3401
|
}, (0,preact_module.h)("img", {
|
|
3402
3402
|
alt: "great",
|
|
3403
|
-
src: __webpack_require__(
|
|
3403
|
+
src: __webpack_require__(940)
|
|
3404
3404
|
}), (0,preact_module.h)("p", {
|
|
3405
3405
|
class: "rating-face--text"
|
|
3406
3406
|
}, this.props.t('great')))), (0,preact_module.h)("div", {
|
|
@@ -3414,12 +3414,12 @@ class Rating extends common/* Com */.Sq {
|
|
|
3414
3414
|
var rated;
|
|
3415
3415
|
var ended;
|
|
3416
3416
|
let user = this.props.store.matchUser();
|
|
3417
|
-
util/* default */.
|
|
3418
|
-
if (util/* default */.
|
|
3417
|
+
util/* default */.A.map(this.props.store.listEvents(this.props.cid), ev => {
|
|
3418
|
+
if (util/* default */.A.get(ev, 'type') === 'conversation_state_updated' && util/* default */.A.get(ev, 'data.conversation.state') === 'ended') {
|
|
3419
3419
|
ended = ev;
|
|
3420
3420
|
}
|
|
3421
|
-
if (util/* default */.
|
|
3422
|
-
if (util/* default */.
|
|
3421
|
+
if (util/* default */.A.get(ev, 'type') === 'conversation_rating_requested') requested = ev;
|
|
3422
|
+
if (util/* default */.A.get(ev, 'type') === 'conversation_rated' && util/* default */.A.get(ev, 'by.id') === user.id) rated = ev;
|
|
3423
3423
|
});
|
|
3424
3424
|
if (rated) return false;
|
|
3425
3425
|
let accountSetting = this.props.plugin.chatbox;
|
|
@@ -3460,7 +3460,7 @@ class Rating extends common/* Com */.Sq {
|
|
|
3460
3460
|
hide: false
|
|
3461
3461
|
});
|
|
3462
3462
|
if (!this.refRating.current) return;
|
|
3463
|
-
util/* default */.
|
|
3463
|
+
util/* default */.A.setTimeout(() => {
|
|
3464
3464
|
if (this.refComment.current) this.refComment.current.focus();
|
|
3465
3465
|
}, 400);
|
|
3466
3466
|
this.refComment.current.value = '';
|
|
@@ -3549,15 +3549,15 @@ function DropdownSelect_toPrimitive(t, r) { if ("object" != typeof t || !t) retu
|
|
|
3549
3549
|
|
|
3550
3550
|
|
|
3551
3551
|
|
|
3552
|
-
class DropdownSelect extends common/* Com */.
|
|
3552
|
+
class DropdownSelect extends common/* Com */.Mw {
|
|
3553
3553
|
constructor(props) {
|
|
3554
3554
|
super(props);
|
|
3555
3555
|
DropdownSelect_defineProperty(this, "state", {
|
|
3556
3556
|
show: false,
|
|
3557
3557
|
searchValue: ''
|
|
3558
3558
|
});
|
|
3559
|
-
DropdownSelect_defineProperty(this, "filterRef", (0,preact_module/* createRef */.
|
|
3560
|
-
DropdownSelect_defineProperty(this, "overlayRef", (0,preact_module/* createRef */.
|
|
3559
|
+
DropdownSelect_defineProperty(this, "filterRef", (0,preact_module/* createRef */._3)());
|
|
3560
|
+
DropdownSelect_defineProperty(this, "overlayRef", (0,preact_module/* createRef */._3)());
|
|
3561
3561
|
DropdownSelect_defineProperty(this, "onTouchMove", e => {
|
|
3562
3562
|
if (e.target === this.overlayRef.current) {
|
|
3563
3563
|
e.preventDefault();
|
|
@@ -3582,15 +3582,15 @@ class DropdownSelect extends common/* Com */.Sq {
|
|
|
3582
3582
|
});
|
|
3583
3583
|
DropdownSelect_defineProperty(this, "hasSearch", () => {
|
|
3584
3584
|
if (this.props.has_search) return true;
|
|
3585
|
-
return util/* default */.
|
|
3585
|
+
return util/* default */.A.size(this.props.items) >= 10;
|
|
3586
3586
|
});
|
|
3587
3587
|
DropdownSelect_defineProperty(this, "getFilteredOptions", () => {
|
|
3588
3588
|
let items = this.props.items;
|
|
3589
3589
|
if (this.state.searchValue && this.hasSearch()) {
|
|
3590
|
-
items = util/* default */.
|
|
3591
|
-
let optionName = util/* default */.
|
|
3592
|
-
let optionDesc = util/* default */.
|
|
3593
|
-
let searchValue = util/* default */.
|
|
3590
|
+
items = util/* default */.A.filter(items, item => {
|
|
3591
|
+
let optionName = util/* default */.A.unicodeToAscii(item.name).toLowerCase().replace(/ /g, '');
|
|
3592
|
+
let optionDesc = util/* default */.A.unicodeToAscii(item.desc).toLowerCase().replace(/ /g, '');
|
|
3593
|
+
let searchValue = util/* default */.A.unicodeToAscii(this.state.searchValue).toLowerCase().replace(/ /g, '');
|
|
3594
3594
|
return optionName.indexOf(searchValue) != -1 || optionDesc.indexOf(searchValue) != -1;
|
|
3595
3595
|
});
|
|
3596
3596
|
}
|
|
@@ -3629,7 +3629,7 @@ class DropdownSelect extends common/* Com */.Sq {
|
|
|
3629
3629
|
class: "dropdown_select_filter__empty"
|
|
3630
3630
|
}, (0,preact_module.h)("img", {
|
|
3631
3631
|
class: "dropdown_select_filter__empty_img",
|
|
3632
|
-
src: __webpack_require__(
|
|
3632
|
+
src: __webpack_require__(3142)
|
|
3633
3633
|
}), (0,preact_module.h)("div", {
|
|
3634
3634
|
class: "muted",
|
|
3635
3635
|
style: "text-align: center !important;"
|
|
@@ -3649,7 +3649,7 @@ class DropdownSelect extends common/* Com */.Sq {
|
|
|
3649
3649
|
focusFilter() {
|
|
3650
3650
|
if (!this.filterRef.current) return;
|
|
3651
3651
|
this.filterRef.current.focus();
|
|
3652
|
-
util/* default */.
|
|
3652
|
+
util/* default */.A.setTimeout(() => {
|
|
3653
3653
|
if (!this.filterRef.current) return;
|
|
3654
3654
|
this.filterRef.current.focus();
|
|
3655
3655
|
}, 100);
|
|
@@ -3657,7 +3657,7 @@ class DropdownSelect extends common/* Com */.Sq {
|
|
|
3657
3657
|
renderDropdown() {
|
|
3658
3658
|
if (!this.state.show) return null;
|
|
3659
3659
|
let items = this.getFilteredOptions();
|
|
3660
|
-
let $items = util/* default */.
|
|
3660
|
+
let $items = util/* default */.A.map(items, item => {
|
|
3661
3661
|
return (0,preact_module.h)("div", {
|
|
3662
3662
|
class: "dropdown_select__item",
|
|
3663
3663
|
onClick: _ => this.onSelect(item)
|
|
@@ -3667,12 +3667,12 @@ class DropdownSelect extends common/* Com */.Sq {
|
|
|
3667
3667
|
if (this.hasSearch()) {
|
|
3668
3668
|
let $img = (0,preact_module.h)("img", {
|
|
3669
3669
|
class: "dropdown_select_filter__icon",
|
|
3670
|
-
src: __webpack_require__(
|
|
3670
|
+
src: __webpack_require__(5452)
|
|
3671
3671
|
});
|
|
3672
3672
|
if (this.props.loading) {
|
|
3673
3673
|
$img = (0,preact_module.h)("img", {
|
|
3674
3674
|
class: "dropdown_select_filter__icon",
|
|
3675
|
-
src: __webpack_require__(
|
|
3675
|
+
src: __webpack_require__(185)
|
|
3676
3676
|
});
|
|
3677
3677
|
}
|
|
3678
3678
|
$filter = (0,preact_module.h)("div", {
|
|
@@ -3718,17 +3718,17 @@ class DropdownSelect extends common/* Com */.Sq {
|
|
|
3718
3718
|
class: "muted text-truncate",
|
|
3719
3719
|
style: "flex: 1 !important;"
|
|
3720
3720
|
}, "Ch\u1ECDn m\u1ED9t ph\u1EA7n t\u1EED");
|
|
3721
|
-
if (util/* default */.
|
|
3721
|
+
if (util/* default */.A.get(this.props, 'selected.name')) $name = (0,preact_module.h)("div", {
|
|
3722
3722
|
class: "text-truncate",
|
|
3723
3723
|
style: "flex: 1 !important;"
|
|
3724
|
-
}, util/* default */.
|
|
3724
|
+
}, util/* default */.A.get(this.props, 'selected.name'));
|
|
3725
3725
|
let style = 'position: relative !important;';
|
|
3726
3726
|
if (this.props.full) {
|
|
3727
3727
|
style = '';
|
|
3728
3728
|
}
|
|
3729
3729
|
return (0,preact_module.h)("div", {
|
|
3730
3730
|
style: style
|
|
3731
|
-
}, (0,preact_module.h)(common/* Clickaway */.
|
|
3731
|
+
}, (0,preact_module.h)(common/* Clickaway */.tW, {
|
|
3732
3732
|
onClickaway: this.hideDropdown
|
|
3733
3733
|
}, (0,preact_module.h)("div", {
|
|
3734
3734
|
type: "text",
|
|
@@ -3736,7 +3736,7 @@ class DropdownSelect extends common/* Com */.Sq {
|
|
|
3736
3736
|
onClick: this.toogleDropdown
|
|
3737
3737
|
}, $name, "\xA0", (0,preact_module.h)("img", {
|
|
3738
3738
|
class: "dropdown_select__caret",
|
|
3739
|
-
src: __webpack_require__(
|
|
3739
|
+
src: __webpack_require__(7741)
|
|
3740
3740
|
})), this.renderDropdown()));
|
|
3741
3741
|
}
|
|
3742
3742
|
}
|
|
@@ -3748,7 +3748,7 @@ function address_picker_toPrimitive(t, r) { if ("object" != typeof t || !t) retu
|
|
|
3748
3748
|
|
|
3749
3749
|
|
|
3750
3750
|
|
|
3751
|
-
class AddressPicker extends common/* Com */.
|
|
3751
|
+
class AddressPicker extends common/* Com */.Mw {
|
|
3752
3752
|
constructor(props) {
|
|
3753
3753
|
super(props);
|
|
3754
3754
|
address_picker_defineProperty(this, "state", {
|
|
@@ -3756,8 +3756,8 @@ class AddressPicker extends common/* Com */.Sq {
|
|
|
3756
3756
|
searchValue: '',
|
|
3757
3757
|
addresses: []
|
|
3758
3758
|
});
|
|
3759
|
-
address_picker_defineProperty(this, "filterRef", (0,preact_module/* createRef */.
|
|
3760
|
-
address_picker_defineProperty(this, "overlayRef", (0,preact_module/* createRef */.
|
|
3759
|
+
address_picker_defineProperty(this, "filterRef", (0,preact_module/* createRef */._3)());
|
|
3760
|
+
address_picker_defineProperty(this, "overlayRef", (0,preact_module/* createRef */._3)());
|
|
3761
3761
|
address_picker_defineProperty(this, "onTouchMove", e => {
|
|
3762
3762
|
if (e.target === this.overlayRef.current) {
|
|
3763
3763
|
e.preventDefault();
|
|
@@ -3781,13 +3781,13 @@ class AddressPicker extends common/* Com */.Sq {
|
|
|
3781
3781
|
}
|
|
3782
3782
|
if (e.key == 'Enter') {}
|
|
3783
3783
|
});
|
|
3784
|
-
address_picker_defineProperty(this, "doSearch", util/* default */.
|
|
3784
|
+
address_picker_defineProperty(this, "doSearch", util/* default */.A.throttle(async () => {
|
|
3785
3785
|
let requestId = Date.now();
|
|
3786
3786
|
this.requestId = requestId;
|
|
3787
3787
|
let res = await this.props.store.suggest_addresses(this.state.searchValue);
|
|
3788
3788
|
if (this.requestId !== requestId) return;
|
|
3789
3789
|
this.setState({
|
|
3790
|
-
addresses: util/* default */.
|
|
3790
|
+
addresses: util/* default */.A.get(res, 'body.addresses', [])
|
|
3791
3791
|
});
|
|
3792
3792
|
}, 100));
|
|
3793
3793
|
address_picker_defineProperty(this, "onChangeSearchValue", e => {
|
|
@@ -3824,7 +3824,7 @@ class AddressPicker extends common/* Com */.Sq {
|
|
|
3824
3824
|
class: "dropdown_select_filter__empty"
|
|
3825
3825
|
}, (0,preact_module.h)("img", {
|
|
3826
3826
|
class: "dropdown_select_filter__empty_img",
|
|
3827
|
-
src: __webpack_require__(
|
|
3827
|
+
src: __webpack_require__(3142)
|
|
3828
3828
|
}), (0,preact_module.h)("div", {
|
|
3829
3829
|
class: "muted",
|
|
3830
3830
|
style: "text-align: center !important;"
|
|
@@ -3844,14 +3844,14 @@ class AddressPicker extends common/* Com */.Sq {
|
|
|
3844
3844
|
focusFilter() {
|
|
3845
3845
|
if (!this.filterRef.current) return;
|
|
3846
3846
|
this.filterRef.current.focus();
|
|
3847
|
-
util/* default */.
|
|
3847
|
+
util/* default */.A.setTimeout(() => {
|
|
3848
3848
|
if (!this.filterRef.current) return;
|
|
3849
3849
|
this.filterRef.current.focus();
|
|
3850
3850
|
}, 100);
|
|
3851
3851
|
}
|
|
3852
3852
|
renderDropdown() {
|
|
3853
3853
|
if (!this.state.show) return null;
|
|
3854
|
-
let $items = util/* default */.
|
|
3854
|
+
let $items = util/* default */.A.map(this.state.addresses, (addr, i) => {
|
|
3855
3855
|
let label = [((addr.address || '') + ' ' + normalize(addr.street)).trim()].join(', ');
|
|
3856
3856
|
let desc = [normalize(addr.ward), normalize(addr.district), normalize(addr.province)].join(', ');
|
|
3857
3857
|
return (0,preact_module.h)("div", {
|
|
@@ -3865,12 +3865,12 @@ class AddressPicker extends common/* Com */.Sq {
|
|
|
3865
3865
|
let $filter = null;
|
|
3866
3866
|
let $img = (0,preact_module.h)("img", {
|
|
3867
3867
|
class: "dropdown_select_filter__icon",
|
|
3868
|
-
src: __webpack_require__(
|
|
3868
|
+
src: __webpack_require__(5452)
|
|
3869
3869
|
});
|
|
3870
3870
|
if (this.props.loading) {
|
|
3871
3871
|
$img = (0,preact_module.h)("img", {
|
|
3872
3872
|
class: "dropdown_select_filter__icon",
|
|
3873
|
-
src: __webpack_require__(
|
|
3873
|
+
src: __webpack_require__(185)
|
|
3874
3874
|
});
|
|
3875
3875
|
}
|
|
3876
3876
|
$filter = (0,preact_module.h)("div", {
|
|
@@ -3921,7 +3921,7 @@ class AddressPicker extends common/* Com */.Sq {
|
|
|
3921
3921
|
}
|
|
3922
3922
|
return (0,preact_module.h)("div", {
|
|
3923
3923
|
style: style
|
|
3924
|
-
}, (0,preact_module.h)(common/* Clickaway */.
|
|
3924
|
+
}, (0,preact_module.h)(common/* Clickaway */.tW, {
|
|
3925
3925
|
onClickaway: this.hideDropdown
|
|
3926
3926
|
}, (0,preact_module.h)("div", {
|
|
3927
3927
|
type: "text",
|
|
@@ -3948,37 +3948,37 @@ function normalize(s) {
|
|
|
3948
3948
|
}
|
|
3949
3949
|
;// CONCATENATED MODULE: ./src/order/icon.js
|
|
3950
3950
|
|
|
3951
|
-
let promiseMainCSS = (() => __webpack_require__.e(/* import() */
|
|
3951
|
+
let promiseMainCSS = (() => __webpack_require__.e(/* import() */ 278).then(__webpack_require__.bind(__webpack_require__, 9278)))();
|
|
3952
3952
|
var $link = document.createElement('link');
|
|
3953
3953
|
$link.href = 'https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap';
|
|
3954
3954
|
$link.rel = 'stylesheet';
|
|
3955
3955
|
document.head.append($link);
|
|
3956
|
-
util/* default */.
|
|
3956
|
+
util/* default */.A.preloadWebfonts(['Roboto'], [400, 500]);
|
|
3957
3957
|
|
|
3958
|
-
let icon_defaultAvatar = __webpack_require__(
|
|
3958
|
+
let icon_defaultAvatar = __webpack_require__(2538);
|
|
3959
3959
|
|
|
3960
3960
|
|
|
3961
3961
|
|
|
3962
|
-
class Icon extends common/* Com */.
|
|
3962
|
+
class Icon extends common/* Com */.Mw {
|
|
3963
3963
|
render() {
|
|
3964
3964
|
if (this.props.name == 'package') {
|
|
3965
3965
|
if (this.props.active) return (0,preact_module.h)("img", {
|
|
3966
3966
|
style: "width: 18px !important;",
|
|
3967
|
-
src: __webpack_require__(
|
|
3967
|
+
src: __webpack_require__(8512)
|
|
3968
3968
|
});
|
|
3969
3969
|
return (0,preact_module.h)("img", {
|
|
3970
3970
|
style: "width: 18px !important;",
|
|
3971
|
-
src: __webpack_require__(
|
|
3971
|
+
src: __webpack_require__(6857)
|
|
3972
3972
|
});
|
|
3973
3973
|
}
|
|
3974
3974
|
if (this.props.name === 'shop') {
|
|
3975
3975
|
if (this.props.active) return (0,preact_module.h)("img", {
|
|
3976
3976
|
style: "width: 18px !important;",
|
|
3977
|
-
src: __webpack_require__(
|
|
3977
|
+
src: __webpack_require__(5244)
|
|
3978
3978
|
});
|
|
3979
3979
|
return (0,preact_module.h)("img", {
|
|
3980
3980
|
style: "width: 18px !important;",
|
|
3981
|
-
src: __webpack_require__(
|
|
3981
|
+
src: __webpack_require__(2523)
|
|
3982
3982
|
});
|
|
3983
3983
|
}
|
|
3984
3984
|
}
|
|
@@ -3995,9 +3995,9 @@ function order_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var
|
|
|
3995
3995
|
|
|
3996
3996
|
|
|
3997
3997
|
|
|
3998
|
-
var checkedimg = __webpack_require__(
|
|
3999
|
-
var ximg = __webpack_require__(
|
|
4000
|
-
class order_Order extends common/* Com */.
|
|
3998
|
+
var checkedimg = __webpack_require__(5860);
|
|
3999
|
+
var ximg = __webpack_require__(3080);
|
|
4000
|
+
class order_Order extends common/* Com */.Mw {
|
|
4001
4001
|
constructor(props) {
|
|
4002
4002
|
super(props);
|
|
4003
4003
|
order_defineProperty(this, "state", {
|
|
@@ -4060,7 +4060,7 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4060
4060
|
loadDistrict: false
|
|
4061
4061
|
});
|
|
4062
4062
|
if (!out.error) this.setState({
|
|
4063
|
-
districts: util/* default */.
|
|
4063
|
+
districts: util/* default */.A.get(out, 'body.addresses')
|
|
4064
4064
|
});
|
|
4065
4065
|
});
|
|
4066
4066
|
order_defineProperty(this, "onSelectDistrict", async item => {
|
|
@@ -4079,7 +4079,7 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4079
4079
|
loadWard: false
|
|
4080
4080
|
});
|
|
4081
4081
|
if (!out.error) this.setState({
|
|
4082
|
-
wards: util/* default */.
|
|
4082
|
+
wards: util/* default */.A.get(out, 'body.addresses')
|
|
4083
4083
|
});
|
|
4084
4084
|
});
|
|
4085
4085
|
order_defineProperty(this, "onSelectWard", item => this.setState({
|
|
@@ -4100,7 +4100,7 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4100
4100
|
order_defineProperty(this, "onSelectAddress", addr => {
|
|
4101
4101
|
if (!addr) return;
|
|
4102
4102
|
this.setState({
|
|
4103
|
-
address: [util/* default */.
|
|
4103
|
+
address: [util/* default */.A.trim(addr.address), util/* default */.A.trim(addr.street)].join(' ').trim(),
|
|
4104
4104
|
street: addr.street,
|
|
4105
4105
|
err: {},
|
|
4106
4106
|
g_err: ''
|
|
@@ -4147,36 +4147,36 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4147
4147
|
});
|
|
4148
4148
|
}
|
|
4149
4149
|
if (this.state.shipping === 'shop') {
|
|
4150
|
-
if (!util/* default */.
|
|
4150
|
+
if (!util/* default */.A.isPhone(this.state.phone)) {
|
|
4151
4151
|
err.phone = true;
|
|
4152
4152
|
}
|
|
4153
|
-
if (!util/* default */.
|
|
4153
|
+
if (!util/* default */.A.trim(this.state.fullname)) {
|
|
4154
4154
|
err.name = true;
|
|
4155
4155
|
}
|
|
4156
|
-
if (!util/* default */.
|
|
4156
|
+
if (!util/* default */.A.trim(this.state.email)) {
|
|
4157
4157
|
err.email = true;
|
|
4158
4158
|
}
|
|
4159
4159
|
} else if (this.state.shipping_address == 'new') {
|
|
4160
|
-
if (!util/* default */.
|
|
4160
|
+
if (!util/* default */.A.isPhone(this.state.phone)) {
|
|
4161
4161
|
err.phone = true;
|
|
4162
4162
|
}
|
|
4163
|
-
if (!util/* default */.
|
|
4163
|
+
if (!util/* default */.A.trim(this.state.fullname)) {
|
|
4164
4164
|
err.name = true;
|
|
4165
4165
|
}
|
|
4166
|
-
if (!util/* default */.
|
|
4166
|
+
if (!util/* default */.A.trim(this.state.address)) {
|
|
4167
4167
|
err.address = true;
|
|
4168
4168
|
}
|
|
4169
|
-
if (util/* default */.
|
|
4169
|
+
if (util/* default */.A.size(this.state.selectedWard) == 0) {
|
|
4170
4170
|
err.ward = true;
|
|
4171
4171
|
}
|
|
4172
|
-
if (util/* default */.
|
|
4172
|
+
if (util/* default */.A.size(this.state.selectedDistrict) == 0) {
|
|
4173
4173
|
err.district = true;
|
|
4174
4174
|
}
|
|
4175
|
-
if (util/* default */.
|
|
4175
|
+
if (util/* default */.A.size(this.state.selectedProvince) == 0) {
|
|
4176
4176
|
err.province = true;
|
|
4177
4177
|
}
|
|
4178
4178
|
}
|
|
4179
|
-
if (util/* default */.
|
|
4179
|
+
if (util/* default */.A.size(err) > 0) {
|
|
4180
4180
|
this.setState({
|
|
4181
4181
|
err,
|
|
4182
4182
|
g_err: this.props.t('input_shipping_info_err')
|
|
@@ -4184,15 +4184,15 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4184
4184
|
return;
|
|
4185
4185
|
}
|
|
4186
4186
|
let user = this.props.store.matchUser();
|
|
4187
|
-
let ufullname = util/* default */.
|
|
4188
|
-
let uemail = util/* default */.
|
|
4189
|
-
let uphone = util/* default */.
|
|
4190
|
-
let order = util/* default */.
|
|
4187
|
+
let ufullname = util/* default */.A.getUserAttr(user, 'fullname', 'text');
|
|
4188
|
+
let uemail = util/* default */.A.getUserAttr(user, 'emails', 'text');
|
|
4189
|
+
let uphone = util/* default */.A.getUserAttr(user, 'phones', 'text');
|
|
4190
|
+
let order = util/* default */.A.cloneDeep(this.state.order);
|
|
4191
4191
|
if (this.state.shipping === 'shop') {
|
|
4192
|
-
util/* default */.
|
|
4193
|
-
util/* default */.
|
|
4194
|
-
util/* default */.
|
|
4195
|
-
util/* default */.
|
|
4192
|
+
util/* default */.A.set(order, 'shipping.pickup_at_shop', true);
|
|
4193
|
+
util/* default */.A.set(order, 'shipping.address.phone', this.state.phone);
|
|
4194
|
+
util/* default */.A.set(order, 'shipping.address.fullname', this.state.fullname);
|
|
4195
|
+
util/* default */.A.set(order, 'shipping.address.email', this.state.email);
|
|
4196
4196
|
} else {
|
|
4197
4197
|
if (this.state.shipping_address == 'new') {
|
|
4198
4198
|
let out = await this.props.store.createShippingAddress({
|
|
@@ -4212,37 +4212,37 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4212
4212
|
if (out.error) return this.setState({
|
|
4213
4213
|
g_err: this.props.t('update_failed')
|
|
4214
4214
|
});
|
|
4215
|
-
util/* default */.
|
|
4215
|
+
util/* default */.A.set(order, 'shipping.address', out.body);
|
|
4216
4216
|
} else {
|
|
4217
4217
|
let addresses = this.props.store.matchShippingAddresses();
|
|
4218
|
-
let sa = util/* default */.
|
|
4218
|
+
let sa = util/* default */.A.find(addresses, addr => addr.id === this.state.shipping_address);
|
|
4219
4219
|
if (!sa) {
|
|
4220
4220
|
return this.setState({
|
|
4221
4221
|
err,
|
|
4222
4222
|
g_err: this.props.t('input_shipping_info_err')
|
|
4223
4223
|
});
|
|
4224
4224
|
}
|
|
4225
|
-
util/* default */.
|
|
4225
|
+
util/* default */.A.set(order, 'shipping.address', sa);
|
|
4226
4226
|
}
|
|
4227
4227
|
}
|
|
4228
4228
|
let changeduser = false;
|
|
4229
4229
|
if (!ufullname && this.state.fullname) {
|
|
4230
4230
|
changeduser = true;
|
|
4231
|
-
util/* default */.
|
|
4231
|
+
util/* default */.A.setUserAttr(user, {
|
|
4232
4232
|
key: 'fullname',
|
|
4233
4233
|
text: this.state.fullname
|
|
4234
4234
|
});
|
|
4235
4235
|
}
|
|
4236
4236
|
if (!uemail && this.state.email) {
|
|
4237
4237
|
changeduser = true;
|
|
4238
|
-
util/* default */.
|
|
4238
|
+
util/* default */.A.setUserAttr(user, {
|
|
4239
4239
|
key: 'emails',
|
|
4240
4240
|
text: this.state.email
|
|
4241
4241
|
});
|
|
4242
4242
|
}
|
|
4243
4243
|
if (!uphone && this.state.phone) {
|
|
4244
4244
|
changeduser = true;
|
|
4245
|
-
util/* default */.
|
|
4245
|
+
util/* default */.A.setUserAttr(user, {
|
|
4246
4246
|
key: 'phones',
|
|
4247
4247
|
text: this.state.phone
|
|
4248
4248
|
});
|
|
@@ -4269,7 +4269,7 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4269
4269
|
order_defineProperty(this, "onCancel", () => {
|
|
4270
4270
|
if (this.props.onResponse) this.props.onResponse('rejected');
|
|
4271
4271
|
if (this.props.cid && !this.state.order.user_confirmation) {
|
|
4272
|
-
let order = util/* default */.
|
|
4272
|
+
let order = util/* default */.A.cloneDeep(this.state.order);
|
|
4273
4273
|
order.user_confirmation = 'rejected';
|
|
4274
4274
|
this.props.store.updateOrder(order);
|
|
4275
4275
|
}
|
|
@@ -4296,10 +4296,10 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4296
4296
|
});
|
|
4297
4297
|
}
|
|
4298
4298
|
let user = this.props.store.matchUser();
|
|
4299
|
-
let attributes = util/* default */.
|
|
4300
|
-
let fullname = util/* default */.
|
|
4301
|
-
let email = util/* default */.
|
|
4302
|
-
let phone = util/* default */.
|
|
4299
|
+
let attributes = util/* default */.A.get(this.props.store.matchUser(), 'attributes', []);
|
|
4300
|
+
let fullname = util/* default */.A.get(util/* default */.A.find(attributes, att => att.key === 'fullname'), 'text');
|
|
4301
|
+
let email = util/* default */.A.get(util/* default */.A.find(attributes, att => att.key === 'emails'), 'text');
|
|
4302
|
+
let phone = util/* default */.A.get(util/* default */.A.find(attributes, att => att.key === 'phones'), 'text');
|
|
4303
4303
|
this.setState({
|
|
4304
4304
|
fullname,
|
|
4305
4305
|
email,
|
|
@@ -4311,7 +4311,7 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4311
4311
|
loadProvince: false
|
|
4312
4312
|
});
|
|
4313
4313
|
if (!out.error) this.setState({
|
|
4314
|
-
provinces: util/* default */.
|
|
4314
|
+
provinces: util/* default */.A.get(out, 'body.addresses')
|
|
4315
4315
|
});
|
|
4316
4316
|
}
|
|
4317
4317
|
isMobile() {
|
|
@@ -4341,7 +4341,7 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4341
4341
|
}
|
|
4342
4342
|
if (editmode) {
|
|
4343
4343
|
let pms = this.props.store.matchPaymentMethods();
|
|
4344
|
-
let $pms = util/* default */.
|
|
4344
|
+
let $pms = util/* default */.A.map(pms, pm => {
|
|
4345
4345
|
let $name = pm.description;
|
|
4346
4346
|
if (pm.method == 'bank_transfer') {
|
|
4347
4347
|
$name = pm.description + ' ' + pm.bank_name + ' ' + pm.bank_branch;
|
|
@@ -4383,7 +4383,7 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4383
4383
|
});
|
|
4384
4384
|
let seccls = 'card_section';
|
|
4385
4385
|
if (this.isMobile()) seccls = 'order_section';
|
|
4386
|
-
return (0,preact_module.h)(preact_module/* Fragment */.
|
|
4386
|
+
return (0,preact_module.h)(preact_module/* Fragment */.FK, null, (0,preact_module.h)("div", {
|
|
4387
4387
|
class: "order_section__line"
|
|
4388
4388
|
}), (0,preact_module.h)("div", {
|
|
4389
4389
|
class: seccls
|
|
@@ -4410,7 +4410,7 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4410
4410
|
}, "S\u1ED1 t\xE0i kho\u1EA3n: ", pm.bank_number));
|
|
4411
4411
|
}
|
|
4412
4412
|
if (!$body) return null;
|
|
4413
|
-
return (0,preact_module.h)(preact_module/* Fragment */.
|
|
4413
|
+
return (0,preact_module.h)(preact_module/* Fragment */.FK, null, (0,preact_module.h)("div", {
|
|
4414
4414
|
class: "order_label"
|
|
4415
4415
|
}, this.props.t('payment')), $body);
|
|
4416
4416
|
}
|
|
@@ -4422,15 +4422,15 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4422
4422
|
let user = this.props.store.matchUser();
|
|
4423
4423
|
if (editmode) {
|
|
4424
4424
|
let addresses = this.props.store.matchShippingAddresses();
|
|
4425
|
-
let provinces = util/* default */.
|
|
4425
|
+
let provinces = util/* default */.A.map(this.state.provinces, province => ({
|
|
4426
4426
|
id: province.id,
|
|
4427
4427
|
name: province.province
|
|
4428
4428
|
}));
|
|
4429
|
-
let districts = util/* default */.
|
|
4429
|
+
let districts = util/* default */.A.map(this.state.districts, district => ({
|
|
4430
4430
|
id: district.id,
|
|
4431
4431
|
name: district.district
|
|
4432
4432
|
}));
|
|
4433
|
-
let wards = util/* default */.
|
|
4433
|
+
let wards = util/* default */.A.map(this.state.wards, ward => ({
|
|
4434
4434
|
id: ward.id,
|
|
4435
4435
|
name: ward.ward
|
|
4436
4436
|
}));
|
|
@@ -4439,11 +4439,11 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4439
4439
|
let ship_icon_active = false;
|
|
4440
4440
|
if (this.state.shipping === 'ship') {
|
|
4441
4441
|
ship_icon_active = true;
|
|
4442
|
-
let $preaddrs = util/* default */.
|
|
4442
|
+
let $preaddrs = util/* default */.A.map(addresses, addr => {
|
|
4443
4443
|
let fulladdr = [addr.street, addr.ward, addr.district, addr.region, addr.country].filter(a => a).join(', ');
|
|
4444
4444
|
let $phone = null;
|
|
4445
4445
|
if (addr.phone) {
|
|
4446
|
-
$phone = (0,preact_module.h)(preact_module/* Fragment */.
|
|
4446
|
+
$phone = (0,preact_module.h)(preact_module/* Fragment */.FK, null, "\xA0\xB7\xA0", this.props.t('phn'), " ", addr.phone);
|
|
4447
4447
|
}
|
|
4448
4448
|
return (0,preact_module.h)("div", {
|
|
4449
4449
|
style: "margin-bottom: 15px !important"
|
|
@@ -4571,7 +4571,7 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4571
4571
|
style: "flex: 1 !important; margin-left: 7px !important;"
|
|
4572
4572
|
})));
|
|
4573
4573
|
cls += ' ship_card__active';
|
|
4574
|
-
if (util/* default */.
|
|
4574
|
+
if (util/* default */.A.size(addresses) == 0) {
|
|
4575
4575
|
$body = (0,preact_module.h)("div", null, (0,preact_module.h)("div", {
|
|
4576
4576
|
class: 'mt-3 mb-2 '
|
|
4577
4577
|
}, this.props.t('input_shipping_info')), $new);
|
|
@@ -4623,7 +4623,7 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4623
4623
|
}
|
|
4624
4624
|
let seccls = 'card_section';
|
|
4625
4625
|
if (this.isMobile()) seccls = 'order_section';
|
|
4626
|
-
return (0,preact_module.h)(preact_module/* Fragment */.
|
|
4626
|
+
return (0,preact_module.h)(preact_module/* Fragment */.FK, null, (0,preact_module.h)("div", {
|
|
4627
4627
|
class: "order_section__line"
|
|
4628
4628
|
}), (0,preact_module.h)("div", {
|
|
4629
4629
|
class: seccls
|
|
@@ -4649,13 +4649,13 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4649
4649
|
class: "ml-2"
|
|
4650
4650
|
}, "Giao h\xE0ng cho t\xF4i"))), $body));
|
|
4651
4651
|
}
|
|
4652
|
-
let addr = util/* default */.
|
|
4652
|
+
let addr = util/* default */.A.get(order, 'shipping.address') || {};
|
|
4653
4653
|
let fulladdr = [addr.address, addr.ward, addr.district, addr.region, addr.country].filter(a => a).join(', ');
|
|
4654
4654
|
let $phone = null;
|
|
4655
4655
|
if (addr.phone) $phone = (0,preact_module.h)("div", {
|
|
4656
4656
|
class: "mt-1 muted"
|
|
4657
4657
|
}, this.props.t('phn'), ":\xA0", addr.phone);
|
|
4658
|
-
if (util/* default */.
|
|
4658
|
+
if (util/* default */.A.get(order, 'shipping.pickup_at_shop')) {
|
|
4659
4659
|
fulladdr = 'Nhận hàng tại cửa hàng';
|
|
4660
4660
|
}
|
|
4661
4661
|
let $addr = fulladdr ? (0,preact_module.h)("div", null, fulladdr) : (0,preact_module.h)("i", {
|
|
@@ -4674,28 +4674,28 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4674
4674
|
if (order.deposit > 0) {
|
|
4675
4675
|
$deposit = (0,preact_module.h)("span", {
|
|
4676
4676
|
class: "muted"
|
|
4677
|
-
}, "(c\u1ECDc ", util/* default */.
|
|
4677
|
+
}, "(c\u1ECDc ", util/* default */.A.formatCurrency(order.deposit), ")");
|
|
4678
4678
|
}
|
|
4679
4679
|
let $discount = null;
|
|
4680
4680
|
if (order.total_discount > 0) {
|
|
4681
4681
|
$discount = (0,preact_module.h)("div", {
|
|
4682
4682
|
class: "order_summary_line"
|
|
4683
|
-
}, (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 */.A.formatCurrency(order.total_discount)));
|
|
4684
4684
|
}
|
|
4685
4685
|
let $pay = null;
|
|
4686
4686
|
if ($deposit || order.payment_made) {
|
|
4687
|
-
$pay = (0,preact_module.h)(preact_module/* Fragment */.
|
|
4687
|
+
$pay = (0,preact_module.h)(preact_module/* Fragment */.FK, null, (0,preact_module.h)("div", {
|
|
4688
4688
|
class: "order_summary_line"
|
|
4689
|
-
}, (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 */.A.formatCurrency(order.payment_made))), (0,preact_module.h)("div", {
|
|
4690
4690
|
class: "order_summary_line"
|
|
4691
|
-
}, (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 */.A.formatCurrency((order.total || 0) - (order.payment_made || 0)))));
|
|
4692
4692
|
}
|
|
4693
4693
|
let $tax = (0,preact_module.h)("div", {
|
|
4694
4694
|
class: "order_summary_line"
|
|
4695
|
-
}, (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 */.A.formatCurrency(order.total_tax)));
|
|
4696
4696
|
let $ship = (0,preact_module.h)("div", {
|
|
4697
4697
|
class: "order_summary_line"
|
|
4698
|
-
}, (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 */.A.get(order, 'shipping.fee', 0), " d"));
|
|
4699
4699
|
let editmode = false;
|
|
4700
4700
|
if (!order.status || order.status == 'open') {
|
|
4701
4701
|
editmode = !order.user_confirmation;
|
|
@@ -4708,12 +4708,12 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4708
4708
|
class: "muted"
|
|
4709
4709
|
}, (0,preact_module.h)("img", {
|
|
4710
4710
|
class: "order_ship_icon",
|
|
4711
|
-
src: __webpack_require__(
|
|
4711
|
+
src: __webpack_require__(7324)
|
|
4712
4712
|
}), "\xA0 Ch\u01B0a bao g\u1ED3m thu\u1EBF v\xE0 ph\xED v\u1EADn chuy\u1EC3n");
|
|
4713
4713
|
}
|
|
4714
4714
|
let seccls = '';
|
|
4715
4715
|
if (this.isMobile()) seccls = 'order_section';
|
|
4716
|
-
return (0,preact_module.h)(preact_module/* Fragment */.
|
|
4716
|
+
return (0,preact_module.h)(preact_module/* Fragment */.FK, null, (0,preact_module.h)("div", {
|
|
4717
4717
|
class: "order_section__line"
|
|
4718
4718
|
}), (0,preact_module.h)("div", {
|
|
4719
4719
|
class: seccls
|
|
@@ -4721,12 +4721,12 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4721
4721
|
class: "order_label"
|
|
4722
4722
|
}, "T\xF3m t\u1EAFt"), (0,preact_module.h)("div", {
|
|
4723
4723
|
class: "order_summary_line"
|
|
4724
|
-
}, (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 */.A.formatCurrency(order.subtotal))), $tax, $discount, $ship, $note, (0,preact_module.h)("div", {
|
|
4725
4725
|
class: "order_summary_line",
|
|
4726
4726
|
style: "margin-top: 10px !important; padding-top: 15px !important; border-top: 1px solid #eee !important"
|
|
4727
4727
|
}, (0,preact_module.h)("div", null, "B\u1EA1n ph\u1EA3i tr\u1EA3"), (0,preact_module.h)("div", {
|
|
4728
4728
|
class: "order__total"
|
|
4729
|
-
}, util/* default */.
|
|
4729
|
+
}, util/* default */.A.formatCurrency(order.total))), $pay));
|
|
4730
4730
|
}
|
|
4731
4731
|
renderStatusBadge(order) {
|
|
4732
4732
|
let status = order.status || 'open';
|
|
@@ -4737,9 +4737,9 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4737
4737
|
}
|
|
4738
4738
|
renderShippingInfo(order) {
|
|
4739
4739
|
if (order.status != 'open' || order.user_confirmation) {}
|
|
4740
|
-
let shipping_provider = util/* default */.
|
|
4740
|
+
let shipping_provider = util/* default */.A.get(order, 'shipping.shipping_provider');
|
|
4741
4741
|
if (!shipping_provider) return null;
|
|
4742
|
-
let shipping_code = util/* default */.
|
|
4742
|
+
let shipping_code = util/* default */.A.get(order, 'shipping.shipping_code');
|
|
4743
4743
|
let $tracking_code = null;
|
|
4744
4744
|
if (shipping_code) $tracking_code = (0,preact_module.h)("div", {
|
|
4745
4745
|
class: "muted",
|
|
@@ -4750,7 +4750,7 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4750
4750
|
href: 'https://giaohangtietkiem.vn/tra-cuu-van-don/' + shipping_code
|
|
4751
4751
|
}, shipping_code, "\xA0", (0,preact_module.h)("img", {
|
|
4752
4752
|
class: "order_tracking_link_icon",
|
|
4753
|
-
src: __webpack_require__(
|
|
4753
|
+
src: __webpack_require__(3266)
|
|
4754
4754
|
})));
|
|
4755
4755
|
if (shipping_provider == 'ghtk') {
|
|
4756
4756
|
return (0,preact_module.h)("div", {
|
|
@@ -4767,9 +4767,9 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4767
4767
|
return null;
|
|
4768
4768
|
}
|
|
4769
4769
|
renderDesktopShippingInfo(order) {
|
|
4770
|
-
let shipping_provider = util/* default */.
|
|
4770
|
+
let shipping_provider = util/* default */.A.get(order, 'shipping.shipping_provider');
|
|
4771
4771
|
if (!shipping_provider) return null;
|
|
4772
|
-
let shipping_code = util/* default */.
|
|
4772
|
+
let shipping_code = util/* default */.A.get(order, 'shipping.shipping_code');
|
|
4773
4773
|
let $tracking_code = null;
|
|
4774
4774
|
if (shipping_code) $tracking_code = (0,preact_module.h)("div", {
|
|
4775
4775
|
class: "muted",
|
|
@@ -4780,10 +4780,10 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4780
4780
|
href: 'https://giaohangtietkiem.vn/tra-cuu-van-don/' + shipping_code
|
|
4781
4781
|
}, shipping_code, "\xA0", (0,preact_module.h)("img", {
|
|
4782
4782
|
class: "order_tracking_link_icon",
|
|
4783
|
-
src: __webpack_require__(
|
|
4783
|
+
src: __webpack_require__(3266)
|
|
4784
4784
|
})));
|
|
4785
4785
|
if (shipping_provider == 'ghtk') {
|
|
4786
|
-
return (0,preact_module.h)(preact_module/* Fragment */.
|
|
4786
|
+
return (0,preact_module.h)(preact_module/* Fragment */.FK, null, (0,preact_module.h)("div", {
|
|
4787
4787
|
class: "order_label"
|
|
4788
4788
|
}, "\u0110\u01A1n v\u1ECB v\u1EADn chuy\u1EC3n"), (0,preact_module.h)("div", {
|
|
4789
4789
|
class: "d-flex align-items-center"
|
|
@@ -4796,7 +4796,7 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4796
4796
|
}
|
|
4797
4797
|
renderProducts(order) {
|
|
4798
4798
|
let $products = null;
|
|
4799
|
-
$products = util/* default */.
|
|
4799
|
+
$products = util/* default */.A.map(order.items, item => {
|
|
4800
4800
|
if (!item || !item.product) return null;
|
|
4801
4801
|
let product = item.product;
|
|
4802
4802
|
return (0,preact_module.h)("div", {
|
|
@@ -4804,7 +4804,7 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4804
4804
|
}, (0,preact_module.h)("img", {
|
|
4805
4805
|
class: "order_attachment__product_img",
|
|
4806
4806
|
alt: '' + product.id,
|
|
4807
|
-
src: util/* default */.
|
|
4807
|
+
src: util/* default */.A.get(product, 'images.0') || __webpack_require__(2876)
|
|
4808
4808
|
}), (0,preact_module.h)("div", {
|
|
4809
4809
|
style: "overflow: hidden !important;"
|
|
4810
4810
|
}, (0,preact_module.h)("div", {
|
|
@@ -4813,7 +4813,7 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4813
4813
|
class: "order_attachment__product_desc"
|
|
4814
4814
|
}, product.description || product.long_description), (0,preact_module.h)("div", {
|
|
4815
4815
|
class: "order_attachment__product_desc"
|
|
4816
|
-
}, this.props.t('qty'), " ", item.quantity, "\xA0\xB7\xA0", util/* default */.
|
|
4816
|
+
}, this.props.t('qty'), " ", item.quantity, "\xA0\xB7\xA0", util/* default */.A.formatCurrency(product.price))));
|
|
4817
4817
|
});
|
|
4818
4818
|
if (!this.isMobile()) return (0,preact_module.h)("div", null, (0,preact_module.h)("div", {
|
|
4819
4819
|
class: "order_label"
|
|
@@ -4831,7 +4831,7 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4831
4831
|
editmode = !order.user_confirmation;
|
|
4832
4832
|
}
|
|
4833
4833
|
if (editmode) {
|
|
4834
|
-
$products = util/* default */.
|
|
4834
|
+
$products = util/* default */.A.map(order.items, item => {
|
|
4835
4835
|
if (!item || !item.product) return null;
|
|
4836
4836
|
let product = item.product;
|
|
4837
4837
|
return (0,preact_module.h)("div", {
|
|
@@ -4839,7 +4839,7 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4839
4839
|
}, (0,preact_module.h)("img", {
|
|
4840
4840
|
class: "order_attachment__product_img",
|
|
4841
4841
|
alt: '' + product.id,
|
|
4842
|
-
src: util/* default */.
|
|
4842
|
+
src: util/* default */.A.get(product, 'images.0') || __webpack_require__(2876)
|
|
4843
4843
|
}), (0,preact_module.h)("div", {
|
|
4844
4844
|
style: "overflow: hidden !important; flex: 1 !important"
|
|
4845
4845
|
}, (0,preact_module.h)("div", {
|
|
@@ -4848,7 +4848,7 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4848
4848
|
class: "order_attachment__product_desc"
|
|
4849
4849
|
}, product.description || product.long_description), (0,preact_module.h)("div", {
|
|
4850
4850
|
class: "order_attachment__product_desc"
|
|
4851
|
-
}, util/* default */.
|
|
4851
|
+
}, util/* default */.A.formatCurrency(product.price))), (0,preact_module.h)("input", {
|
|
4852
4852
|
class: "form-control",
|
|
4853
4853
|
style: "text-align: center !important; font-weight: 400 !important; width: 50px !important",
|
|
4854
4854
|
value: item.quantity,
|
|
@@ -4856,10 +4856,10 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4856
4856
|
type: "text"
|
|
4857
4857
|
}), (0,preact_module.h)("div", {
|
|
4858
4858
|
style: "width: 80px !important; text-align: right !important; "
|
|
4859
|
-
}, (0,preact_module.h)("b", null, util/* default */.
|
|
4859
|
+
}, (0,preact_module.h)("b", null, util/* default */.A.formatCurrency(item.quantity * product.price))));
|
|
4860
4860
|
});
|
|
4861
4861
|
} else {
|
|
4862
|
-
$products = util/* default */.
|
|
4862
|
+
$products = util/* default */.A.map(order.items, item => {
|
|
4863
4863
|
if (!item || !item.product) return null;
|
|
4864
4864
|
let product = item.product;
|
|
4865
4865
|
return (0,preact_module.h)("div", {
|
|
@@ -4867,7 +4867,7 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4867
4867
|
}, (0,preact_module.h)("img", {
|
|
4868
4868
|
class: "order_attachment__product_img",
|
|
4869
4869
|
alt: '' + product.id,
|
|
4870
|
-
src: util/* default */.
|
|
4870
|
+
src: util/* default */.A.get(product, 'images.0') || __webpack_require__(2876)
|
|
4871
4871
|
}), (0,preact_module.h)("div", {
|
|
4872
4872
|
style: "overflow: hidden !important; flex: 1 !important"
|
|
4873
4873
|
}, (0,preact_module.h)("div", {
|
|
@@ -4876,11 +4876,11 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4876
4876
|
class: "order_attachment__product_desc"
|
|
4877
4877
|
}, product.description || product.long_description), (0,preact_module.h)("div", {
|
|
4878
4878
|
class: "order_attachment__product_desc"
|
|
4879
|
-
}, util/* default */.
|
|
4879
|
+
}, util/* default */.A.formatCurrency(product.price))), (0,preact_module.h)("div", {
|
|
4880
4880
|
style: "text-align: center !important; font-weight: 400 !important; width: 50px !important"
|
|
4881
4881
|
}, item.quantity), (0,preact_module.h)("div", {
|
|
4882
4882
|
style: "width: 80px !important; text-align: right !important; "
|
|
4883
|
-
}, (0,preact_module.h)("b", null, util/* default */.
|
|
4883
|
+
}, (0,preact_module.h)("b", null, util/* default */.A.formatCurrency(item.total))));
|
|
4884
4884
|
});
|
|
4885
4885
|
}
|
|
4886
4886
|
return (0,preact_module.h)("div", {
|
|
@@ -4988,7 +4988,7 @@ class order_Order extends common/* Com */.Sq {
|
|
|
4988
4988
|
}
|
|
4989
4989
|
renderDesktop(order) {
|
|
4990
4990
|
let acc = this.props.store.matchAccount();
|
|
4991
|
-
var uri = acc.logo_url || __webpack_require__(
|
|
4991
|
+
var uri = acc.logo_url || __webpack_require__(3582);
|
|
4992
4992
|
return (0,preact_module.h)("div", {
|
|
4993
4993
|
class: "desktop order"
|
|
4994
4994
|
}, (0,preact_module.h)("div", {
|
|
@@ -5034,7 +5034,7 @@ class order_Order extends common/* Com */.Sq {
|
|
|
5034
5034
|
class: "order_error"
|
|
5035
5035
|
}, (0,preact_module.h)("img", {
|
|
5036
5036
|
class: "mt-3",
|
|
5037
|
-
src: __webpack_require__(
|
|
5037
|
+
src: __webpack_require__(6907)
|
|
5038
5038
|
}), (0,preact_module.h)("div", {
|
|
5039
5039
|
class: "mt-3"
|
|
5040
5040
|
}, this.props.t('order_load_error')));
|
|
@@ -5046,11 +5046,11 @@ class order_Order extends common/* Com */.Sq {
|
|
|
5046
5046
|
let ShippingProvider = {
|
|
5047
5047
|
ghtk: {
|
|
5048
5048
|
name: 'Giao hàng tiết kiệm',
|
|
5049
|
-
logo: __webpack_require__(
|
|
5049
|
+
logo: __webpack_require__(7362)
|
|
5050
5050
|
},
|
|
5051
5051
|
ghn: {
|
|
5052
5052
|
name: 'Giao hàng nhanh',
|
|
5053
|
-
logo: __webpack_require__(
|
|
5053
|
+
logo: __webpack_require__(1113)
|
|
5054
5054
|
}
|
|
5055
5055
|
};
|
|
5056
5056
|
;// CONCATENATED MODULE: ./src/chatbox/Order.js
|
|
@@ -5063,11 +5063,11 @@ function Order_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var
|
|
|
5063
5063
|
const Order_POPUP_MAX_HEIGHT = 400;
|
|
5064
5064
|
const Order_POPUP_HARD_MAX_HEIGHT = 500;
|
|
5065
5065
|
const Order_POPUP_MIN_HEIGHT = 0;
|
|
5066
|
-
let Order_defaultAvatar = __webpack_require__(
|
|
5066
|
+
let Order_defaultAvatar = __webpack_require__(2538);
|
|
5067
5067
|
|
|
5068
5068
|
|
|
5069
5069
|
|
|
5070
|
-
class Order extends common/* Com */.
|
|
5070
|
+
class Order extends common/* Com */.Mw {
|
|
5071
5071
|
constructor(props) {
|
|
5072
5072
|
super(props);
|
|
5073
5073
|
Order_defineProperty(this, "state", {
|
|
@@ -5098,7 +5098,7 @@ class Order extends common/* Com */.Sq {
|
|
|
5098
5098
|
});
|
|
5099
5099
|
});
|
|
5100
5100
|
Order_defineProperty(this, "close", async () => {
|
|
5101
|
-
await util/* default */.
|
|
5101
|
+
await util/* default */.A.sleep(100);
|
|
5102
5102
|
if (this.state.response === 'confirmed') {
|
|
5103
5103
|
this.props.store.sendConvoEvent(this.props.cid, 'message_sent', {
|
|
5104
5104
|
message: {
|
|
@@ -5154,8 +5154,8 @@ class Order extends common/* Com */.Sq {
|
|
|
5154
5154
|
});
|
|
5155
5155
|
this.props.onClose();
|
|
5156
5156
|
});
|
|
5157
|
-
this.refRating = (0,preact_module/* createRef */.
|
|
5158
|
-
this.refHandle = (0,preact_module/* createRef */.
|
|
5157
|
+
this.refRating = (0,preact_module/* createRef */._3)();
|
|
5158
|
+
this.refHandle = (0,preact_module/* createRef */._3)();
|
|
5159
5159
|
}
|
|
5160
5160
|
componentDidMount() {
|
|
5161
5161
|
this.mouseUp = e => this.onMouseUp(e);
|
|
@@ -5199,7 +5199,7 @@ class Order extends common/* Com */.Sq {
|
|
|
5199
5199
|
render() {
|
|
5200
5200
|
if (this._show != this.props.show) {
|
|
5201
5201
|
this._show = this.props.show;
|
|
5202
|
-
util/* default */.
|
|
5202
|
+
util/* default */.A.setTimeout(() => {
|
|
5203
5203
|
if (!this._show) this.close();else this.open();
|
|
5204
5204
|
});
|
|
5205
5205
|
}
|
|
@@ -5307,9 +5307,9 @@ function Widget_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; va
|
|
|
5307
5307
|
|
|
5308
5308
|
|
|
5309
5309
|
|
|
5310
|
-
var send = __webpack_require__(
|
|
5311
|
-
var Widget_checkedimg = __webpack_require__(
|
|
5312
|
-
var empty = __webpack_require__(
|
|
5310
|
+
var send = __webpack_require__(8506);
|
|
5311
|
+
var Widget_checkedimg = __webpack_require__(9150);
|
|
5312
|
+
var empty = __webpack_require__(9419);
|
|
5313
5313
|
|
|
5314
5314
|
|
|
5315
5315
|
|
|
@@ -5321,12 +5321,12 @@ const Widget_defaultAvatar = 'https://file-subiz.com/fiqoahedjbgwclpouoml-avatar
|
|
|
5321
5321
|
|
|
5322
5322
|
|
|
5323
5323
|
|
|
5324
|
-
class Widget extends common/* Com */.
|
|
5324
|
+
class Widget extends common/* Com */.Mw {
|
|
5325
5325
|
constructor(props) {
|
|
5326
5326
|
super(props);
|
|
5327
|
-
Widget_defineProperty(this, "msgInput", (0,preact_module/* createRef */.
|
|
5327
|
+
Widget_defineProperty(this, "msgInput", (0,preact_module/* createRef */._3)());
|
|
5328
5328
|
Widget_defineProperty(this, "sendMessage", async message => {
|
|
5329
|
-
let hasPostback = util/* default */.
|
|
5329
|
+
let hasPostback = util/* default */.A.find(message.attachments, att => att.type === 'postback');
|
|
5330
5330
|
if (this.isFormRequired() && hasPostback) {
|
|
5331
5331
|
this.onStartConvoClick();
|
|
5332
5332
|
this.fillQuickReplyToQuestion(message);
|
|
@@ -5405,7 +5405,7 @@ class Widget extends common/* Com */.Sq {
|
|
|
5405
5405
|
clickedJoin: false,
|
|
5406
5406
|
quickReplyMessage: {}
|
|
5407
5407
|
});
|
|
5408
|
-
util/* default */.
|
|
5408
|
+
util/* default */.A.setTimeout(() => {
|
|
5409
5409
|
this.events && this.events.focus();
|
|
5410
5410
|
if (!this.props.store.isMobile()) this.focusInput();
|
|
5411
5411
|
}, 100);
|
|
@@ -5416,10 +5416,10 @@ class Widget extends common/* Com */.Sq {
|
|
|
5416
5416
|
let form;
|
|
5417
5417
|
let accountSetting = this.props.plugin.chatbox || {};
|
|
5418
5418
|
let acc = this.props.store.matchAccount() || {};
|
|
5419
|
-
if (util/* default */.
|
|
5420
|
-
let offlineEnabled = util/* default */.
|
|
5419
|
+
if (util/* default */.A.get(accountSetting, 'prechat_form.enabled')) form = accountSetting.prechat_form;
|
|
5420
|
+
let offlineEnabled = util/* default */.A.get(accountSetting, 'offline_form.enabled');
|
|
5421
5421
|
if (this.isOffline(acc, accountSetting) && offlineEnabled) form = accountSetting.offline_form;
|
|
5422
|
-
if (!this.hasSentMessage(this.props.cid) && form && (util/* default */.
|
|
5422
|
+
if (!this.hasSentMessage(this.props.cid) && form && (util/* default */.A.size(form.groups) || form.group_required)) return true;
|
|
5423
5423
|
let formRequired = this.isFormRequired();
|
|
5424
5424
|
return formRequired && !this.props.cid || formRequired && this.props.cid && this.state.clickedJoin;
|
|
5425
5425
|
}
|
|
@@ -5429,8 +5429,8 @@ class Widget extends common/* Com */.Sq {
|
|
|
5429
5429
|
let accountSetting = this.props.plugin.chatbox || {};
|
|
5430
5430
|
let acc = this.props.store.matchAccount() || {};
|
|
5431
5431
|
let submitLabel = this.props.t('prechat_form_btn');
|
|
5432
|
-
if (util/* default */.
|
|
5433
|
-
let offlineEnabled = util/* default */.
|
|
5432
|
+
if (util/* default */.A.get(accountSetting, 'prechat_form.enabled')) form = accountSetting.prechat_form;
|
|
5433
|
+
let offlineEnabled = util/* default */.A.get(accountSetting, 'offline_form.enabled');
|
|
5434
5434
|
if (this.isOffline(acc, accountSetting) && offlineEnabled) {
|
|
5435
5435
|
form = accountSetting.offline_form;
|
|
5436
5436
|
submitLabel = this.props.t('offline_form_btn');
|
|
@@ -5447,10 +5447,10 @@ class Widget extends common/* Com */.Sq {
|
|
|
5447
5447
|
}
|
|
5448
5448
|
let $body = null;
|
|
5449
5449
|
if (this.props.view === 'list') $body = this.renderConvoList();else if (showform) $body = this.renderForm(form, submitLabel);else $body = this.renderChat();
|
|
5450
|
-
let position = util/* default */.
|
|
5451
|
-
if (this.props.store.isMobile()) position = util/* default */.
|
|
5450
|
+
let position = util/* default */.A.get(accountSetting, 'desktop_button.position') || 'right';
|
|
5451
|
+
if (this.props.store.isMobile()) position = util/* default */.A.get(accountSetting, 'mobile_button.position', position);
|
|
5452
5452
|
let cls = 'widget-container widget-container--' + position;
|
|
5453
|
-
if (!this.props.store.isMobile() && util/* default */.
|
|
5453
|
+
if (!this.props.store.isMobile() && util/* default */.A.get(accountSetting, 'window_mode') === 'full') cls += ' widget-container--full';
|
|
5454
5454
|
if (!this.props.isShow) cls += ' widget-container--hide';
|
|
5455
5455
|
return (0,preact_module.h)("div", {
|
|
5456
5456
|
class: cls
|
|
@@ -5468,42 +5468,42 @@ class Widget extends common/* Com */.Sq {
|
|
|
5468
5468
|
}
|
|
5469
5469
|
async submitPrechatForm(form) {
|
|
5470
5470
|
var hasError = false;
|
|
5471
|
-
util/* default */.
|
|
5472
|
-
if (field.is_required && (field.value === undefined || field.value === '' || util/* default */.
|
|
5471
|
+
util/* default */.A.map(this.state.formData, (field, key) => {
|
|
5472
|
+
if (field.is_required && (field.value === undefined || field.value === '' || util/* default */.A.size(field.value) === 0 && Array.isArray(field.value))) {
|
|
5473
5473
|
field.error = this.props.t('error_empty');
|
|
5474
5474
|
hasError = true;
|
|
5475
5475
|
} else field.error = '';
|
|
5476
|
-
if (key.substr(5) === 'emails' && !util/* default */.
|
|
5476
|
+
if (key.substr(5) === 'emails' && !util/* default */.A.isEmail(field.value) && field.is_required) {
|
|
5477
5477
|
field.error = this.props.t('error_email_invalid');
|
|
5478
5478
|
hasError = true;
|
|
5479
5479
|
}
|
|
5480
|
-
if (key.substr(5) === 'phones' && !util/* default */.
|
|
5480
|
+
if (key.substr(5) === 'phones' && !util/* default */.A.isPhone(field.value) && field.is_required) {
|
|
5481
5481
|
field.error = this.props.t('error_phone_invalid');
|
|
5482
5482
|
hasError = true;
|
|
5483
5483
|
}
|
|
5484
5484
|
});
|
|
5485
5485
|
if (hasError) return this.forceUpdate();
|
|
5486
|
-
let data = util/* default */.
|
|
5487
|
-
let user = util/* default */.
|
|
5486
|
+
let data = util/* default */.A.cloneDeep(this.state.formData);
|
|
5487
|
+
let user = util/* default */.A.cloneDeep(this.props.store.matchUser());
|
|
5488
5488
|
let is_lead = false;
|
|
5489
|
-
util/* default */.
|
|
5489
|
+
util/* default */.A.map(data, (field, key) => {
|
|
5490
5490
|
if (!key.startsWith('attr:')) return;
|
|
5491
5491
|
var attr = {
|
|
5492
5492
|
key: key.substr(5)
|
|
5493
5493
|
};
|
|
5494
5494
|
is_lead = is_lead || key == 'emails' || key == 'phones';
|
|
5495
5495
|
if (field.type === 'number') attr.number = parseInt(field.value);
|
|
5496
|
-
if (field.type === 'datetime') attr.datetime = new util/* default */.
|
|
5496
|
+
if (field.type === 'datetime') attr.datetime = new util/* default */.A.Date(field.value).toISOString();
|
|
5497
5497
|
if (field.type === 'list') attr.text = field.value;
|
|
5498
5498
|
if (field.type === 'text' || field.type === 'boolean') attr[field.type] = field.value;
|
|
5499
|
-
util/* default */.
|
|
5499
|
+
util/* default */.A.setUserAttr(user, attr);
|
|
5500
5500
|
});
|
|
5501
|
-
if (is_lead) util/* default */.
|
|
5501
|
+
if (is_lead) util/* default */.A.setUserAttr(user, {
|
|
5502
5502
|
key: 'lead_source',
|
|
5503
5503
|
text: 'widget'
|
|
5504
5504
|
});
|
|
5505
|
-
let firstmsg = util/* default */.
|
|
5506
|
-
let groupid = util/* default */.
|
|
5505
|
+
let firstmsg = util/* default */.A.get(data, 'question.value');
|
|
5506
|
+
let groupid = util/* default */.A.get(data, 'group.value', '');
|
|
5507
5507
|
if (this.props.cid) {
|
|
5508
5508
|
this.props.store.setUser(user);
|
|
5509
5509
|
this.setState({
|
|
@@ -5515,7 +5515,7 @@ class Widget extends common/* Com */.Sq {
|
|
|
5515
5515
|
format: 'plaintext',
|
|
5516
5516
|
fields: [{
|
|
5517
5517
|
key: 'to_agent_group',
|
|
5518
|
-
value: util/* default */.
|
|
5518
|
+
value: util/* default */.A.stringify(groupid)
|
|
5519
5519
|
}],
|
|
5520
5520
|
attachments: this.state.quickReplyMessage.attachments
|
|
5521
5521
|
}
|
|
@@ -5575,7 +5575,7 @@ class Widget extends common/* Com */.Sq {
|
|
|
5575
5575
|
formData['question'] = {
|
|
5576
5576
|
key: 'question',
|
|
5577
5577
|
is_required: true,
|
|
5578
|
-
label: this.props.t.i18n(util/* default */.
|
|
5578
|
+
label: this.props.t.i18n(util/* default */.A.get(form, `i18n_question_label`, {})) || form.question_label,
|
|
5579
5579
|
type: 'text',
|
|
5580
5580
|
value: this.state.quickReplyMessage.text
|
|
5581
5581
|
};
|
|
@@ -5586,8 +5586,8 @@ class Widget extends common/* Com */.Sq {
|
|
|
5586
5586
|
}
|
|
5587
5587
|
onBooleanChange(key, e) {
|
|
5588
5588
|
this.wasFormInputed = true;
|
|
5589
|
-
let formData = util/* default */.
|
|
5590
|
-
let field = util/* default */.
|
|
5589
|
+
let formData = util/* default */.A.cloneDeep(this.state.formData);
|
|
5590
|
+
let field = util/* default */.A.find(formData, (_, fkkey) => fkkey === key);
|
|
5591
5591
|
if (!field) return;
|
|
5592
5592
|
field.value = e.target.checked;
|
|
5593
5593
|
this.setState({
|
|
@@ -5596,8 +5596,8 @@ class Widget extends common/* Com */.Sq {
|
|
|
5596
5596
|
}
|
|
5597
5597
|
onInputChange(key, val) {
|
|
5598
5598
|
this.wasFormInputed = true;
|
|
5599
|
-
let formData = util/* default */.
|
|
5600
|
-
let field = util/* default */.
|
|
5599
|
+
let formData = util/* default */.A.cloneDeep(this.state.formData);
|
|
5600
|
+
let field = util/* default */.A.find(formData, (_, fkkey) => fkkey === key);
|
|
5601
5601
|
if (!field) return;
|
|
5602
5602
|
field.value = val;
|
|
5603
5603
|
this.setState({
|
|
@@ -5606,8 +5606,8 @@ class Widget extends common/* Com */.Sq {
|
|
|
5606
5606
|
}
|
|
5607
5607
|
onListAddItem(key, val) {
|
|
5608
5608
|
this.wasFormInputed = true;
|
|
5609
|
-
let formData = util/* default */.
|
|
5610
|
-
let field = util/* default */.
|
|
5609
|
+
let formData = util/* default */.A.cloneDeep(this.state.formData);
|
|
5610
|
+
let field = util/* default */.A.find(formData, (_, fkkey) => fkkey === key);
|
|
5611
5611
|
if (!field) return;
|
|
5612
5612
|
field.value = field.value || [];
|
|
5613
5613
|
field.value.push(val);
|
|
@@ -5617,8 +5617,8 @@ class Widget extends common/* Com */.Sq {
|
|
|
5617
5617
|
}
|
|
5618
5618
|
onListRemoveItem(key, index) {
|
|
5619
5619
|
this.wasFormInputed = true;
|
|
5620
|
-
let formData = util/* default */.
|
|
5621
|
-
let field = util/* default */.
|
|
5620
|
+
let formData = util/* default */.A.cloneDeep(this.state.formData);
|
|
5621
|
+
let field = util/* default */.A.find(formData, (_, fkkey) => fkkey === key);
|
|
5622
5622
|
if (!field) return;
|
|
5623
5623
|
field.value = field.value || [];
|
|
5624
5624
|
field.value.splice(index, 1);
|
|
@@ -5627,11 +5627,11 @@ class Widget extends common/* Com */.Sq {
|
|
|
5627
5627
|
});
|
|
5628
5628
|
}
|
|
5629
5629
|
renderCheckboxField(field) {
|
|
5630
|
-
let items = util/* default */.
|
|
5630
|
+
let items = util/* default */.A.get(field, 'def.items', []);
|
|
5631
5631
|
let values = [];
|
|
5632
5632
|
let value = field.value || '';
|
|
5633
5633
|
if (value) values = value.split(',');
|
|
5634
|
-
return (0,preact_module.h)("div", null, util/* default */.
|
|
5634
|
+
return (0,preact_module.h)("div", null, util/* default */.A.map(items, item => {
|
|
5635
5635
|
return (0,preact_module.h)("div", {
|
|
5636
5636
|
class: "checkbox"
|
|
5637
5637
|
}, (0,preact_module.h)("input", {
|
|
@@ -5649,14 +5649,14 @@ class Widget extends common/* Com */.Sq {
|
|
|
5649
5649
|
}
|
|
5650
5650
|
toggleCheckboxField(key, v) {
|
|
5651
5651
|
this.wasFormInputed = true;
|
|
5652
|
-
let formData = util/* default */.
|
|
5653
|
-
let field = util/* default */.
|
|
5652
|
+
let formData = util/* default */.A.cloneDeep(this.state.formData);
|
|
5653
|
+
let field = util/* default */.A.find(formData, (f, fkkey) => f.key === key);
|
|
5654
5654
|
if (!field) return;
|
|
5655
5655
|
let value = field.value || '';
|
|
5656
5656
|
let values = [];
|
|
5657
5657
|
if (value) values = value.split(',');
|
|
5658
5658
|
if (values.includes(v)) {
|
|
5659
|
-
values = util/* default */.
|
|
5659
|
+
values = util/* default */.A.filter(values, value => value !== v);
|
|
5660
5660
|
} else {
|
|
5661
5661
|
values.push(v);
|
|
5662
5662
|
}
|
|
@@ -5666,9 +5666,9 @@ class Widget extends common/* Com */.Sq {
|
|
|
5666
5666
|
});
|
|
5667
5667
|
}
|
|
5668
5668
|
renderRadioField(field) {
|
|
5669
|
-
let items = util/* default */.
|
|
5669
|
+
let items = util/* default */.A.get(field, 'def.items', []);
|
|
5670
5670
|
let value = field.value || '';
|
|
5671
|
-
return (0,preact_module.h)("div", null, util/* default */.
|
|
5671
|
+
return (0,preact_module.h)("div", null, util/* default */.A.map(items, item => {
|
|
5672
5672
|
return (0,preact_module.h)("div", {
|
|
5673
5673
|
class: "radio"
|
|
5674
5674
|
}, (0,preact_module.h)("input", {
|
|
@@ -5687,8 +5687,8 @@ class Widget extends common/* Com */.Sq {
|
|
|
5687
5687
|
}
|
|
5688
5688
|
toggleRadioField(key, v) {
|
|
5689
5689
|
this.wasFormInputed = true;
|
|
5690
|
-
let formData = util/* default */.
|
|
5691
|
-
let field = util/* default */.
|
|
5690
|
+
let formData = util/* default */.A.cloneDeep(this.state.formData);
|
|
5691
|
+
let field = util/* default */.A.find(formData, (f, fkkey) => f.key === key);
|
|
5692
5692
|
if (!field) return;
|
|
5693
5693
|
field.value = v;
|
|
5694
5694
|
this.setState({
|
|
@@ -5697,8 +5697,8 @@ class Widget extends common/* Com */.Sq {
|
|
|
5697
5697
|
}
|
|
5698
5698
|
selectDropdownField(key, v) {
|
|
5699
5699
|
this.wasFormInputed = true;
|
|
5700
|
-
let formData = util/* default */.
|
|
5701
|
-
let field = util/* default */.
|
|
5700
|
+
let formData = util/* default */.A.cloneDeep(this.state.formData);
|
|
5701
|
+
let field = util/* default */.A.find(formData, (f, fkkey) => f.key === key);
|
|
5702
5702
|
if (!field) return;
|
|
5703
5703
|
field.value = v;
|
|
5704
5704
|
this.setState({
|
|
@@ -5706,20 +5706,20 @@ class Widget extends common/* Com */.Sq {
|
|
|
5706
5706
|
});
|
|
5707
5707
|
}
|
|
5708
5708
|
renderDropdownField(field) {
|
|
5709
|
-
let items = util/* default */.
|
|
5709
|
+
let items = util/* default */.A.get(field, 'def.items', []);
|
|
5710
5710
|
return (0,preact_module.h)("select", {
|
|
5711
5711
|
class: "form-control",
|
|
5712
5712
|
value: field.value,
|
|
5713
5713
|
onChange: e => this.selectDropdownField(field.key, e.target.value)
|
|
5714
5714
|
}, (0,preact_module.h)("option", {
|
|
5715
5715
|
value: ""
|
|
5716
|
-
}, "-- ", this.props.t('no_select'), " --"), util/* default */.
|
|
5716
|
+
}, "-- ", this.props.t('no_select'), " --"), util/* default */.A.map(items, item => (0,preact_module.h)("option", {
|
|
5717
5717
|
value: item.value
|
|
5718
5718
|
}, this.props.t.i18n(item.i18n_label) || item.label || item.value)));
|
|
5719
5719
|
}
|
|
5720
5720
|
renderFields() {
|
|
5721
|
-
if (util/* default */.
|
|
5722
|
-
let $fields = util/* default */.
|
|
5721
|
+
if (util/* default */.A.size(this.state.formData) === 0) return null;
|
|
5722
|
+
let $fields = util/* default */.A.map(this.state.formData, (field, key) => {
|
|
5723
5723
|
if (this.state.quickReplyMessage.text && key === 'question') return null;
|
|
5724
5724
|
let $field = null;
|
|
5725
5725
|
var errclass = field.error ? 'input--error' : '';
|
|
@@ -5735,13 +5735,13 @@ class Widget extends common/* Com */.Sq {
|
|
|
5735
5735
|
row: "4",
|
|
5736
5736
|
class: "form-control"
|
|
5737
5737
|
});
|
|
5738
|
-
} else if (util/* default */.
|
|
5738
|
+
} else if (util/* default */.A.get(field, 'def.select') === 'checkbox') {
|
|
5739
5739
|
$field = this.renderCheckboxField(field);
|
|
5740
|
-
} else if (util/* default */.
|
|
5740
|
+
} else if (util/* default */.A.get(field, 'def.select') === 'radio') {
|
|
5741
5741
|
$field = this.renderRadioField(field);
|
|
5742
|
-
} else if (util/* default */.
|
|
5742
|
+
} else if (util/* default */.A.get(field, 'def.select') === 'dropdown') {
|
|
5743
5743
|
$field = this.renderDropdownField(field);
|
|
5744
|
-
} else if (util/* default */.
|
|
5744
|
+
} else if (util/* default */.A.get(field, 'def.multiple_line')) {
|
|
5745
5745
|
$field = (0,preact_module.h)("textarea", {
|
|
5746
5746
|
class: "form-control",
|
|
5747
5747
|
ref: ref => {
|
|
@@ -5788,7 +5788,7 @@ class Widget extends common/* Com */.Sq {
|
|
|
5788
5788
|
class: "checkbox--check"
|
|
5789
5789
|
}, (0,preact_module.h)("div", null)));
|
|
5790
5790
|
} else if (field.type === 'group') {
|
|
5791
|
-
$field = util/* default */.
|
|
5791
|
+
$field = util/* default */.A.map(field.list, item => (0,preact_module.h)("div", {
|
|
5792
5792
|
class: "radio"
|
|
5793
5793
|
}, (0,preact_module.h)("input", {
|
|
5794
5794
|
type: "radio",
|
|
@@ -5805,8 +5805,8 @@ class Widget extends common/* Com */.Sq {
|
|
|
5805
5805
|
}))));
|
|
5806
5806
|
} else if (field.type === 'list') {
|
|
5807
5807
|
let selected = this.state.formData[key].value || [];
|
|
5808
|
-
let items = util/* default */.
|
|
5809
|
-
return !util/* default */.
|
|
5808
|
+
let items = util/* default */.A.filter(util/* default */.A.get(field, 'list', []), item => {
|
|
5809
|
+
return !util/* default */.A.includes(selected, item);
|
|
5810
5810
|
});
|
|
5811
5811
|
$field = (0,preact_module.h)(ListField, {
|
|
5812
5812
|
selected: selected,
|
|
@@ -5854,8 +5854,8 @@ class Widget extends common/* Com */.Sq {
|
|
|
5854
5854
|
size: "16",
|
|
5855
5855
|
mode: "white"
|
|
5856
5856
|
}));
|
|
5857
|
-
let title = this.props.t.i18n(util/* default */.
|
|
5858
|
-
if (!title) title = util/* default */.
|
|
5857
|
+
let title = this.props.t.i18n(util/* default */.A.get(form, `i18n_title`, {}));
|
|
5858
|
+
if (!title) title = util/* default */.A.get(form, 'title', this.props.t('capture_lead_title'));
|
|
5859
5859
|
title = title.replace('↵', '');
|
|
5860
5860
|
return (0,preact_module.h)("div", {
|
|
5861
5861
|
class: "widget-body"
|
|
@@ -5886,15 +5886,15 @@ class Widget extends common/* Com */.Sq {
|
|
|
5886
5886
|
}
|
|
5887
5887
|
renderConvoList() {
|
|
5888
5888
|
let convoM = this.props.store.matchConvo('*');
|
|
5889
|
-
var convos = util/* default */.
|
|
5890
|
-
convos = util/* default */.
|
|
5891
|
-
convos = util/* default */.
|
|
5892
|
-
var $convos = util/* default */.
|
|
5893
|
-
let ags = util/* default */.
|
|
5889
|
+
var convos = util/* default */.A.map(convoM, convo => this.props.store.matchConvo(convo.id));
|
|
5890
|
+
convos = util/* default */.A.filter(convos, convo => !!convo);
|
|
5891
|
+
convos = util/* default */.A.orderByF(convos, convo => util/* default */.A.get(convo, 'last_message_sent.created', convo.actived), 'desc');
|
|
5892
|
+
var $convos = util/* default */.A.map(convos, convo => {
|
|
5893
|
+
let ags = util/* default */.A.filter(convo.members, m => {
|
|
5894
5894
|
return (m.type === 'agent' || m.type === 'bot') && m.membership === 'active';
|
|
5895
5895
|
});
|
|
5896
|
-
let agentids = util/* default */.
|
|
5897
|
-
agentids = agentids || util/* default */.
|
|
5896
|
+
let agentids = util/* default */.A.map(ags, m => m.id);
|
|
5897
|
+
agentids = agentids || util/* default */.A.agentsOfConvo(convo)[0];
|
|
5898
5898
|
return (0,preact_module.h)("div", {
|
|
5899
5899
|
class: "convo-list--item",
|
|
5900
5900
|
onClick: () => this.goToConvo(convo.id),
|
|
@@ -5911,7 +5911,7 @@ class Widget extends common/* Com */.Sq {
|
|
|
5911
5911
|
let $body = (0,preact_module.h)("div", {
|
|
5912
5912
|
class: "convo-list--list"
|
|
5913
5913
|
}, $convos);
|
|
5914
|
-
if (util/* default */.
|
|
5914
|
+
if (util/* default */.A.size(convos) === 0) {
|
|
5915
5915
|
$body = (0,preact_module.h)("div", {
|
|
5916
5916
|
class: "convo-list--list"
|
|
5917
5917
|
}, (0,preact_module.h)("div", {
|
|
@@ -5947,19 +5947,19 @@ class Widget extends common/* Com */.Sq {
|
|
|
5947
5947
|
if (this.props.store.isPreview) return;
|
|
5948
5948
|
var $input = this.msgInput.current;
|
|
5949
5949
|
if (!$input) return;
|
|
5950
|
-
util/* default */.
|
|
5951
|
-
util/* default */.
|
|
5950
|
+
util/* default */.A.setTimeout(() => $input && $input.blur());
|
|
5951
|
+
util/* default */.A.setTimeout(() => $input && $input.blur(), 300);
|
|
5952
5952
|
}
|
|
5953
5953
|
focusInput() {
|
|
5954
5954
|
if (this.props.store.isPreview) return;
|
|
5955
5955
|
if (this.shouldShowForm()) {
|
|
5956
5956
|
let firstemptykey = '';
|
|
5957
|
-
util/* default */.
|
|
5957
|
+
util/* default */.A.map(this.state.formData, (field, key) => {
|
|
5958
5958
|
if (field.type !== 'text') return;
|
|
5959
5959
|
if (firstemptykey) return;
|
|
5960
5960
|
if (!field.value) firstemptykey = key;
|
|
5961
5961
|
});
|
|
5962
|
-
util/* default */.
|
|
5962
|
+
util/* default */.A.setTimeout(() => {
|
|
5963
5963
|
var $input = this['form_' + Widget_encode(firstemptykey)];
|
|
5964
5964
|
if (!$input) return;
|
|
5965
5965
|
$input.focus();
|
|
@@ -5968,8 +5968,8 @@ class Widget extends common/* Com */.Sq {
|
|
|
5968
5968
|
}
|
|
5969
5969
|
var $input = this.msgInput.current;
|
|
5970
5970
|
if (!$input) return;
|
|
5971
|
-
util/* default */.
|
|
5972
|
-
util/* default */.
|
|
5971
|
+
util/* default */.A.setTimeout(() => $input.focus());
|
|
5972
|
+
util/* default */.A.setTimeout(() => $input.focus(), 300);
|
|
5973
5973
|
}
|
|
5974
5974
|
onRate(rating) {
|
|
5975
5975
|
if (!this.props.cid) return;
|
|
@@ -5983,7 +5983,7 @@ class Widget extends common/* Com */.Sq {
|
|
|
5983
5983
|
fillQuickReplyToQuestion(message) {
|
|
5984
5984
|
let formData = this.state.formData;
|
|
5985
5985
|
if (formData) {
|
|
5986
|
-
util/* default */.
|
|
5986
|
+
util/* default */.A.set(formData, 'question.value', message.text);
|
|
5987
5987
|
}
|
|
5988
5988
|
this.setState({
|
|
5989
5989
|
formData,
|
|
@@ -6076,8 +6076,8 @@ class Widget extends common/* Com */.Sq {
|
|
|
6076
6076
|
let form;
|
|
6077
6077
|
let accountSetting = this.props.plugin.chatbox || {};
|
|
6078
6078
|
let acc = this.props.store.matchAccount() || {};
|
|
6079
|
-
if (util/* default */.
|
|
6080
|
-
let offlineEnabled = util/* default */.
|
|
6079
|
+
if (util/* default */.A.get(accountSetting, 'prechat_form.enabled')) form = accountSetting.prechat_form;
|
|
6080
|
+
let offlineEnabled = util/* default */.A.get(accountSetting, 'offline_form.enabled');
|
|
6081
6081
|
if (this.isOffline(acc, accountSetting) && offlineEnabled) form = accountSetting.offline_form;
|
|
6082
6082
|
if (!form) return false;
|
|
6083
6083
|
let formData = this.fillForm(form);
|
|
@@ -6085,34 +6085,34 @@ class Widget extends common/* Com */.Sq {
|
|
|
6085
6085
|
if (convo.state === 'ended') return true;
|
|
6086
6086
|
if (convo.state && convo.state !== 'pending') delete formData.group;
|
|
6087
6087
|
let isAllFiledEmpty = true;
|
|
6088
|
-
util/* default */.
|
|
6088
|
+
util/* default */.A.each(formData, field => {
|
|
6089
6089
|
if (field.value) isAllFiledEmpty = false;
|
|
6090
6090
|
});
|
|
6091
6091
|
if (isAllFiledEmpty && !this.userHasSent(this.props.cid)) return true;
|
|
6092
|
-
return !!util/* default */.
|
|
6092
|
+
return !!util/* default */.A.find(formData, field => field.is_required && (field.value == null || field.value === ''));
|
|
6093
6093
|
}
|
|
6094
6094
|
renderConvoSummary(convo) {
|
|
6095
6095
|
let accountSetting = this.props.plugin.chatbox || {};
|
|
6096
6096
|
let agentM = this.props.store.matchAgent('*');
|
|
6097
|
-
let ags = util/* default */.
|
|
6097
|
+
let ags = util/* default */.A.filter(convo.members, m => {
|
|
6098
6098
|
return (m.type === 'agent' || m.type === 'bot') && m.membership === 'active';
|
|
6099
6099
|
});
|
|
6100
|
-
let agentids = util/* default */.
|
|
6101
|
-
agentids = agentids || util/* default */.
|
|
6102
|
-
let agents = util/* default */.
|
|
6100
|
+
let agentids = util/* default */.A.map(ags, m => m.id);
|
|
6101
|
+
agentids = agentids || util/* default */.A.agentsOfConvo(convo)[0];
|
|
6102
|
+
let agents = util/* default */.A.map(agentids, id => agentM[id] || {
|
|
6103
6103
|
avatar_url: Widget_defaultAvatar,
|
|
6104
6104
|
fullname: 'Offline Agent'
|
|
6105
6105
|
});
|
|
6106
|
-
var name = util/* default */.
|
|
6106
|
+
var name = util/* default */.A.each(agents, ag => ag.fullname).join(', ');
|
|
6107
6107
|
if (accountSetting.hide_agent_profile || !name) name = this.props.store.matchAccount().name;
|
|
6108
6108
|
if (!name) name = this.props.t('agent');
|
|
6109
6109
|
var $you = null;
|
|
6110
6110
|
if (convo.lastSenderType === 'user') {
|
|
6111
6111
|
$you = (0,preact_module.h)("span", null, this.props.t('you'), ":");
|
|
6112
6112
|
}
|
|
6113
|
-
let seen = util/* default */.
|
|
6113
|
+
let seen = util/* default */.A.isConvoSeen(convo, this.props.store.matchUser().id);
|
|
6114
6114
|
var lastmsg = this.renderMessagePreview(convo.last_message_sent);
|
|
6115
|
-
var time = util/* default */.
|
|
6115
|
+
var time = util/* default */.A.getMs(util/* default */.A.get(convo, 'last_message_sent.created')) || util/* default */.A.getMs(convo.created);
|
|
6116
6116
|
let $unread = seen ? null : (0,preact_module.h)("div", {
|
|
6117
6117
|
class: "convo-list--item-unread"
|
|
6118
6118
|
});
|
|
@@ -6145,23 +6145,23 @@ class Widget extends common/* Com */.Sq {
|
|
|
6145
6145
|
}
|
|
6146
6146
|
agentsOfConvo(convo) {
|
|
6147
6147
|
let agentM = this.props.store.matchAgent('*');
|
|
6148
|
-
var agentids = util/* default */.
|
|
6149
|
-
return util/* default */.
|
|
6148
|
+
var agentids = util/* default */.A.agentsOfConvo(convo, true);
|
|
6149
|
+
return util/* default */.A.map(agentids, id => agentM[id] || {
|
|
6150
6150
|
avatar_url: Widget_defaultAvatar,
|
|
6151
6151
|
fullname: 'Offline Agent'
|
|
6152
6152
|
});
|
|
6153
6153
|
}
|
|
6154
6154
|
renderMessagePreview(ev) {
|
|
6155
6155
|
let defmsg = this.props.t('sent_you_a_message');
|
|
6156
|
-
let message = util/* default */.
|
|
6157
|
-
var format = util/* default */.
|
|
6156
|
+
let message = util/* default */.A.get(ev, 'data.message.text');
|
|
6157
|
+
var format = util/* default */.A.get(ev, 'data.message.format');
|
|
6158
6158
|
if (format !== 'plaintext') message = defmsg;
|
|
6159
|
-
if (!message && util/* default */.
|
|
6159
|
+
if (!message && util/* default */.A.size(util/* default */.A.get(ev, 'data.message.attachments')) > 0) message = defmsg;
|
|
6160
6160
|
if (!message) return null;
|
|
6161
|
-
let byType = util/* default */.
|
|
6161
|
+
let byType = util/* default */.A.get(ev, 'by.type');
|
|
6162
6162
|
return (0,preact_module.h)("div", {
|
|
6163
6163
|
class: "convo-list--convo-last-mes"
|
|
6164
|
-
}, util/* default */.
|
|
6164
|
+
}, util/* default */.A.map(util/* default */.A.extractText(message), tag => {
|
|
6165
6165
|
if (tag.type === 'emoji') return (0,preact_module.h)(Emoji, {
|
|
6166
6166
|
emojiCode: tag.text,
|
|
6167
6167
|
byType: byType
|
|
@@ -6173,19 +6173,19 @@ class Widget extends common/* Com */.Sq {
|
|
|
6173
6173
|
var convo = this.props.store.matchConvo(cid) || {};
|
|
6174
6174
|
let user = this.props.store.matchUser();
|
|
6175
6175
|
if (this.userSent[cid]) return true;
|
|
6176
|
-
let joined = util/* default */.
|
|
6176
|
+
let joined = util/* default */.A.find(convo.members, mem => mem.id === user.id && (mem.membership === 'active' || mem.last_sent > 0));
|
|
6177
6177
|
return joined;
|
|
6178
6178
|
}
|
|
6179
6179
|
hasSentMessage(cid) {
|
|
6180
6180
|
let convo = this.props.store.matchConvo(cid) || {};
|
|
6181
|
-
let joined = util/* default */.
|
|
6181
|
+
let joined = util/* default */.A.find(convo.members, mem => {
|
|
6182
6182
|
if (mem.type === 'bot') return true;
|
|
6183
6183
|
return mem.last_sent;
|
|
6184
6184
|
});
|
|
6185
6185
|
return joined;
|
|
6186
6186
|
}
|
|
6187
6187
|
isOffline(acc, accSetting) {
|
|
6188
|
-
let enableWhen = util/* default */.
|
|
6188
|
+
let enableWhen = util/* default */.A.get(accSetting, 'offline_form.enable_when');
|
|
6189
6189
|
let isonline = true;
|
|
6190
6190
|
if (enableWhen === 'all_agents_offline') isonline = acc.is_online;
|
|
6191
6191
|
if (enableWhen === 'out_of_bussiness_hour') isonline = acc.is_in_business_hour;
|
|
@@ -6195,8 +6195,8 @@ class Widget extends common/* Com */.Sq {
|
|
|
6195
6195
|
let form;
|
|
6196
6196
|
let accountSetting = this.props.plugin.chatbox || {};
|
|
6197
6197
|
let acc = this.props.store.matchAccount() || {};
|
|
6198
|
-
if (util/* default */.
|
|
6199
|
-
let offlineEnabled = util/* default */.
|
|
6198
|
+
if (util/* default */.A.get(accountSetting, 'prechat_form.enabled')) form = accountSetting.prechat_form;
|
|
6199
|
+
let offlineEnabled = util/* default */.A.get(accountSetting, 'offline_form.enabled');
|
|
6200
6200
|
if (this.isOffline(acc, accountSetting) && offlineEnabled) {
|
|
6201
6201
|
form = accountSetting.offline_form;
|
|
6202
6202
|
}
|
|
@@ -6206,23 +6206,23 @@ class Widget extends common/* Com */.Sq {
|
|
|
6206
6206
|
if (this.props.view === 'prechat_form') {
|
|
6207
6207
|
form = accountSetting.prechat_form;
|
|
6208
6208
|
}
|
|
6209
|
-
if (util/* default */.
|
|
6209
|
+
if (util/* default */.A.size(form) === 0) return [];
|
|
6210
6210
|
var data = {};
|
|
6211
|
-
util/* default */.
|
|
6211
|
+
util/* default */.A.each(form.fields, f => {
|
|
6212
6212
|
var newf = Object.assign({}, f);
|
|
6213
6213
|
if (f.type === 'list') {
|
|
6214
6214
|
newf.list = f.list;
|
|
6215
6215
|
}
|
|
6216
|
-
newf.label = this.props.t.i18n(util/* default */.
|
|
6216
|
+
newf.label = this.props.t.i18n(util/* default */.A.get(f, `i18n_label`, {})) || f.label;
|
|
6217
6217
|
data['attr:' + f.key] = newf;
|
|
6218
6218
|
});
|
|
6219
|
-
if (form.group_required && util/* default */.
|
|
6219
|
+
if (form.group_required && util/* default */.A.size(form.groups) > 0) {
|
|
6220
6220
|
data['group'] = {
|
|
6221
6221
|
key: 'group',
|
|
6222
6222
|
is_required: !!form.group_required,
|
|
6223
|
-
label: this.props.t.i18n(util/* default */.
|
|
6223
|
+
label: this.props.t.i18n(util/* default */.A.get(form, `i18n_group_label`, {})) || form.group_label,
|
|
6224
6224
|
type: 'group',
|
|
6225
|
-
list: util/* default */.
|
|
6225
|
+
list: util/* default */.A.map(form.groups, group => ({
|
|
6226
6226
|
value: group.id,
|
|
6227
6227
|
label: group.name
|
|
6228
6228
|
}))
|
|
@@ -6231,7 +6231,7 @@ class Widget extends common/* Com */.Sq {
|
|
|
6231
6231
|
data['question'] = {
|
|
6232
6232
|
key: 'question',
|
|
6233
6233
|
is_required: true,
|
|
6234
|
-
label: this.props.t.i18n(util/* default */.
|
|
6234
|
+
label: this.props.t.i18n(util/* default */.A.get(form, `i18n_question_label`, {})) || form.question_label,
|
|
6235
6235
|
type: 'text'
|
|
6236
6236
|
};
|
|
6237
6237
|
if (this.isFormChanged(this.state.formData, data)) {
|
|
@@ -6245,44 +6245,44 @@ class Widget extends common/* Com */.Sq {
|
|
|
6245
6245
|
let newKeys = Object.keys(newForm);
|
|
6246
6246
|
if (oldKeys.length !== newKeys.length) return true;
|
|
6247
6247
|
for (let i = 0; i < oldKeys.length; i++) {
|
|
6248
|
-
if (util/* default */.
|
|
6249
|
-
if (util/* default */.
|
|
6250
|
-
if (util/* default */.
|
|
6248
|
+
if (util/* default */.A.get(oldForm, `${oldKeys[i]}.label`) !== util/* default */.A.get(newForm, `${newKeys[i]}.label`)) return true;
|
|
6249
|
+
if (util/* default */.A.get(oldForm, `${oldKeys[i]}.is_required`) !== util/* default */.A.get(newForm, `${newKeys[i]}.is_required`)) return true;
|
|
6250
|
+
if (util/* default */.A.stringify(util/* default */.A.get(oldForm, `${oldKeys[i]}.list`)) !== util/* default */.A.stringify(util/* default */.A.get(newForm, `${newKeys[i]}.list`))) {
|
|
6251
6251
|
return true;
|
|
6252
6252
|
}
|
|
6253
6253
|
}
|
|
6254
6254
|
return false;
|
|
6255
6255
|
}
|
|
6256
6256
|
fillForm(form) {
|
|
6257
|
-
if (util/* default */.
|
|
6257
|
+
if (util/* default */.A.size(form) === 0) return [];
|
|
6258
6258
|
var data = {};
|
|
6259
6259
|
let user = this.props.store.matchUser();
|
|
6260
|
-
util/* default */.
|
|
6260
|
+
util/* default */.A.each(form.fields, f => {
|
|
6261
6261
|
var newf = Object.assign({}, f);
|
|
6262
|
-
newf.value = util/* default */.
|
|
6262
|
+
newf.value = util/* default */.A.getUserAttr(user, f.key, f.type);
|
|
6263
6263
|
if (newf.key == 'emails' && !newf.value) {
|
|
6264
|
-
newf.value = util/* default */.
|
|
6264
|
+
newf.value = util/* default */.A.getUserAttr(user, 'related_email', 'text');
|
|
6265
6265
|
}
|
|
6266
6266
|
if (newf.key == 'phones' && !newf.value) {
|
|
6267
|
-
newf.value = util/* default */.
|
|
6267
|
+
newf.value = util/* default */.A.getUserAttr(user, 'related_phone', 'text');
|
|
6268
6268
|
}
|
|
6269
6269
|
if (f.type === 'boolean' && !newf.value) newf.value = false;
|
|
6270
6270
|
if (f.type === 'datetime' && newf.value) {
|
|
6271
|
-
newf.value = new util/* default */.
|
|
6271
|
+
newf.value = new util/* default */.A.Date(data.value).toLocaleDateString('en-CA');
|
|
6272
6272
|
}
|
|
6273
6273
|
if (f.type === 'list') {
|
|
6274
6274
|
newf.list = f.list;
|
|
6275
6275
|
}
|
|
6276
|
-
newf.label = this.props.t.i18n(util/* default */.
|
|
6276
|
+
newf.label = this.props.t.i18n(util/* default */.A.get(f, `i18n_label`, {})) || f.label;
|
|
6277
6277
|
data['attr:' + f.key] = newf;
|
|
6278
6278
|
});
|
|
6279
|
-
if (form.group_required && util/* default */.
|
|
6279
|
+
if (form.group_required && util/* default */.A.size(form.groups) > 0) {
|
|
6280
6280
|
data['group'] = {
|
|
6281
6281
|
key: 'group',
|
|
6282
6282
|
is_required: !!form.group_required,
|
|
6283
|
-
label: this.props.t.i18n(util/* default */.
|
|
6283
|
+
label: this.props.t.i18n(util/* default */.A.get(form, `i18n_group_label`, {})) || form.group_label,
|
|
6284
6284
|
type: 'group',
|
|
6285
|
-
list: util/* default */.
|
|
6285
|
+
list: util/* default */.A.map(form.groups, group => ({
|
|
6286
6286
|
value: group.id,
|
|
6287
6287
|
label: group.name
|
|
6288
6288
|
}))
|
|
@@ -6291,7 +6291,7 @@ class Widget extends common/* Com */.Sq {
|
|
|
6291
6291
|
return data;
|
|
6292
6292
|
}
|
|
6293
6293
|
}
|
|
6294
|
-
class FormMounter extends common/* Com */.
|
|
6294
|
+
class FormMounter extends common/* Com */.Mw {
|
|
6295
6295
|
componentDidMount() {
|
|
6296
6296
|
this.props.onMount(this.props.form);
|
|
6297
6297
|
}
|
|
@@ -6305,23 +6305,23 @@ function Widget_encode(key) {
|
|
|
6305
6305
|
|
|
6306
6306
|
|
|
6307
6307
|
|
|
6308
|
-
let main_promiseMainCSS = (() => __webpack_require__.e(/* import() */
|
|
6309
|
-
class Main extends common/* Com */.
|
|
6308
|
+
let main_promiseMainCSS = (() => __webpack_require__.e(/* import() */ 278).then(__webpack_require__.bind(__webpack_require__, 9278)))();
|
|
6309
|
+
class Main extends common/* Com */.Mw {
|
|
6310
6310
|
constructor(props) {
|
|
6311
6311
|
super(props);
|
|
6312
|
-
this.refButton = (0,preact_module/* createRef */.
|
|
6313
|
-
this.refWidget = (0,preact_module/* createRef */.
|
|
6312
|
+
this.refButton = (0,preact_module/* createRef */._3)();
|
|
6313
|
+
this.refWidget = (0,preact_module/* createRef */._3)();
|
|
6314
6314
|
}
|
|
6315
6315
|
async refreshCSS() {
|
|
6316
6316
|
let plugins = this.props.store.matchPlugin();
|
|
6317
|
-
let found = util/* default */.
|
|
6317
|
+
let found = util/* default */.A.find(plugins, plugin => plugin.id === this.props.plugin.id);
|
|
6318
6318
|
if (!found) return;
|
|
6319
6319
|
let css = (await main_promiseMainCSS).default.default.toString();
|
|
6320
|
-
var outcss = util/* default */.
|
|
6321
|
-
util/* default */.
|
|
6320
|
+
var outcss = util/* default */.A.replaceCssVariable(css, found.chatbox);
|
|
6321
|
+
util/* default */.A.setCss(this.props.plugin.id, this.$cssStyleDiv, outcss);
|
|
6322
6322
|
}
|
|
6323
6323
|
componentWillUnmount() {
|
|
6324
|
-
util/* default */.
|
|
6324
|
+
util/* default */.A.setCss(this.props.plugin.id, this.$cssStyleDiv, '');
|
|
6325
6325
|
}
|
|
6326
6326
|
async componentDidMount() {
|
|
6327
6327
|
this.$cssStyleDiv = document.getElementById('subiz-style-for-' + this.props.plugin.id);
|
|
@@ -6357,7 +6357,7 @@ class Main extends common/* Com */.Sq {
|
|
|
6357
6357
|
}
|
|
6358
6358
|
render() {
|
|
6359
6359
|
if (!this.state.cssready) return null;
|
|
6360
|
-
if (util/* default */.
|
|
6360
|
+
if (util/* default */.A.isUserBanned(this.props.store.matchUser())) return null;
|
|
6361
6361
|
if (!this.props.t) return null;
|
|
6362
6362
|
return (0,preact_module.h)("div", {
|
|
6363
6363
|
class: this.props.store.isMobile() ? 'mobile' : 'desktop'
|
|
@@ -6391,10 +6391,10 @@ class Main extends common/* Com */.Sq {
|
|
|
6391
6391
|
if ($widget.wasFormInputed) return;
|
|
6392
6392
|
if (ev.type !== 'message_sent') return;
|
|
6393
6393
|
if (!this.state.isShowWidget) return;
|
|
6394
|
-
let byType = util/* default */.
|
|
6395
|
-
let byid = util/* default */.
|
|
6394
|
+
let byType = util/* default */.A.get(ev, 'by.type');
|
|
6395
|
+
let byid = util/* default */.A.get(ev, 'by.id') || '';
|
|
6396
6396
|
if (!byid.startsWith('bb') || byType !== 'agent') return;
|
|
6397
|
-
let cid = util/* default */.
|
|
6397
|
+
let cid = util/* default */.A.get(ev, 'data.message.conversation_id');
|
|
6398
6398
|
if (!cid) return;
|
|
6399
6399
|
this.showWidget({
|
|
6400
6400
|
cid,
|
|
@@ -6406,7 +6406,7 @@ class Main extends common/* Com */.Sq {
|
|
|
6406
6406
|
if (this.props.plugin._no_auto_expand) return;
|
|
6407
6407
|
if (this.props.store.matchHasManuallyClosed()) return;
|
|
6408
6408
|
let convoM = this.props.store.matchConvo('*');
|
|
6409
|
-
let redconvo = util/* default */.
|
|
6409
|
+
let redconvo = util/* default */.A.find(convoM, convo => !util/* default */.A.isConvoSeen(convo, this.props.store.matchUser().id));
|
|
6410
6410
|
if (!redconvo || !redconvo.id) return;
|
|
6411
6411
|
if (!this.state.isShowWidget) this.showWidget({
|
|
6412
6412
|
view: 'chat',
|
|
@@ -6424,14 +6424,14 @@ class Main extends common/* Com */.Sq {
|
|
|
6424
6424
|
this.refButton.current && this.refButton.current.ClearPreview();
|
|
6425
6425
|
if (!p.view) {
|
|
6426
6426
|
let lastview = this.props.store.matchLastview() || {};
|
|
6427
|
-
p.view = util/* default */.
|
|
6428
|
-
p.cid = util/* default */.
|
|
6427
|
+
p.view = util/* default */.A.get(lastview, 'view');
|
|
6428
|
+
p.cid = util/* default */.A.get(lastview, 'opts.cid');
|
|
6429
6429
|
}
|
|
6430
6430
|
p = p || {};
|
|
6431
6431
|
if (!p.view && !p.cid) {
|
|
6432
6432
|
let convoM = this.props.store.matchConvo('*');
|
|
6433
|
-
let redconvo = util/* default */.
|
|
6434
|
-
p.cid = util/* default */.
|
|
6433
|
+
let redconvo = util/* default */.A.find(convoM, convo => !util/* default */.A.isConvoSeen(convo, this.props.store.matchUser().id));
|
|
6434
|
+
p.cid = util/* default */.A.get(redconvo, 'id', util/* default */.A.get(convoM, '0.id'));
|
|
6435
6435
|
p.view = 'chat';
|
|
6436
6436
|
}
|
|
6437
6437
|
if (this.props.store.isMobile()) modifyViewport();
|
|
@@ -6486,196 +6486,196 @@ function modifyViewport() {
|
|
|
6486
6486
|
|
|
6487
6487
|
/***/ }),
|
|
6488
6488
|
|
|
6489
|
-
/***/
|
|
6489
|
+
/***/ 1108:
|
|
6490
6490
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6491
6491
|
|
|
6492
6492
|
module.exports = __webpack_require__.p + "assets/img/bubble_default.7d5e4ab.svg";
|
|
6493
6493
|
|
|
6494
6494
|
/***/ }),
|
|
6495
6495
|
|
|
6496
|
-
/***/
|
|
6496
|
+
/***/ 7741:
|
|
6497
6497
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6498
6498
|
|
|
6499
6499
|
module.exports = __webpack_require__.p + "assets/img/caret.998eb8f.svg";
|
|
6500
6500
|
|
|
6501
6501
|
/***/ }),
|
|
6502
6502
|
|
|
6503
|
-
/***/
|
|
6503
|
+
/***/ 1370:
|
|
6504
6504
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6505
6505
|
|
|
6506
6506
|
module.exports = __webpack_require__.p + "assets/img/convos_empty.2353007.svg";
|
|
6507
6507
|
|
|
6508
6508
|
/***/ }),
|
|
6509
6509
|
|
|
6510
|
-
/***/
|
|
6510
|
+
/***/ 2876:
|
|
6511
6511
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6512
6512
|
|
|
6513
6513
|
module.exports = __webpack_require__.p + "assets/img/default.06e6ee0.jpg";
|
|
6514
6514
|
|
|
6515
6515
|
/***/ }),
|
|
6516
6516
|
|
|
6517
|
-
/***/
|
|
6517
|
+
/***/ 2538:
|
|
6518
6518
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6519
6519
|
|
|
6520
6520
|
module.exports = __webpack_require__.p + "assets/img/default_avatar.5b74dc1.png";
|
|
6521
6521
|
|
|
6522
6522
|
/***/ }),
|
|
6523
6523
|
|
|
6524
|
-
/***/
|
|
6524
|
+
/***/ 9150:
|
|
6525
6525
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6526
6526
|
|
|
6527
6527
|
module.exports = __webpack_require__.p + "assets/img/done_gray.d7e8203.svg";
|
|
6528
6528
|
|
|
6529
6529
|
/***/ }),
|
|
6530
6530
|
|
|
6531
|
-
/***/
|
|
6531
|
+
/***/ 5860:
|
|
6532
6532
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6533
6533
|
|
|
6534
6534
|
module.exports = __webpack_require__.p + "assets/img/done_green.b817fd4.svg";
|
|
6535
6535
|
|
|
6536
6536
|
/***/ }),
|
|
6537
6537
|
|
|
6538
|
-
/***/
|
|
6538
|
+
/***/ 9419:
|
|
6539
6539
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6540
6540
|
|
|
6541
6541
|
module.exports = __webpack_require__.p + "assets/img/empty.29bed2d.svg";
|
|
6542
6542
|
|
|
6543
6543
|
/***/ }),
|
|
6544
6544
|
|
|
6545
|
-
/***/
|
|
6545
|
+
/***/ 6907:
|
|
6546
6546
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6547
6547
|
|
|
6548
6548
|
module.exports = __webpack_require__.p + "assets/img/empty_1.0b98af0.svg";
|
|
6549
6549
|
|
|
6550
6550
|
/***/ }),
|
|
6551
6551
|
|
|
6552
|
-
/***/
|
|
6552
|
+
/***/ 3266:
|
|
6553
6553
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6554
6554
|
|
|
6555
6555
|
module.exports = __webpack_require__.p + "assets/img/external-link.90577cc.svg";
|
|
6556
6556
|
|
|
6557
6557
|
/***/ }),
|
|
6558
6558
|
|
|
6559
|
-
/***/
|
|
6559
|
+
/***/ 1113:
|
|
6560
6560
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6561
6561
|
|
|
6562
6562
|
module.exports = __webpack_require__.p + "assets/img/ghn.070f8e3.svg";
|
|
6563
6563
|
|
|
6564
6564
|
/***/ }),
|
|
6565
6565
|
|
|
6566
|
-
/***/
|
|
6566
|
+
/***/ 7362:
|
|
6567
6567
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6568
6568
|
|
|
6569
6569
|
module.exports = __webpack_require__.p + "assets/img/ghtk.326eac1.svg";
|
|
6570
6570
|
|
|
6571
6571
|
/***/ }),
|
|
6572
6572
|
|
|
6573
|
-
/***/
|
|
6573
|
+
/***/ 3582:
|
|
6574
6574
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6575
6575
|
|
|
6576
6576
|
module.exports = __webpack_require__.p + "assets/img/image_default.be0698b.png";
|
|
6577
6577
|
|
|
6578
6578
|
/***/ }),
|
|
6579
6579
|
|
|
6580
|
-
/***/
|
|
6580
|
+
/***/ 7324:
|
|
6581
6581
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6582
6582
|
|
|
6583
6583
|
module.exports = __webpack_require__.p + "assets/img/info.ebce7ea.svg";
|
|
6584
6584
|
|
|
6585
6585
|
/***/ }),
|
|
6586
6586
|
|
|
6587
|
-
/***/
|
|
6587
|
+
/***/ 185:
|
|
6588
6588
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6589
6589
|
|
|
6590
6590
|
module.exports = __webpack_require__.p + "assets/img/loader.37000a7.svg";
|
|
6591
6591
|
|
|
6592
6592
|
/***/ }),
|
|
6593
6593
|
|
|
6594
|
-
/***/
|
|
6594
|
+
/***/ 6973:
|
|
6595
6595
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6596
6596
|
|
|
6597
6597
|
module.exports = __webpack_require__.p + "assets/img/loading_static.a27f0ac.svg";
|
|
6598
6598
|
|
|
6599
6599
|
/***/ }),
|
|
6600
6600
|
|
|
6601
|
-
/***/
|
|
6601
|
+
/***/ 3142:
|
|
6602
6602
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6603
6603
|
|
|
6604
6604
|
module.exports = __webpack_require__.p + "assets/img/not_found_search.2ddb8d1.png";
|
|
6605
6605
|
|
|
6606
6606
|
/***/ }),
|
|
6607
6607
|
|
|
6608
|
-
/***/
|
|
6608
|
+
/***/ 8512:
|
|
6609
6609
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6610
6610
|
|
|
6611
6611
|
module.exports = __webpack_require__.p + "assets/img/package.8d37d0f.svg";
|
|
6612
6612
|
|
|
6613
6613
|
/***/ }),
|
|
6614
6614
|
|
|
6615
|
-
/***/
|
|
6615
|
+
/***/ 6857:
|
|
6616
6616
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6617
6617
|
|
|
6618
6618
|
module.exports = __webpack_require__.p + "assets/img/package_fade.763c001.svg";
|
|
6619
6619
|
|
|
6620
6620
|
/***/ }),
|
|
6621
6621
|
|
|
6622
|
-
/***/
|
|
6622
|
+
/***/ 7134:
|
|
6623
6623
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6624
6624
|
|
|
6625
6625
|
module.exports = __webpack_require__.p + "assets/img/rating--average.1ea492c.svg";
|
|
6626
6626
|
|
|
6627
6627
|
/***/ }),
|
|
6628
6628
|
|
|
6629
|
-
/***/
|
|
6629
|
+
/***/ 940:
|
|
6630
6630
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6631
6631
|
|
|
6632
6632
|
module.exports = __webpack_require__.p + "assets/img/rating--great.e3d712e.svg";
|
|
6633
6633
|
|
|
6634
6634
|
/***/ }),
|
|
6635
6635
|
|
|
6636
|
-
/***/
|
|
6636
|
+
/***/ 9801:
|
|
6637
6637
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6638
6638
|
|
|
6639
6639
|
module.exports = __webpack_require__.p + "assets/img/rating--poor.2938a25.svg";
|
|
6640
6640
|
|
|
6641
6641
|
/***/ }),
|
|
6642
6642
|
|
|
6643
|
-
/***/
|
|
6643
|
+
/***/ 5452:
|
|
6644
6644
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6645
6645
|
|
|
6646
6646
|
module.exports = __webpack_require__.p + "assets/img/search.f9705ff.svg";
|
|
6647
6647
|
|
|
6648
6648
|
/***/ }),
|
|
6649
6649
|
|
|
6650
|
-
/***/
|
|
6650
|
+
/***/ 8506:
|
|
6651
6651
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6652
6652
|
|
|
6653
6653
|
module.exports = __webpack_require__.p + "assets/img/send.6db52a9.svg";
|
|
6654
6654
|
|
|
6655
6655
|
/***/ }),
|
|
6656
6656
|
|
|
6657
|
-
/***/
|
|
6657
|
+
/***/ 5244:
|
|
6658
6658
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6659
6659
|
|
|
6660
6660
|
module.exports = __webpack_require__.p + "assets/img/shop.f7dc7d8.svg";
|
|
6661
6661
|
|
|
6662
6662
|
/***/ }),
|
|
6663
6663
|
|
|
6664
|
-
/***/
|
|
6664
|
+
/***/ 2523:
|
|
6665
6665
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6666
6666
|
|
|
6667
6667
|
module.exports = __webpack_require__.p + "assets/img/shop_faded.df7845a.svg";
|
|
6668
6668
|
|
|
6669
6669
|
/***/ }),
|
|
6670
6670
|
|
|
6671
|
-
/***/
|
|
6671
|
+
/***/ 9529:
|
|
6672
6672
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6673
6673
|
|
|
6674
6674
|
module.exports = __webpack_require__.p + "assets/img/subiz-mono.877e9f5.svg";
|
|
6675
6675
|
|
|
6676
6676
|
/***/ }),
|
|
6677
6677
|
|
|
6678
|
-
/***/
|
|
6678
|
+
/***/ 3080:
|
|
6679
6679
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
6680
6680
|
|
|
6681
6681
|
module.exports = __webpack_require__.p + "assets/img/x.26fdfa3.svg";
|