@subiz/widget-v4 4.1.100 → 4.1.102
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/img/subiz-mono.svg +1 -1
- package/assets/less/form.less +44 -31
- package/assets/less/widget.less +18 -14
- package/assets/less/widget_header.less +1 -1
- package/compiled_src/chatbox/PoweredBy.js +2 -2
- package/compiled_src/chatbox/Widget.js +27 -19
- package/dist/{191a16d5da3.app.js → 191a179639e.app.js} +1 -1
- package/dist/{191a16d5da3.index.html → 191a179639e.index.html} +1 -1
- package/dist/{191a16d5da3.library.html → 191a179639e.library.html} +1 -1
- package/dist/{191a16d5da3.library.js → 191a179639e.library.js} +1 -1
- package/dist/{191a16d5da3.preview.html → 191a179639e.preview.html} +1 -1
- package/dist/{191a16d5da3.preview.js → 191a179639e.preview.js} +1 -1
- package/dist/{191a16d5da3.webview.js → 191a179639e.webview.js} +1 -1
- package/dist/HASH +1 -1
- package/dist/screenshoot.html +1 -1
- package/package.json +3 -3
- package/src/chatbox/PoweredBy.js +1 -1
- package/src/chatbox/Widget.js +28 -19
- package/webpack.prod.js +0 -7
- package/webpack.screenshoot.js +0 -1
- package/dist/191a16d5da3.screenshoot.js +0 -1
- /package/dist/{191a16d5da3.127.js → 191a179639e.127.js} +0 -0
- /package/dist/{191a16d5da3.132.js → 191a179639e.132.js} +0 -0
- /package/dist/{191a16d5da3.185.js → 191a179639e.185.js} +0 -0
- /package/dist/{191a16d5da3.27.js → 191a179639e.27.js} +0 -0
- /package/dist/{191a16d5da3.278.js → 191a179639e.278.js} +0 -0
- /package/dist/{191a16d5da3.459.js → 191a179639e.459.js} +0 -0
- /package/dist/{191a16d5da3.490.js → 191a179639e.490.js} +0 -0
- /package/dist/{191a16d5da3.74.js → 191a179639e.74.js} +0 -0
- /package/dist/{191a16d5da3.997.js → 191a179639e.997.js} +0 -0
package/dist/HASH
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
191a179639e
|
package/dist/screenshoot.html
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@subiz/widget-v4",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.102",
|
|
4
4
|
"main": "./compiled_src/lib.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "npx webpack serve --config webpack.dev.js",
|
|
@@ -30,10 +30,10 @@
|
|
|
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": "^23.
|
|
33
|
+
"puppeteer": "^23.3.0",
|
|
34
34
|
"webpack": "^5.94.0",
|
|
35
35
|
"webpack-bundle-analyzer": "^4.10.2",
|
|
36
36
|
"webpack-cli": "^5.1.4",
|
|
37
|
-
"webpack-dev-server": "^5.0
|
|
37
|
+
"webpack-dev-server": "^5.1.0"
|
|
38
38
|
}
|
|
39
39
|
}
|
package/src/chatbox/PoweredBy.js
CHANGED
|
@@ -11,7 +11,7 @@ export default function PoweredBy(props) {
|
|
|
11
11
|
return (
|
|
12
12
|
<div class='poweredby'>
|
|
13
13
|
<a href={link} class='poweredby--text' target='_blank' title='Subiz'>
|
|
14
|
-
<img width='
|
|
14
|
+
<img width='17' height='12' class='poweredby--subiz-logo' src={logo} alt='powerred by subiz' /> Subiz
|
|
15
15
|
</a>
|
|
16
16
|
</div>
|
|
17
17
|
)
|
package/src/chatbox/Widget.js
CHANGED
|
@@ -214,7 +214,7 @@ export default class Widget extends Com {
|
|
|
214
214
|
|
|
215
215
|
if (is_lead) sb.setUserAttr(user, {key: 'lead_source', text: 'widget'})
|
|
216
216
|
|
|
217
|
-
let firstmsg = sb.get(data, 'question.value')
|
|
217
|
+
let firstmsg = sb.get(data, 'question.value', this.props.t('get_started'))
|
|
218
218
|
let groupid = sb.get(data, 'group.value', '')
|
|
219
219
|
|
|
220
220
|
// creating convo
|
|
@@ -279,13 +279,6 @@ export default class Widget extends Com {
|
|
|
279
279
|
formMounted = (form) => {
|
|
280
280
|
// waiting for element to be created
|
|
281
281
|
let formData = this.fillForm(form)
|
|
282
|
-
formData['question'] = {
|
|
283
|
-
key: 'question',
|
|
284
|
-
is_required: true,
|
|
285
|
-
label: this.props.t.i18n(sb.get(form, `i18n_question_label`, {})) || form.question_label,
|
|
286
|
-
type: 'text',
|
|
287
|
-
value: this.state.quickReplyMessage.text,
|
|
288
|
-
}
|
|
289
282
|
|
|
290
283
|
this.setState({formData})
|
|
291
284
|
// dont steal focus on mobile or trying to override form
|
|
@@ -302,6 +295,11 @@ export default class Widget extends Com {
|
|
|
302
295
|
this.setState({formData})
|
|
303
296
|
}
|
|
304
297
|
|
|
298
|
+
onKeywordField(e, form, formName, key) {
|
|
299
|
+
if (e.code == 'Enter') {
|
|
300
|
+
this.submitPrechatForm(form, formName)
|
|
301
|
+
}
|
|
302
|
+
}
|
|
305
303
|
onInputChange(key, val) {
|
|
306
304
|
this.wasFormInputed = true
|
|
307
305
|
let formData = sb.cloneDeep(this.state.formData)
|
|
@@ -447,7 +445,7 @@ export default class Widget extends Com {
|
|
|
447
445
|
)
|
|
448
446
|
}
|
|
449
447
|
|
|
450
|
-
renderFields() {
|
|
448
|
+
renderFields(form, formName) {
|
|
451
449
|
if (sb.size(this.state.formData) === 0) return null
|
|
452
450
|
let $fields = sb.map(this.state.formData, (field, key) => {
|
|
453
451
|
// not display question when click bot quick reply
|
|
@@ -484,6 +482,7 @@ export default class Widget extends Com {
|
|
|
484
482
|
value={field.value || ''}
|
|
485
483
|
onInput={(e) => this.onInputChange(key, e.target.value)}
|
|
486
484
|
onChange={(e) => this.onInputChange(key, e.target.value)}
|
|
485
|
+
onKeyDown={(e) => this.onKeywordField(e, form, formName, key)}
|
|
487
486
|
ref={(ref) => {
|
|
488
487
|
this['form_' + encode(key)] = ref
|
|
489
488
|
}}
|
|
@@ -604,7 +603,7 @@ export default class Widget extends Com {
|
|
|
604
603
|
<div class='flex-grow-1'>
|
|
605
604
|
<div class='form mt-3 pl-3 pr-3 pt-3 pb-3 d-flex flex-column'>
|
|
606
605
|
<div>{title}</div>
|
|
607
|
-
{this.renderFields()}
|
|
606
|
+
{this.renderFields(form, formName)}
|
|
608
607
|
</div>
|
|
609
608
|
</div>
|
|
610
609
|
|
|
@@ -730,9 +729,7 @@ export default class Widget extends Com {
|
|
|
730
729
|
|
|
731
730
|
fillQuickReplyToQuestion(message) {
|
|
732
731
|
let formData = this.state.formData
|
|
733
|
-
if (formData)
|
|
734
|
-
sb.set(formData, 'question.value', message.text)
|
|
735
|
-
}
|
|
732
|
+
if (formData) sb.set(formData, 'question.value', message.text || this.props.t('get_started'))
|
|
736
733
|
this.setState({formData, quickReplyMessage: message})
|
|
737
734
|
}
|
|
738
735
|
|
|
@@ -1085,12 +1082,14 @@ export default class Widget extends Com {
|
|
|
1085
1082
|
}
|
|
1086
1083
|
}
|
|
1087
1084
|
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1085
|
+
if (form.question_required) {
|
|
1086
|
+
// add question field
|
|
1087
|
+
data['question'] = {
|
|
1088
|
+
key: 'question',
|
|
1089
|
+
is_required: true,
|
|
1090
|
+
label: this.props.t.i18n(sb.get(form, `i18n_question_label`, {})) || form.question_label,
|
|
1091
|
+
type: 'text',
|
|
1092
|
+
}
|
|
1094
1093
|
}
|
|
1095
1094
|
|
|
1096
1095
|
if (this.isFormChanged(this.state.formData, data)) {
|
|
@@ -1156,6 +1155,16 @@ export default class Widget extends Com {
|
|
|
1156
1155
|
list: sb.map(form.groups, (group) => ({value: group.id, label: group.name})),
|
|
1157
1156
|
}
|
|
1158
1157
|
}
|
|
1158
|
+
|
|
1159
|
+
if (form.question_required) {
|
|
1160
|
+
formData['question'] = {
|
|
1161
|
+
key: 'question',
|
|
1162
|
+
is_required: true,
|
|
1163
|
+
label: this.props.t.i18n(sb.get(form, `i18n_question_label`, {})) || form.question_label,
|
|
1164
|
+
type: 'text',
|
|
1165
|
+
value: this.state.quickReplyMessage.text,
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1159
1168
|
return data
|
|
1160
1169
|
}
|
|
1161
1170
|
}
|
package/webpack.prod.js
CHANGED
|
@@ -10,7 +10,6 @@ webpackconfig.entry = {
|
|
|
10
10
|
app: './app.js',
|
|
11
11
|
preview: './preview.js',
|
|
12
12
|
library: './library.js',
|
|
13
|
-
screenshoot: './screenshoot.js',
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
const HASH = Date.now().toString(16)
|
|
@@ -34,12 +33,6 @@ webpackconfig.plugins = [
|
|
|
34
33
|
inject: 'body',
|
|
35
34
|
chunks: ['app'],
|
|
36
35
|
}),
|
|
37
|
-
new HtmlWebpackPlugin({
|
|
38
|
-
filename: 'screenshoot.html',
|
|
39
|
-
template: './screenshoot.html',
|
|
40
|
-
inject: 'body',
|
|
41
|
-
chunks: ['screenshoot'],
|
|
42
|
-
}),
|
|
43
36
|
new HtmlWebpackPlugin({
|
|
44
37
|
filename: HASH + '.preview.html',
|
|
45
38
|
template: './preview.html',
|