@subiz/widget-v4 4.1.59 → 4.1.60

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