@cometchat/chat-uikit-react-native 5.1.2 → 5.2.0

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 (200) hide show
  1. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  2. package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
  3. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  4. package/android/.gradle/7.4/gc.properties +0 -0
  5. package/android/.gradle/vcs-1/gc.properties +0 -0
  6. package/lib/CometChatAIAssistantChatHistory/CometChatAIAssistantChatHistory.d.ts +40 -0
  7. package/lib/CometChatAIAssistantChatHistory/CometChatAIAssistantChatHistory.js +467 -0
  8. package/lib/CometChatAIAssistantChatHistory/CometChatAIAssistantChatHistory.js.map +1 -0
  9. package/lib/CometChatAIAssistantChatHistory/Skeleton.d.ts +24 -0
  10. package/lib/CometChatAIAssistantChatHistory/Skeleton.js +130 -0
  11. package/lib/CometChatAIAssistantChatHistory/Skeleton.js.map +1 -0
  12. package/lib/CometChatAIAssistantChatHistory/index.d.ts +1 -0
  13. package/lib/CometChatAIAssistantChatHistory/index.js +2 -0
  14. package/lib/CometChatAIAssistantChatHistory/index.js.map +1 -0
  15. package/lib/CometChatAIAssistantChatHistory/style.d.ts +30 -0
  16. package/lib/CometChatAIAssistantChatHistory/style.js +122 -0
  17. package/lib/CometChatAIAssistantChatHistory/style.js.map +1 -0
  18. package/lib/CometChatConversations/CometChatConversations.js +26 -5
  19. package/lib/CometChatConversations/CometChatConversations.js.map +1 -1
  20. package/lib/CometChatMessageComposer/CometChatMessageComposer.d.ts +7 -0
  21. package/lib/CometChatMessageComposer/CometChatMessageComposer.js +101 -13
  22. package/lib/CometChatMessageComposer/CometChatMessageComposer.js.map +1 -1
  23. package/lib/CometChatMessageHeader/CometChatMessageHeader.d.ts +16 -0
  24. package/lib/CometChatMessageHeader/CometChatMessageHeader.js +63 -13
  25. package/lib/CometChatMessageHeader/CometChatMessageHeader.js.map +1 -1
  26. package/lib/CometChatMessageList/CometChatMessageList.d.ts +33 -0
  27. package/lib/CometChatMessageList/CometChatMessageList.js +535 -76
  28. package/lib/CometChatMessageList/CometChatMessageList.js.map +1 -1
  29. package/lib/CometChatMessageList/style.js +74 -2
  30. package/lib/CometChatMessageList/style.js.map +1 -1
  31. package/lib/calls/CometChatIncomingCall/CometChatIncomingCall.js +6 -12
  32. package/lib/calls/CometChatIncomingCall/CometChatIncomingCall.js.map +1 -1
  33. package/lib/calls/CometChatOutgoingCall/CometChatOutgoingCall.js +4 -3
  34. package/lib/calls/CometChatOutgoingCall/CometChatOutgoingCall.js.map +1 -1
  35. package/lib/extensions/Polls/Polls.js +38 -17
  36. package/lib/extensions/Polls/Polls.js.map +1 -1
  37. package/lib/index.d.ts +5 -1
  38. package/lib/index.js +6 -2
  39. package/lib/index.js.map +1 -1
  40. package/lib/shared/constants/UIKitConstants.d.ts +16 -0
  41. package/lib/shared/constants/UIKitConstants.js +16 -0
  42. package/lib/shared/constants/UIKitConstants.js.map +1 -1
  43. package/lib/shared/events/CometChatMessageEvents/index.d.ts +3 -0
  44. package/lib/shared/events/CometChatMessageEvents/index.js +3 -0
  45. package/lib/shared/events/CometChatMessageEvents/index.js.map +1 -1
  46. package/lib/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.js +3 -0
  47. package/lib/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.js.map +1 -1
  48. package/lib/shared/events/CometChatUIEventHandler/Listener.d.ts +3 -1
  49. package/lib/shared/events/CometChatUIEventHandler/Listener.js +4 -1
  50. package/lib/shared/events/CometChatUIEventHandler/Listener.js.map +1 -1
  51. package/lib/shared/events/ListenerInitializer.d.ts +3 -1
  52. package/lib/shared/events/ListenerInitializer.js +5 -1
  53. package/lib/shared/events/ListenerInitializer.js.map +1 -1
  54. package/lib/shared/events/messages.d.ts +2 -1
  55. package/lib/shared/events/messages.js +1 -0
  56. package/lib/shared/events/messages.js.map +1 -1
  57. package/lib/shared/framework/DataSource.d.ts +3 -1
  58. package/lib/shared/framework/DataSourceDecorator.d.ts +3 -1
  59. package/lib/shared/framework/DataSourceDecorator.js +8 -2
  60. package/lib/shared/framework/DataSourceDecorator.js.map +1 -1
  61. package/lib/shared/framework/MessageDataSource.d.ts +6 -0
  62. package/lib/shared/framework/MessageDataSource.js +64 -1
  63. package/lib/shared/framework/MessageDataSource.js.map +1 -1
  64. package/lib/shared/icons/components/ai-chat-history.d.ts +8 -0
  65. package/lib/shared/icons/components/ai-chat-history.js +9 -0
  66. package/lib/shared/icons/components/ai-chat-history.js.map +1 -0
  67. package/lib/shared/icons/components/ai-copy-option.d.ts +8 -0
  68. package/lib/shared/icons/components/ai-copy-option.js +9 -0
  69. package/lib/shared/icons/components/ai-copy-option.js.map +1 -0
  70. package/lib/shared/icons/components/ai-new-chat.d.ts +8 -0
  71. package/lib/shared/icons/components/ai-new-chat.js +9 -0
  72. package/lib/shared/icons/components/ai-new-chat.js.map +1 -0
  73. package/lib/shared/icons/components/ai-send-button.d.ts +8 -0
  74. package/lib/shared/icons/components/ai-send-button.js +9 -0
  75. package/lib/shared/icons/components/ai-send-button.js.map +1 -0
  76. package/lib/shared/icons/components/right-arrow.d.ts +3 -0
  77. package/lib/shared/icons/components/right-arrow.js +6 -0
  78. package/lib/shared/icons/components/right-arrow.js.map +1 -0
  79. package/lib/shared/icons/components/stop-fill.js +8 -7
  80. package/lib/shared/icons/components/stop-fill.js.map +1 -1
  81. package/lib/shared/icons/icon-mapping.d.ts +11 -0
  82. package/lib/shared/icons/icon-mapping.js +11 -0
  83. package/lib/shared/icons/icon-mapping.js.map +1 -1
  84. package/lib/shared/modals/CometChatAIAssistantTools.d.ts +47 -0
  85. package/lib/shared/modals/CometChatAIAssistantTools.js +44 -0
  86. package/lib/shared/modals/CometChatAIAssistantTools.js.map +1 -0
  87. package/lib/shared/modals/StreamMessage.d.ts +4 -0
  88. package/lib/shared/modals/StreamMessage.js +11 -0
  89. package/lib/shared/modals/StreamMessage.js.map +1 -0
  90. package/lib/shared/modals/index.d.ts +3 -1
  91. package/lib/shared/modals/index.js +3 -1
  92. package/lib/shared/modals/index.js.map +1 -1
  93. package/lib/shared/resources/CometChatLocalizeNew/CometChatLocalizationHelper.d.ts +126 -0
  94. package/lib/shared/resources/CometChatLocalizeNew/resources/de/translation.json +7 -1
  95. package/lib/shared/resources/CometChatLocalizeNew/resources/en/translation.json +7 -1
  96. package/lib/shared/resources/CometChatLocalizeNew/resources/es/translation.json +7 -1
  97. package/lib/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +7 -1
  98. package/lib/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +7 -1
  99. package/lib/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +7 -1
  100. package/lib/shared/resources/CometChatLocalizeNew/resources/it/translation.json +7 -1
  101. package/lib/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +7 -1
  102. package/lib/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +7 -1
  103. package/lib/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +7 -1
  104. package/lib/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +7 -1
  105. package/lib/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +7 -1
  106. package/lib/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +7 -1
  107. package/lib/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +7 -1
  108. package/lib/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +7 -1
  109. package/lib/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +7 -1
  110. package/lib/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +7 -1
  111. package/lib/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +7 -1
  112. package/lib/shared/services/stream-message.service.d.ts +84 -0
  113. package/lib/shared/services/stream-message.service.js +406 -0
  114. package/lib/shared/services/stream-message.service.js.map +1 -0
  115. package/lib/shared/views/CometChatAIAssistantMessageBubble/CometChatAIAssistantMessageBubble.d.ts +9 -0
  116. package/lib/shared/views/CometChatAIAssistantMessageBubble/CometChatAIAssistantMessageBubble.js +248 -0
  117. package/lib/shared/views/CometChatAIAssistantMessageBubble/CometChatAIAssistantMessageBubble.js.map +1 -0
  118. package/lib/shared/views/CometChatAIAssistantMessageBubble/index.d.ts +3 -0
  119. package/lib/shared/views/CometChatAIAssistantMessageBubble/index.js +4 -0
  120. package/lib/shared/views/CometChatAIAssistantMessageBubble/index.js.map +1 -0
  121. package/lib/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.js +5 -2
  122. package/lib/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.js.map +1 -1
  123. package/lib/shared/views/CometChatImageBubble/CometChatImageLoader.js +1 -1
  124. package/lib/shared/views/CometChatImageBubble/CometChatImageLoader.js.map +1 -1
  125. package/lib/shared/views/CometChatImageViewerModal/ImageViewerModal.js +52 -32
  126. package/lib/shared/views/CometChatImageViewerModal/ImageViewerModal.js.map +1 -1
  127. package/lib/shared/views/CometChatSendButtonView/CometChatSendButtonView.d.ts +10 -0
  128. package/lib/shared/views/CometChatSendButtonView/CometChatSendButtonView.js +54 -0
  129. package/lib/shared/views/CometChatSendButtonView/CometChatSendButtonView.js.map +1 -0
  130. package/lib/shared/views/CometChatSendButtonView/index.d.ts +1 -0
  131. package/lib/shared/views/CometChatSendButtonView/index.js +2 -0
  132. package/lib/shared/views/CometChatSendButtonView/index.js.map +1 -0
  133. package/lib/shared/views/CometChatStreamMessageBubble/CometChatStreamMessageBubble.d.ts +8 -0
  134. package/lib/shared/views/CometChatStreamMessageBubble/CometChatStreamMessageBubble.js +436 -0
  135. package/lib/shared/views/CometChatStreamMessageBubble/CometChatStreamMessageBubble.js.map +1 -0
  136. package/lib/shared/views/CometChatStreamMessageBubble/index.d.ts +3 -0
  137. package/lib/shared/views/CometChatStreamMessageBubble/index.js +3 -0
  138. package/lib/shared/views/CometChatStreamMessageBubble/index.js.map +1 -0
  139. package/lib/shared/views/CometChatTextBubble/CometChatTextBubble.d.ts +14 -6
  140. package/lib/shared/views/CometChatTextBubble/CometChatTextBubble.js +82 -57
  141. package/lib/shared/views/CometChatTextBubble/CometChatTextBubble.js.map +1 -1
  142. package/lib/theme/context.d.ts +96 -15
  143. package/lib/theme/type.d.ts +14 -1
  144. package/package.json +5 -2
  145. package/src/CometChatAIAssistantChatHistory/CometChatAIAssistantChatHistory.tsx +627 -0
  146. package/src/CometChatAIAssistantChatHistory/Skeleton.tsx +228 -0
  147. package/src/CometChatAIAssistantChatHistory/index.ts +2 -0
  148. package/src/CometChatAIAssistantChatHistory/style.ts +160 -0
  149. package/src/CometChatConversations/CometChatConversations.tsx +36 -10
  150. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +137 -19
  151. package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +106 -18
  152. package/src/CometChatMessageList/CometChatMessageList.tsx +619 -72
  153. package/src/CometChatMessageList/style.ts +74 -2
  154. package/src/index.ts +31 -1
  155. package/src/shared/constants/UIKitConstants.ts +17 -0
  156. package/src/shared/events/CometChatMessageEvents/index.ts +3 -1
  157. package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +3 -0
  158. package/src/shared/events/CometChatUIEventHandler/Listener.ts +4 -0
  159. package/src/shared/events/ListenerInitializer.ts +6 -1
  160. package/src/shared/events/messages.ts +1 -0
  161. package/src/shared/framework/DataSource.ts +4 -2
  162. package/src/shared/framework/DataSourceDecorator.tsx +10 -2
  163. package/src/shared/framework/MessageDataSource.tsx +75 -2
  164. package/src/shared/icons/Icon.tsx +1 -1
  165. package/src/shared/icons/components/ai-chat-history.tsx +21 -0
  166. package/src/shared/icons/components/ai-copy-option.tsx +21 -0
  167. package/src/shared/icons/components/ai-new-chat.tsx +21 -0
  168. package/src/shared/icons/components/ai-send-button.tsx +24 -0
  169. package/src/shared/icons/components/right-arrow.tsx +13 -0
  170. package/src/shared/icons/components/stop-fill.tsx +14 -12
  171. package/src/shared/icons/icon-mapping.tsx +14 -0
  172. package/src/shared/modals/CometChatAIAssistantTools.ts +65 -0
  173. package/src/shared/modals/StreamMessage.ts +12 -0
  174. package/src/shared/modals/index.ts +5 -1
  175. package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +7 -1
  176. package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +7 -1
  177. package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +7 -1
  178. package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +7 -1
  179. package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +7 -2
  180. package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +7 -1
  181. package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +7 -1
  182. package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +7 -1
  183. package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +7 -1
  184. package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +7 -1
  185. package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +7 -1
  186. package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +7 -1
  187. package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +7 -1
  188. package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +7 -1
  189. package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +7 -1
  190. package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +7 -1
  191. package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +7 -1
  192. package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +7 -1
  193. package/src/shared/services/stream-message.service.ts +470 -0
  194. package/src/shared/views/CometChatAIAssistantMessageBubble/CometChatAIAssistantMessageBubble.tsx +262 -0
  195. package/src/shared/views/CometChatAIAssistantMessageBubble/index.ts +4 -0
  196. package/src/shared/views/CometChatSendButtonView/CometChatSendButtonView.tsx +86 -0
  197. package/src/shared/views/CometChatSendButtonView/index.ts +1 -0
  198. package/src/shared/views/CometChatStreamMessageBubble/CometChatStreamMessageBubble.tsx +493 -0
  199. package/src/shared/views/CometChatStreamMessageBubble/index.ts +9 -0
  200. package/src/theme/type.ts +14 -1
