@subiz/widget-v4 4.1.122 → 4.1.124
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/assets/less/form.less +1 -1
- package/assets/less/message.less +7 -0
- package/assets/less/widget_header.less +5 -3
- package/compiled_src/chatbox/Event.js +15 -11
- package/compiled_src/chatbox/TextMessage.js +6 -2
- package/compiled_src/chatbox/Widget.js +4 -6
- package/compiled_src/plugin.js +1 -0
- package/compiled_src/store/api.js +5 -2
- package/compiled_src/store/api_fake.js +0 -1
- package/compiled_src/store/chain.js +228 -0
- package/compiled_src/store/inmem_localstorage.js +33 -0
- package/compiled_src/store/kv.js +86 -0
- package/compiled_src/store/lsdb.js +68 -0
- package/compiled_src/store/store.js +27 -20
- package/dist/132.js +6433 -2574
- package/dist/178.js +406 -0
- package/dist/18a02a9c54e.132.js +1 -0
- package/dist/18a02a9c54e.178.js +1 -0
- package/dist/18a02a9c54e.213.js +1 -0
- package/dist/18a02a9c54e.335.js +1 -0
- package/dist/18a02a9c54e.362.js +1 -0
- package/dist/18a02a9c54e.441.js +1 -0
- package/dist/18a02a9c54e.605.js +1 -0
- package/dist/18a02a9c54e.678.js +1 -0
- package/dist/18a02a9c54e.782.js +1 -0
- package/dist/18a02a9c54e.app.js +1 -0
- package/dist/{19643345ab6.index.html → 18a02a9c54e.index.html} +4 -28
- package/dist/{19643345ab6.library.html → 18a02a9c54e.library.html} +4 -28
- package/dist/18a02a9c54e.library.js +1 -0
- package/dist/{19643345ab6.preview.html → 18a02a9c54e.preview.html} +1 -1
- package/dist/18a02a9c54e.preview.js +1 -0
- package/dist/18a02a9c54e.screenshoot.js +1 -0
- package/dist/18a02a9c54e.webview.js +1 -0
- package/dist/213.js +2780 -0
- package/dist/{74.js → 335.js} +35 -35
- package/dist/362.js +107 -0
- package/dist/441.js +2855 -0
- package/dist/{490.js → 605.js} +82 -82
- package/dist/{997.js → 678.js} +6 -6
- package/dist/782.js +107 -0
- package/dist/HASH +1 -1
- package/dist/assets/img/{subiz-mono.8fbc067.svg → subiz-mono.877e9f5.svg} +1 -1
- package/dist/malicious-app.js +4 -6
- package/dist/screenshoot.html +1 -1
- package/dist/screenshoot.js +4849 -9583
- package/package.json +1 -2
- package/src/chatbox/Event.js +5 -3
- package/src/chatbox/TextMessage.js +6 -2
- package/src/chatbox/Widget.js +3 -4
- package/src/chatbox/main.js +1 -0
- package/src/plugin.js +2 -0
- package/src/store/api.js +5 -2
- package/src/store/api_fake.js +0 -1
- package/src/store/chain.js +255 -0
- package/src/store/inmem_localstorage.js +40 -0
- package/src/store/kv.js +103 -0
- package/src/store/lsdb.js +74 -0
- package/src/store/store.js +27 -22
- package/dist/127.js +0 -273
- package/dist/185.js +0 -1885
- package/dist/19643345ab6.127.js +0 -1
- package/dist/19643345ab6.132.js +0 -1
- package/dist/19643345ab6.185.js +0 -1
- package/dist/19643345ab6.27.js +0 -1
- package/dist/19643345ab6.278.js +0 -1
- package/dist/19643345ab6.459.js +0 -1
- package/dist/19643345ab6.490.js +0 -1
- package/dist/19643345ab6.74.js +0 -1
- package/dist/19643345ab6.997.js +0 -1
- package/dist/19643345ab6.app.js +0 -1
- package/dist/19643345ab6.library.js +0 -1
- package/dist/19643345ab6.preview.js +0 -1
- package/dist/19643345ab6.webview.js +0 -1
- package/dist/27.js +0 -107
- package/dist/278.js +0 -406
- package/dist/459.js +0 -107
|
@@ -5,8 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _index = _interopRequireDefault(require("../util/index.js"));
|
|
8
|
-
var _storage = _interopRequireDefault(require("@subiz/storage"));
|
|
9
8
|
var _api = _interopRequireDefault(require("./api.js"));
|
|
9
|
+
var _lsdb = _interopRequireDefault(require("./lsdb.js"));
|
|
10
|
+
var _chain = _interopRequireDefault(require("./chain.js"));
|
|
11
|
+
var _kv = _interopRequireDefault(require("./kv.js"));
|
|
10
12
|
var _api_fake = _interopRequireDefault(require("./api_fake.js"));
|
|
11
13
|
var _realtime_fake = _interopRequireDefault(require("./realtime_fake.js"));
|
|
12
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -205,9 +207,9 @@ class Store {
|
|
|
205
207
|
}
|
|
206
208
|
cleanLocalStorage();
|
|
207
209
|
this.pubsub = new _index.default.Pubsub();
|
|
208
|
-
this.kv = new
|
|
209
|
-
this.cache = new
|
|
210
|
-
this.chain = new
|
|
210
|
+
this.kv = new _kv.default(new _lsdb.default('sbz2023', this.inmem), 'kv');
|
|
211
|
+
this.cache = new _kv.default(new _lsdb.default('sbz2023', true), 'kv');
|
|
212
|
+
this.chain = new _chain.default(new _lsdb.default('cbz2023', true), 'ch');
|
|
211
213
|
this.getLocaleContent = this.api.getLocaleContent;
|
|
212
214
|
this.g_haveSentSeenM = {};
|
|
213
215
|
this.last_focused = _index.default.Date.now();
|
|
@@ -306,13 +308,11 @@ class Store {
|
|
|
306
308
|
async overrideAcc(acc) {
|
|
307
309
|
this.forceAcc = _index.default.cloneDeep(acc);
|
|
308
310
|
await this.readyGate.entry();
|
|
309
|
-
this.disconnect('account');
|
|
310
311
|
this.reconnect();
|
|
311
312
|
}
|
|
312
313
|
async overrideChatbox(chatbox) {
|
|
313
314
|
this.forceChatbox = chatbox;
|
|
314
315
|
await this.readyGate.entry();
|
|
315
|
-
this.disconnect('account');
|
|
316
316
|
await this.reconnect();
|
|
317
317
|
_index.default.setTimeout(this.pubsub.publish('resetCSS'), 10);
|
|
318
318
|
}
|
|
@@ -435,9 +435,14 @@ class Store {
|
|
|
435
435
|
user_mask: mask
|
|
436
436
|
}, xhrsend);
|
|
437
437
|
this.realtime.onEvent(this.onWs.bind(this));
|
|
438
|
-
this.realtime.onInterrupted(() =>
|
|
438
|
+
this.realtime.onInterrupted(async () => {
|
|
439
|
+
await this.reconnectWs(accid, user.id);
|
|
440
|
+
this.reconnect();
|
|
441
|
+
});
|
|
439
442
|
this.seenLoop();
|
|
440
|
-
await this.reconnect(
|
|
443
|
+
await this.reconnect({
|
|
444
|
+
user: user
|
|
445
|
+
});
|
|
441
446
|
this.readyGate.open();
|
|
442
447
|
this.reconnectWs(accid, user.id);
|
|
443
448
|
return user;
|
|
@@ -460,7 +465,10 @@ class Store {
|
|
|
460
465
|
getAccessToken: () => this.api.token_generator()
|
|
461
466
|
});
|
|
462
467
|
this.realtime.onEvent(this.onWs.bind(this));
|
|
463
|
-
this.realtime.onInterrupted(() =>
|
|
468
|
+
this.realtime.onInterrupted(async () => {
|
|
469
|
+
await this.reconnectWs(accid, user.id);
|
|
470
|
+
this.reconnect();
|
|
471
|
+
});
|
|
464
472
|
this.seenLoop();
|
|
465
473
|
await this.reconnect();
|
|
466
474
|
this.readyGate.open();
|
|
@@ -516,20 +524,20 @@ class Store {
|
|
|
516
524
|
}, 1000);
|
|
517
525
|
}
|
|
518
526
|
async reconnectWs(accid, userid) {
|
|
519
|
-
await this.realtime.subscribe([`conversation_state_updated.account.${accid}.user.${userid}`, `conversation_joined.account.${accid}.user.${userid}`, `conversation_typing.account.${accid}.user.${userid}`, `message_sent.account.${accid}.user.${userid}`, `
|
|
527
|
+
await this.realtime.subscribe([`conversation_state_updated.account.${accid}.user.${userid}`, `conversation_joined.account.${accid}.user.${userid}`, `conversation_typing.account.${accid}.user.${userid}`, `message_sent.account.${accid}.user.${userid}`, `message_pong.account.${accid}.user.${userid}`, `conversation_rating_requested.account.${accid}.user.${userid}`, `conversation_rated.account.${accid}.user.${userid}`]);
|
|
520
528
|
await this.readyGate.entry();
|
|
521
|
-
this.disconnect('account');
|
|
522
|
-
return this.reconnect();
|
|
523
529
|
}
|
|
524
|
-
async reconnect() {
|
|
530
|
+
async reconnect(p) {
|
|
525
531
|
if (this._die) return;
|
|
526
532
|
await this.reconnectGate.entry(undefined, true);
|
|
527
|
-
if (this.isInsync('account')) return this.reconnectGate.open();
|
|
528
533
|
this.markSync('account');
|
|
529
|
-
let
|
|
534
|
+
let fetchuser = p && p.user ? Promise.resolve({
|
|
535
|
+
body: p.user
|
|
536
|
+
}) : this.api.getUser();
|
|
537
|
+
let outs = await Promise.all([fetchuser, this.api.getAccountSetting()]);
|
|
530
538
|
let error = _index.default.find(outs, out => out.error);
|
|
531
539
|
if (error) return console.error(error);
|
|
532
|
-
let set =
|
|
540
|
+
let set = outs[1].body;
|
|
533
541
|
set.user = outs[0].body;
|
|
534
542
|
await this._setSetting(set);
|
|
535
543
|
let convob = await this.api.listConversations();
|
|
@@ -653,6 +661,7 @@ class Store {
|
|
|
653
661
|
if (!ev || !ev.type) return;
|
|
654
662
|
ev.created = _index.default.getMs(ev.created);
|
|
655
663
|
if (ev.type === 'user_info_updated') {
|
|
664
|
+
return;
|
|
656
665
|
let user = _index.default.cloneDeep(this.cache.match('user'));
|
|
657
666
|
let attrs = _index.default.get(ev, 'data.user.attributes') || [];
|
|
658
667
|
_index.default.map(attrs, attr => _index.default.setUserAttr(user, attr));
|
|
@@ -677,8 +686,6 @@ class Store {
|
|
|
677
686
|
}
|
|
678
687
|
}
|
|
679
688
|
if (!convo) return;
|
|
680
|
-
let channel = _index.default.get(ev, 'touchpoint.channel', '');
|
|
681
|
-
if (channel && channel != 'subiz') return;
|
|
682
689
|
this.pubsub.publish('events', ev);
|
|
683
690
|
if (ev.type === 'conversation_joined') {
|
|
684
691
|
let members = _index.default.get(ev, 'data.conversation.members', []);
|
|
@@ -1035,9 +1042,9 @@ class Store {
|
|
|
1035
1042
|
if ((k || '').startsWith('__sb')) this.cookie.remove(k);
|
|
1036
1043
|
});
|
|
1037
1044
|
this.kv.destroy();
|
|
1038
|
-
this.kv = new
|
|
1045
|
+
this.kv = new _kv.default(new _lsdb.default('sbz2023', this.inmem), 'kv');
|
|
1039
1046
|
this.chain.destroy();
|
|
1040
|
-
this.chain = new
|
|
1047
|
+
this.chain = new _chain.default(new _lsdb.default('cbz2023', true), 'ch');
|
|
1041
1048
|
}
|
|
1042
1049
|
destroy() {
|
|
1043
1050
|
this._die = true;
|