@droppii-org/chat-mobile 0.2.29 → 0.2.30
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/lib/module/components/flows/inputButtons/index.js +6 -3
- package/lib/module/components/flows/inputButtons/index.js.map +1 -1
- package/lib/module/config/api-endpoints.js +2 -1
- package/lib/module/config/api-endpoints.js.map +1 -1
- package/lib/module/context/ChatDetailContext.js +35 -2
- package/lib/module/context/ChatDetailContext.js.map +1 -1
- package/lib/module/context/index.js +1 -0
- package/lib/module/context/index.js.map +1 -1
- package/lib/module/hooks/conversation/useGetConversationDetail.js +58 -0
- package/lib/module/hooks/conversation/useGetConversationDetail.js.map +1 -0
- package/lib/module/hooks/flows/useFlow.js +1 -1
- package/lib/module/hooks/flows/useFlow.js.map +1 -1
- package/lib/module/hooks/flows/useGetConversationFlowMainMenu.js +17 -0
- package/lib/module/hooks/flows/useGetConversationFlowMainMenu.js.map +1 -0
- package/lib/module/hooks/message/useSendMessage.js +32 -7
- package/lib/module/hooks/message/useSendMessage.js.map +1 -1
- package/lib/module/hooks/query-keys.js +4 -1
- package/lib/module/hooks/query-keys.js.map +1 -1
- package/lib/module/hooks/useChatCompose.js +0 -1
- package/lib/module/hooks/useChatCompose.js.map +1 -1
- package/lib/module/index.js +4 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatAttachmentPanel.js +4 -14
- package/lib/module/screens/chat-detail/ChatAttachmentPanel.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatComposer.js +26 -15
- package/lib/module/screens/chat-detail/ChatComposer.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatDetail.js +58 -71
- package/lib/module/screens/chat-detail/ChatDetail.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatDetailHeader.js +7 -10
- package/lib/module/screens/chat-detail/ChatDetailHeader.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatListLegend.js +1 -1
- package/lib/module/screens/chat-detail/ChatListLegend.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatLoadEarlier.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatQuickActions.js +2 -1
- package/lib/module/screens/chat-detail/ChatQuickActions.js.map +1 -1
- package/lib/module/screens/chat-detail/constants.js +30 -24
- package/lib/module/screens/chat-detail/constants.js.map +1 -1
- package/lib/module/screens/chat-detail/index.js +2 -2
- package/lib/module/screens/chat-detail/index.js.map +1 -1
- package/lib/module/screens/chat-detail/types.js +15 -1
- package/lib/module/screens/chat-detail/types.js.map +1 -1
- package/lib/module/services/attachmentHandlers/imageAttachmentHandler.js +2 -2
- package/lib/module/services/attachmentHandlers/imageAttachmentHandler.js.map +1 -1
- package/lib/module/services/endpoints.js +3 -1
- package/lib/module/services/endpoints.js.map +1 -1
- package/lib/module/translation/resources/i18n.js +7 -1
- package/lib/module/translation/resources/i18n.js.map +1 -1
- package/lib/module/types/chat.js +9 -0
- package/lib/module/types/chat.js.map +1 -1
- package/lib/module/types/flows.js +5 -0
- package/lib/module/types/flows.js.map +1 -1
- package/lib/module/utils/flows.js +5 -0
- package/lib/module/utils/flows.js.map +1 -1
- package/lib/module/utils/imageUtils.js +0 -3
- package/lib/module/utils/imageUtils.js.map +1 -1
- package/lib/module/utils/messageUtils.js +5 -19
- package/lib/module/utils/messageUtils.js.map +1 -1
- package/lib/typescript/src/components/flows/inputButtons/index.d.ts.map +1 -1
- package/lib/typescript/src/config/api-endpoints.d.ts +1 -0
- package/lib/typescript/src/config/api-endpoints.d.ts.map +1 -1
- package/lib/typescript/src/context/ChatDetailContext.d.ts +1 -1
- package/lib/typescript/src/context/ChatDetailContext.d.ts.map +1 -1
- package/lib/typescript/src/context/index.d.ts +1 -0
- package/lib/typescript/src/context/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/conversation/useGetConversationDetail.d.ts +17 -0
- package/lib/typescript/src/hooks/conversation/useGetConversationDetail.d.ts.map +1 -0
- package/lib/typescript/src/hooks/flows/useGetConversationFlowMainMenu.d.ts +3 -0
- package/lib/typescript/src/hooks/flows/useGetConversationFlowMainMenu.d.ts.map +1 -0
- package/lib/typescript/src/hooks/message/useSendMessage.d.ts +5 -4
- package/lib/typescript/src/hooks/message/useSendMessage.d.ts.map +1 -1
- package/lib/typescript/src/hooks/query-keys.d.ts +3 -0
- package/lib/typescript/src/hooks/query-keys.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +6 -4
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatAttachmentPanel.d.ts +2 -2
- package/lib/typescript/src/screens/chat-detail/ChatAttachmentPanel.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts +3 -1
- package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetailHeader.d.ts +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetailHeader.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatLoadEarlier.d.ts +3 -2
- package/lib/typescript/src/screens/chat-detail/ChatLoadEarlier.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatQuickActions.d.ts +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatQuickActions.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/constants.d.ts +3 -3
- package/lib/typescript/src/screens/chat-detail/constants.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/index.d.ts +3 -3
- package/lib/typescript/src/screens/chat-detail/index.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/types.d.ts +28 -19
- package/lib/typescript/src/screens/chat-detail/types.d.ts.map +1 -1
- package/lib/typescript/src/services/endpoints.d.ts +2 -0
- package/lib/typescript/src/services/endpoints.d.ts.map +1 -1
- package/lib/typescript/src/store/conversation.d.ts +1 -1
- package/lib/typescript/src/store/conversation.d.ts.map +1 -1
- package/lib/typescript/src/translation/resources/i18n.d.ts.map +1 -1
- package/lib/typescript/src/types/chat.d.ts +26 -2
- package/lib/typescript/src/types/chat.d.ts.map +1 -1
- package/lib/typescript/src/types/flows.d.ts +3 -0
- package/lib/typescript/src/types/flows.d.ts.map +1 -1
- package/lib/typescript/src/utils/flows.d.ts +2 -0
- package/lib/typescript/src/utils/flows.d.ts.map +1 -1
- package/lib/typescript/src/utils/imageUtils.d.ts +0 -1
- package/lib/typescript/src/utils/imageUtils.d.ts.map +1 -1
- package/lib/typescript/src/utils/messageUtils.d.ts +1 -1
- package/lib/typescript/src/utils/messageUtils.d.ts.map +1 -1
- package/package.json +3 -5
- package/src/components/flows/inputButtons/index.tsx +11 -3
- package/src/config/api-endpoints.ts +2 -0
- package/src/context/ChatDetailContext.tsx +57 -4
- package/src/context/index.ts +1 -0
- package/src/hooks/conversation/useGetConversationDetail.ts +78 -0
- package/src/hooks/flows/useFlow.ts +1 -1
- package/src/hooks/flows/useGetConversationFlowMainMenu.ts +19 -0
- package/src/hooks/message/useSendMessage.ts +43 -14
- package/src/hooks/query-keys.ts +6 -0
- package/src/hooks/useChatCompose.ts +1 -1
- package/src/index.tsx +15 -6
- package/src/screens/chat-detail/ChatAttachmentPanel.tsx +8 -25
- package/src/screens/chat-detail/ChatComposer.tsx +26 -21
- package/src/screens/chat-detail/ChatDetail.tsx +61 -77
- package/src/screens/chat-detail/ChatDetailHeader.tsx +7 -18
- package/src/screens/chat-detail/ChatListLegend.tsx +1 -1
- package/src/screens/chat-detail/ChatLoadEarlier.tsx +1 -2
- package/src/screens/chat-detail/ChatQuickActions.tsx +6 -2
- package/src/screens/chat-detail/constants.ts +33 -27
- package/src/screens/chat-detail/index.ts +5 -8
- package/src/screens/chat-detail/types.ts +30 -28
- package/src/services/attachmentHandlers/imageAttachmentHandler.ts +2 -2
- package/src/services/endpoints.ts +4 -0
- package/src/store/conversation.ts +1 -1
- package/src/translation/resources/i18n.ts +6 -0
- package/src/types/chat.ts +31 -1
- package/src/types/flows.ts +4 -0
- package/src/utils/flows.ts +7 -0
- package/src/utils/imageUtils.ts +0 -4
- package/src/utils/messageUtils.ts +7 -22
- package/lib/module/screens/chat-detail/ChatDay.js +0 -65
- package/lib/module/screens/chat-detail/ChatDay.js.map +0 -1
- package/lib/module/types/message.js +0 -17
- package/lib/module/types/message.js.map +0 -1
- package/lib/module/utils/resolveMessageType.js +0 -47
- package/lib/module/utils/resolveMessageType.js.map +0 -1
- package/lib/typescript/src/screens/chat-detail/ChatDay.d.ts +0 -3
- package/lib/typescript/src/screens/chat-detail/ChatDay.d.ts.map +0 -1
- package/lib/typescript/src/types/message.d.ts +0 -16
- package/lib/typescript/src/types/message.d.ts.map +0 -1
- package/lib/typescript/src/utils/resolveMessageType.d.ts +0 -4
- package/lib/typescript/src/utils/resolveMessageType.d.ts.map +0 -1
- package/src/screens/chat-detail/ChatDay.tsx +0 -73
- package/src/types/message.ts +0 -18
- package/src/utils/resolveMessageType.ts +0 -51
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatDetail.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/ChatDetail.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChatDetail.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/ChatDetail.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAO/C,QAAA,MAAM,UAAU,8PAgBX,eAAe,iCAoHnB,CAAC;AAQF,eAAe,UAAU,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ChatDetailHeaderProps } from './types';
|
|
2
|
-
declare const ChatDetailHeader: import("react").MemoExoticComponent<({
|
|
2
|
+
declare const ChatDetailHeader: import("react").MemoExoticComponent<({ showAddMember, conversationId, onBack, onPressSearch, onPressAddMember, onPressMenu, onPressAvatar, }: ChatDetailHeaderProps) => import("react").JSX.Element>;
|
|
3
3
|
export default ChatDetailHeader;
|
|
4
4
|
//# sourceMappingURL=ChatDetailHeader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatDetailHeader.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/ChatDetailHeader.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"ChatDetailHeader.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/ChatDetailHeader.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAIrD,QAAA,MAAM,gBAAgB,gJASjB,qBAAqB,iCAoGzB,CAAC;AAIF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare const ChatLoadEarlier: import("react").MemoExoticComponent<({ isLoading }: {
|
|
2
|
+
isLoading: boolean;
|
|
3
|
+
}) => import("react").JSX.Element>;
|
|
3
4
|
//# sourceMappingURL=ChatLoadEarlier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatLoadEarlier.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/ChatLoadEarlier.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChatLoadEarlier.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/ChatLoadEarlier.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe,sDACF;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,iCAW/C,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ChatQuickActionsProps } from './types';
|
|
2
2
|
export declare const ChatQuickActions: import("react").MemoExoticComponent<({ visible, actions, onActionPress, renderAction, renderQuickActions, }: ChatQuickActionsProps) => import("react").JSX.Element>;
|
|
3
3
|
//# sourceMappingURL=ChatQuickActions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatQuickActions.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/ChatQuickActions.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ChatQuickActions.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/ChatQuickActions.tsx"],"names":[],"mappings":"AAUA,OAAO,EAEL,KAAK,qBAAqB,EAE3B,MAAM,SAAS,CAAC;AAqDjB,eAAO,MAAM,gBAAgB,+GAOxB,qBAAqB,iCAqDzB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type DChatQuickAction, type DChatPannelAction } from './types';
|
|
2
2
|
export declare const CHAT_BUBBLE_COLORS: {
|
|
3
3
|
readonly received: string;
|
|
4
4
|
readonly sent: string;
|
|
@@ -6,12 +6,12 @@ export declare const CHAT_BUBBLE_COLORS: {
|
|
|
6
6
|
readonly timestamp: any;
|
|
7
7
|
readonly dayLabel: any;
|
|
8
8
|
};
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const DEFAULT_QUICK_ACTIONS: DChatQuickAction[];
|
|
10
10
|
export declare const ATTACHMENT_PANEL_COLUMNS = 4;
|
|
11
11
|
export declare const ATTACHMENT_ITEM_HEIGHT = 100;
|
|
12
12
|
export declare const ATTACHMENT_PANEL_VERTICAL_PADDING = 16;
|
|
13
13
|
export declare const getAttachmentPanelHeight: (actionCount: number, columns?: number) => number;
|
|
14
14
|
/** @deprecated use getAttachmentPanelHeight */
|
|
15
15
|
export declare const DEFAULT_ATTACHMENT_PANEL_HEIGHT: number;
|
|
16
|
-
export declare const
|
|
16
|
+
export declare const DEFAULT_PANNEL_ACTIONS: DChatPannelAction[];
|
|
17
17
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/constants.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/constants.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EAGvB,MAAM,SAAS,CAAC;AAIjB,eAAO,MAAM,kBAAkB;;;;;;CAMrB,CAAC;AAEX,eAAO,MAAM,qBAAqB,EAAE,gBAAgB,EAgBnD,CAAC;AAEF,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAC1C,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,iCAAiC,KAAK,CAAC;AAEpD,eAAO,MAAM,wBAAwB,GACnC,aAAa,MAAM,EACnB,gBAAkC,KACjC,MAGF,CAAC;AAEF,+CAA+C;AAC/C,eAAO,MAAM,+BAA+B,QAA8B,CAAC;AAE3E,eAAO,MAAM,sBAAsB,EAAE,iBAAiB,EA+BrD,CAAC"}
|
|
@@ -3,8 +3,8 @@ export { default as ChatDetailHeader } from './ChatDetailHeader';
|
|
|
3
3
|
export { ChatComposer } from './ChatComposer';
|
|
4
4
|
export { ChatQuickActions } from './ChatQuickActions';
|
|
5
5
|
export { ChatAttachmentPanel } from './ChatAttachmentPanel';
|
|
6
|
-
export {
|
|
6
|
+
export { DEFAULT_QUICK_ACTIONS, DEFAULT_PANNEL_ACTIONS, DEFAULT_ATTACHMENT_PANEL_HEIGHT, } from './constants';
|
|
7
7
|
export { getConversationTitle, getConversationAvatarUri, getConversationSubtitle, shouldShowAddMember, } from './conversationHeader.utils';
|
|
8
|
-
export type { DChatActionItem, DChatActionIconProvider, DChatQuickAction,
|
|
9
|
-
export {
|
|
8
|
+
export type { DChatActionItem, DChatActionIconProvider, DChatQuickAction, DChatPannelAction, ChatDetailProps, ChatDetailHeaderProps, ChatListProps, ChatComposerProps, ChatQuickActionsProps, ChatQuickActionsRenderParams, ChatPanelProps, } from './types';
|
|
9
|
+
export { DChatPannelActionItemType, DChatQuickActionItemType } from './types';
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,+BAA+B,GAChC,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,eAAe,EACf,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,4BAA4B,EAC5B,cAAc,GACf,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { MediaItem } from '../../hooks/useMediaViewer';
|
|
3
3
|
import type { DMessageItem } from '../../types/chat';
|
|
4
|
-
import type { ConversationItem } from '@droppii/openim-rn-client-sdk';
|
|
5
4
|
import type { MeasuredRect } from './messageToolbox/types';
|
|
6
5
|
export type DChatActionIconProvider = 'MaterialCommunityIcons' | 'DroppiiNew';
|
|
6
|
+
export declare enum DChatPannelActionItemType {
|
|
7
|
+
Gallery = "Gallery",
|
|
8
|
+
Camera = "Camera",
|
|
9
|
+
Documents = "Documents",
|
|
10
|
+
SendOrder = "SendOrder",
|
|
11
|
+
SendProduct = "SendProduct",
|
|
12
|
+
CreateAppointment = "CreateAppointment"
|
|
13
|
+
}
|
|
14
|
+
export declare enum DChatQuickActionItemType {
|
|
15
|
+
Restart = "Restart",
|
|
16
|
+
SendOrder = "SendOrder",
|
|
17
|
+
ScamWarning = "ScamWarning"
|
|
18
|
+
}
|
|
7
19
|
export interface DChatActionItem {
|
|
8
|
-
id:
|
|
20
|
+
id: DChatQuickActionItemType | DChatPannelActionItemType;
|
|
9
21
|
label: string;
|
|
10
22
|
iconName: string;
|
|
11
23
|
iconProvider?: DChatActionIconProvider;
|
|
@@ -13,13 +25,13 @@ export interface DChatActionItem {
|
|
|
13
25
|
onPress?: () => void;
|
|
14
26
|
meta?: Record<string, unknown>;
|
|
15
27
|
}
|
|
16
|
-
export
|
|
17
|
-
|
|
28
|
+
export interface DChatQuickAction extends DChatActionItem {
|
|
29
|
+
id: DChatQuickActionItemType;
|
|
30
|
+
}
|
|
31
|
+
export interface DChatPannelAction extends DChatActionItem {
|
|
32
|
+
id: DChatPannelActionItemType;
|
|
33
|
+
}
|
|
18
34
|
export interface ChatDetailHeaderProps {
|
|
19
|
-
title: string;
|
|
20
|
-
subtitle?: string;
|
|
21
|
-
avatarUri?: string | null;
|
|
22
|
-
avatarFullName?: string;
|
|
23
35
|
showAddMember?: boolean;
|
|
24
36
|
onBack?: () => void;
|
|
25
37
|
onPressSearch?: () => void;
|
|
@@ -39,11 +51,9 @@ export interface ChatQuickActionsProps {
|
|
|
39
51
|
renderAction?: (action: DChatQuickAction, onPress: () => void) => ReactNode;
|
|
40
52
|
renderQuickActions?: (params: ChatQuickActionsRenderParams) => ReactNode;
|
|
41
53
|
}
|
|
42
|
-
export interface
|
|
43
|
-
actions?:
|
|
54
|
+
export interface ChatPanelProps {
|
|
55
|
+
actions?: DChatPannelAction[];
|
|
44
56
|
columns?: number;
|
|
45
|
-
onActionPress?: (action: DChatAttachmentAction) => void;
|
|
46
|
-
renderAction?: (action: DChatAttachmentAction, onPress: () => void) => ReactNode;
|
|
47
57
|
}
|
|
48
58
|
export interface ChatComposerProps {
|
|
49
59
|
isEmptyMessage?: boolean;
|
|
@@ -63,16 +73,15 @@ export interface ChatListProps {
|
|
|
63
73
|
onPressUrl?: (url: string) => void;
|
|
64
74
|
onLongPress?: (message: DMessageItem, rect: MeasuredRect) => void;
|
|
65
75
|
}
|
|
66
|
-
export interface ChatDetailProps extends Omit<ChatDetailHeaderProps, '
|
|
67
|
-
|
|
76
|
+
export interface ChatDetailProps extends Omit<ChatDetailHeaderProps, 'showAddMember' | 'conversationId'> {
|
|
77
|
+
targetConversationId?: string;
|
|
78
|
+
targetUserId?: string;
|
|
79
|
+
targetGroupId?: string;
|
|
80
|
+
targetBotId?: string;
|
|
68
81
|
enabled?: boolean;
|
|
69
|
-
title?: string;
|
|
70
|
-
subtitle?: string;
|
|
71
|
-
avatarUri?: string | null;
|
|
72
|
-
avatarFullName?: string;
|
|
73
82
|
showAddMember?: boolean;
|
|
74
|
-
getSubtitle?: (conversation: ConversationItem) => string | undefined;
|
|
75
83
|
onPressUrl?: (url: string) => void;
|
|
76
84
|
customMessageItemFactory?: (item: DMessageItem) => ReactNode;
|
|
85
|
+
pannelActions?: DChatPannelAction[];
|
|
77
86
|
}
|
|
78
87
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,MAAM,uBAAuB,GAAG,wBAAwB,GAAG,YAAY,CAAC;AAE9E,oBAAY,yBAAyB;IACnC,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,WAAW,gBAAgB;IAC3B,iBAAiB,sBAAsB;CACxC;AAED,oBAAY,wBAAwB;IAClC,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,WAAW,gBAAgB;CAC5B;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,wBAAwB,GAAG,yBAAyB,CAAC;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,uBAAuB,CAAC;IACvC,QAAQ,CAAC,EAAE,OA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}
|
|
@@ -10,6 +10,8 @@ export declare const ENDPOINTS: {
|
|
|
10
10
|
conversationFlow: (id: string) => string;
|
|
11
11
|
resetConversationFlow: (id: string) => string;
|
|
12
12
|
runConversationFlow: (id: string) => string;
|
|
13
|
+
getConversationByBotId: (botId: string) => string;
|
|
14
|
+
conversationFlowMainMenu: (id: string) => string;
|
|
13
15
|
};
|
|
14
16
|
uploaderService: {
|
|
15
17
|
readonly uploadImage: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../../../src/services/endpoints.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,cAAc,EACd,cAAc,EACd,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAGjC,eAAO,MAAM,SAAS;;;+BAKK,MAAM;oCAED,MAAM;kCAER,MAAM;;;;;
|
|
1
|
+
{"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../../../src/services/endpoints.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,cAAc,EACd,cAAc,EACd,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAGjC,eAAO,MAAM,SAAS;;;+BAKK,MAAM;oCAED,MAAM;kCAER,MAAM;wCAEA,MAAM;uCAEP,MAAM;;;;;CAQxC,CAAC;AAGF,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -2,7 +2,7 @@ import type { ConversationItem } from '@droppii/openim-rn-client-sdk';
|
|
|
2
2
|
type ConversationID = string;
|
|
3
3
|
export interface ConversationStore {
|
|
4
4
|
currentConversationId?: ConversationID;
|
|
5
|
-
setCurrentConversation(id
|
|
5
|
+
setCurrentConversation(id?: ConversationID): void;
|
|
6
6
|
getCurrentConversation(): ConversationItem | undefined;
|
|
7
7
|
list: ConversationID[];
|
|
8
8
|
map: Record<ConversationID, ConversationItem>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../src/store/conversation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,KAAK,cAAc,GAAG,MAAM,CAAC;AAE7B,MAAM,WAAW,iBAAiB;IAChC,qBAAqB,CAAC,EAAE,cAAc,CAAC;IACvC,sBAAsB,CAAC,EAAE,EAAE,cAAc,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../src/store/conversation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,KAAK,cAAc,GAAG,MAAM,CAAC;AAE7B,MAAM,WAAW,iBAAiB;IAChC,qBAAqB,CAAC,EAAE,cAAc,CAAC;IACvC,sBAAsB,CAAC,EAAE,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAClD,sBAAsB,IAAI,gBAAgB,GAAG,SAAS,CAAC;IACvD,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;IAC9C,6FAA6F;IAC7F,qBAAqB,EAAE,MAAM,CAAC;IAC9B,mBAAmB,CAAC,aAAa,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAAC;IAC7D;;;OAGG;IACH,kBAAkB,CAAC,EAAE,EAAE,cAAc,GAAG,IAAI,CAAC;IAC7C,KAAK,IAAI,IAAI,CAAC;CACf;AAED,eAAO,MAAM,oBAAoB,gFA2C9B,CAAC;AAEJ,eAAO,MAAM,eAAe,GAAI,IAAI,MAAM,KAAG,gBAAgB,GAAG,SAE/D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../../../src/translation/resources/i18n.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../../../src/translation/resources/i18n.ts"],"names":[],"mappings":";;;AA8DA,wBAEE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type MessageItem } from '@droppii/openim-rn-client-sdk';
|
|
1
|
+
import { type ConversationItem, type MessageItem } from '@droppii/openim-rn-client-sdk';
|
|
2
2
|
import type { PropsWithChildren } from 'react';
|
|
3
3
|
import type { IUrlMetadata } from './common';
|
|
4
|
-
import type { IConversationFlow, IConversationFlowStep, IRunConversationFlowPayload } from './flows';
|
|
4
|
+
import type { DFlowContext, IConversationFlow, IConversationFlowStep, IRunConversationFlowPayload } from './flows';
|
|
5
5
|
import type { GetOpenIMTokenResponse } from './auth';
|
|
6
6
|
export declare const EventProvider: {
|
|
7
7
|
readonly ga: "ga";
|
|
@@ -44,6 +44,10 @@ export declare enum DMemberRole {
|
|
|
44
44
|
AGENT = "AGENT",
|
|
45
45
|
MEMBER = "MEMBER"
|
|
46
46
|
}
|
|
47
|
+
export declare enum DFlowState {
|
|
48
|
+
BOT = 1,
|
|
49
|
+
CS = 2
|
|
50
|
+
}
|
|
47
51
|
export interface DConversationPeerUser {
|
|
48
52
|
id: string;
|
|
49
53
|
username?: string;
|
|
@@ -117,6 +121,9 @@ export interface ChatDetailContextType {
|
|
|
117
121
|
refetchConversationFlow: () => void;
|
|
118
122
|
isBotConversation: boolean;
|
|
119
123
|
setConverationFlowStep: (step?: IConversationFlowStep) => void;
|
|
124
|
+
flowState?: DFlowState;
|
|
125
|
+
runButtonContext: (stringContext: DFlowContext) => Promise<boolean>;
|
|
126
|
+
conversation?: ConversationItem;
|
|
120
127
|
}
|
|
121
128
|
export interface ChatDetailProviderProps extends PropsWithChildren {
|
|
122
129
|
}
|
|
@@ -131,5 +138,22 @@ export interface IConversationItemEx {
|
|
|
131
138
|
};
|
|
132
139
|
chatCategory: DChatCategory;
|
|
133
140
|
}
|
|
141
|
+
export declare const CustomMessageType: {
|
|
142
|
+
readonly Order: "Order";
|
|
143
|
+
readonly Product: "Product";
|
|
144
|
+
};
|
|
145
|
+
export type CustomMessageType = (typeof CustomMessageType)[keyof typeof CustomMessageType];
|
|
146
|
+
export type CustomElemOrderData = {
|
|
147
|
+
id: string;
|
|
148
|
+
orderCode: string;
|
|
149
|
+
timestamp: number;
|
|
150
|
+
};
|
|
151
|
+
export type CustomMessagePayload = {
|
|
152
|
+
type: typeof CustomMessageType.Order;
|
|
153
|
+
data: CustomElemOrderData;
|
|
154
|
+
} | {
|
|
155
|
+
type: typeof CustomMessageType.Product;
|
|
156
|
+
data: Record<string, unknown>;
|
|
157
|
+
};
|
|
134
158
|
export {};
|
|
135
159
|
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../../src/types/chat.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../../src/types/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,qBAAqB,EACrB,2BAA2B,EAC5B,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAErD,eAAO,MAAM,aAAa;;;;CAIhB,CAAC;AAEX,KAAK,KAAK,GAAG,CACX,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,GAAG,EACZ,QAAQ,CAAC,EAAE,GAAG,MAAM,OAAO,aAAa,EAAE,KACvC,IAAI,CAAC;AAEV,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,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AAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAC5B;IAAE,IAAI,EAAE,OAAO,iBAAiB,CAAC,KAAK,CAAC;IAAC,IAAI,EAAE,mBAAmB,CAAA;CAAE,GACnE;IAAE,IAAI,EAAE,OAAO,iBAAiB,CAAC,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { PeerType } from '@droppii/openim-rn-client-sdk';
|
|
2
2
|
import type { DChatApplicationType, DChatCategory } from './chat';
|
|
3
|
+
export declare enum DFlowContext {
|
|
4
|
+
CHAT_WITH_CS = "chat_with_cs"
|
|
5
|
+
}
|
|
3
6
|
/** START NODE TYPE */
|
|
4
7
|
export declare const NodeTypes: {
|
|
5
8
|
readonly BubbleText: "bubble-text";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../../../src/types/flows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAElE,sBAAsB;AACtB,eAAO,MAAM,SAAS;;;;;;CAMZ,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAEnE,eAAO,MAAM,mBAAmB;;;CAGtB,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAC7B,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAEjE,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC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B,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,UAAU,EAAE,CAAC;CACxB;AAED,oBAAoB;AAEpB,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,mBAAmB,CAAC;IAC1B,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,aAAa,CAAC;IAC5B,QAAQ,EAAE,QAAQ,CAAC;IACnB,eAAe,EAAE,oBAAoB,CAAC;IACtC,eAAe,EAAE,qBAAqB,GAAG,IAAI,CAAC;CAC/C;AAED,MAAM,WAAW,4BAA4B;IAC3C,YAAY,EAAE,qBAAqB,GAAG,IAAI,CAAC;CAC5C;AAED,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type GroupChild, type IConversationFlowStep } from '../types/flows';
|
|
2
2
|
export declare const getFlowInputButtonsNode: (step?: IConversationFlowStep | null) => GroupChild<"input-buttons">;
|
|
3
3
|
export declare const DEFAULT_BUTTON_ID = "default-item-button";
|
|
4
|
+
export declare const CONTEXT_BUTTON_PREFIX = "context:";
|
|
5
|
+
export declare const isContextButton: (label: string) => boolean;
|
|
4
6
|
//# sourceMappingURL=flows.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../../../src/utils/flows.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC3B,MAAM,gBAAgB,CAAC;AAExB,eAAO,MAAM,uBAAuB,GAClC,OAAO,qBAAqB,GAAG,IAAI,gCAQpC,CAAC;AAEF,eAAO,MAAM,iBAAiB,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../../../src/utils/flows.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC3B,MAAM,gBAAgB,CAAC;AAExB,eAAO,MAAM,uBAAuB,GAClC,OAAO,qBAAqB,GAAG,IAAI,gCAQpC,CAAC;AAEF,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;AAEvD,eAAO,MAAM,qBAAqB,aAAa,CAAC;AAEhD,eAAO,MAAM,eAAe,GAAI,OAAO,MAAM,YAG5C,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ImageFile } from '../types/imageUpload';
|
|
2
|
-
export declare const generateUUID: () => string;
|
|
3
2
|
export declare const isVideoFile: (filename: string | undefined) => boolean;
|
|
4
3
|
export declare const isVideoFromPicker: (pickedItem: any) => boolean;
|
|
5
4
|
export declare const getMimeType: (fileName: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imageUtils.d.ts","sourceRoot":"","sources":["../../../../src/utils/imageUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAItD,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"imageUtils.d.ts","sourceRoot":"","sources":["../../../../src/utils/imageUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAItD,eAAO,MAAM,WAAW,GAAI,UAAU,MAAM,GAAG,SAAS,KAAG,OAI1D,CAAC;AAGF,eAAO,MAAM,iBAAiB,GAAI,YAAY,GAAG,KAAG,OAInD,CAAC;AA+BF,eAAO,MAAM,WAAW,GAAI,UAAU,MAAM,KAAG,MAG9C,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,WAAW,MAAM,KAAG,MAkB/C,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,KAAG,MAM9C,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,MAAM,SAAS,KAAG,MAAM,GAAG,IAiB5D,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,SAAS,MAAM,KAAG,MAExD,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Message formatting and preview utilities
|
|
3
3
|
*/
|
|
4
4
|
import { type ConversationItem } from '@droppii/openim-rn-client-sdk';
|
|
5
|
-
import type
|
|
5
|
+
import { type DMessageItem } from '../types/chat';
|
|
6
6
|
export declare const isMessageRevoked: (message: DMessageItem) => boolean;
|
|
7
7
|
export declare const extractTextContent: (message: DMessageItem) => string;
|
|
8
8
|
export declare const getMessagePreview: (message: DMessageItem) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageUtils.d.ts","sourceRoot":"","sources":["../../../../src/utils/messageUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"messageUtils.d.ts","sourceRoot":"","sources":["../../../../src/utils/messageUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAIlD,eAAO,MAAM,gBAAgB,GAAI,SAAS,YAAY,KAAG,OACN,CAAC;AAEpD,eAAO,MAAM,kBAAkB,GAAI,SAAS,YAAY,KAAG,MAQ1D,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,SAAS,YAAY,KAAG,MAmEzD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,SAAS,YAAY,GAAG,SAAS,EACjC,gBAAgB,MAAM,EACtB,eAAe,gBAAgB,KAC9B,MAmBF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@droppii-org/chat-mobile",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.30",
|
|
4
4
|
"description": "Droppii chat mobile",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -69,13 +69,12 @@
|
|
|
69
69
|
"example-legacy": "yarn workspace @droppii-org/chat-mobile-example-legacy"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@droppii/openim-rn-client-sdk": "git+ssh://git@github.com/droppii/open-im-sdk-reactnative.git#v1.0.0-
|
|
72
|
+
"@droppii/openim-rn-client-sdk": "git+ssh://git@github.com/droppii/open-im-sdk-reactnative.git#v1.0.0-rc15",
|
|
73
73
|
"@legendapp/list": "^3.0.6",
|
|
74
74
|
"axios": "^1.16.1",
|
|
75
75
|
"lodash": "^4.18.1",
|
|
76
76
|
"react-native-fs": "^2.20.0",
|
|
77
|
-
"react-native-
|
|
78
|
-
"uuid": "^9.0.0"
|
|
77
|
+
"react-native-uuid": "^2.0.4"
|
|
79
78
|
},
|
|
80
79
|
"devDependencies": {
|
|
81
80
|
"@commitlint/config-conventional": "^20.5.0",
|
|
@@ -146,7 +145,6 @@
|
|
|
146
145
|
"react-native-create-thumbnail": "*",
|
|
147
146
|
"react-native-file-viewer": "*",
|
|
148
147
|
"react-native-gesture-handler": "*",
|
|
149
|
-
"react-native-gifted-chat": "*",
|
|
150
148
|
"react-native-image-crop-picker": "*",
|
|
151
149
|
"react-native-keyboard-controller": "*",
|
|
152
150
|
"react-native-linear-gradient": "*",
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
KRadiusValue,
|
|
7
7
|
KSpacingValue,
|
|
8
8
|
} from '@droppii/libs';
|
|
9
|
-
import { memo, useCallback } from 'react';
|
|
9
|
+
import { memo, useCallback, useMemo } from 'react';
|
|
10
10
|
import { StyleSheet } from 'react-native';
|
|
11
11
|
import { messageStyles } from '../../messages/styles';
|
|
12
12
|
import type {
|
|
@@ -14,7 +14,7 @@ import type {
|
|
|
14
14
|
InputButtonItem,
|
|
15
15
|
IRunConversationFlowPayload,
|
|
16
16
|
} from '../../../types/flows';
|
|
17
|
-
import { DEFAULT_BUTTON_ID } from '../../../utils/flows';
|
|
17
|
+
import { DEFAULT_BUTTON_ID, isContextButton } from '../../../utils/flows';
|
|
18
18
|
import { trans } from '../../../translation';
|
|
19
19
|
|
|
20
20
|
interface IInputButtonFlow {
|
|
@@ -26,6 +26,14 @@ interface IInputButtonFlow {
|
|
|
26
26
|
export const InputButtonFlow = memo((props: IInputButtonFlow) => {
|
|
27
27
|
const { nodeData, onResetFlow, onRunFlow } = props || {};
|
|
28
28
|
|
|
29
|
+
const buttonList = useMemo(() => {
|
|
30
|
+
return (
|
|
31
|
+
nodeData?.data?.buttons?.filter(
|
|
32
|
+
(n) => !isContextButton(n?.label || '')
|
|
33
|
+
) || []
|
|
34
|
+
);
|
|
35
|
+
}, [nodeData]);
|
|
36
|
+
|
|
29
37
|
const onPressItem = useCallback(
|
|
30
38
|
(item: InputButtonItem) => {
|
|
31
39
|
if (item.id === DEFAULT_BUTTON_ID) {
|
|
@@ -71,7 +79,7 @@ export const InputButtonFlow = memo((props: IInputButtonFlow) => {
|
|
|
71
79
|
return (
|
|
72
80
|
<KContainer.View style={styles.bubble}>
|
|
73
81
|
<KContainer.View style={styles.buttonsContainer}>
|
|
74
|
-
{
|
|
82
|
+
{buttonList?.map((item) => renderButtonItem(item))}
|
|
75
83
|
</KContainer.View>
|
|
76
84
|
</KContainer.View>
|
|
77
85
|
);
|
|
@@ -15,12 +15,14 @@ export interface ApiEndpoints {
|
|
|
15
15
|
conversationFlow: string;
|
|
16
16
|
// Image upload service (relative path - full URL constructed in imageUpload service)
|
|
17
17
|
imageUpload: string;
|
|
18
|
+
bot: string;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
const DEFAULT_ENDPOINTS: ApiEndpoints = {
|
|
21
22
|
urlMetadata: '/chat-service/v1/utils/url-metadata',
|
|
22
23
|
conversationFlow: '/chat-service/v1/app/conversations',
|
|
23
24
|
imageUpload: '/uploader-service/v1/uploader/permanently',
|
|
25
|
+
bot: '/chat-service/v1/app/bots/',
|
|
24
26
|
};
|
|
25
27
|
|
|
26
28
|
let endpoints: ApiEndpoints = { ...DEFAULT_ENDPOINTS };
|
|
@@ -6,20 +6,32 @@ import {
|
|
|
6
6
|
useMemo,
|
|
7
7
|
useState,
|
|
8
8
|
} from 'react';
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
import {
|
|
10
|
+
DFlowState,
|
|
11
|
+
type ChatDetailContextType,
|
|
12
|
+
type ChatDetailProviderProps,
|
|
12
13
|
} from '../types/chat';
|
|
13
14
|
import { fechtCurrentConversationFlow } from '../hooks/flows/useCurrentConversationFlow';
|
|
14
15
|
import { useConversationStore } from '../store';
|
|
15
16
|
import { PeerType } from '@droppii/openim-rn-client-sdk';
|
|
16
|
-
import
|
|
17
|
+
import {
|
|
18
|
+
DFlowContext,
|
|
19
|
+
NodeTypes,
|
|
20
|
+
type IConversationFlow,
|
|
21
|
+
type IConversationFlowStep,
|
|
22
|
+
} from '../types/flows';
|
|
23
|
+
import { useGetConversationFlowMainMenu } from '../hooks/flows/useGetConversationFlowMainMenu';
|
|
24
|
+
import { useRunFlow } from '../hooks/flows/useFlow';
|
|
25
|
+
import { CONTEXT_BUTTON_PREFIX, isContextButton } from '../utils/flows';
|
|
17
26
|
|
|
18
27
|
export const ChatDetailContext = createContext<ChatDetailContextType>({
|
|
19
28
|
isBotConversation: false,
|
|
20
29
|
conversationFlow: undefined,
|
|
21
30
|
refetchConversationFlow: () => {},
|
|
22
31
|
setConverationFlowStep: () => {},
|
|
32
|
+
flowState: undefined,
|
|
33
|
+
runButtonContext: () => Promise.resolve(false),
|
|
34
|
+
conversation: undefined,
|
|
23
35
|
});
|
|
24
36
|
|
|
25
37
|
export const useChatDetailContext = (): ChatDetailContextType => {
|
|
@@ -43,10 +55,26 @@ export const ChatDetailProvider = ({ children }: ChatDetailProviderProps) => {
|
|
|
43
55
|
IConversationFlow | undefined
|
|
44
56
|
>(undefined);
|
|
45
57
|
|
|
58
|
+
const flowState = useMemo(() => {
|
|
59
|
+
return conversationFlow
|
|
60
|
+
? conversationFlow?.flowCurrentStep?.data?.children?.some(
|
|
61
|
+
(n) => n.type === NodeTypes.LogicCsTeam
|
|
62
|
+
)
|
|
63
|
+
? DFlowState.CS
|
|
64
|
+
: DFlowState.BOT
|
|
65
|
+
: undefined;
|
|
66
|
+
}, [conversationFlow]);
|
|
67
|
+
|
|
46
68
|
const isBotConversation = useMemo(() => {
|
|
47
69
|
return conversation?.peerType === PeerType.Bot;
|
|
48
70
|
}, [conversation]);
|
|
49
71
|
|
|
72
|
+
const { data: conversationFlowMainMenu } = useGetConversationFlowMainMenu(
|
|
73
|
+
isBotConversation ? conversationId : ''
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const { mutateAsync: runFlow } = useRunFlow();
|
|
77
|
+
|
|
50
78
|
const setConverationFlowStep = useCallback((step?: IConversationFlowStep) => {
|
|
51
79
|
setConverationFlow(
|
|
52
80
|
(prev) =>
|
|
@@ -64,6 +92,28 @@ export const ChatDetailProvider = ({ children }: ChatDetailProviderProps) => {
|
|
|
64
92
|
}
|
|
65
93
|
}, [conversationId]);
|
|
66
94
|
|
|
95
|
+
const runButtonContext = useCallback(
|
|
96
|
+
async (stringContext: DFlowContext) => {
|
|
97
|
+
const actionItem = conversationFlowMainMenu?.find(
|
|
98
|
+
(f) =>
|
|
99
|
+
isContextButton(f.label) &&
|
|
100
|
+
f.label.trim().slice(CONTEXT_BUTTON_PREFIX.length) ===
|
|
101
|
+
stringContext?.trim()
|
|
102
|
+
);
|
|
103
|
+
if (actionItem) {
|
|
104
|
+
const res = await runFlow({
|
|
105
|
+
actionId: actionItem.id,
|
|
106
|
+
groupId: '',
|
|
107
|
+
childId: '',
|
|
108
|
+
});
|
|
109
|
+
setConverationFlowStep(res?.flowNextStep || undefined);
|
|
110
|
+
return res ? true : false;
|
|
111
|
+
}
|
|
112
|
+
return false;
|
|
113
|
+
},
|
|
114
|
+
[runFlow, conversationFlowMainMenu, setConverationFlowStep]
|
|
115
|
+
);
|
|
116
|
+
|
|
67
117
|
useEffect(() => {
|
|
68
118
|
if (!!conversationId && !!isBotConversation) {
|
|
69
119
|
getConversationFlow();
|
|
@@ -77,6 +127,9 @@ export const ChatDetailProvider = ({ children }: ChatDetailProviderProps) => {
|
|
|
77
127
|
refetchConversationFlow: () => {},
|
|
78
128
|
setConverationFlowStep,
|
|
79
129
|
isBotConversation,
|
|
130
|
+
flowState,
|
|
131
|
+
runButtonContext,
|
|
132
|
+
conversation,
|
|
80
133
|
}}
|
|
81
134
|
>
|
|
82
135
|
{children}
|
package/src/context/index.ts
CHANGED