@subiz/widget-v4 4.1.24 → 4.1.26

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 (39) hide show
  1. package/compiled_src/chatbox/Event.js +3 -1
  2. package/compiled_src/chatbox/Widget.js +1 -1
  3. package/compiled_src/store/api.js +2 -0
  4. package/compiled_src/store/store.js +4 -0
  5. package/compiled_src/util/campaign.js +2 -2
  6. package/compiled_src/util/common.js +13 -0
  7. package/dist/132.js +1 -1
  8. package/dist/{186a09be422.132.js → 186bfd5b9ef.132.js} +1 -1
  9. package/dist/186bfd5b9ef.app.js +1 -0
  10. package/dist/{186a09be422.index.html → 186bfd5b9ef.index.html} +1 -1
  11. package/dist/{186a09be422.library.html → 186bfd5b9ef.library.html} +1 -1
  12. package/dist/186bfd5b9ef.library.js +1 -0
  13. package/dist/{186a09be422.preview.html → 186bfd5b9ef.preview.html} +1 -1
  14. package/dist/186bfd5b9ef.preview.js +1 -0
  15. package/dist/186bfd5b9ef.screenshoot.js +1 -0
  16. package/dist/186bfd5b9ef.webview.js +1 -0
  17. package/dist/HASH +1 -1
  18. package/dist/screenshoot.html +1 -1
  19. package/dist/screenshoot.js +12 -5
  20. package/package.json +3 -3
  21. package/src/chatbox/Event.js +3 -1
  22. package/src/chatbox/Widget.js +1 -1
  23. package/src/store/api.js +2 -2
  24. package/src/store/store.js +4 -1
  25. package/src/util/campaign.js +2 -2
  26. package/src/util/common.js +13 -0
  27. package/dist/186a09be422.app.js +0 -1
  28. package/dist/186a09be422.library.js +0 -1
  29. package/dist/186a09be422.preview.js +0 -1
  30. package/dist/186a09be422.screenshoot.js +0 -1
  31. package/dist/186a09be422.webview.js +0 -1
  32. /package/dist/{186a09be422.178.js → 186bfd5b9ef.178.js} +0 -0
  33. /package/dist/{186a09be422.213.js → 186bfd5b9ef.213.js} +0 -0
  34. /package/dist/{186a09be422.335.js → 186bfd5b9ef.335.js} +0 -0
  35. /package/dist/{186a09be422.362.js → 186bfd5b9ef.362.js} +0 -0
  36. /package/dist/{186a09be422.441.js → 186bfd5b9ef.441.js} +0 -0
  37. /package/dist/{186a09be422.605.js → 186bfd5b9ef.605.js} +0 -0
  38. /package/dist/{186a09be422.678.js → 186bfd5b9ef.678.js} +0 -0
  39. /package/dist/{186a09be422.782.js → 186bfd5b9ef.782.js} +0 -0
@@ -201,13 +201,15 @@ class Event extends _common.Com {
201
201
  });
202
202
  let $error = null;
203
203
  if (ev._error && ev.type === 'message_sent') {
204
+ let msg = this.props.t('error_send_message');
205
+ if (ev._error_message) msg = this.props.t(ev._error_message);
204
206
  $error = (0, _preact.h)("a", {
205
207
  class: "message_error",
206
208
  src: "javascript:;",
207
209
  onClick: e => this.resendMessage()
208
210
  }, (0, _preact.h)("div", {
209
211
  class: "message_error__text"
210
- }, this.props.t('error_send_message')), (0, _preact.h)("div", {
212
+ }, msg), (0, _preact.h)("div", {
211
213
  class: "message_error__icon"
212
214
  }));
213
215
  }
