@subiz/widget-v4 4.1.103 → 4.1.104

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.
Files changed (60) hide show
  1. package/compiled_src/chatbox/ChatButton.js +5 -0
  2. package/compiled_src/chatbox/Widget.js +9 -9
  3. package/compiled_src/chatbox/main.js +1 -0
  4. package/compiled_src/lib.js +3 -0
  5. package/compiled_src/store/api.js +1 -0
  6. package/compiled_src/store/store.js +3 -0
  7. package/dist/127.js +273 -0
  8. package/dist/132.js +2569 -6434
  9. package/dist/185.js +1885 -0
  10. package/dist/191ee43a45a.127.js +1 -0
  11. package/dist/191ee43a45a.132.js +1 -0
  12. package/dist/191ee43a45a.185.js +1 -0
  13. package/dist/191ee43a45a.27.js +1 -0
  14. package/dist/191ee43a45a.278.js +1 -0
  15. package/dist/191ee43a45a.459.js +1 -0
  16. package/dist/191ee43a45a.490.js +1 -0
  17. package/dist/191ee43a45a.74.js +1 -0
  18. package/dist/191ee43a45a.997.js +1 -0
  19. package/dist/191ee43a45a.app.js +1 -0
  20. package/dist/{18a02a9c54e.index.html → 191ee43a45a.index.html} +28 -4
  21. package/dist/{18a02a9c54e.library.html → 191ee43a45a.library.html} +28 -4
  22. package/dist/191ee43a45a.library.js +1 -0
  23. package/dist/{18a02a9c54e.preview.html → 191ee43a45a.preview.html} +1 -1
  24. package/dist/191ee43a45a.preview.js +1 -0
  25. package/dist/191ee43a45a.webview.js +1 -0
  26. package/dist/{782.js → 27.js} +7 -7
  27. package/dist/278.js +406 -0
  28. package/dist/{362.js → 459.js} +7 -7
  29. package/dist/{605.js → 490.js} +82 -82
  30. package/dist/{335.js → 74.js} +35 -35
  31. package/dist/{678.js → 997.js} +6 -6
  32. package/dist/HASH +1 -1
  33. package/dist/assets/img/{subiz-mono.877e9f5.svg → subiz-mono.8fbc067.svg} +1 -1
  34. package/dist/malicious-app.js +6 -4
  35. package/dist/screenshoot.html +1 -1
  36. package/dist/screenshoot.js +6730 -2489
  37. package/package.json +3 -3
  38. package/src/chatbox/ChatButton.js +4 -0
  39. package/src/chatbox/Widget.js +9 -10
  40. package/src/chatbox/main.js +2 -0
  41. package/src/lib.js +4 -0
  42. package/src/store/api.js +1 -0
  43. package/src/store/store.js +4 -0
  44. package/dist/178.js +0 -406
  45. package/dist/18a02a9c54e.132.js +0 -1
  46. package/dist/18a02a9c54e.178.js +0 -1
  47. package/dist/18a02a9c54e.213.js +0 -1
  48. package/dist/18a02a9c54e.335.js +0 -1
  49. package/dist/18a02a9c54e.362.js +0 -1
  50. package/dist/18a02a9c54e.441.js +0 -1
  51. package/dist/18a02a9c54e.605.js +0 -1
  52. package/dist/18a02a9c54e.678.js +0 -1
  53. package/dist/18a02a9c54e.782.js +0 -1
  54. package/dist/18a02a9c54e.app.js +0 -1
  55. package/dist/18a02a9c54e.library.js +0 -1
  56. package/dist/18a02a9c54e.preview.js +0 -1
  57. package/dist/18a02a9c54e.screenshoot.js +0 -1
  58. package/dist/18a02a9c54e.webview.js +0 -1
  59. package/dist/213.js +0 -2780
  60. package/dist/441.js +0 -2855
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@subiz/widget-v4",
3
- "version": "4.1.103",
3
+ "version": "4.1.104",
4
4
  "main": "./compiled_src/lib.js",
