react-native-chatbot-ai 0.1.53 → 0.1.54

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/lib/module/assets/images/img_empty_data.png +0 -0
  2. package/lib/module/assets/images/index.js +2 -1
  3. package/lib/module/assets/images/index.js.map +1 -1
  4. package/lib/module/components/Drawer/SessionList.js +2 -1
  5. package/lib/module/components/Drawer/SessionList.js.map +1 -1
  6. package/lib/module/components/chat/ChatMessageList.js +15 -2
  7. package/lib/module/components/chat/ChatMessageList.js.map +1 -1
  8. package/lib/module/components/chat/ChatProductList.js +77 -0
  9. package/lib/module/components/chat/ChatProductList.js.map +1 -0
  10. package/lib/module/components/chat/index.js +134 -4
  11. package/lib/module/components/chat/index.js.map +1 -1
  12. package/lib/module/components/chat/item/ChatAIAnswerMessageItem.js +0 -2
  13. package/lib/module/components/chat/item/ChatAIAnswerMessageItem.js.map +1 -1
  14. package/lib/module/components/chat/item/ChatTable.js +19 -24
  15. package/lib/module/components/chat/item/ChatTable.js.map +1 -1
  16. package/lib/module/components/product/Card.js +226 -177
  17. package/lib/module/components/product/Card.js.map +1 -1
  18. package/lib/module/components/product/CardHorizontal.js +17 -13
  19. package/lib/module/components/product/CardHorizontal.js.map +1 -1
  20. package/lib/module/constants/events.js +2 -1
  21. package/lib/module/constants/events.js.map +1 -1
  22. package/lib/module/constants/query.js +2 -1
  23. package/lib/module/constants/query.js.map +1 -1
  24. package/lib/module/context/ChatContext.js +13 -3
  25. package/lib/module/context/ChatContext.js.map +1 -1
  26. package/lib/module/hooks/message/useMessage.js +7 -1
  27. package/lib/module/hooks/message/useMessage.js.map +1 -1
  28. package/lib/module/hooks/message/useSendMessage.js +3 -1
  29. package/lib/module/hooks/message/useSendMessage.js.map +1 -1
  30. package/lib/module/hooks/session/useGetExternalSessionInfo.js +17 -0
  31. package/lib/module/hooks/session/useGetExternalSessionInfo.js.map +1 -0
  32. package/lib/module/services/endpoints.js +2 -1
  33. package/lib/module/services/endpoints.js.map +1 -1
  34. package/lib/module/translation/resources/i18n.js +7 -1
  35. package/lib/module/translation/resources/i18n.js.map +1 -1
  36. package/lib/module/types/chat.js.map +1 -1
  37. package/lib/typescript/src/assets/images/index.d.ts +1 -0
  38. package/lib/typescript/src/assets/images/index.d.ts.map +1 -1
  39. package/lib/typescript/src/components/Drawer/SessionList.d.ts.map +1 -1
  40. package/lib/typescript/src/components/chat/ChatMessageList.d.ts.map +1 -1
  41. package/lib/typescript/src/components/chat/ChatProductList.d.ts +7 -0
  42. package/lib/typescript/src/components/chat/ChatProductList.d.ts.map +1 -0
  43. package/lib/typescript/src/components/chat/index.d.ts.map +1 -1
  44. package/lib/typescript/src/components/chat/item/ChatAIAnswerMessageItem.d.ts.map +1 -1
  45. package/lib/typescript/src/components/chat/item/ChatTable.d.ts.map +1 -1
  46. package/lib/typescript/src/components/product/Card.d.ts +6 -0
  47. package/lib/typescript/src/components/product/Card.d.ts.map +1 -1
  48. package/lib/typescript/src/components/product/CardHorizontal.d.ts +1 -0
  49. package/lib/typescript/src/components/product/CardHorizontal.d.ts.map +1 -1
  50. package/lib/typescript/src/constants/events.d.ts +1 -0
  51. package/lib/typescript/src/constants/events.d.ts.map +1 -1
  52. package/lib/typescript/src/constants/query.d.ts +1 -0
  53. package/lib/typescript/src/constants/query.d.ts.map +1 -1
  54. package/lib/typescript/src/context/ChatContext.d.ts.map +1 -1
  55. package/lib/typescript/src/hooks/message/useMessage.d.ts.map +1 -1
  56. package/lib/typescript/src/hooks/message/useSendMessage.d.ts.map +1 -1
  57. package/lib/typescript/src/hooks/session/useGetExternalSessionInfo.d.ts +6 -0
  58. package/lib/typescript/src/hooks/session/useGetExternalSessionInfo.d.ts.map +1 -0
  59. package/lib/typescript/src/services/endpoints.d.ts +1 -0
  60. package/lib/typescript/src/services/endpoints.d.ts.map +1 -1
  61. package/lib/typescript/src/translation/resources/i18n.d.ts.map +1 -1
  62. package/lib/typescript/src/types/chat.d.ts +2 -0
  63. package/lib/typescript/src/types/chat.d.ts.map +1 -1
  64. package/lib/typescript/src/types/dto.d.ts +10 -0
  65. package/lib/typescript/src/types/dto.d.ts.map +1 -1
  66. package/package.json +6 -2
  67. package/src/assets/images/img_empty_data.png +0 -0
  68. package/src/assets/images/index.ts +1 -0
  69. package/src/components/Drawer/SessionList.tsx +4 -2
  70. package/src/components/chat/ChatMessageList.tsx +20 -2
  71. package/src/components/chat/ChatProductList.tsx +92 -0
  72. package/src/components/chat/index.tsx +145 -2
  73. package/src/components/chat/item/ChatAIAnswerMessageItem.tsx +0 -2
  74. package/src/components/chat/item/ChatTable.tsx +17 -29
  75. package/src/components/product/Card.tsx +228 -173
  76. package/src/components/product/CardHorizontal.tsx +19 -15
  77. package/src/constants/events.ts +1 -0
  78. package/src/constants/query.ts +1 -0
  79. package/src/context/ChatContext.tsx +13 -1
  80. package/src/hooks/message/useMessage.ts +7 -1
  81. package/src/hooks/message/useSendMessage.ts +3 -1
  82. package/src/hooks/session/useGetExternalSessionInfo.ts +23 -0
  83. package/src/ignore.d.ts +1 -0
  84. package/src/services/endpoints.ts +2 -0
  85. package/src/translation/resources/i18n.ts +7 -0
  86. package/src/types/chat.ts +2 -0
  87. package/src/types/dto.ts +12 -0
