@cometchat/chat-uikit-react-native 5.5.0 → 5.5.1

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 (72) hide show
  1. package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorView.kt +20 -0
  2. package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorViewManager.kt +9 -1
  3. package/ios/RichTextEditorView.swift +43 -0
  4. package/ios/RichTextEditorViewManager.m +1 -0
  5. package/ios/RichTextEditorViewManager.swift +8 -0
  6. package/package.json +5 -2
  7. package/src/CometChatCompactMessageComposer/CometChatCompactMessageComposer.tsx +38 -9
  8. package/src/CometChatConversations/CometChatConversations.tsx +8 -1
  9. package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +2 -2
  10. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +15 -3
  11. package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +10 -1
  12. package/src/CometChatMessageList/CometChatMessageList.tsx +5 -2
  13. package/src/CometChatMessageList/PERFORMANCE_ARCHITECTURE.md +478 -0
  14. package/src/CometChatMessageList/SEARCH_NAV_PERF_PLAN.md +613 -0
  15. package/src/CometChatMessageList/SEARCH_NAV_SLOWNESS_FINDINGS_AND_FIX.md +313 -0
  16. package/src/CometChatMessageList/components/MessageOptionsSheet.tsx +7 -8
  17. package/src/CometChatPinnedMessages/CometChatPinnedMessages.tsx +43 -19
  18. package/src/CometChatRichTextEditor/index.tsx +4 -0
  19. package/src/CometChatRichTextEditor/types.ts +2 -0
  20. package/src/CometChatSavedMessages/CometChatSavedMessages.tsx +251 -14
  21. package/src/CometChatSearch/CometChatSearch.tsx +29 -6
  22. package/src/shared/CometChatUiKit/CometChatUIKit.changes.md +76 -0
  23. package/src/shared/CometChatUiKit/CometChatUIKit.ts +2 -1
  24. package/src/shared/CometChatUiKit/checkAuthSettings-review.md +211 -0
  25. package/src/shared/constants/UIKitConstants.ts +3 -17
  26. package/src/shared/constants/textPatterns.ts +27 -0
  27. package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +25 -259
  28. package/src/shared/formatters/CometChatRichTextFormatter/index.tsx +31 -19
  29. package/src/shared/formatters/CometChatTextFormatter.ts +22 -0
  30. package/src/shared/formatters/applyRawFormatters.ts +31 -0
  31. package/src/shared/framework/MessageDataSource.tsx +14 -8
  32. package/src/shared/resources/CometChatLocalizeNew/CometChatI18nProvider.tsx +15 -30
  33. package/src/shared/resources/CometChatLocalizeNew/CometChatLocalizationHelper.ts +138 -19
  34. package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +74 -1
  35. package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +0 -1
  36. package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +54 -1
  37. package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +54 -1
  38. package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +54 -1
  39. package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +54 -1
  40. package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +54 -1
  41. package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +54 -1
  42. package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +54 -1
  43. package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +54 -1
  44. package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +54 -1
  45. package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +54 -1
  46. package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +54 -1
  47. package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +54 -1
  48. package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +54 -1
  49. package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +54 -1
  50. package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +54 -1
  51. package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +54 -1
  52. package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +11 -0
  53. package/src/shared/utils/MarkdownUtils.ts +34 -4
  54. package/src/shared/utils/PinnedMessagesHelper.ts +65 -0
  55. package/src/shared/utils/SavedMessagesHelper.ts +42 -6
  56. package/src/shared/utils/__testUtils__/messagesRequestBuilderMock.ts +37 -0
  57. package/src/shared/utils/cloneRequestBuilder.ts +25 -0
  58. package/src/shared/views/ClipboardPasteHandler/ClipboardPasteHandler.ts +15 -4
  59. package/src/shared/views/CometChatAudiosBubble/CometChatAudiosBubble.tsx +5 -0
  60. package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +4 -1
  61. package/src/shared/views/CometChatCaptionText/CometChatCaptionText.tsx +8 -1
  62. package/src/shared/views/CometChatFilesBubble/CometChatFilesBubble.tsx +5 -0
  63. package/src/shared/views/CometChatImagesBubble/CometChatImagesBubble.tsx +5 -0
  64. package/src/shared/views/CometChatList/Header.tsx +8 -2
  65. package/src/shared/views/CometChatVideosBubble/CometChatVideosBubble.tsx +5 -0
  66. package/src/shared/views/CometChatVoiceNoteBubble/CometChatVoiceNoteBubble.tsx +5 -0
  67. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  68. package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
  69. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  70. package/android/.gradle/7.4/gc.properties +0 -0
  71. package/android/.gradle/vcs-1/gc.properties +0 -0
  72. package/src/CometChatMessageList/MANUAL_TEST_CASES.md +0 -154
