@droppii-org/chat-mobile 0.2.106 → 0.2.108

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 (187) hide show
  1. package/lib/module/components/ThreadCard/ThreadCard.js +2 -0
  2. package/lib/module/components/ThreadCard/ThreadCard.js.map +1 -1
  3. package/lib/module/components/messages/ExpandableMessageText.js +112 -0
  4. package/lib/module/components/messages/ExpandableMessageText.js.map +1 -0
  5. package/lib/module/components/messages/PreviewScrollableText.js +80 -0
  6. package/lib/module/components/messages/PreviewScrollableText.js.map +1 -0
  7. package/lib/module/components/messages/fileMessage/index.js +9 -2
  8. package/lib/module/components/messages/fileMessage/index.js.map +1 -1
  9. package/lib/module/components/messages/linkMessage/index.js +21 -12
  10. package/lib/module/components/messages/linkMessage/index.js.map +1 -1
  11. package/lib/module/components/messages/quotedMessage/index.js +18 -3
  12. package/lib/module/components/messages/quotedMessage/index.js.map +1 -1
  13. package/lib/module/components/messages/textMessage/index.js +7 -1
  14. package/lib/module/components/messages/textMessage/index.js.map +1 -1
  15. package/lib/module/components/messages/types.js.map +1 -1
  16. package/lib/module/context/TimelinePressGuardContext.js +14 -0
  17. package/lib/module/context/TimelinePressGuardContext.js.map +1 -0
  18. package/lib/module/hooks/useConversationList.js +4 -0
  19. package/lib/module/hooks/useConversationList.js.map +1 -1
  20. package/lib/module/hooks/useDismissKeyboardFirst.js +19 -0
  21. package/lib/module/hooks/useDismissKeyboardFirst.js.map +1 -0
  22. package/lib/module/hooks/useExpandableText.js +125 -0
  23. package/lib/module/hooks/useExpandableText.js.map +1 -0
  24. package/lib/module/hooks/useGuardedPress.js +19 -0
  25. package/lib/module/hooks/useGuardedPress.js.map +1 -0
  26. package/lib/module/screens/chat-detail/ChatComposer.js +89 -498
  27. package/lib/module/screens/chat-detail/ChatComposer.js.map +1 -1
  28. package/lib/module/screens/chat-detail/ChatDetail.js +49 -20
  29. package/lib/module/screens/chat-detail/ChatDetail.js.map +1 -1
  30. package/lib/module/screens/chat-detail/ChatListLegend.js +113 -76
  31. package/lib/module/screens/chat-detail/ChatListLegend.js.map +1 -1
  32. package/lib/module/screens/chat-detail/PinnedMessagesSheet.js +7 -0
  33. package/lib/module/screens/chat-detail/PinnedMessagesSheet.js.map +1 -1
  34. package/lib/module/screens/chat-detail/components/ChatComposerAccessorySlot.js +47 -0
  35. package/lib/module/screens/chat-detail/components/ChatComposerAccessorySlot.js.map +1 -0
  36. package/lib/module/screens/chat-detail/components/ChatComposerInputArea.js +149 -0
  37. package/lib/module/screens/chat-detail/components/ChatComposerInputArea.js.map +1 -0
  38. package/lib/module/screens/chat-detail/components/ChatComposerStatusBanner.js +104 -0
  39. package/lib/module/screens/chat-detail/components/ChatComposerStatusBanner.js.map +1 -0
  40. package/lib/module/screens/chat-detail/hooks/useChatComposerAnimation.js +0 -17
  41. package/lib/module/screens/chat-detail/hooks/useChatComposerAnimation.js.map +1 -1
  42. package/lib/module/screens/chat-detail/hooks/useChatComposerState.js +16 -2
  43. package/lib/module/screens/chat-detail/hooks/useChatComposerState.js.map +1 -1
  44. package/lib/module/screens/chat-detail/hooks/useComposerBotMenu.js +122 -0
  45. package/lib/module/screens/chat-detail/hooks/useComposerBotMenu.js.map +1 -0
  46. package/lib/module/screens/chat-detail/hooks/useComposerPanelActions.js +46 -0
  47. package/lib/module/screens/chat-detail/hooks/useComposerPanelActions.js.map +1 -0
  48. package/lib/module/screens/chat-detail/hooks/useComposerPanelDismiss.js +75 -0
  49. package/lib/module/screens/chat-detail/hooks/useComposerPanelDismiss.js.map +1 -0
  50. package/lib/module/screens/chat-detail/hooks/useComposerPanels.js +136 -0
  51. package/lib/module/screens/chat-detail/hooks/useComposerPanels.js.map +1 -0
  52. package/lib/module/screens/chat-detail/hooks/useComposerSend.js +74 -0
  53. package/lib/module/screens/chat-detail/hooks/useComposerSend.js.map +1 -0
  54. package/lib/module/screens/chat-detail/legend/LegendChatMessage.js +12 -3
  55. package/lib/module/screens/chat-detail/legend/LegendChatMessage.js.map +1 -1
  56. package/lib/module/screens/chat-detail/messageToolbox/MessageToolboxOverlay.js +11 -2
  57. package/lib/module/screens/chat-detail/messageToolbox/MessageToolboxOverlay.js.map +1 -1
  58. package/lib/module/screens/chat-detail/messageToolbox/MessageToolboxWrapper.js +79 -6
  59. package/lib/module/screens/chat-detail/messageToolbox/MessageToolboxWrapper.js.map +1 -1
  60. package/lib/module/screens/chat-detail/messageToolbox/useClonePreview.js +30 -0
  61. package/lib/module/screens/chat-detail/messageToolbox/useClonePreview.js.map +1 -0
  62. package/lib/module/screens/chat-detail/types.js +5 -0
  63. package/lib/module/screens/chat-detail/types.js.map +1 -1
  64. package/lib/module/store/expandedMessage.js +28 -0
  65. package/lib/module/store/expandedMessage.js.map +1 -0
  66. package/lib/module/store/message.js +14 -0
  67. package/lib/module/store/message.js.map +1 -1
  68. package/lib/module/utils/composerPanelDismissGesture.js +52 -0
  69. package/lib/module/utils/composerPanelDismissGesture.js.map +1 -0
  70. package/lib/module/utils/expandableText.js +41 -0
  71. package/lib/module/utils/expandableText.js.map +1 -0
  72. package/lib/module/utils/inlineTruncation.js +51 -0
  73. package/lib/module/utils/inlineTruncation.js.map +1 -0
  74. package/lib/module/utils/perf-marker.js +44 -0
  75. package/lib/module/utils/perf-marker.js.map +1 -0
  76. package/lib/module/utils/truncateTextChildren.js +38 -0
  77. package/lib/module/utils/truncateTextChildren.js.map +1 -0
  78. package/lib/typescript/src/components/ThreadCard/ThreadCard.d.ts.map +1 -1
  79. package/lib/typescript/src/components/messages/ExpandableMessageText.d.ts +25 -0
  80. package/lib/typescript/src/components/messages/ExpandableMessageText.d.ts.map +1 -0
  81. package/lib/typescript/src/components/messages/PreviewScrollableText.d.ts +29 -0
  82. package/lib/typescript/src/components/messages/PreviewScrollableText.d.ts.map +1 -0
  83. package/lib/typescript/src/components/messages/fileMessage/index.d.ts.map +1 -1
  84. package/lib/typescript/src/components/messages/linkMessage/index.d.ts +1 -1
  85. package/lib/typescript/src/components/messages/linkMessage/index.d.ts.map +1 -1
  86. package/lib/typescript/src/components/messages/quotedMessage/index.d.ts.map +1 -1
  87. package/lib/typescript/src/components/messages/textMessage/index.d.ts +1 -1
  88. package/lib/typescript/src/components/messages/textMessage/index.d.ts.map +1 -1
  89. package/lib/typescript/src/components/messages/types.d.ts +18 -0
  90. package/lib/typescript/src/components/messages/types.d.ts.map +1 -1
  91. package/lib/typescript/src/context/TimelinePressGuardContext.d.ts +3 -0
  92. package/lib/typescript/src/context/TimelinePressGuardContext.d.ts.map +1 -0
  93. package/lib/typescript/src/hooks/useConversationList.d.ts.map +1 -1
  94. package/lib/typescript/src/hooks/useDismissKeyboardFirst.d.ts +8 -0
  95. package/lib/typescript/src/hooks/useDismissKeyboardFirst.d.ts.map +1 -0
  96. package/lib/typescript/src/hooks/useExpandableText.d.ts +13 -0
  97. package/lib/typescript/src/hooks/useExpandableText.d.ts.map +1 -0
  98. package/lib/typescript/src/hooks/useGuardedPress.d.ts +9 -0
  99. package/lib/typescript/src/hooks/useGuardedPress.d.ts.map +1 -0
  100. package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts +7 -3
  101. package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts.map +1 -1
  102. package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts.map +1 -1
  103. package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts +5 -1
  104. package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts.map +1 -1
  105. package/lib/typescript/src/screens/chat-detail/PinnedMessagesSheet.d.ts.map +1 -1
  106. package/lib/typescript/src/screens/chat-detail/components/ChatComposerAccessorySlot.d.ts +12 -0
  107. package/lib/typescript/src/screens/chat-detail/components/ChatComposerAccessorySlot.d.ts.map +1 -0
  108. package/lib/typescript/src/screens/chat-detail/components/ChatComposerInputArea.d.ts +30 -0
  109. package/lib/typescript/src/screens/chat-detail/components/ChatComposerInputArea.d.ts.map +1 -0
  110. package/lib/typescript/src/screens/chat-detail/components/ChatComposerStatusBanner.d.ts +19 -0
  111. package/lib/typescript/src/screens/chat-detail/components/ChatComposerStatusBanner.d.ts.map +1 -0
  112. package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerAnimation.d.ts +0 -1
  113. package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerAnimation.d.ts.map +1 -1
  114. package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerState.d.ts +7 -0
  115. package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerState.d.ts.map +1 -1
  116. package/lib/typescript/src/screens/chat-detail/hooks/useComposerBotMenu.d.ts +7 -0
  117. package/lib/typescript/src/screens/chat-detail/hooks/useComposerBotMenu.d.ts.map +1 -0
  118. package/lib/typescript/src/screens/chat-detail/hooks/useComposerPanelActions.d.ts +17 -0
  119. package/lib/typescript/src/screens/chat-detail/hooks/useComposerPanelActions.d.ts.map +1 -0
  120. package/lib/typescript/src/screens/chat-detail/hooks/useComposerPanelDismiss.d.ts +12 -0
  121. package/lib/typescript/src/screens/chat-detail/hooks/useComposerPanelDismiss.d.ts.map +1 -0
  122. package/lib/typescript/src/screens/chat-detail/hooks/useComposerPanels.d.ts +25 -0
  123. package/lib/typescript/src/screens/chat-detail/hooks/useComposerPanels.d.ts.map +1 -0
  124. package/lib/typescript/src/screens/chat-detail/hooks/useComposerSend.d.ts +16 -0
  125. package/lib/typescript/src/screens/chat-detail/hooks/useComposerSend.d.ts.map +1 -0
  126. package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts +11 -1
  127. package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts.map +1 -1
  128. package/lib/typescript/src/screens/chat-detail/messageToolbox/MessageToolboxOverlay.d.ts.map +1 -1
  129. package/lib/typescript/src/screens/chat-detail/messageToolbox/MessageToolboxWrapper.d.ts +14 -1
  130. package/lib/typescript/src/screens/chat-detail/messageToolbox/MessageToolboxWrapper.d.ts.map +1 -1
  131. package/lib/typescript/src/screens/chat-detail/messageToolbox/useClonePreview.d.ts +18 -0
  132. package/lib/typescript/src/screens/chat-detail/messageToolbox/useClonePreview.d.ts.map +1 -0
  133. package/lib/typescript/src/screens/chat-detail/types.d.ts +8 -0
  134. package/lib/typescript/src/screens/chat-detail/types.d.ts.map +1 -1
  135. package/lib/typescript/src/store/expandedMessage.d.ts +15 -0
  136. package/lib/typescript/src/store/expandedMessage.d.ts.map +1 -0
  137. package/lib/typescript/src/store/message.d.ts.map +1 -1
  138. package/lib/typescript/src/utils/composerPanelDismissGesture.d.ts +33 -0
  139. package/lib/typescript/src/utils/composerPanelDismissGesture.d.ts.map +1 -0
  140. package/lib/typescript/src/utils/expandableText.d.ts +18 -0
  141. package/lib/typescript/src/utils/expandableText.d.ts.map +1 -0
  142. package/lib/typescript/src/utils/inlineTruncation.d.ts +24 -0
  143. package/lib/typescript/src/utils/inlineTruncation.d.ts.map +1 -0
  144. package/lib/typescript/src/utils/perf-marker.d.ts +8 -0
  145. package/lib/typescript/src/utils/perf-marker.d.ts.map +1 -0
  146. package/lib/typescript/src/utils/truncateTextChildren.d.ts +3 -0
  147. package/lib/typescript/src/utils/truncateTextChildren.d.ts.map +1 -0
  148. package/package.json +2 -1
  149. package/src/components/ThreadCard/ThreadCard.tsx +2 -0
  150. package/src/components/messages/ExpandableMessageText.tsx +145 -0
  151. package/src/components/messages/PreviewScrollableText.tsx +98 -0
  152. package/src/components/messages/fileMessage/index.tsx +17 -3
  153. package/src/components/messages/linkMessage/index.tsx +30 -21
  154. package/src/components/messages/quotedMessage/index.tsx +19 -3
  155. package/src/components/messages/textMessage/index.tsx +11 -2
  156. package/src/components/messages/types.ts +18 -0
  157. package/src/context/TimelinePressGuardContext.tsx +15 -0
  158. package/src/hooks/useConversationList.ts +2 -0
  159. package/src/hooks/useDismissKeyboardFirst.ts +19 -0
  160. package/src/hooks/useExpandableText.ts +143 -0
  161. package/src/hooks/useGuardedPress.ts +20 -0
  162. package/src/screens/chat-detail/ChatComposer.tsx +105 -631
  163. package/src/screens/chat-detail/ChatDetail.tsx +49 -20
  164. package/src/screens/chat-detail/ChatListLegend.tsx +122 -71
  165. package/src/screens/chat-detail/PinnedMessagesSheet.tsx +8 -0
  166. package/src/screens/chat-detail/components/ChatComposerAccessorySlot.tsx +61 -0
  167. package/src/screens/chat-detail/components/ChatComposerInputArea.tsx +198 -0
  168. package/src/screens/chat-detail/components/ChatComposerStatusBanner.tsx +116 -0
  169. package/src/screens/chat-detail/hooks/useChatComposerAnimation.ts +0 -29
  170. package/src/screens/chat-detail/hooks/useChatComposerState.ts +25 -2
  171. package/src/screens/chat-detail/hooks/useComposerBotMenu.tsx +140 -0
  172. package/src/screens/chat-detail/hooks/useComposerPanelActions.ts +57 -0
  173. package/src/screens/chat-detail/hooks/useComposerPanelDismiss.ts +111 -0
  174. package/src/screens/chat-detail/hooks/useComposerPanels.ts +197 -0
  175. package/src/screens/chat-detail/hooks/useComposerSend.ts +98 -0
  176. package/src/screens/chat-detail/legend/LegendChatMessage.tsx +24 -2
  177. package/src/screens/chat-detail/messageToolbox/MessageToolboxOverlay.tsx +20 -1
  178. package/src/screens/chat-detail/messageToolbox/MessageToolboxWrapper.tsx +111 -5
  179. package/src/screens/chat-detail/messageToolbox/useClonePreview.ts +34 -0
  180. package/src/screens/chat-detail/types.ts +9 -0
  181. package/src/store/expandedMessage.ts +42 -0
  182. package/src/store/message.ts +14 -0
  183. package/src/utils/composerPanelDismissGesture.ts +72 -0
  184. package/src/utils/expandableText.ts +51 -0
  185. package/src/utils/inlineTruncation.ts +65 -0
  186. package/src/utils/perf-marker.ts +39 -0
  187. package/src/utils/truncateTextChildren.ts +46 -0