@@ -0,0 +1,23 @@
1
+ import { useQuery } from '@tanstack/react-query';
2
+ import { QUERY_KEYS } from '../../constants/query';
3
+ import { apiInstance } from '../../services';
4
+ import { BaseResponse, IChatExternalSessionInfoResponse } from '../../types';
5
+ import { ENDPOINTS } from '../../services/endpoints';
6
+
7
+ interface IUseGetExternalSessionInfoProps {
8
+ sessionId: string;
9
+ }
10
+
11
+ export const useGetExternalSessionInfo = ({
12
+ sessionId,
13
+ }: IUseGetExternalSessionInfoProps) =>
14
+ useQuery({
15
+ queryKey: [QUERY_KEYS.GET_EXTERNAL_SESSION_INFO, sessionId],
16
+ queryFn: async () => {
17
+ const res = await apiInstance?.get<
18
+ BaseResponse<IChatExternalSessionInfoResponse>
19
+ >(ENDPOINTS.assistantService.getExternalSessionInfo(sessionId));
20
+ return res?.data?.data || null;
21
+ },
22
+ enabled: !!sessionId,
23
+ });
package/src/ignore.d.ts CHANGED
@@ -19,5 +19,6 @@ declare module '@droppii/libs' {
19
19
  export const KRating: any;
20
20
  export const KProduct: any;
21
21
  export const KFonts: any;
22
+ export const KBadge: any;
22
23
  }
23
24
  declare module '*';
@@ -17,6 +17,8 @@ export const ENDPOINTS = {
17
17
  `/assistant-service/v1/app/chat/sessions/${sessionId}/feedback`,
18
18
  generateAudio: (sessionId: string, messageId: string) =>
19
19
  `/assistant-service/v1/app/chat/sessions/${sessionId}/messages/${messageId}/speech`,
20
+ getExternalSessionInfo: (sessionId: string) =>
21
+ `/assistant-service/v1/app/chat/sessions/${sessionId}/tab-data`,
20
22
  },
21
23
  uploaderService: {
22
24
  upload: '/uploader-service/v1/uploader/permanently',
@@ -56,6 +56,13 @@ const i18nKey: Record<string, string> = {
56
56
  //product
57
57
  commissions: 'LN: ',
58
58
  points: 'Points: ',
59
+
60
+ //tabs
61
+ answer: 'Trả lời',
62
+ source: 'Nguồn',
63
+ product: 'Sản phẩm',
64
+ view_original_message: 'Xem câu trả lời gốc',
65
+ empty_product: 'Không có sản phẩm nào',
59
66
  };
60
67
 
61
68
  export default {
package/src/types/chat.ts CHANGED
@@ -17,6 +17,8 @@ export interface ChatContextType {
17
17
  chatbotUrl: string;
18
18
  logGA: (event: string, params?: any) => void;
19
19
  notifyError?: ErrorLogger;
20
+ tabIndex: number;
21
+ setTabIndex: (tabIndex: number) => void;
20
22
  }
21
23
 
22
24
  export interface ChatProviderProps {
package/src/types/dto.ts CHANGED
@@ -199,3 +199,15 @@ export interface SendFeedbackResponse {
199
199
  success: boolean;
200
200
  message: string;
201
201
  }
202
+
203
+ export interface ISessionProductItem extends IProductItem {
204
+ message_id?: string;
205
+ }
206
+
207
+ export interface IChatExternalSessionInfoResponse {
208
+ products: {
209
+ items: ISessionProductItem[];
210
+ count: number;
211
+ };
212
+ source: null;
213
+ }