@@ -585,7 +585,7 @@ class Widget extends _common.Com {
585
585
  let convoM = this.props.store.matchConvo('*');
586
586
  var convos = _index.default.map(convoM, convo => this.props.store.matchConvo(convo.id));
587
587
  convos = _index.default.filter(convos, convo => !!convo);
588
- convos = _index.default.orderBy(convos, 'created', 'desc');
588
+ convos = _index.default.orderByF(convos, convo => _index.default.get(convo, 'last_message_sent.created', convo.actived), 'desc');
589
589
  var $convos = _index.default.map(convos, convo => {
590
590
  let ags = _index.default.filter(convo.members, m => {
591
591
  return (m.type === 'agent' || m.type === 'bot') && m.membership === 'active';
@@ -71,6 +71,7 @@ class _default {
71
71
  type: file.type
72
72
  });
73
73
  if (error) return {
74
+ body: signed,
74
75
  error
75
76
  };
76
77
  let contentType = file.type || 'application/octet-stream';
@@ -88,6 +89,7 @@ class _default {
88
89
  account_id: this.accid
89
90
  }));
90
91
  if (error) return {
92
+ body,
91
93
  error
92
94
  };
93
95
  return {
@@ -748,9 +748,13 @@ class Store {
748
748
  await this.convoGate.entry();
749
749
  await flow.map(files, 1, async att => {
750
750
  const {
751
+ body,
751
752
  url,
752
753
  error
753
754
  } = await this.api.uploadToS3(att._file);
755
+ if (_index.default.get(body, 'code') == 'invalid_field_size') {
756
+ event._error_message = 'cannot_send_too_big_file';
757
+ }
754
758
  event._error = error;
755
759
  att.url = url;
756
760
  });
@@ -44,7 +44,7 @@ function trackAreaClicked(selector, cb) {
44
44
  });
45
45
  });
46
46
  }
47
- function trackInactivity(seconds, cb) {
47
+ function trackInactivity(seconds = 0, cb) {
48
48
  let events = ['scroll', 'keyup', 'keydown', 'mousemove', 'mousewheel', 'mouseenter', 'mouseover', 'mousedown', 'touchstart', 'touchmove', 'touchenter'];
49
49
  let inactiveSeconds = 0;
50
50
  let resetTime = () => {
@@ -67,7 +67,7 @@ let timeOnPage = 0;
67
67
  common.setInterval(() => {
68
68
  timeOnPage += 5;
69
69
  }, 5000);
70
- function trackTimeOnPage(seconds, cb) {
70
+ function trackTimeOnPage(seconds = 0, cb) {
71
71
  if (seconds < 1) {
72
72
  return common.setTimeout(function () {
73
73
  cb(seconds);
@@ -38,6 +38,7 @@ exports.noop = noop;
38
38
  exports.norm = norm;
39
39
  exports.offsetToMin = offsetToMin;
40
40
  exports.orderBy = orderBy;
41
+ exports.orderByF = orderByF;
41
42
  exports.parseJSON = parseJSON;
42
43
  exports.preloadImg = preloadImg;
43
44
  exports.preloadWebfonts = preloadWebfonts;
@@ -342,6 +343,18 @@ function orderBy(a, k, d) {
342
343
  });
343
344
  return clone;
344
345
  }
346
+ function orderByF(a, f, d) {
347
+ var clone = [];
348
+ each(a, v => clone.push(v));
349
+ clone.sort((i, j) => {
350
+ let ik = f(i);
351
+ let jk = f(j);
352
+ if (ik === jk) return 0;
353
+ var r = ik < jk ? -1 : 1;
354
+ return d === 'desc' ? -r : r;
355
+ });
356
+ return clone;
357
+ }
345
358
  function isPhone(phone) {
346
359
  var re = /^[\+]?[(]?[0-9]{2,3}[)]?[-\s\.]?[0-9]{3,4}[-\s\.]?[0-9]{4,6}$/im;
347
360
  return re.test(String(phone));
package/dist/132.js CHANGED
@@ -5835,7 +5835,7 @@ class Widget extends common/* Com */.up {
5835
5835
  let convoM = this.props.store.matchConvo('*');
5836
5836
  var convos = util/* default.map */.Z.map(convoM, convo => this.props.store.matchConvo(convo.id));
5837
5837
  convos = util/* default.filter */.Z.filter(convos, convo => !!convo);
5838
- convos = util/* default.orderBy */.Z.orderBy(convos, 'created', 'desc');
5838
+ convos = util/* default.orderBy */.Z.orderBy(convos, 'actived', 'desc');
5839
5839
  var $convos = util/* default.map */.Z.map(convos, convo => {
5840
5840
  let ags = util/* default.filter */.Z.filter(convo.members, m => {
5841
5841
  return (m.type === 'agent' || m.type === 'bot') && m.membership === 'active';