@@ -1,10 +1,14 @@
1
1
  "use strict";
2
2
 
3
- import { useState, useMemo, useRef } from 'react';
3
+ import { useState, useMemo, useRef, useCallback, useEffect } from 'react';
4
+ import { Platform } from 'react-native';
5
+ const IS_IOS = Platform.OS === 'ios';
6
+ const INPUT_LINE_HEIGHT = 22.4;
7
+ const WRAPPED_HEIGHT_THRESHOLD = IS_IOS ? INPUT_LINE_HEIGHT + 4 : INPUT_LINE_HEIGHT + 12;
4
8
 
5
9
  // 'mention' is used only for mutual-exclusion (closing attachment/sticker
6
10
  // when the mention picker opens) — the mention picker itself renders as its
7
- // own absolutely-positioned sibling in ChatComposer, not through this
11
+ // own absolutely-positioned sibling in ChatComposerInputArea, not through this
8
12
  // state's render slot, since it must float above the input while the
9
13
  // keyboard stays open (attachment/sticker intentionally take over the
10
14
  // keyboard area, which the mention picker must not do).
@@ -21,6 +25,15 @@ export const useChatComposerState = value => {
21
25
  }
22
26
  return value.includes('\n') || isInputWrapped;
23
27
  }, [isInputWrapped, value]);
