@banbox/chat 1.0.10 → 1.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.
- package/dist/index.cjs +9 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +9 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/chat/ChatRoot.tsx +14 -1
- package/src/chat/InboxPopup.tsx +4 -1
- package/src/chat/SinglePopup.tsx +4 -1
package/package.json
CHANGED
package/src/chat/ChatRoot.tsx
CHANGED
|
@@ -32,9 +32,20 @@ export type ChatRootProps = {
|
|
|
32
32
|
* <ChatRoot adapter={adapter} theme="admin" />
|
|
33
33
|
*/
|
|
34
34
|
theme?: ChatTheme;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Keys of footer toolbar actions to hide.
|
|
38
|
+
*
|
|
39
|
+
* Available keys: "attachment" | "emoji" | "businessCard" | "addressCard" | "translate"
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* // Hide the Delivery Address button in the seller app:
|
|
43
|
+
* <ChatRoot hiddenActionKeys={["addressCard"]} ... />
|
|
44
|
+
*/
|
|
45
|
+
hiddenActionKeys?: string[];
|
|
35
46
|
};
|
|
36
47
|
|
|
37
|
-
export default function ChatRoot({ adapter, uiCallbacks, theme }: ChatRootProps) {
|
|
48
|
+
export default function ChatRoot({ adapter, uiCallbacks, theme, hiddenActionKeys }: ChatRootProps) {
|
|
38
49
|
const { isOpen, variant } = useChatUI();
|
|
39
50
|
|
|
40
51
|
// Lock page scroll whenever the chat is open
|
|
@@ -55,6 +66,7 @@ export default function ChatRoot({ adapter, uiCallbacks, theme }: ChatRootProps)
|
|
|
55
66
|
adapter={adapter}
|
|
56
67
|
uiCallbacks={uiCallbacks}
|
|
57
68
|
theme={theme}
|
|
69
|
+
hiddenActionKeys={hiddenActionKeys}
|
|
58
70
|
/>
|
|
59
71
|
) : (
|
|
60
72
|
<SinglePopup
|
|
@@ -62,6 +74,7 @@ export default function ChatRoot({ adapter, uiCallbacks, theme }: ChatRootProps)
|
|
|
62
74
|
adapter={adapter}
|
|
63
75
|
uiCallbacks={uiCallbacks}
|
|
64
76
|
theme={theme}
|
|
77
|
+
hiddenActionKeys={hiddenActionKeys}
|
|
65
78
|
/>
|
|
66
79
|
)
|
|
67
80
|
)}
|
package/src/chat/InboxPopup.tsx
CHANGED
|
@@ -34,6 +34,8 @@ export type InboxPopupProps = {
|
|
|
34
34
|
adapter: ChatAdapter;
|
|
35
35
|
uiCallbacks?: ChatUICallbacks;
|
|
36
36
|
theme?: ChatTheme;
|
|
37
|
+
/** Keys of footer toolbar actions to hide. e.g. ["addressCard", "translate"] */
|
|
38
|
+
hiddenActionKeys?: string[];
|
|
37
39
|
};
|
|
38
40
|
|
|
39
41
|
/* ─── Helpers ─── */
|
|
@@ -50,7 +52,7 @@ const avatarBgByInitial: Record<string, string> = {
|
|
|
50
52
|
/* ══════════════════════════════════════════════════
|
|
51
53
|
Component
|
|
52
54
|
══════════════════════════════════════════════════ */
|
|
53
|
-
const InboxPopup: React.FC<InboxPopupProps> = ({ adapter, uiCallbacks, theme }) => {
|
|
55
|
+
const InboxPopup: React.FC<InboxPopupProps> = ({ adapter, uiCallbacks, theme, hiddenActionKeys }) => {
|
|
54
56
|
const { close, selectThread, selectedThreadId, reference } = useChatUI();
|
|
55
57
|
const { isOpen: isGalleryOpen, closeGallery } = useGallery();
|
|
56
58
|
|
|
@@ -337,6 +339,7 @@ const InboxPopup: React.FC<InboxPopupProps> = ({ adapter, uiCallbacks, theme })
|
|
|
337
339
|
replyTo={replyTo}
|
|
338
340
|
clearReply={() => setReplyTo(undefined)}
|
|
339
341
|
onAfterSend={() => setRev((v) => v + 1)}
|
|
342
|
+
hiddenActionKeys={hiddenActionKeys}
|
|
340
343
|
onSend={(payload) => {
|
|
341
344
|
if (activeId) adapter.messages.send(activeId, payload);
|
|
342
345
|
}}
|
package/src/chat/SinglePopup.tsx
CHANGED
|
@@ -55,12 +55,14 @@ export type SinglePopupProps = {
|
|
|
55
55
|
adapter: ChatAdapter;
|
|
56
56
|
uiCallbacks?: ChatUICallbacks;
|
|
57
57
|
theme?: ChatTheme;
|
|
58
|
+
/** Keys of footer toolbar actions to hide. e.g. ["addressCard", "translate"] */
|
|
59
|
+
hiddenActionKeys?: string[];
|
|
58
60
|
};
|
|
59
61
|
|
|
60
62
|
/* ══════════════════════════════════════════════════
|
|
61
63
|
Component
|
|
62
64
|
══════════════════════════════════════════════════ */
|
|
63
|
-
const SinglePopup: React.FC<SinglePopupProps> = ({ adapter, uiCallbacks, theme }) => {
|
|
65
|
+
const SinglePopup: React.FC<SinglePopupProps> = ({ adapter, uiCallbacks, theme, hiddenActionKeys }) => {
|
|
64
66
|
const { close, reference } = useChatUI();
|
|
65
67
|
const { isOpen: isGalleryOpen, closeGallery } = useGallery();
|
|
66
68
|
|
|
@@ -258,6 +260,7 @@ const SinglePopup: React.FC<SinglePopupProps> = ({ adapter, uiCallbacks, theme }
|
|
|
258
260
|
replyTo={replyTo}
|
|
259
261
|
clearReply={() => setReplyTo(undefined)}
|
|
260
262
|
onAfterSend={handleAfterSend}
|
|
263
|
+
hiddenActionKeys={hiddenActionKeys}
|
|
261
264
|
onSend={(payload) => {
|
|
262
265
|
if (activeId) adapter.messages.send(activeId, payload);
|
|
263
266
|
}}
|