@droppii-org/chat-sdk 0.1.55 → 0.1.56

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 (154) hide show
  1. package/dist/components/biz-inbox/BizThreadAvatar.d.ts +3 -3
  2. package/dist/components/biz-inbox/BizThreadAvatar.d.ts.map +1 -1
  3. package/dist/components/biz-inbox/BizThreadAvatar.js +5 -5
  4. package/dist/components/biz-inbox/BizThreadCard.d.ts +3 -3
  5. package/dist/components/biz-inbox/BizThreadCard.d.ts.map +1 -1
  6. package/dist/components/biz-inbox/BizThreadCard.js +7 -8
  7. package/dist/components/biz-inbox/BizThreadList.d.ts +3 -3
  8. package/dist/components/biz-inbox/BizThreadList.d.ts.map +1 -1
  9. package/dist/components/biz-inbox/BizThreadList.js +4 -8
  10. package/dist/components/biz-inbox/BizThreadTitle.d.ts +3 -3
  11. package/dist/components/biz-inbox/BizThreadTitle.d.ts.map +1 -1
  12. package/dist/components/biz-inbox/BizThreadTitle.js +5 -5
  13. package/dist/components/biz-thread-detail/BizMessageList.d.ts.map +1 -1
  14. package/dist/components/biz-thread-detail/BizMessageList.js +4 -5
  15. package/dist/components/biz-thread-detail/BizThreadDetailHeader.d.ts +2 -2
  16. package/dist/components/biz-thread-detail/BizThreadDetailHeader.d.ts.map +1 -1
  17. package/dist/components/biz-thread-detail/BizThreadDetailHeader.js +7 -5
  18. package/dist/components/biz-thread-detail/BizThreadDetailInput.d.ts.map +1 -1
  19. package/dist/components/biz-thread-detail/BizThreadDetailInput.js +8 -13
  20. package/dist/components/biz-thread-detail/bot/BotButtonMessage.d.ts +1 -1
  21. package/dist/components/biz-thread-detail/bot/BotButtonMessage.d.ts.map +1 -1
  22. package/dist/components/conversation-detail/ConversationDetailHeader.d.ts +8 -0
  23. package/dist/components/conversation-detail/ConversationDetailHeader.d.ts.map +1 -0
  24. package/dist/components/conversation-detail/ConversationDetailHeader.js +18 -0
  25. package/dist/components/conversation-detail/ConversationDetailInput.d.ts +8 -0
  26. package/dist/components/conversation-detail/ConversationDetailInput.d.ts.map +1 -0
  27. package/dist/components/conversation-detail/ConversationDetailInput.js +258 -0
  28. package/dist/components/conversation-detail/ConversationMessageList.d.ts +7 -0
  29. package/dist/components/conversation-detail/ConversationMessageList.d.ts.map +1 -0
  30. package/dist/components/conversation-detail/ConversationMessageList.js +35 -0
  31. package/dist/components/conversation-detail/ConversationMoreOptionItem.d.ts +8 -0
  32. package/dist/components/conversation-detail/ConversationMoreOptionItem.d.ts.map +1 -0
  33. package/dist/components/conversation-detail/ConversationMoreOptionItem.js +19 -0
  34. package/dist/components/conversation-detail/ConversationMoreOptionPanel.d.ts +10 -0
  35. package/dist/components/conversation-detail/ConversationMoreOptionPanel.d.ts.map +1 -0
  36. package/dist/components/conversation-detail/ConversationMoreOptionPanel.js +20 -0
  37. package/dist/components/conversation-detail/bot/BotButtonMessage.d.ts +10 -0
  38. package/dist/components/conversation-detail/bot/BotButtonMessage.d.ts.map +1 -0
  39. package/dist/components/conversation-detail/bot/BotButtonMessage.js +30 -0
  40. package/dist/components/conversation-detail/bot/BotStartButton.d.ts +8 -0
  41. package/dist/components/conversation-detail/bot/BotStartButton.d.ts.map +1 -0
  42. package/dist/components/conversation-detail/bot/BotStartButton.js +11 -0
  43. package/dist/components/conversation-detail/bot/BotSuggest.d.ts +7 -0
  44. package/dist/components/conversation-detail/bot/BotSuggest.d.ts.map +1 -0
  45. package/dist/components/conversation-detail/bot/BotSuggest.js +11 -0
  46. package/dist/components/conversation-detail/bot/index.d.ts +7 -0
  47. package/dist/components/conversation-detail/bot/index.d.ts.map +1 -0
  48. package/dist/components/conversation-detail/bot/index.js +3 -0
  49. package/dist/components/conversation-detail/index.d.ts +10 -0
  50. package/dist/components/conversation-detail/index.d.ts.map +1 -0
  51. package/dist/components/conversation-detail/index.js +5 -0
  52. package/dist/components/conversation-inbox/ConversationInboxHeader.d.ts +3 -0
  53. package/dist/components/conversation-inbox/ConversationInboxHeader.d.ts.map +1 -0
  54. package/dist/components/conversation-inbox/ConversationInboxHeader.js +8 -0
  55. package/dist/components/conversation-inbox/ConversationInboxItem.d.ts +8 -0
  56. package/dist/components/conversation-inbox/ConversationInboxItem.d.ts.map +1 -0
  57. package/dist/components/conversation-inbox/ConversationInboxItem.js +30 -0
  58. package/dist/components/conversation-inbox/ConversationInboxList.d.ts +12 -0
  59. package/dist/components/conversation-inbox/ConversationInboxList.d.ts.map +1 -0
  60. package/dist/components/conversation-inbox/ConversationInboxList.js +36 -0
  61. package/dist/components/conversation-inbox/ConversationInboxTitle.d.ts +9 -0
  62. package/dist/components/conversation-inbox/ConversationInboxTitle.d.ts.map +1 -0
  63. package/dist/components/conversation-inbox/ConversationInboxTitle.js +7 -0
  64. package/dist/components/conversation-inbox/ConversationPeerAvatar.d.ts +10 -0
  65. package/dist/components/conversation-inbox/ConversationPeerAvatar.d.ts.map +1 -0
  66. package/dist/components/conversation-inbox/ConversationPeerAvatar.js +10 -0
  67. package/dist/components/conversation-inbox/index.d.ts +10 -0
  68. package/dist/components/conversation-inbox/index.d.ts.map +1 -0
  69. package/dist/components/conversation-inbox/index.js +5 -0
  70. package/dist/components/message/footer/LinkInputPreview.js +1 -1
  71. package/dist/components/message/item/ImageMessage.js +1 -1
  72. package/dist/components/message/item/LinkCard.js +1 -1
  73. package/dist/components/message/item/LinkText.js +1 -1
  74. package/dist/components/message/item/VideoMessage.js +1 -1
  75. package/dist/components/message/item/mediaSize.d.ts.map +1 -1
  76. package/dist/components/message/item/mediaSize.js +8 -8
  77. package/dist/constants/moreOption.d.ts +9 -0
  78. package/dist/constants/moreOption.d.ts.map +1 -0
  79. package/dist/constants/moreOption.js +37 -0
  80. package/dist/hooks/conversation/useActiveConversation.d.ts +3 -0
  81. package/dist/hooks/conversation/useActiveConversation.d.ts.map +1 -0
  82. package/dist/hooks/conversation/useActiveConversation.js +31 -0
  83. package/dist/hooks/conversation/useBotConversationDetail.d.ts +3 -0
  84. package/dist/hooks/conversation/useBotConversationDetail.d.ts.map +1 -0
  85. package/dist/hooks/conversation/useBotConversationDetail.js +18 -0
  86. package/dist/hooks/conversation/useBotFlow.d.ts +18 -0
  87. package/dist/hooks/conversation/useBotFlow.d.ts.map +1 -0
  88. package/dist/hooks/conversation/useBotFlow.js +150 -0
  89. package/dist/hooks/conversation/useConversationList.d.ts +15 -0
  90. package/dist/hooks/conversation/useConversationList.d.ts.map +1 -0
  91. package/dist/hooks/conversation/useConversationList.js +70 -0
  92. package/dist/hooks/conversation/useCreateConversation.d.ts +8 -0
  93. package/dist/hooks/conversation/useCreateConversation.d.ts.map +1 -0
  94. package/dist/hooks/conversation/useCreateConversation.js +15 -0
  95. package/dist/hooks/conversation/useResetBotFlow.d.ts +3 -0
  96. package/dist/hooks/conversation/useResetBotFlow.d.ts.map +1 -0
  97. package/dist/hooks/conversation/useResetBotFlow.js +14 -0
  98. package/dist/hooks/conversation/useRunBotFlow.d.ts +7 -0
  99. package/dist/hooks/conversation/useRunBotFlow.d.ts.map +1 -0
  100. package/dist/hooks/conversation/useRunBotFlow.js +14 -0
  101. package/dist/hooks/global/useGlobalEvent.d.ts.map +1 -1
  102. package/dist/hooks/global/useGlobalEvent.js +15 -7
  103. package/dist/hooks/message/useSendMessage.d.ts +1 -1
  104. package/dist/hooks/message/useSendMessage.d.ts.map +1 -1
  105. package/dist/hooks/user/useAuth.js +2 -2
  106. package/dist/index.d.ts +12 -11
  107. package/dist/index.d.ts.map +1 -1
  108. package/dist/index.js +7 -6
  109. package/dist/locales/i18n.js +3 -3
  110. package/dist/locales/i18n.ts +3 -3
  111. package/dist/locales/vi/biz-inbox.json +39 -39
  112. package/dist/locales/vi/conversation-inbox.json +39 -0
  113. package/dist/screens/biz-message/index.d.ts +3 -4
  114. package/dist/screens/biz-message/index.d.ts.map +1 -1
  115. package/dist/screens/biz-message/index.js +5 -9
  116. package/dist/screens/biz-thread-detail/index.js +6 -6
  117. package/dist/screens/conversation-detail/index.d.ts +9 -0
  118. package/dist/screens/conversation-detail/index.d.ts.map +1 -0
  119. package/dist/screens/conversation-detail/index.js +53 -0
  120. package/dist/screens/conversation-inbox/index.d.ts +8 -0
  121. package/dist/screens/conversation-inbox/index.d.ts.map +1 -0
  122. package/dist/screens/conversation-inbox/index.js +30 -0
  123. package/dist/services/query.d.ts +0 -1
  124. package/dist/services/query.d.ts.map +1 -1
  125. package/dist/services/query.js +0 -1
  126. package/dist/services/routes.d.ts +0 -1
  127. package/dist/services/routes.d.ts.map +1 -1
  128. package/dist/services/routes.js +0 -1
  129. package/dist/store/conversation.d.ts.map +1 -1
  130. package/dist/store/conversation.js +14 -5
  131. package/dist/store/messageDraft.d.ts +9 -0
  132. package/dist/store/messageDraft.d.ts.map +1 -0
  133. package/dist/store/messageDraft.js +35 -0
  134. package/dist/store/type.d.ts +6 -1
  135. package/dist/store/type.d.ts.map +1 -1
  136. package/dist/styles/global.css +1 -1
  137. package/dist/tsconfig.tsbuildinfo +1 -1
  138. package/dist/types/conversation.d.ts +116 -0
  139. package/dist/types/conversation.d.ts.map +1 -0
  140. package/dist/types/conversation.js +33 -0
  141. package/dist/utils/common.d.ts +1 -1
  142. package/dist/utils/common.d.ts.map +1 -1
  143. package/dist/utils/common.js +5 -3
  144. package/dist/utils/conversation.d.ts +12 -0
  145. package/dist/utils/conversation.d.ts.map +1 -0
  146. package/dist/utils/conversation.js +53 -0
  147. package/dist/utils/events.d.ts +1 -1
  148. package/dist/utils/events.d.ts.map +1 -1
  149. package/dist/utils/fileValidation.d.ts +2 -1
  150. package/dist/utils/fileValidation.d.ts.map +1 -1
  151. package/dist/utils/fileValidation.js +10 -1
  152. package/dist/utils/imCommon.d.ts +1 -0
  153. package/dist/utils/imCommon.d.ts.map +1 -1
  154. package/package.json +1 -1
