@subiz/widget-v4 4.0.87 → 4.0.89

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 (37) hide show
  1. package/assets/less/chatbox.less +2 -0
  2. package/compiled_src/chatbox/Event.js +1 -1
  3. package/compiled_src/chatbox/Widget.js +55 -6
  4. package/compiled_src/util/common.js +1 -1
  5. package/dist/132.js +140 -40
  6. package/dist/178.js +1 -1
  7. package/dist/1833a09e682.132.js +1 -0
  8. package/dist/1833a09e682.178.js +1 -0
  9. package/dist/{182ed9b853b.213.js → 1833a09e682.213.js} +0 -0
  10. package/dist/{182ed9b853b.335.js → 1833a09e682.335.js} +0 -0
  11. package/dist/{182ed9b853b.362.js → 1833a09e682.362.js} +0 -0
  12. package/dist/1833a09e682.441.js +1 -0
  13. package/dist/{182ed9b853b.605.js → 1833a09e682.605.js} +0 -0
  14. package/dist/{182ed9b853b.678.js → 1833a09e682.678.js} +0 -0
  15. package/dist/{182ed9b853b.782.js → 1833a09e682.782.js} +0 -0
  16. package/dist/1833a09e682.app.js +1 -0
  17. package/dist/{182ed9b853b.index.html → 1833a09e682.index.html} +2 -2
  18. package/dist/{182ed9b853b.library.html → 1833a09e682.library.html} +2 -2
  19. package/dist/1833a09e682.library.js +1 -0
  20. package/dist/{182ed9b853b.preview.html → 1833a09e682.preview.html} +1 -1
  21. package/dist/1833a09e682.preview.js +1 -0
  22. package/dist/1833a09e682.screenshoot.js +1 -0
  23. package/dist/441.js +52 -45
  24. package/dist/HASH +1 -1
  25. package/dist/screenshoot.html +1 -1
  26. package/dist/screenshoot.js +1 -1
  27. package/package.json +9 -9
  28. package/src/chatbox/Event.js +1 -1
  29. package/src/chatbox/Widget.js +52 -3
  30. package/src/util/common.js +1 -1
  31. package/dist/182ed9b853b.132.js +0 -1
  32. package/dist/182ed9b853b.178.js +0 -1
  33. package/dist/182ed9b853b.441.js +0 -1
  34. package/dist/182ed9b853b.app.js +0 -1
  35. package/dist/182ed9b853b.library.js +0 -1
  36. package/dist/182ed9b853b.preview.js +0 -1
  37. package/dist/182ed9b853b.screenshoot.js +0 -1
@@ -97,6 +97,8 @@ body div#sbz92 {
97
97
  }
98
98
 