5
5
  "scripts": {
6
6
  "dev": "npx webpack serve --config webpack.dev.js",
@@ -27,10 +27,10 @@
27
27
  "@babel/plugin-proposal-class-properties": "^7.18.6",
28
28
  "@babel/plugin-transform-react-jsx": "^7.25.2",
29
29
  "@babel/preset-env": "^7.25.4",
30
- "babel-loader": "^9.1.3",
30
+ "babel-loader": "^9.2.1",
31
31
  "babel-plugin-syntax-jsx": "^6.18.0",
32
32
  "html-webpack-plugin": "^5.6.0",
33
- "puppeteer": "^23.3.0",
33
+ "puppeteer": "^23.3.1",
34
34
  "webpack": "^5.94.0",
35
35
  "webpack-bundle-analyzer": "^4.10.2",
36
36
  "webpack-cli": "^5.1.4",
@@ -100,6 +100,10 @@ export default class ChatButton extends Com {
100
100
  this.setState({previewEvent: {}})
101
101
  }
102
102
 
103
+ ClosePreview() {
104
+ this.setState({displayPreview: false})
105
+ }
106
+
103
107
  // this method could be call from the parent
104
108
  ShowGreeting() {
105
109
  // workaround for bao chau elect dont want show greeting in mobile
@@ -279,6 +279,15 @@ 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
+ if (form.question_required || this.state.quickReplyMessage.text) {
283
+ formData['question'] = {
284
+ key: 'question',
285
+ is_required: true,
286
+ label: this.props.t.i18n(sb.get(form, `i18n_question_label`, {})) || form.question_label,
287
+ type: 'text',
288
+ value: this.state.quickReplyMessage.text,
289
+ }
290
+ }
282
291
 
283
292
  this.setState({formData})
284
293
  // dont steal focus on mobile or trying to override form
@@ -1155,16 +1164,6 @@ export default class Widget extends Com {
1155
1164
  list: sb.map(form.groups, (group) => ({value: group.id, label: group.name})),
1156
1165
  }
1157
1166
  }
1158
-
1159
- if (form.question_required) {
1160
- data['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
- }
1168
1167
  return data
1169
1168
  }
1170
1169
  }
@@ -188,6 +188,8 @@ export default class Main extends Com {
188
188
 
189
189
  onWidgetClose() {
190
190
  this.refButton.current && this.refButton.current.ClearPreview()
191
+ // need call closePreview if not this will display default agent avatar and account name
192
+ this.refButton.current && this.refButton.current.ClosePreview()
191
193
  this.props.store.setHasManuallyClosed()
192
194
  this.hideWidget()
193
195
 
package/src/lib.js CHANGED
@@ -147,6 +147,10 @@ class Widget {
147
147
  return this.pluginMgr.getCurrentView()
148
148
  }
149
149
 
150
+ createTicket(ticket) {
151
+ return this.createTicket(ticket)
152
+ }
153
+
150
154
  expandWidget(view, convo) {
151
155
  return this.showWidget(view, convo)
152
156
  }
package/src/store/api.js CHANGED
@@ -314,4 +314,5 @@ export default class {
314
314
  list_wards = (p) => this.apireq.setQuery(p).get(`/accounts/${this.accid}/wards`)
315
315
 
316
316
  suggest_address = (keyword) => this.apireq.setQuery({keyword: keyword}).get(`/accounts/${this.accid}/addresses`)
317
+ create_ticket = (ticket) => this.apireq.post(`/accounts/${this.accid}/tickets`, ticket)
317
318
  }
@@ -168,6 +168,10 @@ export default class Store {
168
168
  return this.api.createShippingAddress(addr)
169
169
  }
170
170
 
171
+ createTicket(ticket) {
172
+ return this.api.create_ticket(ticket)
173
+ }
174
+
171
175
  async overrideAcc(acc) {
172
176
  this.forceAcc = sb.cloneDeep(acc)
173
177
  await this.readyGate.entry()