@subiz/widget-v4 4.1.169 → 4.1.170

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.
@@ -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);
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.170",
4
4
  "main": "./compiled_src/lib.js",
5
5
  "scripts": {
6
6
  "dev": "npx webpack serve --config webpack.dev.js",
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