@subiz/widget-v4 4.1.60 → 4.1.61

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.
Files changed (58) hide show
  1. package/app.js +10 -0
  2. package/compiled_src/call/call.js +2 -2
  3. package/compiled_src/chatbox/DropdownSelect.js +2 -2
  4. package/compiled_src/chatbox/ImageAttachments.js +2 -2
  5. package/compiled_src/chatbox/MessageInput.js +2 -2
  6. package/compiled_src/chatbox/Order.js +2 -2
  7. package/compiled_src/chatbox/Rating.js +2 -2
  8. package/compiled_src/chatbox/Widget.js +2 -2
  9. package/compiled_src/contact/contact.js +2 -2
  10. package/compiled_src/lib.js +2 -2
  11. package/compiled_src/notif/notif.js +2 -2
  12. package/compiled_src/order/address_picker.js +2 -2
  13. package/compiled_src/order/order.js +2 -2
  14. package/compiled_src/popup/countdown.js +2 -2
  15. package/compiled_src/popup/popup.js +2 -2
  16. package/compiled_src/store/api.js +2 -2
  17. package/compiled_src/store/api_fake.js +2 -2
  18. package/compiled_src/store/store.js +2 -2
  19. package/dist/178.js +1 -1
  20. package/dist/18d5e97bf55.178.js +1 -0
  21. package/dist/18d5e97bf55.213.js +1 -0
  22. package/dist/18d5e97bf55.335.js +1 -0
  23. package/dist/{18a02a9c54e.362.js → 18d5e97bf55.362.js} +1 -1
  24. package/dist/18d5e97bf55.605.js +1 -0
  25. package/dist/{18a02a9c54e.782.js → 18d5e97bf55.782.js} +1 -1
  26. package/dist/18d5e97bf55.841.js +1 -0
  27. package/dist/18d5e97bf55.app.js +1 -0
  28. package/dist/{18a02a9c54e.index.html → 18d5e97bf55.index.html} +4 -4
  29. package/dist/{18a02a9c54e.library.html → 18d5e97bf55.library.html} +4 -4
  30. package/dist/18d5e97bf55.library.js +1 -0
  31. package/dist/{18a02a9c54e.preview.html → 18d5e97bf55.preview.html} +1 -1
  32. package/dist/18d5e97bf55.preview.js +1 -0
  33. package/dist/18d5e97bf55.screenshoot.js +1 -0
  34. package/dist/18d5e97bf55.webview.js +1 -0
  35. package/dist/213.js +122 -106
  36. package/dist/335.js +27 -27
  37. package/dist/362.js +1 -1
  38. package/dist/605.js +52 -53
  39. package/dist/782.js +1 -1
  40. package/dist/{132.js → 841.js} +657 -644
  41. package/dist/HASH +1 -1
  42. package/dist/malicious-app.js +9 -3
  43. package/dist/screenshoot.html +1 -1
  44. package/dist/screenshoot.js +547 -623
  45. package/package.json +8 -8
  46. package/dist/18a02a9c54e.132.js +0 -1
  47. package/dist/18a02a9c54e.178.js +0 -1
  48. package/dist/18a02a9c54e.213.js +0 -1
  49. package/dist/18a02a9c54e.335.js +0 -1
  50. package/dist/18a02a9c54e.441.js +0 -1
  51. package/dist/18a02a9c54e.605.js +0 -1
  52. package/dist/18a02a9c54e.app.js +0 -1
  53. package/dist/18a02a9c54e.library.js +0 -1
  54. package/dist/18a02a9c54e.preview.js +0 -1
  55. package/dist/18a02a9c54e.screenshoot.js +0 -1
  56. package/dist/18a02a9c54e.webview.js +0 -1
  57. package/dist/441.js +0 -2855
  58. /package/dist/{18a02a9c54e.678.js → 18d5e97bf55.678.js} +0 -0
