@subiz/widget-v4 4.1.198 → 4.1.199

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 (55) hide show
  1. package/assets/img/default_avatar.png +0 -0
  2. package/assets/img/default_logo.png +0 -0
  3. package/assets/img/default_logo.svg +5 -0
  4. package/assets/less/avatar.less +2 -2
  5. package/assets/less/message.less +5 -0
  6. package/assets/less/widget.less +1 -1
  7. package/assets/less/widget_header.less +2 -0
  8. package/compiled_src/bot.js +3 -18
  9. package/compiled_src/chatbox/Events.js +1 -0
  10. package/compiled_src/chatbox/Header.js +2 -2
  11. package/compiled_src/chatbox/QuickReplies.js +2 -1
  12. package/compiled_src/chatbox/Widget.js +2 -1
  13. package/compiled_src/lib.js +1 -1
  14. package/compiled_src/store/store.js +23 -18
  15. package/dist/{19bbfd5aa77.278.js → 19c2dc9a6ec.278.js} +1 -1
  16. package/dist/19c2dc9a6ec.app.js +1 -0
  17. package/dist/{19bbfd5aa77.chat.html → 19c2dc9a6ec.chat.html} +1 -1
  18. package/dist/19c2dc9a6ec.chat.js +1 -0
  19. package/dist/{19bbfd5aa77.form.html → 19c2dc9a6ec.form.html} +1 -1
  20. package/dist/{19bbfd5aa77.form.js → 19c2dc9a6ec.form.js} +1 -1
  21. package/dist/{19bbfd5aa77.index.html → 19c2dc9a6ec.index.html} +1 -1
  22. package/dist/{19bbfd5aa77.library.html → 19c2dc9a6ec.library.html} +1 -1
  23. package/dist/19c2dc9a6ec.library.js +1 -0
  24. package/dist/{19bbfd5aa77.preview.html → 19c2dc9a6ec.preview.html} +1 -1
  25. package/dist/19c2dc9a6ec.preview.js +1 -0
  26. package/dist/19c2dc9a6ec.webview.js +1 -0
  27. package/dist/DEVHASH +1 -0
  28. package/dist/HASH +1 -1
  29. package/dist/assets/img/default_avatar.e449b04.png +0 -0
  30. package/dist/assets/img/default_logo.dd13a2b.svg +5 -0
  31. package/dist/screenshoot.js +39 -31
  32. package/package.json +8 -8
  33. package/src/bot.js +4 -14
  34. package/src/chatbox/Events.js +1 -1
  35. package/src/chatbox/Header.js +2 -2
  36. package/src/chatbox/QuickReplies.js +10 -10
  37. package/src/chatbox/Widget.js +2 -2
  38. package/src/lib.js +1 -1
  39. package/src/store/store.js +20 -13
  40. package/dist/19bbfd5aa77.app.js +0 -1
  41. package/dist/19bbfd5aa77.chat.js +0 -1
  42. package/dist/19bbfd5aa77.library.js +0 -1
  43. package/dist/19bbfd5aa77.preview.js +0 -1
  44. package/dist/19bbfd5aa77.webview.js +0 -1
  45. package/dist/assets/img/default_avatar.5b74dc1.png +0 -0
  46. package/dist/assets/img/rating--poor.2938a25.svg +0 -12
  47. /package/dist/{19bbfd5aa77.127.js → 19c2dc9a6ec.127.js} +0 -0
  48. /package/dist/{19bbfd5aa77.132.js → 19c2dc9a6ec.132.js} +0 -0
  49. /package/dist/{19bbfd5aa77.185.js → 19c2dc9a6ec.185.js} +0 -0
  50. /package/dist/{19bbfd5aa77.27.js → 19c2dc9a6ec.27.js} +0 -0
  51. /package/dist/{19bbfd5aa77.339.js → 19c2dc9a6ec.339.js} +0 -0
  52. /package/dist/{19bbfd5aa77.459.js → 19c2dc9a6ec.459.js} +0 -0
  53. /package/dist/{19bbfd5aa77.490.js → 19c2dc9a6ec.490.js} +0 -0
  54. /package/dist/{19bbfd5aa77.74.js → 19c2dc9a6ec.74.js} +0 -0
  55. /package/dist/{19bbfd5aa77.997.js → 19c2dc9a6ec.997.js} +0 -0
