@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
package/dist/HASH CHANGED
@@ -1 +1 @@
1
- 198a92fcacc
1
+ 198b082f7d0
@@ -11310,6 +11310,7 @@ function Plugin(plugin, store, $container, lib) {
11310
11310
  var _this = this;
11311
11311
  this.getState = () => state;
11312
11312
  var run = async function () {
11313
+ if (typeof sbz_info != 'undefined') sbz_info[util/* default */.A.Date.now() + '.run'] = state;
11313
11314
  if (_destroy) return;
11314
11315
  if (state !== 'hold') return;
11315
11316
  if (plugin.type === 'popup' && store.isConverted(plugin.id)) return;
@@ -11317,6 +11318,7 @@ function Plugin(plugin, store, $container, lib) {
11317
11318
  if (plugin.type === 'chatbox' || plugin.type === 'notification') lastrun = undefined;
11318
11319
  if (!plugin.enabled) return;
11319
11320
  let match = util/* default */.A.checkRunConditions(plugin.initiative_frequency, plugin.conditions, lastrun, store);
11321
+ if (typeof sbz_info != 'undefined') sbz_info[util/* default */.A.Date.now() + '.run.match'] = match;
11320
11322
  if (!match) return;
11321
11323
  state = 'running';
11322
11324
  await _this.update(plugin);
@@ -11504,6 +11506,7 @@ class PluginMgr {
11504
11506
  });
11505
11507
  });
11506
11508
  let pluginM = this.lib.store.matchPlugin();
11509
+ if (typeof sbz_info != 'undefined') sbz_info['plugins'] = pluginM;
11507
11510
  let foundchatbox = false;