@@ -0,0 +1,116 @@
1
+ import { ConversationItem } from "@openim/wasm-client-sdk";
2
+ import { DChatApplicationType } from "./chat";
3
+ export declare enum ChatType {
4
+ SINGLE = "SINGLE",
5
+ GROUP = "GROUP"
6
+ }
7
+ export declare enum ChatCategory {
8
+ BIZ_BIZ = "BIZ_BIZ",
9
+ BIZ_MALL = "BIZ_MALL",
10
+ GROUP = "GROUP",
11
+ BIZ_BOT_PDP = "BIZ_BOT_PDP",
12
+ BIZ_BOT_CRM = "BIZ_BOT_CRM"
13
+ }
14
+ export declare enum PeerType {
15
+ USER = "USER",
16
+ GROUP = "GROUP",
17
+ BOT = "BOT",
18
+ CUSTOMER = "CUSTOMER"
19
+ }
20
+ export interface ConversationExtra {
21
+ applicationType: DChatApplicationType;
22
+ chatCategory: ChatCategory;
23
+ }
24
+ export interface ConversationListItem extends ConversationItem {
25
+ peerType: PeerType;
26
+ }
27
+ export interface ConversationMember {
28
+ userId: string;
29
+ memberRole: string;
30
+ }
31
+ export interface CreateConversationData {
32
+ conversationId: string;
33
+ groupId: string;
34
+ groupName: string;
35
+ chatCategory: ChatCategory;
36
+ chatType: ChatType;
37
+ applicationType: DChatApplicationType;
38
+ members: ConversationMember[];
39
+ }
40
+ export declare enum BotFlowNodeType {
41
+ Start = "start",
42
+ Group = "group"
43
+ }
44
+ export declare enum BotBlockType {
45
+ BubbleText = "bubble-text",
46
+ BubbleImage = "bubble-image",
47
+ InputButtons = "input-buttons",
48
+ InputText = "input-text",
49
+ LogicCsTeam = "logic-cs-team"
50
+ }
51
+ export interface BotButtonOption {
52
+ id: string;
53
+ label: string;
54
+ }
55
+ interface BotBlockBase {
56
+ id: string;
57
+ parentId?: string;
58
+ }
59
+ export interface BotBubbleTextBlock extends BotBlockBase {
60
+ type: BotBlockType.BubbleText;
61
+ data: {
62
+ content: string;
63
+ plainText: string;
64
+ };
65
+ }
66
+ export interface BotBubbleImageBlock extends BotBlockBase {
67
+ type: BotBlockType.BubbleImage;
68
+ data: {
69
+ url: string;
70
+ sourceType: string;
71
+ };
72
+ }
73
+ export interface BotInputButtonsBlock extends BotBlockBase {
74
+ type: BotBlockType.InputButtons;
75
+ data: {
76
+ buttons: BotButtonOption[];
77
+ };
78
+ }
79
+ export interface BotInputTextBlock extends BotBlockBase {
80
+ type: BotBlockType.InputText;
81
+ data: {
82
+ longText: boolean;
83
+ buttonLabel: string;
84
+ placeholder: string;
85
+ };
86
+ }
87
+ export interface BotLogicCsTeamBlock extends BotBlockBase {
88
+ type: BotBlockType.LogicCsTeam;
89
+ data: {
90
+ csTeamId: string;
91
+ };
92
+ }
93
+ export type BotBlock = BotBubbleTextBlock | BotBubbleImageBlock | BotInputButtonsBlock | BotInputTextBlock | BotLogicCsTeamBlock;
94
+ export interface BotFlowNode {
95
+ id: string;
96
+ type: BotFlowNodeType;
97
+ data: {
98
+ label: string | null;
99
+ children: BotBlock[];
100
+ };
101
+ }
102
+ export interface BotConversationDetail {
103
+ conversationId: string;
104
+ chatCategory: ChatCategory;
105
+ chatType: ChatType;
106
+ applicationType: DChatApplicationType;
107
+ flowCurrentStep: BotFlowNode;
108
+ flowIsEnd: boolean;
109
+ }
110
+ export interface RunBotFlowResponse {
111
+ flowNextStep: BotFlowNode;
112
+ isEnd: boolean;
113
+ havingBotMessage: boolean;
114
+ }
115
+ export {};
116
+ //# sourceMappingURL=conversation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/types/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAE9C,oBAAY,QAAQ;IAClB,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB;AAED,oBAAY,YAAY;IACtB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;CAC5B;AAED,oBAAY,QAAQ;IAClB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,GAAG,QAAQ;IACX,QAAQ,aAAa;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,oBAAoB,CAAC;IACtC,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{}));
6
+ export var ChatCategory;
7
+ (function (ChatCategory) {
8
+ ChatCategory["BIZ_BIZ"] = "BIZ_BIZ";
9
+ ChatCategory["BIZ_MALL"] = "BIZ_MALL";
10
+ ChatCategory["GROUP"] = "GROUP";
11
+ ChatCategory["BIZ_BOT_PDP"] = "BIZ_BOT_PDP";
12
+ ChatCategory["BIZ_BOT_CRM"] = "BIZ_BOT_CRM";
13
+ })(ChatCategory || (ChatCategory = {}));
14
+ export var PeerType;
15
+ (function (PeerType) {
16
+ PeerType["USER"] = "USER";
17
+ PeerType["GROUP"] = "GROUP";
18
+ PeerType["BOT"] = "BOT";
19
+ PeerType["CUSTOMER"] = "CUSTOMER";
20
+ })(PeerType || (PeerType = {}));
21
+ export var BotFlowNodeType;
22
+ (function (BotFlowNodeType) {
23
+ BotFlowNodeType["Start"] = "start";
24
+ BotFlowNodeType["Group"] = "group";
25
+ })(BotFlowNodeType || (BotFlowNodeType = {}));
26
+ export var BotBlockType;
27
+ (function (BotBlockType) {
28
+ BotBlockType["BubbleText"] = "bubble-text";
29
+ BotBlockType["BubbleImage"] = "bubble-image";
30
+ BotBlockType["InputButtons"] = "input-buttons";
31
+ BotBlockType["InputText"] = "input-text";
32
+ BotBlockType["LogicCsTeam"] = "logic-cs-team";
33
+ })(BotBlockType || (BotBlockType = {}));
@@ -3,7 +3,7 @@ import { TFunction } from "i18next";
3
3
  export declare function formatDuration(seconds: number): string;