Binary file
Binary file
@@ -0,0 +1,5 @@
1
+ <svg width="200" height="200" viewBox="0 0 200 200" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="200" height="200" fill="#002662"/>
3
+ <path d="M93 35C93 30.5817 96.5817 27 101 27H131C160.271 27 184 50.7289 184 80V200H93V35Z" fill="white" fill-opacity="0.1"/>
4
+ <path d="M22 147C22 119.386 44.3858 97 72 97H115C124.941 97 133 105.059 133 115V200H22V147Z" fill="white" fill-opacity="0.2"/>
5
+ </svg>
@@ -24,8 +24,8 @@
24
24
  .avatar.avatar__account {
25
25
  width: 38px;
26
26
  height: 38px;
27
- border-radius: 8px;
28
- margin-right: @spacer2;
27
+ border-radius: 38px;
28
+ margin-right: @spacer1;
29
29
  }
30
30
 
31
31
  .group-avatar--primary .group-avatar--agent-middle {
@@ -1066,3 +1066,8 @@ a.product_attachment__title {
1066
1066
  .file-attachment.just-focused {
1067
1067
  box-shadow: 0 0 0 2px #000;
1068
1068
  }
1069
+
1070
+ .widget_body_empty_img {
1071
+ max-width: 150px;
1072
+ max-height: 150px;
1073
+ }
@@ -103,7 +103,7 @@
103
103
  }
104
104
 
105
105
  .convo-list--convo-time span {
106
- font-size: 13px;
106
+ font-size: 14px;
107
107
  line-height: 20px;
108
108
  .color(@black);
109
109
  opacity: 0.6;
@@ -50,6 +50,7 @@
50
50
  .color(@text-color);
51
51
  margin-top: 2.5px;
52
52
  position: relative;
53
+ line-height: 1.5;
53
54
  }
54
55
  }
55
56
 
@@ -93,6 +94,7 @@
93
94
  -webkit-box-orient: vertical;
94
95
  -webkit-line-clamp: 2;
95
96
  overflow: hidden;
97
+ line-height: 1.5;
96
98
  }
97
99
  }
98
100
 
@@ -17,28 +17,13 @@ function _default(store) {
17
17
  run = () => true;
18
18
  let match = _index.default.checkRunConditions(bot.initiative_frequency, bot.conditions, store.matchLastBotRun(bot.id), store);
19
19
  if (!match) return;
20
- if (bot.id.startsWith('at')) {
21
- if (!bot.welcome_message) return;
20
+ let welcomMessages = bot.welcome_messages;
21
+ if (_index.default.size(welcomMessages)) {
22
22
  let {
23
23
  error
24
- } = await store.startLightConvo(bot.id, bot.welcome_message, common.getLocale(bot, _index.default.detectLang()), false);
25
- if (error) return console.error(error);
24
+ } = await store.startLightConvo(bot.id, bot.welcome_messages, common.getLocale(bot, _index.default.detectLang()), false);
26
25
  store.logBotRun(bot.id);
27
- return;
28
26
  }
29
- let {
30
- error
31
- } = await store.startConvo({
32
- initial_by: bot.id,
33
- locale: common.getLocale(bot, _index.default.detectLang()),
34
- state: 'active',
35
- members: [{
36
- type: 'bot',
37
- id: bot.id
38
- }]
39
- });
40
- if (error) return console.error(error);
41
- store.logBotRun(bot.id);
42
27
  };
43
28
  let triggers = _index.default.get(bot, 'triggers') || [];
44
29
  for (let tr of triggers) {
@@ -213,6 +213,7 @@ class Events extends _common.Com {
213
213
  class: "widget-body--events-container widget-body--events-container__error"
214
214
  }, (0, _preact.h)("img", {
215
215
  alt: "empty",
216
+ class: "widget_body_empty_img",
216
217
  src: convoemptyimg
217
218
  }), (0, _preact.h)("div", {
218
219
  class: "widget_body__events__error_msg"
@@ -26,7 +26,7 @@ class Header extends _common.Com {
26
26
  width: 38,
27
27
  height: 38,
28
28
  class: "avatar avatar__account",
29
- src: this.props.store.replaceFileUrl(logoUrl) || require('../../assets/img/image_default.png')
29
+ src: this.props.store.replaceFileUrl(logoUrl) || require('../../assets/img/default_logo.svg')
30
30
  });
31
31
  });
32
32
  }
@@ -40,7 +40,7 @@ class Header extends _common.Com {
40
40
  height: 38,
41
41
  alt: acc.name,
42
42
  class: "avatar avatar__account",
43
- src: this.props.store.replaceFileUrl(logo_url) || require('../../assets/img/image_default.png')
43
+ src: this.props.store.replaceFileUrl(logo_url) || require('../../assets/img/default_logo.svg')
44
44
  });
45
45
  }
