@subiz/widget-v4 4.1.79 → 4.1.80
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.
|
@@ -29,7 +29,7 @@ class Time extends _common.Com {
|
|
|
29
29
|
if (this.props.ago) {
|
|
30
30
|
if (this.props.short) {}
|
|
31
31
|
if (!t && this.props.time > 0) t = ago(this.props.time, new _index.default.Date().getTime(), this.props.t);
|
|
32
|
-
} else t = _index.default.shortTime(this.props.time, this.props.tzoffset, Date.now(), forceLocale);
|
|
32
|
+
} else t = _index.default.shortTime(this.props.time, this.props.tzoffset, _index.default.Date.now(), forceLocale);
|
|
33
33
|
if (this.props.uppercase) t = t.toUpperCase();
|
|
34
34
|
if (t === this.state.t) return;
|
|
35
35
|
this.setState({
|
|
@@ -145,7 +145,7 @@ class _default {
|
|
|
145
145
|
let outuser;
|
|
146
146
|
for (let i = 0; true; i++) {
|
|
147
147
|
outuser = await ajax.setBaseUrl(this.ApiURL).withCredentials(true).addQuery('v', '6').addQuery('x-user-ref', this.ref).setParser('json').get(`/accounts/${this.accid}/users/${this.ref}`);
|
|
148
|
-
if (outuser.error && _index.default.get(outuser, 'body.code', '').indexOf('locked_account') != -1) break;
|
|
148
|
+
if (outuser.error && _index.default.get(outuser, 'body.error.code', '').indexOf('locked_account') != -1) break;
|
|
149
149
|
if (!_index.default.get(outuser, 'body.id')) {
|
|
150
150
|
let sleeptime = Math.min(2000 + i * 400, 60000);
|
|
151
151
|
await _index.default.sleep(sleeptime);
|
|
@@ -459,9 +459,26 @@ class Store {
|
|
|
459
459
|
if (this.g_haveSentSeenM[lastmsgsent.id]) return;
|
|
460
460
|
if (lastmsgsent.id === lastmsgsent.data.message.idempotency_key) return;
|
|
461
461
|
this.api.markAsSeen(id, lastmsgsent.id);
|
|
462
|
+
this.pubsub.publish('events', {
|
|
463
|
+
created: _index.default.Date.now(),
|
|
464
|
+
type: 'message_pong',
|
|
465
|
+
by: {
|
|
466
|
+
type: 'user'
|
|
467
|
+
},
|
|
468
|
+
data: {
|
|
469
|
+
message: {
|
|
470
|
+
conversation_id: id,
|
|
471
|
+
id: '*',
|
|
472
|
+
pongs: [{
|
|
473
|
+
type: 'seen',
|
|
474
|
+
created: _index.default.Date.now()
|
|
475
|
+
}]
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
});
|
|
462
479
|
let convo = this.cache.match('convo_' + id) || {};
|
|
463
480
|
let mem = _index.default.find(convo.members, m => m.id === user.id);
|
|
464
|
-
if (mem) mem.seen_at = Date.now();
|
|
481
|
+
if (mem) mem.seen_at = _index.default.Date.now();
|
|
465
482
|
this._setConvo(convo);
|
|
466
483
|
this.g_haveSentSeenM[lastmsgsent.id] = true;
|
|
467
484
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@subiz/widget-v4",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.80",
|
|
4
4
|
"main": "./compiled_src/lib.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "npx webpack serve --config webpack.dev.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"lib": "rm -rf compiled_src && npx babel --out-dir=compiled_src src"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@subiz/ajax": "^3.0.
|
|
12
|
+
"@subiz/ajax": "^3.0.16",
|
|
13
13
|
"@subiz/flow": "^1.1.0",
|
|
14
14
|
"@subiz/storage": "0.0.8",
|
|
15
15
|
"@subiz/wsclient": "^4.0.24",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"babel-loader": "^9.1.3",
|
|
31
31
|
"babel-plugin-syntax-jsx": "^6.18.0",
|
|
32
32
|
"html-webpack-plugin": "^5.6.0",
|
|
33
|
-
"puppeteer": "^22.
|
|
34
|
-
"webpack": "^5.
|
|
33
|
+
"puppeteer": "^22.12.0",
|
|
34
|
+
"webpack": "^5.92.1",
|
|
35
35
|
"webpack-bundle-analyzer": "^4.10.2",
|
|
36
36
|
"webpack-cli": "^5.1.4",
|
|
37
37
|
"webpack-dev-server": "^5.0.4"
|
package/src/chatbox/time.js
CHANGED
|
@@ -39,7 +39,7 @@ export default class Time extends Com {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
if (!t && this.props.time > 0) t = ago(this.props.time, new sb.Date().getTime(), this.props.t)
|
|
42
|
-
} else t = sb.shortTime(this.props.time, this.props.tzoffset, Date.now(), forceLocale)
|
|
42
|
+
} else t = sb.shortTime(this.props.time, this.props.tzoffset, sb.Date.now(), forceLocale)
|
|
43
43
|
|
|
44
44
|
if (this.props.uppercase) t = t.toUpperCase()
|
|
45
45
|
|
package/src/store/api.js
CHANGED
|
@@ -63,7 +63,7 @@ export default class {
|
|
|
63
63
|
.addQuery('x-user-ref', this.ref)
|
|
64
64
|
.setParser('json')
|
|
65
65
|
.get(`/accounts/${this.accid}/users/${this.ref}`)
|
|
66
|
-
if (outuser.error && sb.get(outuser, 'body.code', '').indexOf('locked_account') != -1) break
|
|
66
|
+
if (outuser.error && sb.get(outuser, 'body.error.code', '').indexOf('locked_account') != -1) break
|
|
67
67
|
|
|
68
68
|
if (!sb.get(outuser, 'body.id')) {
|
|
69
69
|
let sleeptime = Math.min(2000 + i * 400, 60000)
|
package/src/store/store.js
CHANGED
|
@@ -523,9 +523,23 @@ export default class Store {
|
|
|
523
523
|
// send seen
|
|
524
524
|
this.api.markAsSeen(id, lastmsgsent.id)
|
|
525
525
|
|
|
526
|
+
// fire own event so guest code can update unread number
|
|
527
|
+
this.pubsub.publish('events', {
|
|
528
|
+
created: sb.Date.now(),
|
|
529
|
+
type: 'message_pong',
|
|
530
|
+
by: {type: 'user'},
|
|
531
|
+
data: {
|
|
532
|
+
message: {
|
|
533
|
+
conversation_id: id,
|
|
534
|
+
id: '*',
|
|
535
|
+
pongs: [{type: 'seen', created: sb.Date.now()}],
|
|
536
|
+
},
|
|
537
|
+
},
|
|
538
|
+
})
|
|
539
|
+
|
|
526
540
|
let convo = this.cache.match('convo_' + id) || {}
|
|
527
541
|
let mem = sb.find(convo.members, (m) => m.id === user.id)
|
|
528
|
-
if (mem) mem.seen_at = Date.now()
|
|
542
|
+
if (mem) mem.seen_at = sb.Date.now()
|
|
529
543
|
this._setConvo(convo)
|
|
530
544
|
this.g_haveSentSeenM[lastmsgsent.id] = true
|
|
531
545
|
})
|