99
99
  img {
100
+ overflow: hidden;
101
+ flex-shrink: 0;
100
102
  background-repeat: no-repeat;
101
103
  background-position: center;
102
104
  background-size: 100% 100%;
@@ -128,7 +128,7 @@ class Event extends _common.Com {
128
128
 
129
129
  var uri = acc.logo_url || require('../../assets/img/image_default.png');
130
130
 
131
- if (true || _index.default.get(this.props, 'chatbox.hide_agent_profile')) {
131
+ if (_index.default.get(this.props, 'chatbox.hide_agent_profile')) {
132
132
  return (0, _preact.h)("div", {
133
133
  class: "message-sender"
134
134
  }, (0, _preact.h)("img", {
@@ -54,6 +54,14 @@ class Widget extends _common.Com {
54
54
  _defineProperty(this, "msgInput", (0, _preact.createRef)());
55
55
 
56
56
  _defineProperty(this, "sendMessage", async message => {
57
+ let hasPostback = _index.default.find(message.attachments, att => att.type === 'postback');
58
+
59
+ if (this.isFormRequired() && hasPostback) {
60
+ this.onStartConvoClick();
61
+ this.fillQuickReplyToQuestion(message);
62
+ return;
63
+ }
64
+
57
65
  let text = message.text;
58
66
 
59
67
  if (!this.props.cid) {
@@ -115,7 +123,8 @@ class Widget extends _common.Com {
115
123
  clickedJoin: false,
116
124
  formData: {},
117
125
  showOrder: false,
118
- order_id: ''
126
+ order_id: '',
127
+ quickReplyMessage: ''
119
128
  });
120
129
  this.props.store.onUpdate(this, _ => this.forceUpdate());
121
130
  }
@@ -133,7 +142,8 @@ class Widget extends _common.Com {
133
142
  if (prevProp.cid !== this.props.cid) {
134
143
  this.closeOrder();
135
144
  this.setState({
136
- clickedJoin: false
145
+ clickedJoin: false,
146
+ quickReplyMessage: ''
137
147
  });
138
148
  setTimeout(() => {
139
149
  this.events && this.events.focus();
@@ -145,6 +155,15 @@ class Widget extends _common.Com {
145
155
  }
146
156
 
147
157
  shouldShowForm() {
158
+ let form;
159
+ let accountSetting = this.props.plugin.chatbox || {};
160
+ let acc = this.props.store.matchAccount() || {};
161
+ if (_index.default.get(accountSetting, 'prechat_form.enabled')) form = accountSetting.prechat_form;
162
+
163
+ let offlineEnabled = _index.default.get(accountSetting, 'offline_form.enabled');
164
+
165
+ if (this.isOffline(acc, accountSetting) && offlineEnabled) form = accountSetting.offline_form;
166
+ if (!this.hasSentMessage(this.props.cid) && form && (_index.default.size(form.groups) || form.group_required)) return true;
148
167
  let formRequired = this.isFormRequired();
149
168
  return formRequired && !this.props.cid || formRequired && this.props.cid && this.state.clickedJoin;
150
169
  }
@@ -263,6 +282,9 @@ class Widget extends _common.Com {
263
282
  }]
264
283
  }
265
284
  });
285
+ this.setState({
286
+ quickReplyMessage: ''
287
+ });
266
288
  if (form.end_conversation_after_submit) await this.props.store.endConvo(this.props.cid);
267
289
  return;
268
290
  }
@@ -308,7 +330,8 @@ class Widget extends _common.Com {
308
330
  });
309
331
  this.setState({
310
332
  creating: false,
311
- clickedJoin: false
333
+ clickedJoin: false,
334
+ quickReplyMessage: ''
312
335
  });
313
336
  if (!this.props.store.isMobile()) this.focusInput();
314
337
  }
@@ -319,7 +342,8 @@ class Widget extends _common.Com {
319
342
  key: 'question',
320
343
  is_required: true,
321
344
  label: this.props.t.i18n(_index.default.get(form, `i18n_question_label`, {})) || form.question_label,
322
- type: 'text'
345
+ type: 'text',
346
+ value: this.state.quickReplyMessage
323
347
  };
324
348
  this.setState({
325
349
  formData
@@ -381,6 +405,7 @@ class Widget extends _common.Com {
381
405
  if (_index.default.size(this.state.formData) === 0) return null;
382
406
 
383
407
  let $fields = _index.default.map(this.state.formData, (field, key) => {
408
+ if (this.state.quickReplyMessage && key === 'question') return null;
384
409
  let $field = null;
385
410
  var errclass = field.error ? 'input--error' : '';
386
411
 
@@ -648,6 +673,19 @@ class Widget extends _common.Com {
648
673
  this.focusInput();
649
674
  }
650
675
 
676
+ fillQuickReplyToQuestion(message) {
677
+ let formData = this.state.formData;
678
+
679
+ if (formData) {
680
+ _index.default.set(formData, 'question.value', message.text);
681
+ }
682
+
683
+ this.setState({
684
+ formData,
685
+ quickReplyMessage: message.text
686
+ });
687
+ }
688
+
651
689
  createPostback(postback) {
652
690
  this.props.store.createPostback(this.props.cid, postback);
653
691
  }
@@ -718,7 +756,8 @@ class Widget extends _common.Com {
718
756
  cid: ''
719
757
  });
720
758
  this.setState({
721
- clickedJoin: true
759
+ clickedJoin: true,
760
+ quickReplyMessage: ''
722
761
  });
723
762
  }
724
763
 
@@ -745,7 +784,6 @@ class Widget extends _common.Com {
745
784
  let formData = this.fillForm(form);
746
785
  let convo = this.props.store.matchConvo(this.props.cid) || {};
747
786
  if (convo.state === 'ended') return true;
748
- if (this.userHasSent(this.props.cid)) return false;
749
787
  if (convo.state && convo.state !== 'pending') delete formData.group;
750
788
  return !!_index.default.find(formData, field => field.value == null || field.value === '');
751
789
  }
@@ -868,6 +906,17 @@ class Widget extends _common.Com {
868
906
  return joined;
869
907
  }
870
908
 
909
+ hasSentMessage(cid) {
910
+ let convo = this.props.store.matchConvo(cid) || {};
911
+
912
+ let joined = _index.default.find(convo.members, mem => {
913
+ if (mem.type === 'bot') return true;
914
+ return mem.last_sent;
915
+ });
916
+
917
+ return joined;
918
+ }
919
+
871
920
  isOffline(acc, accSetting) {
872
921
  let enableWhen = _index.default.get(accSetting, 'offline_form.enable_when');
873
922
 
@@ -894,7 +894,7 @@ function checkRunConditions(freq, conds, lastrun, store) {
894
894
 
895
895
  case 'source':
896
896
  if (size(cond.sources) > 0) {
897
- let source = store.matchTrafficSource();
897
+ let source = store.matchTrafficSource() || 'direct';
898
898
  if (!find(cond.sources, src => norm(src) === norm(source))) return false;
899
899
  }
900
900
 
package/dist/132.js CHANGED
@@ -225,6 +225,13 @@ class ChatButton extends common/* Com */.up {
225
225
  position = util/* default.get */.Z.get(accountSetting, 'mobile_button.position') || position;
226
226
  }
227
227
 
228
+ if (accountSetting && accountSetting.hide_agent_profile) {
229
+ agent = Object.assign({}, account, {
230
+ avatar_url: account.logo_url || __webpack_require__(9895),
231
+ fullname: account.name || this.props.t('agent')
232
+ });
233
+ }
234
+
228
235
  let cls = 'widget-preview widget-preview--' + position;
229
236
  if (!this.state.displayPreview) cls += ' widget-preview--hidden';
230
237
  var tags = this.renderMessagePreview(this.state.previewEvent, this.props.t('sent_you_a_message'));
@@ -458,6 +465,26 @@ class AgentsAvatar extends common/* Com */.up {
458
465
 
459
466
  render() {
460
467
  let accountSetting = this.props.plugin.chatbox;
468
+ let acc = this.props.store.matchAccount();
469
+ var tooltippos = this.props.tooltipPos || 'bottom';
470
+ var mode = this.props.mode || 'primary';
471
+
472
+ if (accountSetting && accountSetting.hide_agent_profile) {
473
+ return (0,preact_module.h)("div", {
474
+ class: `group-avatar group-avatar--${mode}`
475
+ }, (0,preact_module.h)("div", {
476
+ class: "d-inline-block pos-relative",
477
+ "data-tooltip": acc.name,
478
+ "data-tooltip-position": tooltippos
479
+ }, (0,preact_module.h)("img", {
480
+ width: 35,
481
+ height: 35,
482
+ alt: "agent avatar left",
483
+ class: "avatar group-avatar--agent-left",
484
+ src: this.props.store.replaceFileUrl(acc.logo_url) || __webpack_require__(9895)
485
+ })));
486
+ }
487
+
461
488
  let agentM = this.props.store.matchAgent('*');
462
489
  var agents = util/* default.map */.Z.map(this.props.agent_ids, id => agentM[id]);
463
490
 
@@ -473,9 +500,6 @@ class AgentsAvatar extends common/* Com */.up {
473
500
  }
474
501
 
475
502
  agents = util/* default.filter */.Z.filter(agents, ag => !!ag);
476
- let acc = this.props.store.matchAccount();
477
- var tooltippos = this.props.tooltipPos || 'bottom';
478
- var mode = this.props.mode || 'primary';
479
503
 
480
504
  if (agents.length === 0) {
481
505
  return (0,preact_module.h)("div", {
@@ -836,6 +860,12 @@ class MessageInput extends common/* Com */.up {
836
860
  }, 5);
837
861
  }
838
862
 
863
+ blur() {
864
+ const $input = this.refMessageInput.current;
865
+ if (!$input) return;
866
+ $input.blur();
867
+ }
868
+
839
869
  render() {
840
870
  var buttons = (0,preact_module.h)("div", {
841
871
  class: "d-flex flex-row align-self-end"
@@ -2726,6 +2756,18 @@ class Event extends common/* Com */.up {
2726
2756
 
2727
2757
  var uri = acc.logo_url || __webpack_require__(9895);
2728
2758
 
2759
+ if (util/* default.get */.Z.get(this.props, 'chatbox.hide_agent_profile')) {
2760
+ return (0,preact_module.h)("div", {
2761
+ class: "message-sender"
2762
+ }, (0,preact_module.h)("img", {
2763
+ alt: "sender",
2764
+ class: "message-sender-avatar",
2765
+ src: this.props.store.replaceFileUrl(uri)
2766
+ }), (0,preact_module.h)("p", {
2767
+ class: "message-sender-name"
2768
+ }, acc.name));
2769
+ }
2770
+
2729
2771
  let agentM = this.props.store.matchAgent('*');
2730
2772
 
2731
2773
  if (byid !== 'system' || bytype !== 'dummy') {
@@ -3022,6 +3064,7 @@ class Events extends common/* Com */.up {
3022
3064
  }));
3023
3065
  processEvents(convo, events);
3024
3066
  let $events = util/* default.map */.Z.map(events, ev => (0,preact_module.h)(Event, {
3067
+ chatbox: this.props.chatbox,
3025
3068
  onLink: this.props.onLink,
3026
3069
  store: this.props.store,
3027
3070
  onFormSubmit: this.props.onFormSubmit,
@@ -5622,6 +5665,48 @@ class Widget extends common/* Com */.up {
5622
5665
  constructor(props) {
5623
5666
  super(props);
5624
5667
 
5668
+ Widget_defineProperty(this, "msgInput", (0,preact_module/* createRef */.Vf)());
5669
+
5670
+ Widget_defineProperty(this, "sendMessage", async message => {
5671
+ let hasPostback = util/* default.find */.Z.find(message.attachments, att => att.type === 'postback');
5672
+
5673
+ if (this.isFormRequired() && hasPostback) {
5674
+ this.onStartConvoClick();
5675
+ this.fillQuickReplyToQuestion(message);
5676
+ return;
5677
+ }
5678
+
5679
+ let text = message.text;
5680
+
5681
+ if (!this.props.cid) {
5682
+ this.creating = true;
5683
+ const {
5684
+ convo,
5685
+ error
5686
+ } = await this.props.store.startConvo({
5687
+ locale: this.props.t.locale(),
5688
+ message: text,
5689
+ initial_by: this.props.store.matchUser().id
5690
+ });
5691
+
5692
+ if (error) {}
5693
+
5694
+ this.creating = false;
5695
+ this.props.store.sendConvoEvent(convo.id, 'message_sent', {
5696
+ message
5697
+ });
5698
+ this.props.onGo({
5699
+ view: 'chat',
5700
+ cid: convo.id
5701
+ });
5702
+ return;
5703
+ }
5704
+
5705
+ this.props.store.sendConvoEvent(this.props.cid, 'message_sent', {
5706
+ message
5707
+ });
5708
+ });
5709
+
5625
5710
  Widget_defineProperty(this, "onLink", (e, url) => {
5626
5711
  if (!url) return e.preventDefault();
5627
5712
  let noschemeurl = url.replace(/(^\w+:|^)\/\//, '');
@@ -5652,7 +5737,8 @@ class Widget extends common/* Com */.up {
5652
5737
  clickedJoin: false,
5653
5738
  formData: {},
5654
5739
  showOrder: false,
5655
- order_id: ''
5740
+ order_id: '',
5741
+ quickReplyMessage: ''
5656
5742
  });
5657
5743
  this.props.store.onUpdate(this, _ => this.forceUpdate());
5658
5744
  }
@@ -5670,7 +5756,8 @@ class Widget extends common/* Com */.up {
5670
5756
  if (prevProp.cid !== this.props.cid) {
5671
5757
  this.closeOrder();
5672
5758
  this.setState({
5673
- clickedJoin: false
5759
+ clickedJoin: false,
5760
+ quickReplyMessage: ''
5674
5761
  });
5675
5762
  setTimeout(() => {
5676
5763
  this.events && this.events.focus();
@@ -5682,6 +5769,13 @@ class Widget extends common/* Com */.up {
5682
5769
  }
5683
5770
 
5684
5771
  shouldShowForm() {
5772
+ let form;
5773
+ let accountSetting = this.props.plugin.chatbox || {};
5774
+ let acc = this.props.store.matchAccount() || {};
5775
+ if (util/* default.get */.Z.get(accountSetting, 'prechat_form.enabled')) form = accountSetting.prechat_form;
5776
+ let offlineEnabled = util/* default.get */.Z.get(accountSetting, 'offline_form.enabled');
5777
+ if (this.isOffline(acc, accountSetting) && offlineEnabled) form = accountSetting.offline_form;
5778
+ if (!this.hasSentMessage(this.props.cid) && form && (util/* default.size */.Z.size(form.groups) || form.group_required)) return true;
5685
5779
  let formRequired = this.isFormRequired();
5686
5780
  return formRequired && !this.props.cid || formRequired && this.props.cid && this.state.clickedJoin;
5687
5781
  }
@@ -5789,6 +5883,9 @@ class Widget extends common/* Com */.up {
5789
5883
  }]
5790
5884
  }
5791
5885
  });
5886
+ this.setState({
5887
+ quickReplyMessage: ''
5888
+ });
5792
5889
  if (form.end_conversation_after_submit) await this.props.store.endConvo(this.props.cid);
5793
5890
  return;
5794
5891
  }
@@ -5834,7 +5931,8 @@ class Widget extends common/* Com */.up {
5834
5931
  });
5835
5932
  this.setState({
5836
5933
  creating: false,
5837
- clickedJoin: false
5934
+ clickedJoin: false,
5935
+ quickReplyMessage: ''
5838
5936
  });
5839
5937
  if (!this.props.store.isMobile()) this.focusInput();
5840
5938
  }
@@ -5845,7 +5943,8 @@ class Widget extends common/* Com */.up {
5845
5943
  key: 'question',
5846
5944
  is_required: true,
5847
5945
  label: this.props.t.i18n(util/* default.get */.Z.get(form, `i18n_question_label`, {})) || form.question_label,
5848
- type: 'text'
5946
+ type: 'text',
5947
+ value: this.state.quickReplyMessage
5849
5948
  };
5850
5949
  this.setState({
5851
5950
  formData
@@ -5898,6 +5997,7 @@ class Widget extends common/* Com */.up {
5898
5997
  renderFields() {
5899
5998
  if (util/* default.size */.Z.size(this.state.formData) === 0) return null;
5900
5999
  let $fields = util/* default.map */.Z.map(this.state.formData, (field, key) => {
6000
+ if (this.state.quickReplyMessage && key === 'question') return null;
5901
6001
  let $field = null;
5902
6002
  var errclass = field.error ? 'input--error' : '';
5903
6003
 
@@ -6114,7 +6214,7 @@ class Widget extends common/* Com */.up {
6114
6214
 
6115
6215
  blur() {
6116
6216
  if (this.props.store.isPreview) return;
6117
- var $input = this.msgInput;
6217
+ var $input = this.msgInput.current;
6118
6218
  if (!$input) return;
6119
6219
  setTimeout(() => $input && $input.blur());
6120
6220
  setTimeout(() => $input && $input.blur(), 300);
@@ -6138,7 +6238,7 @@ class Widget extends common/* Com */.up {
6138
6238
  return;
6139
6239
  }
6140
6240
 
6141
- var $input = this.msgInput;
6241
+ var $input = this.msgInput.current;
6142
6242
  if (!$input) return;
6143
6243
  setTimeout(() => $input.focus());
6144
6244
  setTimeout(() => $input.focus(), 300);
@@ -6154,35 +6254,16 @@ class Widget extends common/* Com */.up {
6154
6254
  this.focusInput();
6155
6255
  }
6156
6256
 
6157
- async sendMessage(message) {
6158
- let text = message.text;
6159
-
6160
- if (!this.props.cid) {
6161
- this.creating = true;
6162
- const {
6163
- convo,
6164
- error
6165
- } = await this.props.store.startConvo({
6166
- locale: this.props.t.locale(),
6167
- message: text,
6168
- initial_by: this.props.store.matchUser().id
6169
- });
6170
-
6171
- if (error) {}
6257
+ fillQuickReplyToQuestion(message) {
6258
+ let formData = this.state.formData;
6172
6259
 
6173
- this.creating = false;
6174
- this.props.store.sendConvoEvent(convo.id, 'message_sent', {
6175
- message
6176
- });
6177
- this.props.onGo({
6178
- view: 'chat',
6179
- cid: convo.id
6180
- });
6181
- return;
6260
+ if (formData) {
6261
+ util/* default.set */.Z.set(formData, 'question.value', message.text);
6182
6262
  }
6183
6263
 
6184
- this.props.store.sendConvoEvent(this.props.cid, 'message_sent', {
6185
- message
6264
+ this.setState({
6265
+ formData,
6266
+ quickReplyMessage: message.text
6186
6267
  });
6187
6268
  }
6188
6269
 
@@ -6193,9 +6274,9 @@ class Widget extends common/* Com */.up {
6193
6274
  renderChat() {
6194
6275
  let $input = (0,preact_module.h)(MessageInput, {
6195
6276
  store: this.props.store,
6196
- ref: ref => this.msgInput = ref,
6277
+ ref: this.msgInput,
6197
6278
  cid: this.props.cid,
6198
- onSend: e => this.sendMessage(e),
6279
+ onSend: this.sendMessage,
6199
6280
  t: this.props.t
6200
6281
  });
6201
6282
  let convo = this.props.store.matchConvo(this.props.cid) || {};
@@ -6218,6 +6299,7 @@ class Widget extends common/* Com */.up {
6218
6299
  isShow: this.props.isShow,
6219
6300
  onLink: this.onLink,
6220
6301
  store: this.props.store,
6302
+ chatbox: this.props.plugin.chatbox || {},
6221
6303
  onFormSubmit: e => this.onEventFormSubmit(e),
6222
6304
  ref: ref => this.events = ref,
6223
6305
  cid: this.props.cid,
@@ -6255,7 +6337,8 @@ class Widget extends common/* Com */.up {
6255
6337
  cid: ''
6256
6338
  });
6257
6339
  this.setState({
6258
- clickedJoin: true
6340
+ clickedJoin: true,
6341
+ quickReplyMessage: ''
6259
6342
  });
6260
6343
  }
6261
6344
 
@@ -6280,12 +6363,12 @@ class Widget extends common/* Com */.up {
6280
6363
  let formData = this.fillForm(form);
6281
6364
  let convo = this.props.store.matchConvo(this.props.cid) || {};
6282
6365
  if (convo.state === 'ended') return true;
6283
- if (this.userHasSent(this.props.cid)) return false;
6284
6366
  if (convo.state && convo.state !== 'pending') delete formData.group;
6285
6367
  return !!util/* default.find */.Z.find(formData, field => field.value == null || field.value === '');
6286
6368
  }
6287
6369
 
6288
6370
  renderConvoSummary(convo) {
6371
+ let accountSetting = this.props.plugin.chatbox || {};
6289
6372
  let agentM = this.props.store.matchAgent('*');
6290
6373
  let ags = util/* default.filter */.Z.filter(convo.members, m => {
6291
6374
  return (m.type === 'agent' || m.type === 'bot') && m.membership === 'active';
@@ -6297,7 +6380,7 @@ class Widget extends common/* Com */.up {
6297
6380
  fullname: 'Offline Agent'
6298
6381
  });
6299
6382
  var name = util/* default.each */.Z.each(agents, ag => ag.fullname).join(', ');
6300
- if (!name) name = this.props.store.matchAccount().name;
6383
+ if (accountSetting.hide_agent_profile || !name) name = this.props.store.matchAccount().name;
6301
6384
  if (!name) name = this.props.t('agent');
6302
6385
  var $you = null;
6303
6386
 
@@ -6384,6 +6467,15 @@ class Widget extends common/* Com */.up {
6384
6467
  return joined;
6385
6468
  }
6386
6469
 
6470
+ hasSentMessage(cid) {
6471
+ let convo = this.props.store.matchConvo(cid) || {};
6472
+ let joined = util/* default.find */.Z.find(convo.members, mem => {
6473
+ if (mem.type === 'bot') return true;
6474
+ return mem.last_sent;
6475
+ });
6476
+ return joined;
6477
+ }
6478
+
6387
6479
  isOffline(acc, accSetting) {
6388
6480
  let enableWhen = util/* default.get */.Z.get(accSetting, 'offline_form.enable_when');
6389
6481
  let isonline = true;
@@ -6639,6 +6731,14 @@ class Main extends common/* Com */.up {
6639
6731
  }
6640
6732
 
6641
6733
  p = p || {};
6734
+
6735
+ if (!p.view && !p.cid) {
6736
+ let convoM = this.props.store.matchConvo('*');
6737
+ let redconvo = util/* default.find */.Z.find(convoM, convo => !util/* default.isConvoSeen */.Z.isConvoSeen(convo, this.props.store.matchUser().id));
6738
+ p.cid = util/* default.get */.Z.get(redconvo, 'id', util/* default.get */.Z.get(convoM, '0.id'));
6739
+ p.view = 'chat';
6740
+ }
6741
+
6642
6742
  if (this.props.store.isMobile()) modifyViewport();
6643
6743
  this.setState({
6644
6744
  widgetConvoId: p.cid,