isometrik-plugin-chat-sdk 2.0.8 → 2.0.11

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 (87) hide show
  1. package/dist/cjs/attachment-preview_22.cjs.entry.js +254 -37
  2. package/dist/cjs/attachment-preview_22.cjs.entry.js.map +1 -1
  3. package/dist/cjs/isometrik-webchat.cjs.js +1 -1
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/login-page_3.cjs.entry.js +1 -1
  6. package/dist/cjs/member-add.cjs.entry.js +1 -1
  7. package/dist/cjs/reaction-container.cjs.entry.js +1 -1
  8. package/dist/cjs/toast-75ef0607.js +159 -0
  9. package/dist/cjs/toast-75ef0607.js.map +1 -0
  10. package/dist/cjs/toast-notification.cjs.entry.js +21 -15
  11. package/dist/cjs/toast-notification.cjs.entry.js.map +1 -1
  12. package/dist/collection/components/ChatUIComponent/Footer/ChatFooter.js +29 -23
  13. package/dist/collection/components/ChatUIComponent/Footer/ChatFooter.js.map +1 -1
  14. package/dist/collection/components/ChatUIComponent/Header/WebChatHeader.js +19 -8
  15. package/dist/collection/components/ChatUIComponent/Header/WebChatHeader.js.map +1 -1
  16. package/dist/collection/components/ChatUIComponent/shared/contact-info/contact-info.js +129 -3
  17. package/dist/collection/components/ChatUIComponent/shared/contact-info/contact-info.js.map +1 -1
  18. package/dist/collection/components/ChatUIComponent/shared/toast-notification/toast-notification.js +32 -26
  19. package/dist/collection/components/ChatUIComponent/shared/toast-notification/toast-notification.js.map +1 -1
  20. package/dist/collection/components/my-component/web-chat/WebchatRightSide.js +17 -2
  21. package/dist/collection/components/my-component/web-chat/WebchatRightSide.js.map +1 -1
  22. package/dist/collection/lib/chat/group-title.js +8 -0
  23. package/dist/collection/lib/chat/group-title.js.map +1 -0
  24. package/dist/collection/lib/chat/index.js +2 -0
  25. package/dist/collection/lib/chat/index.js.map +1 -1
  26. package/dist/collection/lib/chat/mentioned-users.js +59 -0
  27. package/dist/collection/lib/chat/mentioned-users.js.map +1 -0
  28. package/dist/collection/lib/friendly-toast-message.js +38 -0
  29. package/dist/collection/lib/friendly-toast-message.js.map +1 -0
  30. package/dist/collection/lib/toast.js +76 -21
  31. package/dist/collection/lib/toast.js.map +1 -1
  32. package/dist/components/ChatFooter.js +87 -23
  33. package/dist/components/ChatFooter.js.map +1 -1
  34. package/dist/components/WebChatHeader.js +19 -8
  35. package/dist/components/WebChatHeader.js.map +1 -1
  36. package/dist/components/WebchatRightSide.js +17 -2
  37. package/dist/components/WebchatRightSide.js.map +1 -1
  38. package/dist/components/contact-info2.js +138 -5
  39. package/dist/components/contact-info2.js.map +1 -1
  40. package/dist/components/toast-notification.js +21 -15
  41. package/dist/components/toast-notification.js.map +1 -1
  42. package/dist/components/toast.js +112 -21
  43. package/dist/components/toast.js.map +1 -1
  44. package/dist/esm/attachment-preview_22.entry.js +254 -37
  45. package/dist/esm/attachment-preview_22.entry.js.map +1 -1
  46. package/dist/esm/isometrik-webchat.js +1 -1
  47. package/dist/esm/loader.js +1 -1
  48. package/dist/esm/login-page_3.entry.js +1 -1
  49. package/dist/esm/member-add.entry.js +1 -1
  50. package/dist/esm/reaction-container.entry.js +1 -1
  51. package/dist/esm/toast-45ac7913.js +157 -0
  52. package/dist/esm/toast-45ac7913.js.map +1 -0
  53. package/dist/esm/toast-notification.entry.js +21 -15
  54. package/dist/esm/toast-notification.entry.js.map +1 -1
  55. package/dist/isometrik-webchat/isometrik-webchat.esm.js +1 -1
  56. package/dist/isometrik-webchat/isometrik-webchat.esm.js.map +1 -1
  57. package/dist/isometrik-webchat/p-0c06a021.js +2 -0
  58. package/dist/isometrik-webchat/p-0c06a021.js.map +1 -0
  59. package/dist/isometrik-webchat/p-2d69086d.entry.js +2 -0
  60. package/dist/isometrik-webchat/p-2d69086d.entry.js.map +1 -0
  61. package/dist/isometrik-webchat/{p-76341adb.entry.js → p-6024bf2a.entry.js} +2 -2
  62. package/dist/isometrik-webchat/{p-35d9ecdc.entry.js → p-63ff4eea.entry.js} +2 -2
  63. package/dist/isometrik-webchat/{p-2195b0c0.entry.js → p-ba6de4e2.entry.js} +2 -2
  64. package/dist/isometrik-webchat/p-d6fd2dd7.entry.js +2 -0
  65. package/dist/isometrik-webchat/p-d6fd2dd7.entry.js.map +1 -0
  66. package/dist/types/components/ChatUIComponent/Footer/ChatFooter.d.ts +7 -3
  67. package/dist/types/components/ChatUIComponent/Header/WebChatHeader.d.ts +1 -0
  68. package/dist/types/components/ChatUIComponent/shared/contact-info/contact-info.d.ts +15 -0
  69. package/dist/types/lib/chat/group-title.d.ts +2 -0
  70. package/dist/types/lib/chat/index.d.ts +2 -0
  71. package/dist/types/lib/chat/mentioned-users.d.ts +18 -0
  72. package/dist/types/lib/friendly-toast-message.d.ts +5 -0
  73. package/dist/types/lib/toast.d.ts +1 -0
  74. package/package.json +1 -1
  75. package/dist/cjs/toast-f810e550.js +0 -68
  76. package/dist/cjs/toast-f810e550.js.map +0 -1
  77. package/dist/esm/toast-533dd183.js +0 -66
  78. package/dist/esm/toast-533dd183.js.map +0 -1
  79. package/dist/isometrik-webchat/p-4cb54460.js +0 -2
  80. package/dist/isometrik-webchat/p-4cb54460.js.map +0 -1
  81. package/dist/isometrik-webchat/p-a119be75.entry.js +0 -2
  82. package/dist/isometrik-webchat/p-a119be75.entry.js.map +0 -1
  83. package/dist/isometrik-webchat/p-e1d632b0.entry.js +0 -2
  84. package/dist/isometrik-webchat/p-e1d632b0.entry.js.map +0 -1
  85. /package/dist/isometrik-webchat/{p-76341adb.entry.js.map → p-6024bf2a.entry.js.map} +0 -0
  86. /package/dist/isometrik-webchat/{p-35d9ecdc.entry.js.map → p-63ff4eea.entry.js.map} +0 -0
  87. /package/dist/isometrik-webchat/{p-2195b0c0.entry.js.map → p-ba6de4e2.entry.js.map} +0 -0
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-f624fc47.js');
6
6
  const messageReaction = require('./message-reaction-8f93a048.js');