11508
11511
  util/* default */.A.each(pluginM, conf => {
11509
11512
  if (conf.type === 'chatbox') {
@@ -11829,14 +11832,14 @@ class lib_Widget {
11829
11832
  }
11830
11833
  async showWidget(view, cid) {
11831
11834
  await this.domGate.entry();
11832
- this.pluginMgr.showCurrentChatbox({
11835
+ return this.pluginMgr.showCurrentChatbox({
11833
11836
  view,
11834
11837
  cid: cid
11835
11838
  });
11836
11839
  }
11837
11840
  async showTyping() {
11838
11841
  await this.domGate.entry();
11839
- this.pluginMgr.showCurrentChatboxTyping();
11842
+ return this.pluginMgr.showCurrentChatboxTyping();
11840
11843
  }
11841
11844
  async hideWidget() {
11842
11845
  await this.domGate.entry();
package/inject.js CHANGED
@@ -885,14 +885,15 @@ async function run() {
885
885
  config.RealtimeURL,
886
886
  true,
887
887
  false,
888
- 'acqsulrowbxiugvginhw_agqygncqpyaxoujpfc_rtragrsrnshpcernpgiujlnchaaxavkeuhlvevemcuwef',
888
+ // 'acqsulrowbxiugvginhw_agqygncqpyaxoujpfc_rtragrsrnshpcernpgiujlnchaaxavkeuhlvevemcuwef',
889
889
  ) // fake
890
890
  window.subiz = subiz
891
891
 
892
892
  //runNoti(subiz)
893
893
  //runPopup(subiz)
894
- runChatbox(subiz)
895
- await subiz.setAccount('acpxkgumifuoofoosble', document.querySelector('.container'))
894
+ // runChatbox(subiz)
895
+ await subiz.init({account_id: 'acpxkgumifuoofoosble', ref: 'thanhtest123'}, document.querySelector('.container'))
896
+ // await subiz.setAccount('acpxkgumifuoofoosble', document.querySelector('.container'))
896
897
 
897
898
  // subiz.showWidget('rating', 'csqwudlkftltnbebvq')
898
899
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@subiz/widget-v4",
3
- "version": "4.1.169",
3
+ "version": "4.1.172",
4
4
  "main": "./compiled_src/lib.js",
5
5
  "scripts": {
6
6
  "dev": "npx webpack serve --config webpack.dev.js",
@@ -30,7 +30,7 @@
30
30
  "babel-plugin-syntax-jsx": "^6.18.0",
31
31
  "html-webpack-plugin": "^5.6.4",
32
32
  "puppeteer": "^24.16.2",
33
- "webpack": "^5.101.1",
33
+ "webpack": "^5.101.2",
34
34
  "webpack-bundle-analyzer": "^4.10.2",
35
35
  "webpack-cli": "^6.0.1",
36
36
  "webpack-dev-server": "^5.2.2"
@@ -266,6 +266,8 @@ export default class ChatButton extends Com {
266
266
  }
267
267
 
268
268
  renderButton() {
269
+ if (typeof sbz_info != 'undefined') sbz_info.render_chatbox_button = sb.Date.now()
270
+
269
271
  let accountSetting = this.props.plugin.chatbox
270
272
  accountSetting = this.fixMissingSetting(accountSetting)
271
273
  let imgsrc =
@@ -369,6 +371,7 @@ export default class ChatButton extends Com {
369
371
  height: ${imgheight - 4}px !important;
370
372
 
371
373
  `
374
+
372
375
  return (
373
376
  <div class={cls} onClick={(e) => this.onClick(e)}>
374
377
  <div class={whitebgcls} style={whiteBgStyle}></div>
@@ -73,10 +73,19 @@ export default class Main extends Com {
73
73
  }
74
74
 
75
75
  render() {
76
- if (!this.state.cssready) return null
77
- if (sb.isUserBanned(this.props.store.matchUser())) return null
78
- if (!this.props.t) return null
79
-
76
+ if (!this.state.cssready) {
77
+ if (typeof sbz_info != 'undefined') sbz_info.render_chatbox_css_not_ready = sb.Date.now()
78
+ return null
79
+ }
80
+ if (sb.isUserBanned(this.props.store.matchUser())) {
81
+ if (typeof sbz_info != 'undefined') sbz_info.render_chatbox_user_is_banned = sb.Date.now()
82
+ return null
83
+ }
84
+ if (!this.props.t) {
85
+ if (typeof sbz_info != 'undefined') sbz_info.render_chatbox_no_t = sb.Date.now()
86
+ return null
87
+ }
88
+ if (typeof sbz_info != 'undefined') sbz_info.render_chatbox_main = sb.Date.now()
80
89
  return (
81
90
  <div class={this.props.store.isMobile() ? 'mobile' : 'desktop'}>
82
91
  <ChatButton
package/src/lib.js CHANGED
@@ -255,12 +255,12 @@ class Widget {
255
255
  // view could be: chat, list, offline_form
256
256
  async showWidget(view, cid) {
257
257
  await this.domGate.entry()
258
- this.pluginMgr.showCurrentChatbox({view, cid: cid})
258
+ return this.pluginMgr.showCurrentChatbox({view, cid: cid})
259
259
  }
260
260
 
261
261
  async showTyping() {
262
262
  await this.domGate.entry()
263
- this.pluginMgr.showCurrentChatboxTyping()
263
+ return this.pluginMgr.showCurrentChatboxTyping()
264
264
  }
265
265
 
266
266
  async hideWidget() {
package/src/plugin.js CHANGED
@@ -31,6 +31,7 @@ function Plugin(plugin, store, $container, lib) {
31
31
  this.getState = () => state
32
32
 
33
33
  var run = async function () {
34
+ if (typeof sbz_info != 'undefined') sbz_info[sb.Date.now() + '.run'] = state
34
35
  if (_destroy) return
35
36
  if (state !== 'hold') return
36
37
  if (plugin.type === 'popup' && store.isConverted(plugin.id)) return
@@ -39,6 +40,7 @@ function Plugin(plugin, store, $container, lib) {
39
40
  if (plugin.type === 'chatbox' || plugin.type === 'notification') lastrun = undefined
40
41
  if (!plugin.enabled) return
41
42
  let match = sb.checkRunConditions(plugin.initiative_frequency, plugin.conditions, lastrun, store)
43
+ if (typeof sbz_info != 'undefined') sbz_info[sb.Date.now() + '.run.match'] = match
42
44
  if (!match) return
43
45
  state = 'running'
44
46
  await _this.update(plugin)
@@ -73,7 +75,7 @@ function Plugin(plugin, store, $container, lib) {
73
75
 
74
76
  if (plugin.type === 'chatbox') {
75
77
  // if (!Chatbox) Chatbox = (await LoadChatbox()).default
76
- if (typeof sbz_info != 'undefined' ) sbz_info.render_chatbox = sb.Date.now()
78
+ if (typeof sbz_info != 'undefined') sbz_info.render_chatbox = sb.Date.now()
77
79
  render(<Chatbox destroy={_destroy} plugin={plugin} store={store} ref={_ref} t={this.t} />, $div)
78
80
  }
79
81
 
@@ -253,6 +255,7 @@ export default class PluginMgr {
253
255
  })
254
256
 
255
257
  let pluginM = this.lib.store.matchPlugin()
258
+ if (typeof sbz_info != 'undefined') sbz_info['plugins'] = pluginM
256
259
  let foundchatbox = false
257
260
  sb.each(pluginM, (conf) => {
258
261
  if (conf.type === 'chatbox') {
@@ -980,21 +980,20 @@ export default class Store {
980
980
  this.pubsub.publish('events', oldev)
981
981
  }
982
982
 
983
- if (ev.type === 'message_sent') {
984
- let idemkey = sb.get(ev, 'data.message.idempotency_key')
985
- let found = sb.find(this.listEvents(cid), (oldev) => oldev.id === idemkey)
986
- if (found) {
987
- // keeping old created so the ui can be static
988
- this.chain.del(cid, found.id)
989
- ev.created = found.created
990
- }
991
-
992
- convo.last_message_sent = ev
993
- }
994
-
995
983
  // dont store pong and typing
996
984
  if (ev.type !== 'message_pong' && ev.type !== 'conversation_typing') {
997
985
  this.chain.put(cid, ev.id, sb.getMs(ev.created), ev)
986
+ if (ev.type === 'message_sent') {
987
+ let idemkey = sb.get(ev, 'data.message.idempotency_key')
988
+ let found = sb.find(this.listEvents(cid), (oldev) => oldev.id === idemkey)
989
+ if (found) {
990
+ // keeping old created so the ui can be static
991
+ this.chain.del(cid, found.id)
992
+ ev.created = found.created
993
+ }
994
+
995
+ convo.last_message_sent = ev
996
+ }
998
997
  }
999
998
  this._setConvo(convo)
1000
999
  this.pubsub.publish('account')
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes