@subiz/widget-v4 4.1.168 → 4.1.169

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/compiled_src/lib.js +2 -0
  2. package/compiled_src/store/api.js +0 -1
  3. package/compiled_src/store/api_fake.js +0 -1
  4. package/compiled_src/util/common.js +24 -0
  5. package/dist/198a92fcacc.app.js +1 -0
  6. package/dist/{198a731cfbb.chat.html → 198a92fcacc.chat.html} +1 -1
  7. package/dist/{198a731cfbb.library.js → 198a92fcacc.chat.js} +1 -1
  8. package/dist/{198a731cfbb.form.html → 198a92fcacc.form.html} +1 -1
  9. package/dist/198a92fcacc.form.js +1 -0
  10. package/dist/{198a731cfbb.index.html → 198a92fcacc.index.html} +3 -2
  11. package/dist/{198a731cfbb.library.html → 198a92fcacc.library.html} +3 -2
  12. package/dist/198a92fcacc.library.js +1 -0
  13. package/dist/{198a731cfbb.preview.html → 198a92fcacc.preview.html} +1 -1
  14. package/dist/198a92fcacc.preview.js +1 -0
  15. package/dist/198a92fcacc.webview.js +1 -0
  16. package/dist/HASH +1 -1
  17. package/dist/screenshoot.js +29 -2
  18. package/package.json +6 -6
  19. package/src/lib.js +2 -0
  20. package/src/store/api.js +0 -1
  21. package/src/store/api_fake.js +0 -1
  22. package/src/util/common.js +28 -0
  23. package/dist/198a731cfbb.app.js +0 -1
  24. package/dist/198a731cfbb.chat.js +0 -1
  25. package/dist/198a731cfbb.form.js +0 -1
  26. package/dist/198a731cfbb.preview.js +0 -1
  27. package/dist/198a731cfbb.webview.js +0 -1
  28. /package/dist/{198a731cfbb.127.js → 198a92fcacc.127.js} +0 -0
  29. /package/dist/{198a731cfbb.132.js → 198a92fcacc.132.js} +0 -0
  30. /package/dist/{198a731cfbb.185.js → 198a92fcacc.185.js} +0 -0
  31. /package/dist/{198a731cfbb.27.js → 198a92fcacc.27.js} +0 -0
  32. /package/dist/{198a731cfbb.278.js → 198a92fcacc.278.js} +0 -0
  33. /package/dist/{198a731cfbb.339.js → 198a92fcacc.339.js} +0 -0
  34. /package/dist/{198a731cfbb.459.js → 198a92fcacc.459.js} +0 -0
  35. /package/dist/{198a731cfbb.490.js → 198a92fcacc.490.js} +0 -0
  36. /package/dist/{198a731cfbb.74.js → 198a92fcacc.74.js} +0 -0
  37. /package/dist/{198a731cfbb.997.js → 198a92fcacc.997.js} +0 -0
package/dist/HASH CHANGED
@@ -1 +1 @@
1
- 198a731cfbb
1
+ 198a92fcacc
@@ -2262,6 +2262,7 @@ __webpack_require__.r(__webpack_exports__);
2262
2262
  /* harmony export */ usersOfConvo: () => (/* binding */ usersOfConvo)
2263
2263
  /* harmony export */ });
2264
2264
  var op = __webpack_require__(3259);