@@ -0,0 +1,228 @@
1
+ import React, { useEffect, useMemo, useRef } from "react";
2
+ import { Animated, Dimensions, Easing, ScrollView, StyleSheet, View } from "react-native";
3
+ import Svg, { Defs, LinearGradient, Rect, Stop } from "react-native-svg";
4
+ import { useTheme } from "../theme";
5
+ import type { ColorValue } from "react-native";
6
+ import { CometChatTheme } from "../theme/type";
7
+
8
+ /**
9
+ * Animated skeleton placeholder mimicking chat history in CometChat UI‑Kit.
10
+ *
11
+ * The component respects the defaults provided by `theme.chatHistoryStyles.skeletonStyle`,
12
+ * but every visual property can be **overridden per instance** using the
13
+ * `style` prop.
14
+ */
15
+ export interface SkeletonProps {
16
+ /** Partial style overrides (theme fallback for omitted keys). */
17
+ style?: Partial<SkeletonStyle>;
18
+ }
19
+
20
+ /** Alias for the skeleton style slice inside the theme. */
21
+ type SkeletonStyle = {
22
+ backgroundColor?: ColorValue;
23
+ linearGradientColors?: [string, string];
24
+ shimmerBackgroundColor?: ColorValue;
25
+ shimmerOpacity?: number;
26
+ speed?: number;
27
+ containerBackgroundColor?: ColorValue;
28
+ };
29
+
30
+ // ──────────────────────────────────────────────────────────────────────────────
31
+ // Utility helpers
32
+ // ──────────────────────────────────────────────────────────────────────────────
33
+
34
+ function getStyleValue<K extends keyof SkeletonStyle>(
35
+ key: K,
36
+ overrides: Partial<SkeletonStyle> | undefined,
37
+ theme: CometChatTheme
38
+ ): NonNullable<SkeletonStyle[K]> {
39
+ // Use userStyles as fallback since it's guaranteed to exist
40
+ const fallbackSkeletonStyle = theme.userStyles.skeletonStyle;
41
+ const themeValue = (theme as any).chatHistoryStyles?.skeletonStyle?.[key];
42
+ return ((overrides?.[key] as SkeletonStyle[K]) ??
43
+ themeValue ??
44
+ fallbackSkeletonStyle[key]) as NonNullable<SkeletonStyle[K]>;
45
+ }
46
+
47
+ // ──────────────────────────────────────────────────────────────────────────────
48
+ // Layout constants – adapted for chat history structure
49
+ // ──────────────────────────────────────────────────────────────────────────────
50
+
51
+ const { width: SCREEN_WIDTH } = Dimensions.get("window");
52
+
53
+ const PADDING = 20;
54
+ const SECTION_HEADER_HEIGHT = 16;
55
+ const SECTION_SPACING = 25;
56
+ const MESSAGE_HEIGHT = 18;
57
+ const MESSAGE_SPACING = 32;
58
+ const SECTIONS_COUNT = 3;
59
+ const MESSAGES_PER_SECTION = 4;
60
+
61
+ /** Total height required for the SVG canvas */
62
+ const TOTAL_HEIGHT =
63
+ SECTIONS_COUNT * (SECTION_HEADER_HEIGHT + SECTION_SPACING + MESSAGES_PER_SECTION * (MESSAGE_HEIGHT + MESSAGE_SPACING)) +
64
+ PADDING * 2;
65
+
66
+ // ──────────────────────────────────────────────────────────────────────────────
67
+ // SVG elements factory (memoized for perf)
68
+ // ──────────────────────────────────────────────────────────────────────────────
69
+
70
+ const useHistoryElements = (fill: ColorValue) =>
71
+ useMemo(() => {
72
+ const elements: React.ReactElement[] = [];
73
+ let currentY = PADDING;
74
+
75
+ // Chat history sections
76
+ for (let sectionIndex = 0; sectionIndex < SECTIONS_COUNT; sectionIndex++) {
77
+ // Section header (Today, Yesterday, etc.)
78
+ elements.push(
79
+ <Rect
80
+ key={`section-${sectionIndex}`}
81
+ x={PADDING}
82
+ y={currentY}
83
+ width={60 + sectionIndex * 20} // Varying widths for different date labels
84
+ height={SECTION_HEADER_HEIGHT}
85
+ rx={SECTION_HEADER_HEIGHT / 2}
86
+ fill={fill as string}
87
+ />
88
+ );
89
+ currentY += SECTION_HEADER_HEIGHT + SECTION_SPACING;
90
+
91
+ // Messages in this section
92
+ for (let messageIndex = 0; messageIndex < MESSAGES_PER_SECTION; messageIndex++) {
93
+ const messageWidth = SCREEN_WIDTH - PADDING * 2 - (messageIndex * 30); // Varying message widths
94
+ elements.push(
95
+ <Rect
96
+ key={`message-${sectionIndex}-${messageIndex}`}
97
+ x={PADDING}
98
+ y={currentY}
99
+ width={Math.max(messageWidth, SCREEN_WIDTH * 0.4)} // Minimum width
100
+ height={MESSAGE_HEIGHT}
101
+ rx={MESSAGE_HEIGHT / 2}
102
+ fill={fill as string}
103
+ />
104
+ );
105
+ currentY += MESSAGE_HEIGHT + MESSAGE_SPACING;
106
+ }
107
+ currentY += 10; // Extra spacing between sections
108
+ }
109
+
110
+ return elements;
111
+ }, [fill]);
112
+
113
+ // ──────────────────────────────────────────────────────────────────────────────
114
+ // Component Implementation
115
+ // ──────────────────────────────────────────────────────────────────────────────
116
+
117
+ export const Skeleton: React.FC<SkeletonProps> = ({ style }) => {
118
+ const theme = useTheme();
119
+ const get = <K extends keyof SkeletonStyle>(key: K) => getStyleValue(key, style, theme);
120
+
121
+ // Shimmer animation ------------------------------------------
122
+ const translate = useRef(new Animated.Value(0)).current;
123
+
124
+ useEffect(() => {
125
+ const speed = get("speed");
126
+ const duration = 1000 / speed;
127
+ const loop = Animated.loop(
128
+ Animated.timing(translate, {
129
+ toValue: 1,
130
+ duration,
131
+ easing: Easing.linear,
132
+ useNativeDriver: false, // SVG not yet compatible with native driver
133
+ })
134
+ );
135
+
136
+ loop.start();
137
+ return () => loop.stop();
138
+ }, [get, translate]);
139
+
140
+ const translateX = translate.interpolate({
141
+ inputRange: [0, 1],
142
+ outputRange: [-SCREEN_WIDTH * 2, SCREEN_WIDTH],
143
+ });
144
+
145
+ // Pre‑build elements (bottom gradient + top mask)
146
+ const elementsGradient = useHistoryElements("url(#gradient)");
147
+ const elementsSolid = useHistoryElements(String(get("backgroundColor")));
148
+
149
+ return (
150
+ <ScrollView
151
+ scrollEnabled={false}
152
+ showsVerticalScrollIndicator={false}
153
+ style={{ backgroundColor: get("containerBackgroundColor") }}
154
+ >
155
+ {/* Bottom layer (gradient fill) */}
156
+ <Svg
157
+ height={TOTAL_HEIGHT}
158
+ width={SCREEN_WIDTH}
159
+ fill='none'
160
+ preserveAspectRatio='xMidYMid meet'
161
+ >
162
+ <Defs>
163
+ <LinearGradient
164
+ id='gradient'
165
+ x1='0'
166
+ y1='0'
167
+ x2={SCREEN_WIDTH}
168
+ y2='0'
169
+ gradientUnits='userSpaceOnUse'
170
+ >
171
+ {(() => {
172
+ const colors = get("linearGradientColors");
173
+ return [
174
+ <Stop key={0} stopColor={colors[0]} />,
175
+ <Stop key={1} offset='1' stopColor={colors[1]} />,
176
+ ];
177
+ })()}
178
+ </LinearGradient>
179
+ </Defs>
180
+ {elementsGradient}
181
+ </Svg>
182
+
183
+ {/* Moving shimmer highlight (rendered twice for coverage) */}
184
+ {[0, SCREEN_WIDTH / 2].map((offset) => (
185
+ <Animated.View
186
+ key={offset}
187
+ style={[
188
+ styles.shimmer,
189
+ {
190
+ transform: [
191
+ { translateX: Animated.add(translateX, offset) },
192
+ { translateY: -20 },
193
+ { rotate: "15deg" },
194
+ ],
195
+ backgroundColor: get("shimmerBackgroundColor"),
196
+ opacity: get("shimmerOpacity"),
197
+ },
198
+ ]}
199
+ />
200
+ ))}
201
+
202
+ {/* Top mask – solid shapes clip the shimmer to elements */}
203
+ <View style={StyleSheet.absoluteFill} pointerEvents='none'>
204
+ <Svg
205
+ height={TOTAL_HEIGHT}
206
+ width={SCREEN_WIDTH}
207
+ fill='none'
208
+ preserveAspectRatio='xMidYMid meet'
209
+ >
210
+ {elementsSolid}
211
+ </Svg>
212
+ </View>
213
+ </ScrollView>
214
+ );
215
+ };
216
+
217
+ // ──────────────────────────────────────────────────────────────────────────────
218
+ // Styles
219
+ // ──────────────────────────────────────────────────────────────────────────────
220
+
221
+ const styles = StyleSheet.create({
222
+ shimmer: {
223
+ position: "absolute",
224
+ width: "25%", // thin bar for highlight
225
+ top: 0,
226
+ bottom: 0,
227
+ },
228
+ });
@@ -0,0 +1,2 @@
1
+ export { CometChatAIAssistantChatHistory } from "./CometChatAIAssistantChatHistory";
2
+
@@ -0,0 +1,160 @@
1
+ import { ColorValue, ViewStyle, TextStyle } from "react-native";
2
+ import { deepMerge } from "../shared/helper/helperFunctions";
3
+ import { CometChatTheme } from "../theme/type";
4
+ import { DeepPartial } from "../shared/helper/types";
5
+
6
+ export type ChatHistoryStyle = {
7
+ containerStyle: ViewStyle;
8
+ headerStyle: ViewStyle;
9
+ headerContentStyle: ViewStyle;
10
+ headerTitleStyle: TextStyle;
11
+ closeButtonStyle: ViewStyle;
12
+ closeButtonTextStyle: TextStyle;
13
+ newChatButtonStyle: ViewStyle;
14
+ newChatTextStyle: TextStyle;
15
+ listContainerStyle: ViewStyle;
16
+ sectionHeaderStyle: ViewStyle;
17
+ sectionHeaderTextStyle: TextStyle;
18
+ messageItemStyle: ViewStyle;
19
+ messageTextStyle: TextStyle;
20
+ centerContainerStyle: ViewStyle;
21
+ stateTitleStyle: TextStyle;
22
+ stateTextStyle: TextStyle;
23
+ footerLoaderStyle: ViewStyle;
24
+ skeletonStyle: {
25
+ linearGradientColors: [string, string];
26
+ shimmerBackgroundColor: ColorValue;
27
+ shimmerOpacity: number;
28
+ speed: number;
29
+ };
30
+ };
31
+
32
+ export const getChatHistoryStyleLight = (
33
+ color: CometChatTheme["color"],
34
+ spacing: CometChatTheme["spacing"],
35
+ typography: CometChatTheme["typography"]
36
+ ): DeepPartial<ChatHistoryStyle> => {
37
+ return {
38
+ containerStyle: {
39
+ flex: 1,
40
+ backgroundColor: color.background3,
41
+ },
42
+ headerStyle: {
43
+ paddingTop: spacing.padding.p4,
44
+ paddingBottom: spacing.padding.p4,
45
+ backgroundColor: color.background3,
46
+ },
47
+ headerContentStyle: {
48
+ flexDirection: 'row',
49
+ alignItems: 'center',
50
+ paddingHorizontal: spacing.padding.p3,
51
+ borderBottomColor: color.borderDefault,
52
+ borderBottomWidth: 1,
53
+ paddingBottom: spacing.padding.p4,
54
+ width: '100%',
55
+ },
56
+ headerTitleStyle: {
57
+ fontSize: typography.heading4.medium.fontSize,
58
+ fontWeight: typography.heading4.medium.fontWeight,
59
+ color: color.textPrimary,
60
+ marginLeft: spacing.margin.m2,
61
+ ...typography.heading4.medium,
62
+ fontFamily: typography.heading4.medium.fontFamily,
63
+ },
64
+ closeButtonStyle: {
65
+ width: 32,
66
+ height: 32,
67
+ alignItems: 'center',
68
+ justifyContent: 'center',
69
+ },
70
+ closeButtonTextStyle: {
71
+ fontSize: 18,
72
+ color: color.textSecondary,
73
+ },
74
+ newChatButtonStyle: {
75
+ flexDirection: 'row',
76
+ alignItems: 'center',
77
+ paddingHorizontal: spacing.padding.p4,
78
+ paddingVertical: spacing.padding.p2,
79
+ marginBottom: spacing.margin.m2,
80
+ backgroundColor: color.background3,
81
+ },
82
+ newChatTextStyle: {
83
+ fontSize: typography.body.regular.fontSize,
84
+ marginLeft: spacing.margin.m3,
85
+ fontWeight: typography.body.regular.fontWeight,
86
+ color: color.textPrimary,
87
+ ...typography.body.regular,
88
+ },
89
+ listContainerStyle: {
90
+ paddingHorizontal: spacing.padding.p5,
91
+ },
92
+ sectionHeaderStyle: {
93
+ paddingVertical: spacing.padding.p2,
94
+ backgroundColor: color.background3,
95
+ borderBottomWidth: 1,
96
+ borderBottomColor: color.borderLight,
97
+ },
98
+ sectionHeaderTextStyle: {
99
+ fontSize: typography.caption1.medium.fontSize,
100
+ fontWeight: typography.caption1.medium.fontWeight,
101
+ textTransform: 'capitalize',
102
+ color: color.textTertiary,
103
+ ...typography.caption1.medium,
104
+ },
105
+ messageItemStyle: {
106
+ paddingVertical: spacing.padding.p3,
107
+ },
108
+ messageTextStyle: {
109
+ fontSize: typography.body.regular.fontSize,
110
+ lineHeight: 20,
111
+ color: color.textPrimary,
112
+ ...typography.body.regular,
113
+ },
114
+ centerContainerStyle: {
115
+ flex: 1,
116
+ justifyContent: 'center',
117
+ alignItems: 'center',
118
+ padding: spacing.padding.p5,
119
+ backgroundColor: color.background3,
120
+ },
121
+ stateTitleStyle: {
122
+ fontSize: 18,
123
+ fontWeight: 'bold',
124
+ marginBottom: spacing.margin.m2,
125
+ color: color.textPrimary,
126
+ ...typography.heading3.bold,
127
+ },
128
+ stateTextStyle: {
129
+ fontSize: 16,
130
+ textAlign: 'center',
131
+ color: color.textSecondary,
132
+ ...typography.body.regular,
133
+ },
134
+ footerLoaderStyle: {
135
+ paddingVertical: spacing.padding.p4,
136
+ alignItems: 'center',
137
+ },
138
+ skeletonStyle: {
139
+ linearGradientColors: ["#E8E8E8", "#F5F5F5"],
140
+ shimmerBackgroundColor: color.background3,
141
+ shimmerOpacity: 0.01,
142
+ speed: 0.1,
143
+ },
144
+ };
145
+ };
146
+
147
+ export const getChatHistoryStyleDark = (
148
+ color: CometChatTheme["color"],
149
+ spacing: CometChatTheme["spacing"],
150
+ typography: CometChatTheme["typography"]
151
+ ): DeepPartial<ChatHistoryStyle> => {
152
+ return deepMerge(getChatHistoryStyleLight(color, spacing, typography), {
153
+ skeletonStyle: {
154
+ linearGradientColors: ["#383838", "#272727"],
155
+ shimmerBackgroundColor: color.background3,
156
+ shimmerOpacity: 0.01,
157
+ speed: 0.1,
158
+ },
159
+ });
160
+ };
@@ -1507,7 +1507,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
1507
1507
  const withObj = conv.getConversationWith();