7
- const toast = require('./toast-f810e550.js');
7
+ const toast = require('./toast-75ef0607.js');
8
8
  require('./index.m-ff115b26.js');
9
9
  require('./index-66f98408.js');
10
10
 
@@ -0,0 +1,159 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-66f98408.js');
4
+
5
+ /**
6
+ * Map raw API / SDK errors to short user-facing copy.
7
+ * Never surface HTTP status phrases like "Unprocessable entity".
8
+ */
9
+ function friendlyToastMessage(raw, fallback = 'Something went wrong. Try again.') {
10
+ var _a, _b;
11
+ const s = String((_b = (_a = raw === null || raw === void 0 ? void 0 : raw.message) !== null && _a !== void 0 ? _a : raw) !== null && _b !== void 0 ? _b : '')
12
+ .trim()
13
+ .replace(/\s+/g, ' ');
14
+ if (!s)
15
+ return fallback;
16
+ const lower = s.toLowerCase();
17
+ if (lower.includes('unprocessable') ||
18
+ lower.includes('422') ||
19
+ lower === 'bad request' ||
20
+ lower.includes('invalid payload')) {
21
+ return "Couldn't send that message. Please try again.";
22
+ }
23
+ if (lower.includes('network') ||
24
+ lower.includes('failed to fetch') ||
25
+ lower.includes('timeout')) {
26
+ return 'Network issue. Check your connection and try again.';
27
+ }
28
+ if (lower.includes('unauthorized') ||
29
+ lower.includes('401') ||
30
+ lower.includes('forbidden') ||
31
+ lower.includes('403')) {
32
+ return 'Session expired. Please refresh and try again.';
33
+ }
34
+ if (lower.includes('not found') || lower.includes('404')) {
35
+ return 'That chat is no longer available.';
36
+ }
37
+ // Keep short human messages; truncate giant stack/JSON blobs.
38
+ if (s.length > 120 || s.startsWith('{') || s.includes('\n'))
39
+ return fallback;
40
+ return s;
41
+ }
42
+
43
+ class ToastHelper {
44
+ constructor() {
45
+ this.container = document.createElement('div');
46
+ this.container.id = 'isometrik-toast-root';
47
+ Object.assign(this.container.style, {
48
+ position: 'fixed',
49
+ zIndex: '100000',
50
+ display: 'flex',
51
+ flexDirection: 'column',
52
+ gap: '8px',
53
+ pointerEvents: 'none',
54
+ maxWidth: 'min(22rem, calc(100vw - 2rem))',
55
+ });
56
+ document.body.appendChild(this.container);
57
+ }
58
+ static getInstance() {
59
+ if (!ToastHelper.instance)
60
+ ToastHelper.instance = new ToastHelper();
61
+ return ToastHelper.instance;
62
+ }
63
+ /**
64
+ * Solid fallbacks — host themes often leave --danger / --bg-primary unset
65
+ * or map --bg-primary to a light surface (white-on-white toast).
66
+ */
67
+ getTypeStyles(type = 'info') {
68
+ const styles = {
69
+ success: {
70
+ bgColor: 'var(--success, #15803d)',
71
+ color: '#ffffff',
72
+ progressBarColor: 'rgba(255,255,255,0.55)',
73
+ borderColor: 'transparent',
74
+ },
75
+ error: {
76
+ bgColor: 'var(--danger, #b91c1c)',
77
+ color: '#ffffff',
78
+ progressBarColor: 'rgba(255,255,255,0.55)',
79
+ borderColor: 'transparent',
80
+ },
81
+ warning: {
82
+ bgColor: 'var(--text-warning-color, #c2410c)',
83
+ color: '#ffffff',
84
+ progressBarColor: 'rgba(255,255,255,0.55)',
85
+ borderColor: 'transparent',
86
+ },
87
+ info: {
88
+ bgColor: 'var(--hoa-chat-ink, #18181b)',
89
+ color: '#ffffff',
90
+ progressBarColor: 'rgba(255,255,255,0.55)',
91
+ borderColor: 'transparent',
92
+ },
93
+ };
94
+ return styles[type] || styles.info;
95
+ }
96
+ setPosition(position = 'top-right') {
97
+ // Clear previous transform so center variants don't stick.
98
+ this.container.style.transform = '';
99
+ const positions = {
100
+ 'top-right': { top: '1rem', right: '1rem', bottom: 'auto', left: 'auto' },
101
+ 'top-left': { top: '1rem', right: 'auto', bottom: 'auto', left: '1rem' },
102
+ // Sit above typical chat composer (~5.5rem).
103
+ 'bottom-right': { top: 'auto', right: '1rem', bottom: '5.5rem', left: 'auto' },
104
+ 'bottom-left': { top: 'auto', right: 'auto', bottom: '5.5rem', left: '1rem' },
105
+ 'top-center': {
106
+ top: '1rem',
107
+ right: 'auto',
108
+ bottom: 'auto',
109
+ left: '50%',
110
+ transform: 'translateX(-50%)',
111
+ },
112
+ 'bottom-center': {
113
+ top: 'auto',
114
+ right: 'auto',
115
+ bottom: '5.5rem',
116
+ left: '50%',
117
+ transform: 'translateX(-50%)',
118
+ },
119
+ };
120
+ Object.assign(this.container.style, positions[position] || positions['top-right']);
121
+ }
122
+ show(options) {
123
+ const { duration = 3500, type = 'info', position = 'top-right' } = options;
124
+ const message = friendlyToastMessage(options.message);
125
+ this.setPosition(position);
126
+ const toast = document.createElement('toast-notification');
127
+ const styles = this.getTypeStyles(type);
128
+ toast.bgColor = styles.bgColor;
129
+ toast.color = styles.color;
130
+ toast.progressBarColor = styles.progressBarColor;
131
+ toast.progressBarBg = 'transparent';
132
+ toast.borderColor = styles.borderColor;
133
+ toast.borderWidth = '0';
134
+ toast.toastMessage = message;
135
+ toast.padding = '12px 14px';
136
+ toast.borderRadius = '0.5rem';
137
+ toast.width = '100%';
138
+ toast.fontWeight = '600';
139
+ toast.style.pointerEvents = 'auto';
140
+ toast.style.display = 'block';
141
+ toast.style.boxShadow = '0 8px 24px rgba(24, 24, 27, 0.18)';
142
+ this.container.appendChild(toast);
143
+ setTimeout(() => toast.remove(), duration);
144
+ }
145
+ }
146
+ const showToast = (options) => {
147
+ var _a;
148
+ const custom = index.createCustomPartElement('toast', Object.assign(Object.assign({}, options), { message: friendlyToastMessage(options.message) }));
149
+ if (custom) {
150
+ document.body.appendChild(custom);
151
+ setTimeout(() => custom.remove(), (_a = options.duration) !== null && _a !== void 0 ? _a : 3500);
152
+ return;
153
+ }
154
+ ToastHelper.getInstance().show(options);
155
+ };
156
+
157
+ exports.showToast = showToast;
158
+
159
+ //# sourceMappingURL=toast-75ef0607.js.map
@@ -0,0 +1 @@
1
+ {"file":"toast-75ef0607.js","mappings":";;;;AAAA;;;;SAIgB,oBAAoB,CAClC,GAAY,EACZ,QAAQ,GAAG,kCAAkC;;IAE7C,MAAM,CAAC,GAAG,MAAM,CAAC,MAAA,MAAC,GAA6B,aAA7B,GAAG,uBAAH,GAAG,CAA4B,OAAO,mCAAI,GAAG,mCAAI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C,WAAW,CAAC,MAAM,CAAC,CAAC;QAClC,UAAU,CAAC,MAAM,MAAM,CAAC,MAAM,EAAE,EAAE,MAAA,OAAO,CAAC,QAAQ,mCAAI,IAAI,CAAC,CAAC;QAC5D,OAAO;KACR;IACD,WAAW,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC1C;;;;","names":["createCustomPartElement"],"sources":["src/lib/friendly-toast-message.ts","src/lib/toast.ts"],"sourcesContent":["/**\n * Map raw API / SDK errors to short user-facing copy.\n * Never surface HTTP status phrases like \"Unprocessable entity\".\n */\nexport function friendlyToastMessage(\n raw: unknown,\n fallback = 'Something went wrong. Try again.',\n): string {\n const s = String((raw as { message?: unknown })?.message ?? raw ?? '')\n .trim()\n .replace(/\\s+/g, ' ');\n if (!s) return fallback;\n\n const lower = s.toLowerCase();\n if (\n lower.includes('unprocessable') ||\n lower.includes('422') ||\n lower === 'bad request' ||\n lower.includes('invalid payload')\n ) {\n return \"Couldn't send that message. Please try again.\";\n }\n if (\n lower.includes('network') ||\n lower.includes('failed to fetch') ||\n lower.includes('timeout')\n ) {\n return 'Network issue. Check your connection and try again.';\n }\n if (\n lower.includes('unauthorized') ||\n lower.includes('401') ||\n lower.includes('forbidden') ||\n lower.includes('403')\n ) {\n return 'Session expired. Please refresh and try again.';\n }\n if (lower.includes('not found') || lower.includes('404')) {\n return 'That chat is no longer available.';\n }\n // Keep short human messages; truncate giant stack/JSON blobs.\n if (s.length > 120 || s.startsWith('{') || s.includes('\\n')) return fallback;\n return s;\n}\n","import '../components/ChatUIComponent/shared/toast-notification/toast-notification';\nimport { createCustomPartElement } from './custom-ui';\nimport { friendlyToastMessage } from './friendly-toast-message';\n\nexport { friendlyToastMessage } from './friendly-toast-message';\n\nexport interface ToastOptions {\n message: string;\n duration?: number;\n type?: 'success' | 'error' | 'warning' | 'info';\n position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center';\n}\n\nclass ToastHelper {\n private static instance: ToastHelper;\n private container: HTMLDivElement;\n\n private constructor() {\n this.container = document.createElement('div');\n this.container.id = 'isometrik-toast-root';\n Object.assign(this.container.style, {\n position: 'fixed',\n zIndex: '100000',\n display: 'flex',\n flexDirection: 'column',\n gap: '8px',\n pointerEvents: 'none',\n maxWidth: 'min(22rem, calc(100vw - 2rem))',\n } as CSSStyleDeclaration);\n document.body.appendChild(this.container);\n }\n\n public static getInstance(): ToastHelper {\n if (!ToastHelper.instance) ToastHelper.instance = new ToastHelper();\n return ToastHelper.instance;\n }\n\n /**\n * Solid fallbacks — host themes often leave --danger / --bg-primary unset\n * or map --bg-primary to a light surface (white-on-white toast).\n */\n private getTypeStyles(type: string = 'info') {\n const styles: Record<\n string,\n { bgColor: string; color: string; progressBarColor: string; borderColor: string }\n > = {\n success: {\n bgColor: 'var(--success, #15803d)',\n color: '#ffffff',\n progressBarColor: 'rgba(255,255,255,0.55)',\n borderColor: 'transparent',\n },\n error: {\n bgColor: 'var(--danger, #b91c1c)',\n color: '#ffffff',\n progressBarColor: 'rgba(255,255,255,0.55)',\n borderColor: 'transparent',\n },\n warning: {\n bgColor: 'var(--text-warning-color, #c2410c)',\n color: '#ffffff',\n progressBarColor: 'rgba(255,255,255,0.55)',\n borderColor: 'transparent',\n },\n info: {\n bgColor: 'var(--hoa-chat-ink, #18181b)',\n color: '#ffffff',\n progressBarColor: 'rgba(255,255,255,0.55)',\n borderColor: 'transparent',\n },\n };\n return styles[type] || styles.info;\n }\n\n private setPosition(position: string = 'top-right') {\n // Clear previous transform so center variants don't stick.\n this.container.style.transform = '';\n const positions: Record<string, Partial<CSSStyleDeclaration>> = {\n 'top-right': { top: '1rem', right: '1rem', bottom: 'auto', left: 'auto' },\n 'top-left': { top: '1rem', right: 'auto', bottom: 'auto', left: '1rem' },\n // Sit above typical chat composer (~5.5rem).\n 'bottom-right': { top: 'auto', right: '1rem', bottom: '5.5rem', left: 'auto' },\n 'bottom-left': { top: 'auto', right: 'auto', bottom: '5.5rem', left: '1rem' },\n 'top-center': {\n top: '1rem',\n right: 'auto',\n bottom: 'auto',\n left: '50%',\n transform: 'translateX(-50%)',\n },\n 'bottom-center': {\n top: 'auto',\n right: 'auto',\n bottom: '5.5rem',\n left: '50%',\n transform: 'translateX(-50%)',\n },\n };\n Object.assign(this.container.style, positions[position] || positions['top-right']);\n }\n\n public show(options: ToastOptions): void {\n const { duration = 3500, type = 'info', position = 'top-right' } = options;\n const message = friendlyToastMessage(options.message);\n this.setPosition(position);\n const toast = document.createElement('toast-notification') as any;\n const styles = this.getTypeStyles(type);\n toast.bgColor = styles.bgColor;\n toast.color = styles.color;\n toast.progressBarColor = styles.progressBarColor;\n toast.progressBarBg = 'transparent';\n toast.borderColor = styles.borderColor;\n toast.borderWidth = '0';\n toast.toastMessage = message;\n toast.padding = '12px 14px';\n toast.borderRadius = '0.5rem';\n toast.width = '100%';\n toast.fontWeight = '600';\n toast.style.pointerEvents = 'auto';\n toast.style.display = 'block';\n toast.style.boxShadow = '0 8px 24px rgba(24, 24, 27, 0.18)';\n this.container.appendChild(toast);\n setTimeout(() => toast.remove(), duration);\n }\n}\n\nexport const showToast = (options: ToastOptions): void => {\n const custom = createCustomPartElement('toast', {\n ...options,\n message: friendlyToastMessage(options.message),\n } as any);\n if (custom) {\n document.body.appendChild(custom);\n setTimeout(() => custom.remove(), options.duration ?? 3500);\n return;\n }\n ToastHelper.getInstance().show(options);\n};\n"],"version":3}
@@ -7,36 +7,42 @@ const index = require('./index-f624fc47.js');
7
7
  const ToastNotification = class {
8
8
  constructor(hostRef) {
9
9
  index.registerInstance(this, hostRef);
10
- this.bgColor = 'white';
10
+ this.bgColor = '#18181b';
11
11
  this.width = '200px';
12
12
  this.height = 'auto';
13
- this.borderWidth = '1px';
14
- this.borderColor = 'black';
15
- this.color = 'black';
16
- this.fontSize = '14px';
17
- this.borderRadius = '5px';
18
- this.fontWeight = 'normal';
19
- this.progressBarBg = 'white';
20
- this.progressBarHeight = '5px';
21
- this.progressBarColor = 'var(--success)';
22
- this.progressBarBorderRadius = '5px';
13
+ this.borderWidth = '0';
14
+ this.borderColor = 'transparent';
15
+ this.color = '#ffffff';
16
+ this.fontSize = '0.875rem';
17
+ this.borderRadius = '0.5rem';
18
+ this.fontWeight = '600';
19
+ this.progressBarBg = 'transparent';
20
+ this.progressBarHeight = '3px';
21
+ this.progressBarColor = 'rgba(255,255,255,0.55)';
22
+ this.progressBarBorderRadius = '0';
23
23
  this.toastMessage = 'Default message';
24
24
  this.padding = undefined;
25
25
  }
26
26
  render() {
27
- return (index.h("div", { key: '29d9794c50052cde03e6fbd84cd8906567e5340c', class: "toast-container", style: {
27
+ const borderW = this.borderWidth || '0';
28
+ const borderC = this.borderColor || 'transparent';
29
+ return (index.h("div", { key: '26860c462525339767af80e40eb7f81cbd2100fb', class: "toast-container", role: "status", style: {
28
30
  backgroundColor: this.bgColor,
29
31
  color: this.color,
30
32
  width: this.width,
31
33
  height: this.height,
32
- border: `${this.borderWidth} solid ${this.borderColor}`,
34
+ border: borderW === '0' || borderW === '0px' ? 'none' : `${borderW} solid ${borderC}`,
33
35
  borderRadius: this.borderRadius,
34
36
  fontSize: this.fontSize,
35
37
  fontWeight: this.fontWeight,
36
- } }, index.h("div", { key: '7acd2b848a46ae3512ed15f71b537f5fecc4de19', class: "toast-message", style: { padding: this.padding } }, this.toastMessage), index.h("div", { key: 'a518972b61a8b77df6bccbec2537b06c9a7ea895', class: "progress-container", style: { height: this.progressBarHeight, borderRadius: this.progressBarBorderRadius, background: this.progressBarBg } }, index.h("div", { key: '6735d8fb2c4fcbd1262e9a51bdcb90be6203f389', class: "progress-bar", style: { backgroundColor: this.progressBarColor } }))));
38
+ } }, index.h("div", { key: '894c28f99edda42212508bd4035b99bd125d1681', class: "toast-message", style: { padding: this.padding } }, this.toastMessage), index.h("div", { key: 'a40e5a0d3e8746efedbd175a555deb4a2fdaea1b', class: "progress-container", style: {
39
+ height: this.progressBarHeight,
40
+ borderRadius: this.progressBarBorderRadius,
41
+ background: this.progressBarBg,
42
+ } }, index.h("div", { key: 'f3248675f982049e927d41bb6c899050695f02e4', class: "progress-bar", style: { backgroundColor: this.progressBarColor } }))));
37
43
  }
38
44
  };