2265
+ const ajax = __webpack_require__(318);
2265
2266
  function rgbToHsl(r, g, b) {
2266
2267
  ;
2267
2268
  r /= 255, g /= 255, b /= 255;
@@ -2451,6 +2452,29 @@ var setInterval = f.contentWindow.setInterval.bind(f.contentWindow);
2451
2452
  var clearInterval = f.contentWindow.clearInterval.bind(f.contentWindow);
2452
2453
  var clearTimeout = f.contentWindow.clearTimeout.bind(f.contentWindow);
2453
2454
  var XMLHttpRequest = f.contentWindow.XMLHttpRequest;
2455
+ const _originalOpen = XMLHttpRequest.prototype.open;
2456
+ const _originalSend = XMLHttpRequest.prototype.send;
2457
+ XMLHttpRequest.prototype.open = function (method, url, async, user, password) {
2458
+ this._url = url;
2459
+ return _originalOpen.apply(this, arguments);
2460
+ };
2461
+ XMLHttpRequest.prototype.send = function (body) {
2462
+ let old = this.onreadystatechange;
2463
+ this.onreadystatechange = function (a, b, c) {
2464
+ if (this.readyState != 4) return;
2465
+ if (this.status >= 400 || this.status == 0) {
2466
+ if (typeof sbz_logs == 'object') sbz_logs.push({
2467
+ type: 'xhrfailed',
2468
+ url: this._url,
2469
+ status: this.status,
2470
+ response: this.responseText
2471
+ });
2472
+ }
2473
+ old(a, b, c);
2474
+ };
2475
+ return _originalSend.apply(this, arguments);
2476
+ };
2477
+ ajax.env.XMLHttpRequest = XMLHttpRequest;
2454
2478
  function convoOfEv(ev) {
2455
2479
  if (!ev) return '';
2456
2480
  return op.get(ev, 'data.conversation.id', op.get(ev, 'data.message.conversation_id'));
@@ -3737,7 +3761,6 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
3737
3761
  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); }
3738
3762
 
3739
3763
  const ajax = __webpack_require__(318);
3740
- ajax.env.XMLHttpRequest = util/* default */.A.XMLHttpRequest;
3741
3764
  function jsonifyTextPlain(param, done) {
3742
3765
  let req = param.request;
3743
3766
  if (req.content_type === 'text/plain' && req.body !== undefined) req.body = util/* default */.A.stringify(req.body);
@@ -4431,7 +4454,6 @@ function api_fake_toPropertyKey(t) { var i = api_fake_toPrimitive(t, "string");
4431
4454
  function api_fake_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); }
4432
4455
 
4433
4456
  const api_fake_ajax = __webpack_require__(318);