1508
1508
  const avatarURL = withObj instanceof CometChat.User ? withObj.getAvatar() : withObj.getIcon();
1509
1509
  const name = withObj.getName();
1510
-
1510
+
1511
1511
  return (
1512
1512
  <>
1513
1513
  <CometChatAvatar
@@ -1526,19 +1526,45 @@ export const CometChatConversations = (props: ConversationInterface) => {
1526
1526
  );
1527
1527
 
1528
1528
  const TitleViewRaw = useCallback(
1529
- (conv: CometChat.Conversation) => (
1530
- <Text numberOfLines={1} ellipsizeMode='tail' style={mergedStyles.itemStyle.titleStyle}>
1531
- {conv.getConversationWith().getName()}
1532
- </Text>
1533
- ),
1529
+ (conv: CometChat.Conversation) => {
1530
+ const conversationWith = conv.getConversationWith();
1531
+ const isAgentic = conversationWith instanceof CometChat.User && conversationWith.getRole() === "@agentic";
1532
+
1533
+ return (
1534
+ <View style={[
1535
+ { flex: 1 },
1536
+ isAgentic ? { justifyContent: 'center' } : null
1537
+ ]}>
1538
+ <Text
1539
+ numberOfLines={1}
1540
+ ellipsizeMode='tail'
1541
+ style={mergedStyles.itemStyle.titleStyle}
1542
+ >
1543
+ {conversationWith.getName()}
1544
+ </Text>
1545
+ </View>
1546
+ );
1547
+ },
1534
1548
  [mergedStyles]
1535
1549
  );
1536
1550
 
1537
- const SubtitleViewRaw = (conv: CometChat.Conversation) => (
1538
- <LastMessageView conversations={conv} typingText={conv?.["lastMessage"]?.["typing"]} />
1539
- );
1551
+ const SubtitleViewRaw = (conv: CometChat.Conversation) => {
1552
+ const conversationWith = conv.getConversationWith();
1553
+ if (conversationWith instanceof CometChat.User && conversationWith.getRole() === "@agentic") {
1554
+ return <></>;
1555
+ }
1556
+ return (
1557
+ <LastMessageView conversations={conv} typingText={conv?.["lastMessage"]?.["typing"]} />
1558
+ );
1559
+ };
1540
1560
 
1541
- const TrailingViewRaw = useCallback((conv: CometChat.Conversation) => getTrailingView(conv), []);
1561
+ const TrailingViewRaw = useCallback((conv: CometChat.Conversation) => {
1562
+ const conversationWith = conv.getConversationWith();
1563
+ if (conversationWith instanceof CometChat.User && conversationWith.getRole() === "@agentic") {
1564
+ return <></>;
1565
+ }
1566
+ return getTrailingView(conv);
1567
+ }, [getTrailingView]);
1542
1568
 
1543
1569
  return (
1544
1570
  <View style={mergedStyles.containerStyle}>