28
+ const handleInputContentSizeChange = useCallback(event => {
29
+ const {
30
+ height
31
+ } = event.nativeEvent.contentSize;
32
+ setIsInputWrapped(height > WRAPPED_HEIGHT_THRESHOLD);
33
+ }, []);
34
+ useEffect(() => {
35
+ if (!value) setIsInputWrapped(false);
36
+ }, [value]);
24
37
  return {
25
38
  activePanelType,
26
39
  setActivePanelType,
@@ -31,6 +44,7 @@ export const useChatComposerState = value => {
31
44
  isInputWrapped,
32
45
  setIsInputWrapped,
33
46
  isMultilineInput,
47
+ handleInputContentSizeChange,
34
48
  inputRef
35
49
  };
36
50
  };
@@ -1 +1 @@
1
- {"version":3,"names":["useState","useMemo","useRef","useChatComposerState","value","activePanelType","setActivePanelType","isAttachmentOpen","setIsAttachmentOpen","isInputFocused","setIsInputFocused","isInputWrapped","setIsInputWrapped","inputRef","isMultilineInput","includes"],"sourceRoot":"../../../../../src","sources":["screens/chat-detail/hooks/useChatComposerState.ts"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;;AAEjD;AACA;AACA;AACA;AACA;AACA;;AAgBA,OAAO,MAAMC,oBAAoB,GAC/BC,KAAa,IACkB;EAC/B,MAAM,CAACC,eAAe,EAAEC,kBAAkB,CAAC,GAAGN,QAAQ,CAAkB,IAAI,CAAC;EAC7E,MAAM,CAACO,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGR,QAAQ,CAAC,KAAK,CAAC;EAC/D,MAAM,CAACS,cAAc,EAAEC,iBAAiB,CAAC,GAAGV,QAAQ,CAAC,KAAK,CAAC;EAC3D,MAAM,CAACW,cAAc,EAAEC,iBAAiB,CAAC,GAAGZ,QAAQ,CAAC,KAAK,CAAC;EAC3D,MAAMa,QAAQ,GAAGX,MAAM,CAAM,IAAI,CAAC;EAElC,MAAMY,gBAAgB,GAAGb,OAAO,CAAC,MAAM;IACrC,IAAI,CAACG,KAAK,EAAE;MACV,OAAO,KAAK;IACd;IAEA,OAAOA,KAAK,CAACW,QAAQ,CAAC,IAAI,CAAC,IAAIJ,cAAc;EAC/C,CAAC,EAAE,CAACA,cAAc,EAAEP,KAAK,CAAC,CAAC;EAE3B,OAAO;IACLC,eAAe;IACfC,kBAAkB;IAClBC,gBAAgB;IAChBC,mBAAmB;IACnBC,cAAc;IACdC,iBAAiB;IACjBC,cAAc;IACdC,iBAAiB;IACjBE,gBAAgB;IAChBD;EACF,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useState","useMemo","useRef","useCallback","useEffect","Platform","IS_IOS","OS","INPUT_LINE_HEIGHT","WRAPPED_HEIGHT_THRESHOLD","useChatComposerState","value","activePanelType","setActivePanelType","isAttachmentOpen","setIsAttachmentOpen","isInputFocused","setIsInputFocused","isInputWrapped","setIsInputWrapped","inputRef","isMultilineInput","includes","handleInputContentSizeChange","event","height","nativeEvent","contentSize"],"sourceRoot":"../../../../../src","sources":["screens/chat-detail/hooks/useChatComposerState.ts"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,OAAO,EAAEC,MAAM,EAAEC,WAAW,EAAEC,SAAS,QAAQ,OAAO;AACzE,SAASC,QAAQ,QAAQ,cAAc;AAEvC,MAAMC,MAAM,GAAGD,QAAQ,CAACE,EAAE,KAAK,KAAK;AACpC,MAAMC,iBAAiB,GAAG,IAAI;AAC9B,MAAMC,wBAAwB,GAAGH,MAAM,G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C5BH;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+
3
+ import { useCallback, useMemo } from 'react';
4
+ import { KContainer, KColors, KLabel } from '@droppii/libs';
5
+ import { trans } from "../../../translation/index.js";
6
+ import { UIUtils } from "../../../utils/UIUtils.js";
7
+ import { useCloseSupportSession, useResetFlow, useRunFlow } from "../../../hooks/flows/useFlow.js";
8
+ import { DEFAULT_BUTTON_ID, isContextButton } from "../../../utils/flows.js";
9
+ import { DFlowState } from "../../../types/chat.js";
10
+ import { useChatDetailContext } from "../../../context/ChatDetailContext.js";
11
+ import { openBotMenuSheet } from "../BotMenuSheet.js";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ export const useComposerBotMenu = () => {
14
+ const {
15
+ isBotConversation,
16
+ conversationFlow,
17
+ conversationFlowMainMenu,
18
+ flowState
19
+ } = useChatDetailContext();
20
+ const {
21
+ mutate: runFlow,
22
+ isPending
23
+ } = useRunFlow();
24
+ const {
25
+ mutate: resetFlow
26
+ } = useResetFlow();
27
+ const {
28
+ mutateAsync: closeSupportSession
29
+ } = useCloseSupportSession();
30
+ const onStartConversationFlow = useCallback(() => {
31
+ runFlow({
32
+ groupId: conversationFlow?.flowCurrentStep?.id || '',
33
+ actionId: null,
34
+ childId: null,
35
+ plainText: trans('start')
36
+ });
37
+ }, [runFlow, conversationFlow]);
38
+ const botMenuOptions = useMemo(() => {
39
+ const apiOptions = conversationFlowMainMenu?.filter(item => !isContextButton(item.label)) || [];
40
+ const hasDefaultButton = apiOptions.some(item => item.id === DEFAULT_BUTTON_ID);
41
+ if (hasDefaultButton) return apiOptions;
42
+ return [...apiOptions, {
43
+ id: DEFAULT_BUTTON_ID,
44
+ label: trans('restart')
45
+ }];
46
+ }, [conversationFlowMainMenu]);
47
+ const hasBotMenuOptions = isBotConversation && botMenuOptions.length > 0;
48
+ const runBotMenuOption = useCallback(item => {
49
+ if (item.id === DEFAULT_BUTTON_ID) {
50
+ resetFlow();
51
+ return;
52
+ }
53
+ runFlow({
54
+ actionId: item.id,
55
+ groupId: '',
56
+ childId: '',
57
+ plainText: item.label
58
+ });
59
+ }, [runFlow, resetFlow]);
60
+ const handleSelectBotMenuOption = useCallback(item => {
61
+ if (flowState === DFlowState.CS) {
62
+ UIUtils.popup.open({
63
+ header: {
64
+ title: {
65
+ text: trans('chat:end_support_session_title')
66
+ },
67
+ alignment: 'center'
68
+ },
69
+ body: {
70
+ renderContent: () => /*#__PURE__*/_jsx(KContainer.View, {
71
+ padding: '1rem',
72
+ children: /*#__PURE__*/_jsx(KLabel.RichText, {
73
+ typo: "TextMdNormal",
74
+ textAlign: "center",
75
+ color: KColors.gray.dark,
76
+ richTextOptions: {
77
+ i18nKey: trans('chat:end_support_session_desc'),
78
+ components: {
79
+ bold: /*#__PURE__*/_jsx(KLabel.Text, {
80
+ typo: "TextMdBold",
81
+ color: KColors.gray.dark
82
+ })
83
+ }
84
+ }
85
+ })
86
+ })
87
+ },
88
+ actions: {
89
+ buttons: [{
90
+ label: trans('chat:end_support_session_secondary'),
91
+ kind: 'light',
92
+ onPress: () => {}
93
+ }, {
94
+ label: trans('chat:end_support_session_primary'),
95
+ kind: 'danger',
96
+ onPress: async () => {
97
+ await closeSupportSession();
98
+ runBotMenuOption(item);
99
+ }
100
+ }],
101
+ type: 'horizontal-button'
102
+ }
103
+ });
104
+ return;
105
+ }
106
+ runBotMenuOption(item);
107
+ }, [flowState, runBotMenuOption, closeSupportSession]);
108
+ const handleOpenBotMenu = useCallback(() => {
109
+ if (!hasBotMenuOptions) return;
110
+ openBotMenuSheet({
111
+ options: botMenuOptions,
112
+ onSelect: handleSelectBotMenuOption
113
+ });
114
+ }, [hasBotMenuOptions, botMenuOptions, handleSelectBotMenuOption]);
115
+ return {
116
+ hasBotMenuOptions,
117
+ handleOpenBotMenu,
118
+ onStartConversationFlow,
119
+ isRunFlowPending: isPending
120
+ };
121
+ };
122
+ //# sourceMappingURL=useComposerBotMenu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useMemo","KContainer","KColors","KLabel","trans","UIUtils","useCloseSupportSession","useResetFlow","useRunFlow","DEFAULT_BUTTON_ID","isContextButton","DFlowState","useChatDetailContext","openBotMenuSheet","jsx","_jsx","useComposerBotMenu","isBotConversation","conversationFlow","conversationFlowMainMenu","flowState","mutate","runFlow","isPending","resetFlow","mutateAsync","closeSupportSession","onStartConversationFlow","groupId","flowCurrentStep","id","actionId","childId","plainText","botMenuOptions","apiOptions","filter","item","label","hasDefaultButton","some","hasBotMenuOptions","length","runBotMenuOption","handleSelectBotMenuOption","CS","popup","open","header","title","text","alignment","body","renderContent","View","padding","children","RichText","typo","textAlign","color","gray","dark","richTextOptions","i18nKey","components","bold","Text","actions","buttons","kind","onPress","type","handleOpenBotMenu","options","onSelect","isRunFlowPending"],"sourceRoot":"../../../../../src","sources":["screens/chat-detail/hooks/useComposerBotMenu.tsx"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAC5C,SAASC,UAAU,EAAEC,OAAO,EAAEC,MAAM,QAAQ,eAAe;AAE3D,SAASC,KAAK,QAAQ,+BAAsB;AAC5C,SAASC,OAAO,QAAQ,2BAAwB;AAChD,SACEC,sBAAsB,EACtBC,YAAY,EACZC,UAAU,QACL,iCAA8B;AAErC,SAASC,iBAAiB,EAAEC,eAAe,QAAQ,yBAAsB;AACzE,SAASC,UAAU,QAAQ,wBAAqB;AAChD,SAASC,oBAAoB,QAAQ,uCAAoC;AACzE,SAASC,gBAAgB,QAAQ,oBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEnD,OAAO,MAAMC,kBAAkB,GAAGA,CAAA,KAAM;EACtC,MAAM;IACJC,iBAAiB;IACjBC,gBAAgB;IAChBC,wBAAwB;IACxBC;EACF,CAAC,GAAGR,oBAAoB,CAAC,CAAC;EAC1B,MAAM;IAAES,MAAM,EAAEC,OAAO;IAAEC;EAAU,CAAC,GAAGf,UAAU,C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AAE,QAAQ;YACdC,OAAO,EAAE,MAAAA,CAAA,KAAY;cACnB,MAAM7C,mBAAmB,CAAC,CAAC;cAC3BiB,gBAAgB,CAACN,IAAI,CAAC;YACxB;UACF,CAAC,CACF;UACDmC,IAAI,EAAE;QACR;MACF,CAAC,CAAC;MACF;IACF;IACA7B,gBAAgB,CAACN,IAAI,CAAC;EACxB,CAAC,EACD,CAACjB,SAAS,EAAEuB,gBAAgB,EAAEjB,mBAAmB,CACnD,CAAC;EAED,MAAM+C,iBAAiB,GAAG1E,WAAW,CAAC,MAAM;IAC1C,IAAI,CAAC0C,iBAAiB,EAAE;IACxB5B,gBAAgB,CAAC;MACf6D,OAAO,EAAExC,cAAc;MACvByC,QAAQ,EAAE/B;IACZ,CAAC,CAAC;EACJ,CAAC,EAAE,CAACH,iBAAiB,EAAEP,cAAc,EAAEU,yBAAyB,CAAC,CAAC;EAElE,OAAO;IACLH,iBAAiB;IACjBgC,iBAAiB;IACjB9C,uBAAuB;IACvBiD,gBAAgB,EAAErD;EACpB,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ import { useMemo, useRef } from 'react';
4
+ import { debounce } from 'lodash';
5
+ import { DEFAULT_PANNEL_ACTIONS } from "../constants.js";
6
+ import { DChatPannelActionItemType } from "../types.js";
7
+ // Resolves the attachment panel's actions, wiring Gallery/Documents to
8
+ // debounced pickers unless the consumer supplied its own onPress.
9
+ export const useComposerPanelActions = ({
10
+ pannelActions,
11
+ addImages,
12
+ addFiles
13
+ }) => {
14
+ const addImagesRef = useRef(addImages);
15
+ addImagesRef.current = addImages;
16
+ const debouncedImagePickerRef = useRef(debounce(() => addImagesRef.current?.(), 300, {
17
+ leading: true,
18
+ trailing: false
19
+ }));
20
+ const addFilesRef = useRef(addFiles);
21
+ addFilesRef.current = addFiles;
22
+ const debouncedFilePickerRef = useRef(debounce(() => addFilesRef.current?.(), 300, {
23
+ leading: true,
24
+ trailing: false
25
+ }));
26
+ return useMemo(() => {
27
+ return (pannelActions || DEFAULT_PANNEL_ACTIONS)?.map(p => {
28
+ let onPress;
29
+ switch (p.id) {
30
+ case DChatPannelActionItemType.Gallery:
31
+ onPress = debouncedImagePickerRef.current;
32
+ break;
33
+ case DChatPannelActionItemType.Documents:
34
+ onPress = debouncedFilePickerRef.current;
35
+ break;
36
+ default:
37
+ break;
38
+ }
39
+ return {
40
+ ...p,
41
+ onPress: p.onPress || onPress
42
+ };
43
+ });
44
+ }, [pannelActions]);
45
+ };
46
+ //# sourceMappingURL=useComposerPanelActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useMemo","useRef","debounce","DEFAULT_PANNEL_ACTIONS","DChatPannelActionItemType","useComposerPanelActions","pannelActions","addImages","addFiles","addImagesRef","current","debouncedImagePickerRef","leading","trailing","addFilesRef","debouncedFilePickerRef","map","p","onPress","id","Gallery","Documents"],"sourceRoot":"../../../../../src","sources":["screens/chat-detail/hooks/useComposerPanelActions.ts"],"mappings":";;AAAA,SAASA,OAAO,EAAEC,MAAM,QAAQ,OAAO;AACvC,SAASC,QAAQ,QAAQ,QAAQ;AAEjC,SAASC,sBAAsB,QAAQ,iBAAc;AACrD,SAASC,yBAAyB,QAAgC,aAAU;AAQ5E;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAGA,CAAC;EACtCC,aAAa;EACbC,SAAS;EACTC;AAC4B,CAAC,KAAK;EAClC,MAAMC,YAAY,GAAGR,MAAM,CAACM,SAAS,CAAC;EACtCE,YAAY,CAACC,OAAO,GAAGH,SAAS;EAChC,MAAMI,uBAAuB,GAAGV,MAAM,CACpCC,QAAQ,CAAC,MAAMO,YAAY,CAACC,OAAO,GAAG,CAAC,EAAE,GAAG,EAAE;IAC5CE,OAAO,EAAE,IAAI;IACbC,QAAQ,EAAE;EACZ,CAAC,CACH,CAAC;EAED,MAAMC,WAAW,GAAGb,MAAM,CAACO,QAAQ,CAAC;EACpCM,WAAW,CAACJ,OAAO,GAAGF,QAAQ;EAC9B,MAAMO,sBAAsB,GAAGd,MAAM,CACnCC,QAAQ,CAAC,MAAMY,WAAW,CAACJ,OAAO,GAAG,CAAC,EAAE,GAAG,EAAE;IAC3CE,OAAO,EAAE,IAAI;IACbC,QAAQ,EAAE;EACZ,CAAC,CACH,CAAC;EAED,OAAOb,OAAO,CAAC,MAAM;IACnB,OAAO,CAACM,aAAa,IAAIH,sBAAsB,GAAGa,GAAG,CAAEC,CAAC,IAAK;MAC3D,IAAIC,OAAO;MACX,QAAQD,CAAC,CAACE,EAAE;QACV,KAAKf,yBAAyB,CAACgB,OAAO;UACpCF,OAAO,GAAGP,uBAAuB,CAACD,OAAO;UACzC;QACF,KAAKN,yBAAyB,CAACiB,SAAS;UACtCH,OAAO,GAAGH,sBAAsB,CAACL,OAAO;UACxC;QACF;UACE;MACJ;MACA,OAAO;QACL,GAAGO,CAAC;QACJC,OAAO,EAAED,CAAC,CAACC,OAAO,IAAIA;MACxB,CAAC;IACH,CAAC,CAAC;EACJ,CAAC,EAAE,CAACZ,aAAa,CAAC,CAAC;AACrB,CAAC","ignoreList":[]}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+
3
+ import { useCallback, useMemo, useRef, useState } from 'react';
4
+ import { IDLE_DISMISS_TOUCH, isPressSwallowed, markDismissTouchDragged, moveDismissTouch, shouldDismissOnRelease, startDismissTouch } from "../../../utils/composerPanelDismissGesture.js";
5
+ // Tap-outside dismiss for the composer's attachment/sticker panel
6
+ // (DROPPII-30577).
7
+ //
8
+ // While a panel is open the timeline's content is made non-hittable
9
+ // (`isComposerPanelOpen` → `pointerEvents: 'none'` on the list content), so a
10
+ // tap can never reach a bubble — JS touchables and RNGH gestures alike — yet
11
+ // the scroll view itself still receives the touch and scrolls. Tap vs drag is
12
+ // read from plain touch events on a View wrapping the list; they observe the
13
+ // touch without claiming the JS responder, which on iOS would disable the
14
+ // scroll view's pan (RCTScrollView disables it while an ancestor holds the
15
+ // responder).
16
+ //
17
+ // `pointerEvents` only lands after a React round-trip (open → effect →
18
+ // setState → list re-render), so a tap right after opening a heavy panel can
19
+ // still reach a bubble. `shouldSwallowPress` closes that gap synchronously: it
20
+ // is true for every press belonging to a touch that began with the panel
21
+ // open — while it is down and for SWALLOW_AFTER_RELEASE_MS after it lifts,
22
+ // since RNGH gesture callbacks arrive after touchEnd.
23
+ export const useComposerPanelDismiss = () => {
24
+ const panelControllerRef = useRef(null);
25
+ const touchRef = useRef(IDLE_DISMISS_TOUCH);
26
+ const swallowPressRef = useRef(false);
27
+ // null while the tracked touch is down.
28
+ const releasedAtRef = useRef(null);
29
+ const [isComposerPanelOpen, setIsComposerPanelOpen] = useState(false);
30
+ const dismissAreaTouchProps = useMemo(() => ({
31
+ onTouchStart: event => {
32
+ const panelOpen = !!panelControllerRef.current?.isOpen();
33
+ // A second finger must not restart the tracked touch, but a press it
34
+ // makes while the panel is open is still swallowed.
35
+ if (event.nativeEvent.touches.length > 1) {
36
+ if (panelOpen) swallowPressRef.current = true;
37
+ return;
38
+ }
39
+ touchRef.current = startDismissTouch(panelOpen, event.nativeEvent.pageX, event.nativeEvent.pageY);
40
+ swallowPressRef.current = panelOpen;
41
+ releasedAtRef.current = null;
42
+ },
43
+ onTouchMove: event => {
44
+ touchRef.current = moveDismissTouch(touchRef.current, event.nativeEvent.pageX, event.nativeEvent.pageY);
45
+ },
46
+ onTouchEnd: event => {
47
+ if (event.nativeEvent.touches.length > 0) return;
48
+ if (shouldDismissOnRelease(touchRef.current)) {
49
+ panelControllerRef.current?.close();
50
+ }
51
+ touchRef.current = IDLE_DISMISS_TOUCH;
52
+ releasedAtRef.current = Date.now();
53
+ },
54
+ // The scroll view took the touch over (pan began) — not a tap.
55
+ onTouchCancel: () => {
56
+ touchRef.current = IDLE_DISMISS_TOUCH;
57
+ releasedAtRef.current = Date.now();
58
+ }
59
+ }), []);
60
+
61
+ // The list's onScrollBeginDrag — a drag signal on both platforms.
62
+ const notifyScrollBeginDrag = useCallback(() => {
63
+ touchRef.current = markDismissTouchDragged(touchRef.current);
64
+ }, []);
65
+ const shouldSwallowPress = useCallback(() => isPressSwallowed(swallowPressRef.current, releasedAtRef.current, Date.now()), []);
66
+ return {
67
+ panelControllerRef,
68
+ isComposerPanelOpen,
69
+ onComposerPanelOpenChange: setIsComposerPanelOpen,
70
+ dismissAreaTouchProps,
71
+ notifyScrollBeginDrag,
72
+ shouldSwallowPress
73
+ };
74
+ };
75
+ //# sourceMappingURL=useComposerPanelDismiss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useMemo","useRef","useState","IDLE_DISMISS_TOUCH","isPressSwallowed","markDismissTouchDragged","moveDismissTouch","shouldDismissOnRelease","startDismissTouch","useComposerPanelDismiss","panelControllerRef","touchRef","swallowPressRef","releasedAtRef","isComposerPanelOpen","setIsComposerPanelOpen","dismissAreaTouchProps","onTouchStart","event","panelOpen","current","isOpen","nativeEvent","touches","length","pageX","pageY","onTouchMove","onTouchEnd","close","Date","now","onTouchCancel","notifyScrollBeginDrag","shouldSwallowPress","onComposerPanelOpenChange"],"sourceRoot":"../../../../../src","sources":["screens/chat-detail/hooks/useComposerPanelDismiss.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAI9D,SACEC,kBAAkB,EAClBC,gBAAgB,EAChBC,uBAAuB,EACvBC,gBAAgB,EAChBC,sBAAsB,EACtBC,iBAAiB,QAEZ,+CAA4C;AAOnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAGA,CAAA,KAAM;EAC3C,MAAMC,kBAAkB,GAAGT,MAAM,CAAiC,IAAI,CAAC;EACvE,MAAMU,QAAQ,GAAGV,MAAM,CAAeE,kBAAkB,CAAC;EACzD,MAAMS,eAAe,GAAGX,MAAM,CAAC,KAAK,CAAC;EACrC;EACA,MAAMY,aAAa,GAAGZ,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QAAQ,CAACS,OAAO,GAAGjB,kBAAkB;MACrCU,aAAa,CAACO,OAAO,GAAGU,IAAI,CAACC,GAAG,CAAC,CAAC;IACpC;EACF,CAAC,CAAC,EACF,EACF,CAAC;;EAED;EACA,MAAME,qBAAqB,GAAGlC,WAAW,CAAC,MAAM;IAC9CY,QAAQ,CAACS,OAAO,GAAGf,uBAAuB,CAACM,QAAQ,CAACS,OAAO,CAAC;EAC9D,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMc,kBAAkB,GAAGnC,WAAW,CACpC,MACEK,gBAAgB,CACdQ,eAAe,CAACQ,OAAO,EACvBP,aAAa,CAACO,OAAO,EACrBU,IAAI,CAACC,GAAG,CAAC,CACX,CAAC,EACH,EACF,CAAC;EAED,OAAO;IACLrB,kBAAkB;IAClBI,mBAAmB;IACnBqB,yBAAyB,EAAEpB,sBAAsB;IACjDC,qBAAqB;IACrBiB,qBAAqB;IACrBC;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+
3
+ import { useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
4
+ import { Keyboard } from 'react-native';
5
+ import { useChatComposerAnimation } from "./useChatComposerAnimation.js";
6
+ import { getAttachmentPanelHeight, DEFAULT_PANNEL_ACTIONS } from "../constants.js";
7
+ import { STICKER_PICKER_HEIGHT } from "../../../components/StickerPicker/constants.js";
8
+
9
+ // 'immediate' — no animation (sticker yielding to the keyboard);
10
+ // 'fast' — half-duration (attachment yielding to the keyboard);
11
+ // 'animated' — full duration, same as closing via the toggle icon.
12
+
13
+ export const useComposerPanels = ({
14
+ activePanelType,
15
+ setActivePanelType,
16
+ isAttachmentOpen,
17
+ setIsAttachmentOpen,
18
+ isMentionPanelOpen,
19
+ closeMentionPanel,
20
+ isKeyboardVisible,
21
+ isSlotVisible,
22
+ panelControllerRef,
23
+ onPanelOpenChange
24
+ }) => {
25
+ const attachmentPanelHeight = useMemo(() => getAttachmentPanelHeight(DEFAULT_PANNEL_ACTIONS.length), []);
26
+ const panelHeight = activePanelType === 'sticker' ? STICKER_PICKER_HEIGHT : attachmentPanelHeight;
27
+
28
+ // Mirrors isAttachmentOpen synchronously (written before React commits),
29
+ // so imperative readers — the timeline's tap-outside dismiss — never see
30
+ // a stale value between an open/close and the next render.
31
+ const isAttachmentOpenRef = useRef(false);
32
+ const handleAttachmentOpenChange = useCallback(open => {
33
+ isAttachmentOpenRef.current = open;
34
+ setIsAttachmentOpen(open);
35
+ }, [setIsAttachmentOpen]);
36
+ const {
37
+ accessorySlotStyle,
38
+ openWithHeight,
39
+ closeAttachment
40
+ } = useChatComposerAnimation({
41
+ panelHeight,
42
+ onAttachmentOpenChange: handleAttachmentOpenChange
43
+ });
44
+ const closeActivePanel = useCallback(mode => {
45
+ closeAttachment(mode === 'fast', mode === 'immediate');
46
+ setActivePanelType(null);
47
+ }, [closeAttachment, setActivePanelType]);
48
+
49
+ // Close mode when yielding to the keyboard or the mention picker: the
50
+ // sticker panel closes immediately to avoid a layout conflict between the
51
+ // panel closing and the keyboard appearing; the attachment panel is small
52
+ // enough that animation is fine (speedUp=true).
53
+ const yieldingCloseMode = activePanelType === 'sticker' ? 'immediate' : 'fast';
54
+
55
+ // Mutual exclusion (finding #5 in the mention plan): the mention picker
56
+ // never renders through the attachment/sticker panel slot, but opening
57
+ // one must still close the other — starting a mention query while the
58
+ // attachment/sticker panel is open closes that panel.
59
+ useEffect(() => {
60
+ if (isMentionPanelOpen && isAttachmentOpen) {
61
+ closeActivePanel(yieldingCloseMode);
62
+ }
63
+ // eslint-disable-next-line react-hooks/exhaustive-deps
64
+ }, [isMentionPanelOpen]);
65
+
66
+ // A panel left open when the slot disappears (composer disabled, bot
67
+ // restarted, removed from group) would otherwise stay "open" invisibly.
68
+ const isSlotVisibleRef = useRef(isSlotVisible);
69
+ isSlotVisibleRef.current = isSlotVisible;
70
+ useEffect(() => {
71
+ if (!isSlotVisible && isAttachmentOpenRef.current) {
72
+ closeActivePanel('immediate');
73
+ }
74
+ // eslint-disable-next-line react-hooks/exhaustive-deps
75
+ }, [isSlotVisible]);
76
+ const isPanelEffectivelyOpen = isAttachmentOpen && isSlotVisible;
77
+ useEffect(() => {
78
+ onPanelOpenChange?.(isPanelEffectivelyOpen);
79
+ }, [isPanelEffectivelyOpen, onPanelOpenChange]);
80
+ useImperativeHandle(panelControllerRef, () => ({
81
+ isOpen: () => isAttachmentOpenRef.current && isSlotVisibleRef.current,
82
+ close: () => {
83
+ if (isAttachmentOpenRef.current) closeActivePanel('animated');
84
+ }
85
+ }), [closeActivePanel]);
86
+ const handleToggleAttachment = useCallback(() => {
87
+ closeMentionPanel();
88
+ if (activePanelType === 'sticker') {
89
+ // switch from sticker to attachment
90
+ setActivePanelType('attachment');
91
+ openWithHeight(attachmentPanelHeight);
92
+ return;
93
+ }
94
+ // Open/close decided on the same source of truth as the icon: a
95
+ // toggle keyed on the animated height could close a panel that is
96
+ // still collapsing from a tap-outside dismiss while the icon shows it
97
+ // opening.
98
+ if (isAttachmentOpenRef.current) {
99
+ closeActivePanel('animated');
100
+ return;
101
+ }
102
+ if (isKeyboardVisible) {
103
+ Keyboard.dismiss();
104
+ }
105
+ setActivePanelType('attachment');
106
+ openWithHeight(attachmentPanelHeight);
107
+ // Deliberately depend on `closeMentionPanel` (stable — [] deps in
108
+ // useMentionComposer), NOT the whole `mentionComposer` object, which is
109
+ // a fresh literal every render (useMentionComposer doesn't memoize its
110
+ // return value). Depending on the whole object recreated this callback
111
+ // — and therefore every prop built from it, e.g. ChatMessageInput's
112
+ // onEmojiPress — on every single render, which contributed to a real
113
+ // "Maximum update depth exceeded" loop found in testing.
114
+ }, [activePanelType, attachmentPanelHeight, isKeyboardVisible, openWithHeight, closeActivePanel, setActivePanelType, closeMentionPanel]);
115
+ const handleToggleSticker = useCallback(() => {
116
+ closeMentionPanel();
117
+ if (activePanelType === 'sticker') {
118
+ closeActivePanel('animated');
119
+ return;
120
+ }
121
+ if (isKeyboardVisible) {
122
+ Keyboard.dismiss();
123
+ }
124
+ setActivePanelType('sticker');
125
+ openWithHeight(STICKER_PICKER_HEIGHT);
126
+ // Same reasoning as handleToggleAttachment above — see that comment.
127
+ }, [activePanelType, isKeyboardVisible, closeMentionPanel, closeActivePanel, openWithHeight, setActivePanelType]);
128
+ return {
129
+ accessorySlotStyle,
130
+ closeActivePanel,
131
+ yieldingCloseMode,
132
+ handleToggleAttachment,
133
+ handleToggleSticker
134
+ };
135
+ };
136
+ //# sourceMappingURL=useComposerPanels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useEffect","useImperativeHandle","useMemo","useRef","Keyboard","useChatComposerAnimation","getAttachmentPanelHeight","DEFAULT_PANNEL_ACTIONS","STICKER_PICKER_HEIGHT","useComposerPanels","activePanelType","setActivePanelType","isAttachmentOpen","setIsAttachmentOpen","isMentionPanelOpen","closeMentionPanel","isKeyboardVisible","isSlotVisible","panelControllerRef","onPanelOpenChange","attachmentPanelHeight","length","panelHeight","isAttachmentOpenRef","handleAttachmentOpenChange","open","current","accessorySlotStyle","openWithHeight","closeAttachment","onAttachmentOpenChange","closeActivePanel","mode","yieldingCloseMode","isSlotVisibleRef","isPanelEffectivelyOpen","isOpen","close","handleToggleAttachment","dismiss","handleToggleSticker"],"sourceRoot":"../../../../../src","sources":["screens/chat-detail/hooks/useComposerPanels.ts"],"mappings":";;AAAA,SACEA,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,QAED,OAAO;AACd,SAASC,QAAQ,QAAQ,cAAc;AAEvC,SAASC,wBAAwB,QAAQ,+BAA4B;AAGrE,SAASC,wBAAwB,EAAEC,sBAAsB,QAAQ,iBAAc;AAC/E,SAASC,qBAAqB,QAAQ,gDAA6C;;AAEnF;AACA;AACA;;AAmBA,OAAO,MAAMC,iBAAiB,GAAGA,CAAC;EAChCC,eAAe;EACfC,kBAAkB;EAClBC,gBAAgB;EAChBC,mBAAmB;EACnBC,kBAAkB;EAClBC,iB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BpB,kBAAkB,EAClBI,iBAAiB,CAClB,CAAC;EAEF,MAAMyB,mBAAmB,GAAGzC,WAAW,CAAC,MAAM;IAC5CgB,iBAAiB,CAAC,CAAC;IACnB,IAAIL,eAAe,KAAK,SAAS,EAAE;MACjCqB,gBAAgB,CAAC,UAAU,CAAC;MAC5B;IACF;IACA,IAAIf,iBAAiB,EAAE;MACrBZ,QAAQ,CAACmC,OAAO,CAAC,CAAC;IACpB;IACA5B,kBAAkB,CAAC,SAAS,CAAC;IAC7BiB,cAAc,CAACpB,qBAAqB,CAAC;IACrC;EACF,CAAC,EAAE,CACDE,eAAe,EACfM,iBAAiB,EACjBD,iBAAiB,EACjBgB,gBAAgB,EAChBH,cAAc,EACdjB,kBAAkB,CACnB,CAAC;EAEF,OAAO;IACLgB,kBAAkB;IAClBI,gBAAgB;IAChBE,iBAAiB;IACjBK,sBAAsB;IACtBE;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+
3
+ import { useCallback } from 'react';
4
+ import { trans } from "../../../translation/index.js";
5
+ import { UIUtils } from "../../../utils/UIUtils.js";
6
+ import { serializeMentionsForSend, MAX_AT_USER_COUNT } from "../../../utils/mentionSerializer.js";
7
+ export const useComposerSend = ({
8
+ compose,
9
+ isSendMessageAllowed,
10
+ sendDeniedReason,
11
+ mentions,
12
+ clearMentions,
13
+ notifyStoppedTyping,
14
+ inputRef
15
+ }) => useCallback(async () => {
16
+ if (!isSendMessageAllowed) {
17
+ UIUtils.toast.open({
18
+ title: sendDeniedReason,
19
+ theme: 'info'
20
+ });
21
+ return;
22
+ }
23
+ if (compose.isUploading || !compose.canSend) return;
24
+ const mentionsToSend = mentions;
25
+
26
+ // OpenIM's Go core hard-rejects an AtTextMessage tagging more than
27
+ // MAX_AT_USER_COUNT users, so serializeMentionsForSend caps
28
+ // atUserIDList to the first MAX_AT_USER_COUNT (mentionSerializer.ts's
29
+ // doc comment) — the message still sends, with every mention still
30
+ // highlighted in the text, just only the first MAX_AT_USER_COUNT
31
+ // actually get natively tagged/notified. This is a heads-up, not a
32
+ // block, so no `return` here.
33
+ if (mentionsToSend.length > 0) {
34
+ const {
35
+ truncated
36
+ } = serializeMentionsForSend(mentionsToSend);
37
+ if (truncated) {
38
+ UIUtils.toast.open({
39
+ title: trans('group:tag_limit_exceeded', {
40
+ max: String(MAX_AT_USER_COUNT)
41
+ }),
42
+ theme: 'info'
43
+ });
44
+ }
45
+ }
46
+
47
+ // Clear mention state synchronously, in the same tick as
48
+ // compose.send() (which clears `text`) — otherwise there's a real
49
+ // transient render where `value` is already '' but `mentions` still
50
+ // holds the just-sent entries, and the composer can visibly fail to
51
+ // clear (ChatMessageInput stays in children-controlled mode with a
52
+ // "ghost" mention anchored past the end of an empty string). See
53
+ // useMentionComposer.clear()'s doc comment.
54
+ clearMentions();
55
+ // Stop before awaiting the send: the peer should lose the indicator as
56
+ // the message goes out, not once it round-trips.
57
+ notifyStoppedTyping();
58
+ try {
59
+ await compose.send(mentionsToSend);
60
+ } catch (error) {
61
+ if (__DEV__) console.error('[ChatComposer] Failed to send:', error);
62
+ } finally {
63
+ // Belt-and-suspenders: force the native view to actually clear,
64
+ // regardless of whether the value/children mode-switch (triggered
65
+ // by mentions going from non-empty to empty) synced correctly on
66
+ // its own — the underlying nested-Text-in-TextInput technique is
67
+ // known to have platform quirks around this kind of transition.
68
+ inputRef.current?.clear();
69
+ }
70
+ // Depend on mentionComposer.mentions/.clear specifically (both
71
+ // stable-per-value / [] deps), not the whole mentionComposer object —
72
+ // same reasoning as handleToggleAttachment in useComposerPanels.
73
+ }, [compose, isSendMessageAllowed, sendDeniedReason, mentions, clearMentions, notifyStoppedTyping, inputRef]);
74
+ //# sourceMappingURL=useComposerSend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","trans","UIUtils","serializeMentionsForSend","MAX_AT_USER_COUNT","useComposerSend","compose","isSendMessageAllowed","sendDeniedReason","mentions","clearMentions","notifyStoppedTyping","inputRef","toast","open","title","theme","isUploading","canSend","mentionsToSend","length","truncated","max","String","send","error","__DEV__","console","current","clear"],"sourceRoot":"../../../../../src","sources":["screens/chat-detail/hooks/useComposerSend.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAwB,OAAO;AAEnD,SAASC,KAAK,QAAQ,+BAAsB;AAC5C,SAASC,OAAO,QAAQ,2BAAwB;AAChD,SACEC,wBAAwB,EACxBC,iBAAiB,QACZ,qCAAkC;AAgBzC,OAAO,MAAMC,eAAe,GAAGA,CAAC;EAC9BC,OAAO;EACPC,oBAAoB;EACpBC,gBAAgB;EAChBC,QAAQ;EACRC,aAAa;EACbC,mBAAmB;EACnBC;AACoB,CAAC,KACrBZ,WAAW,CAAC,YAAY;EACtB,IAAI,CAACO,oBAAoB,EAAE;IACzBL,OAAO,CAACW,KAAK,CAACC,IAAI,CAAC;MACjBC,KAAK,EAAEP,gBAAgB;MACvBQ,KAAK,EAAE;IACT,CAAC,CAAC;IACF;EACF;EAEA,IAAIV,OAAO,CAACW,WAAW,IAAI,CAACX,OAAO,CAACY,OAAO,EAAE;EAC7C,MAAMC,cAAc,GAAGV,QAAQ;;EAE/B;EACA;EACA;EACA;EACA;EACA;EACA;EACA,IAAIU,cAAc,CAACC,MAAM,GAAG,CAAC,EAAE;IAC7B,MAAM;MAAEC;IAAU,CAAC,GAAGlB,wBAAwB,CAACgB,cAAc,CAAC;IAC9D,IAAIE,SAAS,EAAE;MACbnB,OAAO,CAACW,KAAK,CAACC,IAAI,CAAC;QACjBC,KAAK,EAAEd,KAAK,CAAC,0BAA0B,EAAE;UACvCqB,GAAG,EAAEC,MAAM,CAACnB,iBAAiB;QAC/B,CAAC,CAAC;QACFY,KAAK,EAAE;MACT,CAAC,CAAC;IACJ;EACF;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACAN,aAAa,CAAC,CAAC;EACf;EACA;EACAC,mBAAmB,CAAC,CAAC;EACrB,IAAI;IACF,MAAML,OAAO,CAACkB,IAAI,CAACL,cAAc,CAAC;EACpC,CAAC,CAAC,OAAOM,KAAK,EAAE;IACd,IAAIC,OAAO,EAAEC,OAAO,CAACF,KAAK,CAAC,gCAAgC,EAAEA,KAAK,CAAC;EACrE,CAAC,SAAS;IACR;IACA;IACA;IACA;IACA;IACAb,QAAQ,CAACgB,OAAO,EAAEC,KAAK,CAAC,CAAC;EAC3B;EACA;EACA;EACA;AACF,CAAC,EAAE,CACDvB,OAAO,EACPC,oBAAoB,EACpBC,gBAAgB,EAChBC,QAAQ,EACRC,aAAa,EACbC,mBAAmB,EACnBC,QAAQ,CACT,CAAC","ignoreList":[]}
@@ -21,6 +21,7 @@ import { StickerMessage } from "../../../components/messages/stickerMessage/inde
21
21
  import { GROUP_NOTIFICATION_TYPES } from "../../../utils/messageUtils.js";
22
22
  import { Avatar } from "../../../components/Avatar/index.js";
23
23
  import { TAIL_WIDTH } from "../../../components/messages/BubbleTail.js";
24
+ import { perfCountRender } from "../../../utils/perf-marker.js";
24
25
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
25
26
  const messageComponentMap = {
26
27
  [MessageType.TextMessage]: TextMessage,
@@ -61,8 +62,11 @@ export const LegendChatMessage = /*#__PURE__*/memo(({
61
62
  showName = false,
62
63
  showAvatar = false,
63
64
  showSenderGutter = false,
64
- groupPosition
65
+ groupPosition,
66
+ surface = 'timeline',
67
+ isPreview
65
68
  }) => {
69
+ perfCountRender('LegendChatMessage');
66
70
  const handlePress = useCallback(() => {
67
71
  onPress?.(messageId);
68
72
  }, [onPress, messageId]);
@@ -80,6 +84,8 @@ export const LegendChatMessage = /*#__PURE__*/memo(({
80
84
  style: styles.systemMessageWrapper,
81
85
  children: /*#__PURE__*/_jsx(SystemMessageComponent, {
82
86
  message: message,
87
+ messageId: messageId,
88
+ surface: surface,
83
89
  isOutgoing: isOutgoing,
84
90
  createdAtTime: createdAtTime
85
91
  })
@@ -121,10 +127,13 @@ export const LegendChatMessage = /*#__PURE__*/memo(({
121
127
  style: styles.senderName,
122
128
  children: message.senderNickname
123
129
  }), /*#__PURE__*/_jsx(LongPressWrapper, {
124
- onPress: shouldHandlePress ? handlePress : undefined,
125
- onLongPress: handleLongPress,
130
+ onPress: shouldHandlePress && !isPreview ? handlePress : undefined,
131
+ onLongPress: isPreview ? undefined : handleLongPress,
126
132
  children: /*#__PURE__*/_jsx(MessageComponent, {
127
133
  message: message,
134
+ messageId: messageId,
135
+ surface: surface,
136
+ isPreview: isPreview,
128
137
  isOutgoing: isOutgoing,
129
138
  createdAtTime: createdAtTime,
130
139
  onMediaPress: hasMediaPress ? effectiveOnMediaPress : undefined,