4434
- api_fake_ajax.env.XMLHttpRequest = window.XMLHttpRequest;
4435
4457
  function api_fake_jsonifyTextPlain(param, done) {
4436
4458
  let req = param.request;
4437
4459
  if (req.content_type === 'text/plain' && req.body !== undefined) req.body = util/* default */.A.stringify(req.body);
@@ -11320,6 +11342,7 @@ function Plugin(plugin, store, $container, lib) {
11320
11342
  if (!$div) return;
11321
11343
  if (!this.t) return;
11322
11344
  if (plugin.type === 'chatbox') {
11345
+ if (typeof sbz_info != 'undefined') sbz_info.render_chatbox = util/* default */.A.Date.now();
11323
11346
  (0,preact_module/* render */.XX)((0,preact_module.h)(Main, {
11324
11347
  destroy: _destroy,
11325
11348
  plugin: plugin,
@@ -11663,10 +11686,13 @@ class lib_Widget {
11663
11686
  return outmask;
11664
11687
  }
11665
11688
  async setAccount(id, $container, mask, cb) {
11689
+ if (typeof sbz_info != 'undefined') sbz_info.set_account = util/* default */.A.Date.now();
11666
11690
  if (!id) return {
11667
11691
  error: 'empty_account_id'
11668
11692
  };
11693
+ if (typeof sbz_info != 'undefined') sbz_info.set_account_1 = util/* default */.A.Date.now();
11669
11694
  let outmask = await this.store.init(id, mask);
11695
+ if (typeof sbz_info != 'undefined') sbz_info.set_account_2 = util/* default */.A.Date.now();
11670
11696
  util/* default */.A.setTimeout(() => window.postMessage({
11671
11697
  type: 'widget_loaded',
11672
11698
  account_id: id
@@ -11679,6 +11705,7 @@ class lib_Widget {
11679
11705
  util/* default */.A.clearInterval(clean);
11680
11706
  }, 1000);
11681
11707
  this.domGate.open();
11708
+ if (typeof sbz_info != 'undefined') sbz_info.set_account_done = util/* default */.A.Date.now();
11682
11709
  cb && cb(outmask);
11683
11710
  return outmask;
11684
11711
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@subiz/widget-v4",
3
- "version": "4.1.168",
3
+ "version": "4.1.169",
4
4
  "main": "./compiled_src/lib.js",
5
5
  "scripts": {
6
6
  "dev": "npx webpack serve --config webpack.dev.js",
@@ -21,15 +21,15 @@
21
21
  "preact": "10.19.3"
22
22
  },
23
23
  "devDependencies": {
24
- "@babel/cli": "^7.28.0",
25
- "@babel/core": "^7.28.0",
24
+ "@babel/cli": "^7.28.3",
25
+ "@babel/core": "^7.28.3",
26
26
  "@babel/plugin-proposal-class-properties": "^7.18.6",
27
27
  "@babel/plugin-transform-react-jsx": "^7.27.1",
28
- "@babel/preset-env": "^7.28.0",
28
+ "@babel/preset-env": "^7.28.3",
29
29
  "babel-loader": "^10.0.0",
30
30
  "babel-plugin-syntax-jsx": "^6.18.0",
31
- "html-webpack-plugin": "^5.6.3",
32
- "puppeteer": "^24.16.1",
31
+ "html-webpack-plugin": "^5.6.4",
32
+ "puppeteer": "^24.16.2",
33
33
  "webpack": "^5.101.1",
34
34
  "webpack-bundle-analyzer": "^4.10.2",
35
35
  "webpack-cli": "^6.0.1",
package/src/lib.js CHANGED
@@ -120,7 +120,9 @@ class Widget {
120
120
  if (typeof sbz_info != 'undefined') sbz_info.set_account = sb.Date.now()
121
121
 
122
122
  if (!id) return {error: 'empty_account_id'} // do nothing
123
+ if (typeof sbz_info != 'undefined') sbz_info.set_account_1 = sb.Date.now()
123
124
  let outmask = await this.store.init(id, mask)
125
+ if (typeof sbz_info != 'undefined') sbz_info.set_account_2 = sb.Date.now()
124
126
  sb.setTimeout(() => window.postMessage({type: 'widget_loaded', account_id: id}, '*'), 0) // send to chrome extension
125
127
  // add container to client site
126
128
  if (!$container) $container = document.body || document
package/src/store/api.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import sb from '../util/index.js'
2
2
  const ajax = require('@subiz/ajax/src/ajax.js')
3
- ajax.env.XMLHttpRequest = sb.XMLHttpRequest
4
3
 
5
4
  function jsonifyTextPlain(param, done) {
6
5
  let req = param.request
@@ -1,7 +1,6 @@
1
1
  import sb from '../util/index.js'
2
2
 
3
3
  const ajax = require('@subiz/ajax/src/ajax.js')
4
- ajax.env.XMLHttpRequest = window.XMLHttpRequest
5
4
 
6
5
  function jsonifyTextPlain(param, done) {
7
6
  let req = param.request
@@ -1,4 +1,5 @@
1
1
  var op = require('./op.js')
2
+ const ajax = require('@subiz/ajax/src/ajax.js')
2
3
 
3
4
  /**
4
5
  * Converts an RGB color value to HSL. Conversion formula
@@ -231,6 +232,33 @@ export var clearInterval = f.contentWindow.clearInterval.bind(f.contentWindow)
231
232
  export var clearTimeout = f.contentWindow.clearTimeout.bind(f.contentWindow)
232
233
  export var XMLHttpRequest = f.contentWindow.XMLHttpRequest
233
234
 
235
+ const _originalOpen = XMLHttpRequest.prototype.open
236
+ const _originalSend = XMLHttpRequest.prototype.send
237
+ XMLHttpRequest.prototype.open = function (method, url, async, user, password) {
238
+ this._url = url // store URL for logging
239
+ return _originalOpen.apply(this, arguments)
240
+ }
241
+
242
+ XMLHttpRequest.prototype.send = function (body) {
243
+ let old = this.onreadystatechange
244
+ this.onreadystatechange = function (a, b, c) {
245
+ if (this.readyState != 4) return
246
+ // request completed
247
+ if (this.status >= 400 || this.status == 0) {
248
+ if (typeof sbz_logs == 'object')
249
+ sbz_logs.push({
250
+ type: 'xhrfailed',
251
+ url: this._url,
252
+ status: this.status,
253
+ response: this.responseText,
254
+ })
255
+ }
256
+ old(a, b, c)
257
+ }
258
+ return _originalSend.apply(this, arguments)
259
+ }
260
+ ajax.env.XMLHttpRequest = XMLHttpRequest
261
+
234
262
  // convoOfEv extracts the ID of the conversation
235
263
  // that event is sent to
236
264
  export function convoOfEv(ev) {