@@ -1,6 +1,6 @@
1
- (self["webpackChunk_subiz_widget_v4"] = self["webpackChunk_subiz_widget_v4"] || []).push([[132],{
1
+ (self["webpackChunk_subiz_widget_v4"] = self["webpackChunk_subiz_widget_v4"] || []).push([[841],{
2
2
 
3
- /***/ 8132:
3
+ /***/ 8841:
4
4
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5
5
 
6
6
  "use strict";
@@ -25,7 +25,7 @@ var preact_module = __webpack_require__(6400);
25
25
  class Emoji extends common/* Com */.up {
26
26
  render() {
27
27
  var emojiCode = this.props.emojiCode;
28
- if (util/* default.size */.Z.size(emojiCode) < 3) return null;
28
+ if (util/* default */.Z.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,
@@ -51,11 +51,11 @@ class ChatButton extends common/* Com */.up {
51
51
  this.loadGreeting();
52
52
  this.props.store.onUpdate(this, _ => this.forceUpdate());
53
53
  this.props.store.onConvoEvent(this, ev => {
54
- if (util/* default.get */.Z.get(ev, 'type') !== 'message_sent') return;
55
- let bytype = util/* default.get */.Z.get(ev, 'by.type');
54
+ if (util/* default */.Z.get(ev, 'type') !== 'message_sent') return;
55
+ let bytype = util/* default */.Z.get(ev, 'by.type');
56
56
  if (bytype !== 'system' && bytype !== 'agent') return;
57
57
  let isquickreplies = false;
58
- util/* default.map */.Z.map(util/* default.get */.Z.get(ev, 'data.message.attachments', []), att => {
58
+ util/* default */.Z.map(util/* default */.Z.get(ev, 'data.message.attachments', []), att => {
59
59
  if (!att) return;
60
60
  if (att.type === 'quick_replies') {
61
61
  isquickreplies = true;
@@ -69,30 +69,30 @@ class ChatButton extends common/* Com */.up {
69
69
  });
70
70
  }
71
71
  fixMissingSetting(chatbox) {
72
- chatbox = util/* default.cloneDeep */.Z.cloneDeep(chatbox);
73
- if (util/* default.get */.Z.get(chatbox, 'desktop_button.background_image_url')) {
72
+ chatbox = util/* default */.Z.cloneDeep(chatbox);
73
+ if (util/* default */.Z.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.get */.Z.get(chatbox, 'desktop_button.background_mask_url')) {
76
+ if (util/* default */.Z.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.get */.Z.get(chatbox, 'mobile_button.background_image_url')) {
79
+ if (util/* default */.Z.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.get */.Z.get(chatbox, 'mobile_button.background_mask_url')) {
82
+ if (util/* default */.Z.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.get */.Z.get(accountSetting, 'desktop_button.position') || 'right';
89
+ let position = util/* default */.Z.get(accountSetting, 'desktop_button.position') || 'right';
90
90
  if (this.props.store.isMobile()) {
91
- position = util/* default.get */.Z.get(accountSetting, 'mobile_button.position') || position;
92
- let hiddenButtonMobile = util/* default.get */.Z.get(accountSetting, 'mobile_button.hidden');
91
+ position = util/* default */.Z.get(accountSetting, 'mobile_button.position') || position;
92
+ let hiddenButtonMobile = util/* default */.Z.get(accountSetting, 'mobile_button.hidden');
93
93
  if (hiddenButtonMobile) return null;
94
94
  }
95
- let hiddenButtonDesktop = util/* default.get */.Z.get(accountSetting, 'desktop_button.hidden');
95
+ let hiddenButtonDesktop = util/* default */.Z.get(accountSetting, 'desktop_button.hidden');
96
96
  if (hiddenButtonDesktop) return null;
97
97
  let cls = 'widget-layout widget-layout--' + position;
98
98
  let opacity = this.state.opacity;
@@ -111,11 +111,15 @@ class ChatButton extends common/* Com */.up {
111
111
  });
112
112
  }
113
113
  ShowGreeting() {
114
- let greeting = util/* default.get */.Z.get(this.props.plugin, 'chatbox.greeting', {});
114
+ if (this.props.store.isMobile()) {
115
+ let accid = util/* default */.Z.get(this.props.plugin, 'chatbox.account_id', {});
116
+ if (accid === 'acqjeefqeaoiagyfprap') return;
117
+ }
118
+ let greeting = util/* default */.Z.get(this.props.plugin, 'chatbox.greeting', {});
115
119
  let agentM = this.props.store.matchAgent('*');
116
120
  let byid = greeting.agent_id;
117
121
  if (!byid) byid = randomAgent(agentM).id;
118
- let text = this.props.t.i18n(util/* default.get */.Z.get(greeting, 'greeting', {})) || greeting.message;
122
+ let text = this.props.t.i18n(util/* default */.Z.get(greeting, 'greeting', {})) || greeting.message;
119
123
  this.setState({
120
124
  previewEvent: {
121
125
  by: {
@@ -139,9 +143,9 @@ class ChatButton extends common/* Com */.up {
139
143
  }
140
144
  loadGreeting() {
141
145
  let accountSetting = this.props.plugin.chatbox;
142
- if (new util/* default.Date */.Z.Date().getTime() - this.props.store.matchClosePreviewAt() < Ms30Mins) return;
143
- let greeting = util/* default.get */.Z.get(accountSetting, 'greeting', {});
144
- let text = this.props.t.i18n(util/* default.get */.Z.get(greeting, 'greeting', {})) || greeting.message;
146
+ if (new util/* default */.Z.Date().getTime() - this.props.store.matchClosePreviewAt() < Ms30Mins) return;
147
+ let greeting = util/* default */.Z.get(accountSetting, 'greeting', {});
148
+ let text = this.props.t.i18n(util/* default */.Z.get(greeting, 'greeting', {})) || greeting.message;
145
149
  if (!text || !greeting.enabled) {
146
150
  this.setState({
147
151
  previewEvent: {}
@@ -152,8 +156,8 @@ class ChatButton extends common/* Com */.up {
152
156
  }
153
157
  onClick() {
154
158
  let lastview = this.props.store.matchLastview();
155
- if (util/* default.get */.Z.get(lastview, 'view')) {
156
- if (lastview.view !== 'list' || util/* default.size */.Z.size(this.props.store.matchConvo('*')) > 0) {
159
+ if (util/* default */.Z.get(lastview, 'view')) {
160
+ if (lastview.view !== 'list' || util/* default */.Z.size(this.props.store.matchConvo('*')) > 0) {
157
161
  return this.props.onClick && this.props.onClick(Object.assign({}, lastview.opts, {
158
162
  view: lastview.view
159
163
  }));
@@ -162,10 +166,10 @@ class ChatButton extends common/* Com */.up {
162
166
  return this.onPreviewClick();
163
167
  }
164
168
  onPreviewClick(e) {
165
- let cid = util/* default.convoOfEv */.Z.convoOfEv(this.state.previewEvent);
169
+ let cid = util/* default */.Z.convoOfEv(this.state.previewEvent);
166
170
  if (!cid) {
167
- let convos = util/* default.map */.Z.map(this.props.store.matchConvo('*'));
168
- let convo = util/* default.find */.Z.find(convos, convo => !util/* default.isConvoSeen */.Z.isConvoSeen(convo, this.props.store.matchUser().id));
171
+ let convos = util/* default */.Z.map(this.props.store.matchConvo('*'));
172
+ let convo = util/* default */.Z.find(convos, convo => !util/* default */.Z.isConvoSeen(convo, this.props.store.matchUser().id));
169
173
  if (!convo) convo = convos[0] || {};
170
174
  cid = convo.id;
171
175
  }
@@ -185,13 +189,13 @@ class ChatButton extends common/* Com */.up {
185
189
  renderPreview() {
186
190
  let account = this.props.store.matchAccount();
187
191
  let accountSetting = this.props.plugin.chatbox;
188
- let byid = util/* default.get */.Z.get(this.state.previewEvent, 'by.display_id', util/* default.get */.Z.get(this.state.previewEvent, 'by.id'));
189
- let agent = util/* default.cloneDeep */.Z.cloneDeep(this.props.store.matchAgent(byid)) || {};
190
- agent.fullname = agent.fullname || util/* default.get */.Z.get(account, 'name') || this.props.t('agent');
192
+ let byid = util/* default */.Z.get(this.state.previewEvent, 'by.display_id', util/* default */.Z.get(this.state.previewEvent, 'by.id'));
193
+ let agent = util/* default */.Z.cloneDeep(this.props.store.matchAgent(byid)) || {};
194
+ agent.fullname = agent.fullname || util/* default */.Z.get(account, 'name') || this.props.t('agent');
191
195
  agent.avatar_url = agent.avatar_url || defaultAvatar;
192
- let position = util/* default.get */.Z.get(accountSetting, 'desktop_button.position') || 'right';
196
+ let position = util/* default */.Z.get(accountSetting, 'desktop_button.position') || 'right';
193
197
  if (this.props.store.isMobile()) {
194
- position = util/* default.get */.Z.get(accountSetting, 'mobile_button.position') || position;
198
+ position = util/* default */.Z.get(accountSetting, 'mobile_button.position') || position;
195
199
  }
196
200
  if (accountSetting && accountSetting.hide_agent_profile) {
197
201
  agent = Object.assign({}, account, {
@@ -202,7 +206,7 @@ class ChatButton extends common/* Com */.up {
202
206
  let cls = 'widget-preview widget-preview--' + position;
203
207
  if (!this.state.displayPreview) cls += ' widget-preview--hidden';
204
208
  var tags = this.renderMessagePreview(this.state.previewEvent, this.props.t('sent_you_a_message'));
205
- if (util/* default.size */.Z.size(tags) === 0) cls += ' widget-preview--hidden';
209
+ if (util/* default */.Z.size(tags) === 0) cls += ' widget-preview--hidden';
206
210
  return (0,preact_module.h)("div", {
207
211
  class: cls
208
212
  }, (0,preact_module.h)("div", {
@@ -245,16 +249,16 @@ class ChatButton extends common/* Com */.up {
245
249
  renderButton() {
246
250
  let accountSetting = this.props.plugin.chatbox;
247
251
  accountSetting = this.fixMissingSetting(accountSetting);
248
- let imgsrc = util/* default.get */.Z.get(accountSetting, 'desktop_button.background_image_url') || util/* default.get */.Z.get(accountSetting, 'desktop_button.background_mask_url') || defaultBubble;
249
- let background = util/* default.get */.Z.get(accountSetting, 'background') || DEF_BG;
250
- let position = util/* default.get */.Z.get(accountSetting, 'desktop_button.position') || 'right';
251
- let imgurl = util/* default.get */.Z.get(accountSetting, 'desktop_button.background_image_url');
252
- let maskurl = util/* default.get */.Z.get(accountSetting, 'desktop_button.background_mask_url');
252
+ let imgsrc = util/* default */.Z.get(accountSetting, 'desktop_button.background_image_url') || util/* default */.Z.get(accountSetting, 'desktop_button.background_mask_url') || defaultBubble;
253
+ let background = util/* default */.Z.get(accountSetting, 'background') || DEF_BG;
254
+ let position = util/* default */.Z.get(accountSetting, 'desktop_button.position') || 'right';
255
+ let imgurl = util/* default */.Z.get(accountSetting, 'desktop_button.background_image_url');
256
+ let maskurl = util/* default */.Z.get(accountSetting, 'desktop_button.background_mask_url');
253
257
  if (this.props.store.isMobile()) {
254
- imgsrc = util/* default.get */.Z.get(accountSetting, 'mobile_button.background_image_url') || util/* default.get */.Z.get(accountSetting, 'mobile_button.background_mask_url') || imgsrc;
255
- position = util/* default.get */.Z.get(accountSetting, 'mobile_button.position') || position;
256
- let mobileimgurl = util/* default.get */.Z.get(accountSetting, 'mobile_button.background_image_url');
257
- let mobilemaskurl = util/* default.get */.Z.get(accountSetting, 'mobile_button.background_mask_url');
258
+ imgsrc = util/* default */.Z.get(accountSetting, 'mobile_button.background_image_url') || util/* default */.Z.get(accountSetting, 'mobile_button.background_mask_url') || imgsrc;
259
+ position = util/* default */.Z.get(accountSetting, 'mobile_button.position') || position;
260
+ let mobileimgurl = util/* default */.Z.get(accountSetting, 'mobile_button.background_image_url');
261
+ let mobilemaskurl = util/* default */.Z.get(accountSetting, 'mobile_button.background_mask_url');
258
262
  if (mobileimgurl || mobilemaskurl) {
259
263
  imgurl = mobileimgurl;
260
264
  maskurl = mobilemaskurl;
@@ -350,14 +354,14 @@ class ChatButton extends common/* Com */.up {
350
354
  }
351
355
  renderMessagePreview(ev, defmsg) {
352
356
  defmsg = defmsg || 'Sent you a message';
353
- let message = util/* default.get */.Z.get(ev, 'data.message.text');
354
- var format = util/* default.get */.Z.get(ev, 'data.message.format');
357
+ let message = util/* default */.Z.get(ev, 'data.message.text');
358
+ var format = util/* default */.Z.get(ev, 'data.message.format');
355
359
  if (format === 'delta') return this.renderDeltaMessagePreview(ev, defmsg);
356
360
  if (format && format !== 'plaintext') message = defmsg;
357
- if (!message && util/* default.size */.Z.size(util/* default.get */.Z.get(ev, 'data.message.attachments')) > 0) message = defmsg;
361
+ if (!message && util/* default */.Z.size(util/* default */.Z.get(ev, 'data.message.attachments')) > 0) message = defmsg;
358
362
  if (!message) return null;
359
- let byType = util/* default.get */.Z.get(ev, 'by.type');
360
- var tags = util/* default.extractText */.Z.extractText(message).map(tag => {
363
+ let byType = util/* default */.Z.get(ev, 'by.type');
364
+ var tags = util/* default */.Z.extractText(message).map(tag => {
361
365
  if (tag.type === 'emoji') return (0,preact_module.h)(Emoji, {
362
366
  emojiCode: tag.text,
363
367
  byType: byType
@@ -368,17 +372,17 @@ class ChatButton extends common/* Com */.up {
368
372
  }
369
373
  renderDeltaMessagePreview(ev, defmsg) {
370
374
  defmsg = defmsg || 'Sent you a message';
371
- let message = util/* default.get */.Z.get(ev, 'data.message.quill_delta');
372
- if (!message && util/* default.size */.Z.size(util/* default.get */.Z.get(ev, 'data.message.attachments')) > 0) message = defmsg;
375
+ let message = util/* default */.Z.get(ev, 'data.message.quill_delta');
376
+ if (!message && util/* default */.Z.size(util/* default */.Z.get(ev, 'data.message.attachments')) > 0) message = defmsg;
373
377
  if (!message) return;
374
- let quilldeltas = util/* default.parseJSON */.Z.parseJSON(message) || {};
375
- if (!quilldeltas || util/* default.size */.Z.size(quilldeltas.ops) === 0) return null;
376
- let $deltas = util/* default.map */.Z.map(quilldeltas.ops, delta => {
378
+ let quilldeltas = util/* default */.Z.parseJSON(message) || {};
379
+ if (!quilldeltas || util/* default */.Z.size(quilldeltas.ops) === 0) return null;
380
+ let $deltas = util/* default */.Z.map(quilldeltas.ops, delta => {
377
381
  let html = '';
378
382
  let insert = delta.insert;
379
383
  let attributes = delta.attributes;
380
384
  if (insert.dynamicField) {
381
- return util/* default.get */.Z.get(insert, 'dynamicField.text', '');
385
+ return util/* default */.Z.get(insert, 'dynamicField.text', '');
382
386
  }
383
387
  if (insert.emoji) return (0,preact_module.h)(Emoji, {
384
388
  emojiCode: `:${insert.emoji}:`
@@ -403,8 +407,8 @@ class ChatButton extends common/* Com */.up {
403
407
  }
404
408
  }
405
409
  function randomAgent(agentM) {
406
- var agents = util/* default.filter */.Z.filter(agentM, ag => ag.type === 'agent');
407
- return agents[Math.floor(Math.random() * util/* default.size */.Z.size(agents))] || {};
410
+ var agents = util/* default */.Z.filter(agentM, ag => ag.type === 'agent');
411
+ return agents[Math.floor(Math.random() * util/* default */.Z.size(agents))] || {};
408
412
  }
409
413
  const Ms30Mins = 30 * 60 * 1000;
410
414
  const DEF_BG_URL = 'https://vcdn.subiz-cdn.com/file/bubble_11.svg?v=5';
@@ -420,20 +424,20 @@ class PoweredBy extends common/* Com */.up {
420
424
  render() {
421
425
  if (this.props.store.isMobile()) return null;
422
426
  let user = this.props.store.matchUser() || {};
423
- var link = `https://subiz.com.vn/?utm_source=id-${user.account_id}&utm_medium=widget&utm_campaign=widget_referral`;
427
+ var link = `https://subiz.com.vn/?utm_source=${window.location.host || `id-${user.account_id}`}&utm_medium=widget&utm_campaign=widget_referral`;
424
428
  return (0,preact_module.h)("div", {
425
429
  class: "poweredby"
426
430
  }, (0,preact_module.h)("a", {
427
431
  href: link,
428
432
  class: "poweredby--text",
429
433
  target: "_blank",
430
- rel: "noreferrer"
434
+ title: "Subiz"
431
435
  }, (0,preact_module.h)("img", {
432
436
  width: "14",
433
437
  height: "10",
434
438
  class: "poweredby--subiz-logo",
435
439
  src: logo,
436
- alt: "power by"
440
+ alt: "power by subiz"
437
441
  }), " Subiz"));
438
442
  }
439
443
  }
@@ -466,17 +470,17 @@ class AgentsAvatar extends common/* Com */.up {
466
470
  })));
467
471
  }
468
472
  let agentM = this.props.store.matchAgent('*');
469
- var agents = util/* default.map */.Z.map(this.props.agent_ids, id => agentM[id]);
470
- if (this.props.agent_ids === undefined || util/* default.size */.Z.size(this.props.agent_ids) === 0) {
471
- var agids = util/* default.get */.Z.get(accountSetting, 'header.agent_ids', []);
472
- agids = util/* default.filter */.Z.filter(agids, id => !!agentM[id]);
473
+ var agents = util/* default */.Z.map(this.props.agent_ids, id => agentM[id]);
474
+ if (this.props.agent_ids === undefined || util/* default */.Z.size(this.props.agent_ids) === 0) {
475
+ var agids = util/* default */.Z.get(accountSetting, 'header.agent_ids', []);
476
+ agids = util/* default */.Z.filter(agids, id => !!agentM[id]);
473
477
  if (agids.length !== 0) {
474
- agents = util/* default.map */.Z.map(agids, id => agentM[id]);
478
+ agents = util/* default */.Z.map(agids, id => agentM[id]);
475
479
  } else {
476
- agents = util/* default.filter */.Z.filter(agentM, agent => agent.type === 'agent');
480
+ agents = util/* default */.Z.filter(agentM, agent => agent.type === 'agent');
477
481
  }
478
482
  }
479
- agents = util/* default.filter */.Z.filter(agents, ag => !!ag);
483
+ agents = util/* default */.Z.filter(agents, ag => !!ag);
480
484
  if (agents.length === 0) {
481
485
  return (0,preact_module.h)("div", {
482
486
  class: `group-avatar group-avatar--${mode}`
@@ -590,7 +594,7 @@ class Header extends common/* Com */.up {
590
594
  let renderSocial = false;
591
595
  let renderTeam = false;
592
596
  let accSetting = this.props.plugin.chatbox || {};
593
- let layout = util/* default.get */.Z.get(accSetting, 'header.layout');
597
+ let layout = util/* default */.Z.get(accSetting, 'header.layout');
594
598
  let renderCollapsed = this.props.view !== 'list' && headerMode === 'collapsed';
595
599
  let renderClassic = !renderCollapsed && layout === 'classic';
596
600
  if (renderCollapsed || layout == 'classic') {
@@ -608,9 +612,9 @@ class Header extends common/* Com */.up {
608
612
  let accSetting = this.props.plugin.chatbox || {};
609
613
  let acc = this.props.store.matchAccount() || {};
610
614
  let state = acc.is_online ? this.props.t('agent_online') : this.props.t('agent_offline');
611
- let tagline = util/* default.get */.Z.get(accSetting, `tagline`, {});
615
+ let tagline = util/* default */.Z.get(accSetting, `tagline`, {});
612
616
  let desc = this.props.t.i18n(tagline) || accSetting.introduction || state;
613
- let agentIdsJoined = util/* default.map */.Z.map(this.getAgentJoined(this.props.cid), agent => agent.id);
617
+ let agentIdsJoined = util/* default */.Z.map(this.getAgentJoined(this.props.cid), agent => agent.id);
614
618
  let cls = 'widget-header--inner widget-header--inner--collapsed';
615
619
  if (!show) cls += ' widget-header--inner--hidden';
616
620
  let $back = null;
@@ -636,8 +640,8 @@ class Header extends common/* Com */.up {
636
640
  renderSocial(show) {
637
641
  let accSetting = this.props.plugin.chatbox || {};
638
642
  let acc = this.props.store.matchAccount() || {};
639
- let links = util/* default.get */.Z.get(accSetting, 'header.links') || [];
640
- let $links = util/* default.map */.Z.map(links, link => {
643
+ let links = util/* default */.Z.get(accSetting, 'header.links') || [];
644
+ let $links = util/* default */.Z.map(links, link => {
641
645
  if (!link.url || !link.type || link.type === 'subiz') return null;
642
646
  if (link.type === 'email') {
643
647
  return (0,preact_module.h)("div", null, (0,preact_module.h)("a", {
@@ -650,17 +654,16 @@ class Header extends common/* Com */.up {
650
654
  return (0,preact_module.h)("div", null, (0,preact_module.h)("a", {
651
655
  href: link.url,
652
656
  target: "_blank",
653
- title: link.url,
654
- rel: "noreferrer"
657
+ title: link.url
655
658
  }, (0,preact_module.h)("i", {
656
659
  class: `social__links-logo social__links-logo--${link.type}`
657
660
  })));
658
661
  });
659
662
  const DEFTEAMINTO = `Chúng tôi sẵn sàng trợ giúp :wave:.
660
663
  Vui lòng hỏi chúng tôi bất cứ điều gì hoặc chia sẻ phản hồi của bạn`;
661
- let tagline = util/* default.get */.Z.get(accSetting, `tagline`, {});
664
+ let tagline = util/* default */.Z.get(accSetting, `tagline`, {});
662
665
  var teamintro = this.props.t.i18n(tagline) || accSetting.introduction || this.props.t('team_intro') || DEFTEAMINTO;
663
- var tags = util/* default.extractText */.Z.extractText(teamintro).map(tag => {
666
+ var tags = util/* default */.Z.extractText(teamintro).map(tag => {
664
667
  if (tag.type === 'emoji') return (0,preact_module.h)(Emoji, {
665
668
  emojiCode: tag.text
666
669
  });
@@ -681,7 +684,7 @@ Vui lòng hỏi chúng tôi bất cứ điều gì hoặc chia sẻ phản hồi
681
684
  }, (0,preact_module.h)("img", {
682
685
  alt: "logo",
683
686
  class: "social__account_logo",
684
- src: this.props.store.replaceFileUrl(util/* default.get */.Z.get(acc, 'logo_url'))
687
+ src: this.props.store.replaceFileUrl(util/* default */.Z.get(acc, 'logo_url'))
685
688
  }), (0,preact_module.h)("div", null, (0,preact_module.h)("div", {
686
689
  class: "social__introduction"
687
690
  }, tags), (0,preact_module.h)("div", {
@@ -692,9 +695,9 @@ Vui lòng hỏi chúng tôi bất cứ điều gì hoặc chia sẻ phản hồi
692
695
  let accSetting = this.props.plugin.chatbox || {};
693
696
  const DEFTEAMINTO = `Chúng tôi sẵn sàng trợ giúp :wave:.
694
697
  Vui lòng hỏi chúng tôi bất cứ điều gì hoặc chia sẻ phản hồi của bạn`;
695
- let tagline = util/* default.get */.Z.get(accSetting, `tagline`, {});
698
+ let tagline = util/* default */.Z.get(accSetting, `tagline`, {});
696
699
  var teamintro = this.props.t.i18n(tagline) || accSetting.introduction || this.props.t('team_intro') || DEFTEAMINTO;
697
- var tags = util/* default.extractText */.Z.extractText(teamintro).map(tag => {
700
+ var tags = util/* default */.Z.extractText(teamintro).map(tag => {
698
701
  if (tag.type === 'emoji') return (0,preact_module.h)(Emoji, {
699
702
  emojiCode: tag.text
700
703
  });
@@ -728,19 +731,19 @@ Vui lòng hỏi chúng tôi bất cứ điều gì hoặc chia sẻ phản hồi
728
731
  let accSetting = this.props.plugin.chatbox || {};
729
732
  let acc = this.props.store.matchAccount() || {};
730
733
  let agentsJoined = this.getAgentJoined(this.props.cid);
731
- let caption = util/* default.get */.Z.get(this.props.plugin, 'chatbox.caption', {});
734
+ let caption = util/* default */.Z.get(this.props.plugin, 'chatbox.caption', {});
732
735
  let title = this.props.t.i18n(caption) || accSetting.title;
733
736
  return getJoinedNameMember(agentsJoined) || title || acc.name || this.props.t('widget_title');
734
737
  }
735
738
  renderBackButton() {
736
739
  let allconvos = this.props.store.matchConvo('*');
737
- if (util/* default.size */.Z.size(allconvos) === 0) return null;
740
+ if (util/* default */.Z.size(allconvos) === 0) return null;
738
741
  var $unreadcount = null;
739
742
  let user = this.props.store.matchUser();
740
743
  let unreadcount = 0;
741
- util/* default.map */.Z.map(allconvos, convo => {
744
+ util/* default */.Z.map(allconvos, convo => {
742
745
  if (convo.id == this.props.cid) return;
743
- if (!util/* default.isConvoSeen */.Z.isConvoSeen(convo, user.id)) unreadcount++;
746
+ if (!util/* default */.Z.isConvoSeen(convo, user.id)) unreadcount++;
744
747
  });
745
748
  if (unreadcount !== 0) {
746
749
  $unreadcount = (0,preact_module.h)("span", {
@@ -779,19 +782,19 @@ Vui lòng hỏi chúng tôi bất cứ điều gì hoặc chia sẻ phản hồi
779
782
  }
780
783
  getAgentJoined(cid) {
781
784
  var convo = this.props.store.matchConvo(cid) || {};
782
- let joined = util/* default.filter */.Z.filter(convo.members, mem => mem.type === 'agent' && mem.membership === 'active');
785
+ let joined = util/* default */.Z.filter(convo.members, mem => mem.type === 'agent' && mem.membership === 'active');
783
786
  return joined;
784
787
  }
785
788
  }
786
789
  let getJoinedNameMember = agents => {
787
- agents = util/* default.filter */.Z.filter(agents, agent => util/* default.trim */.Z.trim(agent.fullname));
790
+ agents = util/* default */.Z.filter(agents, agent => util/* default */.Z.trim(agent.fullname));
788
791
  if (!agents.length) return null;
789
- return util/* default.map */.Z.map(agents, agent => agent.fullname).join(', ');
792
+ return util/* default */.Z.map(agents, agent => agent.fullname).join(', ');
790
793
  };
791
794
  ;// CONCATENATED MODULE: ./src/chatbox/MessageInput.js
792
795
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
793
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
794
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
796
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
797
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
795
798
 
796
799
 
797
800
 
@@ -799,22 +802,22 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
799
802
  class MessageInput extends common/* Com */.up {
800
803
  constructor(props) {
801
804
  super(props);
802
- _defineProperty(this, "onEnter", util/* default.throttle */.Z.throttle(function () {
805
+ _defineProperty(this, "onEnter", util/* default */.Z.throttle(function () {
803
806
  this.submitMessage();
804
807
  }, 50));
805
808
  this.refFileInput = (0,preact_module/* createRef */.Vf)();
806
809
  this.refMessageInput = (0,preact_module/* createRef */.Vf)();
807
810
  this.props.store.onUpdate(this, _ => this.forceUpdate());
808
811
  this.props.store.onConvoEvent(this, ev => {
809
- var evcid = util/* default.convoOfEv */.Z.convoOfEv(ev);
812
+ var evcid = util/* default */.Z.convoOfEv(ev);
810
813
  if (evcid !== this.props.cid) return;
811
814
  this.forceUpdate();
812
815
  });
813
816
  this.focus();
814
- this._forceUpdate = util/* default.throttle */.Z.throttle(() => {
817
+ this._forceUpdate = util/* default */.Z.throttle(() => {
815
818
  this.forceUpdate();
816
819
  }, 500);
817
- this.resizeInput = util/* default.throttle */.Z.throttle(function () {
820
+ this.resizeInput = util/* default */.Z.throttle(function () {
818
821
  const input = this.refMessageInput.current;
819
822
  input.style.setProperty('height', '1em', 'important');
820
823
  const height = Math.min(200, input.scrollHeight);
@@ -834,7 +837,7 @@ class MessageInput extends common/* Com */.up {
834
837
  class: "message-input--button message-input--attachment-button",
835
838
  onClick: e => this.selectFile(e)
836
839
  }));
837
- var msg = util/* default.trim */.Z.trim(this.refMessageInput.current && this.refMessageInput.current.value);
840
+ var msg = util/* default */.Z.trim(this.refMessageInput.current && this.refMessageInput.current.value);
838
841
  if (msg.length > 0) {
839
842
  buttons = (0,preact_module.h)("div", {
840
843
  class: "d-flex flex-row align-self-end"
@@ -873,30 +876,30 @@ class MessageInput extends common/* Com */.up {
873
876
  }
874
877
  hasUnfinishRequiredFormOrLock() {
875
878
  let convo = this.props.store.matchConvo(this.props.cid);
876
- if (util/* default.get */.Z.get(convo, 'state') === 'ended') return false;
879
+ if (util/* default */.Z.get(convo, 'state') === 'ended') return false;
877
880
  let events = this.props.store.listEvents(this.props.cid);
878
- events = util/* default.orderBy */.Z.orderBy(events, 'created', 'desc').filter(ev => ev.type === 'message_sent');
879
- let attachments = util/* default.get */.Z.get(events[0], 'data.message.attachments', []);
880
- let lock = util/* default.find */.Z.find(attachments, att => util/* default.get */.Z.get(att, 'lock_input'));
881
+ events = util/* default */.Z.orderBy(events, 'created', 'desc').filter(ev => ev.type === 'message_sent');
882
+ let attachments = util/* default */.Z.get(events[0], 'data.message.attachments', []);
883
+ let lock = util/* default */.Z.find(attachments, att => util/* default */.Z.get(att, 'lock_input'));
881
884
  if (lock) return true;
882
885
  var last_agent_sent;
883
886
  for (let ev of events) {
884
- if (util/* default.get */.Z.get(ev, 'by.type') === 'user') continue;
887
+ if (util/* default */.Z.get(ev, 'by.type') === 'user') continue;
885
888
  last_agent_sent = ev;
886
889
  break;
887
890
  }
888
- attachments = util/* default.get */.Z.get(last_agent_sent, 'data.message.attachments', []);
889
- let pendingForms = util/* default.filter */.Z.filter(attachments, att => {
891
+ attachments = util/* default */.Z.get(last_agent_sent, 'data.message.attachments', []);
892
+ let pendingForms = util/* default */.Z.filter(attachments, att => {
890
893
  if (!att) return false;
891
894
  if (att.type !== 'form' && att.type !== 'ask_info_form') return false;
892
895
  var form = att.form;
893
896
  if (!form) return false;
894
- var state = util/* default.parseJSON */.Z.parseJSON(form.state) || {};
897
+ var state = util/* default */.Z.parseJSON(form.state) || {};
895
898
  if (!state.require_finished && att.type !== 'ask_info_form') return false;
896
899
  if (isSummited(att.form)) return false;
897
900
  return true;
898
901
  });
899
- return util/* default.size */.Z.size(pendingForms) > 0;
902
+ return util/* default */.Z.size(pendingForms) > 0;
900
903
  }
901
904
  renderEmojiPopup() {
902
905
  if (!this.state.openEmoji) return null;
@@ -1000,10 +1003,10 @@ class MessageInput extends common/* Com */.up {
1000
1003
  focus() {
1001
1004
  if (this.props.disabled) return;
1002
1005
  this.refMessageInput.current && this.refMessageInput.current.focus();
1003
- util/* default.setTimeout */.Z.setTimeout(() => {
1006
+ util/* default */.Z.setTimeout(() => {
1004
1007
  this.refMessageInput.current && this.refMessageInput.current.focus();
1005
1008
  });
1006
- util/* default.setTimeout */.Z.setTimeout(() => {
1009
+ util/* default */.Z.setTimeout(() => {
1007
1010
  this.refMessageInput.current && this.refMessageInput.current.focus();
1008
1011
  }, 100);
1009
1012
  }
@@ -1053,9 +1056,9 @@ class MessageInput extends common/* Com */.up {
1053
1056
  $input.value = '';
1054
1057
  }
1055
1058
  _sendFile(files) {
1056
- if (util/* default.size */.Z.size(files) === 0) return;
1059
+ if (util/* default */.Z.size(files) === 0) return;
1057
1060
  if (this.props.disabled) return;
1058
- let attachments = util/* default.map */.Z.map(files, file => {
1061
+ let attachments = util/* default */.Z.map(files, file => {
1059
1062
  return {
1060
1063
  type: 'file',
1061
1064
  mimetype: file.type,
@@ -1069,7 +1072,7 @@ class MessageInput extends common/* Com */.up {
1069
1072
  });
1070
1073
  }
1071
1074
  async submitMessage(msg) {
1072
- msg = msg || util/* default.trim */.Z.trim(this.refMessageInput.current.value) || '';
1075
+ msg = msg || util/* default */.Z.trim(this.refMessageInput.current.value) || '';
1073
1076
  if (!msg) return;
1074
1077
  if (this.props.disabled) return;
1075
1078
  this.refMessageInput.current.value = '';
@@ -1088,7 +1091,7 @@ class MessageInput extends common/* Com */.up {
1088
1091
  }
1089
1092
  pasteImage(event) {
1090
1093
  if (!window.File || !window.FileReader || !window.FileList || !window.Blob) return;
1091
- let now = new util/* default.Date */.Z.Date();
1094
+ let now = new util/* default */.Z.Date();
1092
1095
  let year = now.getFullYear();
1093
1096
  let month = now.getMonth() + 1;
1094
1097
  let date = now.getDate();
@@ -1110,24 +1113,124 @@ class MessageInput extends common/* Com */.up {
1110
1113
  }
1111
1114
  }
1112
1115
  function isSummited(form) {
1113
- let fields = util/* default.get */.Z.get(form, 'fields') || [];
1114
- return util/* default.find */.Z.find(fields, field => !!field.answered);
1116
+ let fields = util/* default */.Z.get(form, 'fields') || [];
1117
+ return util/* default */.Z.find(fields, field => !!field.answered);
1115
1118
  }
1116
1119
  ;// CONCATENATED MODULE: ./src/chatbox/ImageAttachments.js
1120
+ 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; }
1121
+ function ImageAttachments_toPropertyKey(t) { var i = ImageAttachments_toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
1122
+ function ImageAttachments_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1117
1123
 
1118
1124
 
1119
1125
 
1120
1126
  class ImageAttachment extends common/* Com */.up {
1121
1127
  constructor(props) {
1122
1128
  super(props);
1129
+ ImageAttachments_defineProperty(this, "containerRef", (0,preact_module/* createRef */.Vf)());
1130
+ this.setState({
1131
+ ready: false,
1132
+ errorIndecies: []
1133
+ });
1134
+ }
1135
+ componentDidMount() {
1136
+ this.setImageFrameDimension();
1137
+ }
1138
+ setImageFrameDimension() {
1139
+ const MAX_HEIGHT = 240;
1140
+ const DEFAULT_MAX_WIDTH = 267;
1141
+ let $container = this.containerRef.current;
1142
+ this.frameWidth = $container ? $container.offsetWidth : DEFAULT_MAX_WIDTH;
1143
+ this.frameHeight = MAX_HEIGHT;
1144
+ this.setState({
1145
+ ready: true
1146
+ });
1147
+ }
1148
+ onErrorImage(index) {
1149
+ let indecies = this.state.errorIndecies || [];
1150
+ indecies.push(index);
1151
+ indecies = [...indecies];
1152
+ this.setState({
1153
+ errorIndecies: indecies
1154
+ });
1155
+ }
1156
+ calculateImageDimension(image) {
1157
+ if (!image.width || !image.height) return {
1158
+ width: this.frameWidth,
1159
+ height: this.frameHeight
1160
+ };
1161
+ let ratio = image.width / image.height - this.frameWidth / this.frameHeight;
1162
+ if (ratio >= 0) {
1163
+ let width = this.frameWidth;
1164
+ let height = image.height * this.frameWidth / image.width;
1165
+ height = Math.round(height);
1166
+ return {
1167
+ width,
1168
+ height
1169
+ };
1170
+ } else {
1171
+ let height = this.frameHeight;
1172
+ let width = image.width * this.frameHeight / image.height;
1173
+ width = Math.round(width);
1174
+ return {
1175
+ width,
1176
+ height
1177
+ };
1178
+ }
1179
+ }
1180
+ renderImage(image, index) {
1181
+ if (!this.state.ready) {
1182
+ return;
1183
+ }
1184
+ let byType = util/* default */.Z.get(this.props.ev, 'by.type');
1185
+ if (!image.width || !image.height) {
1186
+ return (0,preact_module.h)("div", {
1187
+ class: `image-attachment image-attachment--${byType}`
1188
+ }, (0,preact_module.h)("a", {
1189
+ href: this.props.store.replaceFileUrl(image.url),
1190
+ target: "_blank"
1191
+ }, (0,preact_module.h)("img", {
1192
+ alt: true,
1193
+ class: "image-attachment__img",
1194
+ src: this.props.store.replaceFileUrl(image.thumbnail_url || image.url),
1195
+ onload: e => this.props.onLoad && this.props.onLoad()
1196
+ })));
1197
+ }
1198
+ let {
1199
+ width,
1200
+ height
1201
+ } = this.calculateImageDimension(image);
1202
+ let url = this.props.store.replaceFileUrl(image.thumbnail_url || image.url);
1203
+ let trueUrl = this.props.store.replaceFileUrl(image.url);
1204
+ if (this.state.errorIndecies.includes(index)) {
1205
+ url = __webpack_require__(9270);
1206
+ trueUrl = url;
1207
+ }
1208
+ return (0,preact_module.h)("div", {
1209
+ class: `image-attachment image-attachment--${byType}`
1210
+ }, (0,preact_module.h)("a", {
1211
+ href: trueUrl,
1212
+ target: "_blank"
1213
+ }, (0,preact_module.h)("img", {
1214
+ alt: true,
1215
+ ref: el => {
1216
+ if (el) {
1217
+ el.style.setProperty('width', `${width}px`, 'important');
1218
+ el.style.setProperty('height', `${height}px`, 'important');
1219
+ }
1220
+ },
1221
+ class: "image-attachment__img",
1222
+ src: url,
1223
+ onload: e => this.props.onLoad && this.props.onLoad(),
1224
+ onerror: e => this.onErrorImage(index)
1225
+ })));
1123
1226
  }
1124
1227
  render() {
1125
- var attachments = util/* default.get */.Z.get(this.props.ev, 'data.message.attachments', []);
1228
+ var attachments = util/* default */.Z.get(this.props.ev, 'data.message.attachments', []);
1126
1229
  var images = [];
1127
- let byType = util/* default.get */.Z.get(this.props.ev, 'by.type');
1128
- util/* default.each */.Z.each(attachments, (att, i) => {
1230
+ let byType = util/* default */.Z.get(this.props.ev, 'by.type');
1231
+ util/* default */.Z.each(attachments, (att, i) => {
1129
1232
  if (!att) return;
1130
- if (!util/* default.includes */.Z.includes(att.mimetype, 'image')) return;
1233
+ if (!util/* default */.Z.includes(att.mimetype, 'image')) return;
1131
1234
  if (!att.url) return;
1132
1235
  var uri = att.url;
1133
1236
  if (!uri.startsWith('https://') && !uri.startsWith('http://') && !uri.startsWith('content://') && !uri.startsWith('data:')) {
@@ -1136,24 +1239,16 @@ class ImageAttachment extends common/* Com */.up {
1136
1239
  images.push(att);
1137
1240
  });
1138
1241
  if (images.length === 0) return null;
1139
- var $images = util/* default.map */.Z.map(images, (image, index) => (0,preact_module.h)("div", {
1140
- class: `image-attachment image-attachment--${byType}`
1141
- }, (0,preact_module.h)("a", {
1142
- href: this.props.store.replaceFileUrl(image.thumbnail_url || image.url),
1143
- target: "_blank"
1144
- }, (0,preact_module.h)("img", {
1145
- alt: true,
1146
- class: "image-attachment__img",
1147
- src: this.props.store.replaceFileUrl(image.thumbnail_url || image.url),
1148
- onload: e => this.props.onLoad && this.props.onLoad()
1149
- }))));
1242
+ let $images = util/* default */.Z.map(images, (image, index) => this.renderImage(image, index));
1150
1243
  if (byType === 'agent') {
1151
1244
  return (0,preact_module.h)("div", {
1152
- class: "message-agent"
1245
+ class: "message-agent",
1246
+ ref: this.containerRef
1153
1247
  }, $images);
1154
1248
  } else {
1155
1249
  return (0,preact_module.h)("div", {
1156
- class: "message-user"
1250
+ class: "message-user message-user-images-container",
1251
+ ref: this.containerRef
1157
1252
  }, $images);
1158
1253
  }
1159
1254
  }
@@ -1167,15 +1262,15 @@ class AudioAttachments extends common/* Com */.up {
1167
1262
  super(props);
1168
1263
  }
1169
1264
  render() {
1170
- let byType = util/* default.get */.Z.get(this.props.ev, 'by.type');
1171
- var attachments = util/* default.get */.Z.get(this.props.ev, 'data.message.attachments', []);
1265
+ let byType = util/* default */.Z.get(this.props.ev, 'by.type');
1266
+ var attachments = util/* default */.Z.get(this.props.ev, 'data.message.attachments', []);
1172
1267
  var audios = [];
1173
- util/* default.each */.Z.each(attachments, (att, i) => {
1268
+ util/* default */.Z.each(attachments, (att, i) => {
1174
1269
  if (!att) return;
1175
- if (util/* default.includes */.Z.includes(att.mimetype, 'audio')) audios.push(att);
1270
+ if (util/* default */.Z.includes(att.mimetype, 'audio')) audios.push(att);
1176
1271
  });
1177
1272
  if (audios.length === 0) return null;
1178
- var $audios = util/* default.map */.Z.map(audios, (audio, index) => {
1273
+ var $audios = util/* default */.Z.map(audios, (audio, index) => {
1179
1274
  return (0,preact_module.h)("div", {
1180
1275
  key: index,
1181
1276
  class: `audio-attachment audio-attachment--${byType}`
@@ -1198,18 +1293,18 @@ class AudioAttachments extends common/* Com */.up {
1198
1293
 
1199
1294
  class FileAttachments extends common/* Com */.up {
1200
1295
  render() {
1201
- var byType = util/* default.get */.Z.get(this.props.ev, 'by.type', 'agent');
1202
- var attachments = util/* default.get */.Z.get(this.props.ev, 'data.message.attachments', []);
1296
+ var byType = util/* default */.Z.get(this.props.ev, 'by.type', 'agent');
1297
+ var attachments = util/* default */.Z.get(this.props.ev, 'data.message.attachments', []);
1203
1298
  var files = [];
1204
- util/* default.each */.Z.each(attachments, att => {
1299
+ util/* default */.Z.each(attachments, att => {
1205
1300
  if (!att) return;
1206
1301
  if (!att.url && !att._file) return;
1207
- if (!util/* default.includes */.Z.includes(att.mimetype, 'video') && !util/* default.includes */.Z.includes(att.mimetype, 'audio') && !util/* default.includes */.Z.includes(att.mimetype, 'image') && att.type !== 'button' && att.type !== 'quick_replies' && att.type !== 'form' && att.type !== 'form_submit') {
1302
+ if (!util/* default */.Z.includes(att.mimetype, 'video') && !util/* default */.Z.includes(att.mimetype, 'audio') && !util/* default */.Z.includes(att.mimetype, 'image') && att.type !== 'button' && att.type !== 'quick_replies' && att.type !== 'form' && att.type !== 'form_submit') {
1208
1303
  files.push(att);
1209
1304
  }
1210
1305
  });
1211
1306
  if (files.length === 0) return null;
1212
- var $files = util/* default.map */.Z.map(files, (file, index) => {
1307
+ var $files = util/* default */.Z.map(files, (file, index) => {
1213
1308
  return (0,preact_module.h)("div", {
1214
1309
  key: index,
1215
1310
  class: `file-attachment file-attachment--${byType}`
@@ -1237,8 +1332,8 @@ class Buttons extends common/* Com */.up {
1237
1332
  super(props);
1238
1333
  }
1239
1334
  render() {
1240
- if (util/* default.size */.Z.size(this.props.buttons) === 0) return null;
1241
- var $buttons = util/* default.map */.Z.map(this.props.buttons, (button, index) => {
1335
+ if (util/* default */.Z.size(this.props.buttons) === 0) return null;
1336
+ var $buttons = util/* default */.Z.map(this.props.buttons, (button, index) => {
1242
1337
  if (button.type === 'call_button') {
1243
1338
  return (0,preact_module.h)("a", {
1244
1339
  class: "url-button-attachment",
@@ -1282,13 +1377,13 @@ class ButtonAttachments extends common/* Com */.up {
1282
1377
  super(props);
1283
1378
  }
1284
1379
  render() {
1285
- let byType = util/* default.get */.Z.get(this.props.ev, 'by.type');
1380
+ let byType = util/* default */.Z.get(this.props.ev, 'by.type');
1286
1381
  if (byType === 'user') return null;
1287
1382
  let buttons = [];
1288
- let attachments = util/* default.get */.Z.get(this.props.ev, 'data.message.attachments', []);
1289
- util/* default.each */.Z.each(attachments, (att, i) => {
1290
- if (!att || util/* default.get */.Z.get(att, 'type') !== 'button') return;
1291
- util/* default.each */.Z.each(util/* default.get */.Z.get(att, 'buttons') || [], btn => buttons.push(btn));
1383
+ let attachments = util/* default */.Z.get(this.props.ev, 'data.message.attachments', []);
1384
+ util/* default */.Z.each(attachments, (att, i) => {
1385
+ if (!att || util/* default */.Z.get(att, 'type') !== 'button') return;
1386
+ util/* default */.Z.each(util/* default */.Z.get(att, 'buttons') || [], btn => buttons.push(btn));
1292
1387
  });
1293
1388
  return (0,preact_module.h)(Buttons, {
1294
1389
  store: this.props.store,
@@ -1306,21 +1401,21 @@ class QuickReplies extends common/* Com */.up {
1306
1401
  super(props);
1307
1402
  }
1308
1403
  render() {
1309
- if (util/* default.get */.Z.get(this.props.ev, 'by.type') === 'user') return null;
1404
+ if (util/* default */.Z.get(this.props.ev, 'by.type') === 'user') return null;
1310
1405
  let quickreplies = [];
1311
- util/* default.map */.Z.map(util/* default.get */.Z.get(this.props.ev, 'data.message.attachments', []), att => {
1406
+ util/* default */.Z.map(util/* default */.Z.get(this.props.ev, 'data.message.attachments', []), att => {
1312
1407
  if (!att) return;
1313
1408
  if (att.type === 'quick_replies') {
1314
- quickreplies = util/* default.get */.Z.get(att, 'quick_replies', []);
1409
+ quickreplies = util/* default */.Z.get(att, 'quick_replies', []);
1315
1410
  }
1316
1411
  });
1317
- quickreplies = util/* default.filter */.Z.filter(quickreplies, r => r.title);
1412
+ quickreplies = util/* default */.Z.filter(quickreplies, r => r.title);
1318
1413
  if (quickreplies.length === 0) return null;
1319
- let cid = util/* default.convoOfEv */.Z.convoOfEv(this.props.ev);
1414
+ let cid = util/* default */.Z.convoOfEv(this.props.ev);
1320
1415
  let convo = this.props.store.matchConvo(cid);
1321
- if (util/* default.get */.Z.get(convo, 'state') === 'ended') return null;
1322
- let events = util/* default.map */.Z.map(this.props.store.listEvents(cid));
1323
- events = util/* default.orderBy */.Z.orderBy(events, 'created', 'asc').filter(ev => ev.type === 'message_sent');
1416
+ if (util/* default */.Z.get(convo, 'state') === 'ended') return null;
1417
+ let events = util/* default */.Z.map(this.props.store.listEvents(cid));
1418
+ events = util/* default */.Z.orderBy(events, 'created', 'asc').filter(ev => ev.type === 'message_sent');
1324
1419
  let evindex = 0;
1325
1420
  for (var i = 0; i < events.length; i++) {
1326
1421
  if (events[i].id === this.props.ev.id) {
@@ -1329,9 +1424,9 @@ class QuickReplies extends common/* Com */.up {
1329
1424
  }
1330
1425
  }
1331
1426
  for (var i = evindex + 1; i < events.length; i++) {
1332
- if (util/* default.get */.Z.get(events[i], 'by.type') === 'user') return null;
1427
+ if (util/* default */.Z.get(events[i], 'by.type') === 'user') return null;
1333
1428
  }
1334
- let $replies = util/* default.map */.Z.map(quickreplies, r => (0,preact_module.h)("div", {
1429
+ let $replies = util/* default */.Z.map(quickreplies, r => (0,preact_module.h)("div", {
1335
1430
  class: "message_quick_reply",
1336
1431
  onClick: e => this.props.onSelect(r)
1337
1432
  }, r.title));
@@ -1353,18 +1448,18 @@ class ListField extends common/* Com */.up {
1353
1448
  });
1354
1449
  }
1355
1450
  render() {
1356
- let fields = util/* default.filter */.Z.filter(this.props.items, item => {
1451
+ let fields = util/* default */.Z.filter(this.props.items, item => {
1357
1452
  let search = this.state.search.toLowerCase();
1358
1453
  let name = item || '';
1359
1454
  return name.toLowerCase().indexOf(search) > -1;
1360
1455
  });
1361
- let $fields = util/* default.map */.Z.map(fields, field => {
1456
+ let $fields = util/* default */.Z.map(fields, field => {
1362
1457
  return (0,preact_module.h)("li", {
1363
1458
  class: "custom-select--item-options",
1364
1459
  onClick: () => this.add(field)
1365
1460
  }, field);
1366
1461
  });
1367
- let $selected = util/* default.map */.Z.map(this.props.selected, (item, i) => {
1462
+ let $selected = util/* default */.Z.map(this.props.selected, (item, i) => {
1368
1463
  return (0,preact_module.h)("div", {
1369
1464
  class: "custom-select--selected-item",
1370
1465
  onClick: e => this.remove(e, i)
@@ -1445,16 +1540,16 @@ class FormAttachment extends common/* Com */.up {
1445
1540
  super(props);
1446
1541
  this.props.store.onUpdate(this, _ => this.forceUpdate());
1447
1542
  let user = this.props.store.matchUser();
1448
- let fields = util/* default.get */.Z.get(this.props.form, 'fields') || [];
1449
- let formData = util/* default.map */.Z.map(fields, field => {
1543
+ let fields = util/* default */.Z.get(this.props.form, 'fields') || [];
1544
+ let formData = util/* default */.Z.map(fields, field => {
1450
1545
  let is_required = field.is_required || false;
1451
- var state = util/* default.parseJSON */.Z.parseJSON(field.state) || {};
1546
+ var state = util/* default */.Z.parseJSON(field.state) || {};
1452
1547
  if (!is_required) is_required = state.require || false;
1453
- var userattr = util/* default.getUserAttr */.Z.getUserAttr(user, field.name, state.type || 'text');
1548
+ var userattr = util/* default */.Z.getUserAttr(user, field.name, state.type || 'text');
1454
1549
  return {
1455
1550
  name: field.name,
1456
1551
  items: field.items,
1457
- value: util/* default.parseJSON */.Z.parseJSON(field.answer) || util/* default.parseJSON */.Z.parseJSON(field.default_answer) || userattr,
1552
+ value: util/* default */.Z.parseJSON(field.answer) || util/* default */.Z.parseJSON(field.default_answer) || userattr,
1458
1553
  is_required,
1459
1554
  label: field.title,
1460
1555
  type: field.input_type
@@ -1465,13 +1560,13 @@ class FormAttachment extends common/* Com */.up {
1465
1560
  });
1466
1561
  }
1467
1562
  isSummited() {
1468
- let found = util/* default.find */.Z.find(this.state.formData, field => !!field.answered);
1563
+ let found = util/* default */.Z.find(this.state.formData, field => !!field.answered);
1469
1564
  if (found) return true;
1470
- let convo = this.props.store.matchConvo(util/* default.convoOfEv */.Z.convoOfEv(this.props.ev));
1565
+ let convo = this.props.store.matchConvo(util/* default */.Z.convoOfEv(this.props.ev));
1471
1566
  return convo.state === 'ended';
1472
1567
  }
1473
1568
  render() {
1474
- if (util/* default.size */.Z.size(this.state.formData) === 0) return null;
1569
+ if (util/* default */.Z.size(this.state.formData) === 0) return null;
1475
1570
  let $fields = this.renderFields();
1476
1571
  let $submitbutton = null;
1477
1572
  if (!this.isSummited()) {
@@ -1490,11 +1585,11 @@ class FormAttachment extends common/* Com */.up {
1490
1585
  }
1491
1586
  focus() {
1492
1587
  if (this.props.store.isPreview) return;
1493
- if (util/* default.size */.Z.size(this.state.formData) === 0) return;
1588
+ if (util/* default */.Z.size(this.state.formData) === 0) return;
1494
1589
  let $field;
1495
1590
  if (this.isFormFilled()) {
1496
1591
  var keys = Object.keys(this.state.formData);
1497
- var lastkey = keys[util/* default.size */.Z.size(keys) - 1];
1592
+ var lastkey = keys[util/* default */.Z.size(keys) - 1];
1498
1593
  var lastfield = this.state.formData[lastkey];
1499
1594
  $field = this['field.' + encode(lastfield.name)];
1500
1595
  } else {
@@ -1505,20 +1600,20 @@ class FormAttachment extends common/* Com */.up {
1505
1600
  if ($field) $field.focus();
1506
1601
  }
1507
1602
  firstUnfilledField() {
1508
- return util/* default.find */.Z.find(this.state.formData, field => field.value == null || field.value === '');
1603
+ return util/* default */.Z.find(this.state.formData, field => field.value == null || field.value === '');
1509
1604
  }
1510
1605
  isFormFilled() {
1511
- return !util/* default.find */.Z.find(this.state.formData, field => field.value == null || field.value === '');
1606
+ return !util/* default */.Z.find(this.state.formData, field => field.value == null || field.value === '');
1512
1607
  }
1513
1608
  onInputChange(index, val) {
1514
- let formData = util/* default.cloneDeep */.Z.cloneDeep(this.state.formData);
1609
+ let formData = util/* default */.Z.cloneDeep(this.state.formData);
1515
1610
  formData[index].value = val;
1516
1611
  this.setState({
1517
1612
  formData
1518
1613
  });
1519
1614
  }
1520
1615
  onListAddItem(index, val) {
1521
- let formData = util/* default.cloneDeep */.Z.cloneDeep(this.state.formData);
1616
+ let formData = util/* default */.Z.cloneDeep(this.state.formData);
1522
1617
  let field = formData[index];
1523
1618
  field.value = field.value || [];
1524
1619
  field.value.push(val);
@@ -1527,7 +1622,7 @@ class FormAttachment extends common/* Com */.up {
1527
1622
  });
1528
1623
  }
1529
1624
  onListRemoveItem(index, vindex) {
1530
- let formData = util/* default.cloneDeep */.Z.cloneDeep(this.state.formData);
1625
+ let formData = util/* default */.Z.cloneDeep(this.state.formData);
1531
1626
  let field = formData[index];
1532
1627
  field.value = field.value || [];
1533
1628
  field.value.splice(vindex, 1);
@@ -1536,9 +1631,9 @@ class FormAttachment extends common/* Com */.up {
1536
1631
  });
1537
1632
  }
1538
1633
  renderFields() {
1539
- if (util/* default.size */.Z.size(this.state.formData) === 0) return null;
1634
+ if (util/* default */.Z.size(this.state.formData) === 0) return null;
1540
1635
  let $fields = null;
1541
- $fields = util/* default.map */.Z.map(this.state.formData, (field, index) => {
1636
+ $fields = util/* default */.Z.map(this.state.formData, (field, index) => {
1542
1637
  let $field = null;
1543
1638
  var errclass = field.error ? 'input--error' : '';
1544
1639
  if (field.type === 'text') {
@@ -1614,7 +1709,7 @@ class FormAttachment extends common/* Com */.up {
1614
1709
  }, (0,preact_module.h)("div", null)));
1615
1710
  } else if (field.type === 'list') {
1616
1711
  let selected = field.value || [];
1617
- let items = util/* default.filter */.Z.filter(util/* default.get */.Z.get(field, 'items', []), item => !selected.includes(item));
1712
+ let items = util/* default */.Z.filter(util/* default */.Z.get(field, 'items', []), item => !selected.includes(item));
1618
1713
  $field = (0,preact_module.h)(ListField, {
1619
1714
  selected: selected,
1620
1715
  items: items,
@@ -1652,15 +1747,15 @@ class FormAttachment extends common/* Com */.up {
1652
1747
  }
1653
1748
  async submit() {
1654
1749
  var hasError = false;
1655
- util/* default.map */.Z.map(this.state.formData, field => {
1656
- if (field.is_required && (field.value === undefined || field.value === '' || util/* default.size */.Z.size(field.value) === 0 && Array.isArray(field.value))) {
1750
+ util/* default */.Z.map(this.state.formData, field => {
1751
+ if (field.is_required && (field.value === undefined || field.value === '' || util/* default */.Z.size(field.value) === 0 && Array.isArray(field.value))) {
1657
1752
  field.error = this.props.t('error_empty');
1658
1753
  hasError = true;
1659
1754
  } else {
1660
1755
  field.error = '';
1661
1756
  }
1662
1757
  if (field.name === 'emails' && field.value) {
1663
- if (!util/* default.isEmail */.Z.isEmail(field.value)) {
1758
+ if (!util/* default */.Z.isEmail(field.value)) {
1664
1759
  field.error = this.props.t('error_email_invalid');
1665
1760
  hasError = true;
1666
1761
  }
@@ -1669,32 +1764,32 @@ class FormAttachment extends common/* Com */.up {
1669
1764
  this.forceUpdate();
1670
1765
  if (hasError) return;
1671
1766
  let user = {};
1672
- let formData = util/* default.cloneDeep */.Z.cloneDeep(this.state.formData);
1673
- util/* default.map */.Z.map(formData, field => {
1767
+ let formData = util/* default */.Z.cloneDeep(this.state.formData);
1768
+ util/* default */.Z.map(formData, field => {
1674
1769
  var attr = {
1675
1770
  key: field.name
1676
1771
  };
1677
- field.answered = new util/* default.Date */.Z.Date().getTime();
1772
+ field.answered = new util/* default */.Z.Date().getTime();
1678
1773
  if (field.type === 'number') {
1679
1774
  attr.number = parseInt(field.value);
1680
- field.answer = util/* default.stringify */.Z.stringify(attr.number);
1775
+ field.answer = util/* default */.Z.stringify(attr.number);
1681
1776
  }
1682
1777
  if (field.type === 'datetime') {
1683
- attr.datetime = new util/* default.Date */.Z.Date(field.value).toISOString();
1684
- field.answer = util/* default.stringify */.Z.stringify(attr.datetime);
1778
+ attr.datetime = new util/* default */.Z.Date(field.value).toISOString();
1779
+ field.answer = util/* default */.Z.stringify(attr.datetime);
1685
1780
  }
1686
1781
  if (field.type === 'list') {
1687
1782
  attr.list = field.value;
1688
- field.answer = util/* default.stringify */.Z.stringify(attr.list);
1783
+ field.answer = util/* default */.Z.stringify(attr.list);
1689
1784
  }
1690
1785
  if (field.type === 'text' || field.type === 'boolean') {
1691
1786
  attr[field.type] = field.value;
1692
- field.answer = util/* default.stringify */.Z.stringify(field.value);
1787
+ field.answer = util/* default */.Z.stringify(field.value);
1693
1788
  }
1694
- util/* default.setUserAttr */.Z.setUserAttr(user, attr);
1789
+ util/* default */.Z.setUserAttr(user, attr);
1695
1790
  });
1696
- util/* default.map */.Z.map(formData, field => {
1697
- let ffield = util/* default.find */.Z.find(this.props.form.fields, ffield => ffield.name === field.name);
1791
+ util/* default */.Z.map(formData, field => {
1792
+ let ffield = util/* default */.Z.find(this.props.form.fields, ffield => ffield.name === field.name);
1698
1793
  if (!ffield) return;
1699
1794
  ffield.answered = field.answered;
1700
1795
  });
@@ -1707,12 +1802,12 @@ class FormAttachment extends common/* Com */.up {
1707
1802
  type: 'form_submit',
1708
1803
  form_submit: {
1709
1804
  state: '{"user_id":"' + this.props.store.matchUser().id + '"}',
1710
- form_message_id: util/* default.get */.Z.get(this.props.ev, 'id'),
1805
+ form_message_id: util/* default */.Z.get(this.props.ev, 'id'),
1711
1806
  fields: formData
1712
1807
  }
1713
1808
  }]
1714
1809
  };
1715
- let cid = util/* default.convoOfEv */.Z.convoOfEv(this.props.ev);
1810
+ let cid = util/* default */.Z.convoOfEv(this.props.ev);
1716
1811
  this.props.store.sendConvoEvent(cid, 'message_sent', {
1717
1812
  message
1718
1813
  });
@@ -1732,17 +1827,17 @@ class FormAttachments extends common/* Com */.up {
1732
1827
  super(props);
1733
1828
  }
1734
1829
  render() {
1735
- let byType = util/* default.get */.Z.get(this.props.ev, 'by.type');
1830
+ let byType = util/* default */.Z.get(this.props.ev, 'by.type');
1736
1831
  if (byType === 'user') return;
1737
1832
  let forms = [];
1738
- let attachments = util/* default.get */.Z.get(this.props.ev, 'data.message.attachments') || [];
1739
- util/* default.each */.Z.each(attachments, att => {
1833
+ let attachments = util/* default */.Z.get(this.props.ev, 'data.message.attachments') || [];
1834
+ util/* default */.Z.each(attachments, att => {
1740
1835
  if (!att) return;
1741
1836
  if (att.type !== 'form' && att.type !== 'ask_info_form') return;
1742
1837
  att.form._type = att.type;
1743
1838
  forms.push(att.form);
1744
1839
  });
1745
- let $forms = util/* default.map */.Z.map(forms, (form, formIndex) => {
1840
+ let $forms = util/* default */.Z.map(forms, (form, formIndex) => {
1746
1841
  return (0,preact_module.h)(FormAttachment, {
1747
1842
  store: this.props.store,
1748
1843
  onSubmit: this.props.onSubmit,
@@ -1776,14 +1871,14 @@ class FormSubmitAttachments extends common/* Com */.up {
1776
1871
  render() {
1777
1872
  return null;
1778
1873
  let submits = [];
1779
- let attachments = util/* default.get */.Z.get(this.props.ev, 'data.message.attachments') || [];
1780
- util/* default.each */.Z.each(attachments, att => {
1874
+ let attachments = util/* default */.Z.get(this.props.ev, 'data.message.attachments') || [];
1875
+ util/* default */.Z.each(attachments, att => {
1781
1876
  if (!att) return;
1782
1877
  if (att.type !== 'form_submit') return;
1783
1878
  if (!att.form_submit) return;
1784
1879
  submits.push(att.form_submit);
1785
1880
  });
1786
- let $submits = util/* default.map */.Z.map(submits, (submit, index) => (0,preact_module.h)("div", {
1881
+ let $submits = util/* default */.Z.map(submits, (submit, index) => (0,preact_module.h)("div", {
1787
1882
  class: "info-message"
1788
1883
  }, (0,preact_module.h)("span", null, this.props.tt('prechat_form_thanks'))));
1789
1884
  return (0,preact_module.h)("div", null, $submits);
@@ -1855,13 +1950,13 @@ class GenericTemplateAttachments extends common/* Com */.up {
1855
1950
  });
1856
1951
  }
1857
1952
  render() {
1858
- let byType = util/* default.get */.Z.get(this.props.ev, 'by.type');
1953
+ let byType = util/* default */.Z.get(this.props.ev, 'by.type');
1859
1954
  if (byType === 'user') return null;
1860
- let attachments = util/* default.get */.Z.get(this.props.ev, 'data.message.attachments', []);
1861
- let generics = util/* default.filter */.Z.filter(attachments, att => util/* default.get */.Z.get(att, 'type') === 'generic');
1955
+ let attachments = util/* default */.Z.get(this.props.ev, 'data.message.attachments', []);
1956
+ let generics = util/* default */.Z.filter(attachments, att => util/* default */.Z.get(att, 'type') === 'generic');
1862
1957
  if (generics.length === 0) return null;
1863
- var $generics = util/* default.map */.Z.map(generics, (gen, index) => {
1864
- var $eles = util/* default.map */.Z.map(gen.elements, ele => {
1958
+ var $generics = util/* default */.Z.map(generics, (gen, index) => {
1959
+ var $eles = util/* default */.Z.map(gen.elements, ele => {
1865
1960
  let title = this.props.t.i18n(ele.i18n_title) || ele.title;
1866
1961
  let subtitle = this.props.t.i18n(ele.i18n_subtitle) || ele.subtitle;
1867
1962
  let $title = title ? (0,preact_module.h)("div", {
@@ -1888,7 +1983,7 @@ class GenericTemplateAttachments extends common/* Com */.up {
1888
1983
  t: this.props.t
1889
1984
  }));
1890
1985
  });
1891
- let elements = util/* default.get */.Z.get(attachments, '0.elements', []);
1986
+ let elements = util/* default */.Z.get(attachments, '0.elements', []);
1892
1987
  let leftNavigatorCls = 'generic-attachment-navigator generic-attachment-navigator--left';
1893
1988
  let rightNavigatorCls = 'generic-attachment-navigator generic-attachment-navigator--right';
1894
1989
  if (this.state.focusing === 0) leftNavigatorCls += ' generic-attachment-navigator--disabled';
@@ -1915,7 +2010,7 @@ class GenericTemplateAttachments extends common/* Com */.up {
1915
2010
  bindDrag() {
1916
2011
  if (!this.props.store.isMobile()) return;
1917
2012
  let eles = document.getElementsByClassName('generic-attachment');
1918
- util/* default.map */.Z.map(eles, ele => bind(ele, () => {}));
2013
+ util/* default */.Z.map(eles, ele => bind(ele, () => {}));
1919
2014
  }
1920
2015
  }
1921
2016
  ;// CONCATENATED MODULE: ./src/chatbox/ProductAttachments.js
@@ -1924,19 +2019,19 @@ class GenericTemplateAttachments extends common/* Com */.up {
1924
2019
 
1925
2020
  class ProductAttachments extends common/* Com */.up {
1926
2021
  render() {
1927
- let byType = util/* default.get */.Z.get(this.props.ev, 'by.type');
2022
+ let byType = util/* default */.Z.get(this.props.ev, 'by.type');
1928
2023
  if (byType === 'user') return null;
1929
- let attachments = util/* default.get */.Z.get(this.props.ev, 'data.message.attachments', []);
1930
- let products = util/* default.filter */.Z.filter(attachments, att => util/* default.get */.Z.get(att, 'type') === 'product' || util/* default.get */.Z.get(att, 'type') === 'product_preview');
2024
+ let attachments = util/* default */.Z.get(this.props.ev, 'data.message.attachments', []);
2025
+ let products = util/* default */.Z.filter(attachments, att => util/* default */.Z.get(att, 'type') === 'product' || util/* default */.Z.get(att, 'type') === 'product_preview');
1931
2026
  products = products.filter(product => product.product && product.product.name);
1932
2027
  if (products.length === 0) return null;
1933
2028
  let acc = this.props.store.matchAccount();
1934
- let $products = util/* default.map */.Z.map(products, (att, index) => {
2029
+ let $products = util/* default */.Z.map(products, (att, index) => {
1935
2030
  let product = att.product;
1936
2031
  let $detailbtns = [];
1937
2032
  let url = product.url || product.mobile_url;
1938
2033
  if (this.props.store.isMobile()) url = product.mobile_url || product.url;
1939
- if (url && util/* default.size */.Z.size(product.buttons) == 0) $detailbtns.push((0,preact_module.h)("a", {
2034
+ if (url && util/* default */.Z.size(product.buttons) == 0) $detailbtns.push((0,preact_module.h)("a", {
1940
2035
  class: "product_attachment__btn",
1941
2036
  href: url,
1942
2037
  target: "_blank"
@@ -1945,8 +2040,8 @@ class ProductAttachments extends common/* Com */.up {
1945
2040
  class: "product_attachment__btn_external_link"
1946
2041
  })));
1947
2042
  console.log('P', product);
1948
- if (util/* default.size */.Z.size(product.buttons) > 0) {
1949
- $detailbtns = $detailbtns.concat(util/* default.map */.Z.map(product.buttons, (button, index) => {
2043
+ if (util/* default */.Z.size(product.buttons) > 0) {
2044
+ $detailbtns = $detailbtns.concat(util/* default */.Z.map(product.buttons, (button, index) => {
1950
2045
  if (button.type === 'call_button') {
1951
2046
  return (0,preact_module.h)("a", {
1952
2047
  class: "product_attachment__btn",
@@ -1986,12 +2081,12 @@ class ProductAttachments extends common/* Com */.up {
1986
2081
  if (desc) $subtitle = (0,preact_module.h)("div", {
1987
2082
  class: "product_attachment__subtitle"
1988
2083
  }, desc);
1989
- let currency = product.currency || util/* default.get */.Z.get(acc, 'currency', 'VND');
2084
+ let currency = product.currency || util/* default */.Z.get(acc, 'currency', 'VND');
1990
2085
  let $price = null;
1991
2086
  if (product.price) {
1992
2087
  $price = (0,preact_module.h)("div", {
1993
2088
  class: "product_attachment__price"
1994
- }, util/* default.formatCurrency */.Z.formatCurrency(product.price, currency));
2089
+ }, util/* default */.Z.formatCurrency(product.price, currency));
1995
2090
  }
1996
2091
  let imgsrc = this.props.store.replaceFileUrl(product.image);
1997
2092
  if (!product.image) {
@@ -2018,14 +2113,14 @@ class ProductAttachments extends common/* Com */.up {
2018
2113
 
2019
2114
  class OrderAttachments_ProductAttachments extends common/* Com */.up {
2020
2115
  render() {
2021
- let byType = util/* default.get */.Z.get(this.props.ev, 'by.type');
2116
+ let byType = util/* default */.Z.get(this.props.ev, 'by.type');
2022
2117
  if (byType === 'user') return null;
2023
2118
  let acc = this.props.store.matchAccount();
2024
- var attachments = util/* default.get */.Z.get(this.props.ev, 'data.message.attachments', []);
2025
- let orders = util/* default.filter */.Z.filter(attachments, att => att.type === 'order' && att.order).map(att => att.order);
2119
+ var attachments = util/* default */.Z.get(this.props.ev, 'data.message.attachments', []);
2120
+ let orders = util/* default */.Z.filter(attachments, att => att.type === 'order' && att.order).map(att => att.order);
2026
2121
  if (orders.length === 0) return null;
2027
- let $orders = util/* default.map */.Z.map(orders, (order, index) => {
2028
- util/* default.calcOrderTotal */.Z.calcOrderTotal(order);
2122
+ let $orders = util/* default */.Z.map(orders, (order, index) => {
2123
+ util/* default */.Z.calcOrderTotal(order);
2029
2124
  let $note = null;
2030
2125
  if (order.note) {
2031
2126
  $note = (0,preact_module.h)("div", null, (0,preact_module.h)("div", {
@@ -2036,17 +2131,17 @@ class OrderAttachments_ProductAttachments extends common/* Com */.up {
2036
2131
  }, order.note));
2037
2132
  }
2038
2133
  let $products = null;
2039
- if (util/* default.size */.Z.size(order.items) > 0) {
2134
+ if (util/* default */.Z.size(order.items) > 0) {
2040
2135
  $products = (0,preact_module.h)("div", null, (0,preact_module.h)("div", {
2041
2136
  class: "order_attachment__label"
2042
- }, this.props.t('product')), util/* default.map */.Z.map(order.items, item => {
2137
+ }, this.props.t('product')), util/* default */.Z.map(order.items, item => {
2043
2138
  let product = item.product || {};
2044
2139
  return (0,preact_module.h)("div", {
2045
2140
  class: "order_attachment__product"
2046
2141
  }, (0,preact_module.h)("img", {
2047
2142
  class: "order_attachment__product_img",
2048
- alt: '' + util/* default.get */.Z.get(product, 'id'),
2049
- src: util/* default.get */.Z.get(product, 'image', __webpack_require__(9270))
2143
+ alt: '' + util/* default */.Z.get(product, 'id'),
2144
+ src: util/* default */.Z.get(product, 'image', __webpack_require__(9270))
2050
2145
  }), (0,preact_module.h)("div", {
2051
2146
  style: "overflow: hidden !important;"
2052
2147
  }, (0,preact_module.h)("div", {
@@ -2054,9 +2149,9 @@ class OrderAttachments_ProductAttachments extends common/* Com */.up {
2054
2149
  title: this.props.t.i18n(product.i18n_name) || product.name
2055
2150
  }, this.props.t.i18n(product.i18n_name) || product.name), (0,preact_module.h)("div", {
2056
2151
  class: "order_attachment__product_desc"
2057
- }, util/* default.getProductPropName */.Z.getProductPropName(product, ' / ')), (0,preact_module.h)("div", {
2152
+ }, util/* default */.Z.getProductPropName(product, ' / ')), (0,preact_module.h)("div", {
2058
2153
  class: "order_attachment__product_desc"
2059
- }, this.props.t('qty'), " ", item.quantity, "\xA0\xB7\xA0", util/* default.formatCurrency */.Z.formatCurrency(product.price))));
2154
+ }, this.props.t('qty'), " ", item.quantity, "\xA0\xB7\xA0", util/* default */.Z.formatCurrency(product.price))));
2060
2155
  }));
2061
2156
  }
2062
2157
  let $total = (0,preact_module.h)("div", {
@@ -2065,19 +2160,19 @@ class OrderAttachments_ProductAttachments extends common/* Com */.up {
2065
2160
  class: "d-flex align-items-center justify-content-between"
2066
2161
  }, (0,preact_module.h)("div", null, this.props.t('total')), ' ', (0,preact_module.h)("div", null, (0,preact_module.h)("b", {
2067
2162
  class: "order_attachment__total"
2068
- }, util/* default.formatCurrency */.Z.formatCurrency(order.total)))));
2069
- let phoneattr = util/* default.find */.Z.find(util/* default.get */.Z.get(order, 'user.attributes', []), attr => attr.key === 'phones') || {
2163
+ }, util/* default */.Z.formatCurrency(order.total)))));
2164
+ let phoneattr = util/* default */.Z.find(util/* default */.Z.get(order, 'user.attributes', []), attr => attr.key === 'phones') || {
2070
2165
  key: 'phones',
2071
2166
  text: ''
2072
2167
  };
2073
- let phone = util/* default.get */.Z.get(order, 'shipping.address.phone', '').trim();
2074
- phone = phone || util/* default.trim */.Z.trim(phoneattr.text);
2168
+ let phone = util/* default */.Z.get(order, 'shipping.address.phone', '').trim();
2169
+ phone = phone || util/* default */.Z.trim(phoneattr.text);
2075
2170
  if (phone) phone = this.props.t('phn') + ': ' + phone;
2076
2171
  let $shipto = null;
2077
- if (util/* default.displayOrderShippingAddress */.Z.displayOrderShippingAddress(order) || phone) {
2172
+ if (util/* default */.Z.displayOrderShippingAddress(order) || phone) {
2078
2173
  $shipto = (0,preact_module.h)("div", null, (0,preact_module.h)("div", {
2079
2174
  class: "order_attachment__label"
2080
- }, this.props.t('ship_to')), (0,preact_module.h)("div", null, util/* default.displayOrderShippingAddress */.Z.displayOrderShippingAddress(order)), (0,preact_module.h)("div", {
2175
+ }, this.props.t('ship_to')), (0,preact_module.h)("div", null, util/* default */.Z.displayOrderShippingAddress(order)), (0,preact_module.h)("div", {
2081
2176
  class: "order_attachment__text_truncate"
2082
2177
  }, phone));
2083
2178
  }
@@ -2089,11 +2184,11 @@ class OrderAttachments_ProductAttachments extends common/* Com */.up {
2089
2184
  class: "d-flex align-items-center justify-content-between"
2090
2185
  }, (0,preact_module.h)("div", {
2091
2186
  class: "order_attachment__label no_margin"
2092
- }, this.props.t('subtotal_before_tax')), ' ', (0,preact_module.h)("div", null, util/* default.formatCurrency */.Z.formatCurrency(order._order_value))), (0,preact_module.h)("div", {
2187
+ }, this.props.t('subtotal_before_tax')), ' ', (0,preact_module.h)("div", null, util/* default */.Z.formatCurrency(order._order_value))), (0,preact_module.h)("div", {
2093
2188
  class: "d-flex align-items-center justify-content-between"
2094
2189
  }, (0,preact_module.h)("div", {
2095
2190
  class: "order_attachment__label no_margin"
2096
- }, this.props.t('discount_before_tax')), ' ', (0,preact_module.h)("div", null, "-", util/* default.formatCurrency */.Z.formatCurrency(order._discount_before_tax))));
2191
+ }, this.props.t('discount_before_tax')), ' ', (0,preact_module.h)("div", null, "-", util/* default */.Z.formatCurrency(order._discount_before_tax))));
2097
2192
  }
2098
2193
  let $subtotal = (0,preact_module.h)("div", {
2099
2194
  class: "d-flex align-items-center justify-content-between"
@@ -2101,12 +2196,12 @@ class OrderAttachments_ProductAttachments extends common/* Com */.up {
2101
2196
  class: "order_attachment__label no_margin"
2102
2197
  }, this.props.t('subtotal')), ' ', (0,preact_module.h)("div", {
2103
2198
  style: ""
2104
- }, util/* default.formatCurrency */.Z.formatCurrency(order.subtotal)));
2199
+ }, util/* default */.Z.formatCurrency(order.subtotal)));
2105
2200
  let $tax = null;
2106
2201
  if (order.total_tax) {
2107
2202
  let taxname = '';
2108
- if (util/* default.size */.Z.size(order._taxM) === 1) {
2109
- let tax = util/* default.get */.Z.get(order._taxM, '0.tax', {});
2203
+ if (util/* default */.Z.size(order._taxM) === 1) {
2204
+ let tax = util/* default */.Z.get(order._taxM, '0.tax', {});
2110
2205
  if (tax.name && tax.percentage) taxname = `(${tax.name} ${Math.round(tax.percentage || 0) / 100}%)`;
2111
2206
  }
2112
2207
  $tax = (0,preact_module.h)("div", {
@@ -2115,7 +2210,7 @@ class OrderAttachments_ProductAttachments extends common/* Com */.up {
2115
2210
  class: "order_attachment__label no_margin"
2116
2211
  }, this.props.t('tax'), " ", taxname), (0,preact_module.h)("div", {
2117
2212
  style: ""
2118
- }, util/* default.formatCurrency */.Z.formatCurrency(order.total_tax)));
2213
+ }, util/* default */.Z.formatCurrency(order.total_tax)));
2119
2214
  }
2120
2215
  let $discount = null;
2121
2216
  if (order.discount_type === 'percentage' && order.discount_percentage) {
@@ -2125,7 +2220,7 @@ class OrderAttachments_ProductAttachments extends common/* Com */.up {
2125
2220
  class: "order_attachment__label no_margin"
2126
2221
  }, this.props.t('discount_after_tax'), " (", Math.round(order.discount_percentage / 100), "%)"), ' ', (0,preact_module.h)("div", {
2127
2222
  style: ""
2128
- }, "-", util/* default.formatCurrency */.Z.formatCurrency(order._computed_discount)));
2223
+ }, "-", util/* default */.Z.formatCurrency(order._computed_discount)));
2129
2224
  }
2130
2225
  if (order.discount_type === 'amount' && order.discount_amount) {
2131
2226
  $discount = (0,preact_module.h)("div", {
@@ -2134,17 +2229,17 @@ class OrderAttachments_ProductAttachments extends common/* Com */.up {
2134
2229
  class: "order_attachment__label no_margin"
2135
2230
  }, this.props.t('discount_after_tax')), ' ', (0,preact_module.h)("div", {
2136
2231
  class: "no-shrink"
2137
- }, "-", util/* default.formatCurrency */.Z.formatCurrency(order._computed_discount)));
2232
+ }, "-", util/* default */.Z.formatCurrency(order._computed_discount)));
2138
2233
  }
2139
2234
  let $shipping = null;
2140
- if (util/* default.get */.Z.get(order, 'shipping.nominal_fee')) {
2235
+ if (util/* default */.Z.get(order, 'shipping.nominal_fee')) {
2141
2236
  $shipping = (0,preact_module.h)("div", {
2142
2237
  class: "d-flex align-items-center justify-content-between"
2143
2238
  }, (0,preact_module.h)("div", {
2144
2239
  class: "order_attachment__label no_margin"
2145
2240
  }, this.props.t('shipping_fee')), ' ', (0,preact_module.h)("div", {
2146
2241
  style: ""
2147
- }, util/* default.formatCurrency */.Z.formatCurrency(util/* default.get */.Z.get(order, 'shipping.nominal_fee', 0))));
2242
+ }, util/* default */.Z.formatCurrency(util/* default */.Z.get(order, 'shipping.nominal_fee', 0))));
2148
2243
  }
2149
2244
  let $adjustment = null;
2150
2245
  if (order.adjustment) {
@@ -2154,7 +2249,7 @@ class OrderAttachments_ProductAttachments extends common/* Com */.up {
2154
2249
  class: "order_attachment__label no_margin"
2155
2250
  }, order.adjustment_description), ' ', (0,preact_module.h)("div", {
2156
2251
  class: "no-shrink"
2157
- }, util/* default.formatCurrency */.Z.formatCurrency(order.adjustment)));
2252
+ }, util/* default */.Z.formatCurrency(order.adjustment)));
2158
2253
  }
2159
2254
  $subtotal = (0,preact_module.h)("div", {
2160
2255
  class: "order_attachment__footer"
@@ -2168,7 +2263,7 @@ class OrderAttachments_ProductAttachments extends common/* Com */.up {
2168
2263
  class: "order_attachment__header"
2169
2264
  }, this.props.t('order'), (0,preact_module.h)("span", {
2170
2265
  class: "order_attachment__text_muted order_attachment__text_sm"
2171
- }, util/* default.getOrderDisplayName */.Z.getOrderDisplayName(order))), $products, $shipto, $note, $beforeTax, $subtotal, $total);
2266
+ }, util/* default */.Z.getOrderDisplayName(order))), $products, $shipto, $note, $beforeTax, $subtotal, $total);
2172
2267
  });
2173
2268
  return $orders;
2174
2269
  }
@@ -2182,15 +2277,15 @@ class VideoAttachments extends common/* Com */.up {
2182
2277
  super(props);
2183
2278
  }
2184
2279
  render() {
2185
- let byType = util/* default.get */.Z.get(this.props.ev, 'by.type');
2186
- var attachments = util/* default.get */.Z.get(this.props.ev, 'data.message.attachments', []);
2280
+ let byType = util/* default */.Z.get(this.props.ev, 'by.type');
2281
+ var attachments = util/* default */.Z.get(this.props.ev, 'data.message.attachments', []);
2187
2282
  var videos = [];
2188
- util/* default.each */.Z.each(attachments, (att, i) => {
2283
+ util/* default */.Z.each(attachments, (att, i) => {
2189
2284
  if (!att) return;
2190
- if (util/* default.includes */.Z.includes(att.mimetype, 'video')) videos.push(att);
2285
+ if (util/* default */.Z.includes(att.mimetype, 'video')) videos.push(att);
2191
2286
  });
2192
2287
  if (videos.length === 0) return null;
2193
- var $videos = util/* default.map */.Z.map(videos, (video, index) => {
2288
+ var $videos = util/* default */.Z.map(videos, (video, index) => {
2194
2289
  return (0,preact_module.h)("div", {
2195
2290
  class: `video-attachment video-attachment--${byType}`
2196
2291
  }, (0,preact_module.h)("video", {
@@ -2200,8 +2295,7 @@ class VideoAttachments extends common/* Com */.up {
2200
2295
  height: "",
2201
2296
  poster: this.props.store.replaceFileUrl(video.thumbnail_url),
2202
2297
  controls: "controls",
2203
- preload: "metadata",
2204
- onclick: "this.play()"
2298
+ preload: "metadata"
2205
2299
  }));
2206
2300
  });
2207
2301
  return (0,preact_module.h)("div", {
@@ -2209,73 +2303,23 @@ class VideoAttachments extends common/* Com */.up {
2209
2303
  }, $videos);
2210
2304
  }
2211
2305
  }
2212
- ;// CONCATENATED MODULE: ./src/chatbox/ShadowDomRoot.js
2213
-
2214
-
2215
- class ShadowDomRoot extends common/* Com */.up {
2216
- constructor(props) {
2217
- super(props);
2218
- this.ref = (0,preact_module/* createRef */.Vf)();
2219
- }
2220
- componentDidMount() {
2221
- this.shadowRoot = this.ref.current.attachShadow({
2222
- mode: 'open'
2223
- });
2224
- this.update(this.props.html);
2225
- }
2226
- update(html) {
2227
- this.shadowRoot.innerHTML = `<style type="text/css">
2228
- body { font-family: 'Inter', sans-serif!important; font-size: 14px!important; line-height: 20px; overflow-y: hidden; margin:0 }
2229
- h{ font-size: 14/18px!important; }
2230
- a { text-decoration: none;}
2231
- img { max-width: 100%; display: block; margin: 10px auto; }
2232
- * { white-space: normal }
2233
- ul > li { margin-bottom: 5px }
2234
- ul:last-child { margin-bottom: 0 }
2235
- p { margin-bottom: 0; margin-top: 0;}
2236
- </style>
2237
- <div>${html}</div>`;
2238
- let links = this.shadowRoot.querySelectorAll('a');
2239
- for (var i = 0; i < links.length; i++) links[i].target = '_blank';
2240
- }
2241
- render() {
2242
- return (0,preact_module.h)("div", {
2243
- ref: this.ref,
2244
- style: "white-space: normal !important"
2245
- });
2246
- }
2247
- }
2248
2306
  ;// CONCATENATED MODULE: ./src/chatbox/TextMessage.js
2249
2307
 
2250
- let mustrerender = [];
2251
- let marked = (obj, text) => {
2252
- mustrerender.push(obj);
2253
- return '';
2254
- };
2255
- const loadMarked = () => __webpack_require__.e(/* import() */ 441).then(__webpack_require__.bind(__webpack_require__, 7441));
2256
- (async () => {
2257
- let markedf = (await loadMarked()).marked;
2258
- marked = (obj, text) => markedf(text);
2259
- util/* default.map */.Z.map(mustrerender, obj => obj.forceUpdate());
2260
- mustrerender = [];
2261
- })();
2262
-
2263
2308
 
2264
2309
 
2265
2310
 
2266
2311
  class TextMessage extends common/* Com */.up {
2267
2312
  render() {
2268
- var format = util/* default.get */.Z.get(this.props.ev, 'data.message.format', 'plaintext');
2269
- if (format === 'markdown') return this.renderMarkdown();
2313
+ var format = util/* default */.Z.get(this.props.ev, 'data.message.format', 'plaintext');
2270
2314
  if (format === 'delta') return this.renderDelta();
2271
2315
  return this.renderPlainText();
2272
2316
  }
2273
2317
  renderPlainText() {
2274
- var text = util/* default.get */.Z.get(this.props.ev, 'data.message.text');
2275
- text = util/* default.trim */.Z.trim(text);
2276
- if (util/* default.size */.Z.size(text) === 0) return null;
2277
- let byType = util/* default.get */.Z.get(this.props.ev, 'by.type');
2278
- var tags = util/* default.extractText */.Z.extractText(text).map(tag => {
2318
+ var text = util/* default */.Z.get(this.props.ev, 'data.message.text');
2319
+ text = util/* default */.Z.trim(text);
2320
+ if (util/* default */.Z.size(text) === 0) return null;
2321
+ let byType = util/* default */.Z.get(this.props.ev, 'by.type');
2322
+ var tags = util/* default */.Z.extractText(text).map(tag => {
2279
2323
  if (tag.type === 'emoji') return (0,preact_module.h)(Emoji, {
2280
2324
  emojiCode: tag.text,
2281
2325
  byType: byType
@@ -2299,7 +2343,7 @@ class TextMessage extends common/* Com */.up {
2299
2343
  }, tag.text);
2300
2344
  return tag.text;
2301
2345
  });
2302
- if (util/* default.size */.Z.size(tags) === 0) return null;
2346
+ if (util/* default */.Z.size(tags) === 0) return null;
2303
2347
  if (byType === 'agent') {
2304
2348
  return (0,preact_module.h)("div", {
2305
2349
  class: "message-agent message-text--agent"
@@ -2310,16 +2354,16 @@ class TextMessage extends common/* Com */.up {
2310
2354
  }, tags);
2311
2355
  }
2312
2356
  renderDelta() {
2313
- let deltas = util/* default.get */.Z.get(this.props.ev, 'data.message.quill_delta') || util/* default.get */.Z.get(this.props.ev, 'data.message.text');
2314
- let quilldeltas = util/* default.parseJSON */.Z.parseJSON(deltas) || {};
2357
+ let deltas = util/* default */.Z.get(this.props.ev, 'data.message.quill_delta') || util/* default */.Z.get(this.props.ev, 'data.message.text');
2358
+ let quilldeltas = util/* default */.Z.parseJSON(deltas) || {};
2315
2359
  quilldeltas = trimQuillDelta(quilldeltas);
2316
- if (!quilldeltas || util/* default.size */.Z.size(quilldeltas.ops) === 0) return null;
2317
- let $deltas = util/* default.map */.Z.map(quilldeltas.ops, delta => {
2360
+ if (!quilldeltas || util/* default */.Z.size(quilldeltas.ops) === 0) return null;
2361
+ let $deltas = util/* default */.Z.map(quilldeltas.ops, delta => {
2318
2362
  let html = '';
2319
2363
  let insert = delta.insert;
2320
2364
  let attributes = delta.attributes;
2321
2365
  if (insert.dynamicField) {
2322
- return util/* default.get */.Z.get(insert, 'dynamicField.text', '');
2366
+ return util/* default */.Z.get(insert, 'dynamicField.text', '');
2323
2367
  }
2324
2368
  if (insert.mention) {
2325
2369
  if (insert.mention.id == '*' || insert.mention.id == 'all') {
@@ -2328,7 +2372,7 @@ class TextMessage extends common/* Com */.up {
2328
2372
  }, "@", this.$t('all'));
2329
2373
  }
2330
2374
  let ag = store.matchAgent(insert.mention.id);
2331
- let name = util/* default.getAgentDisplayName */.Z.getAgentDisplayName(ag, insert.mention.fullname);
2375
+ let name = util/* default */.Z.getAgentDisplayName(ag, insert.mention.fullname);
2332
2376
  return (0,preact_module.h)("span", {
2333
2377
  class: "mention",
2334
2378
  "data-agent-id": ag.id,
@@ -2339,7 +2383,7 @@ class TextMessage extends common/* Com */.up {
2339
2383
  emojiCode: `:${insert.emoji}:`
2340
2384
  });
2341
2385
  if (typeof insert === 'string') {
2342
- let $tags = util/* default.extractText */.Z.extractText(insert).map((tag, i) => {
2386
+ let $tags = util/* default */.Z.extractText(insert).map((tag, i) => {
2343
2387
  if (tag.type === 'link') {
2344
2388
  return (0,preact_module.h)("a", {
2345
2389
  href: absLink(tag.text),
@@ -2363,9 +2407,9 @@ class TextMessage extends common/* Com */.up {
2363
2407
  }
2364
2408
  return null;
2365
2409
  });
2366
- let byType = util/* default.get */.Z.get(this.ev, 'by.type');
2410
+ let byType = util/* default */.Z.get(this.ev, 'by.type');
2367
2411
  if (byType !== 'user') byType = 'agent';
2368
- if (util/* default.size */.Z.size($deltas) === 0) return null;
2412
+ if (util/* default */.Z.size($deltas) === 0) return null;
2369
2413
  if (byType === 'agent') {
2370
2414
  return (0,preact_module.h)("div", {
2371
2415
  class: "message-agent message-text--agent"
@@ -2375,46 +2419,6 @@ class TextMessage extends common/* Com */.up {
2375
2419
  class: "message-user message-text--user"
2376
2420
  }, $deltas);
2377
2421
  }
2378
- renderMarkdown(text) {
2379
- if (!text) text = util/* default.get */.Z.get(this.props.ev, 'data.message.text');
2380
- if (util/* default.size */.Z.size(text) === 0) return null;
2381
- let byType = util/* default.get */.Z.get(this.props.ev, 'by.type');
2382
- text = util/* default.trim */.Z.trim(text);
2383
- if (util/* default.size */.Z.size(text) === 0) return null;
2384
- if (byType === 'agent') {
2385
- return (0,preact_module.h)("div", {
2386
- class: "markdown-message message-agent message-text--agent"
2387
- }, (0,preact_module.h)(ShadowDomRoot, {
2388
- html: marked(this, text)
2389
- }));
2390
- }
2391
- return (0,preact_module.h)("div", {
2392
- class: "d-flex flex-column align-items-end"
2393
- }, (0,preact_module.h)("div", {
2394
- class: "markdown-message message-user message-text--user"
2395
- }, (0,preact_module.h)(ShadowDomRoot, {
2396
- html: marked(this, text)
2397
- })));
2398
- }
2399
- }
2400
- function deltaToMarkdown(deltas) {
2401
- let output = '';
2402
- sb.each(deltas, (delta, idx) => {
2403
- let text = '';
2404
- let insert = delta.insert;
2405
- let attributes = delta.attributes;
2406
- if (insert.emoji) text = emojiCodes[insert.emoji] || '';
2407
- if (attributes) {
2408
- if (attributes.italic && attributes.bold) text = `*__${insert}__*`;else if (attributes.italic) text = `*${insert}*`;else if (attributes.bold) text = `**${insert}**`;else text = insert;
2409
- }
2410
- if (insert.dynamicField) text = `${sb.get(insert, 'dynamicField.text', '')}`;
2411
- if (!insert.emoji && !attributes && !insert.dynamicField) {
2412
- text = insert || '';
2413
- text = text.replace(/\n/g, '<br/>');
2414
- }
2415
- output += text;
2416
- });
2417
- return output;
2418
2422
  }
2419
2423
  const emojiCodes = {
2420
2424
  like: '👍',
@@ -2463,8 +2467,8 @@ function absLink(url) {
2463
2467
  }
2464
2468
  ;// CONCATENATED MODULE: ./src/chatbox/time.js
2465
2469
 
2466
- var g_pub = new util/* default.Pubsub */.Z.Pubsub();
2467
- util/* default.setInterval */.Z.setInterval(() => g_pub.publish('time'), 20 * 1000);
2470
+ var g_pub = new util/* default */.Z.Pubsub();
2471
+ util/* default */.Z.setInterval(() => g_pub.publish('time'), 20 * 1000);
2468
2472
 
2469
2473
 
2470
2474
  class Time extends common/* Com */.up {
@@ -2479,10 +2483,10 @@ class Time extends common/* Com */.up {
2479
2483
  var t = '';
2480
2484
  if (this.props.ago) {
2481
2485
  if (this.props.short) {
2482
- if (Math.abs(this.props.time - new util/* default.Date */.Z.Date().getTime()) > 86400000 * 10) {
2483
- let tim = new util/* default.Date */.Z.Date(this.props.time);
2486
+ if (Math.abs(this.props.time - new util/* default */.Z.Date().getTime()) > 86400000 * 10) {
2487
+ let tim = new util/* default */.Z.Date(this.props.time);
2484
2488
  let tzyear = tim.getFullYear();
2485
- let locale = util/* default.get */.Z.get(navigator, 'languages.0', 'en-US');
2489
+ let locale = util/* default */.Z.get(navigator, 'languages.0', 'en-US');
2486
2490
  let tzmonthname = tim.toLocaleDateString(locale, {
2487
2491
  month: 'short'
2488
2492
  });
@@ -2490,8 +2494,8 @@ class Time extends common/* Com */.up {
2490
2494
  t = tzdate + ' ' + tzmonthname + ' ' + tzyear;
2491
2495
  }
2492
2496
  }
2493
- if (!t && this.props.time > 0) t = ago(this.props.time, new util/* default.Date */.Z.Date().getTime());
2494
- } else t = util/* default.shortTime */.Z.shortTime(this.props.time, this.props.tzoffset);
2497
+ if (!t && this.props.time > 0) t = ago(this.props.time, new util/* default */.Z.Date().getTime());
2498
+ } else t = util/* default */.Z.shortTime(this.props.time, this.props.tzoffset);
2495
2499
  if (this.props.uppercase) t = t.toUpperCase();
2496
2500
  if (t === this.state.t) return;
2497
2501
  this.setState({
@@ -2602,7 +2606,7 @@ class InfoMessage extends common/* Com */.up {
2602
2606
  }));
2603
2607
  }
2604
2608
  if (ev.type === 'conversation_rated') {
2605
- var rating = util/* default.get */.Z.get(ev, 'data.conversation.ratings.0', {
2609
+ var rating = util/* default */.Z.get(ev, 'data.conversation.ratings.0', {
2606
2610
  no_rating: true,
2607
2611
  rating: 0
2608
2612
  });
@@ -2613,7 +2617,7 @@ class InfoMessage extends common/* Com */.up {
2613
2617
  class: "info-message"
2614
2618
  }, this.props.t('rated_as') + ' ' + this.props.t(getRateLang(rating.rating)).toLowerCase()));
2615
2619
  }
2616
- if (ev.type === 'conversation_state_updated' && util/* default.get */.Z.get(ev, 'data.conversation.state') === 'ended') {
2620
+ if (ev.type === 'conversation_state_updated' && util/* default */.Z.get(ev, 'data.conversation.state') === 'ended') {
2617
2621
  return (0,preact_module.h)("div", {
2618
2622
  class: "convo-event"
2619
2623
  }, $time, (0,preact_module.h)("div", {
@@ -2647,7 +2651,7 @@ class Event extends common/* Com */.up {
2647
2651
  this.refForm = (0,preact_module/* createRef */.Vf)();
2648
2652
  }
2649
2653
  render() {
2650
- var ev = util/* default.get */.Z.get(this.props.event, 'ev', {});
2654
+ var ev = util/* default */.Z.get(this.props.event, 'ev', {});
2651
2655
  switch (ev.type) {
2652
2656
  case 'conversation_joined':
2653
2657
  break;
@@ -2656,7 +2660,7 @@ class Event extends common/* Com */.up {
2656
2660
  case 'conversation_state_updated':
2657
2661
  case 'conversation_rating_requested':
2658
2662
  case 'conversation_rated':
2659
- if (!util/* default.startsWith */.Z.startsWith(ev.id, 'ev')) return null;
2663
+ if (!util/* default */.Z.startsWith(ev.id, 'ev')) return null;
2660
2664
  return (0,preact_module.h)(InfoMessage, {
2661
2665
  t: this.props.t,
2662
2666
  store: this.props.store,
@@ -2669,7 +2673,7 @@ class Event extends common/* Com */.up {
2669
2673
  this.refForm.current && this.refForm.current.focus();
2670
2674
  }
2671
2675
  chooseQuickReply(reply) {
2672
- let ev = util/* default.get */.Z.get(this.props.event, 'ev', {});
2676
+ let ev = util/* default */.Z.get(this.props.event, 'ev', {});
2673
2677
  let message = {
2674
2678
  text: reply.title,
2675
2679
  format: 'plaintext'
@@ -2686,7 +2690,7 @@ class Event extends common/* Com */.up {
2686
2690
  this.props.onSend(message);
2687
2691
  }
2688
2692
  choosePostbackBtn(button) {
2689
- let ev = util/* default.get */.Z.get(this.props.event, 'ev', {});
2693
+ let ev = util/* default */.Z.get(this.props.event, 'ev', {});
2690
2694
  let message = {
2691
2695
  text: button.title,
2692
2696
  format: 'plaintext'
@@ -2703,13 +2707,13 @@ class Event extends common/* Com */.up {
2703
2707
  this.props.onSend(message);
2704
2708
  }
2705
2709
  renderAgentAvatar(ev) {
2706
- let bytype = util/* default.get */.Z.get(ev, 'by.type');
2707
- let byid = util/* default.get */.Z.get(ev, 'by.display_id', util/* default.get */.Z.get(ev, 'by.id'));
2710
+ let bytype = util/* default */.Z.get(ev, 'by.type');
2711
+ let byid = util/* default */.Z.get(ev, 'by.display_id', util/* default */.Z.get(ev, 'by.id'));
2708
2712
  if (bytype === 'user') return null;
2709
2713
  var senderName = this.getSenderName(ev);
2710
2714
  let acc = this.props.store.matchAccount();
2711
2715
  var uri = acc.logo_url || __webpack_require__(9895);
2712
- if (util/* default.get */.Z.get(this.props, 'chatbox.hide_agent_profile')) {
2716
+ if (util/* default */.Z.get(this.props, 'chatbox.hide_agent_profile')) {
2713
2717
  return (0,preact_module.h)("div", {
2714
2718
  class: "message-sender"
2715
2719
  }, (0,preact_module.h)("img", {
@@ -2722,7 +2726,7 @@ class Event extends common/* Com */.up {
2722
2726
  }
2723
2727
  let agentM = this.props.store.matchAgent('*');
2724
2728
  if (byid !== 'system' && bytype !== 'dummy' && bytype !== 'workflow') {
2725
- uri = util/* default.get */.Z.get(agentM[byid], 'avatar_url') || acc.logo_url || __webpack_require__(4761);
2729
+ uri = util/* default */.Z.get(agentM[byid], 'avatar_url') || acc.logo_url || __webpack_require__(4761);
2726
2730
  }
2727
2731
  return (0,preact_module.h)("div", {
2728
2732
  class: "message-sender"
@@ -2744,8 +2748,8 @@ class Event extends common/* Com */.up {
2744
2748
  time: ev.created
2745
2749
  }));
2746
2750
  }
2747
- let t = new util/* default.Date */.Z.Date(ev.created).toLocaleString();
2748
- if (util/* default.get */.Z.get(ev, 'by.type') !== 'user') {
2751
+ let t = new util/* default */.Z.Date(ev.created).toLocaleString();
2752
+ if (util/* default */.Z.get(ev, 'by.type') !== 'user') {
2749
2753
  let $sender = null;
2750
2754
  if (this.props.event.mode === 'lead') $sender = this.renderAgentAvatar(ev);
2751
2755
  return (0,preact_module.h)("div", {
@@ -2801,15 +2805,15 @@ class Event extends common/* Com */.up {
2801
2805
  onSelect: e => this.chooseQuickReply(e)
2802
2806
  }));
2803
2807
  }
2804
- if (util/* default.getMsgField */.Z.getMsgField(ev, 'idempotency') === ev.id && this.props.store.now() - ev.created < 900) {
2805
- util/* default.setTimeout */.Z.setTimeout(() => this.setState({
2808
+ if (util/* default */.Z.getMsgField(ev, 'idempotency') === ev.id && this.props.store.now() - ev.created < 900) {
2809
+ util/* default */.Z.setTimeout(() => this.setState({
2806
2810
  refresh: this.state.refresh
2807
2811
  }), 1000);
2808
2812
  }
2809
2813
  let $dot = (0,preact_module.h)("div", {
2810
2814
  class: "sending_dot"
2811
2815
  });
2812
- if (this.props.store.now() - ev.created < 900 || util/* default.getMsgField */.Z.getMsgField(ev, 'idempotency') !== ev.id) {
2816
+ if (this.props.store.now() - ev.created < 900 || util/* default */.Z.getMsgField(ev, 'idempotency') !== ev.id) {
2813
2817
  $dot = (0,preact_module.h)("div", {
2814
2818
  class: "sending_dot sending_dot__hide"
2815
2819
  });
@@ -2873,7 +2877,7 @@ class Event extends common/* Com */.up {
2873
2877
  })), $error);
2874
2878
  }
2875
2879
  renderUpdateConvo(ev) {
2876
- var state = util/* default.get */.Z.get(ev, 'data.conversation.state');
2880
+ var state = util/* default */.Z.get(ev, 'data.conversation.state');
2877
2881
  if (state === 'active') return null;
2878
2882
  if (state === 'pending') return null;
2879
2883
  return (0,preact_module.h)("div", {
@@ -2883,18 +2887,18 @@ class Event extends common/* Com */.up {
2883
2887
  }));
2884
2888
  }
2885
2889
  resendMessage() {
2886
- let cid = util/* default.convoOfEv */.Z.convoOfEv(this.props.event.ev);
2887
- const message = util/* default.get */.Z.get(this.props.event, 'ev.data.message');
2890
+ let cid = util/* default */.Z.convoOfEv(this.props.event.ev);
2891
+ const message = util/* default */.Z.get(this.props.event, 'ev.data.message');
2888
2892
  this.props.store.sendConvoEvent(cid, 'message_sent', {
2889
2893
  message
2890
2894
  });
2891
2895
  }
2892
2896
  getSenderName(ev) {
2893
- let bytype = util/* default.get */.Z.get(ev, 'by.type');
2894
- let byid = util/* default.get */.Z.get(ev, 'by.display_id', util/* default.get */.Z.get(ev, 'by.id'));
2895
- if (bytype === 'user') return util/* default.getUserDisplayName */.Z.getUserDisplayName(this.props.store.matchUser());
2897
+ let bytype = util/* default */.Z.get(ev, 'by.type');
2898
+ let byid = util/* default */.Z.get(ev, 'by.display_id', util/* default */.Z.get(ev, 'by.id'));
2899
+ if (bytype === 'user') return util/* default */.Z.getUserDisplayName(this.props.store.matchUser());
2896
2900
  let acc = this.props.store.matchAccount();
2897
- if (bytype === 'agent') return util/* default.getAgentDisplayName */.Z.getAgentDisplayName(acc, this.props.store.matchAgent(byid));
2901
+ if (bytype === 'agent') return util/* default */.Z.getAgentDisplayName(acc, this.props.store.matchAgent(byid));
2898
2902
  if (byid === 'system' || bytype === 'dummy' || bytype === 'workflow') return acc.name || 'system';
2899
2903
  return '';
2900
2904
  }
@@ -2941,7 +2945,7 @@ class Events extends common/* Com */.up {
2941
2945
  this.props.store.onConvoEvent(this, ev => this.onEvent(ev));
2942
2946
  this.loadConvo();
2943
2947
  this.refBody = null;
2944
- this.checkAndSeen = util/* default.throttle */.Z.throttle(() => {
2948
+ this.checkAndSeen = util/* default */.Z.throttle(() => {
2945
2949
  if (this.props.isShow && this.isBottom() && this.props.store.browserVisibility === 'visible' && document.hasFocus()) {
2946
2950
  this.props.store.seenConvo(this.props.cid);
2947
2951
  }
@@ -2953,8 +2957,8 @@ class Events extends common/* Com */.up {
2953
2957
  }
2954
2958
  render() {
2955
2959
  if (this.state.error) return this.renderError();
2956
- let events = util/* default.map */.Z.map(this.props.store.listEvents(this.props.cid));
2957
- if (!this.state.loading && util/* default.size */.Z.size(events) === 0) {
2960
+ let events = util/* default */.Z.map(this.props.store.listEvents(this.props.cid));
2961
+ if (!this.state.loading && util/* default */.Z.size(events) === 0) {
2958
2962
  return (0,preact_module.h)("div", {
2959
2963
  ref: ref => this.refBody = ref,
2960
2964
  class: "widget-body--events-container"
@@ -2968,13 +2972,13 @@ class Events extends common/* Com */.up {
2968
2972
  store: this.props.store
2969
2973
  }));
2970
2974
  }
2971
- events = util/* default.orderBy */.Z.orderBy(events, 'created', 'asc');
2975
+ events = util/* default */.Z.orderBy(events, 'created', 'asc');
2972
2976
  let convo = this.props.store.matchConvo(this.props.cid);
2973
- events = util/* default.map */.Z.map(events, ev => ({
2977
+ events = util/* default */.Z.map(events, ev => ({
2974
2978
  ev: ev
2975
2979
  }));
2976
2980
  processEvents(convo, events);
2977
- let $events = util/* default.map */.Z.map(events, ev => (0,preact_module.h)(Event, {
2981
+ let $events = util/* default */.Z.map(events, ev => (0,preact_module.h)(Event, {
2978
2982
  chatbox: this.props.chatbox,
2979
2983
  onLink: this.props.onLink,
2980
2984
  store: this.props.store,
@@ -2990,7 +2994,7 @@ class Events extends common/* Com */.up {
2990
2994
  if (this.state.loading || this.props.creating) {
2991
2995
  $loading = (0,preact_module.h)(Spinner, {
2992
2996
  static: true,
2993
- mode: util/* default.get */.Z.get(this.props.chatbox, 'primary_color', 'dark'),
2997
+ mode: util/* default */.Z.get(this.props.chatbox, 'primary_color', 'dark'),
2994
2998
  size: "120",
2995
2999
  center: true
2996
3000
  });
@@ -3029,23 +3033,23 @@ class Events extends common/* Com */.up {
3029
3033
  }
3030
3034
  focus() {
3031
3035
  let events = this.props.store.listEvents(this.props.cid);
3032
- events = util/* default.orderBy */.Z.orderBy(util/* default.map */.Z.map(events), 'created', 'desc');
3036
+ events = util/* default */.Z.orderBy(util/* default */.Z.map(events), 'created', 'desc');
3033
3037
  var last_agent_sent;
3034
3038
  for (let ev of events) {
3035
- if (util/* default.get */.Z.get(ev, 'type') !== 'message_sent') continue;
3036
- if (util/* default.get */.Z.get(ev, 'by.type') === 'user') continue;
3039
+ if (util/* default */.Z.get(ev, 'type') !== 'message_sent') continue;
3040
+ if (util/* default */.Z.get(ev, 'by.type') === 'user') continue;
3037
3041
  last_agent_sent = ev;
3038
3042
  break;
3039
3043
  }
3040
- if (util/* default.get */.Z.get(last_agent_sent, 'by.type') === 'user') last_agent_sent = null;
3041
- let attachments = util/* default.get */.Z.get(last_agent_sent, 'data.message.attachments', []);
3044
+ if (util/* default */.Z.get(last_agent_sent, 'by.type') === 'user') last_agent_sent = null;
3045
+ let attachments = util/* default */.Z.get(last_agent_sent, 'data.message.attachments', []);
3042
3046
  let convo = this.props.store.matchConvo(this.props.cid);
3043
- let pendingForms = util/* default.filter */.Z.filter(attachments, att => {
3047
+ let pendingForms = util/* default */.Z.filter(attachments, att => {
3044
3048
  if (!att) return false;
3045
3049
  if (att.type !== 'form' && att.type !== 'ask_info_form') return false;
3046
3050
  var form = att.form;
3047
3051
  if (!form) return false;
3048
- var state = util/* default.parseJSON */.Z.parseJSON(form.state) || {};
3052
+ var state = util/* default */.Z.parseJSON(form.state) || {};
3049
3053
  if (!state.require_finished && att.type !== 'ask_info_form') return false;
3050
3054
  if (Events_isSummited(att.form)) return false;
3051
3055
  if (convo.state === 'ended') return false;
@@ -3053,10 +3057,10 @@ class Events extends common/* Com */.up {
3053
3057
  });
3054
3058
  }
3055
3059
  onEvent(newev) {
3056
- if (util/* default.convoOfEv */.Z.convoOfEv(newev) !== this.props.cid) return;
3060
+ if (util/* default */.Z.convoOfEv(newev) !== this.props.cid) return;
3057
3061
  let isBottom = this.isBottom();
3058
3062
  var byme = false;
3059
- if (util/* default.get */.Z.get(newev, 'type') === 'message_sent' && newev.id === util/* default.getMsgField */.Z.getMsgField(newev, 'idempotency')) byme = true;
3063
+ if (util/* default */.Z.get(newev, 'type') === 'message_sent' && newev.id === util/* default */.Z.getMsgField(newev, 'idempotency')) byme = true;
3060
3064
  if (byme || isBottom) this.scrollToBottom();
3061
3065
  }
3062
3066
  async loadConvo() {
@@ -3066,7 +3070,7 @@ class Events extends common/* Com */.up {
3066
3070
  loading: true
3067
3071
  });
3068
3072
  let events = this.props.store.listEvents(this.props.cid);
3069
- if (util/* default.size */.Z.size(events) === 0) {
3073
+ if (util/* default */.Z.size(events) === 0) {
3070
3074
  let cid = this.props.cid;
3071
3075
  let {
3072
3076
  error
@@ -3090,7 +3094,7 @@ class Events extends common/* Com */.up {
3090
3094
  error: false
3091
3095
  });
3092
3096
  this.scrollToBottom();
3093
- util/* default.setTimeout */.Z.setTimeout(() => this.setState({
3097
+ util/* default */.Z.setTimeout(() => this.setState({
3094
3098
  loading: false
3095
3099
  }), 50);
3096
3100
  }
@@ -3100,11 +3104,11 @@ class Events extends common/* Com */.up {
3100
3104
  return $container.scrollHeight < $container.scrollTop + $container.offsetHeight + 50;
3101
3105
  }
3102
3106
  scrollToBottom() {
3103
- util/* default.setTimeout */.Z.setTimeout(() => {
3107
+ util/* default */.Z.setTimeout(() => {
3104
3108
  const $div = this.refBody;
3105
3109
  if ($div) $div.scrollTop = $div.scrollHeight;
3106
3110
  });
3107
- util/* default.setTimeout */.Z.setTimeout(() => {
3111
+ util/* default */.Z.setTimeout(() => {
3108
3112
  const $div = this.refBody;
3109
3113
  if ($div) $div.scrollTop = $div.scrollHeight;
3110
3114
  }, 200);
@@ -3122,13 +3126,13 @@ function processEvents(convo, events) {
3122
3126
  let curEvent = events[i];
3123
3127
  let lastEvent = events[i - 1];
3124
3128
  if (visibleEvent(curEvent.ev)) {
3125
- let elapsedSec = util/* default.unixSec */.Z.unixSec(curEvent.ev.created) - util/* default.unixSec */.Z.unixSec(lastEvent.ev.created);
3129
+ let elapsedSec = util/* default */.Z.unixSec(curEvent.ev.created) - util/* default */.Z.unixSec(lastEvent.ev.created);
3126
3130
  if (elapsedSec > 120) curEvent.show_time = true;
3127
3131
  }
3128
3132
  }
3129
3133
  for (var i = 0; i < events.length; i++) {
3130
3134
  let curEvent = events[i];
3131
- if (util/* default.get */.Z.get(curEvent, 'ev.type') === 'message_sent') {
3135
+ if (util/* default */.Z.get(curEvent, 'ev.type') === 'message_sent') {
3132
3136
  curEvent.show_time = true;
3133
3137
  break;
3134
3138
  }
@@ -3138,7 +3142,7 @@ function processEvents(convo, events) {
3138
3142
  let prevEvent = events[i - 1];
3139
3143
  if (curEvent.ev.type === 'message_sent') {
3140
3144
  curEvent.mode = 'lead';
3141
- if (util/* default.get */.Z.get(prevEvent, 'ev.type') === 'message_sent' && util/* default.get */.Z.get(prevEvent, 'ev.by.id') === util/* default.get */.Z.get(curEvent, 'ev.by.id')) {
3145
+ if (util/* default */.Z.get(prevEvent, 'ev.type') === 'message_sent' && util/* default */.Z.get(prevEvent, 'ev.by.id') === util/* default */.Z.get(curEvent, 'ev.by.id')) {
3142
3146
  curEvent.mode = 'follow';
3143
3147
  }
3144
3148
  continue;
@@ -3146,12 +3150,12 @@ function processEvents(convo, events) {
3146
3150
  }
3147
3151
  }
3148
3152
  function visibleEvent(ev) {
3149
- let type = util/* default.get */.Z.get(ev, 'type');
3153
+ let type = util/* default */.Z.get(ev, 'type');
3150
3154
  return type === 'message_sent' || type === 'conversation_state_updated';
3151
3155
  }
3152
3156
  function Events_isSummited(form) {
3153
- let fields = util/* default.get */.Z.get(form, 'fields') || [];
3154
- return util/* default.find */.Z.find(fields, field => !!field.answered);
3157
+ let fields = util/* default */.Z.get(form, 'fields') || [];
3158
+ return util/* default */.Z.find(fields, field => !!field.answered);
3155
3159
  }
3156
3160
  ;// CONCATENATED MODULE: ./src/chatbox/Typing.js
3157
3161
 
@@ -3167,29 +3171,29 @@ class Typing extends common/* Com */.up {
3167
3171
  ev: {}
3168
3172
  });
3169
3173
  this.props.store.onConvoEvent(this, ev => {
3170
- if (util/* default.convoOfEv */.Z.convoOfEv(ev) !== this.props.cid) return;
3174
+ if (util/* default */.Z.convoOfEv(ev) !== this.props.cid) return;
3171
3175
  let user = this.props.store.matchUser();
3172
- if (util/* default.get */.Z.get(ev, 'by.id') === user.id) return;
3173
- let oldby = util/* default.get */.Z.get(this.state.ev, 'by.id');
3174
- if (oldby && util/* default.get */.Z.get(ev, 'by.id') !== oldby) return;
3175
- if (util/* default.get */.Z.get(ev, 'type') === 'message_sent') {
3176
- if (this.timer) util/* default.clearTimeout */.Z.clearTimeout(this.timer);
3176
+ if (util/* default */.Z.get(ev, 'by.id') === user.id) return;
3177
+ let oldby = util/* default */.Z.get(this.state.ev, 'by.id');
3178
+ if (oldby && util/* default */.Z.get(ev, 'by.id') !== oldby) return;
3179
+ if (util/* default */.Z.get(ev, 'type') === 'message_sent') {
3180
+ if (this.timer) util/* default */.Z.clearTimeout(this.timer);
3177
3181
  this.timer = null;
3178
3182
  this.setState({
3179
3183
  isShow: false
3180
3184
  });
3181
3185
  return;
3182
3186
  }
3183
- let ag = this.props.store.matchAgent(ev.by.id) || {};
3187
+ if (util/* default */.Z.get(ev, 'type') !== 'conversation_typing') return;
3188
+ let ag = this.props.store.matchAgent(util/* default */.Z.get(ev, 'by.id')) || {};
3184
3189
  if (ag.type == 'agent') return;
3185
- if (util/* default.get */.Z.get(ev, 'type') !== 'conversation_typing') return;
3186
3190
  this.setState({
3187
3191
  ev: ev,
3188
3192
  isShow: true
3189
3193
  });
3190
- if (this.timer) util/* default.clearTimeout */.Z.clearTimeout(this.timer);
3191
- this.timer = util/* default.setTimeout */.Z.setTimeout(() => {
3192
- if (util/* default.convoOfEv */.Z.convoOfEv(ev) !== this.props.cid) return;
3194
+ if (this.timer) util/* default */.Z.clearTimeout(this.timer);
3195
+ this.timer = util/* default */.Z.setTimeout(() => {
3196
+ if (util/* default */.Z.convoOfEv(ev) !== this.props.cid) return;
3193
3197
  this.timer = null;
3194
3198
  this.setState({
3195
3199
  isShow: false
@@ -3200,8 +3204,8 @@ class Typing extends common/* Com */.up {
3200
3204
  render() {
3201
3205
  let account = this.props.store.matchAccount();
3202
3206
  var cls = this.state.isShow ? '' : 'typing--hidden';
3203
- let byid = util/* default.get */.Z.get(this.state.ev, 'by.display_id', util/* default.get */.Z.get(this.state.ev, 'by.id'));
3204
- let agentName = util/* default.getAgentDisplayName */.Z.getAgentDisplayName(account, this.props.store.matchAgent(byid));
3207
+ let byid = util/* default */.Z.get(this.state.ev, 'by.display_id', util/* default */.Z.get(this.state.ev, 'by.id'));
3208
+ let agentName = util/* default */.Z.getAgentDisplayName(account, this.props.store.matchAgent(byid));
3205
3209
  return (0,preact_module.h)("div", {
3206
3210
  class: `typing ${cls}`
3207
3211
  }, agentName, " ", this.props.t('typing'));
@@ -3220,7 +3224,7 @@ class Typing extends common/* Com */.up {
3220
3224
  this.stop();
3221
3225
  var t0;
3222
3226
  var run = t => {
3223
- if (!t) t = new util/* default.Date */.Z.Date().getTime();
3227
+ if (!t) t = new util/* default */.Z.Date().getTime();
3224
3228
  var deltaT = t - t0;
3225
3229
  var [newy, done] = this.calcY(v, y0, deltaT);
3226
3230
  cb(newy);
@@ -3228,7 +3232,7 @@ class Typing extends common/* Com */.up {
3228
3232
  this.animationframe = window.requestAnimationFrame(run);
3229
3233
  };
3230
3234
  this.animationframe = window.requestAnimationFrame(t => {
3231
- t0 = t || new util/* default.Date */.Z.Date().getTime();
3235
+ t0 = t || new util/* default */.Z.Date().getTime();
3232
3236
  run(t0);
3233
3237
  });
3234
3238
  }
@@ -3263,8 +3267,8 @@ function eqFloat(a, b) {
3263
3267
  }
3264
3268
  ;// CONCATENATED MODULE: ./src/chatbox/Rating.js
3265
3269
  function Rating_defineProperty(obj, key, value) { key = Rating_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3266
- function Rating_toPropertyKey(arg) { var key = Rating_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3267
- function Rating_toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
3270
+ function Rating_toPropertyKey(t) { var i = Rating_toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
3271
+ function Rating_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
3268
3272
 
3269
3273
 
3270
3274
  const POPUP_MAX_HEIGHT = 400;
@@ -3290,7 +3294,7 @@ class Rating extends common/* Com */.up {
3290
3294
  if (this.shoudDisplay()) this.open();
3291
3295
  });
3292
3296
  this.props.store.onConvoEvent(this, ev => {
3293
- var cid = util/* default.convoOfEv */.Z.convoOfEv(ev);
3297
+ var cid = util/* default */.Z.convoOfEv(ev);
3294
3298
  if (cid !== this.props.cid) return;
3295
3299
  if (this.shoudDisplay()) this.open();
3296
3300
  });
@@ -3399,12 +3403,12 @@ class Rating extends common/* Com */.up {
3399
3403
  var rated;
3400
3404
  var ended;
3401
3405
  let user = this.props.store.matchUser();
3402
- util/* default.map */.Z.map(this.props.store.listEvents(this.props.cid), ev => {
3403
- if (util/* default.get */.Z.get(ev, 'type') === 'conversation_state_updated' && util/* default.get */.Z.get(ev, 'data.conversation.state') === 'ended') {
3406
+ util/* default */.Z.map(this.props.store.listEvents(this.props.cid), ev => {
3407
+ if (util/* default */.Z.get(ev, 'type') === 'conversation_state_updated' && util/* default */.Z.get(ev, 'data.conversation.state') === 'ended') {
3404
3408
  ended = ev;
3405
3409
  }
3406
- if (util/* default.get */.Z.get(ev, 'type') === 'conversation_rating_requested') requested = ev;
3407
- if (util/* default.get */.Z.get(ev, 'type') === 'conversation_rated' && util/* default.get */.Z.get(ev, 'by.id') === user.id) rated = ev;
3410
+ if (util/* default */.Z.get(ev, 'type') === 'conversation_rating_requested') requested = ev;
3411
+ if (util/* default */.Z.get(ev, 'type') === 'conversation_rated' && util/* default */.Z.get(ev, 'by.id') === user.id) rated = ev;
3408
3412
  });
3409
3413
  if (rated) return false;
3410
3414
  let accountSetting = this.props.plugin.chatbox;
@@ -3445,7 +3449,7 @@ class Rating extends common/* Com */.up {
3445
3449
  hide: false
3446
3450
  });
3447
3451
  if (!this.refRating.current) return;
3448
- util/* default.setTimeout */.Z.setTimeout(() => {
3452
+ util/* default */.Z.setTimeout(() => {
3449
3453
  if (this.refComment.current) this.refComment.current.focus();
3450
3454
  }, 400);
3451
3455
  this.refComment.current.value = '';
@@ -3528,8 +3532,8 @@ class Rating extends common/* Com */.up {
3528
3532
  }
3529
3533
  ;// CONCATENATED MODULE: ./src/chatbox/DropdownSelect.js
3530
3534
  function DropdownSelect_defineProperty(obj, key, value) { key = DropdownSelect_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3531
- function DropdownSelect_toPropertyKey(arg) { var key = DropdownSelect_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3532
- function DropdownSelect_toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
3535
+ function DropdownSelect_toPropertyKey(t) { var i = DropdownSelect_toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
3536
+ function DropdownSelect_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
3533
3537
 
3534
3538
 
3535
3539
 
@@ -3567,15 +3571,15 @@ class DropdownSelect extends common/* Com */.up {
3567
3571
  });
3568
3572
  DropdownSelect_defineProperty(this, "hasSearch", () => {
3569
3573
  if (this.props.has_search) return true;
3570
- return util/* default.size */.Z.size(this.props.items) >= 10;
3574
+ return util/* default */.Z.size(this.props.items) >= 10;
3571
3575
  });
3572
3576
  DropdownSelect_defineProperty(this, "getFilteredOptions", () => {
3573
3577
  let items = this.props.items;
3574
3578
  if (this.state.searchValue && this.hasSearch()) {
3575
- items = util/* default.filter */.Z.filter(items, item => {
3576
- let optionName = util/* default.unicodeToAscii */.Z.unicodeToAscii(item.name).toLowerCase().replace(/ /g, '');
3577
- let optionDesc = util/* default.unicodeToAscii */.Z.unicodeToAscii(item.desc).toLowerCase().replace(/ /g, '');
3578
- let searchValue = util/* default.unicodeToAscii */.Z.unicodeToAscii(this.state.searchValue).toLowerCase().replace(/ /g, '');
3579
+ items = util/* default */.Z.filter(items, item => {
3580
+ let optionName = util/* default */.Z.unicodeToAscii(item.name).toLowerCase().replace(/ /g, '');
3581
+ let optionDesc = util/* default */.Z.unicodeToAscii(item.desc).toLowerCase().replace(/ /g, '');
3582
+ let searchValue = util/* default */.Z.unicodeToAscii(this.state.searchValue).toLowerCase().replace(/ /g, '');
3579
3583
  return optionName.indexOf(searchValue) != -1 || optionDesc.indexOf(searchValue) != -1;
3580
3584
  });
3581
3585
  }
@@ -3634,7 +3638,7 @@ class DropdownSelect extends common/* Com */.up {
3634
3638
  focusFilter() {
3635
3639
  if (!this.filterRef.current) return;
3636
3640
  this.filterRef.current.focus();
3637
- util/* default.setTimeout */.Z.setTimeout(() => {
3641
+ util/* default */.Z.setTimeout(() => {
3638
3642
  if (!this.filterRef.current) return;
3639
3643
  this.filterRef.current.focus();
3640
3644
  }, 100);
@@ -3642,7 +3646,7 @@ class DropdownSelect extends common/* Com */.up {
3642
3646
  renderDropdown() {
3643
3647
  if (!this.state.show) return null;
3644
3648
  let items = this.getFilteredOptions();
3645
- let $items = util/* default.map */.Z.map(items, item => {
3649
+ let $items = util/* default */.Z.map(items, item => {
3646
3650
  return (0,preact_module.h)("div", {
3647
3651
  class: "dropdown_select__item",
3648
3652
  onClick: _ => this.onSelect(item)
@@ -3703,10 +3707,10 @@ class DropdownSelect extends common/* Com */.up {
3703
3707
  class: "muted text-truncate",
3704
3708
  style: "flex: 1 !important;"
3705
3709
  }, "Ch\u1ECDn m\u1ED9t ph\u1EA7n t\u1EED");
3706
- if (util/* default.get */.Z.get(this.props, 'selected.name')) $name = (0,preact_module.h)("div", {
3710
+ if (util/* default */.Z.get(this.props, 'selected.name')) $name = (0,preact_module.h)("div", {
3707
3711
  class: "text-truncate",
3708
3712
  style: "flex: 1 !important;"
3709
- }, util/* default.get */.Z.get(this.props, 'selected.name'));
3713
+ }, util/* default */.Z.get(this.props, 'selected.name'));
3710
3714
  let style = 'position: relative !important;';
3711
3715
  if (this.props.full) {
3712
3716
  style = '';
@@ -3727,8 +3731,8 @@ class DropdownSelect extends common/* Com */.up {
3727
3731
  }
3728
3732
  ;// CONCATENATED MODULE: ./src/order/address_picker.js
3729
3733
  function address_picker_defineProperty(obj, key, value) { key = address_picker_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3730
- function address_picker_toPropertyKey(arg) { var key = address_picker_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3731
- function address_picker_toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
3734
+ function address_picker_toPropertyKey(t) { var i = address_picker_toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
3735
+ function address_picker_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
3732
3736
 
3733
3737
 
3734
3738
 
@@ -3766,13 +3770,13 @@ class AddressPicker extends common/* Com */.up {
3766
3770
  }
3767
3771
  if (e.key == 'Enter') {}
3768
3772
  });
3769
- address_picker_defineProperty(this, "doSearch", util/* default.throttle */.Z.throttle(async () => {
3773
+ address_picker_defineProperty(this, "doSearch", util/* default */.Z.throttle(async () => {
3770
3774
  let requestId = Date.now();
3771
3775
  this.requestId = requestId;
3772
3776
  let res = await this.props.store.suggest_addresses(this.state.searchValue);
3773
3777
  if (this.requestId !== requestId) return;
3774
3778
  this.setState({
3775
- addresses: util/* default.get */.Z.get(res, 'body.addresses', [])
3779
+ addresses: util/* default */.Z.get(res, 'body.addresses', [])
3776
3780
  });
3777
3781
  }, 100));
3778
3782
  address_picker_defineProperty(this, "onChangeSearchValue", e => {
@@ -3829,14 +3833,14 @@ class AddressPicker extends common/* Com */.up {
3829
3833
  focusFilter() {
3830
3834
  if (!this.filterRef.current) return;
3831
3835
  this.filterRef.current.focus();
3832
- util/* default.setTimeout */.Z.setTimeout(() => {
3836
+ util/* default */.Z.setTimeout(() => {
3833
3837
  if (!this.filterRef.current) return;
3834
3838
  this.filterRef.current.focus();
3835
3839
  }, 100);
3836
3840
  }
3837
3841
  renderDropdown() {
3838
3842
  if (!this.state.show) return null;
3839
- let $items = util/* default.map */.Z.map(this.state.addresses, (addr, i) => {
3843
+ let $items = util/* default */.Z.map(this.state.addresses, (addr, i) => {
3840
3844
  let label = [((addr.address || '') + ' ' + normalize(addr.street)).trim()].join(', ');
3841
3845
  let desc = [normalize(addr.ward), normalize(addr.district), normalize(addr.province)].join(', ');
3842
3846
  return (0,preact_module.h)("div", {
@@ -3938,7 +3942,7 @@ var $link = document.createElement('link');
3938
3942
  $link.href = 'https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap';
3939
3943
  $link.rel = 'stylesheet';
3940
3944
  document.head.append($link);
3941
- util/* default.preloadWebfonts */.Z.preloadWebfonts(['Roboto'], [400, 500]);
3945
+ util/* default */.Z.preloadWebfonts(['Roboto'], [400, 500]);
3942
3946
 
3943
3947
  let icon_defaultAvatar = __webpack_require__(4761);
3944
3948
 
@@ -3970,8 +3974,8 @@ class Icon extends common/* Com */.up {
3970
3974
  }
3971
3975
  ;// CONCATENATED MODULE: ./src/order/order.js
3972
3976
  function order_defineProperty(obj, key, value) { key = order_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3973
- function order_toPropertyKey(arg) { var key = order_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3974
- function order_toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
3977
+ function order_toPropertyKey(t) { var i = order_toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
3978
+ function order_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
3975
3979
 
3976
3980
 
3977
3981
 
@@ -4045,7 +4049,7 @@ class order_Order extends common/* Com */.up {
4045
4049
  loadDistrict: false
4046
4050
  });
4047
4051
  if (!out.error) this.setState({
4048
- districts: util/* default.get */.Z.get(out, 'body.addresses')
4052
+ districts: util/* default */.Z.get(out, 'body.addresses')
4049
4053
  });
4050
4054
  });
4051
4055
  order_defineProperty(this, "onSelectDistrict", async item => {
@@ -4064,7 +4068,7 @@ class order_Order extends common/* Com */.up {
4064
4068
  loadWard: false
4065
4069
  });
4066
4070
  if (!out.error) this.setState({
4067
- wards: util/* default.get */.Z.get(out, 'body.addresses')
4071
+ wards: util/* default */.Z.get(out, 'body.addresses')
4068
4072
  });
4069
4073
  });
4070
4074
  order_defineProperty(this, "onSelectWard", item => this.setState({
@@ -4085,7 +4089,7 @@ class order_Order extends common/* Com */.up {
4085
4089
  order_defineProperty(this, "onSelectAddress", addr => {
4086
4090
  if (!addr) return;
4087
4091
  this.setState({
4088
- address: [util/* default.trim */.Z.trim(addr.address), util/* default.trim */.Z.trim(addr.street)].join(' ').trim(),
4092
+ address: [util/* default */.Z.trim(addr.address), util/* default */.Z.trim(addr.street)].join(' ').trim(),
4089
4093
  street: addr.street,
4090
4094
  err: {},
4091
4095
  g_err: ''
@@ -4132,36 +4136,36 @@ class order_Order extends common/* Com */.up {
4132
4136
  });
4133
4137
  }
4134
4138
  if (this.state.shipping === 'shop') {
4135
- if (!util/* default.isPhone */.Z.isPhone(this.state.phone)) {
4139
+ if (!util/* default */.Z.isPhone(this.state.phone)) {
4136
4140
  err.phone = true;
4137
4141
  }
4138
- if (!util/* default.trim */.Z.trim(this.state.fullname)) {
4142
+ if (!util/* default */.Z.trim(this.state.fullname)) {
4139
4143
  err.name = true;
4140
4144
  }
4141
- if (!util/* default.trim */.Z.trim(this.state.email)) {
4145
+ if (!util/* default */.Z.trim(this.state.email)) {
4142
4146
  err.email = true;
4143
4147
  }
4144
4148
  } else if (this.state.shipping_address == 'new') {
4145
- if (!util/* default.isPhone */.Z.isPhone(this.state.phone)) {
4149
+ if (!util/* default */.Z.isPhone(this.state.phone)) {
4146
4150
  err.phone = true;
4147
4151
  }
4148
- if (!util/* default.trim */.Z.trim(this.state.fullname)) {
4152
+ if (!util/* default */.Z.trim(this.state.fullname)) {
4149
4153
  err.name = true;
4150
4154
  }
4151
- if (!util/* default.trim */.Z.trim(this.state.address)) {
4155
+ if (!util/* default */.Z.trim(this.state.address)) {
4152
4156
  err.address = true;
4153
4157
  }
4154
- if (util/* default.size */.Z.size(this.state.selectedWard) == 0) {
4158
+ if (util/* default */.Z.size(this.state.selectedWard) == 0) {
4155
4159
  err.ward = true;
4156
4160
  }
4157
- if (util/* default.size */.Z.size(this.state.selectedDistrict) == 0) {
4161
+ if (util/* default */.Z.size(this.state.selectedDistrict) == 0) {
4158
4162
  err.district = true;
4159
4163
  }
4160
- if (util/* default.size */.Z.size(this.state.selectedProvince) == 0) {
4164
+ if (util/* default */.Z.size(this.state.selectedProvince) == 0) {
4161
4165
  err.province = true;
4162
4166
  }
4163
4167
  }
4164
- if (util/* default.size */.Z.size(err) > 0) {
4168
+ if (util/* default */.Z.size(err) > 0) {
4165
4169
  this.setState({
4166
4170
  err,
4167
4171
  g_err: this.props.t('input_shipping_info_err')
@@ -4169,15 +4173,15 @@ class order_Order extends common/* Com */.up {
4169
4173
  return;
4170
4174
  }
4171
4175
  let user = this.props.store.matchUser();
4172
- let ufullname = util/* default.getUserAttr */.Z.getUserAttr(user, 'fullname', 'text');
4173
- let uemail = util/* default.getUserAttr */.Z.getUserAttr(user, 'emails', 'text');
4174
- let uphone = util/* default.getUserAttr */.Z.getUserAttr(user, 'phones', 'text');
4175
- let order = util/* default.cloneDeep */.Z.cloneDeep(this.state.order);
4176
+ let ufullname = util/* default */.Z.getUserAttr(user, 'fullname', 'text');
4177
+ let uemail = util/* default */.Z.getUserAttr(user, 'emails', 'text');
4178
+ let uphone = util/* default */.Z.getUserAttr(user, 'phones', 'text');
4179
+ let order = util/* default */.Z.cloneDeep(this.state.order);
4176
4180
  if (this.state.shipping === 'shop') {
4177
- util/* default.set */.Z.set(order, 'shipping.pickup_at_shop', true);
4178
- util/* default.set */.Z.set(order, 'shipping.address.phone', this.state.phone);
4179
- util/* default.set */.Z.set(order, 'shipping.address.fullname', this.state.fullname);
4180
- util/* default.set */.Z.set(order, 'shipping.address.email', this.state.email);
4181
+ util/* default */.Z.set(order, 'shipping.pickup_at_shop', true);
4182
+ util/* default */.Z.set(order, 'shipping.address.phone', this.state.phone);
4183
+ util/* default */.Z.set(order, 'shipping.address.fullname', this.state.fullname);
4184
+ util/* default */.Z.set(order, 'shipping.address.email', this.state.email);
4181
4185
  } else {
4182
4186
  if (this.state.shipping_address == 'new') {
4183
4187
  let out = await this.props.store.createShippingAddress({
@@ -4197,37 +4201,37 @@ class order_Order extends common/* Com */.up {
4197
4201
  if (out.error) return this.setState({
4198
4202
  g_err: this.props.t('update_failed')
4199
4203
  });
4200
- util/* default.set */.Z.set(order, 'shipping.address', out.body);
4204
+ util/* default */.Z.set(order, 'shipping.address', out.body);
4201
4205
  } else {
4202
4206
  let addresses = this.props.store.matchShippingAddresses();
4203
- let sa = util/* default.find */.Z.find(addresses, addr => addr.id === this.state.shipping_address);
4207
+ let sa = util/* default */.Z.find(addresses, addr => addr.id === this.state.shipping_address);
4204
4208
  if (!sa) {
4205
4209
  return this.setState({
4206
4210
  err,
4207
4211
  g_err: this.props.t('input_shipping_info_err')
4208
4212
  });
4209
4213
  }
4210
- util/* default.set */.Z.set(order, 'shipping.address', sa);
4214
+ util/* default */.Z.set(order, 'shipping.address', sa);
4211
4215
  }
4212
4216
  }
4213
4217
  let changeduser = false;
4214
4218
  if (!ufullname && this.state.fullname) {
4215
4219
  changeduser = true;
4216
- util/* default.setUserAttr */.Z.setUserAttr(user, {
4220
+ util/* default */.Z.setUserAttr(user, {
4217
4221
  key: 'fullname',
4218
4222
  text: this.state.fullname
4219
4223
  });
4220
4224
  }
4221
4225
  if (!uemail && this.state.email) {
4222
4226
  changeduser = true;
4223
- util/* default.setUserAttr */.Z.setUserAttr(user, {
4227
+ util/* default */.Z.setUserAttr(user, {
4224
4228
  key: 'emails',
4225
4229
  text: this.state.email
4226
4230
  });
4227
4231
  }
4228
4232
  if (!uphone && this.state.phone) {
4229
4233
  changeduser = true;
4230
- util/* default.setUserAttr */.Z.setUserAttr(user, {
4234
+ util/* default */.Z.setUserAttr(user, {
4231
4235
  key: 'phones',
4232
4236
  text: this.state.phone
4233
4237
  });
@@ -4254,7 +4258,7 @@ class order_Order extends common/* Com */.up {
4254
4258
  order_defineProperty(this, "onCancel", () => {
4255
4259
  if (this.props.onResponse) this.props.onResponse('rejected');
4256
4260
  if (this.props.cid && !this.state.order.user_confirmation) {
4257
- let order = util/* default.cloneDeep */.Z.cloneDeep(this.state.order);
4261
+ let order = util/* default */.Z.cloneDeep(this.state.order);
4258
4262
  order.user_confirmation = 'rejected';
4259
4263
  this.props.store.updateOrder(order);
4260
4264
  }
@@ -4281,10 +4285,10 @@ class order_Order extends common/* Com */.up {
4281
4285
  });
4282
4286
  }
4283
4287
  let user = this.props.store.matchUser();
4284
- let attributes = util/* default.get */.Z.get(this.props.store.matchUser(), 'attributes', []);
4285
- let fullname = util/* default.get */.Z.get(util/* default.find */.Z.find(attributes, att => att.key === 'fullname'), 'text');
4286
- let email = util/* default.get */.Z.get(util/* default.find */.Z.find(attributes, att => att.key === 'emails'), 'text');
4287
- let phone = util/* default.get */.Z.get(util/* default.find */.Z.find(attributes, att => att.key === 'phones'), 'text');
4288
+ let attributes = util/* default */.Z.get(this.props.store.matchUser(), 'attributes', []);
4289
+ let fullname = util/* default */.Z.get(util/* default */.Z.find(attributes, att => att.key === 'fullname'), 'text');
4290
+ let email = util/* default */.Z.get(util/* default */.Z.find(attributes, att => att.key === 'emails'), 'text');
4291
+ let phone = util/* default */.Z.get(util/* default */.Z.find(attributes, att => att.key === 'phones'), 'text');
4288
4292
  this.setState({
4289
4293
  fullname,
4290
4294
  email,
@@ -4296,7 +4300,7 @@ class order_Order extends common/* Com */.up {
4296
4300
  loadProvince: false
4297
4301
  });
4298
4302
  if (!out.error) this.setState({
4299
- provinces: util/* default.get */.Z.get(out, 'body.addresses')
4303
+ provinces: util/* default */.Z.get(out, 'body.addresses')
4300
4304
  });
4301
4305
  }
4302
4306
  isMobile() {
@@ -4326,7 +4330,7 @@ class order_Order extends common/* Com */.up {
4326
4330
  }
4327
4331
  if (editmode) {
4328
4332
  let pms = this.props.store.matchPaymentMethods();
4329
- let $pms = util/* default.map */.Z.map(pms, pm => {
4333
+ let $pms = util/* default */.Z.map(pms, pm => {
4330
4334
  let $name = pm.description;
4331
4335
  if (pm.method == 'bank_transfer') {
4332
4336
  $name = pm.description + ' ' + pm.bank_name + ' ' + pm.bank_branch;
@@ -4407,15 +4411,15 @@ class order_Order extends common/* Com */.up {
4407
4411
  let user = this.props.store.matchUser();
4408
4412
  if (editmode) {
4409
4413
  let addresses = this.props.store.matchShippingAddresses();
4410
- let provinces = util/* default.map */.Z.map(this.state.provinces, province => ({
4414
+ let provinces = util/* default */.Z.map(this.state.provinces, province => ({
4411
4415
  id: province.id,
4412
4416
  name: province.province
4413
4417
  }));
4414
- let districts = util/* default.map */.Z.map(this.state.districts, district => ({
4418
+ let districts = util/* default */.Z.map(this.state.districts, district => ({
4415
4419
  id: district.id,
4416
4420
  name: district.district
4417
4421
  }));
4418
- let wards = util/* default.map */.Z.map(this.state.wards, ward => ({
4422
+ let wards = util/* default */.Z.map(this.state.wards, ward => ({
4419
4423
  id: ward.id,
4420
4424
  name: ward.ward
4421
4425
  }));
@@ -4424,7 +4428,7 @@ class order_Order extends common/* Com */.up {
4424
4428
  let ship_icon_active = false;
4425
4429
  if (this.state.shipping === 'ship') {
4426
4430
  ship_icon_active = true;
4427
- let $preaddrs = util/* default.map */.Z.map(addresses, addr => {
4431
+ let $preaddrs = util/* default */.Z.map(addresses, addr => {
4428
4432
  let fulladdr = [addr.street, addr.ward, addr.district, addr.region, addr.country].filter(a => a).join(', ');
4429
4433
  let $phone = null;
4430
4434
  if (addr.phone) {
@@ -4556,7 +4560,7 @@ class order_Order extends common/* Com */.up {
4556
4560
  style: "flex: 1 !important; margin-left: 7px !important;"
4557
4561
  })));
4558
4562
  cls += ' ship_card__active';
4559
- if (util/* default.size */.Z.size(addresses) == 0) {
4563
+ if (util/* default */.Z.size(addresses) == 0) {
4560
4564
  $body = (0,preact_module.h)("div", null, (0,preact_module.h)("div", {
4561
4565
  class: 'mt-3 mb-2 '
4562
4566
  }, this.props.t('input_shipping_info')), $new);
@@ -4634,13 +4638,13 @@ class order_Order extends common/* Com */.up {
4634
4638
  class: "ml-2"
4635
4639
  }, "Giao h\xE0ng cho t\xF4i"))), $body));
4636
4640
  }
4637
- let addr = util/* default.get */.Z.get(order, 'shipping.address') || {};
4641
+ let addr = util/* default */.Z.get(order, 'shipping.address') || {};
4638
4642
  let fulladdr = [addr.address, addr.ward, addr.district, addr.region, addr.country].filter(a => a).join(', ');
4639
4643
  let $phone = null;
4640
4644
  if (addr.phone) $phone = (0,preact_module.h)("div", {
4641
4645
  class: "mt-1 muted"
4642
4646
  }, this.props.t('phn'), ":\xA0", addr.phone);
4643
- if (util/* default.get */.Z.get(order, 'shipping.pickup_at_shop')) {
4647
+ if (util/* default */.Z.get(order, 'shipping.pickup_at_shop')) {
4644
4648
  fulladdr = 'Nhận hàng tại cửa hàng';
4645
4649
  }
4646
4650
  let $addr = fulladdr ? (0,preact_module.h)("div", null, fulladdr) : (0,preact_module.h)("i", {
@@ -4659,28 +4663,28 @@ class order_Order extends common/* Com */.up {
4659
4663
  if (order.deposit > 0) {
4660
4664
  $deposit = (0,preact_module.h)("span", {
4661
4665
  class: "muted"
4662
- }, "(c\u1ECDc ", util/* default.formatCurrency */.Z.formatCurrency(order.deposit), ")");
4666
+ }, "(c\u1ECDc ", util/* default */.Z.formatCurrency(order.deposit), ")");
4663
4667
  }
4664
4668
  let $discount = null;
4665
4669
  if (order.total_discount > 0) {
4666
4670
  $discount = (0,preact_module.h)("div", {
4667
4671
  class: "order_summary_line"
4668
- }, (0,preact_module.h)("div", null, "Gi\u1EA3m gi\xE1"), (0,preact_module.h)("div", null, util/* default.formatCurrency */.Z.formatCurrency(order.total_discount)));
4672
+ }, (0,preact_module.h)("div", null, "Gi\u1EA3m gi\xE1"), (0,preact_module.h)("div", null, util/* default */.Z.formatCurrency(order.total_discount)));
4669
4673
  }
4670
4674
  let $pay = null;
4671
4675
  if ($deposit || order.payment_made) {
4672
4676
  $pay = (0,preact_module.h)(preact_module/* Fragment */.HY, null, (0,preact_module.h)("div", {
4673
4677
  class: "order_summary_line"
4674
- }, (0,preact_module.h)("div", null, "B\u1EA1n \u0111\xE3 tr\u1EA3"), (0,preact_module.h)("div", null, $deposit, " ", util/* default.formatCurrency */.Z.formatCurrency(order.payment_made))), (0,preact_module.h)("div", {
4678
+ }, (0,preact_module.h)("div", null, "B\u1EA1n \u0111\xE3 tr\u1EA3"), (0,preact_module.h)("div", null, $deposit, " ", util/* default */.Z.formatCurrency(order.payment_made))), (0,preact_module.h)("div", {
4675
4679
  class: "order_summary_line"
4676
- }, (0,preact_module.h)("div", null, "B\u1EA1n ch\u01B0a tr\u1EA3"), (0,preact_module.h)("div", null, util/* default.formatCurrency */.Z.formatCurrency((order.total || 0) - (order.payment_made || 0)))));
4680
+ }, (0,preact_module.h)("div", null, "B\u1EA1n ch\u01B0a tr\u1EA3"), (0,preact_module.h)("div", null, util/* default */.Z.formatCurrency((order.total || 0) - (order.payment_made || 0)))));
4677
4681
  }
4678
4682
  let $tax = (0,preact_module.h)("div", {
4679
4683
  class: "order_summary_line"
4680
- }, (0,preact_module.h)("div", null, "Ti\u1EC1n thu\u1EBF"), (0,preact_module.h)("div", null, util/* default.formatCurrency */.Z.formatCurrency(order.total_tax)));
4684
+ }, (0,preact_module.h)("div", null, "Ti\u1EC1n thu\u1EBF"), (0,preact_module.h)("div", null, util/* default */.Z.formatCurrency(order.total_tax)));
4681
4685
  let $ship = (0,preact_module.h)("div", {
4682
4686
  class: "order_summary_line"
4683
- }, (0,preact_module.h)("div", null, "Ph\xED v\u1EADn chuy\u1EC3n"), (0,preact_module.h)("div", null, util/* default.get */.Z.get(order, 'shipping.fee', 0), " d"));
4687
+ }, (0,preact_module.h)("div", null, "Ph\xED v\u1EADn chuy\u1EC3n"), (0,preact_module.h)("div", null, util/* default */.Z.get(order, 'shipping.fee', 0), " d"));
4684
4688
  let editmode = false;
4685
4689
  if (!order.status || order.status == 'open') {
4686
4690
  editmode = !order.user_confirmation;
@@ -4706,12 +4710,12 @@ class order_Order extends common/* Com */.up {
4706
4710
  class: "order_label"
4707
4711
  }, "T\xF3m t\u1EAFt"), (0,preact_module.h)("div", {
4708
4712
  class: "order_summary_line"
4709
- }, (0,preact_module.h)("div", null, "T\u1ED5ng ti\u1EC1n h\xE0ng"), (0,preact_module.h)("div", null, util/* default.formatCurrency */.Z.formatCurrency(order.subtotal))), $tax, $discount, $ship, $note, (0,preact_module.h)("div", {
4713
+ }, (0,preact_module.h)("div", null, "T\u1ED5ng ti\u1EC1n h\xE0ng"), (0,preact_module.h)("div", null, util/* default */.Z.formatCurrency(order.subtotal))), $tax, $discount, $ship, $note, (0,preact_module.h)("div", {
4710
4714
  class: "order_summary_line",
4711
4715
  style: "margin-top: 10px !important; padding-top: 15px !important; border-top: 1px solid #eee !important"
4712
4716
  }, (0,preact_module.h)("div", null, "B\u1EA1n ph\u1EA3i tr\u1EA3"), (0,preact_module.h)("div", {
4713
4717
  class: "order__total"
4714
- }, util/* default.formatCurrency */.Z.formatCurrency(order.total))), $pay));
4718
+ }, util/* default */.Z.formatCurrency(order.total))), $pay));
4715
4719
  }
4716
4720
  renderStatusBadge(order) {
4717
4721
  let status = order.status || 'open';
@@ -4722,9 +4726,9 @@ class order_Order extends common/* Com */.up {
4722
4726
  }
4723
4727
  renderShippingInfo(order) {
4724
4728
  if (order.status != 'open' || order.user_confirmation) {}
4725
- let shipping_provider = util/* default.get */.Z.get(order, 'shipping.shipping_provider');
4729
+ let shipping_provider = util/* default */.Z.get(order, 'shipping.shipping_provider');
4726
4730
  if (!shipping_provider) return null;
4727
- let shipping_code = util/* default.get */.Z.get(order, 'shipping.shipping_code');
4731
+ let shipping_code = util/* default */.Z.get(order, 'shipping.shipping_code');
4728
4732
  let $tracking_code = null;
4729
4733
  if (shipping_code) $tracking_code = (0,preact_module.h)("div", {
4730
4734
  class: "muted",
@@ -4752,9 +4756,9 @@ class order_Order extends common/* Com */.up {
4752
4756
  return null;
4753
4757
  }
4754
4758
  renderDesktopShippingInfo(order) {
4755
- let shipping_provider = util/* default.get */.Z.get(order, 'shipping.shipping_provider');
4759
+ let shipping_provider = util/* default */.Z.get(order, 'shipping.shipping_provider');
4756
4760
  if (!shipping_provider) return null;
4757
- let shipping_code = util/* default.get */.Z.get(order, 'shipping.shipping_code');
4761
+ let shipping_code = util/* default */.Z.get(order, 'shipping.shipping_code');
4758
4762
  let $tracking_code = null;
4759
4763
  if (shipping_code) $tracking_code = (0,preact_module.h)("div", {
4760
4764
  class: "muted",
@@ -4781,7 +4785,7 @@ class order_Order extends common/* Com */.up {
4781
4785
  }
4782
4786
  renderProducts(order) {
4783
4787
  let $products = null;
4784
- $products = util/* default.map */.Z.map(order.items, item => {
4788
+ $products = util/* default */.Z.map(order.items, item => {
4785
4789
  if (!item || !item.product) return null;
4786
4790
  let product = item.product;
4787
4791
  return (0,preact_module.h)("div", {
@@ -4789,7 +4793,7 @@ class order_Order extends common/* Com */.up {
4789
4793
  }, (0,preact_module.h)("img", {
4790
4794
  class: "order_attachment__product_img",
4791
4795
  alt: '' + product.id,
4792
- src: util/* default.get */.Z.get(product, 'images.0') || __webpack_require__(9270)
4796
+ src: util/* default */.Z.get(product, 'images.0') || __webpack_require__(9270)
4793
4797
  }), (0,preact_module.h)("div", {
4794
4798
  style: "overflow: hidden !important;"
4795
4799
  }, (0,preact_module.h)("div", {
@@ -4798,7 +4802,7 @@ class order_Order extends common/* Com */.up {
4798
4802
  class: "order_attachment__product_desc"
4799
4803
  }, product.description || product.long_description), (0,preact_module.h)("div", {
4800
4804
  class: "order_attachment__product_desc"
4801
- }, this.props.t('qty'), " ", item.quantity, "\xA0\xB7\xA0", util/* default.formatCurrency */.Z.formatCurrency(product.price))));
4805
+ }, this.props.t('qty'), " ", item.quantity, "\xA0\xB7\xA0", util/* default */.Z.formatCurrency(product.price))));
4802
4806
  });
4803
4807
  if (!this.isMobile()) return (0,preact_module.h)("div", null, (0,preact_module.h)("div", {
4804
4808
  class: "order_label"
@@ -4816,7 +4820,7 @@ class order_Order extends common/* Com */.up {
4816
4820
  editmode = !order.user_confirmation;
4817
4821
  }
4818
4822
  if (editmode) {
4819
- $products = util/* default.map */.Z.map(order.items, item => {
4823
+ $products = util/* default */.Z.map(order.items, item => {
4820
4824
  if (!item || !item.product) return null;
4821
4825
  let product = item.product;
4822
4826
  return (0,preact_module.h)("div", {
@@ -4824,7 +4828,7 @@ class order_Order extends common/* Com */.up {
4824
4828
  }, (0,preact_module.h)("img", {
4825
4829
  class: "order_attachment__product_img",
4826
4830
  alt: '' + product.id,
4827
- src: util/* default.get */.Z.get(product, 'images.0') || __webpack_require__(9270)
4831
+ src: util/* default */.Z.get(product, 'images.0') || __webpack_require__(9270)
4828
4832
  }), (0,preact_module.h)("div", {
4829
4833
  style: "overflow: hidden !important; flex: 1 !important"
4830
4834
  }, (0,preact_module.h)("div", {
@@ -4833,7 +4837,7 @@ class order_Order extends common/* Com */.up {
4833
4837
  class: "order_attachment__product_desc"
4834
4838
  }, product.description || product.long_description), (0,preact_module.h)("div", {
4835
4839
  class: "order_attachment__product_desc"
4836
- }, util/* default.formatCurrency */.Z.formatCurrency(product.price))), (0,preact_module.h)("input", {
4840
+ }, util/* default */.Z.formatCurrency(product.price))), (0,preact_module.h)("input", {
4837
4841
  class: "form-control",
4838
4842
  style: "text-align: center !important; font-weight: 400 !important; width: 50px !important",
4839
4843
  value: item.quantity,
@@ -4841,10 +4845,10 @@ class order_Order extends common/* Com */.up {
4841
4845
  type: "text"
4842
4846
  }), (0,preact_module.h)("div", {
4843
4847
  style: "width: 80px !important; text-align: right !important; "
4844
- }, (0,preact_module.h)("b", null, util/* default.formatCurrency */.Z.formatCurrency(item.quantity * product.price))));
4848
+ }, (0,preact_module.h)("b", null, util/* default */.Z.formatCurrency(item.quantity * product.price))));
4845
4849
  });
4846
4850
  } else {
4847
- $products = util/* default.map */.Z.map(order.items, item => {
4851
+ $products = util/* default */.Z.map(order.items, item => {
4848
4852
  if (!item || !item.product) return null;
4849
4853
  let product = item.product;
4850
4854
  return (0,preact_module.h)("div", {
@@ -4852,7 +4856,7 @@ class order_Order extends common/* Com */.up {
4852
4856
  }, (0,preact_module.h)("img", {
4853
4857
  class: "order_attachment__product_img",
4854
4858
  alt: '' + product.id,
4855
- src: util/* default.get */.Z.get(product, 'images.0') || __webpack_require__(9270)
4859
+ src: util/* default */.Z.get(product, 'images.0') || __webpack_require__(9270)
4856
4860
  }), (0,preact_module.h)("div", {
4857
4861
  style: "overflow: hidden !important; flex: 1 !important"
4858
4862
  }, (0,preact_module.h)("div", {
@@ -4861,11 +4865,11 @@ class order_Order extends common/* Com */.up {
4861
4865
  class: "order_attachment__product_desc"
4862
4866
  }, product.description || product.long_description), (0,preact_module.h)("div", {
4863
4867
  class: "order_attachment__product_desc"
4864
- }, util/* default.formatCurrency */.Z.formatCurrency(product.price))), (0,preact_module.h)("div", {
4868
+ }, util/* default */.Z.formatCurrency(product.price))), (0,preact_module.h)("div", {
4865
4869
  style: "text-align: center !important; font-weight: 400 !important; width: 50px !important"
4866
4870
  }, item.quantity), (0,preact_module.h)("div", {
4867
4871
  style: "width: 80px !important; text-align: right !important; "
4868
- }, (0,preact_module.h)("b", null, util/* default.formatCurrency */.Z.formatCurrency(item.total))));
4872
+ }, (0,preact_module.h)("b", null, util/* default */.Z.formatCurrency(item.total))));
4869
4873
  });
4870
4874
  }
4871
4875
  return (0,preact_module.h)("div", {
@@ -5040,8 +5044,8 @@ let ShippingProvider = {
5040
5044
  };
5041
5045
  ;// CONCATENATED MODULE: ./src/chatbox/Order.js
5042
5046
  function Order_defineProperty(obj, key, value) { key = Order_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5043
- function Order_toPropertyKey(arg) { var key = Order_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
5044
- function Order_toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
5047
+ function Order_toPropertyKey(t) { var i = Order_toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
5048
+ function Order_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5045
5049
 
5046
5050
 
5047
5051
 
@@ -5083,7 +5087,7 @@ class Order extends common/* Com */.up {
5083
5087
  });
5084
5088
  });
5085
5089
  Order_defineProperty(this, "close", async () => {
5086
- await util/* default.sleep */.Z.sleep(100);
5090
+ await util/* default */.Z.sleep(100);
5087
5091
  if (this.state.response === 'confirmed') {
5088
5092
  this.props.store.sendConvoEvent(this.props.cid, 'message_sent', {
5089
5093
  message: {
@@ -5184,7 +5188,7 @@ class Order extends common/* Com */.up {
5184
5188
  render() {
5185
5189
  if (this._show != this.props.show) {
5186
5190
  this._show = this.props.show;
5187
- util/* default.setTimeout */.Z.setTimeout(() => {
5191
+ util/* default */.Z.setTimeout(() => {
5188
5192
  if (!this._show) this.close();else this.open();
5189
5193
  });
5190
5194
  }
@@ -5285,8 +5289,8 @@ class Order extends common/* Com */.up {
5285
5289
  }
5286
5290
  ;// CONCATENATED MODULE: ./src/chatbox/Widget.js
5287
5291
  function Widget_defineProperty(obj, key, value) { key = Widget_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5288
- function Widget_toPropertyKey(arg) { var key = Widget_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
5289
- function Widget_toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
5292
+ function Widget_toPropertyKey(t) { var i = Widget_toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
5293
+ function Widget_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5290
5294
 
5291
5295
 
5292
5296
 
@@ -5311,7 +5315,7 @@ class Widget extends common/* Com */.up {
5311
5315
  super(props);
5312
5316
  Widget_defineProperty(this, "msgInput", (0,preact_module/* createRef */.Vf)());
5313
5317
  Widget_defineProperty(this, "sendMessage", async message => {
5314
- let hasPostback = util/* default.find */.Z.find(message.attachments, att => att.type === 'postback');
5318
+ let hasPostback = util/* default */.Z.find(message.attachments, att => att.type === 'postback');
5315
5319
  if (this.isFormRequired() && hasPostback) {
5316
5320
  this.onStartConvoClick();
5317
5321
  this.fillQuickReplyToQuestion(message);
@@ -5390,7 +5394,7 @@ class Widget extends common/* Com */.up {
5390
5394
  clickedJoin: false,
5391
5395
  quickReplyMessage: {}
5392
5396
  });
5393
- util/* default.setTimeout */.Z.setTimeout(() => {
5397
+ util/* default */.Z.setTimeout(() => {
5394
5398
  this.events && this.events.focus();
5395
5399
  if (!this.props.store.isMobile()) this.focusInput();
5396
5400
  }, 100);
@@ -5401,10 +5405,10 @@ class Widget extends common/* Com */.up {
5401
5405
  let form;
5402
5406
  let accountSetting = this.props.plugin.chatbox || {};
5403
5407
  let acc = this.props.store.matchAccount() || {};
5404
- if (util/* default.get */.Z.get(accountSetting, 'prechat_form.enabled')) form = accountSetting.prechat_form;
5405
- let offlineEnabled = util/* default.get */.Z.get(accountSetting, 'offline_form.enabled');
5408
+ if (util/* default */.Z.get(accountSetting, 'prechat_form.enabled')) form = accountSetting.prechat_form;
5409
+ let offlineEnabled = util/* default */.Z.get(accountSetting, 'offline_form.enabled');
5406
5410
  if (this.isOffline(acc, accountSetting) && offlineEnabled) form = accountSetting.offline_form;
5407
- if (!this.hasSentMessage(this.props.cid) && form && (util/* default.size */.Z.size(form.groups) || form.group_required)) return true;
5411
+ if (!this.hasSentMessage(this.props.cid) && form && (util/* default */.Z.size(form.groups) || form.group_required)) return true;
5408
5412
  let formRequired = this.isFormRequired();
5409
5413
  return formRequired && !this.props.cid || formRequired && this.props.cid && this.state.clickedJoin;
5410
5414
  }
@@ -5414,8 +5418,8 @@ class Widget extends common/* Com */.up {
5414
5418
  let accountSetting = this.props.plugin.chatbox || {};
5415
5419
  let acc = this.props.store.matchAccount() || {};
5416
5420
  let submitLabel = this.props.t('prechat_form_btn');
5417
- if (util/* default.get */.Z.get(accountSetting, 'prechat_form.enabled')) form = accountSetting.prechat_form;
5418
- let offlineEnabled = util/* default.get */.Z.get(accountSetting, 'offline_form.enabled');
5421
+ if (util/* default */.Z.get(accountSetting, 'prechat_form.enabled')) form = accountSetting.prechat_form;
5422
+ let offlineEnabled = util/* default */.Z.get(accountSetting, 'offline_form.enabled');
5419
5423
  if (this.isOffline(acc, accountSetting) && offlineEnabled) {
5420
5424
  form = accountSetting.offline_form;
5421
5425
  submitLabel = this.props.t('offline_form_btn');
@@ -5432,9 +5436,10 @@ class Widget extends common/* Com */.up {
5432
5436
  }
5433
5437
  let $body = null;
5434
5438
  if (this.props.view === 'list') $body = this.renderConvoList();else if (showform) $body = this.renderForm(form, submitLabel);else $body = this.renderChat();
5435
- let position = util/* default.get */.Z.get(accountSetting, 'desktop_button.position') || 'right';
5436
- if (this.props.store.isMobile()) position = util/* default.get */.Z.get(accountSetting, 'mobile_button.position', position);
5439
+ let position = util/* default */.Z.get(accountSetting, 'desktop_button.position') || 'right';
5440
+ if (this.props.store.isMobile()) position = util/* default */.Z.get(accountSetting, 'mobile_button.position', position);
5437
5441
  let cls = 'widget-container widget-container--' + position;
5442
+ if (!this.props.store.isMobile() && util/* default */.Z.get(accountSetting, 'window_mode') === 'full') cls += ' widget-container--full';
5438
5443
  if (!this.props.isShow) cls += ' widget-container--hide';
5439
5444
  return (0,preact_module.h)("div", {
5440
5445
  class: cls
@@ -5452,42 +5457,42 @@ class Widget extends common/* Com */.up {
5452
5457
  }
5453
5458
  async submitPrechatForm(form) {
5454
5459
  var hasError = false;
5455
- util/* default.map */.Z.map(this.state.formData, (field, key) => {
5456
- if (field.is_required && (field.value === undefined || field.value === '' || util/* default.size */.Z.size(field.value) === 0 && Array.isArray(field.value))) {
5460
+ util/* default */.Z.map(this.state.formData, (field, key) => {
5461
+ if (field.is_required && (field.value === undefined || field.value === '' || util/* default */.Z.size(field.value) === 0 && Array.isArray(field.value))) {
5457
5462
  field.error = this.props.t('error_empty');
5458
5463
  hasError = true;
5459
5464
  } else field.error = '';
5460
- if (key.substr(5) === 'emails' && !util/* default.isEmail */.Z.isEmail(field.value) && field.is_required) {
5465
+ if (key.substr(5) === 'emails' && !util/* default */.Z.isEmail(field.value) && field.is_required) {
5461
5466
  field.error = this.props.t('error_email_invalid');
5462
5467
  hasError = true;
5463
5468
  }
5464
- if (key.substr(5) === 'phones' && !util/* default.isPhone */.Z.isPhone(field.value) && field.is_required) {
5469
+ if (key.substr(5) === 'phones' && !util/* default */.Z.isPhone(field.value) && field.is_required) {
5465
5470
  field.error = this.props.t('error_phone_invalid');
5466
5471
  hasError = true;
5467
5472
  }
5468
5473
  });
5469
5474
  if (hasError) return this.forceUpdate();
5470
- let data = util/* default.cloneDeep */.Z.cloneDeep(this.state.formData);
5471
- let user = util/* default.cloneDeep */.Z.cloneDeep(this.props.store.matchUser());
5475
+ let data = util/* default */.Z.cloneDeep(this.state.formData);
5476
+ let user = util/* default */.Z.cloneDeep(this.props.store.matchUser());
5472
5477
  let is_lead = false;
5473
- util/* default.map */.Z.map(data, (field, key) => {
5478
+ util/* default */.Z.map(data, (field, key) => {
5474
5479
  if (!key.startsWith('attr:')) return;
5475
5480
  var attr = {
5476
5481
  key: key.substr(5)
5477
5482
  };
5478
5483
  is_lead = is_lead || key == 'emails' || key == 'phones';
5479
5484
  if (field.type === 'number') attr.number = parseInt(field.value);
5480
- if (field.type === 'datetime') attr.datetime = new util/* default.Date */.Z.Date(field.value).toISOString();
5485
+ if (field.type === 'datetime') attr.datetime = new util/* default */.Z.Date(field.value).toISOString();
5481
5486
  if (field.type === 'list') attr.text = field.value;
5482
5487
  if (field.type === 'text' || field.type === 'boolean') attr[field.type] = field.value;
5483
- util/* default.setUserAttr */.Z.setUserAttr(user, attr);
5488
+ util/* default */.Z.setUserAttr(user, attr);
5484
5489
  });
5485
- if (is_lead) util/* default.setUserAttr */.Z.setUserAttr(user, {
5490
+ if (is_lead) util/* default */.Z.setUserAttr(user, {
5486
5491
  key: 'lead_source',
5487
5492
  text: 'widget'
5488
5493
  });
5489
- let firstmsg = util/* default.get */.Z.get(data, 'question.value');
5490
- let groupid = util/* default.get */.Z.get(data, 'group.value', '');
5494
+ let firstmsg = util/* default */.Z.get(data, 'question.value');
5495
+ let groupid = util/* default */.Z.get(data, 'group.value', '');
5491
5496
  if (this.props.cid) {
5492
5497
  this.props.store.setUser(user);
5493
5498
  this.setState({
@@ -5499,7 +5504,7 @@ class Widget extends common/* Com */.up {
5499
5504
  format: 'plaintext',
5500
5505
  fields: [{
5501
5506
  key: 'to_agent_group',
5502
- value: util/* default.stringify */.Z.stringify(groupid)
5507
+ value: util/* default */.Z.stringify(groupid)
5503
5508
  }],
5504
5509
  attachments: this.state.quickReplyMessage.attachments
5505
5510
  }
@@ -5559,7 +5564,7 @@ class Widget extends common/* Com */.up {
5559
5564
  formData['question'] = {
5560
5565
  key: 'question',
5561
5566
  is_required: true,
5562
- label: this.props.t.i18n(util/* default.get */.Z.get(form, `i18n_question_label`, {})) || form.question_label,
5567
+ label: this.props.t.i18n(util/* default */.Z.get(form, `i18n_question_label`, {})) || form.question_label,
5563
5568
  type: 'text',
5564
5569
  value: this.state.quickReplyMessage.text
5565
5570
  };
@@ -5570,8 +5575,8 @@ class Widget extends common/* Com */.up {
5570
5575
  }
5571
5576
  onBooleanChange(key, e) {
5572
5577
  this.wasFormInputed = true;
5573
- let formData = util/* default.cloneDeep */.Z.cloneDeep(this.state.formData);
5574
- let field = util/* default.find */.Z.find(formData, (_, fkkey) => fkkey === key);
5578
+ let formData = util/* default */.Z.cloneDeep(this.state.formData);
5579
+ let field = util/* default */.Z.find(formData, (_, fkkey) => fkkey === key);
5575
5580
  if (!field) return;
5576
5581
  field.value = e.target.checked;
5577
5582
  this.setState({
@@ -5580,8 +5585,8 @@ class Widget extends common/* Com */.up {
5580
5585
  }
5581
5586
  onInputChange(key, val) {
5582
5587
  this.wasFormInputed = true;
5583
- let formData = util/* default.cloneDeep */.Z.cloneDeep(this.state.formData);
5584
- let field = util/* default.find */.Z.find(formData, (_, fkkey) => fkkey === key);
5588
+ let formData = util/* default */.Z.cloneDeep(this.state.formData);
5589
+ let field = util/* default */.Z.find(formData, (_, fkkey) => fkkey === key);
5585
5590
  if (!field) return;
5586
5591
  field.value = val;
5587
5592
  this.setState({
@@ -5590,8 +5595,8 @@ class Widget extends common/* Com */.up {
5590
5595
  }
5591
5596
  onListAddItem(key, val) {
5592
5597
  this.wasFormInputed = true;
5593
- let formData = util/* default.cloneDeep */.Z.cloneDeep(this.state.formData);
5594
- let field = util/* default.find */.Z.find(formData, (_, fkkey) => fkkey === key);
5598
+ let formData = util/* default */.Z.cloneDeep(this.state.formData);
5599
+ let field = util/* default */.Z.find(formData, (_, fkkey) => fkkey === key);
5595
5600
  if (!field) return;
5596
5601
  field.value = field.value || [];
5597
5602
  field.value.push(val);
@@ -5601,8 +5606,8 @@ class Widget extends common/* Com */.up {
5601
5606
  }
5602
5607
  onListRemoveItem(key, index) {
5603
5608
  this.wasFormInputed = true;
5604
- let formData = util/* default.cloneDeep */.Z.cloneDeep(this.state.formData);
5605
- let field = util/* default.find */.Z.find(formData, (_, fkkey) => fkkey === key);
5609
+ let formData = util/* default */.Z.cloneDeep(this.state.formData);
5610
+ let field = util/* default */.Z.find(formData, (_, fkkey) => fkkey === key);
5606
5611
  if (!field) return;
5607
5612
  field.value = field.value || [];
5608
5613
  field.value.splice(index, 1);
@@ -5611,11 +5616,11 @@ class Widget extends common/* Com */.up {
5611
5616
  });
5612
5617
  }
5613
5618
  renderCheckboxField(field) {
5614
- let items = util/* default.get */.Z.get(field, 'def.items', []);
5619
+ let items = util/* default */.Z.get(field, 'def.items', []);
5615
5620
  let values = [];
5616
5621
  let value = field.value || '';
5617
5622
  if (value) values = value.split(',');
5618
- return (0,preact_module.h)("div", null, util/* default.map */.Z.map(items, item => {
5623
+ return (0,preact_module.h)("div", null, util/* default */.Z.map(items, item => {
5619
5624
  return (0,preact_module.h)("div", {
5620
5625
  class: "checkbox"
5621
5626
  }, (0,preact_module.h)("input", {
@@ -5633,14 +5638,14 @@ class Widget extends common/* Com */.up {
5633
5638
  }
5634
5639
  toggleCheckboxField(key, v) {
5635
5640
  this.wasFormInputed = true;
5636
- let formData = util/* default.cloneDeep */.Z.cloneDeep(this.state.formData);
5637
- let field = util/* default.find */.Z.find(formData, (f, fkkey) => f.key === key);
5641
+ let formData = util/* default */.Z.cloneDeep(this.state.formData);
5642
+ let field = util/* default */.Z.find(formData, (f, fkkey) => f.key === key);
5638
5643
  if (!field) return;
5639
5644
  let value = field.value || '';
5640
5645
  let values = [];
5641
5646
  if (value) values = value.split(',');
5642
5647
  if (values.includes(v)) {
5643
- values = util/* default.filter */.Z.filter(values, value => value !== v);
5648
+ values = util/* default */.Z.filter(values, value => value !== v);
5644
5649
  } else {
5645
5650
  values.push(v);
5646
5651
  }
@@ -5650,9 +5655,9 @@ class Widget extends common/* Com */.up {
5650
5655
  });
5651
5656
  }
5652
5657
  renderRadioField(field) {
5653
- let items = util/* default.get */.Z.get(field, 'def.items', []);
5658
+ let items = util/* default */.Z.get(field, 'def.items', []);
5654
5659
  let value = field.value || '';
5655
- return (0,preact_module.h)("div", null, util/* default.map */.Z.map(items, item => {
5660
+ return (0,preact_module.h)("div", null, util/* default */.Z.map(items, item => {
5656
5661
  return (0,preact_module.h)("div", {
5657
5662
  class: "radio"
5658
5663
  }, (0,preact_module.h)("input", {
@@ -5671,8 +5676,8 @@ class Widget extends common/* Com */.up {
5671
5676
  }
5672
5677
  toggleRadioField(key, v) {
5673
5678
  this.wasFormInputed = true;
5674
- let formData = util/* default.cloneDeep */.Z.cloneDeep(this.state.formData);
5675
- let field = util/* default.find */.Z.find(formData, (f, fkkey) => f.key === key);
5679
+ let formData = util/* default */.Z.cloneDeep(this.state.formData);
5680
+ let field = util/* default */.Z.find(formData, (f, fkkey) => f.key === key);
5676
5681
  if (!field) return;
5677
5682
  field.value = v;
5678
5683
  this.setState({
@@ -5681,8 +5686,8 @@ class Widget extends common/* Com */.up {
5681
5686
  }
5682
5687
  selectDropdownField(key, v) {
5683
5688
  this.wasFormInputed = true;
5684
- let formData = util/* default.cloneDeep */.Z.cloneDeep(this.state.formData);
5685
- let field = util/* default.find */.Z.find(formData, (f, fkkey) => f.key === key);
5689
+ let formData = util/* default */.Z.cloneDeep(this.state.formData);
5690
+ let field = util/* default */.Z.find(formData, (f, fkkey) => f.key === key);
5686
5691
  if (!field) return;
5687
5692
  field.value = v;
5688
5693
  this.setState({
@@ -5690,20 +5695,20 @@ class Widget extends common/* Com */.up {
5690
5695
  });
5691
5696
  }
5692
5697
  renderDropdownField(field) {
5693
- let items = util/* default.get */.Z.get(field, 'def.items', []);
5698
+ let items = util/* default */.Z.get(field, 'def.items', []);
5694
5699
  return (0,preact_module.h)("select", {
5695
5700
  class: "form-control",
5696
5701
  value: field.value,
5697
5702
  onChange: e => this.selectDropdownField(field.key, e.target.value)
5698
5703
  }, (0,preact_module.h)("option", {
5699
5704
  value: ""
5700
- }, "-- ", this.props.t('no_select'), " --"), util/* default.map */.Z.map(items, item => (0,preact_module.h)("option", {
5705
+ }, "-- ", this.props.t('no_select'), " --"), util/* default */.Z.map(items, item => (0,preact_module.h)("option", {
5701
5706
  value: item.value
5702
5707
  }, this.props.t.i18n(item.i18n_label) || item.label || item.value)));
5703
5708
  }
5704
5709
  renderFields() {
5705
- if (util/* default.size */.Z.size(this.state.formData) === 0) return null;
5706
- let $fields = util/* default.map */.Z.map(this.state.formData, (field, key) => {
5710
+ if (util/* default */.Z.size(this.state.formData) === 0) return null;
5711
+ let $fields = util/* default */.Z.map(this.state.formData, (field, key) => {
5707
5712
  if (this.state.quickReplyMessage.text && key === 'question') return null;
5708
5713
  let $field = null;
5709
5714
  var errclass = field.error ? 'input--error' : '';
@@ -5719,13 +5724,13 @@ class Widget extends common/* Com */.up {
5719
5724
  row: "4",
5720
5725
  class: "form-control"
5721
5726
  });
5722
- } else if (util/* default.get */.Z.get(field, 'def.select') === 'checkbox') {
5727
+ } else if (util/* default */.Z.get(field, 'def.select') === 'checkbox') {
5723
5728
  $field = this.renderCheckboxField(field);
5724
- } else if (util/* default.get */.Z.get(field, 'def.select') === 'radio') {
5729
+ } else if (util/* default */.Z.get(field, 'def.select') === 'radio') {
5725
5730
  $field = this.renderRadioField(field);
5726
- } else if (util/* default.get */.Z.get(field, 'def.select') === 'dropdown') {
5731
+ } else if (util/* default */.Z.get(field, 'def.select') === 'dropdown') {
5727
5732
  $field = this.renderDropdownField(field);
5728
- } else if (util/* default.get */.Z.get(field, 'def.multiple_line')) {
5733
+ } else if (util/* default */.Z.get(field, 'def.multiple_line')) {
5729
5734
  $field = (0,preact_module.h)("textarea", {
5730
5735
  class: "form-control",
5731
5736
  ref: ref => {
@@ -5772,7 +5777,7 @@ class Widget extends common/* Com */.up {
5772
5777
  class: "checkbox--check"
5773
5778
  }, (0,preact_module.h)("div", null)));
5774
5779
  } else if (field.type === 'group') {
5775
- $field = util/* default.map */.Z.map(field.list, item => (0,preact_module.h)("div", {
5780
+ $field = util/* default */.Z.map(field.list, item => (0,preact_module.h)("div", {
5776
5781
  class: "radio"
5777
5782
  }, (0,preact_module.h)("input", {
5778
5783
  type: "radio",
@@ -5789,8 +5794,8 @@ class Widget extends common/* Com */.up {
5789
5794
  }))));
5790
5795
  } else if (field.type === 'list') {
5791
5796
  let selected = this.state.formData[key].value || [];
5792
- let items = util/* default.filter */.Z.filter(util/* default.get */.Z.get(field, 'list', []), item => {
5793
- return !util/* default.includes */.Z.includes(selected, item);
5797
+ let items = util/* default */.Z.filter(util/* default */.Z.get(field, 'list', []), item => {
5798
+ return !util/* default */.Z.includes(selected, item);
5794
5799
  });
5795
5800
  $field = (0,preact_module.h)(ListField, {
5796
5801
  selected: selected,
@@ -5838,8 +5843,8 @@ class Widget extends common/* Com */.up {
5838
5843
  size: "16",
5839
5844
  mode: "white"
5840
5845
  }));
5841
- let title = this.props.t.i18n(util/* default.get */.Z.get(form, `i18n_title`, {}));
5842
- if (!title) title = util/* default.get */.Z.get(form, 'title', this.props.t('capture_lead_title'));
5846
+ let title = this.props.t.i18n(util/* default */.Z.get(form, `i18n_title`, {}));
5847
+ if (!title) title = util/* default */.Z.get(form, 'title', this.props.t('capture_lead_title'));
5843
5848
  title = title.replace('↵', '');
5844
5849
  return (0,preact_module.h)("div", {
5845
5850
  class: "widget-body"
@@ -5870,15 +5875,15 @@ class Widget extends common/* Com */.up {
5870
5875
  }
5871
5876
  renderConvoList() {
5872
5877
  let convoM = this.props.store.matchConvo('*');
5873
- var convos = util/* default.map */.Z.map(convoM, convo => this.props.store.matchConvo(convo.id));
5874
- convos = util/* default.filter */.Z.filter(convos, convo => !!convo);
5875
- convos = util/* default.orderByF */.Z.orderByF(convos, convo => util/* default.get */.Z.get(convo, 'last_message_sent.created', convo.actived), 'desc');
5876
- var $convos = util/* default.map */.Z.map(convos, convo => {
5877
- let ags = util/* default.filter */.Z.filter(convo.members, m => {
5878
+ var convos = util/* default */.Z.map(convoM, convo => this.props.store.matchConvo(convo.id));
5879
+ convos = util/* default */.Z.filter(convos, convo => !!convo);
5880
+ convos = util/* default */.Z.orderByF(convos, convo => util/* default */.Z.get(convo, 'last_message_sent.created', convo.actived), 'desc');
5881
+ var $convos = util/* default */.Z.map(convos, convo => {
5882
+ let ags = util/* default */.Z.filter(convo.members, m => {
5878
5883
  return (m.type === 'agent' || m.type === 'bot') && m.membership === 'active';
5879
5884
  });
5880
- let agentids = util/* default.map */.Z.map(ags, m => m.id);
5881
- agentids = agentids || util/* default.agentsOfConvo */.Z.agentsOfConvo(convo)[0];
5885
+ let agentids = util/* default */.Z.map(ags, m => m.id);
5886
+ agentids = agentids || util/* default */.Z.agentsOfConvo(convo)[0];
5882
5887
  return (0,preact_module.h)("div", {
5883
5888
  class: "convo-list--item",
5884
5889
  onClick: () => this.goToConvo(convo.id),
@@ -5895,7 +5900,7 @@ class Widget extends common/* Com */.up {
5895
5900
  let $body = (0,preact_module.h)("div", {
5896
5901
  class: "convo-list--list"
5897
5902
  }, $convos);
5898
- if (util/* default.size */.Z.size(convos) === 0) {
5903
+ if (util/* default */.Z.size(convos) === 0) {
5899
5904
  $body = (0,preact_module.h)("div", {
5900
5905
  class: "convo-list--list"
5901
5906
  }, (0,preact_module.h)("div", {
@@ -5931,19 +5936,19 @@ class Widget extends common/* Com */.up {
5931
5936
  if (this.props.store.isPreview) return;
5932
5937
  var $input = this.msgInput.current;
5933
5938
  if (!$input) return;
5934
- util/* default.setTimeout */.Z.setTimeout(() => $input && $input.blur());
5935
- util/* default.setTimeout */.Z.setTimeout(() => $input && $input.blur(), 300);
5939
+ util/* default */.Z.setTimeout(() => $input && $input.blur());
5940
+ util/* default */.Z.setTimeout(() => $input && $input.blur(), 300);
5936
5941
  }
5937
5942
  focusInput() {
5938
5943
  if (this.props.store.isPreview) return;
5939
5944
  if (this.shouldShowForm()) {
5940
5945
  let firstemptykey = '';
5941
- util/* default.map */.Z.map(this.state.formData, (field, key) => {
5946
+ util/* default */.Z.map(this.state.formData, (field, key) => {
5942
5947
  if (field.type !== 'text') return;
5943
5948
  if (firstemptykey) return;
5944
5949
  if (!field.value) firstemptykey = key;
5945
5950
  });
5946
- util/* default.setTimeout */.Z.setTimeout(() => {
5951
+ util/* default */.Z.setTimeout(() => {
5947
5952
  var $input = this['form_' + Widget_encode(firstemptykey)];
5948
5953
  if (!$input) return;
5949
5954
  $input.focus();
@@ -5952,8 +5957,8 @@ class Widget extends common/* Com */.up {
5952
5957
  }
5953
5958
  var $input = this.msgInput.current;
5954
5959
  if (!$input) return;
5955
- util/* default.setTimeout */.Z.setTimeout(() => $input.focus());
5956
- util/* default.setTimeout */.Z.setTimeout(() => $input.focus(), 300);
5960
+ util/* default */.Z.setTimeout(() => $input.focus());
5961
+ util/* default */.Z.setTimeout(() => $input.focus(), 300);
5957
5962
  }
5958
5963
  onRate(rating) {
5959
5964
  if (!this.props.cid) return;
@@ -5967,7 +5972,7 @@ class Widget extends common/* Com */.up {
5967
5972
  fillQuickReplyToQuestion(message) {
5968
5973
  let formData = this.state.formData;
5969
5974
  if (formData) {
5970
- util/* default.set */.Z.set(formData, 'question.value', message.text);
5975
+ util/* default */.Z.set(formData, 'question.value', message.text);
5971
5976
  }
5972
5977
  this.setState({
5973
5978
  formData,
@@ -6060,8 +6065,8 @@ class Widget extends common/* Com */.up {
6060
6065
  let form;
6061
6066
  let accountSetting = this.props.plugin.chatbox || {};
6062
6067
  let acc = this.props.store.matchAccount() || {};
6063
- if (util/* default.get */.Z.get(accountSetting, 'prechat_form.enabled')) form = accountSetting.prechat_form;
6064
- let offlineEnabled = util/* default.get */.Z.get(accountSetting, 'offline_form.enabled');
6068
+ if (util/* default */.Z.get(accountSetting, 'prechat_form.enabled')) form = accountSetting.prechat_form;
6069
+ let offlineEnabled = util/* default */.Z.get(accountSetting, 'offline_form.enabled');
6065
6070
  if (this.isOffline(acc, accountSetting) && offlineEnabled) form = accountSetting.offline_form;
6066
6071
  if (!form) return false;
6067
6072
  let formData = this.fillForm(form);
@@ -6069,34 +6074,34 @@ class Widget extends common/* Com */.up {
6069
6074
  if (convo.state === 'ended') return true;
6070
6075
  if (convo.state && convo.state !== 'pending') delete formData.group;
6071
6076
  let isAllFiledEmpty = true;
6072
- util/* default.each */.Z.each(formData, field => {
6077
+ util/* default */.Z.each(formData, field => {
6073
6078
  if (field.value) isAllFiledEmpty = false;
6074
6079
  });
6075
6080
  if (isAllFiledEmpty && !this.userHasSent(this.props.cid)) return true;
6076
- return !!util/* default.find */.Z.find(formData, field => field.is_required && (field.value == null || field.value === ''));
6081
+ return !!util/* default */.Z.find(formData, field => field.is_required && (field.value == null || field.value === ''));
6077
6082
  }
6078
6083
  renderConvoSummary(convo) {
6079
6084
  let accountSetting = this.props.plugin.chatbox || {};
6080
6085
  let agentM = this.props.store.matchAgent('*');
6081
- let ags = util/* default.filter */.Z.filter(convo.members, m => {
6086
+ let ags = util/* default */.Z.filter(convo.members, m => {
6082
6087
  return (m.type === 'agent' || m.type === 'bot') && m.membership === 'active';
6083
6088
  });
6084
- let agentids = util/* default.map */.Z.map(ags, m => m.id);
6085
- agentids = agentids || util/* default.agentsOfConvo */.Z.agentsOfConvo(convo)[0];
6086
- let agents = util/* default.map */.Z.map(agentids, id => agentM[id] || {
6089
+ let agentids = util/* default */.Z.map(ags, m => m.id);
6090
+ agentids = agentids || util/* default */.Z.agentsOfConvo(convo)[0];
6091
+ let agents = util/* default */.Z.map(agentids, id => agentM[id] || {
6087
6092
  avatar_url: Widget_defaultAvatar,
6088
6093
  fullname: 'Offline Agent'
6089
6094
  });
6090
- var name = util/* default.each */.Z.each(agents, ag => ag.fullname).join(', ');
6095
+ var name = util/* default */.Z.each(agents, ag => ag.fullname).join(', ');
6091
6096
  if (accountSetting.hide_agent_profile || !name) name = this.props.store.matchAccount().name;
6092
6097
  if (!name) name = this.props.t('agent');
6093
6098
  var $you = null;
6094
6099
  if (convo.lastSenderType === 'user') {
6095
6100
  $you = (0,preact_module.h)("span", null, this.props.t('you'), ":");
6096
6101
  }
6097
- let seen = util/* default.isConvoSeen */.Z.isConvoSeen(convo, this.props.store.matchUser().id);
6102
+ let seen = util/* default */.Z.isConvoSeen(convo, this.props.store.matchUser().id);
6098
6103
  var lastmsg = this.renderMessagePreview(convo.last_message_sent);
6099
- var time = util/* default.getMs */.Z.getMs(util/* default.get */.Z.get(convo, 'last_message_sent.created')) || util/* default.getMs */.Z.getMs(convo.created);
6104
+ var time = util/* default */.Z.getMs(util/* default */.Z.get(convo, 'last_message_sent.created')) || util/* default */.Z.getMs(convo.created);
6100
6105
  let $unread = seen ? null : (0,preact_module.h)("div", {
6101
6106
  class: "convo-list--item-unread"
6102
6107
  });
@@ -6129,23 +6134,23 @@ class Widget extends common/* Com */.up {
6129
6134
  }
6130
6135
  agentsOfConvo(convo) {
6131
6136
  let agentM = this.props.store.matchAgent('*');
6132
- var agentids = util/* default.agentsOfConvo */.Z.agentsOfConvo(convo, true);
6133
- return util/* default.map */.Z.map(agentids, id => agentM[id] || {
6137
+ var agentids = util/* default */.Z.agentsOfConvo(convo, true);
6138
+ return util/* default */.Z.map(agentids, id => agentM[id] || {
6134
6139
  avatar_url: Widget_defaultAvatar,
6135
6140
  fullname: 'Offline Agent'
6136
6141
  });
6137
6142
  }
6138
6143
  renderMessagePreview(ev) {
6139
6144
  let defmsg = this.props.t('sent_you_a_message');
6140
- let message = util/* default.get */.Z.get(ev, 'data.message.text');
6141
- var format = util/* default.get */.Z.get(ev, 'data.message.format');
6145
+ let message = util/* default */.Z.get(ev, 'data.message.text');
6146
+ var format = util/* default */.Z.get(ev, 'data.message.format');
6142
6147
  if (format !== 'plaintext') message = defmsg;
6143
- if (!message && util/* default.size */.Z.size(util/* default.get */.Z.get(ev, 'data.message.attachments')) > 0) message = defmsg;
6148
+ if (!message && util/* default */.Z.size(util/* default */.Z.get(ev, 'data.message.attachments')) > 0) message = defmsg;
6144
6149
  if (!message) return null;
6145
- let byType = util/* default.get */.Z.get(ev, 'by.type');
6150
+ let byType = util/* default */.Z.get(ev, 'by.type');
6146
6151
  return (0,preact_module.h)("div", {
6147
6152
  class: "convo-list--convo-last-mes"
6148
- }, util/* default.map */.Z.map(util/* default.extractText */.Z.extractText(message), tag => {
6153
+ }, util/* default */.Z.map(util/* default */.Z.extractText(message), tag => {
6149
6154
  if (tag.type === 'emoji') return (0,preact_module.h)(Emoji, {
6150
6155
  emojiCode: tag.text,
6151
6156
  byType: byType
@@ -6157,19 +6162,19 @@ class Widget extends common/* Com */.up {
6157
6162
  var convo = this.props.store.matchConvo(cid) || {};
6158
6163
  let user = this.props.store.matchUser();
6159
6164
  if (this.userSent[cid]) return true;
6160
- let joined = util/* default.find */.Z.find(convo.members, mem => mem.id === user.id && (mem.membership === 'active' || mem.last_sent > 0));
6165
+ let joined = util/* default */.Z.find(convo.members, mem => mem.id === user.id && (mem.membership === 'active' || mem.last_sent > 0));
6161
6166
  return joined;
6162
6167
  }
6163
6168
  hasSentMessage(cid) {
6164
6169
  let convo = this.props.store.matchConvo(cid) || {};
6165
- let joined = util/* default.find */.Z.find(convo.members, mem => {
6170
+ let joined = util/* default */.Z.find(convo.members, mem => {
6166
6171
  if (mem.type === 'bot') return true;
6167
6172
  return mem.last_sent;
6168
6173
  });
6169
6174
  return joined;
6170
6175
  }
6171
6176
  isOffline(acc, accSetting) {
6172
- let enableWhen = util/* default.get */.Z.get(accSetting, 'offline_form.enable_when');
6177
+ let enableWhen = util/* default */.Z.get(accSetting, 'offline_form.enable_when');
6173
6178
  let isonline = true;
6174
6179
  if (enableWhen === 'all_agents_offline') isonline = acc.is_online;
6175
6180
  if (enableWhen === 'out_of_bussiness_hour') isonline = acc.is_in_business_hour;
@@ -6179,8 +6184,8 @@ class Widget extends common/* Com */.up {
6179
6184
  let form;
6180
6185
  let accountSetting = this.props.plugin.chatbox || {};
6181
6186
  let acc = this.props.store.matchAccount() || {};
6182
- if (util/* default.get */.Z.get(accountSetting, 'prechat_form.enabled')) form = accountSetting.prechat_form;
6183
- let offlineEnabled = util/* default.get */.Z.get(accountSetting, 'offline_form.enabled');
6187
+ if (util/* default */.Z.get(accountSetting, 'prechat_form.enabled')) form = accountSetting.prechat_form;
6188
+ let offlineEnabled = util/* default */.Z.get(accountSetting, 'offline_form.enabled');
6184
6189
  if (this.isOffline(acc, accountSetting) && offlineEnabled) {
6185
6190
  form = accountSetting.offline_form;
6186
6191
  }
@@ -6190,23 +6195,23 @@ class Widget extends common/* Com */.up {
6190
6195
  if (this.props.view === 'prechat_form') {
6191
6196
  form = accountSetting.prechat_form;
6192
6197
  }
6193
- if (util/* default.size */.Z.size(form) === 0) return [];
6198
+ if (util/* default */.Z.size(form) === 0) return [];
6194
6199
  var data = {};
6195
- util/* default.each */.Z.each(form.fields, f => {
6200
+ util/* default */.Z.each(form.fields, f => {
6196
6201
  var newf = Object.assign({}, f);
6197
6202
  if (f.type === 'list') {
6198
6203
  newf.list = f.list;
6199
6204
  }
6200
- newf.label = this.props.t.i18n(util/* default.get */.Z.get(f, `i18n_label`, {})) || f.label;
6205
+ newf.label = this.props.t.i18n(util/* default */.Z.get(f, `i18n_label`, {})) || f.label;
6201
6206
  data['attr:' + f.key] = newf;
6202
6207
  });
6203
- if (form.group_required && util/* default.size */.Z.size(form.groups) > 0) {
6208
+ if (form.group_required && util/* default */.Z.size(form.groups) > 0) {
6204
6209
  data['group'] = {
6205
6210
  key: 'group',
6206
6211
  is_required: !!form.group_required,
6207
- label: this.props.t.i18n(util/* default.get */.Z.get(form, `i18n_group_label`, {})) || form.group_label,
6212
+ label: this.props.t.i18n(util/* default */.Z.get(form, `i18n_group_label`, {})) || form.group_label,
6208
6213
  type: 'group',
6209
- list: util/* default.map */.Z.map(form.groups, group => ({
6214
+ list: util/* default */.Z.map(form.groups, group => ({
6210
6215
  value: group.id,
6211
6216
  label: group.name
6212
6217
  }))
@@ -6215,7 +6220,7 @@ class Widget extends common/* Com */.up {
6215
6220
  data['question'] = {
6216
6221
  key: 'question',
6217
6222
  is_required: true,
6218
- label: this.props.t.i18n(util/* default.get */.Z.get(form, `i18n_question_label`, {})) || form.question_label,
6223
+ label: this.props.t.i18n(util/* default */.Z.get(form, `i18n_question_label`, {})) || form.question_label,
6219
6224
  type: 'text'
6220
6225
  };
6221
6226
  if (this.isFormChanged(this.state.formData, data)) {
@@ -6229,38 +6234,44 @@ class Widget extends common/* Com */.up {
6229
6234
  let newKeys = Object.keys(newForm);
6230
6235
  if (oldKeys.length !== newKeys.length) return true;
6231
6236
  for (let i = 0; i < oldKeys.length; i++) {
6232
- if (util/* default.get */.Z.get(oldForm, `${oldKeys[i]}.label`) !== util/* default.get */.Z.get(newForm, `${newKeys[i]}.label`)) return true;
6233
- if (util/* default.get */.Z.get(oldForm, `${oldKeys[i]}.is_required`) !== util/* default.get */.Z.get(newForm, `${newKeys[i]}.is_required`)) return true;
6234
- if (util/* default.stringify */.Z.stringify(util/* default.get */.Z.get(oldForm, `${oldKeys[i]}.list`)) !== util/* default.stringify */.Z.stringify(util/* default.get */.Z.get(newForm, `${newKeys[i]}.list`))) {
6237
+ if (util/* default */.Z.get(oldForm, `${oldKeys[i]}.label`) !== util/* default */.Z.get(newForm, `${newKeys[i]}.label`)) return true;
6238
+ if (util/* default */.Z.get(oldForm, `${oldKeys[i]}.is_required`) !== util/* default */.Z.get(newForm, `${newKeys[i]}.is_required`)) return true;
6239
+ if (util/* default */.Z.stringify(util/* default */.Z.get(oldForm, `${oldKeys[i]}.list`)) !== util/* default */.Z.stringify(util/* default */.Z.get(newForm, `${newKeys[i]}.list`))) {
6235
6240
  return true;
6236
6241
  }
6237
6242
  }
6238
6243
  return false;
6239
6244
  }
6240
6245
  fillForm(form) {
6241
- if (util/* default.size */.Z.size(form) === 0) return [];
6246
+ if (util/* default */.Z.size(form) === 0) return [];
6242
6247
  var data = {};
6243
6248
  let user = this.props.store.matchUser();
6244
- util/* default.each */.Z.each(form.fields, f => {
6249
+ util/* default */.Z.each(form.fields, f => {
6245
6250
  var newf = Object.assign({}, f);
6246
- newf.value = util/* default.getUserAttr */.Z.getUserAttr(user, f.key, f.type);
6251
+ newf.value = util/* default */.Z.getUserAttr(user, f.key, f.type);
6252
+ if (newf.key == 'emails' && !newf.value) {
6253
+ newf.value = util/* default */.Z.getUserAttr(user, 'related_email', 'text');
6254
+ }
6255
+ if (newf.key == 'phones' && !newf.value) {
6256
+ newf.value = util/* default */.Z.getUserAttr(user, 'related_phone', 'text');
6257
+ }
6247
6258
  if (f.type === 'boolean' && !newf.value) newf.value = false;
6248
6259
  if (f.type === 'datetime' && newf.value) {
6249
- newf.value = new util/* default.Date */.Z.Date(data.value).toLocaleDateString('en-CA');
6260
+ newf.value = new util/* default */.Z.Date(data.value).toLocaleDateString('en-CA');
6250
6261
  }
6251
6262
  if (f.type === 'list') {
6252
6263
  newf.list = f.list;
6253
6264
  }
6254
- newf.label = this.props.t.i18n(util/* default.get */.Z.get(f, `i18n_label`, {})) || f.label;
6265
+ newf.label = this.props.t.i18n(util/* default */.Z.get(f, `i18n_label`, {})) || f.label;
6255
6266
  data['attr:' + f.key] = newf;
6256
6267
  });
6257
- if (form.group_required && util/* default.size */.Z.size(form.groups) > 0) {
6268
+ if (form.group_required && util/* default */.Z.size(form.groups) > 0) {
6258
6269
  data['group'] = {
6259
6270
  key: 'group',
6260
6271
  is_required: !!form.group_required,
6261
- label: this.props.t.i18n(util/* default.get */.Z.get(form, `i18n_group_label`, {})) || form.group_label,
6272
+ label: this.props.t.i18n(util/* default */.Z.get(form, `i18n_group_label`, {})) || form.group_label,
6262
6273
  type: 'group',
6263
- list: util/* default.map */.Z.map(form.groups, group => ({
6274
+ list: util/* default */.Z.map(form.groups, group => ({
6264
6275
  value: group.id,
6265
6276
  label: group.name
6266
6277
  }))
@@ -6292,14 +6303,14 @@ class Main extends common/* Com */.up {
6292
6303
  }
6293
6304
  async refreshCSS() {
6294
6305
  let plugins = this.props.store.matchPlugin();
6295
- let found = util/* default.find */.Z.find(plugins, plugin => plugin.id === this.props.plugin.id);
6306
+ let found = util/* default */.Z.find(plugins, plugin => plugin.id === this.props.plugin.id);
6296
6307
  if (!found) return;
6297
6308
  let css = (await main_promiseMainCSS).default.default.toString();
6298
- var outcss = util/* default.replaceCssVariable */.Z.replaceCssVariable(css, found.chatbox);
6299
- util/* default.setCss */.Z.setCss(this.props.plugin.id, this.$cssStyleDiv, outcss);
6309
+ var outcss = util/* default */.Z.replaceCssVariable(css, found.chatbox);
6310
+ util/* default */.Z.setCss(this.props.plugin.id, this.$cssStyleDiv, outcss);
6300
6311
  }
6301
6312
  componentWillUnmount() {
6302
- util/* default.setCss */.Z.setCss(this.props.plugin.id, this.$cssStyleDiv, '');
6313
+ util/* default */.Z.setCss(this.props.plugin.id, this.$cssStyleDiv, '');
6303
6314
  }
6304
6315
  async componentDidMount() {
6305
6316
  this.$cssStyleDiv = document.getElementById('subiz-style-for-' + this.props.plugin.id);
@@ -6335,7 +6346,7 @@ class Main extends common/* Com */.up {
6335
6346
  }
6336
6347
  render() {
6337
6348
  if (!this.state.cssready) return null;
6338
- if (util/* default.isUserBanned */.Z.isUserBanned(this.props.store.matchUser())) return null;
6349
+ if (util/* default */.Z.isUserBanned(this.props.store.matchUser())) return null;
6339
6350
  if (!this.props.t) return null;
6340
6351
  return (0,preact_module.h)("div", {
6341
6352
  class: this.props.store.isMobile() ? 'mobile' : 'desktop'
@@ -6369,10 +6380,10 @@ class Main extends common/* Com */.up {
6369
6380
  if ($widget.wasFormInputed) return;
6370
6381
  if (ev.type !== 'message_sent') return;
6371
6382
  if (!this.state.isShowWidget) return;
6372
- let byType = util/* default.get */.Z.get(ev, 'by.type');
6373
- let byid = util/* default.get */.Z.get(ev, 'by.id') || '';
6383
+ let byType = util/* default */.Z.get(ev, 'by.type');
6384
+ let byid = util/* default */.Z.get(ev, 'by.id') || '';
6374
6385
  if (!byid.startsWith('bb') || byType !== 'agent') return;
6375
- let cid = util/* default.get */.Z.get(ev, 'data.message.conversation_id');
6386
+ let cid = util/* default */.Z.get(ev, 'data.message.conversation_id');
6376
6387
  if (!cid) return;
6377
6388
  this.showWidget({
6378
6389
  cid,
@@ -6384,7 +6395,7 @@ class Main extends common/* Com */.up {
6384
6395
  if (this.props.plugin._no_auto_expand) return;
6385
6396
  if (this.props.store.matchHasManuallyClosed()) return;
6386
6397
  let convoM = this.props.store.matchConvo('*');
6387
- let redconvo = util/* default.find */.Z.find(convoM, convo => !util/* default.isConvoSeen */.Z.isConvoSeen(convo, this.props.store.matchUser().id));
6398
+ let redconvo = util/* default */.Z.find(convoM, convo => !util/* default */.Z.isConvoSeen(convo, this.props.store.matchUser().id));
6388
6399
  if (!redconvo || !redconvo.id) return;
6389
6400
  if (!this.state.isShowWidget) this.showWidget({
6390
6401
  view: 'chat',
@@ -6402,14 +6413,14 @@ class Main extends common/* Com */.up {
6402
6413
  this.refButton.current && this.refButton.current.ClearPreview();
6403
6414
  if (!p.view) {
6404
6415
  let lastview = this.props.store.matchLastview() || {};
6405
- p.view = util/* default.get */.Z.get(lastview, 'view');
6406
- p.cid = util/* default.get */.Z.get(lastview, 'opts.cid');
6416
+ p.view = util/* default */.Z.get(lastview, 'view');
6417
+ p.cid = util/* default */.Z.get(lastview, 'opts.cid');
6407
6418
  }
6408
6419
  p = p || {};
6409
6420
  if (!p.view && !p.cid) {
6410
6421
  let convoM = this.props.store.matchConvo('*');
6411
- let redconvo = util/* default.find */.Z.find(convoM, convo => !util/* default.isConvoSeen */.Z.isConvoSeen(convo, this.props.store.matchUser().id));
6412
- p.cid = util/* default.get */.Z.get(redconvo, 'id', util/* default.get */.Z.get(convoM, '0.id'));
6422
+ let redconvo = util/* default */.Z.find(convoM, convo => !util/* default */.Z.isConvoSeen(convo, this.props.store.matchUser().id));
6423
+ p.cid = util/* default */.Z.get(redconvo, 'id', util/* default */.Z.get(convoM, '0.id'));
6413
6424
  p.view = 'chat';
6414
6425
  }
6415
6426
  if (this.props.store.isMobile()) modifyViewport();
@@ -6447,11 +6458,13 @@ class Main extends common/* Com */.up {
6447
6458
  }
6448
6459
  function restoreViewport() {
6449
6460
  if (document.body && document.body.classList) document.body.classList.remove('sbz_no_scroll');
6461
+ if (document.documentElement && document.documentElement.classList) document.documentElement.classList.remove('sbz_no_scroll');
6450
6462
  let metatag = document.getElementById('subiz-meta-viewport');
6451
6463
  if (metatag) metatag.remove();
6452
6464
  }
6453
6465
  function modifyViewport() {
6454
6466
  if (document.body && document.body.classList) document.body.classList.add('sbz_no_scroll');
6467
+ if (document.documentElement && document.documentElement.classList) document.documentElement.classList.add('sbz_no_scroll');
6455
6468
  let metatag = document.createElement('meta');
6456
6469
  metatag.httpEquiv = 'X-UA-Compatible';
6457
6470
  metatag.name = 'viewport';