46
46
  render() {
@@ -40,7 +40,8 @@ class QuickReplies extends _common.Com {
40
40
  }
41
41
  let $replies = _index.default.map(quickreplies, r => (0, _preact.h)("div", {
42
42
  class: "message_quick_reply",
43
- onClick: e => this.props.onSelect(r)
43
+ onClick: e => this.props.onSelect(r),
44
+ title: r.title
44
45
  }, r.title));
45
46
  return (0, _preact.h)("div", {
46
47
  class: "message_quick_replies"
@@ -117,7 +117,7 @@ class Widget extends _common.Com {
117
117
  id: botid,
118
118
  bot_version: oldconvo.bot_version
119
119
  }],
120
- initial_by: this.props.store.matchUser().id,
120
+ initial_by: botid,
121
121
  is_testing: oldconvo.is_testing,
122
122
  greeting_message: greeting_msg
123
123
  });
@@ -815,6 +815,7 @@ class Widget extends _common.Com {
815
815
  }, (0, _preact.h)("div", {
816
816
  class: "empty-container"
817
817
  }, (0, _preact.h)("img", {
818
+ class: "widget_body_empty_img",
818
819
  alt: "empty",
819
820
  src: empty
820
821
  }), (0, _preact.h)("div", {
@@ -260,7 +260,7 @@ class Widget {
260
260
  startConvo(req) {
261
261
  req = _index.default.cloneDeep(req) || {};
262
262
  if (req.welcome_message) {
263
- return this.store.startLightConvo(req.bot_id, req.welcome_message, req.locale, req.is_testing, req.bot_version);
263
+ return this.store.startLightConvo(req.bot_id, [req.welcome_message], req.locale, req.is_testing, req.bot_version);
264
264
  }
265
265
  let members = req.members || [];
266
266
  if (req.bot_id) {
@@ -744,7 +744,7 @@ class Store {
744
744
  setting = _index.default.cloneDeep(setting) || {};
745
745
  setting.account = Object.assign({}, setting.account, this.forceAcc);
746
746
  if (!setting.account.logo_url) {
747
- setting.account.logo_url = 'https://vcdn.subiz-cdn.com/file/fiqpezhkmeyesdscyetk-default_logo.jpg';
747
+ setting.account.logo_url = 'https://vcdn.subiz-cdn.com/widget-v4/public/assets/img/default_logo.dd13a2b.svg';
748
748
  }
749
749
  if (setting.user) {
750
750
  setting.user.account_id = setting.account.id;
@@ -952,7 +952,7 @@ class Store {
952
952
  delete this.lightConvos[id];
953
953
  this.kv.put('light_convos', this.lightConvos);
954
954
  }
955
- startLightConvo(botid, message, locale, is_testing, botversion) {
955
+ startLightConvo(botid, messages, locale, is_testing, botversion) {
956
956
  let convoid = 'cslight' + botid + '_' + this.now();
957
957
  let user = this.cache.match('user') || {};
958
958
  let old = this.lightConvos[convoid];
@@ -960,26 +960,31 @@ class Store {
960
960
  convo: old
961
961
  };
962
962
  let now = this.now();
963
- let ev = {};
964
- ev.created = now;
965
- ev.event_time = now;
966
- ev.id = 'evfake' + now;
967
- ev.type = 'message_sent';
968
- ev.by = {
969
- id: botid,
970
- type: 'bot'
971
- };
972
- ev.data = {
973
- message: message
974
- };
975
- ev.data.message.conversation_id = convoid;
963
+ let lastev = {};
964
+ let newevs = _index.default.map(messages, (message, idx) => {
965
+ let ev = {};
966
+ ev.created = now;
967
+ ev.event_time = now;
968
+ ev.id = 'evfake' + now + idx;
969
+ ev.type = 'message_sent';
970
+ ev.by = {
971
+ id: botid,
972
+ type: 'bot'
973
+ };
974
+ ev.data = {
975
+ message: message
976
+ };
977
+ ev.data.message.conversation_id = convoid;
978
+ lastev = ev;
979
+ return ev;
980
+ });
976
981
  let newconvo = {
977
982
  id: convoid,
978
983
  locale: locale,
979
984
  initial_by: botid,
980
985
  created: now,
981
986
  actived: now,
982
- last_message_sent: ev,
987
+ last_message_sent: lastev,
983
988
  members: [{
984
989
  type: 'user',
985
990
  id: user.id
@@ -995,13 +1000,13 @@ class Store {
995
1000
  source: 'web'
996
1001
  },
997
1002
  traffic_source: 'direct',
998
- events: [ev],
1003
+ events: newevs,
999
1004
  is_testing: is_testing,
1000
1005
  bot_versio: botversion
1001
1006
  };
1002
1007
  this.lightConvos[convoid] = newconvo;
1003
1008
  this.kv.put('light_convos', this.lightConvos);
1004
- this.pubsub.publish('events', ev);
1009
+ this.pubsub.publish('events', lastev);
1005
1010
  return {
1006
1011
  convo: newconvo
1007
1012
  };