@subiz/widget-v4 4.1.169 → 4.1.172

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 (35) hide show
  1. package/compiled_src/chatbox/ChatButton.js +1 -0
  2. package/compiled_src/chatbox/main.js +13 -3
  3. package/compiled_src/lib.js +2 -2
  4. package/compiled_src/plugin.js +3 -0
  5. package/compiled_src/store/store.js +9 -9
  6. package/dist/{198a92fcacc.app.js → 198b082f7d0.app.js} +1 -1
  7. package/dist/{198a92fcacc.chat.html → 198b082f7d0.chat.html} +1 -1
  8. package/dist/{198a92fcacc.chat.js → 198b082f7d0.chat.js} +1 -1
  9. package/dist/{198a92fcacc.form.html → 198b082f7d0.form.html} +1 -1
  10. package/dist/{198a92fcacc.form.js → 198b082f7d0.form.js} +1 -1
  11. package/dist/{198a92fcacc.index.html → 198b082f7d0.index.html} +1 -1
  12. package/dist/{198a92fcacc.library.html → 198b082f7d0.library.html} +1 -1
  13. package/dist/{198a92fcacc.library.js → 198b082f7d0.library.js} +1 -1
  14. package/dist/{198a92fcacc.preview.html → 198b082f7d0.preview.html} +1 -1
  15. package/dist/{198a92fcacc.preview.js → 198b082f7d0.preview.js} +1 -1
  16. package/dist/{198a92fcacc.webview.js → 198b082f7d0.webview.js} +1 -1
  17. package/dist/HASH +1 -1
  18. package/dist/screenshoot.js +5 -2
  19. package/inject.js +4 -3
  20. package/package.json +2 -2
  21. package/src/chatbox/ChatButton.js +3 -0
  22. package/src/chatbox/main.js +13 -4
  23. package/src/lib.js +2 -2
  24. package/src/plugin.js +4 -1
  25. package/src/store/store.js +11 -12
  26. /package/dist/{198a92fcacc.127.js → 198b082f7d0.127.js} +0 -0
  27. /package/dist/{198a92fcacc.132.js → 198b082f7d0.132.js} +0 -0
  28. /package/dist/{198a92fcacc.185.js → 198b082f7d0.185.js} +0 -0
  29. /package/dist/{198a92fcacc.27.js → 198b082f7d0.27.js} +0 -0
  30. /package/dist/{198a92fcacc.278.js → 198b082f7d0.278.js} +0 -0
  31. /package/dist/{198a92fcacc.339.js → 198b082f7d0.339.js} +0 -0
  32. /package/dist/{198a92fcacc.459.js → 198b082f7d0.459.js} +0 -0
  33. /package/dist/{198a92fcacc.490.js → 198b082f7d0.490.js} +0 -0
  34. /package/dist/{198a92fcacc.74.js → 198b082f7d0.74.js} +0 -0
  35. /package/dist/{198a92fcacc.997.js → 198b082f7d0.997.js} +0 -0
@@ -252,6 +252,7 @@ class ChatButton extends _common.Com {
252
252
  this._buttonLoaded = true;
253
253
  }
254
254
  renderButton() {
255
+ if (typeof sbz_info != 'undefined') sbz_info.render_chatbox_button = _index.default.Date.now();
255
256
  let accountSetting = this.props.plugin.chatbox;
256
257
  accountSetting = this.fixMissingSetting(accountSetting);
257
258
  let imgsrc = _index.default.get(accountSetting, 'desktop_button.background_image_url') || _index.default.get(accountSetting, 'desktop_button.background_mask_url') || defaultBubble;
@@ -68,9 +68,19 @@ class Main extends _common.Com {
68
68
  }
69
69
  }