@@ -0,0 +1,37 @@
1
+ /**
2
+ * The SDK stub both request-builder helpers test against.
3
+ *
4
+ * build() MUTATES, like the real SDK 4.1.0 — it folds `category` into `categories`.
5
+ * That line is the point of the stub: a kinder mock let a shallow clone through,
6
+ * because the copy shared the caller's array and the push landed on THEIR builder.
7
+ */
8
+ export const messagesRequestBuilderMock = () => ({
9
+ CometChat: {
10
+ MessagesRequestBuilder: class {
11
+ limit?: number;
12
+ savedOnly?: boolean;
13
+ pinnedOnly?: boolean;
14
+ uid?: string;
15
+ guid?: string;
16
+ category?: string;
17
+ categories?: string[];
18
+ setLimit(l: number) { this.limit = l; return this; }
19
+ setSavedOnly(v: boolean) { this.savedOnly = v; return this; }
20
+ setPinnedOnly(v: boolean) { this.pinnedOnly = v; return this; }
21
+ setUID(u: string) { this.uid = u; return this; }
22
+ setGUID(g: string) { this.guid = g; return this; }
23
+ setCategory(c: string) { this.category = c; return this; }
24
+ setCategories(c: string[]) { this.categories = c; return this; }
25
+ build() {
26
+ if (this.category && this.categories) this.categories.push(this.category);
27
+ return {
28
+ __limit: this.limit,
29
+ __savedOnly: this.savedOnly,
30
+ __pinnedOnly: this.pinnedOnly,
31
+ __uid: this.uid,
32
+ __guid: this.guid,
33
+ };
34
+ }
35
+ },
36
+ },
37
+ });
@@ -0,0 +1,25 @@
1
+ import { CometChat } from "@cometchat/chat-sdk-react-native";
2
+
3
+ /**
4
+ * A copy of an integrator's request builder, so a panel can assert its own invariants
5
+ * without writing to the caller's object. See PinnedMessagesHelper for why that matters.
6
+ *
7
+ * Prototype-preserving, so the copy keeps its methods — `{ ...builder }` would not.
8
+ *
9
+ * Arrays are re-pointed, not shared. Every SETTER replaces its array, so sharing looks
10
+ * safe — but `build()` is not a setter and it mutates: SDK 4.1.0 runs
11
+ * `this.categories.push(this.category)` and the same for types. A shallow copy therefore
12
+ * grows the CALLER's array once per build.
13
+ *
14
+ * Dependency-free on purpose: CommonUtils.clone drags the constants barrel (and its
15
+ * CometChat.CALL_STATUS read) into a leaf helper and breaks every narrow SDK mock.
16
+ */
17
+ export const cloneRequestBuilder = (
18
+ builder: CometChat.MessagesRequestBuilder
19
+ ): CometChat.MessagesRequestBuilder => {
20
+ const copy = Object.assign(Object.create(Object.getPrototypeOf(builder)), builder);
21
+ for (const [key, value] of Object.entries(copy)) {
22
+ if (Array.isArray(value)) (copy as unknown as Record<string, unknown>)[key] = [...value];
23
+ }
24
+ return copy;
25
+ };
@@ -1,7 +1,9 @@
1
1
  import Clipboard from '@react-native-clipboard/clipboard';
2
2
  import NativeCometChatClipboardModule from './NativeCometChatClipboardModule';
3
3
  import type { ClipboardImageResult } from './NativeCometChatClipboardModule';