39
- ToastNotification.style = ":host { display: block; }\n .toast-container { box-shadow: 0 4px 12px var(--overlay); overflow: hidden; }\n .toast-message { padding: 8px; }\n .progress-container { width: 100%; overflow: hidden; position: relative; }\n .progress-bar {\n height: 100%; width: 100%; transform-origin: left;\n animation: progress 3s linear forwards;\n }\n @keyframes progress {\n from { width: 100%; }\n to { width: 0%; }\n }";
45
+ ToastNotification.style = ":host { display: block; }\n .toast-container {\n overflow: hidden;\n box-shadow: 0 8px 24px rgba(24, 24, 27, 0.18);\n letter-spacing: -0.01em;\n line-height: 1.35;\n }\n .toast-message { padding: 8px; word-break: break-word; }\n .progress-container { width: 100%; overflow: hidden; position: relative; }\n .progress-bar {\n height: 100%; width: 100%; transform-origin: left;\n animation: progress 3.5s linear forwards;\n }\n @keyframes progress {\n from { width: 100%; }\n to { width: 0%; }\n }";
40
46
 
41
47
  exports.toast_notification = ToastNotification;
42
48
 
@@ -1 +1 @@
1
- {"file":"toast-notification.entry.cjs.js","mappings":";;;;;;MAoBa,iBAAiB;;;uBACF,OAAO;qBACT,OAAO;sBACN,MAAM;2BACD,KAAK;2BACL,OAAO;qBACb,OAAO;wBACJ,MAAM;4BACF,KAAK;0BACP,QAAQ;6BACL,OAAO;iCACH,KAAK;gCACN,gBAAgB;uCACT,KAAK;4BAChB,iBAAiB;;;IAGhD,MAAM;QACJ,QACEA,kEACE,KAAK,EAAC,iBAAiB,EACvB,KAAK,EAAE;gBACL,eAAe,EAAE,IAAI,CAAC,OAAO;gBAC7B,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,MAAM,EAAE,GAAG,IAAI,CAAC,WAAW,UAAU,IAAI,CAAC,WAAW,EAAE;gBACvD,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,UAAU,EAAE,IAAI,CAAC,UAAU;aAC5B,IAEDA,kEAAK,KAAK,EAAC,eAAe,EAAC,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IACxD,IAAI,CAAC,YAAY,CACd,EACNA,kEACE,KAAK,EAAC,oBAAoB,EAC1B,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,iBAAiB,EAAE,YAAY,EAAE,IAAI,CAAC,uBAAuB,EAAE,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE,IAErHA,kEAAK,KAAK,EAAC,cAAc,EAAC,KAAK,EAAE,EAAE,eAAe,EAAE,IAAI,CAAC,gBAAgB,EAAE,GAAI,CAC3E,CACF,EACN;KACH;;;;;;","names":["h"],"sources":["src/components/ChatUIComponent/shared/toast-notification/toast-notification.tsx"],"sourcesContent":["import { Component, Prop, h } from '@stencil/core';\n\n@Component({\n tag: 'toast-notification',\n shadow: true,\n styles: `\n :host { display: block; }\n .toast-container { box-shadow: 0 4px 12px var(--overlay); overflow: hidden; }\n .toast-message { padding: 8px; }\n .progress-container { width: 100%; overflow: hidden; position: relative; }\n .progress-bar {\n height: 100%; width: 100%; transform-origin: left;\n animation: progress 3s linear forwards;\n }\n @keyframes progress {\n from { width: 100%; }\n to { width: 0%; }\n }\n `,\n})\nexport class ToastNotification {\n @Prop() bgColor: string = 'white';\n @Prop() width: string = '200px';\n @Prop() height: string = 'auto';\n @Prop() borderWidth: string = '1px';\n @Prop() borderColor: string = 'black';\n @Prop() color: string = 'black';\n @Prop() fontSize: string = '14px';\n @Prop() borderRadius: string = '5px';\n @Prop() fontWeight: string = 'normal';\n @Prop() progressBarBg: string = 'white';\n @Prop() progressBarHeight: string = '5px';\n @Prop() progressBarColor: string = 'var(--success)';\n @Prop() progressBarBorderRadius: string = '5px';\n @Prop() toastMessage: string = 'Default message';\n @Prop() padding: string;\n\n render() {\n return (\n <div\n class=\"toast-container\"\n style={{\n backgroundColor: this.bgColor,\n color: this.color,\n width: this.width,\n height: this.height,\n border: `${this.borderWidth} solid ${this.borderColor}`,\n borderRadius: this.borderRadius,\n fontSize: this.fontSize,\n fontWeight: this.fontWeight,\n }}\n >\n <div class=\"toast-message\" style={{ padding: this.padding }}>\n {this.toastMessage}\n </div>\n <div\n class=\"progress-container\"\n style={{ height: this.progressBarHeight, borderRadius: this.progressBarBorderRadius, background: this.progressBarBg }}\n >\n <div class=\"progress-bar\" style={{ backgroundColor: this.progressBarColor }} />\n </div>\n </div>\n );\n }\n}\n"],"version":3}
1
+ {"file":"toast-notification.entry.cjs.js","mappings":";;;;;;MAyBa,iBAAiB;;;uBACF,SAAS;qBACX,OAAO;sBACN,MAAM;2BACD,GAAG;2BACH,aAAa;qBACnB,SAAS;wBACN,UAAU;4BACN,QAAQ;0BACV,KAAK;6BACF,aAAa;iCACT,KAAK;gCACN,wBAAwB;uCACjB,GAAG;4BACd,iBAAiB;;;IAGhD,MAAM;QACJ,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,IAAI,GAAG,CAAC;QACxC,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,IAAI,aAAa,CAAC;QAClD,QACEA,kEACE,KAAK,EAAC,iBAAiB,EACvB,IAAI,EAAC,QAAQ,EACb,KAAK,EAAE;gBACL,eAAe,EAAE,IAAI,CAAC,OAAO;gBAC7B,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,MAAM,EAAE,OAAO,KAAK,GAAG,IAAI,OAAO,KAAK,KAAK,GAAG,MAAM,GAAG,GAAG,OAAO,UAAU,OAAO,EAAE;gBACrF,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,UAAU,EAAE,IAAI,CAAC,UAAU;aAC5B,IAEDA,kEAAK,KAAK,EAAC,eAAe,EAAC,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IACxD,IAAI,CAAC,YAAY,CACd,EACNA,kEACE,KAAK,EAAC,oBAAoB,EAC1B,KAAK,EAAE;gBACL,MAAM,EAAE,IAAI,CAAC,iBAAiB;gBAC9B,YAAY,EAAE,IAAI,CAAC,uBAAuB;gBAC1C,UAAU,EAAE,IAAI,CAAC,aAAa;aAC/B,IAEDA,kEAAK,KAAK,EAAC,cAAc,EAAC,KAAK,EAAE,EAAE,eAAe,EAAE,IAAI,CAAC,gBAAgB,EAAE,GAAI,CAC3E,CACF,EACN;KACH;;;;;;","names":["h"],"sources":["src/components/ChatUIComponent/shared/toast-notification/toast-notification.tsx"],"sourcesContent":["import { Component, Prop, h } from '@stencil/core';\n\n@Component({\n tag: 'toast-notification',\n shadow: true,\n styles: `\n :host { display: block; }\n .toast-container {\n overflow: hidden;\n box-shadow: 0 8px 24px rgba(24, 24, 27, 0.18);\n letter-spacing: -0.01em;\n line-height: 1.35;\n }\n .toast-message { padding: 8px; word-break: break-word; }\n .progress-container { width: 100%; overflow: hidden; position: relative; }\n .progress-bar {\n height: 100%; width: 100%; transform-origin: left;\n animation: progress 3.5s linear forwards;\n }\n @keyframes progress {\n from { width: 100%; }\n to { width: 0%; }\n }\n `,\n})\nexport class ToastNotification {\n @Prop() bgColor: string = '#18181b';\n @Prop() width: string = '200px';\n @Prop() height: string = 'auto';\n @Prop() borderWidth: string = '0';\n @Prop() borderColor: string = 'transparent';\n @Prop() color: string = '#ffffff';\n @Prop() fontSize: string = '0.875rem';\n @Prop() borderRadius: string = '0.5rem';\n @Prop() fontWeight: string = '600';\n @Prop() progressBarBg: string = 'transparent';\n @Prop() progressBarHeight: string = '3px';\n @Prop() progressBarColor: string = 'rgba(255,255,255,0.55)';\n @Prop() progressBarBorderRadius: string = '0';\n @Prop() toastMessage: string = 'Default message';\n @Prop() padding: string;\n\n render() {\n const borderW = this.borderWidth || '0';\n const borderC = this.borderColor || 'transparent';\n return (\n <div\n class=\"toast-container\"\n role=\"status\"\n style={{\n backgroundColor: this.bgColor,\n color: this.color,\n width: this.width,\n height: this.height,\n border: borderW === '0' || borderW === '0px' ? 'none' : `${borderW} solid ${borderC}`,\n borderRadius: this.borderRadius,\n fontSize: this.fontSize,\n fontWeight: this.fontWeight,\n }}\n >\n <div class=\"toast-message\" style={{ padding: this.padding }}>\n {this.toastMessage}\n </div>\n <div\n class=\"progress-container\"\n style={{\n height: this.progressBarHeight,\n borderRadius: this.progressBarBorderRadius,\n background: this.progressBarBg,\n }}\n >\n <div class=\"progress-bar\" style={{ backgroundColor: this.progressBarColor }} />\n </div>\n </div>\n );\n }\n}\n"],"version":3}
@@ -9,6 +9,7 @@ import "../shared/reply-block/reply-block";
9
9
  import { showToast } from "../../../lib/toast";
