@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.
- package/compiled_src/lib.js +4 -2
- package/compiled_src/plugin.js +2 -0
- package/compiled_src/store/api.js +0 -1
- package/compiled_src/store/api_fake.js +0 -1
- package/compiled_src/util/common.js +24 -0
- package/dist/198a92fcacc.app.js +1 -0
- package/dist/{198a731cfbb.chat.html → 198a92fcacc.chat.html} +1 -1
- package/dist/{198a731cfbb.library.js → 198a92fcacc.chat.js} +1 -1
- package/dist/{198a731cfbb.form.html → 198a92fcacc.form.html} +1 -1
- package/dist/198a92fcacc.form.js +1 -0
- package/dist/{198a731cfbb.index.html → 198a92fcacc.index.html} +3 -2
- package/dist/{198a731cfbb.library.html → 198a92fcacc.library.html} +3 -2
- package/dist/198a92fcacc.library.js +1 -0
- package/dist/{198a731cfbb.preview.html → 198a92fcacc.preview.html} +1 -1
- package/dist/198a92fcacc.preview.js +1 -0
- package/dist/198a92fcacc.webview.js +1 -0
- package/dist/HASH +1 -1
- package/dist/screenshoot.js +29 -2
- package/inject.js +4 -3
- package/package.json +6 -6
- package/src/lib.js +4 -2
- package/src/plugin.js +3 -1
- package/src/store/api.js +0 -1
- package/src/store/api_fake.js +0 -1
- package/src/util/common.js +28 -0
- package/dist/198a731cfbb.app.js +0 -1
- package/dist/198a731cfbb.chat.js +0 -1
- package/dist/198a731cfbb.form.js +0 -1
- package/dist/198a731cfbb.preview.js +0 -1
- package/dist/198a731cfbb.webview.js +0 -1
- /package/dist/{198a731cfbb.127.js → 198a92fcacc.127.js} +0 -0
- /package/dist/{198a731cfbb.132.js → 198a92fcacc.132.js} +0 -0
- /package/dist/{198a731cfbb.185.js → 198a92fcacc.185.js} +0 -0
- /package/dist/{198a731cfbb.27.js → 198a92fcacc.27.js} +0 -0
- /package/dist/{198a731cfbb.278.js → 198a92fcacc.278.js} +0 -0
- /package/dist/{198a731cfbb.339.js → 198a92fcacc.339.js} +0 -0
- /package/dist/{198a731cfbb.459.js → 198a92fcacc.459.js} +0 -0
- /package/dist/{198a731cfbb.490.js → 198a92fcacc.490.js} +0 -0
- /package/dist/{198a731cfbb.74.js → 198a92fcacc.74.js} +0 -0
- /package/dist/{198a731cfbb.997.js → 198a92fcacc.997.js} +0 -0
package/dist/HASH
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
198a92fcacc
|
package/dist/screenshoot.js
CHANGED
|
@@ -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/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.
|
|
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.
|
|
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",
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
"preact": "10.19.3"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@babel/cli": "^7.28.
|
|
25
|
-
"@babel/core": "^7.28.
|
|
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.
|
|
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.
|
|
32
|
-
"puppeteer": "^24.16.
|
|
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
|
|
@@ -253,12 +255,12 @@ class Widget {
|
|
|
253
255
|
// view could be: chat, list, offline_form
|
|
254
256
|
async showWidget(view, cid) {
|
|
255
257
|
await this.domGate.entry()
|
|
256
|
-
this.pluginMgr.showCurrentChatbox({view, cid: cid})
|
|
258
|
+
return this.pluginMgr.showCurrentChatbox({view, cid: cid})
|
|
257
259
|
}
|
|
258
260
|
|
|
259
261
|
async showTyping() {
|
|
260
262
|
await this.domGate.entry()
|
|
261
|
-
this.pluginMgr.showCurrentChatboxTyping()
|
|
263
|
+
return this.pluginMgr.showCurrentChatboxTyping()
|
|
262
264
|
}
|
|
263
265
|
|
|
264
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'
|
|
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
|
|
package/src/store/api.js
CHANGED
package/src/store/api_fake.js
CHANGED
package/src/util/common.js
CHANGED
|
@@ -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) {
|