4
- import { stripColorTags } from '../../formatters/richTextWireFormat';
4
+ import { stripMarkdown } from '../../utils/MarkdownUtils';
5
+ import { applyRawFormatters } from '../../formatters/applyRawFormatters';
6
+ import type { CometChatTextFormatter } from '../../formatters/CometChatTextFormatter';
5
7
 
6
8
  export type { ClipboardImageResult };
7
9
 
@@ -36,13 +38,22 @@ export const ClipboardPasteHandler = {
36
38
  * chat app. Falls back to a plain copy when the native module is unavailable — the text
37
39
  * still lands on the clipboard, just without colour.
38
40
  */
39
- copyMessageText(raw: string): void {
40
- const plain = stripColorTags(raw);
41
+ copyMessageText(raw: string, textFormatters?: Array<CometChatTextFormatter>): void {
42
+ // A consumer's own wire token is rewritten into UI Kit markup first. Without this the strip below
43
+ // does not recognise it, so the token leaks verbatim into Notes or another chat app, and pasting
44
+ // back into our own composer brings it in as literal text instead of styled text.
45
+ const wire = applyRawFormatters(raw, textFormatters);
46
+ // stripMarkdown, not stripColorTags: colour was the only case anyone checked, so `<u>`, `<b>`,
47
+ // `<i>`, `<s>` and every markdown marker went to Notes and mail verbatim — QA saw
48
+ // `<u>fbebf</u>` pasted from a message that read "fbebf" on screen. stripMarkdown removes HTML
49
+ // tags and markdown AND colour, and unlike stripRichText it keeps line breaks, which a copied
50
+ // multi-line message must retain.
51
+ const plain = stripMarkdown(wire);
41
52
  if (!NativeCometChatClipboardModule?.setRichText) {
42
53
  Clipboard.setString(plain);
43
54
  return;
44
55
  }
45
- NativeCometChatClipboardModule.setRichText(plain, raw).catch(() => {
56
+ NativeCometChatClipboardModule.setRichText(plain, wire).catch(() => {
46
57
  Clipboard.setString(plain);
47
58
  });
48
59
  },
@@ -24,6 +24,7 @@ import { useCompTheme } from '../../../theme/hook';
24
24
  import { CometChatCaptionText } from '../CometChatCaptionText';
25
25
  import { useCometChatTranslation } from '../../resources/CometChatLocalizeNew';
26
26
  import { ATTACHMENT_COLLAPSED_LIMIT } from '../../constants/UIKitConstants';
27
+ import { AdditionalParams } from "../../base/Types";
27
28
 
28
29
  const { SoundPlayer, FileManager } = NativeModules;
29
30
  const soundEvents = new NativeEventEmitter(SoundPlayer);
@@ -440,6 +441,8 @@ export interface CometChatAudiosBubbleProps {
440
441
  message: CometChat.MediaMessage;
441
442
  theme: CometChatTheme;
442
443
  style?: CometChatTheme["audiosBubbleStyles"];
444
+ /** Render-time params from the message list — carries the consumer's `textFormatters`. */
445
+ additionalParams?: AdditionalParams;
443
446
  }
444
447
 
445
448
  /**
@@ -451,6 +454,7 @@ export function CometChatAudiosBubble({
451
454
  message,
452
455
  theme,
453
456
  style,
457
+ additionalParams,
454
458
  }: CometChatAudiosBubbleProps) {
455
459
  const compTheme = useCompTheme();
456
460
  const s = deepMerge(
@@ -569,6 +573,7 @@ export function CometChatAudiosBubble({
569
573
  {Boolean(caption) && (
570
574
  <CometChatCaptionText
571
575
  message={message}
576
+ additionalParams={additionalParams}
572
577
  caption={caption}
573
578
  theme={theme}
574
579
  containerStyle={{
@@ -208,7 +208,10 @@ const CometChatBottomSheet = forwardRef(
208
208
  >
209
209
  <View
210
210
  style={{
211
- ...(doNotOccupyEntireHeight ? {} : { flex: 1 }),
211
+ // Content-sized sheets must still shrink to the sheet's maxHeight: without
212
+ // flexShrink this view keeps its full content height and overflows past the
213
+ // bottom of the screen, leaving the last rows of a scrollable child unreachable.
214
+ ...(doNotOccupyEntireHeight ? { flexShrink: 1 } : { flex: 1 }),
212
215
  paddingBottom: style.paddingBottom ?? 0,
213
216
  }}
214
217
  >
@@ -10,6 +10,7 @@ import {
10
10
  CometChatUrlsFormatter,
11
11
  CometChatRichTextFormatter,
12
12
  } from "../../formatters";
13
+ import { applyRawFormatters } from "../../formatters/applyRawFormatters";
13
14
  import { CommonUtils } from "../../utils/CommonUtils";
14
15
  import { CometChatUIKit } from "../../CometChatUiKit";
15
16
  import { MentionsTargetElement } from "../../constants/UIKitConstants";
@@ -46,9 +47,15 @@ export function CometChatCaptionText({
46
47
  () => buildCaptionFormatters(message, theme, additionalParams),
47
48
  [message, theme, additionalParams]
48
49
  );
50
+ // A consumer's own wire token becomes UI Kit markup before the chain above parses the caption —
51
+ // same order the text bubble uses, so a caption and a text message render identically.
52
+ const text = useMemo(
53
+ () => applyRawFormatters(caption, additionalParams?.textFormatters),
54
+ [caption, additionalParams]
55
+ );
49
56
  return (
50
57
  <CometChatTextBubble
51
- text={caption}
58
+ text={text}
52
59
  textStyle={textStyle}
53
60
  textContainerStyle={containerStyle}
54
61
  textFormatters={formatters}
@@ -18,6 +18,7 @@ import { useCometChatTranslation } from '../../resources/CometChatLocalizeNew';
18
18
  import { groupAttachments } from '../../utils/groupAttachments';
19
19
  import { CometChatUIKit } from '../../CometChatUiKit';
20
20
  import { CometChatCaptionText } from '../CometChatCaptionText';
21
+ import { AdditionalParams } from "../../base/Types";
21
22
 
22
23
  const { FileManager } = NativeModules;
23
24
  const fileEventEmitter = new NativeEventEmitter(FileManager);
@@ -53,6 +54,8 @@ export interface CometChatFilesBubbleProps {
53
54
  /** Per-instance style overrides (applied over the tokenized defaults) — same pattern as the
54
55
  * other bubbles (e.g. CometChatAudioBubble / CometChatFileBubble). */
55
56
  style?: CometChatTheme["filesBubbleStyles"];
57
+ /** Render-time params from the message list — carries the consumer's `textFormatters`. */
58
+ additionalParams?: AdditionalParams;
56
59
  }
57
60
 
58
61
  /**
@@ -64,6 +67,7 @@ export function CometChatFilesBubble({
64
67
  message,
65
68
  theme,
66
69
  style,
70
+ additionalParams,
67
71
  }: CometChatFilesBubbleProps) {
68
72
  const { t } = useCometChatTranslation();
69
73
  const compTheme = useCompTheme();
@@ -298,6 +302,7 @@ export function CometChatFilesBubble({
298
302
  {Boolean(caption) && (
299
303
  <CometChatCaptionText
300
304
  message={message}
305
+ additionalParams={additionalParams}
301
306
  caption={caption}
302
307
  theme={theme}
303
308
  containerStyle={{
@@ -11,6 +11,7 @@ import { CometChatMediaViewer } from '../CometChatMediaViewer';
11
11
  import { CometChatCaptionText } from '../CometChatCaptionText';
12
12
  import { Icon } from '../../icons/Icon';
13
13
  import { isImageMime } from '../CometChatMediaViewer/mediaViewerUtils';
14
+ import { AdditionalParams } from "../../base/Types";
14
15
 
15
16
  // ---------------------------------------------------------------------------
16
17
  // Design doc §8.1 — ImagesBubble: renders a single-kind IMAGE message (all images after the §7 fan-out)
@@ -211,6 +212,8 @@ export interface CometChatImagesBubbleProps {
211
212
  theme: CometChatTheme;
212
213
  /** Per-instance style overrides — shares the `mediaGridBubbleStyles` theme key with VideosBubble. */
213
214
  style?: CometChatTheme["mediaGridBubbleStyles"];
215
+ /** Render-time params from the message list — carries the consumer's `textFormatters`. */
216
+ additionalParams?: AdditionalParams;
214
217
  }
215
218
 
216
219
  /**
@@ -221,6 +224,7 @@ export function CometChatImagesBubble({
221
224
  message: initialMessage,
222
225
  theme,
223
226
  style,
227
+ additionalParams,
224
228
  }: CometChatImagesBubbleProps) {
225
229
  const compTheme = useCompTheme();
226
230
  const s = deepMerge(theme.mediaGridBubbleStyles ?? {}, compTheme.mediaGridBubbleStyles ?? {}, style ?? {});
@@ -287,6 +291,7 @@ export function CometChatImagesBubble({
287
291
  {Boolean(caption) && (
288
292
  <CometChatCaptionText
289
293
  message={message}
294
+ additionalParams={additionalParams}
290
295
  caption={caption}
291
296
  theme={theme}
292
297
  containerStyle={{
@@ -12,6 +12,7 @@ import {
12
12
  ViewStyle,
13
13
  } from "react-native";
14
14
  import { useTheme } from "../../../theme";
15
+ import { useCometChatTranslation } from "../../resources/CometChatLocalizeNew";
15
16
  import { Icon } from "../../icons/Icon";
16
17
  import styles from "./styles";
17
18
 
@@ -163,7 +164,7 @@ export default function Header({
163
164
  titleStyle = {},
164
165
  titleViewStyle,
165
166
  containerStyle,
166
- searchPlaceholderText = "Search",
167
+ searchPlaceholderText,
167
168
  confirmSelectionStyle,
168
169
  selectionCancelStyle,
169
170
  titleSeparatorStyle = {},
@@ -174,7 +175,11 @@ export default function Header({
174
175
  onSearchBarClicked,
175
176
  }: HeaderProps) {
176
177
  const theme = useTheme();
178
+ const { t } = useCometChatTranslation();
177
179
  const inputRef = useRef<TextInput>(null);
180
+ // Callers that pass nothing used to get a hardcoded English "Search", which
181
+ // is why the conversation list's search box stayed English in every locale.
182
+ const searchPlaceholder = searchPlaceholderText ?? t("SEARCH");
178
183
  return (
179
184
  <View style={[styles.listBaseHeaderStyle, { width: '100%' }]}>
180
185
  {/* Header section with border */}
@@ -277,6 +282,7 @@ export default function Header({
277
282
  ) : (
278
283
 
279
284
  <Pressable
285
+ testID='List.searchBar'
280
286
  onPress={onSearchBarClicked}
281
287
  disabled={!onSearchBarClicked}
282
288
  >
@@ -309,7 +315,7 @@ export default function Header({
309
315
  />
310
316
  <TextInput
311
317
  ref={inputRef}
312
- placeholder={searchPlaceholderText}
318
+ placeholder={searchPlaceholder}
313
319
  placeholderTextColor={
314
320
  searchStyle?.placehodlerTextStyle?.color || theme.color.textTertiary
315
321
  }
@@ -12,6 +12,7 @@ import { CometChatMessageEvents } from '../../events/CometChatMessageEvents';
12
12
  import { CometChatMediaViewer } from '../CometChatMediaViewer';
13
13
  import { CometChatCaptionText } from '../CometChatCaptionText';
14
14
  import { isVideoMime } from '../CometChatMediaViewer/mediaViewerUtils';
15
+ import { AdditionalParams } from "../../base/Types";
15
16
 
16
17
  // ---------------------------------------------------------------------------
17
18
  // Design doc §8.1 — VideosBubble: renders a single-kind VIDEO message (all videos after the §7 fan-out)
@@ -309,6 +310,8 @@ export interface CometChatVideosBubbleProps {
309
310
  theme: CometChatTheme;
310
311
  /** Per-instance style overrides — shares the `mediaGridBubbleStyles` theme key with ImagesBubble. */
311
312
  style?: CometChatTheme["mediaGridBubbleStyles"];
313
+ /** Render-time params from the message list — carries the consumer's `textFormatters`. */
314
+ additionalParams?: AdditionalParams;
312
315
  }
313
316
 
314
317
  /**
@@ -319,6 +322,7 @@ export function CometChatVideosBubble({
319
322
  message: initialMessage,
320
323
  theme,
321
324
  style,
325
+ additionalParams,
322
326
  }: CometChatVideosBubbleProps) {
323
327
  const compTheme = useCompTheme();
324
328
  const s = deepMerge(theme.mediaGridBubbleStyles ?? {}, compTheme.mediaGridBubbleStyles ?? {}, style ?? {});
@@ -402,6 +406,7 @@ export function CometChatVideosBubble({
402
406
  {Boolean(caption) && (
403
407
  <CometChatCaptionText
404
408
  message={message}
409
+ additionalParams={additionalParams}
405
410
  caption={caption}
406
411
  theme={theme}
407
412
  containerStyle={{
@@ -8,6 +8,7 @@ import { CometChatAudioBubble } from '../CometChatAudioBubble';
8
8
  import { CometChatCaptionText } from '../CometChatCaptionText';
9
9
  import { deepMerge } from '../../helper/helperFunctions';
10
10
  import { useCompTheme } from '../../../theme/hook';
11
+ import { AdditionalParams } from "../../base/Types";
11
12
 
12
13
  // ---------------------------------------------------------------------------
13
14
  // Design doc §8.1a — the "VoiceNoteBubble": renders a RECORDED voice-note message
@@ -23,6 +24,8 @@ export interface CometChatVoiceNoteBubbleProps {
23
24
  theme: CometChatTheme;
24
25
  /** Per-instance style overrides (same pattern as the other bubbles). */
25
26
  style?: CometChatTheme["voiceNoteBubbleStyles"];
27
+ /** Render-time params from the message list — carries the consumer's `textFormatters`. */
28
+ additionalParams?: AdditionalParams;
26
29
  }
27
30
 
28
31
  /**
@@ -33,6 +36,7 @@ export function CometChatVoiceNoteBubble({
33
36
  message,
34
37
  theme,
35
38
  style,
39
+ additionalParams,
36
40
  }: CometChatVoiceNoteBubbleProps) {
37
41
  const compTheme = useCompTheme();
38
42
  const s = deepMerge(theme.voiceNoteBubbleStyles ?? {}, compTheme.voiceNoteBubbleStyles ?? {}, style ?? {});
@@ -60,6 +64,7 @@ export function CometChatVoiceNoteBubble({
60
64
  {Boolean(caption) && (
61
65
  <CometChatCaptionText
62
66
  message={message}
67
+ additionalParams={additionalParams}
63
68
  caption={caption}
64
69
  theme={theme}
65
70
  containerStyle={{
File without changes
File without changes
@@ -1,154 +0,0 @@
1
- # Manual Test Cases — `loadLastAgentConversation`
2
-
3
- ## Prerequisites
4
- - An `@agentic` user configured in your CometChat dashboard
5
- - The example app running with `loadLastAgentConversation={true}` on `CometChatMessageList`
6
- - At least one previous conversation with the agent (send a message, get a response)
7
-
8
- ---
9
-
10
- ## TC-1: Auto-loads last conversation on open
11
-
12
- **Steps:**
13
- 1. Have at least one previous conversation with the agent (send "Hello", wait for reply)
14
- 2. Navigate away from the agent chat (go back to conversation list)
15
- 3. Open the agent chat again
16
-
17
- **Expected:**
18
- - A loading indicator appears briefly
19
- - The previous conversation messages load automatically
20
- - You see your last messages and the agent's responses
21
-
22
- ---
23
-
24
- ## TC-2: Shows greeting/empty state when no previous conversation exists
25
-
26
- **Steps:**
27
- 1. Use a fresh `@agentic` user with no message history (or use a new logged-in user who hasn't chatted with the agent)
28
- 2. Open the agent chat
29
-
30
- **Expected:**
31
- - The agent greeting view appears (avatar, greeting message, suggested messages)
32
- - No loading spinner hangs indefinitely
33
-
34
- ---
35
-
36
- ## TC-3: "New Chat" button from header shows empty state
37
-
38
- **Steps:**
39
- 1. Open the agent chat (previous conversation auto-loads)
40
- 2. Tap the "New Chat" button (pencil/compose icon) in the header
41
-
42
- **Expected:**
43
- - The screen resets to the greeting/empty state
44
- - The previous conversation is NOT re-loaded
45
- - You can type a fresh message to start a new conversation
46
-
47
- ---
48
-
49
- ## TC-4: "New Chat" button from Chat History drawer works
50
-
51
- **Steps:**
52
- 1. Open the agent chat
53
- 2. Tap the "Chat History" button in the header to open the history drawer
54
- 3. Tap the "New Chat" button inside the history drawer
55
-
56
- **Expected:**
57
- - The history drawer closes
58
- - The message list resets to greeting/empty state
59
- - The previous conversation is NOT re-loaded
60
-
61
- ---
62
-
63
- ## TC-5: Loading a specific conversation from Chat History still works
64
-
65
- **Steps:**
66
- 1. Open the agent chat (previous conversation auto-loads)
67
- 2. Tap the "Chat History" button in the header
68
- 3. Tap on a specific past conversation from the list
69
-
70
- **Expected:**
71
- - The selected conversation loads with all its messages
72
- - Streaming/responses still work if you send a new message in that thread
73
-
74
- ---
75
-
76
- ## TC-6: Sending a new message after "New Chat" starts a new thread
77
-
78
- **Steps:**
79
- 1. Open the agent chat (previous conversation auto-loads)
80
- 2. Tap "New Chat" (message list resets to empty)
81
- 3. Type and send a message (e.g., "What's the weather?")
82
-
83
- **Expected:**
84
- - Your message appears in the list
85
- - A streaming indicator shows while the agent responds
86
- - The agent's reply appears correctly
87
- - This is now a NEW conversation thread (not appended to the old one)
88
-
89
- ---
90
-
91
- ## TC-7: Re-opening after new chat shows the NEW conversation
92
-
93
- **Steps:**
94
- 1. Complete TC-6 (start a new chat, send message, get reply)
95
- 2. Navigate away from the agent chat
96
- 3. Open the agent chat again
97
-
98
- **Expected:**
99
- - The most recent conversation (from step 1-2) auto-loads
100
- - You see the "What's the weather?" message and the agent's response
101
- - NOT the older conversation from before
102
-
103
- ---
104
-
105
- ## TC-8: `loadLastAgentConversation={false}` preserves existing behavior
106
-
107
- **Steps:**
108
- 1. Change the prop to `loadLastAgentConversation={false}` (or remove it) in Messages.tsx
109
- 2. Open the agent chat (even with previous conversations)
110
-
111
- **Expected:**
112
- - The greeting/empty state shows immediately
113
- - No automatic loading of previous conversation
114
- - Behaves exactly as before this feature was added
115
-
116
- ---
117
-
118
- ## TC-9: Non-agentic users are unaffected
119
-
120
- **Steps:**
121
- 1. With `loadLastAgentConversation={true}` still set
122
- 2. Open a regular (non-agentic) user chat that has message history
123
-
124
- **Expected:**
125
- - Messages load normally (standard behavior)
126
- - No change in behavior — the prop only applies to `@agentic` users
127
-
128
- ---
129
-
130
- ## TC-10: Scroll up to load older messages in auto-loaded conversation
131
-
132
- **Steps:**
133
- 1. Have a long conversation history with the agent (30+ messages)
134
- 2. Open the agent chat (auto-loads last conversation)
135
- 3. Scroll up to the top of the loaded messages
136
-
137
- **Expected:**
138
- - Older messages load (pagination works)
139
- - No crash or infinite spinner
140
- - The loading indicator appears at the top while fetching
141
-
142
- ---
143
-
144
- ## TC-11: Delete all history from Chat History panel
145
-
146
- **Steps:**
147
- 1. Open the agent chat
148
- 2. Open Chat History drawer
149
- 3. Long-press and delete all conversations one by one until none remain
150
-
151
- **Expected:**
152
- - When the last conversation is deleted, the list shows empty state
153
- - The message list resets to greeting/empty view
154
- - Re-opening the chat shows greeting (no conversation to auto-load)