4
4
  export declare function renderFileSize(bytes: number): string;
5
5
  export declare const generateContentBasedOnMessageType: (contentType: MessageType, plainText?: string, t?: TFunction) => string;
6
- export declare const parseLatestMessage: (latestMsg: string, currentUserId?: string, t?: TFunction) => string;
6
+ export declare const parseLatestMessage: (latestMsg: string, currentUserId?: string, t?: TFunction, onlySelfSender?: boolean) => string;
7
7
  export declare const highlightSearch: (text: string, keyword: string, maxLength?: number) => string;
8
8
  interface FormatOptions {
9
9
  hasTime?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGnE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAkBpC,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAItD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAapD;AAED,eAAO,MAAM,iCAAiC,GAC5C,aAAa,WAAW,EACxB,YAAY,MAAM,EAClB,IAAI,SAAS,WAuBd,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,WAAW,MAAM,EACjB,gBAAgB,MAAM,EACtB,IAAI,SAAS,WAkDd,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,MAAM,MAAM,EACZ,SAAS,MAAM,EACf,kBAAc,WA2Cf,CAAC;AAEF,UAAU,aAAa;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,aAAa,GACtB,MAAM,CAqBR;AAED,eAAO,MAAM,QAAQ,QAAkD,CAAC;AAExE,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAqC3D;AAED,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,IAOrD,CAAC;AAKF,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,OACf,CAAC;AAEnC,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,KAAG,MAO9B,CAAC;AAEZ;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAgEjD"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGnE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAkBpC,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAItD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAapD;AAED,eAAO,MAAM,iCAAiC,GAC5C,aAAa,WAAW,EACxB,YAAY,MAAM,EAClB,IAAI,SAAS,WAuBd,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,WAAW,MAAM,EACjB,gBAAgB,MAAM,EACtB,IAAI,SAAS,EACb,wBAAsB,WAoDvB,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,MAAM,MAAM,EACZ,SAAS,MAAM,EACf,kBAAc,WA2Cf,CAAC;AAEF,UAAU,aAAa;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,aAAa,GACtB,MAAM,CAqBR;AAED,eAAO,MAAM,QAAQ,QAAkD,CAAC;AAExE,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAqC3D;AAED,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,IAOrD,CAAC;AAKF,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,OACf,CAAC;AAEnC,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,KAAG,MAO9B,CAAC;AAEZ;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAgEjD"}
