@droppii-org/chat-sdk 0.1.70 → 0.1.72
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/components/conversation-detail/ConversationDetailInput.d.ts +3 -1
- package/dist/components/conversation-detail/ConversationDetailInput.d.ts.map +1 -1
- package/dist/components/conversation-detail/ConversationDetailInput.js +2 -2
- package/dist/components/conversation-detail/ConversationMoreOptionPanel.d.ts +2 -1
- package/dist/components/conversation-detail/ConversationMoreOptionPanel.d.ts.map +1 -1
- package/dist/components/conversation-detail/ConversationMoreOptionPanel.js +9 -5
- package/dist/components/conversation-detail/bot/BotButtonMessage.d.ts.map +1 -1
- package/dist/components/conversation-detail/bot/BotButtonMessage.js +6 -4
- package/dist/components/media-collection/FileCollection.d.ts.map +1 -1
- package/dist/components/media-collection/FileCollection.js +1 -2
- package/dist/components/message/footer/FilePreview.d.ts +0 -6
- package/dist/components/message/footer/FilePreview.d.ts.map +1 -1
- package/dist/components/message/footer/FilePreview.js +1 -17
- package/dist/components/message/item/FileMessage.d.ts.map +1 -1
- package/dist/components/message/item/FileMessage.js +1 -2
- package/dist/components/message/item/TextMessage.d.ts.map +1 -1
- package/dist/components/message/item/TextMessage.js +0 -6
- package/dist/components/message/item/index.d.ts.map +1 -1
- package/dist/components/message/item/index.js +2 -8
- package/dist/components/message/item/renderMessageContent.d.ts.map +1 -1
- package/dist/components/message/item/renderMessageContent.js +3 -0
- package/dist/components/message/reply/ReplyQuoteContent.d.ts.map +1 -1
- package/dist/components/message/reply/ReplyQuoteContent.js +1 -1
- package/dist/constants/botFlow.d.ts +2 -0
- package/dist/constants/botFlow.d.ts.map +1 -1
- package/dist/constants/botFlow.js +2 -0
- package/dist/constants/moreOption.d.ts +11 -0
- package/dist/constants/moreOption.d.ts.map +1 -1
- package/dist/constants/moreOption.js +14 -0
- package/dist/context/ChatContext.d.ts +1 -1
- package/dist/context/ChatContext.d.ts.map +1 -1
- package/dist/context/ChatContext.js +2 -1
- package/dist/hooks/conversation/useBotConversationDetail.d.ts +1 -0
- package/dist/hooks/conversation/useBotConversationDetail.d.ts.map +1 -1
- package/dist/hooks/conversation/useBotConversationDetail.js +5 -4
- package/dist/hooks/conversation/useBotMainMenu.d.ts +4 -0
- package/dist/hooks/conversation/useBotMainMenu.d.ts.map +1 -0
- package/dist/hooks/conversation/useBotMainMenu.js +16 -0
- package/dist/hooks/conversation/useResolveConversation.d.ts +11 -0
- package/dist/hooks/conversation/useResolveConversation.d.ts.map +1 -0
- package/dist/hooks/conversation/useResolveConversation.js +90 -0
- package/dist/hooks/conversation/useSwitchToCsTeam.d.ts +6 -0
- package/dist/hooks/conversation/useSwitchToCsTeam.d.ts.map +1 -0
- package/dist/hooks/conversation/useSwitchToCsTeam.js +41 -0
- package/dist/hooks/message/useMessage.d.ts +1 -0
- package/dist/hooks/message/useMessage.d.ts.map +1 -1
- package/dist/hooks/message/useMessage.js +12 -0
- package/dist/hooks/message/useSendMessage.d.ts +9 -2
- package/dist/hooks/message/useSendMessage.d.ts.map +1 -1
- package/dist/hooks/message/useSendMessage.js +50 -4
- package/dist/index.d.ts +14 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -0
- package/dist/locales/vi/common.json +2 -0
- package/dist/locales/vi/conversation-inbox.json +1 -0
- package/dist/screens/conversation-detail/index.d.ts +3 -2
- package/dist/screens/conversation-detail/index.d.ts.map +1 -1
- package/dist/screens/conversation-detail/index.js +15 -1
- package/dist/screens/conversation-inbox/index.d.ts +3 -1
- package/dist/screens/conversation-inbox/index.d.ts.map +1 -1
- package/dist/screens/conversation-inbox/index.js +2 -2
- package/dist/services/query.d.ts +2 -0
- package/dist/services/query.d.ts.map +1 -1
- package/dist/services/query.js +2 -0
- package/dist/services/routes.d.ts +2 -0
- package/dist/services/routes.d.ts.map +1 -1
- package/dist/services/routes.js +2 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/chat.d.ts +5 -2
- package/dist/types/chat.d.ts.map +1 -1
- package/dist/types/chat.js +4 -4
- package/dist/types/conversation.d.ts +4 -0
- package/dist/types/conversation.d.ts.map +1 -1
- package/dist/utils/botFlow.d.ts +7 -0
- package/dist/utils/botFlow.d.ts.map +1 -0
- package/dist/utils/botFlow.js +9 -0
- package/dist/utils/common.d.ts +9 -0
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/common.js +34 -3
- package/package.json +1 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { MoreOptionConfig } from "../../constants/moreOption";
|
|
1
2
|
export interface ConversationDetailInputProps {
|
|
2
3
|
placeholder?: string;
|
|
3
4
|
onSendMessage?: (text: string) => void;
|
|
4
5
|
onInputChange?: (value: string) => void;
|
|
6
|
+
moreOptions?: MoreOptionConfig[];
|
|
5
7
|
}
|
|
6
|
-
declare const ConversationDetailInput: ({ placeholder, onSendMessage, onInputChange, }: ConversationDetailInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare const ConversationDetailInput: ({ placeholder, onSendMessage, onInputChange, moreOptions, }: ConversationDetailInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
9
|
export default ConversationDetailInput;
|
|
8
10
|
//# sourceMappingURL=ConversationDetailInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationDetailInput.d.ts","sourceRoot":"","sources":["../../../src/components/conversation-detail/ConversationDetailInput.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConversationDetailInput.d.ts","sourceRoot":"","sources":["../../../src/components/conversation-detail/ConversationDetailInput.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAK/D,MAAM,WAAW,4BAA4B;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,WAAW,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAClC;AAED,QAAA,MAAM,uBAAuB,GAAI,6DAK9B,4BAA4B,4CA8Y9B,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
|
@@ -20,7 +20,7 @@ import { ReplyPreviewBar } from "../../components/message/reply/ReplyPreviewBar"
|
|
|
20
20
|
import ConversationMoreOptionPanel from "./ConversationMoreOptionPanel";
|
|
21
21
|
const MAX_LINES = 5;
|
|
22
22
|
const CONTAINER_MIN_HEIGHT = 48;
|
|
23
|
-
const ConversationDetailInput = ({ placeholder, onSendMessage, onInputChange, }) => {
|
|
23
|
+
const ConversationDetailInput = ({ placeholder, onSendMessage, onInputChange, moreOptions, }) => {
|
|
24
24
|
const { t } = useTranslation("conversation-inbox");
|
|
25
25
|
const { t: tCommon } = useTranslation("common");
|
|
26
26
|
const conversationData = useConversationStore((state) => state.conversationData);
|
|
@@ -254,6 +254,6 @@ const ConversationDetailInput = ({ placeholder, onSendMessage, onInputChange, })
|
|
|
254
254
|
};
|
|
255
255
|
return (_jsxs("div", { ref: containerRef, "data-testid": "conversation-detail-input", className: "flex w-full shrink-0 flex-col bg-chat-bubble-neutral/[0.05]", children: [_jsx("input", { ref: mediaInputRef, type: "file", accept: "image/jpeg,image/png,image/jpg,video/*", multiple: true, className: "hidden", onChange: handleMediaInputChange }), _jsx("input", { ref: documentInputRef, type: "file", accept: ".pdf,.doc,.docx", multiple: true, className: "hidden", onChange: handleDocumentInputChange }), _jsx(ReplyPreviewBar, {}), listUploadFiles.length > 0 && (_jsx(FilePreviewList, { files: listUploadFiles, onRemove: (file) => handleRemoveFile(file.uid), onVideoReady: () => setIsVideoLoading(false) })), showLinkPreview && previewUrl && (_jsx(LinkInputPreview, { url: previewUrl, onRemove: () => setPreviewDismissed(true) })), _jsxs("div", { className: "flex items-end gap-3 px-3 py-2", children: [_jsx("div", { className: "flex shrink-0 items-center", children: _jsx("button", { type: "button", onClick: handleToggleMoreOption, "aria-label": t("thread_detail.more_option.toggle"), "aria-expanded": isMoreOptionOpen, "data-testid": "conversation-detail-more-option-toggle", className: "flex py-3 items-center justify-center rounded-full", children: isMoreOptionOpen ? (_jsx(Icon, { icon: "close-circle-b", size: 24, className: "text-primary-400" })) : (_jsx(Icon, { icon: "plus-circle-o", size: 24, className: "text-gray-900" })) }) }), _jsx("div", { className: clsx("flex min-w-0 flex-1 overflow-hidden rounded-xl border bg-white transition-shadow", isFocused
|
|
256
256
|
? "border-primary-200 shadow-primary-focus"
|
|
257
|
-
: "border-gray-50"), style: { minHeight: CONTAINER_MIN_HEIGHT }, children: _jsx("div", { className: "flex min-w-0 flex-[1_0_0] items-center gap-2 self-stretch px-3 py-1", children: _jsx("textarea", { ref: textareaRef, value: value, rows: 1, onChange: (event) => handleChange(event.target.value), onFocus: handleFocus, onBlur: handleBlur, onKeyDown: handleKeyDown, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t("thread_detail.input_placeholder"), "data-testid": "conversation-detail-message-input", className: "conversation-message-input-scrollbar min-h-0 min-w-0 flex-1 resize-none appearance-none border-0 bg-transparent p-0 text-[16px] leading-[1.6] tracking-[0.16px] text-black outline-none ring-0 placeholder:text-gray-400 focus:border-0 focus:outline-none focus:ring-0" }) }) }), _jsx("div", { className: "flex shrink-0 items-center pb-1", children: _jsx("button", { type: "button", onClick: () => void handleSend(), disabled: !canSend, "data-testid": "conversation-detail-send", className: clsx("flex h-10 w-10 items-center justify-center rounded-full", canSend ? "bg-chat-send" : "bg-chat-send opacity-25"), children: _jsx(Icon, { icon: "send-b", size: 20, className: "text-white" }) }) })] }), isMoreOptionOpen && (_jsx(ConversationMoreOptionPanel, { disabled: !isConversationReady, onTriggerMediaInput: () => { var _a; return (_a = mediaInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, onTriggerDocumentInput: () => { var _a; return (_a = documentInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); } }))] }));
|
|
257
|
+
: "border-gray-50"), style: { minHeight: CONTAINER_MIN_HEIGHT }, children: _jsx("div", { className: "flex min-w-0 flex-[1_0_0] items-center gap-2 self-stretch px-3 py-1", children: _jsx("textarea", { ref: textareaRef, value: value, rows: 1, onChange: (event) => handleChange(event.target.value), onFocus: handleFocus, onBlur: handleBlur, onKeyDown: handleKeyDown, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t("thread_detail.input_placeholder"), "data-testid": "conversation-detail-message-input", className: "conversation-message-input-scrollbar min-h-0 min-w-0 flex-1 resize-none appearance-none border-0 bg-transparent p-0 text-[16px] leading-[1.6] tracking-[0.16px] text-black outline-none ring-0 placeholder:text-gray-400 focus:border-0 focus:outline-none focus:ring-0" }) }) }), _jsx("div", { className: "flex shrink-0 items-center pb-1", children: _jsx("button", { type: "button", onClick: () => void handleSend(), disabled: !canSend, "data-testid": "conversation-detail-send", className: clsx("flex h-10 w-10 items-center justify-center rounded-full", canSend ? "bg-chat-send" : "bg-chat-send opacity-25"), children: _jsx(Icon, { icon: "send-b", size: 20, className: "text-white" }) }) })] }), isMoreOptionOpen && (_jsx(ConversationMoreOptionPanel, { disabled: !isConversationReady, options: moreOptions, onTriggerMediaInput: () => { var _a; return (_a = mediaInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, onTriggerDocumentInput: () => { var _a; return (_a = documentInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); } }))] }));
|
|
258
258
|
};
|
|
259
259
|
export default ConversationDetailInput;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { MoreOptionConfig } from "../../constants/moreOption";
|
|
2
2
|
export interface ConversationMoreOptionPanelProps {
|
|
3
3
|
disabled?: boolean;
|
|
4
|
+
options?: MoreOptionConfig[];
|
|
4
5
|
onSelectOption?: (option: MoreOptionConfig) => void;
|
|
5
6
|
onTriggerMediaInput?: () => void;
|
|
6
7
|
onTriggerDocumentInput?: () => void;
|
|
7
8
|
}
|
|
8
|
-
declare const ConversationMoreOptionPanel: ({ disabled, onSelectOption, onTriggerMediaInput, onTriggerDocumentInput, }: ConversationMoreOptionPanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const ConversationMoreOptionPanel: ({ disabled, options, onSelectOption, onTriggerMediaInput, onTriggerDocumentInput, }: ConversationMoreOptionPanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
export default ConversationMoreOptionPanel;
|
|
10
11
|
//# sourceMappingURL=ConversationMoreOptionPanel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationMoreOptionPanel.d.ts","sourceRoot":"","sources":["../../../src/components/conversation-detail/ConversationMoreOptionPanel.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,gBAAgB,
|
|
1
|
+
{"version":3,"file":"ConversationMoreOptionPanel.d.ts","sourceRoot":"","sources":["../../../src/components/conversation-detail/ConversationMoreOptionPanel.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,gBAAgB,EAEjB,MAAM,wBAAwB,CAAC;AAGhC,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC7B,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACpD,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,sBAAsB,CAAC,EAAE,MAAM,IAAI,CAAC;CACrC;AAED,QAAA,MAAM,2BAA2B,GAAI,qFAMlC,gCAAgC,4CAkClC,CAAC;AAEF,eAAe,2BAA2B,CAAC"}
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback } from "react";
|
|
4
|
-
import { MORE_OPTIONS, } from "../../constants/moreOption";
|
|
4
|
+
import { MORE_OPTIONS, MoreOptionKey, } from "../../constants/moreOption";
|
|
5
5
|
import ConversationMoreOptionItem from "./ConversationMoreOptionItem";
|
|
6
|
-
const ConversationMoreOptionPanel = ({ disabled = false, onSelectOption, onTriggerMediaInput, onTriggerDocumentInput, }) => {
|
|
6
|
+
const ConversationMoreOptionPanel = ({ disabled = false, options = MORE_OPTIONS, onSelectOption, onTriggerMediaInput, onTriggerDocumentInput, }) => {
|
|
7
7
|
const handleSelectOption = useCallback((option) => {
|
|
8
|
-
if (option.
|
|
8
|
+
if (option.key === MoreOptionKey.Media) {
|
|
9
9
|
onTriggerMediaInput === null || onTriggerMediaInput === void 0 ? void 0 : onTriggerMediaInput();
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
|
-
if (option.
|
|
12
|
+
if (option.key === MoreOptionKey.Document) {
|
|
13
13
|
onTriggerDocumentInput === null || onTriggerDocumentInput === void 0 ? void 0 : onTriggerDocumentInput();
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
|
+
if (option.onSelect) {
|
|
17
|
+
option.onSelect();
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
16
20
|
onSelectOption === null || onSelectOption === void 0 ? void 0 : onSelectOption(option);
|
|
17
21
|
}, [onSelectOption, onTriggerMediaInput, onTriggerDocumentInput]);
|
|
18
|
-
return (_jsx("div", { "data-testid": "conversation-more-option-panel", className: "grid grid-cols-4 gap-y-5 bg-white py-5", children:
|
|
22
|
+
return (_jsx("div", { "data-testid": "conversation-more-option-panel", className: "grid grid-cols-4 gap-y-5 bg-white py-5", children: options.map((option) => (_jsx(ConversationMoreOptionItem, { option: Object.assign(Object.assign({}, option), { enabled: option.enabled && !disabled }), onSelect: handleSelectOption }, option.key))) }));
|
|
19
23
|
};
|
|
20
24
|
export default ConversationMoreOptionPanel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BotButtonMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation-detail/bot/BotButtonMessage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BotButtonMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/conversation-detail/bot/BotButtonMessage.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAI5D,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,QAAA,MAAM,gBAAgB,GAAI,6CAKvB,qBAAqB,mDA8EvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -5,12 +5,14 @@ import { useTranslation } from "react-i18next";
|
|
|
5
5
|
import { Icon } from "../../../components/icon";
|
|
6
6
|
import MessageBubble from "../../../components/message/item/MessageBubble";
|
|
7
7
|
import { BOT_BUTTON_MENU_THRESHOLD, BOT_DEFAULT_BUTTON_ID, } from "../../../constants/botFlow";
|
|
8
|
+
import { filterVisibleBotButtons } from "../../../utils/botFlow";
|
|
8
9
|
const CHEVRON_SIZE = 20;
|
|
9
10
|
const BotButtonMessage = ({ buttons, disabled, onSelect, onRestart, }) => {
|
|
10
11
|
const { t } = useTranslation("conversation-inbox");
|
|
11
|
-
|
|
12
|
+
const visibleButtons = filterVisibleBotButtons(buttons);
|
|
13
|
+
if (visibleButtons.length === 0)
|
|
12
14
|
return null;
|
|
13
|
-
const isMenuStyle =
|
|
15
|
+
const isMenuStyle = visibleButtons.length > BOT_BUTTON_MENU_THRESHOLD;
|
|
14
16
|
const handleSelect = (actionId) => {
|
|
15
17
|
if (disabled)
|
|
16
18
|
return;
|
|
@@ -20,9 +22,9 @@ const BotButtonMessage = ({ buttons, disabled, onSelect, onRestart, }) => {
|
|
|
20
22
|
}
|
|
21
23
|
onSelect(actionId);
|
|
22
24
|
};
|
|
23
|
-
const optionsNode = isMenuStyle ? (_jsx("div", { className: "flex flex-col overflow-hidden rounded-xl bg-white", children:
|
|
25
|
+
const optionsNode = isMenuStyle ? (_jsx("div", { className: "flex flex-col overflow-hidden rounded-xl bg-white", children: visibleButtons.map((option, index) => (_jsxs("button", { type: "button", disabled: disabled, onClick: () => handleSelect(option.id), className: clsx("flex items-center gap-4 px-3 py-2 text-left transition-colors", index !== visibleButtons.length - 1 && "border-b border-gray-25", disabled && "cursor-not-allowed opacity-60"), children: [_jsx("span", { className: "flex-1 text-[16px] font-medium leading-[1.6] text-gray-900", children: option.id === BOT_DEFAULT_BUTTON_ID
|
|
24
26
|
? t("thread_detail.bot.restart")
|
|
25
|
-
: option.label }), _jsx(Icon, { icon: "angle-right-o", size: CHEVRON_SIZE, className: "text-gray-900" })] }, option.id))) })) : (_jsx("div", { className: "flex flex-col gap-2", children:
|
|
27
|
+
: option.label }), _jsx(Icon, { icon: "angle-right-o", size: CHEVRON_SIZE, className: "text-gray-900" })] }, option.id))) })) : (_jsx("div", { className: "flex flex-col gap-2", children: visibleButtons.map((option) => (_jsx("button", { type: "button", disabled: disabled, onClick: () => handleSelect(option.id), className: clsx("flex flex-1 items-center justify-center gap-2 rounded-lg border border-primary-400 bg-primary-25 px-3 py-2", "text-center text-[14px] font-[510] leading-[160%] text-primary-400 transition-colors", disabled && "cursor-not-allowed opacity-60"), children: _jsx("span", { children: option.id === BOT_DEFAULT_BUTTON_ID
|
|
26
28
|
? t("thread_detail.bot.restart")
|
|
27
29
|
: option.label }) }, option.id))) }));
|
|
28
30
|
return (_jsx("div", { className: "flex min-w-0 flex-col gap-2 px-3 py-1 sm:px-4", children: _jsx("div", { className: "flex min-w-0 items-end justify-start pl-3 pr-12", children: _jsx("div", { className: "flex min-w-0 max-w-[75%] flex-col items-start", children: _jsx(MessageBubble, { isMine: false, content: optionsNode }) }) }) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileCollection.d.ts","sourceRoot":"","sources":["../../../src/components/media-collection/FileCollection.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FileCollection.d.ts","sourceRoot":"","sources":["../../../src/components/media-collection/FileCollection.tsx"],"names":[],"mappings":"AAYA,QAAA,MAAM,cAAc,+CAqGnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -8,8 +8,7 @@ import dayjs from "dayjs";
|
|
|
8
8
|
import useConversationStore from "../../store/conversation";
|
|
9
9
|
import { useTranslation } from "react-i18next";
|
|
10
10
|
import { documentIcon } from "../../assets/svg";
|
|
11
|
-
import { shortenFileName } from "../../
|
|
12
|
-
import { renderFileSize } from "../../utils/common";
|
|
11
|
+
import { renderFileSize, shortenFileName } from "../../utils/common";
|
|
13
12
|
const FileCollection = () => {
|
|
14
13
|
const { t } = useTranslation();
|
|
15
14
|
const selectedSourceId = useConversationStore((state) => state.selectedSourceId);
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import { UploadFile } from "antd";
|
|
2
|
-
interface ShortenOptions {
|
|
3
|
-
maxLength?: number;
|
|
4
|
-
keepStart?: number;
|
|
5
|
-
keepEnd?: number;
|
|
6
|
-
}
|
|
7
|
-
export declare const shortenFileName: (name?: string, options?: ShortenOptions) => string;
|
|
8
2
|
export declare function FilePreviewList({ files, onRemove, onVideoReady, }: {
|
|
9
3
|
files: UploadFile[];
|
|
10
4
|
onRemove: (file: UploadFile) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilePreview.d.ts","sourceRoot":"","sources":["../../../../src/components/message/footer/FilePreview.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"FilePreview.d.ts","sourceRoot":"","sources":["../../../../src/components/message/footer/FilePreview.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AA6IlC,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,QAAQ,EACR,YAAY,GACb,EAAE;IACD,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;IACrC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B,kDAsBA;AAED,QAAA,MAAM,WAAW,+CAQhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -5,23 +5,7 @@ import { useMessageFooterContext } from ".";
|
|
|
5
5
|
import { Icon } from "../../../components/icon";
|
|
6
6
|
import { documentIcon } from "../../../assets/svg";
|
|
7
7
|
import { DOCUMENT_MIME_TYPES } from "../../../utils/fileValidation";
|
|
8
|
-
import { formatDuration } from "../../../utils/common";
|
|
9
|
-
export const shortenFileName = (name, options = {}) => {
|
|
10
|
-
if (!name)
|
|
11
|
-
return "";
|
|
12
|
-
const { maxLength = 20, keepStart = 8, keepEnd = 3 } = options;
|
|
13
|
-
if (name.length <= maxLength)
|
|
14
|
-
return name;
|
|
15
|
-
const dotIndex = name.lastIndexOf(".");
|
|
16
|
-
const ext = dotIndex !== -1 ? name.slice(dotIndex) : "";
|
|
17
|
-
const base = dotIndex !== -1 ? name.slice(0, dotIndex) : name;
|
|
18
|
-
const available = maxLength - ext.length - 3;
|
|
19
|
-
const startLen = keepStart !== null && keepStart !== void 0 ? keepStart : Math.floor(available / 2);
|
|
20
|
-
const endLen = keepEnd !== null && keepEnd !== void 0 ? keepEnd : Math.floor(available / 2);
|
|
21
|
-
const start = base.slice(0, startLen);
|
|
22
|
-
const end = base.slice(-endLen);
|
|
23
|
-
return `${start}...${end}${ext}`;
|
|
24
|
-
};
|
|
8
|
+
import { formatDuration, shortenFileName } from "../../../utils/common";
|
|
25
9
|
const formatFileSize = (bytes) => {
|
|
26
10
|
if (bytes === 0)
|
|
27
11
|
return "0 B";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/message/item/FileMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"FileMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/message/item/FileMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiB,MAAM,yBAAyB,CAAC;AAMrE,UAAU,oBAAoB;IAC5B,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,QAAA,MAAM,eAAe,GAAI,OAAO,oBAAoB,4CAiEnD,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -3,8 +3,7 @@ import { MessageStatus } from "@openim/wasm-client-sdk";
|
|
|
3
3
|
import { Spin } from "antd";
|
|
4
4
|
import { Icon } from "../../../components/icon";
|
|
5
5
|
import { documentIcon } from "../../../assets/svg";
|
|
6
|
-
import { shortenFileName } from "../../../
|
|
7
|
-
import { renderFileSize } from "../../../utils/common";
|
|
6
|
+
import { renderFileSize, shortenFileName } from "../../../utils/common";
|
|
8
7
|
const FileMessageItem = (props) => {
|
|
9
8
|
var _a;
|
|
10
9
|
const { message } = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/message/item/TextMessage.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"TextMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/message/item/TextMessage.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAOtD,UAAU,oBAAoB;IAC5B,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,QAAA,MAAM,eAAe,GAAI,OAAO,oBAAoB,mDAgDnD,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
-
import { MessageType } from "@openim/wasm-client-sdk";
|
|
5
|
-
import useAuthStore from "../../../store/auth";
|
|
6
4
|
import { htmlHasFormatting, sanitizeHtml, stripHtml } from "../../../utils/common";
|
|
7
5
|
import { extractLinkUrls } from "../../../utils/link";
|
|
8
6
|
import LinkText from "./LinkText";
|
|
@@ -10,7 +8,6 @@ import { MESSAGE_TEXT_CLASS } from "./textStyle";
|
|
|
10
8
|
const TextMessageItem = (props) => {
|
|
11
9
|
var _a, _b, _c, _d;
|
|
12
10
|
const { message } = props;
|
|
13
|
-
const isCrm = useAuthStore((state) => state.isCrm);
|
|
14
11
|
let extendMessageInfo = null;
|
|
15
12
|
try {
|
|
16
13
|
extendMessageInfo = JSON.parse((message === null || message === void 0 ? void 0 : message.ex) || "{}");
|
|
@@ -19,9 +16,6 @@ const TextMessageItem = (props) => {
|
|
|
19
16
|
extendMessageInfo = {};
|
|
20
17
|
console.error("Failed to parse extendMessageInfo", error);
|
|
21
18
|
}
|
|
22
|
-
if ((message === null || message === void 0 ? void 0 : message.contentType) === MessageType.CustomMessage && !isCrm) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
19
|
const richHtmlContent = ((_b = (_a = extendMessageInfo === null || extendMessageInfo === void 0 ? void 0 : extendMessageInfo.messageInfo) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.content) || "";
|
|
26
20
|
if (richHtmlContent && htmlHasFormatting(richHtmlContent)) {
|
|
27
21
|
const sanitizedContent = sanitizeHtml(richHtmlContent);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/message/item/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,WAAW,IAAI,eAAe,EAG/B,MAAM,yBAAyB,CAAC;AAiCjC,UAAU,gBAAgB;IACxB,OAAO,EAAE,eAAe,CAAC;IACzB,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,uBAAuB,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD,eAAe,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;IACpD,mBAAmB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;IAClD,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;IACpD,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAeD,QAAA,MAAM,WAAW,GAAI,qMAalB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/message/item/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,WAAW,IAAI,eAAe,EAG/B,MAAM,yBAAyB,CAAC;AAiCjC,UAAU,gBAAgB;IACxB,OAAO,EAAE,eAAe,CAAC;IACzB,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,uBAAuB,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD,eAAe,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;IACpD,mBAAmB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;IAClD,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;IACpD,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAeD,QAAA,MAAM,WAAW,GAAI,qMAalB,gBAAgB,mDA8QlB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { Dropdown, message as toastMessage } from "antd";
|
|
|
6
6
|
import { MessageStatus, MessageType, } from "@openim/wasm-client-sdk";
|
|
7
7
|
import MessageBubble from "./MessageBubble";
|
|
8
8
|
import { renderBubbleContent } from "./renderMessageContent";
|
|
9
|
-
import { getVisibleNeighbor,
|
|
9
|
+
import { getVisibleNeighbor, isMessageHiddenForViewer, } from "../../../hooks/message/useMessage";
|
|
10
10
|
import { MSG_ITEM_CONTENT_PREFIX, MSG_ITEM_PREFIX } from "../../../constants";
|
|
11
11
|
import { formatTimestamp } from "../../../utils/common";
|
|
12
12
|
import useAuthStore from "../../../store/auth";
|
|
@@ -127,13 +127,7 @@ const MessageItem = ({ message, allMessages, isGroupChat = false, forceHideTip =
|
|
|
127
127
|
const showAvatar = showPeerInfo && !isMine && !nextSameUser;
|
|
128
128
|
const showSenderName = showPeerInfo && !isMine && !prevSameUser;
|
|
129
129
|
const showTip = forceHideTip ? false : !nextSameUser;
|
|
130
|
-
if (
|
|
131
|
-
return null;
|
|
132
|
-
}
|
|
133
|
-
if ((!isCrm &&
|
|
134
|
-
(MessageType.CustomMessage === (message === null || message === void 0 ? void 0 : message.contentType) ||
|
|
135
|
-
isSystemLogMessage)) ||
|
|
136
|
-
!visibleTypeMessage.includes(message === null || message === void 0 ? void 0 : message.contentType)) {
|
|
130
|
+
if (isMessageHiddenForViewer(message, isCrm)) {
|
|
137
131
|
return null;
|
|
138
132
|
}
|
|
139
133
|
const messageContainerProps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderMessageContent.d.ts","sourceRoot":"","sources":["../../../../src/components/message/item/renderMessageContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,IAAI,eAAe,EAAe,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"renderMessageContent.d.ts","sourceRoot":"","sources":["../../../../src/components/message/item/renderMessageContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,IAAI,eAAe,EAAe,MAAM,yBAAyB,CAAC;AAYtF,eAAO,MAAM,mBAAmB,GAAI,SAAS,eAAe,4CAyB3D,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,SAAS,eAAe,EACxB,sBAAsB,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,4CAwBpD,CAAC"}
|
|
@@ -9,6 +9,7 @@ import UrlTextMessageItem from "./UrlTextMessage";
|
|
|
9
9
|
import RevokeMessageItem from "./RevokeMessage";
|
|
10
10
|
import QuoteMessageItem from "./QuoteMessage";
|
|
11
11
|
import SystemLogMessageItem from "./SystemLogMessage";
|
|
12
|
+
import CustomMessageItem from "./CustomMessage";
|
|
12
13
|
export const renderMessageByType = (message) => {
|
|
13
14
|
switch (message === null || message === void 0 ? void 0 : message.contentType) {
|
|
14
15
|
case MessageType.TextMessage:
|
|
@@ -28,6 +29,8 @@ export const renderMessageByType = (message) => {
|
|
|
28
29
|
return _jsx(SystemLogMessageItem, { message: message });
|
|
29
30
|
case MessageType.RevokeMessage:
|
|
30
31
|
return _jsx(RevokeMessageItem, {});
|
|
32
|
+
case MessageType.CustomMessage:
|
|
33
|
+
return _jsx(CustomMessageItem, { message: message });
|
|
31
34
|
default:
|
|
32
35
|
return _jsx(TextMessageItem, { message: message });
|
|
33
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReplyQuoteContent.d.ts","sourceRoot":"","sources":["../../../../src/components/message/reply/ReplyQuoteContent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AASnE,eAAO,MAAM,oBAAoB,GAAI,aAAa,WAAW,YACb,CAAC;AAEjD,UAAU,sBAAsB;IAC9B,OAAO,EAAE,WAAW,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,iBAAiB,GAAI,qBAG/B,sBAAsB,
|
|
1
|
+
{"version":3,"file":"ReplyQuoteContent.d.ts","sourceRoot":"","sources":["../../../../src/components/message/reply/ReplyQuoteContent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AASnE,eAAO,MAAM,oBAAoB,GAAI,aAAa,WAAW,YACb,CAAC;AAEjD,UAAU,sBAAsB;IAC9B,OAAO,EAAE,WAAW,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,iBAAiB,GAAI,qBAG/B,sBAAsB,4CA2BxB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -15,6 +15,6 @@ export const ReplyQuoteContent = ({ message, title = "", }) => {
|
|
|
15
15
|
return (_jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-0.5 pr-2 self-stretch", children: [_jsx("div", { className: "w-[3px] shrink-0 self-stretch rounded bg-gray-cool-200" }), hasMedia && _jsx(ReplyPreviewMedia, { message: message }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col justify-center py-1 pl-2", children: [_jsx("p", { className: "truncate text-[14px] font-medium leading-[160%] text-gray-900", children: title }), _jsx("p", { className: "truncate text-[13px] leading-[160%] text-gray-400", children: generateContentBasedOnMessageType(message.contentType, ((_a = message.textElem) === null || _a === void 0 ? void 0 : _a.content) || ((_b = message.quoteElem) === null || _b === void 0 ? void 0 : _b.text), t, {
|
|
16
16
|
duration: (_c = message.videoElem) === null || _c === void 0 ? void 0 : _c.duration,
|
|
17
17
|
fileName: (_d = message.fileElem) === null || _d === void 0 ? void 0 : _d.fileName,
|
|
18
|
-
}) })] })] }));
|
|
18
|
+
}, message.customElem) })] })] }));
|
|
19
19
|
};
|
|
20
20
|
export default ReplyQuoteContent;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export declare const BOT_DEFAULT_BUTTON_ID = "default-item-button";
|
|
2
2
|
export declare const BOT_BUTTON_MENU_THRESHOLD = 3;
|
|
3
|
+
export declare const BOT_HIDDEN_COMMAND_PREFIX = "context:";
|
|
4
|
+
export declare const BOT_COMMAND_CHAT_WITH_CS = "context:chat_with_cs";
|
|
3
5
|
//# sourceMappingURL=botFlow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"botFlow.d.ts","sourceRoot":"","sources":["../../src/constants/botFlow.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,wBAAwB,CAAC;AAE3D,eAAO,MAAM,yBAAyB,IAAI,CAAC"}
|
|
1
|
+
{"version":3,"file":"botFlow.d.ts","sourceRoot":"","sources":["../../src/constants/botFlow.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,wBAAwB,CAAC;AAE3D,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C,eAAO,MAAM,yBAAyB,aAAa,CAAC;AAEpD,eAAO,MAAM,wBAAwB,yBAAyB,CAAC"}
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
+
export declare const MoreOptionKey: {
|
|
2
|
+
readonly Media: "media";
|
|
3
|
+
readonly Camera: "camera";
|
|
4
|
+
readonly Document: "document";
|
|
5
|
+
readonly Order: "order";
|
|
6
|
+
readonly Product: "product";
|
|
7
|
+
readonly Appointment: "appointment";
|
|
8
|
+
};
|
|
9
|
+
export type MoreOptionKey = (typeof MoreOptionKey)[keyof typeof MoreOptionKey];
|
|
1
10
|
export interface MoreOptionConfig {
|
|
11
|
+
key: string;
|
|
2
12
|
icon: string;
|
|
3
13
|
labelKey: string;
|
|
4
14
|
enabled: boolean;
|
|
15
|
+
onSelect?: () => void;
|
|
5
16
|
}
|
|
6
17
|
export declare const DEFAULT_MORE_OPTIONS: MoreOptionConfig[];
|
|
7
18
|
export declare function createMoreOptions(extraOptions?: MoreOptionConfig[]): MoreOptionConfig[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moreOption.d.ts","sourceRoot":"","sources":["../../src/constants/moreOption.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"moreOption.d.ts","sourceRoot":"","sources":["../../src/constants/moreOption.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;;;CAOhB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE/E,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,eAAO,MAAM,oBAAoB,EAAE,gBAAgB,EAmBlD,CAAC;AAEF,wBAAgB,iBAAiB,CAC/B,YAAY,GAAE,gBAAgB,EAAO,GACpC,gBAAgB,EAAE,CAEpB;AAED,eAAO,MAAM,YAAY,EAAE,gBAAgB,EAmBzC,CAAC"}
|
|
@@ -1,15 +1,26 @@
|
|
|
1
|
+
export const MoreOptionKey = {
|
|
2
|
+
Media: "media",
|
|
3
|
+
Camera: "camera",
|
|
4
|
+
Document: "document",
|
|
5
|
+
Order: "order",
|
|
6
|
+
Product: "product",
|
|
7
|
+
Appointment: "appointment",
|
|
8
|
+
};
|
|
1
9
|
export const DEFAULT_MORE_OPTIONS = [
|
|
2
10
|
{
|
|
11
|
+
key: MoreOptionKey.Media,
|
|
3
12
|
icon: "image-02-o",
|
|
4
13
|
labelKey: "thread_detail.more_option.media",
|
|
5
14
|
enabled: true,
|
|
6
15
|
},
|
|
7
16
|
{
|
|
17
|
+
key: MoreOptionKey.Camera,
|
|
8
18
|
icon: "camera-o",
|
|
9
19
|
labelKey: "thread_detail.more_option.camera",
|
|
10
20
|
enabled: false,
|
|
11
21
|
},
|
|
12
22
|
{
|
|
23
|
+
key: MoreOptionKey.Document,
|
|
13
24
|
icon: "paperclip-o",
|
|
14
25
|
labelKey: "thread_detail.more_option.document",
|
|
15
26
|
enabled: true,
|
|
@@ -20,16 +31,19 @@ export function createMoreOptions(extraOptions = []) {
|
|
|
20
31
|
}
|
|
21
32
|
export const MORE_OPTIONS = createMoreOptions([
|
|
22
33
|
{
|
|
34
|
+
key: MoreOptionKey.Order,
|
|
23
35
|
icon: "receipt-o",
|
|
24
36
|
labelKey: "thread_detail.more_option.order",
|
|
25
37
|
enabled: false,
|
|
26
38
|
},
|
|
27
39
|
{
|
|
40
|
+
key: MoreOptionKey.Product,
|
|
28
41
|
icon: "shopping-basket-o",
|
|
29
42
|
labelKey: "thread_detail.more_option.product",
|
|
30
43
|
enabled: false,
|
|
31
44
|
},
|
|
32
45
|
{
|
|
46
|
+
key: MoreOptionKey.Appointment,
|
|
33
47
|
icon: "calendar-active-o",
|
|
34
48
|
labelKey: "thread_detail.more_option.appointment",
|
|
35
49
|
enabled: false,
|
|
@@ -2,5 +2,5 @@ import "../styles/global.css";
|
|
|
2
2
|
import { ChatContextType, ChatProviderProps } from "../types/chat";
|
|
3
3
|
export declare const ChatContext: import("react").Context<ChatContextType>;
|
|
4
4
|
export declare const useChatContext: () => ChatContextType;
|
|
5
|
-
export declare const ChatProvider: ({ children, config }: ChatProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const ChatProvider: ({ children, config, renderCustomMessage, }: ChatProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
//# sourceMappingURL=ChatContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatContext.d.ts","sourceRoot":"","sources":["../../src/context/ChatContext.tsx"],"names":[],"mappings":"AAEA,OAAO,sBAAsB,CAAC;AAG9B,OAAO,EACL,eAAe,EACf,iBAAiB,EAGlB,MAAM,cAAc,CAAC;AAStB,eAAO,MAAM,WAAW,0CAOtB,CAAC;AAEH,eAAO,MAAM,cAAc,uBAAgC,CAAC;AAE5D,eAAO,MAAM,YAAY,GAAI,
|
|
1
|
+
{"version":3,"file":"ChatContext.d.ts","sourceRoot":"","sources":["../../src/context/ChatContext.tsx"],"names":[],"mappings":"AAEA,OAAO,sBAAsB,CAAC;AAG9B,OAAO,EACL,eAAe,EACf,iBAAiB,EAGlB,MAAM,cAAc,CAAC;AAStB,eAAO,MAAM,WAAW,0CAOtB,CAAC;AAEH,eAAO,MAAM,cAAc,uBAAgC,CAAC;AAE5D,eAAO,MAAM,YAAY,GAAI,4CAI1B,iBAAiB,4CAsGnB,CAAC"}
|
|
@@ -18,7 +18,7 @@ export const ChatContext = createContext({
|
|
|
18
18
|
updateSyncStatus: () => { },
|
|
19
19
|
});
|
|
20
20
|
export const useChatContext = () => useContext(ChatContext);
|
|
21
|
-
export const ChatProvider = ({ children, config }) => {
|
|
21
|
+
export const ChatProvider = ({ children, config, renderCustomMessage, }) => {
|
|
22
22
|
const [connectStatus, setConnectStatus] = useState(ConnectStatus.Disconnected);
|
|
23
23
|
const [syncStatus, setSyncStatus] = useState(SyncStatus.Success);
|
|
24
24
|
const [user, setUser] = useState(null);
|
|
@@ -91,5 +91,6 @@ export const ChatProvider = ({ children, config }) => {
|
|
|
91
91
|
getSelfUserInfo,
|
|
92
92
|
updateConnectStatus,
|
|
93
93
|
updateSyncStatus,
|
|
94
|
+
renderCustomMessage,
|
|
94
95
|
}, children: _jsx(ConfigProvider, { getPopupContainer: (triggerNode) => document.body, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(MainLayout, { children: children }) }) }) }));
|
|
95
96
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { BotConversationDetail } from "../../types/conversation";
|
|
2
|
+
export declare const fetchBotConversationDetail: (conversationId: string) => Promise<BotConversationDetail>;
|
|
2
3
|
export declare const useBotConversationDetail: (conversationId: string, enabled: boolean) => import("@tanstack/react-query").UseQueryResult<BotConversationDetail, Error>;
|
|
3
4
|
//# sourceMappingURL=useBotConversationDetail.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBotConversationDetail.d.ts","sourceRoot":"","sources":["../../../src/hooks/conversation/useBotConversationDetail.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAElE,eAAO,MAAM,wBAAwB,GACnC,gBAAgB,MAAM,EACtB,SAAS,OAAO,
|
|
1
|
+
{"version":3,"file":"useBotConversationDetail.d.ts","sourceRoot":"","sources":["../../../src/hooks/conversation/useBotConversationDetail.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAElE,eAAO,MAAM,0BAA0B,GACrC,gBAAgB,MAAM,KACrB,OAAO,CAAC,qBAAqB,CAK/B,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACnC,gBAAgB,MAAM,EACtB,SAAS,OAAO,iFAUjB,CAAC"}
|
|
@@ -3,13 +3,14 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
3
3
|
import { apiInstance } from "../../services/api";
|
|
4
4
|
import { ENDPOINTS } from "../../services/routes";
|
|
5
5
|
import { QUERY_KEYS } from "../../services/query";
|
|
6
|
+
export const fetchBotConversationDetail = async (conversationId) => {
|
|
7
|
+
const res = await apiInstance.get(ENDPOINTS.chatService.getConversationDetail(conversationId));
|
|
8
|
+
return res.data.data;
|
|
9
|
+
};
|
|
6
10
|
export const useBotConversationDetail = (conversationId, enabled) => {
|
|
7
11
|
return useQuery({
|
|
8
12
|
queryKey: [QUERY_KEYS.GET_CONVERSATION_DETAIL, conversationId],
|
|
9
|
-
queryFn:
|
|
10
|
-
const res = await apiInstance.get(ENDPOINTS.chatService.getConversationDetail(conversationId));
|
|
11
|
-
return res.data.data;
|
|
12
|
-
},
|
|
13
|
+
queryFn: () => fetchBotConversationDetail(conversationId),
|
|
13
14
|
enabled: enabled && !!conversationId,
|
|
14
15
|
staleTime: 0,
|
|
15
16
|
refetchOnWindowFocus: false,
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BotMainMenuItem } from "../../types/conversation";
|
|
2
|
+
export declare const fetchBotMainMenu: (conversationId: string) => Promise<BotMainMenuItem[]>;
|
|
3
|
+
export declare const useBotMainMenu: (conversationId: string, enabled: boolean) => import("@tanstack/react-query").UseQueryResult<BotMainMenuItem[], Error>;
|
|
4
|
+
//# sourceMappingURL=useBotMainMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBotMainMenu.d.ts","sourceRoot":"","sources":["../../../src/hooks/conversation/useBotMainMenu.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,eAAO,MAAM,gBAAgB,GAC3B,gBAAgB,MAAM,KACrB,OAAO,CAAC,eAAe,EAAE,CAK3B,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,gBAAgB,MAAM,EAAE,SAAS,OAAO,6EAMtE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { apiInstance } from "../../services/api";
|
|
4
|
+
import { ENDPOINTS } from "../../services/routes";
|
|
5
|
+
import { QUERY_KEYS } from "../../services/query";
|
|
6
|
+
export const fetchBotMainMenu = async (conversationId) => {
|
|
7
|
+
const res = await apiInstance.get(ENDPOINTS.chatService.getBotMainMenu(conversationId));
|
|
8
|
+
return res.data.data || [];
|
|
9
|
+
};
|
|
10
|
+
export const useBotMainMenu = (conversationId, enabled) => {
|
|
11
|
+
return useQuery({
|
|
12
|
+
queryKey: [QUERY_KEYS.GET_BOT_MAIN_MENU, conversationId],
|
|
13
|
+
queryFn: () => fetchBotMainMenu(conversationId),
|
|
14
|
+
enabled: enabled && !!conversationId,
|
|
15
|
+
});
|
|
16
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface UseResolveConversationParams {
|
|
2
|
+
conversationId?: string;
|
|
3
|
+
userId?: string;
|
|
4
|
+
groupId?: string;
|
|
5
|
+
botId?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const useResolveConversation: ({ conversationId, userId, groupId, botId, }: UseResolveConversationParams) => {
|
|
8
|
+
isResolving: boolean;
|
|
9
|
+
error: Error | null;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=useResolveConversation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResolveConversation.d.ts","sourceRoot":"","sources":["../../../src/hooks/conversation/useResolveConversation.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,4BAA4B;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAOD,eAAO,MAAM,sBAAsB,GAAI,6CAKpC,4BAA4B;;;CAmG9B,CAAC"}
|