@subiz/widget-v4 4.1.160 → 4.1.162

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 (53) hide show
  1. package/compiled_src/chatbox/Event.js +6 -2
  2. package/compiled_src/chatbox/MessageInput.js +7 -0
  3. package/compiled_src/lib.js +19 -1
  4. package/dist/{1989dc3a5f1.app.js → 198a2601817.app.js} +1 -1
  5. package/dist/{1989dc3a5f1.chat.html → 198a2601817.chat.html} +1 -1
  6. package/dist/{1989dc3ac95.chat.js → 198a2601817.chat.js} +1 -1
  7. package/dist/{1989dc3a5f1.form.html → 198a2601817.form.html} +1 -1
  8. package/dist/{1989dc3ac95.form.js → 198a2601817.form.js} +1 -1
  9. package/dist/{1989dc3a5f1.index.html → 198a2601817.index.html} +1 -1
  10. package/dist/{1989dc3a5f1.library.html → 198a2601817.library.html} +1 -1
  11. package/dist/{1989dc3ac95.library.js → 198a2601817.library.js} +1 -1
  12. package/dist/{1989dc3a5f1.preview.html → 198a2601817.preview.html} +1 -1
  13. package/dist/198a2601817.preview.js +1 -0
  14. package/dist/{1989dc3a5f1.webview.js → 198a2601817.webview.js} +1 -1
  15. package/dist/HASH +1 -1
  16. package/dist/screenshoot.js +31 -2
  17. package/package.json +2 -2
  18. package/src/chatbox/Event.js +6 -1
  19. package/src/chatbox/MessageInput.js +10 -0
  20. package/src/lib.js +16 -2
  21. package/dist/1989dc3a5f1.chat.js +0 -1
  22. package/dist/1989dc3a5f1.form.js +0 -1
  23. package/dist/1989dc3a5f1.library.js +0 -1
  24. package/dist/1989dc3a5f1.preview.js +0 -1
  25. package/dist/1989dc3ac95.127.js +0 -1
  26. package/dist/1989dc3ac95.132.js +0 -1
  27. package/dist/1989dc3ac95.185.js +0 -1
  28. package/dist/1989dc3ac95.27.js +0 -1
  29. package/dist/1989dc3ac95.278.js +0 -1
  30. package/dist/1989dc3ac95.339.js +0 -1
  31. package/dist/1989dc3ac95.459.js +0 -1
  32. package/dist/1989dc3ac95.490.js +0 -1
  33. package/dist/1989dc3ac95.74.js +0 -1
  34. package/dist/1989dc3ac95.997.js +0 -1
  35. package/dist/1989dc3ac95.app.js +0 -1
  36. package/dist/1989dc3ac95.chat.html +0 -1
  37. package/dist/1989dc3ac95.form.html +0 -1
  38. package/dist/1989dc3ac95.index.html +0 -71
  39. package/dist/1989dc3ac95.library.html +0 -71
  40. package/dist/1989dc3ac95.preview.html +0 -759
  41. package/dist/1989dc3ac95.preview.js +0 -1
  42. package/dist/1989dc3ac95.webview.js +0 -1
  43. package/malicious-app.js.hash.js +0 -17
  44. /package/dist/{1989dc3a5f1.127.js → 198a2601817.127.js} +0 -0
  45. /package/dist/{1989dc3a5f1.132.js → 198a2601817.132.js} +0 -0
  46. /package/dist/{1989dc3a5f1.185.js → 198a2601817.185.js} +0 -0
  47. /package/dist/{1989dc3a5f1.27.js → 198a2601817.27.js} +0 -0
  48. /package/dist/{1989dc3a5f1.278.js → 198a2601817.278.js} +0 -0
  49. /package/dist/{1989dc3a5f1.339.js → 198a2601817.339.js} +0 -0
  50. /package/dist/{1989dc3a5f1.459.js → 198a2601817.459.js} +0 -0
  51. /package/dist/{1989dc3a5f1.490.js → 198a2601817.490.js} +0 -0
  52. /package/dist/{1989dc3a5f1.74.js → 198a2601817.74.js} +0 -0
  53. /package/dist/{1989dc3a5f1.997.js → 198a2601817.997.js} +0 -0
@@ -246,7 +246,7 @@ class Event extends _common.Com {
246
246
  let ev = this.props.event.ev;
247
247
  let attachments = _index.default.get(ev, 'data.message.attachments');
248
248
  let hasForm = _index.default.find(attachments, att => att.type === 'form');
249
- if (ev.id === 'evshpgaeetsplfqprzmynrvrl') hasForm = true;
249
+ if (isEmptyMessage(_index.default.get(ev, 'data.message'))) return null;
250
250
  this.tryLoadOrder(ev);
251
251
  let t = new _index.default.Date(ev.created).toLocaleString();
252
252
  if (_index.default.get(ev, 'by.type') !== 'user') {
@@ -515,4 +515,8 @@ class Event extends _common.Com {
515
515
  return acc.name;
516
516
  }
517
517
  }
518
- exports.default = Event;
518
+ exports.default = Event;
519
+ function isEmptyMessage(msg) {
520
+ if (!msg) return true;
521
+ if (!msg.text && !msg.block && !_index.default.size(msg.attachments)) return true;
522
+ }
@@ -230,6 +230,13 @@ class MessageInput extends _common.Com {
230
230
  }
231
231
  focus() {
232
232
  if (this.props.disabled) return;
233
+ const activeElement = document.activeElement;
234
+ let focused = false;
235
+ if (activeElement) {
236
+ if (activeElement.tagName === 'INPUT' || activeElement.tagName === 'TEXTAREA') focused = true;
237
+ if (activeElement.hasAttribute('contenteditable') && activeElement.getAttribute('contenteditable') === 'true') focused = true;
238
+ }
239
+ if (focused) return;
233
240
  this.refMessageInput.current && this.refMessageInput.current.focus();
234
241
  _index.default.setTimeout(() => {
235
242
  this.refMessageInput.current && this.refMessageInput.current.focus();
@@ -217,7 +217,25 @@ class Widget {
217
217
  return this.store.sendConversion(formid, values, impressiontoken);
218
218
  }
219
219
  startConvo(req) {
220
- if (!req.is_light) return this.store.startConvo(req);else return this.store.startLightConvo(req.bot_id, req.welcome_message, req.locale, req.is_testing, req.bot_version);
220
+ req = _index.default.cloneDeep(req) || {};
221
+ if (req.welcome_message) {
222
+ return this.store.startLightConvo(req.bot_id, req.welcome_message, req.locale, req.is_testing, req.bot_version);
223
+ }
224
+ let members = req.members || [];
225
+ if (req.bot_id) {
226
+ let botid = req.bot_id;
227
+ delete req.bot_id;
228
+ if (!_index.default.find(members, m => b.id == botid)) {
229
+ members.push({
230
+ type: 'bot',
231
+ id: botid,
232
+ bot_version: req.bot_version
233
+ });
234
+ }
235
+ }
236
+ req.members = members;
237
+ req.initial_by = this.store.matchUser().id;
238
+ return this.store.startConvo(req);
221
239
  }
222
240
  async showGreeting() {
223
241
  await this.domGate.entry();