@@ -53,20 +53,22 @@ export const generateContentBasedOnMessageType = (contentType, plainText, t) =>
53
53
  return "";
54
54
  }
55
55
  };
56
- export const parseLatestMessage = (latestMsg, currentUserId, t) => {
56
+ export const parseLatestMessage = (latestMsg, currentUserId, t, onlySelfSender = false) => {
57
57
  var _a, _b, _c;
58
58
  if (!latestMsg || !t)
59
59
  return "";
60
60
  try {
61
61
  const msgData = JSON.parse(latestMsg);
62
62
  const contentType = msgData === null || msgData === void 0 ? void 0 : msgData.contentType;
63
+ const isSelfSender = !!currentUserId && msgData.sendID === currentUserId;
63
64
  const sender = getSenderLabelForLatestPreview(msgData, currentUserId, t);
65
+ const senderPrefix = !onlySelfSender || isSelfSender ? `${sender}: ` : "";
64
66
  switch (contentType) {
65
67
  case MessageType.LogTextMessage:
66
68
  return getSystemLogMessageText(msgData);
67
69
  case MessageType.TextMessage:
68
70
  case MessageType.QuoteMessage:
69
- return `${sender}: ${generateContentBasedOnMessageType(contentType, ((_a = msgData === null || msgData === void 0 ? void 0 : msgData.textElem) === null || _a === void 0 ? void 0 : _a.content) || ((_b = msgData === null || msgData === void 0 ? void 0 : msgData.quoteElem) === null || _b === void 0 ? void 0 : _b.text) || "")}`;
71
+ return `${senderPrefix}${generateContentBasedOnMessageType(contentType, ((_a = msgData === null || msgData === void 0 ? void 0 : msgData.textElem) === null || _a === void 0 ? void 0 : _a.content) || ((_b = msgData === null || msgData === void 0 ? void 0 : msgData.quoteElem) === null || _b === void 0 ? void 0 : _b.text) || "")}`;
70
72
  case MessageType.PictureMessage:
71
73
  case MessageType.MergeMessage:
72
74
  case MessageType.VoiceMessage:
@@ -74,7 +76,7 @@ export const parseLatestMessage = (latestMsg, currentUserId, t) => {
74
76
  case MessageType.FileMessage:
75
77
  case MessageType.UrlTextMessage:
76
78
  case MessageType.RevokeMessage:
77
- return `${sender}: ${generateContentBasedOnMessageType(contentType)}`;
79
+ return `${senderPrefix}${generateContentBasedOnMessageType(contentType)}`;
78
80
  case MessageType.CustomMessage: {
79
81
  const customData = (_c = msgData.customElem) === null || _c === void 0 ? void 0 : _c.data;
80
82
  if (customData === "#SESSION - START") {
@@ -0,0 +1,12 @@
1
+ import { ConversationItem } from "@openim/wasm-client-sdk";
2
+ import { ChatCategory, PeerType, type ConversationExtra } from "../types/conversation";
3
+ export declare const parseConversationExtra: (ex: string | undefined) => ConversationExtra;
4
+ export declare const resolveConversationChatCategory: (item: ConversationItem) => ChatCategory;
5
+ export declare const isBotPeer: (item: ConversationItem) => boolean;
6
+ export declare const isCustomerPeer: (item: ConversationItem) => boolean;
7
+ export declare const isGroupChat: (item: ConversationItem) => boolean;
8
+ export declare const resolveConversationDisplayName: (item: ConversationItem, t: (key: string) => string) => string;
9
+ export declare const resolveConversationAvatarUrl: (item: ConversationItem) => string | null;
10
+ export declare const resolvePeerBadgeLabel: (peerType: PeerType, t: (key: string) => string) => string;
11
+ export declare const resolvePeerBadgeColor: (peerType: PeerType) => "" | "bg-orange-900" | "bg-blue-300";
12
+ //# sourceMappingURL=conversation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/utils/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAe,MAAM,yBAAyB,CAAC;AACxE,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;AAQ9B,eAAO,MAAM,sBAAsB,GACjC,IAAI,MAAM,GAAG,SAAS,KACrB,iBAaF,CAAC;AAEF,eAAO,MAAM,+BAA+B,GAC1C,MAAM,gBAAgB,KACrB,YAA4D,CAAC;AAEhE,eAAO,MAAM,SAAS,GAAI,MAAM,gBAAgB,YAChB,CAAC;AAEjC,eAAO,MAAM,cAAc,GAAI,MAAM,gBAAgB,YAChB,CAAC;AAEtC,eAAO,MAAM,WAAW,GAAI,MAAM,gBAAgB,YAChB,CAAA;AAElC,eAAO,MAAM,8BAA8B,GACzC,MAAM,gBAAgB,EACtB,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,KACzB,MAKF,CAAC;AAEF,eAAO,MAAM,4BAA4B,GACvC,MAAM,gBAAgB,KACrB,MAAM,GAAG,IAGX,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,UAAU,QAAQ,EAClB,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,KACzB,MAIF,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,UAAU,QAAQ,yCAIvD,CAAC"}
@@ -0,0 +1,53 @@
1
+ import { ChatCategory, PeerType, } from "../types/conversation";
2
+ import { DChatApplicationType } from "../types/chat";
3
+ const DEFAULT_CONVERSATION_EXTRA = {
4
+ applicationType: DChatApplicationType.DROPPII,
5
+ chatCategory: ChatCategory.BIZ_BIZ,
6
+ };
7
+ export const parseConversationExtra = (ex) => {
8
+ var _a, _b;
9
+ if (!ex)
10
+ return DEFAULT_CONVERSATION_EXTRA;
11
+ try {
12
+ const parsed = JSON.parse(ex);
13
+ return {
14
+ applicationType: (_a = parsed.applicationType) !== null && _a !== void 0 ? _a : DEFAULT_CONVERSATION_EXTRA.applicationType,
15
+ chatCategory: (_b = parsed.chatCategory) !== null && _b !== void 0 ? _b : DEFAULT_CONVERSATION_EXTRA.chatCategory,
16
+ };
17
+ }
18
+ catch (_c) {
19
+ return DEFAULT_CONVERSATION_EXTRA;
20
+ }
21
+ };
22
+ export const resolveConversationChatCategory = (item) => parseConversationExtra(item.ex).chatCategory;
23
+ export const isBotPeer = (item) => item.peerType === PeerType.BOT;
24
+ export const isCustomerPeer = (item) => item.peerType === PeerType.CUSTOMER;
25
+ export const isGroupChat = (item) => item.peerType === PeerType.GROUP;
26
+ export const resolveConversationDisplayName = (item, t) => {
27
+ var _a;
28
+ const showName = (_a = item.showName) === null || _a === void 0 ? void 0 : _a.trim();
29
+ if (showName)
30
+ return showName;
31
+ if (isBotPeer(item))
32
+ return t("thread_card.bot_crm_name");
33
+ return t("thread_card.fallback_name");
34
+ };
35
+ export const resolveConversationAvatarUrl = (item) => {
36
+ var _a;
37
+ const avatar = (_a = item.faceURL) === null || _a === void 0 ? void 0 : _a.trim();
38
+ return avatar || null;
39
+ };
40
+ export const resolvePeerBadgeLabel = (peerType, t) => {
41
+ if (peerType === PeerType.CUSTOMER)
42
+ return t("thread_card.badge.mall");
43
+ if (peerType === PeerType.BOT)
44
+ return t("thread_card.badge.bot");
45
+ return "";
46
+ };
47
+ export const resolvePeerBadgeColor = (peerType) => {
48
+ if (peerType === PeerType.CUSTOMER)
49
+ return "bg-orange-900";
50
+ if (peerType === PeerType.BOT)
51
+ return "bg-blue-300";
52
+ return "";
53
+ };
@@ -2,7 +2,7 @@ import { MessageItem } from "@openim/wasm-client-sdk";
2
2
  import { UpdateSessionResponse } from "../types/dto";
3
3
  type EmitterEvents = {
4
4
  CHAT_LIST_SCROLL_TO_BOTTOM: void;
5
- BIZ_CHAT_SCROLL_TO_BOTTOM_IF_AT_BOTTOM: void;
5
+ CONVERSATION_CHAT_SCROLL_TO_BOTTOM_IF_AT_BOTTOM: void;
6
6
  CHAT_LIST_SCROLL_TO_MESSAGE: string;
7
7
  PUSH_NEW_MSG: MessageItem;
8
8
  UPDATE_ONE_MSG: MessageItem;
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/utils/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpD,KAAK,aAAa,GAAG;IACnB,0BAA0B,EAAE,IAAI,CAAC;IACjC,sCAAsC,EAAE,IAAI,CAAC;IAC7C,2BAA2B,EAAE,MAAM,CAAC;IAEpC,YAAY,EAAE,WAAW,CAAC;IAC1B,cAAc,EAAE,WAAW,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC;IAEvB,cAAc,EAAE,qBAAqB,CAAC;IACtC,qBAAqB,EAAE,IAAI,CAAC;IAG5B,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IAGtC,cAAc,EAAE,IAAI,CAAC;CACtB,CAAC;AAEF,QAAA,MAAM,OAAO,uCAAwB,CAAC;AAEtC,eAAO,MAAM,IAAI;;;CAAe,CAAC;AAEjC,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/utils/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpD,KAAK,aAAa,GAAG;IACnB,0BAA0B,EAAE,IAAI,CAAC;IACjC,+CAA+C,EAAE,IAAI,CAAC;IACtD,2BAA2B,EAAE,MAAM,CAAC;IAEpC,YAAY,EAAE,WAAW,CAAC;IAC1B,cAAc,EAAE,WAAW,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC;IAEvB,cAAc,EAAE,qBAAqB,CAAC;IACtC,qBAAqB,EAAE,IAAI,CAAC;IAG5B,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IAGtC,cAAc,EAAE,IAAI,CAAC;CACtB,CAAC;AAEF,QAAA,MAAM,OAAO,uCAAwB,CAAC;AAEtC,eAAO,MAAM,IAAI;;;CAAe,CAAC;AAEjC,eAAe,OAAO,CAAC"}
@@ -1,8 +1,9 @@
1
1
  import { UploadFile } from "antd";
2
2
  import { TFunction } from "i18next";
3
3
  export declare const ACCEPTED_IMAGE_TYPES: string[];
4
- export declare const MAX_IMAGE_SIZE_MB = 5;
4
+ export declare const MAX_IMAGE_SIZE_MB = 15;
5
5
  export declare const MAX_VIDEO_SIZE_MB = 200;
6
+ export declare const MAX_DOCUMENT_SIZE_MB = 20;
6
7
  export declare const DOCUMENT_MIME_TYPES: string[];
7
8
  export interface FileValidationOptions {
8
9
  t: TFunction;
@@ -1 +1 @@
1
- {"version":3,"file":"fileValidation.d.ts","sourceRoot":"","sources":["../../src/utils/fileValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,UAAU,EAAE,MAAM,MAAM,CAAC;AAE1D,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,eAAO,MAAM,oBAAoB,UAA2C,CAAC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CAAC;IACb,oBAAoB,CAAC,EAAE,UAAU,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,GACvB,MAAM,IAAI,EACV,GAAG,SAAS,KACX,oBAuBF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,UAAU,IAAI,EAAE,EAChB,sBAAsB,UAAU,EAAE,EAClC,GAAG,SAAS,KACX,oBAYF,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,MAAM,IAAI,KAAG,UAO5C,CAAC;AAEH,eAAO,MAAM,2BAA2B,GACtC,OAAO,IAAI,EAAE,EACb,GAAG,SAAS,KACX,UAAU,EA4BZ,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAClC,OAAO,IAAI,EAAE,EACb,SAAS,qBAAqB,KAC7B,UAAU,EA+BZ,CAAC"}
@@ -1,7 +1,8 @@
1
1
  import { message as antdMessage } from "antd";
2
2
  export const ACCEPTED_IMAGE_TYPES = ["image/jpeg", "image/png", "image/jpg"];
3
- export const MAX_IMAGE_SIZE_MB = 5;
3
+ export const MAX_IMAGE_SIZE_MB = 15;
4
4
  export const MAX_VIDEO_SIZE_MB = 200;
5
+ export const MAX_DOCUMENT_SIZE_MB = 20;
5
6
  export const DOCUMENT_MIME_TYPES = [
6
7
  "application/pdf",
7
8
  "application/msword",
@@ -58,6 +59,14 @@ export const processAndValidateDocuments = (files, t) => {
58
59
  antdMessage.error(t("invalid_document_format", { fileName: file.name }));
59
60
  return false;
60
61
  }
62
+ const fileSizeMB = file.size / 1024 / 1024;
63
+ if (fileSizeMB > MAX_DOCUMENT_SIZE_MB) {
64
+ antdMessage.error(t("file_size_exceeded", {
65
+ fileName: file.name,
66
+ maxSize: MAX_DOCUMENT_SIZE_MB,
67
+ }));
68
+ return false;
69
+ }
61
70
  return true;
62
71
  })
63
72
  .map(createUploadFile);
@@ -22,5 +22,6 @@ export declare const conversationSort: (conversationList: ConversationItem[], or
22
22
  isMsgDestruct: boolean;
23
23
  attachedInfo: string;
24
24
  ex?: string;
25
+ peerType?: string;
25
26
  }[];
26
27
  //# sourceMappingURL=imCommon.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"imCommon.d.ts","sourceRoot":"","sources":["../../src/utils/imCommon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGxE,eAAO,MAAM,cAAc,GAAI,cAAc,WAAW,YACO,CAAC;AAEhE,eAAO,MAAM,gBAAgB,GAC3B,kBAAkB,gBAAgB,EAAE,EACpC,eAAe,gBAAgB,EAAE;;;;;;;;;;;;;;;;;;;;;;GA+ClC,CAAC"}
1
+ {"version":3,"file":"imCommon.d.ts","sourceRoot":"","sources":["../../src/utils/imCommon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGxE,eAAO,MAAM,cAAc,GAAI,cAAc,WAAW,YACO,CAAC;AAEhE,eAAO,MAAM,gBAAgB,GAC3B,kBAAkB,gBAAgB,EAAE,EACpC,eAAe,gBAAgB,EAAE;;;;;;;;;;;;;;;;;;;;;;;GA+ClC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@droppii-org/chat-sdk",
3
- "version": "0.1.55",
3
+ "version": "0.1.56",
4
4
  "description": "Droppii React Chat SDK",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",