@subiz/widget-v4 4.1.206 → 4.1.207
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/chatbox.less +1 -0
- package/assets/less/widget.less +2 -2
- package/compiled_src/chatbox/main.js +11 -6
- package/compiled_src/util/common.js +2 -0
- package/compiled_src/util/common.test.js +8 -0
- package/dist/app.js +1406 -0
- package/dist/chat.html +10 -0
- package/dist/chat.js +1395 -0
- package/dist/form.html +10 -0
- package/dist/form.js +609 -0
- package/dist/index.html +90 -0
- package/dist/inject.html +20 -0
- package/dist/inject.js +1395 -0
- package/dist/library.html +90 -0
- package/dist/library.js +1385 -0
- package/dist/order.html +32 -0
- package/dist/order.js +810 -0
- package/dist/preview.html +784 -0
- package/dist/preview.js +1455 -0
- package/dist/screenshoot.html +10 -2
- package/dist/screenshoot.js +742 -12837
- package/dist/src_chatbox_OrderAttachments_js.js +22 -0
- package/dist/src_chatbox_Order_js.js +206 -0
- package/dist/src_chatbox_css_js.js +306 -0
- package/dist/src_contact_contact_js.js +22 -0
- package/dist/src_contact_css_js.js +32 -0
- package/dist/src_form_css_js.js +32 -0
- package/dist/src_notif_css_js.js +32 -0
- package/dist/src_notif_notif_js.js +22 -0
- package/dist/src_popup_css_js.js +32 -0
- package/dist/src_popup_popup_js.js +84 -0
- package/dist/webview.js +1406 -0
- package/package.json +7 -7
- package/src/chatbox/main.js +16 -8
- package/src/util/common.js +2 -0
- package/src/util/common.test.js +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@subiz/widget-v4",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.207",
|
|
4
4
|
"main": "./compiled_src/lib.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "npx webpack serve --config webpack.dev.js",
|
|
@@ -21,19 +21,19 @@
|
|
|
21
21
|
"preact": "10.19.3"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@babel/cli": "^7.28.
|
|
25
|
-
"@babel/core": "^7.29.
|
|
24
|
+
"@babel/cli": "^7.28.7",
|
|
25
|
+
"@babel/core": "^7.29.7",
|
|
26
26
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
27
|
-
"@babel/plugin-transform-react-jsx": "^7.28.
|
|
28
|
-
"@babel/preset-env": "^7.29.
|
|
27
|
+
"@babel/plugin-transform-react-jsx": "^7.28.7",
|
|
28
|
+
"@babel/preset-env": "^7.29.7",
|
|
29
29
|
"babel-loader": "^10.1.1",
|
|
30
30
|
"babel-plugin-syntax-jsx": "^6.18.0",
|
|
31
31
|
"html-webpack-plugin": "^5.6.8",
|
|
32
32
|
"puppeteer": "^25.9.0",
|
|
33
33
|
"tape": "^5.10.2",
|
|
34
|
-
"webpack": "^5.110.
|
|
34
|
+
"webpack": "^5.110.3",
|
|
35
35
|
"webpack-bundle-analyzer": "^5.3.2",
|
|
36
|
-
"webpack-cli": "^7.2.
|
|
36
|
+
"webpack-cli": "^7.2.3",
|
|
37
37
|
"webpack-dev-server": "^6.0.0"
|
|
38
38
|
}
|
|
39
39
|
}
|
package/src/chatbox/main.js
CHANGED
|
@@ -66,7 +66,9 @@ export default class Main extends Com {
|
|
|
66
66
|
this.refreshCSS()
|
|
67
67
|
|
|
68
68
|
let lastview = this.props.store.matchLastview() || {}
|
|
69
|
-
|
|
69
|
+
// Only validate a saved cid when restoring an opened widget.
|
|
70
|
+
// Mobile init may downgrade a saved widget state to preview while keeping stale opts.
|
|
71
|
+
let cid = sb.get(lastview, 'screen') === 'widget' ? sb.get(lastview, 'opts.cid') : ''
|
|
70
72
|
if (cid) {
|
|
71
73
|
this._last_cid = cid
|
|
72
74
|
this.setState({changing: true}, () => {
|
|
@@ -177,11 +179,15 @@ export default class Main extends Com {
|
|
|
177
179
|
}
|
|
178
180
|
|
|
179
181
|
onNewMessageShowWidget(cid) {
|
|
180
|
-
if (this.props.store.isMobile()) modifyViewport()
|
|
182
|
+
if (this.props.store.isMobile()) modifyViewport(this.shouldLockPageScroll())
|
|
181
183
|
this.props.store.updateLastview({screen: 'widget', previewEvent: {}, view: 'chat', opts: {cid}})
|
|
182
184
|
this.forceUpdate()
|
|
183
185
|
}
|
|
184
186
|
|
|
187
|
+
shouldLockPageScroll() {
|
|
188
|
+
return sb.get(this.props.plugin, 'chatbox.mobile_height') === undefined
|
|
189
|
+
}
|
|
190
|
+
|
|
185
191
|
async showWidget(p) {
|
|
186
192
|
//this.refButton.current && this.refButton.current.ClearPreview()
|
|
187
193
|
|
|
@@ -196,7 +202,7 @@ export default class Main extends Com {
|
|
|
196
202
|
newView.opts = {cid}
|
|
197
203
|
}
|
|
198
204
|
|
|
199
|
-
if (this.props.store.isMobile()) modifyViewport()
|
|
205
|
+
if (this.props.store.isMobile()) modifyViewport(this.shouldLockPageScroll())
|
|
200
206
|
this.props.store.updateLastview(newView)
|
|
201
207
|
this.forceUpdate()
|
|
202
208
|
}
|
|
@@ -248,11 +254,13 @@ function restoreViewport() {
|
|
|
248
254
|
if (metatag) metatag.remove()
|
|
249
255
|
}
|
|
250
256
|
|
|
251
|
-
function modifyViewport() {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
document.documentElement.classList
|
|
257
|
+
function modifyViewport(lockPageScroll) {
|
|
258
|
+
if (lockPageScroll) {
|
|
259
|
+
// dont allow to scroll background document
|
|
260
|
+
if (document.body && document.body.classList) document.body.classList.add('sbz_no_scroll')
|
|
261
|
+
if (document.documentElement && document.documentElement.classList)
|
|
262
|
+
document.documentElement.classList.add('sbz_no_scroll')
|
|
263
|
+
}
|
|
256
264
|
|
|
257
265
|
let currentMetas = document.querySelectorAll('meta[name="viewport"]')
|
|
258
266
|
let shouldAddMetaTag = true
|
package/src/util/common.js
CHANGED
|
@@ -682,6 +682,7 @@ export function replaceCssVariable(css, setting) {
|
|
|
682
682
|
//tokens = tokenize(tokens, "'@mobile_button.background_mask_url'")
|
|
683
683
|
tokens = tokenize(tokens, "'@mobile_button.margin_x'")
|
|
684
684
|
tokens = tokenize(tokens, "'@mobile_button.margin_y'")
|
|
685
|
+
tokens = tokenize(tokens, "'@mobile_height'")
|
|
685
686
|
tokens = tokenize(tokens, "'@widget_position'")
|
|
686
687
|
tokens = tokenize(tokens, "'@z_index'")
|
|
687
688
|
tokens = tokenize(tokens, "'@z_index_2'")
|
|
@@ -838,6 +839,7 @@ export const DEFVAL = {
|
|
|
838
839
|
margin_x: 0.3,
|
|
839
840
|
margin_y: 0.3,
|
|
840
841
|
},
|
|
842
|
+
mobile_height: '100%',
|
|
841
843
|
widget_position: 'fixed',
|
|
842
844
|
z_index: 2000000000,
|
|
843
845
|
}
|
package/src/util/common.test.js
CHANGED
|
@@ -56,6 +56,13 @@ test('util.randomString', (t) => {
|
|
|
56
56
|
t.end()
|
|
57
57
|
})
|
|
58
58
|
|
|
59
|
+
test('replaceCssVariable mobile height', (t) => {
|
|
60
|
+
let css = "height: '@mobile_height';"
|
|
61
|
+
t.equal(util.replaceCssVariable(css, {}), 'height: 100%;', 'defaults to full mobile height')
|
|
62
|
+
t.equal(util.replaceCssVariable(css, {mobile_height: '50%'}), 'height: 50%;', 'uses configured mobile height')
|
|
63
|
+
t.end()
|
|
64
|
+
})
|
|
65
|
+
|
|
59
66
|
test('convert message event first msg send', (t) => {
|
|
60
67
|
var events = [
|
|
61
68
|
{by: {id: 1}, type: 'message_sent', created: 1100},
|