70
70
  render() {
71
- if (!this.state.cssready) return null;
72
- if (_index.default.isUserBanned(this.props.store.matchUser())) return null;
73
- if (!this.props.t) return null;
71
+ if (!this.state.cssready) {
72
+ if (typeof sbz_info != 'undefined') sbz_info.render_chatbox_css_not_ready = _index.default.Date.now();
73
+ return null;
74
+ }
75
+ if (_index.default.isUserBanned(this.props.store.matchUser())) {
76
+ if (typeof sbz_info != 'undefined') sbz_info.render_chatbox_user_is_banned = _index.default.Date.now();
77
+ return null;
78
+ }
79
+ if (!this.props.t) {
80
+ if (typeof sbz_info != 'undefined') sbz_info.render_chatbox_no_t = _index.default.Date.now();
81
+ return null;
82
+ }
83
+ if (typeof sbz_info != 'undefined') sbz_info.render_chatbox_main = _index.default.Date.now();
74
84
  return (0, _preact.h)("div", {
75
85
  class: this.props.store.isMobile() ? 'mobile' : 'desktop'
76
86
  }, (0, _preact.h)(_ChatButton.default, {
@@ -251,14 +251,14 @@ class Widget {
251
251
  }
252
252
  async showWidget(view, cid) {
253
253
  await this.domGate.entry();
254
- this.pluginMgr.showCurrentChatbox({
254
+ return this.pluginMgr.showCurrentChatbox({
255
255
  view,
256
256
  cid: cid
257
257
  });
258
258
  }
259
259
  async showTyping() {
260
260
  await this.domGate.entry();
261
- this.pluginMgr.showCurrentChatboxTyping();
261
+ return this.pluginMgr.showCurrentChatboxTyping();
262
262
  }
263
263
  async hideWidget() {
264
264
  await this.domGate.entry();
@@ -29,6 +29,7 @@ function Plugin(plugin, store, $container, lib) {
29
29
  var _this = this;
30
30
  this.getState = () => state;
31
31
  var run = async function () {
32
+ if (typeof sbz_info != 'undefined') sbz_info[_index.default.Date.now() + '.run'] = state;
32
33
  if (_destroy) return;
33
34
  if (state !== 'hold') return;
34
35
  if (plugin.type === 'popup' && store.isConverted(plugin.id)) return;
@@ -36,6 +37,7 @@ function Plugin(plugin, store, $container, lib) {
36
37
  if (plugin.type === 'chatbox' || plugin.type === 'notification') lastrun = undefined;
37
38
  if (!plugin.enabled) return;
38
39
  let match = _index.default.checkRunConditions(plugin.initiative_frequency, plugin.conditions, lastrun, store);
40
+ if (typeof sbz_info != 'undefined') sbz_info[_index.default.Date.now() + '.run.match'] = match;
39
41
  if (!match) return;
40
42
  state = 'running';
41
43
  await _this.update(plugin);
@@ -223,6 +225,7 @@ class PluginMgr {
223
225
  });
224
226
  });
225
227
  let pluginM = this.lib.store.matchPlugin();
228
+ if (typeof sbz_info != 'undefined') sbz_info['plugins'] = pluginM;
226
229
  let foundchatbox = false;
227
230
  _index.default.each(pluginM, conf => {
228
231
  if (conf.type === 'chatbox') {
@@ -833,17 +833,17 @@ class Store {
833
833
  this.chain.put(cid, oldev.id, _index.default.getMs(oldev.created), oldev);
834
834
  this.pubsub.publish('events', oldev);
835
835
  }
836
- if (ev.type === 'message_sent') {
837
- let idemkey = _index.default.get(ev, 'data.message.idempotency_key');
838
- let found = _index.default.find(this.listEvents(cid), oldev => oldev.id === idemkey);
839
- if (found) {
840
- this.chain.del(cid, found.id);
841
- ev.created = found.created;
842
- }
843
- convo.last_message_sent = ev;
844
- }
845
836
  if (ev.type !== 'message_pong' && ev.type !== 'conversation_typing') {
846
837
  this.chain.put(cid, ev.id, _index.default.getMs(ev.created), ev);
838
+ if (ev.type === 'message_sent') {
839
+ let idemkey = _index.default.get(ev, 'data.message.idempotency_key');
840
+ let found = _index.default.find(this.listEvents(cid), oldev => oldev.id === idemkey);
841
+ if (found) {
842
+ this.chain.del(cid, found.id);
843
+ ev.created = found.created;
844
+ }
845
+ convo.last_message_sent = ev;
846
+ }
847
847
  }
848
848
  this._setConvo(convo);
849
849
  this.pubsub.publish('account');