@subiz/widget-v4 4.1.168 → 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.
Files changed (40) hide show
  1. package/compiled_src/lib.js +4 -2
  2. package/compiled_src/plugin.js +2 -0
  3. package/compiled_src/store/api.js +0 -1
  4. package/compiled_src/store/api_fake.js +0 -1
  5. package/compiled_src/util/common.js +24 -0
  6. package/dist/198a92fcacc.app.js +1 -0
  7. package/dist/{198a731cfbb.chat.html → 198a92fcacc.chat.html} +1 -1
  8. package/dist/{198a731cfbb.library.js → 198a92fcacc.chat.js} +1 -1
  9. package/dist/{198a731cfbb.form.html → 198a92fcacc.form.html} +1 -1
  10. package/dist/198a92fcacc.form.js +1 -0
  11. package/dist/{198a731cfbb.index.html → 198a92fcacc.index.html} +3 -2
  12. package/dist/{198a731cfbb.library.html → 198a92fcacc.library.html} +3 -2
  13. package/dist/198a92fcacc.library.js +1 -0
  14. package/dist/{198a731cfbb.preview.html → 198a92fcacc.preview.html} +1 -1
  15. package/dist/198a92fcacc.preview.js +1 -0
  16. package/dist/198a92fcacc.webview.js +1 -0
  17. package/dist/HASH +1 -1
  18. package/dist/screenshoot.js +29 -2
  19. package/inject.js +4 -3
  20. package/package.json +6 -6
  21. package/src/lib.js +4 -2
  22. package/src/plugin.js +3 -1
  23. package/src/store/api.js +0 -1
  24. package/src/store/api_fake.js +0 -1
  25. package/src/util/common.js +28 -0
  26. package/dist/198a731cfbb.app.js +0 -1
  27. package/dist/198a731cfbb.chat.js +0 -1
  28. package/dist/198a731cfbb.form.js +0 -1
  29. package/dist/198a731cfbb.preview.js +0 -1
  30. package/dist/198a731cfbb.webview.js +0 -1
  31. /package/dist/{198a731cfbb.127.js → 198a92fcacc.127.js} +0 -0
  32. /package/dist/{198a731cfbb.132.js → 198a92fcacc.132.js} +0 -0
  33. /package/dist/{198a731cfbb.185.js → 198a92fcacc.185.js} +0 -0
  34. /package/dist/{198a731cfbb.27.js → 198a92fcacc.27.js} +0 -0
  35. /package/dist/{198a731cfbb.278.js → 198a92fcacc.278.js} +0 -0
  36. /package/dist/{198a731cfbb.339.js → 198a92fcacc.339.js} +0 -0
  37. /package/dist/{198a731cfbb.459.js → 198a92fcacc.459.js} +0 -0
  38. /package/dist/{198a731cfbb.490.js → 198a92fcacc.490.js} +0 -0
  39. /package/dist/{198a731cfbb.74.js → 198a92fcacc.74.js} +0 -0
  40. /package/dist/{198a731cfbb.997.js → 198a92fcacc.997.js} +0 -0
@@ -112,7 +112,9 @@ class Widget {
112
112
  if (!id) return {
113
113
  error: 'empty_account_id'
114
114
  };
115
+ if (typeof sbz_info != 'undefined') sbz_info.set_account_1 = _index.default.Date.now();
115
116
  let outmask = await this.store.init(id, mask);
117
+ if (typeof sbz_info != 'undefined') sbz_info.set_account_2 = _index.default.Date.now();
116
118
  _index.default.setTimeout(() => window.postMessage({
117
119
  type: 'widget_loaded',
118
120
  account_id: id
@@ -249,14 +251,14 @@ class Widget {
249
251
  }
250
252
  async showWidget(view, cid) {
251
253
  await this.domGate.entry();
252
- this.pluginMgr.showCurrentChatbox({
254
+ return this.pluginMgr.showCurrentChatbox({
253
255
  view,
254
256
  cid: cid
255
257
  });
256
258
  }
257
259
  async showTyping() {
258
260
  await this.domGate.entry();
259
- this.pluginMgr.showCurrentChatboxTyping();
261
+ return this.pluginMgr.showCurrentChatboxTyping();
260
262
  }
261
263
  async hideWidget() {
262
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);
@@ -10,7 +10,6 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
10
10
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
11
11
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
12
12
  const ajax = require('@subiz/ajax/src/ajax.js');
13
- ajax.env.XMLHttpRequest = _index.default.XMLHttpRequest;
14
13
  function jsonifyTextPlain(param, done) {
15
14
  let req = param.request;
16
15
  if (req.content_type === 'text/plain' && req.body !== undefined) req.body = _index.default.stringify(req.body);
@@ -10,7 +10,6 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
10
10
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
11
11
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
12
12
  const ajax = require('@subiz/ajax/src/ajax.js');
13
- ajax.env.XMLHttpRequest = window.XMLHttpRequest;
14
13
  function jsonifyTextPlain(param, done) {
15
14
  let req = param.request;
16
15
  if (req.content_type === 'text/plain' && req.body !== undefined) req.body = _index.default.stringify(req.body);
@@ -77,6 +77,7 @@ exports.unicodeToAscii = unicodeToAscii;
77
77
  exports.unixSec = unixSec;
78
78
  exports.usersOfConvo = usersOfConvo;
79
79
  var op = require('./op.js');
80
+ const ajax = require('@subiz/ajax/src/ajax.js');
80
81
  function rgbToHsl(r, g, b) {
81
82
  ;
82
83
  r /= 255, g /= 255, b /= 255;
@@ -266,6 +267,29 @@ var setInterval = exports.setInterval = f.contentWindow.setInterval.bind(f.conte
266
267
  var clearInterval = exports.clearInterval = f.contentWindow.clearInterval.bind(f.contentWindow);
267
268
  var clearTimeout = exports.clearTimeout = f.contentWindow.clearTimeout.bind(f.contentWindow);
268
269
  var XMLHttpRequest = exports.XMLHttpRequest = f.contentWindow.XMLHttpRequest;
270
+ const _originalOpen = XMLHttpRequest.prototype.open;
271
+ const _originalSend = XMLHttpRequest.prototype.send;
272
+ XMLHttpRequest.prototype.open = function (method, url, async, user, password) {
273
+ this._url = url;
274
+ return _originalOpen.apply(this, arguments);
275
+ };
276
+ XMLHttpRequest.prototype.send = function (body) {
277
+ let old = this.onreadystatechange;
278
+ this.onreadystatechange = function (a, b, c) {
279
+ if (this.readyState != 4) return;
280
+ if (this.status >= 400 || this.status == 0) {
281
+ if (typeof sbz_logs == 'object') sbz_logs.push({
282
+ type: 'xhrfailed',
283
+ url: this._url,
284
+ status: this.status,
285
+ response: this.responseText
286
+ });
287
+ }
288
+ old(a, b, c);
289
+ };
290
+ return _originalSend.apply(this, arguments);
291
+ };
292
+ ajax.env.XMLHttpRequest = XMLHttpRequest;
269
293
  function convoOfEv(ev) {
270
294
  if (!ev) return '';
271
295
  return op.get(ev, 'data.conversation.id', op.get(ev, 'data.message.conversation_id'));