@subiz/widget-v4 4.1.125 → 4.1.126

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 (58) hide show
  1. package/assets/less/avatar.less +7 -3
  2. package/assets/less/widget_header.less +29 -7
  3. package/compiled_src/chatbox/ChatButton.js +12 -3
  4. package/compiled_src/chatbox/Header.js +12 -1
  5. package/compiled_src/util/common.js +15 -0
  6. package/dist/127.js +273 -0
  7. package/dist/132.js +2575 -6434
  8. package/dist/185.js +1885 -0
  9. package/dist/1964f21ffc8.127.js +1 -0
  10. package/dist/1964f21ffc8.132.js +1 -0
  11. package/dist/1964f21ffc8.185.js +1 -0
  12. package/dist/1964f21ffc8.27.js +1 -0
  13. package/dist/1964f21ffc8.278.js +1 -0
  14. package/dist/1964f21ffc8.459.js +1 -0
  15. package/dist/1964f21ffc8.490.js +1 -0
  16. package/dist/1964f21ffc8.74.js +1 -0
  17. package/dist/1964f21ffc8.997.js +1 -0
  18. package/dist/1964f21ffc8.app.js +1 -0
  19. package/dist/{18a02a9c54e.index.html → 1964f21ffc8.index.html} +28 -4
  20. package/dist/{18a02a9c54e.library.html → 1964f21ffc8.library.html} +28 -4
  21. package/dist/1964f21ffc8.library.js +1 -0
  22. package/dist/{18a02a9c54e.preview.html → 1964f21ffc8.preview.html} +1 -1
  23. package/dist/1964f21ffc8.preview.js +1 -0
  24. package/dist/1964f21ffc8.webview.js +1 -0
  25. package/dist/27.js +107 -0
  26. package/dist/278.js +406 -0
  27. package/dist/459.js +107 -0
  28. package/dist/{605.js → 490.js} +82 -82
  29. package/dist/{335.js → 74.js} +35 -35
  30. package/dist/{678.js → 997.js} +6 -6
  31. package/dist/HASH +1 -1
  32. package/dist/assets/img/{subiz-mono.877e9f5.svg → subiz-mono.8fbc067.svg} +1 -1
  33. package/dist/malicious-app.js +6 -4
  34. package/dist/screenshoot.html +1 -1
  35. package/dist/screenshoot.js +9619 -4865
  36. package/package.json +1 -1
  37. package/src/chatbox/ChatButton.js +12 -1
  38. package/src/chatbox/Header.js +15 -0
  39. package/src/util/common.js +16 -0
  40. package/dist/178.js +0 -406
  41. package/dist/18a02a9c54e.132.js +0 -1
  42. package/dist/18a02a9c54e.178.js +0 -1
  43. package/dist/18a02a9c54e.213.js +0 -1
  44. package/dist/18a02a9c54e.335.js +0 -1
  45. package/dist/18a02a9c54e.362.js +0 -1
  46. package/dist/18a02a9c54e.441.js +0 -1
  47. package/dist/18a02a9c54e.605.js +0 -1
  48. package/dist/18a02a9c54e.678.js +0 -1
  49. package/dist/18a02a9c54e.782.js +0 -1
  50. package/dist/18a02a9c54e.app.js +0 -1
  51. package/dist/18a02a9c54e.library.js +0 -1
  52. package/dist/18a02a9c54e.preview.js +0 -1
  53. package/dist/18a02a9c54e.screenshoot.js +0 -1
  54. package/dist/18a02a9c54e.webview.js +0 -1
  55. package/dist/213.js +0 -2780
  56. package/dist/362.js +0 -107
  57. package/dist/441.js +0 -2855
  58. package/dist/782.js +0 -107
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@subiz/widget-v4",
3
- "version": "4.1.125",
3
+ "version": "4.1.126",
4
4
  "main": "./compiled_src/lib.js",
5
5
  "scripts": {
6
6
  "dev": "npx webpack serve --config webpack.dev.js",
@@ -388,7 +388,18 @@ export default class ChatButton extends Com {
388
388
  defmsg = defmsg || this.props.t('sent_you_a_message')
389
389
  var format = sb.get(ev, 'data.message.format')
390
390
  let block = sb.get(ev, 'data.message.block')
391
- if (block || format == 'block') return <Block block={block} />
391
+ if (block || format == 'block') {
392
+ if (sb.isBlockEmpty(block)) {
393
+ let attachments = sb.get(ev, 'data.message.attachments')
394
+ if (sb.size(attachments) > 0) {
395
+ return (
396
+ <div>{`${this.props.t('send')} ${sb.size(attachments)} ${sb.size(attachments) > 1 ? this.props.t('attachments') : this.props.t('attachment')}`}</div>
397
+ )
398
+ }
399
+ return defmsg
400
+ }
401
+ return <Block block={block} />
402
+ }
392
403
 
393
404
  let message = sb.get(ev, 'data.message.text', defmsg)
394
405
  if (!message && sb.size(sb.get(ev, 'data.message.attachments')) > 0) message = defmsg
@@ -9,6 +9,20 @@ export default class Header extends Com {
9
9
  super(props)
10
10
  }
11
11
 
12
+ renderAccountAvatar() {
13
+ let acc = this.props.store.matchAccount() || {}
14
+ if (!acc.logo_url) return null
15
+ return (
16
+ <img
17
+ width={38}
18
+ height={38}
19
+ alt={acc.name}
20
+ class='avatar avatar__account'
21
+ src={this.props.store.replaceFileUrl(acc.logo_url) || require('../../assets/img/image_default.png')}
22
+ />
23
+ )
24
+ }
25
+
12
26
  render() {
13
27
  let headerMode = 'collapsed'
14
28
 
@@ -55,6 +69,7 @@ export default class Header extends Com {
55
69
  return (
56
70
  <div class={cls} style={style}>
57
71
  {$back}
72
+ {this.renderAccountAvatar()}
58
73
  <div class='widget-header--title-container'>
59
74
  <div class='widget-header--title'>{this.getTitle()}</div>
60
75
  <div class='widget-header--description' title={desc}>
@@ -1411,6 +1411,22 @@ export function blockToText(block) {
1411
1411
  return _blockToText(block).trim()
1412
1412
  }
1413
1413
 
1414
+ export function isBlockEmpty(block) {
1415
+ return _isBlockEmpty(block)
1416
+ }
1417
+
1418
+ function _isBlockEmpty(block = {}) {
1419
+ if (!size(block.contents)) {
1420
+ if ((block.text || '').trim()) return false
1421
+ return true
1422
+ }
1423
+ let result = true
1424
+ map(block.contents, (content) => {
1425
+ result = result && _isBlockEmpty(content)
1426
+ })
1427
+ return result
1428
+ }
1429
+
1414
1430
  function _blockToText(block) {
1415
1431
  if (!block || !block.type) return ''
1416
1432
  let out = ''