@subiz/widget-v4 4.1.49 → 4.1.52
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/chatbox/VideoAttachments.js +1 -2
- package/compiled_src/lib.js +8 -0
- package/compiled_src/plugin.js +2 -1
- package/package.json +11 -12
- package/src/chatbox/VideoAttachments.js +11 -9
- package/src/lib.js +3 -0
- package/src/plugin.js +2 -1
|
@@ -31,8 +31,7 @@ class VideoAttachments extends _common.Com {
|
|
|
31
31
|
height: "",
|
|
32
32
|
poster: this.props.store.replaceFileUrl(video.thumbnail_url),
|
|
33
33
|
controls: "controls",
|
|
34
|
-
preload: "metadata"
|
|
35
|
-
onclick: "this.play()"
|
|
34
|
+
preload: "metadata"
|
|
36
35
|
}));
|
|
37
36
|
});
|
|
38
37
|
return (0, _preact.h)("div", {
|
package/compiled_src/lib.js
CHANGED
|
@@ -60,6 +60,10 @@ class Widget {
|
|
|
60
60
|
let accid = param.account_id;
|
|
61
61
|
let ref = param.ref;
|
|
62
62
|
let user = await this.store.init(accid, undefined, ref);
|
|
63
|
+
_index.default.setTimeout(() => window.postMessage({
|
|
64
|
+
type: 'widget_loaded',
|
|
65
|
+
account_id: accid
|
|
66
|
+
}, '*'), 0);
|
|
63
67
|
if (!$container) $container = document.body || document;
|
|
64
68
|
this.pluginMgr = new _plugin.default(this, $container);
|
|
65
69
|
let clean = _index.default.setInterval(() => {
|
|
@@ -72,6 +76,10 @@ class Widget {
|
|
|
72
76
|
}
|
|
73
77
|
async setAccount(id, $container, mask, cb) {
|
|
74
78
|
let outmask = await this.store.init(id, mask);
|
|
79
|
+
_index.default.setTimeout(() => window.postMessage({
|
|
80
|
+
type: 'widget_loaded',
|
|
81
|
+
account_id: id
|
|
82
|
+
}, '*'), 0);
|
|
75
83
|
if (!$container) $container = document.body || document;
|
|
76
84
|
this.pluginMgr = new _plugin.default(this, $container);
|
|
77
85
|
let clean = _index.default.setInterval(() => {
|
package/compiled_src/plugin.js
CHANGED
|
@@ -18,7 +18,9 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
18
18
|
if (!$container) throw '$div must is a valid html node';
|
|
19
19
|
var $div = document.createElement('div');
|
|
20
20
|
$div.id = plugin.id;
|
|
21
|
+
let acc = store.matchAccount();
|
|
21
22
|
$div.setAttribute('sbz-plugin-type', plugin.type);
|
|
23
|
+
$div.setAttribute('sbz-plugin-account-id', acc.id);
|
|
22
24
|
$container.appendChild($div);
|
|
23
25
|
let _locale = common.getLocale(plugin, _index.default.detectLang());
|
|
24
26
|
var domGate = new _index.default.Gate();
|
|
@@ -131,7 +133,6 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
131
133
|
let message = _index.default.find(messages, message => message.key === key);
|
|
132
134
|
return _index.default.get(message, 'message', key);
|
|
133
135
|
};
|
|
134
|
-
let acc = store.matchAccount();
|
|
135
136
|
t.i18n = i18nText => {
|
|
136
137
|
if (!i18nText) return '';
|
|
137
138
|
let fallbackLocale = plugin.locale || acc.locale || 'vi-VN';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@subiz/widget-v4",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.52",
|
|
4
4
|
"main": "./compiled_src/lib.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "npx webpack serve --config webpack.dev.js",
|
|
@@ -12,28 +12,27 @@
|
|
|
12
12
|
"@subiz/ajax": "^3.0.12",
|
|
13
13
|
"@subiz/flow": "^1.1.0",
|
|
14
14
|
"@subiz/storage": "0.0.8",
|
|
15
|
-
"@subiz/wsclient": "^4.0.
|
|
15
|
+
"@subiz/wsclient": "^4.0.18",
|
|
16
16
|
"cookie_js": "1.4.2",
|
|
17
|
-
"core-js": "^3.
|
|
17
|
+
"core-js": "^3.34.0",
|
|
18
18
|
"css-loader": "5.2.7",
|
|
19
19
|
"file-loader": "^6.2.0",
|
|
20
20
|
"less": "^4.2.0",
|
|
21
21
|
"less-loader": "^11.1.3",
|
|
22
|
-
"preact": "^10.
|
|
22
|
+
"preact": "^10.19.2"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@babel/cli": "^7.23.
|
|
26
|
-
"@babel/core": "^7.23.
|
|
25
|
+
"@babel/cli": "^7.23.4",
|
|
26
|
+
"@babel/core": "^7.23.5",
|
|
27
27
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
28
|
-
"@babel/plugin-transform-react-jsx": "^7.
|
|
29
|
-
"@babel/preset-env": "^7.23.
|
|
28
|
+
"@babel/plugin-transform-react-jsx": "^7.23.4",
|
|
29
|
+
"@babel/preset-env": "^7.23.5",
|
|
30
30
|
"babel-loader": "^9.1.3",
|
|
31
31
|
"babel-plugin-syntax-jsx": "^6.18.0",
|
|
32
32
|
"html-webpack-plugin": "^5.5.3",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"webpack": "^
|
|
36
|
-
"webpack-bundle-analyzer": "^4.9.1",
|
|
33
|
+
"puppeteer": "^21.6.0",
|
|
34
|
+
"webpack": "^5.89.0",
|
|
35
|
+
"webpack-bundle-analyzer": "^4.10.1",
|
|
37
36
|
"webpack-cli": "^5.1.4",
|
|
38
37
|
"webpack-dev-server": "^4.15.1"
|
|
39
38
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import sb from '../util/index.js'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import {Com} from '../common.js'
|
|
3
|
+
import {h} from 'preact'
|
|
4
4
|
|
|
5
5
|
export default class VideoAttachments extends Com {
|
|
6
6
|
constructor(props) {
|
|
7
7
|
super(props)
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
render
|
|
10
|
+
render() {
|
|
11
11
|
let byType = sb.get(this.props.ev, 'by.type')
|
|
12
12
|
var attachments = sb.get(this.props.ev, 'data.message.attachments', [])
|
|
13
13
|
var videos = []
|
|
@@ -22,14 +22,16 @@ export default class VideoAttachments extends Com {
|
|
|
22
22
|
return (
|
|
23
23
|
<div class={`video-attachment video-attachment--${byType}`}>
|
|
24
24
|
<video
|
|
25
|
-
class=
|
|
25
|
+
class='video-attachment__video'
|
|
26
26
|
src={this.props.store.replaceFileUrl(video.url)}
|
|
27
|
-
width=
|
|
28
|
-
height=
|
|
27
|
+
width='100%'
|
|
28
|
+
height=''
|
|
29
29
|
poster={this.props.store.replaceFileUrl(video.thumbnail_url)}
|
|
30
|
-
controls=
|
|
31
|
-
preload=
|
|
32
|
-
onclick
|
|
30
|
+
controls='controls'
|
|
31
|
+
preload='metadata'
|
|
32
|
+
// remove onclick because preact build error
|
|
33
|
+
//onclick="this.play()"
|
|
34
|
+
></video>
|
|
33
35
|
</div>
|
|
34
36
|
)
|
|
35
37
|
})
|
package/src/lib.js
CHANGED
|
@@ -54,6 +54,8 @@ class Widget {
|
|
|
54
54
|
let ref = param.ref
|
|
55
55
|
|
|
56
56
|
let user = await this.store.init(accid, undefined, ref)
|
|
57
|
+
sb.setTimeout(() => window.postMessage({type: 'widget_loaded', account_id: accid}, '*'), 0) // send to chrome extension
|
|
58
|
+
|
|
57
59
|
// add container to client site
|
|
58
60
|
if (!$container) $container = document.body || document
|
|
59
61
|
this.pluginMgr = new PluginMgr(this, $container)
|
|
@@ -70,6 +72,7 @@ class Widget {
|
|
|
70
72
|
|
|
71
73
|
async setAccount(id, $container, mask, cb) {
|
|
72
74
|
let outmask = await this.store.init(id, mask)
|
|
75
|
+
sb.setTimeout(() => window.postMessage({type: 'widget_loaded', account_id: id}, '*'), 0) // send to chrome extension
|
|
73
76
|
// add container to client site
|
|
74
77
|
if (!$container) $container = document.body || document
|
|
75
78
|
this.pluginMgr = new PluginMgr(this, $container)
|
package/src/plugin.js
CHANGED
|
@@ -11,7 +11,9 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
11
11
|
if (!$container) throw '$div must is a valid html node'
|
|
12
12
|
var $div = document.createElement('div')
|
|
13
13
|
$div.id = plugin.id
|
|
14
|
+
let acc = store.matchAccount()
|
|
14
15
|
$div.setAttribute('sbz-plugin-type', plugin.type)
|
|
16
|
+
$div.setAttribute('sbz-plugin-account-id', acc.id)
|
|
15
17
|
$container.appendChild($div) // use body as container
|
|
16
18
|
|
|
17
19
|
// auto detect language first
|
|
@@ -142,7 +144,6 @@ function Plugin(plugin, store, $container, lib) {
|
|
|
142
144
|
return sb.get(message, 'message', key)
|
|
143
145
|
}
|
|
144
146
|
|
|
145
|
-
let acc = store.matchAccount()
|
|
146
147
|
t.i18n = (i18nText) => {
|
|
147
148
|
if (!i18nText) return ''
|
|
148
149
|
let fallbackLocale = plugin.locale || acc.locale || 'vi-VN'
|