10
10
  import { takeMediaFiles, mediaLimitToastMessage, MAX_MEDIA_PER_MESSAGE } from "../../../lib/chat/media-limits";
11
11
  import { ATTACHMENT_BODY_PLACEHOLDER, attachmentBodyForApi, buildReplyMetaData, } from "../../../lib/chat/send-media";
12
+ import { toMentionedUsersPayload } from "../../../lib/chat/mentioned-users";
12
13
  import { postGroupCastMessage, getPresignedUrlForGroupcastMedia } from "../../../api/groupcast.js";
13
14
  import { Attachment, Delete, Microphone, Send, Smile } from "../../../constants/chat-assets";
14
15
  import DocumentsIcon from "../../../assets/svg/documents.svg";
@@ -94,7 +95,12 @@ class ChatFooter {
94
95
  };
95
96
  this.createLocalMessage = (messageBody, attachments = null, messageId) => {
96
97
  var _a;
97
- return (Object.assign(Object.assign(Object.assign({ body: messageBody, messageId: messageId, deliveredToAll: 'pending', senderId: this.userMetaData.userId, messageType: this.replyMessage ? 2 : 0, sentAt: Date.now() }, (attachments && { attachments })), (((_a = this.mentionUserList) === null || _a === void 0 ? void 0 : _a.length) > 0 && { mentionedUsers: this.mentionUserList })), (this.replyMessage && { metaData: this.getReplyMetadata() })));
98
+ const mentionedUsers = this.mentionedUsersForApi(messageBody);
99
+ return Object.assign(Object.assign(Object.assign({ body: messageBody, messageId: messageId, deliveredToAll: 'pending', senderId: this.userMetaData.userId, messageType: this.replyMessage ? 2 : 0, sentAt: Date.now() }, (attachments && { attachments })), (((_a = this.mentionUserList) === null || _a === void 0 ? void 0 : _a.length) > 0 && {
100
+ mentionedUsers: this.mentionUserList.some(m => m === null || m === void 0 ? void 0 : m.userName)
101
+ ? this.mentionUserList
102
+ : mentionedUsers,
103
+ })), (this.replyMessage && { metaData: this.getReplyMetadata() }));
98
104
  };
99
105
  this.updateMessageWithApiResponse = (messageId, oldMessageId) => {
100
106
  const newMessages = [...this.allMessages];
@@ -510,6 +516,10 @@ class ChatFooter {
510
516
  console.warn('updateConversationListProp is not a function', this.updateConversationListProp);
511
517
  }
512
518
  }
519
+ /** API payload only — strips userName, sets wordCount + order. */
520
+ mentionedUsersForApi(body) {
521
+ return toMentionedUsersPayload(body, this.mentionUserList);
522
+ }
513
523
  clearLinkPreview() {
514
524
  this.linkPreview = '';
515
525
  this.linkToPreview = '';
@@ -526,7 +536,6 @@ class ChatFooter {
526
536
  document.removeEventListener('pointerdown', this.closeAttachOutside);
527
537
  }
528
538
  async sendTextMessage(body, conversationId) {
529
- var _a;
530
539
  this.messageBody = '';
531
540
  let messageId = 'localId' + Date.now().toString() + Math.random() * 100;
532
541
  const localMessage = this.createLocalMessage(body, null, messageId);
@@ -541,22 +550,9 @@ class ChatFooter {
541
550
  const urlParams = new URLSearchParams(window.location.search);
542
551
  const isGroupcast = urlParams.has('groupcast');
543
552
  const groupcastId = urlParams.get('groupcast');
553
+ const mentionedUsers = this.mentionedUsersForApi(body);
544
554
  if (isGroupcast) {
545
- const payloadForGroupcastMessage = {
546
- showInConversation: true,
547
- sendPushForNewConversationCreated: true,
548
- searchableTags: this.generateSearchableTags(body),
549
- metaData: this.getReplyMetadata(),
550
- body: body,
551
- groupcastId: groupcastId,
552
- readCount: 1,
553
- notifyOnCompletion: true,
554
- messageType: this.replyMessage ? 2 : 0,
555
- hideNewConversationsForSender: true,
556
- encrypted: true,
557
- deviceId: this.deviceId,
558
- deliveryCount: 1,
559
- };
555
+ const payloadForGroupcastMessage = Object.assign({ showInConversation: true, sendPushForNewConversationCreated: true, searchableTags: this.generateSearchableTags(body), metaData: this.getReplyMetadata(), body: body, groupcastId: groupcastId, readCount: 1, notifyOnCompletion: true, messageType: this.replyMessage ? 2 : 0, hideNewConversationsForSender: true, encrypted: true, deviceId: this.deviceId, deliveryCount: 1 }, (mentionedUsers.length > 0 && { mentionedUsers }));
560
556
  try {
561
557
  const res = await postGroupCastMessage(payloadForGroupcastMessage);
562
558
  this.updateMessageWithApiResponse(res.messageId, messageId);
@@ -569,6 +565,12 @@ class ChatFooter {
569
565
  position: 'bottom-right',
570
566
  });
571
567
  }
568
+ finally {
569
+ this.changeMessageSendingState(false);
570
+ this.replyMessage = null;
571
+ this.messageBody = '';
572
+ this.mentionUserList = [];
573
+ }
572
574
  }
573
575
  else {
574
576
  const payload = {
@@ -583,8 +585,8 @@ class ChatFooter {
583
585
  body: body,
584
586
  metaData: this.getReplyMetadata(),
585
587
  };
586
- if (((_a = this.mentionUserList) === null || _a === void 0 ? void 0 : _a.length) > 0) {
587
- payload['mentionedUsers'] = this.mentionUserList;
588
+ if (mentionedUsers.length > 0) {
589
+ payload['mentionedUsers'] = mentionedUsers;
588
590
  }
589
591
  try {
590
592
  const res = await ChatSDK.getInstance().message.postMessages(payload);
@@ -602,6 +604,7 @@ class ChatFooter {
602
604
  this.changeMessageSendingState(false);
603
605
  this.replyMessage = null;
604
606
  this.messageBody = '';
607
+ this.mentionUserList = [];
605
608
  }
606
609
  }
607
610
  }
@@ -684,7 +687,7 @@ class ChatFooter {
684
687
  }
685
688
  }
686
689
  async uploadAndSendMedia(presignedUrls, attachments, conversationId, oldMessageId) {
687
- var _a, _b, _c, _d;
690
+ var _a, _b, _c;
688
691
  const allPayloads = [];
689
692
  const uploadPromises = presignedUrls.map(async (urlDetails, index) => {
690
693
  let mediaId, mediaUrl, thumbnailUrl, mediaPresignedUrl;
@@ -752,8 +755,10 @@ class ChatFooter {
752
755
  metaData: this.getReplyMetadata(),
753
756
  };
754
757
  let payloadForGroupcastMessage = Object.assign(Object.assign({}, payload), { hideNewConversationsForSender: false, groupcastId: this.groupcastId, notifyOnCompletion: true, sendPushForNewConversationCreated: true });
755
- if (((_d = this.mentionUserList) === null || _d === void 0 ? void 0 : _d.length) > 0) {
756
- payload['mentionedUsers'] = this.mentionUserList;
758
+ const mentionedUsers = this.mentionedUsersForApi(caption);
759
+ if (mentionedUsers.length > 0) {
760
+ payload['mentionedUsers'] = mentionedUsers;
761
+ payloadForGroupcastMessage['mentionedUsers'] = mentionedUsers;
757
762
  }
758
763
  try {
759
764
  let sendMessageRes;
@@ -763,6 +768,7 @@ class ChatFooter {
763
768
  else {
764
769
  sendMessageRes = await ChatSDK.getInstance().message.postMessages(payload);
765
770
  }
771
+ this.mentionUserList = [];
766
772
  this.updateMessageWithApiResponse(sendMessageRes.messageId, oldMessageId);
767
773
  this.replyMessage = null;
768
774
  showToast({
@@ -814,7 +820,7 @@ class ChatFooter {
814
820
  const webChat = findWebChatHost(this.el);
815
821
  const hasCustomReply = (webChat ? hasNamedSlot(webChat, 'reply-preview') : false) || hasNamedSlot(this.el, 'reply-preview');
816
822
  const showAttachment = this.attachmentDetails || this.showCamera;
817
- return (h(Host, { key: '4aecc1f90f540e9082f8abbaf4faadbbcd549fd4', class: { 'attachment-open': !!showAttachment } }, h("div", { key: 'f11f01df71447e564785543322ad9cefffb2df19', class: "chat-footer-container" }, showAttachment ? (h("slot", { name: "attachment-preview" }, h("attachment-preview", { showCamera: this.showCamera, onClose: this.handleClearAttachment, width: "150px", height: "150px", bgColor: "var(--bg-primary-light)", padding: "3px", margin: "10px 0 0 0", contentType: contentType, content: this.mediaPreviews, onSend: this.handleSendMessage, "onfile-uploaded": this.handleFileUpload, "onattachment-removed": this.handleRemoveAttachment, "oncamera-retake": this.handleCameraRetake, key: this.inputKey, inputValue: this.messageBody, "oninput-change": this.handleInputChange, backgroundColor: "var(--bg-primary-color)", containerBoxShadow: "none", inputFontColor: "var(--text-primary-color)", inputBorderRadius: "10px", conversationDetails: this.conversationDetails, userMetaData: this.userMetaData }))) : (h(Fragment, null, hasCustomReply ? h("slot", { name: "reply-preview" }) : null, h("slot", { name: "composer-input" }, !hasCustomReply && this.replyMessage ? (h("reply-block", { messageBody: (_a = this.replyMessage) === null || _a === void 0 ? void 0 : _a.body, messageInfo: this.replyMessage, senderName: ((_b = this.userMetaData) === null || _b === void 0 ? void 0 : _b.userId) === ((_d = (_c = this.replyMessage) === null || _c === void 0 ? void 0 : _c.senderInfo) === null || _d === void 0 ? void 0 : _d.userId)
823
+ return (h(Host, { key: 'de774ccefb329af2fe95f29fc90fa4cad874af9c', class: { 'attachment-open': !!showAttachment } }, h("div", { key: '0e8d6829943505e92e45c38980c827b57366902c', class: "chat-footer-container" }, showAttachment ? (h("slot", { name: "attachment-preview" }, h("attachment-preview", { showCamera: this.showCamera, onClose: this.handleClearAttachment, width: "150px", height: "150px", bgColor: "var(--bg-primary-light)", padding: "3px", margin: "10px 0 0 0", contentType: contentType, content: this.mediaPreviews, onSend: this.handleSendMessage, "onfile-uploaded": this.handleFileUpload, "onattachment-removed": this.handleRemoveAttachment, "oncamera-retake": this.handleCameraRetake, key: this.inputKey, inputValue: this.messageBody, "oninput-change": this.handleInputChange, backgroundColor: "var(--bg-primary-color)", containerBoxShadow: "none", inputFontColor: "var(--text-primary-color)", inputBorderRadius: "10px", conversationDetails: this.conversationDetails, userMetaData: this.userMetaData }))) : (h(Fragment, null, hasCustomReply ? h("slot", { name: "reply-preview" }) : null, h("slot", { name: "composer-input" }, !hasCustomReply && this.replyMessage ? (h("reply-block", { messageBody: (_a = this.replyMessage) === null || _a === void 0 ? void 0 : _a.body, messageInfo: this.replyMessage, senderName: ((_b = this.userMetaData) === null || _b === void 0 ? void 0 : _b.userId) === ((_d = (_c = this.replyMessage) === null || _c === void 0 ? void 0 : _c.senderInfo) === null || _d === void 0 ? void 0 : _d.userId)
818
824
  ? 'You'
819
825
  : (_f = (_e = this.replyMessage) === null || _e === void 0 ? void 0 : _e.senderInfo) === null || _f === void 0 ? void 0 : _f.userName, onIconClick: this.handleremoveReplyMessage })) : null, h("div", { class: "composer-wrap", key: this.inputKey, ref: el => (this.composerWrapRef = el) }, this.showEmojiPicker ? (h("div", { class: "emoji-panel", style: this.emojiPanelStyle }, h("div", { class: "emoji-panel-header" }, h("span", null, "Emoji"), h("button", { class: "emoji-panel-close", type: "button", "aria-label": "Close", onClick: this.handleEmojiToggle }, "\u00D7")), h("emoji-picker", { class: "emoji-picker light", ref: this.bindEmojiPicker }))) : null, h("div", { class: { composer: true, recording: this.isRecording } }, this.isRecording ? (h("div", { class: "rec-body" }, h("div", { class: "rec-left" }, h("button", { class: "rec-icon-btn danger", type: "button", title: "Delete recording", "aria-label": "Delete recording", onClick: this.handleRecDelete }, h("img", { class: "theme-icon", src: Delete, alt: "" })), h("div", { class: "rec-timer-wrap" }, h("span", { class: { 'rec-dot': true, live: !this.isPaused } }), h("span", { class: "rec-timer" }, this.formatRecTime(this.recordingSeconds)))), h("div", { class: "rec-wave" }, h("audio-bubble", { liveRecord: true, audioProgressColor: "#2563eb", audioWaveColor: "#2563eb", ref: el => (this.recBubble = el), onRecordingProgress: this.onRecordingProgress, onRecordingError: this.onRecordingError })), h("button", { class: { 'rec-icon-btn': true, 'rec-toggle': true, pause: !this.isPaused }, type: "button", title: this.isPaused ? 'Resume recording' : 'Pause recording', "aria-label": this.isPaused ? 'Resume recording' : 'Pause recording', onClick: this.handleRecPauseToggle }, h("img", { class: "theme-icon", src: this.isPaused ? PlayIcon : PauseIcon, alt: "" })), h("button", { class: "rec-send", type: "button", title: "Send voice note", "aria-label": "Send voice note", onClick: this.handleRecSend }, h("img", { src: Send, alt: "" })))) : (h(Fragment, null, h("div", { class: "attach-wrap" }, h("button", { class: "icon-btn", type: "button", title: "Attach file", "aria-label": "Attach", onClick: this.handleAttachClick }, h("img", { src: Attachment, alt: "" })), this.showAttachMenu ? (h("div", { class: "attach-menu", style: this.attachMenuStyle }, h("button", { class: "attach-opt", type: "button", onClick: this.pickDocument }, h("span", { class: "attach-opt-icon attach-opt-icon--doc" }, h("img", { src: DocumentsIcon, alt: "" })), h("span", null, "Document")), h("button", { class: "attach-opt", type: "button", onClick: this.pickPhotos }, h("span", { class: "attach-opt-icon attach-opt-icon--photos" }, h("img", { class: "theme-icon", src: PhotosIcon, alt: "" })), h("span", null, "Photos & videos")), h("button", { class: "attach-opt", type: "button", onClick: this.pickCamera }, h("span", { class: "attach-opt-icon attach-opt-icon--camera" }, h("img", { class: "theme-icon", src: CameraIcon, alt: "" })), h("span", null, "Camera")))) : null), h("button", { class: "icon-btn", type: "button", title: "Emojis", "aria-label": "Emojis", onClick: this.handleEmojiToggle }, h("img", { src: Smile, alt: "" })), h("input", { class: "file-input", type: "file", multiple: true, accept: ".jpg,.jpeg,.png,.gif,.webp,.bmp,.heic,.mp4,.mov,.webm,.mkv,.mp3,.wav,.m4a,.aac,.ogg", ref: el => (this.mediaInputRef = el), onChange: this.handleNativeFileChange }), h("input", { class: "file-input", type: "file", multiple: true, accept: ".pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.csv,.rtf,application/*", ref: el => (this.docInputRef = el), onChange: this.handleNativeFileChange }), h("textarea", { class: "composer-input", rows: 1, placeholder: "Type a message", value: this.messageBody, ref: el => (this.inputRef = el), onInput: this.handleComposerInput, onKeyDown: this.handleComposerKeyDown }), this.messageBody.trim() ? (h("button", { class: "icon-btn", type: "button", title: "Send", "aria-label": "Send", onClick: this.handleSendMessage }, h("img", { src: Send, alt: "" }))) : (h("button", { class: "icon-btn", type: "button", title: "Voice note", "aria-label": "Voice note", onClick: this.handleMicClick }, h("img", { src: Microphone, alt: "" })))))))))))));
820
826
  }