@cometchat/chat-sdk-javascript 4.1.14 → 4.2.1-beta
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.
- package/CometChat.d.ts +813 -15
- package/CometChat.js +1 -1
- package/package.json +1 -1
package/CometChat.d.ts
CHANGED
|
@@ -1135,6 +1135,22 @@ export class CometChat {
|
|
|
1135
1135
|
static NotificationCategoriesRequest: typeof NotificationCategoriesRequest;
|
|
1136
1136
|
static NotificationCategoriesRequestBuilder: typeof NotificationCategoriesRequestBuilder;
|
|
1137
1137
|
static NotificationFeedListener: typeof NotificationFeedListener;
|
|
1138
|
+
static MessageThread: typeof MessageThread;
|
|
1139
|
+
static ThreadsRequest: typeof ThreadsRequest;
|
|
1140
|
+
static ThreadsRequestBuilder: typeof ThreadsRequestBuilder;
|
|
1141
|
+
static PIN_SAVE_ERROR_CODES: {
|
|
1142
|
+
ACTION_NOT_ALLOWED: string;
|
|
1143
|
+
};
|
|
1144
|
+
static PIN_SAVE_DEFAULTS: {
|
|
1145
|
+
LIMIT: number;
|
|
1146
|
+
MIN_LIMIT: number;
|
|
1147
|
+
MAX_LIMIT: number;
|
|
1148
|
+
};
|
|
1149
|
+
static PINNED_BY: {
|
|
1150
|
+
SYSTEM: string;
|
|
1151
|
+
ME: string;
|
|
1152
|
+
};
|
|
1153
|
+
static ConversationListener: typeof ConversationListener;
|
|
1138
1154
|
static CallSettings: typeof CallSettings;
|
|
1139
1155
|
static CallSettingsBuilder: typeof CallSettingsBuilder;
|
|
1140
1156
|
static MainVideoContainerSetting: typeof MainVideoContainerSetting;
|
|
@@ -1397,7 +1413,7 @@ export class CometChat {
|
|
|
1397
1413
|
* @returns
|
|
1398
1414
|
* @memberof CometChat
|
|
1399
1415
|
*/
|
|
1400
|
-
static sendDirectMessage(message: Object): Promise<
|
|
1416
|
+
static sendDirectMessage(message: Object): Promise<BaseMessage | TextMessage | MediaMessage | CustomMessage>;
|
|
1401
1417
|
/**
|
|
1402
1418
|
* Function to send a message to group.
|
|
1403
1419
|
* @internal
|
|
@@ -1405,14 +1421,14 @@ export class CometChat {
|
|
|
1405
1421
|
* @returns
|
|
1406
1422
|
* @memberof CometChat
|
|
1407
1423
|
*/
|
|
1408
|
-
static sendGroupMessage(message: any): Promise<
|
|
1424
|
+
static sendGroupMessage(message: any): Promise<BaseMessage | TextMessage | MediaMessage | CustomMessage>;
|
|
1409
1425
|
/**
|
|
1410
1426
|
* Function to send a media message.
|
|
1411
1427
|
* @param {MediaMessage} message
|
|
1412
1428
|
* @returns {Message | any}
|
|
1413
1429
|
* @memberof CometChat
|
|
1414
1430
|
*/
|
|
1415
|
-
static sendMediaMessage(message: Object): Promise<
|
|
1431
|
+
static sendMediaMessage(message: Object): Promise<BaseMessage | TextMessage | MediaMessage | CustomMessage>;
|
|
1416
1432
|
/**
|
|
1417
1433
|
* Creates an {@link UploadFileRequest} scoped to one destination and one upload batch. This is
|
|
1418
1434
|
* the entry point for the multi-attachment upload flow: configure the request
|
|
@@ -1460,7 +1476,7 @@ export class CometChat {
|
|
|
1460
1476
|
* @returns {Message | any}
|
|
1461
1477
|
* @memberof CometChat
|
|
1462
1478
|
*/
|
|
1463
|
-
static sendCustomMessage(message: CustomMessage): Promise<
|
|
1479
|
+
static sendCustomMessage(message: CustomMessage): Promise<BaseMessage | TextMessage | MediaMessage | CustomMessage>;
|
|
1464
1480
|
/**
|
|
1465
1481
|
*
|
|
1466
1482
|
* Function to send a interactive message.
|
|
@@ -1468,7 +1484,7 @@ export class CometChat {
|
|
|
1468
1484
|
* @returns {Message | any}
|
|
1469
1485
|
* @memberof CometChat
|
|
1470
1486
|
*/
|
|
1471
|
-
static sendInteractiveMessage(message: InteractiveMessage): Promise<
|
|
1487
|
+
static sendInteractiveMessage(message: InteractiveMessage): Promise<BaseMessage | TextMessage | MediaMessage | CustomMessage>;
|
|
1472
1488
|
/**
|
|
1473
1489
|
*
|
|
1474
1490
|
* Function to get the last delivered message id from local storage.
|
|
@@ -2304,12 +2320,201 @@ export class CometChat {
|
|
|
2304
2320
|
* @param {string} listenerId - The listener ID to remove
|
|
2305
2321
|
*/
|
|
2306
2322
|
static removeNotificationFeedListener(listenerId: string): void;
|
|
2323
|
+
/**
|
|
2324
|
+
* Subscribe to (follow) a message thread, identified by its parent/root message id.
|
|
2325
|
+
* Allowed even on a message with zero replies (A9 — no reply-count guard). The POST
|
|
2326
|
+
* carries no body and is idempotent: a duplicate subscribe still returns 200.
|
|
2327
|
+
*
|
|
2328
|
+
* The SDK keeps NO subscription state: the resolved promise IS the acknowledgement,
|
|
2329
|
+
* and the consumer owns the resulting UI state. The server-side truth reappears on
|
|
2330
|
+
* the next message fetch as `BaseMessage.isThreadSubscribed()`.
|
|
2331
|
+
*
|
|
2332
|
+
* @param {number} parentMessageId - The root message id of the thread to follow.
|
|
2333
|
+
* @returns {Promise<string>} the server ack message (`{data:{success,message}}`, A9).
|
|
2334
|
+
* @memberof CometChat
|
|
2335
|
+
*/
|
|
2336
|
+
static subscribeToThread(parentMessageId: number): Promise<string>;
|
|
2337
|
+
/**
|
|
2338
|
+
* Unsubscribe from (unfollow) a message thread. Idempotent — a DELETE on a
|
|
2339
|
+
* non-subscribed thread still returns 200 (A9). Server-side this hard-deletes the
|
|
2340
|
+
* subscription row (A1), so a consumer showing a thread list must ALSO remove that
|
|
2341
|
+
* row from its own list (documented in the guide; the SDK ships no list).
|
|
2342
|
+
*
|
|
2343
|
+
* The SDK keeps NO subscription state: the resolved promise IS the acknowledgement,
|
|
2344
|
+
* and the consumer owns the resulting UI state.
|
|
2345
|
+
*
|
|
2346
|
+
* @param {number} parentMessageId - The root message id of the thread to unfollow.
|
|
2347
|
+
* @returns {Promise<string>} the server ack message.
|
|
2348
|
+
* @memberof CometChat
|
|
2349
|
+
*/
|
|
2350
|
+
static unsubscribeFromThread(parentMessageId: number): Promise<string>;
|
|
2351
|
+
/**
|
|
2352
|
+
* Pin a message to its conversation. The pin is conversation-wide and visible to
|
|
2353
|
+
* everyone; only an Admin/Moderator (group owner included) may pin, and the server
|
|
2354
|
+
* is the authority — a member's call is rejected with `ERR_ACTION_NOT_ALLOWED`.
|
|
2355
|
+
*
|
|
2356
|
+
* A conversation holds a capped number of pins; read it from app settings via
|
|
2357
|
+
* `CometChat.getPinnedMessagesLimit()` rather than hard-coding a number. Pinning is
|
|
2358
|
+
* idempotent, and a message has a single pinner: re-pinning updates
|
|
2359
|
+
* `pinnedBy`/`pinnedAt` to the most recent one.
|
|
2360
|
+
*
|
|
2361
|
+
* @param {string | number} messageId - the message to pin.
|
|
2362
|
+
* @returns {Promise<BaseMessage>} the full updated message, with `pinnedAt`/`pinnedBy` set.
|
|
2363
|
+
* @memberof CometChat
|
|
2364
|
+
*/
|
|
2365
|
+
static pinMessage(messageId: string | number | any): Promise<BaseMessage>;
|
|
2366
|
+
/**
|
|
2367
|
+
* Unpin a message from its conversation. Role-gated like `pinMessage`, and NOT
|
|
2368
|
+
* restricted to the original pinner — any Admin/Moderator may unpin. Idempotent.
|
|
2369
|
+
*
|
|
2370
|
+
* @param {string | number} messageId - the message to unpin.
|
|
2371
|
+
* @returns {Promise<BaseMessage>} the full updated message, with the pin attributes cleared.
|
|
2372
|
+
* @memberof CometChat
|
|
2373
|
+
*/
|
|
2374
|
+
static unpinMessage(messageId: string | number | any): Promise<BaseMessage>;
|
|
2375
|
+
/**
|
|
2376
|
+
* Save ("bookmark") a message for the logged-in user. Private and cross-conversation:
|
|
2377
|
+
* no one else can see it, no role is required, and it syncs to the user's other
|
|
2378
|
+
* devices via `MessageListener.onMessageSaved`. Idempotent.
|
|
2379
|
+
*
|
|
2380
|
+
* A user may save a capped number of messages; read it from app settings via
|
|
2381
|
+
* `CometChat.getSavedMessagesLimit()`.
|
|
2382
|
+
*
|
|
2383
|
+
* @param {string | number} messageId - the message to save.
|
|
2384
|
+
* @returns {Promise<BaseMessage>} the full updated message, with `savedAt` set.
|
|
2385
|
+
* @memberof CometChat
|
|
2386
|
+
*/
|
|
2387
|
+
static saveMessage(messageId: string | number | any): Promise<BaseMessage>;
|
|
2388
|
+
/**
|
|
2389
|
+
* Remove a message from the logged-in user's saved list. Private, no role required,
|
|
2390
|
+
* idempotent, and mirrored to the user's other devices via
|
|
2391
|
+
* `MessageListener.onMessageUnsaved`.
|
|
2392
|
+
*
|
|
2393
|
+
* @param {string | number} messageId - the message to unsave.
|
|
2394
|
+
* @returns {Promise<BaseMessage>} the full updated message, with `savedAt` cleared.
|
|
2395
|
+
* @memberof CometChat
|
|
2396
|
+
*/
|
|
2397
|
+
static unsaveMessage(messageId: string | number | any): Promise<BaseMessage>;
|
|
2398
|
+
/**
|
|
2399
|
+
* Pin a conversation to the top of the logged-in user's conversation list. The pin
|
|
2400
|
+
* is PRIVATE to that user — nobody else sees it — and syncs to their other devices
|
|
2401
|
+
* via `ConversationListener.onConversationPinned`.
|
|
2402
|
+
*
|
|
2403
|
+
* A user may pin a limited number of conversations; read it from app settings via
|
|
2404
|
+
* `CometChat.getPinnedConversationsLimit()` rather than hard-coding a number.
|
|
2405
|
+
* Idempotent.
|
|
2406
|
+
*
|
|
2407
|
+
* Separate from an admin-global pin, which is managed from the dashboard and shows
|
|
2408
|
+
* for every user; those cannot be created or removed from the SDK.
|
|
2409
|
+
*
|
|
2410
|
+
* @param {string} conversationWith - the peer's UID, or the group's GUID.
|
|
2411
|
+
* @param {string} conversationType - "user" or "group".
|
|
2412
|
+
* @returns {Promise<Conversation>} the full updated conversation, with `pinnedAt`/`pinnedBy` set.
|
|
2413
|
+
* @memberof CometChat
|
|
2414
|
+
*/
|
|
2415
|
+
static pinConversation(conversationWith: string, conversationType: string): Promise<Conversation>;
|
|
2416
|
+
/**
|
|
2417
|
+
* Remove the logged-in user's own pin from a conversation. Idempotent.
|
|
2418
|
+
*
|
|
2419
|
+
* A user CANNOT unpin an admin-global pin — the server rejects that with
|
|
2420
|
+
* `ERR_ACTION_NOT_ALLOWED`. Check `conversation.isSystemPinned()` and hide the
|
|
2421
|
+
* unpin affordance rather than letting the call fail.
|
|
2422
|
+
*
|
|
2423
|
+
* @param {string} conversationWith - the peer's UID, or the group's GUID.
|
|
2424
|
+
* @param {string} conversationType - "user" or "group".
|
|
2425
|
+
* @returns {Promise<Conversation>} the full updated conversation, with the pin attributes cleared.
|
|
2426
|
+
* @memberof CometChat
|
|
2427
|
+
*/
|
|
2428
|
+
static unpinConversation(conversationWith: string, conversationType: string): Promise<Conversation>;
|
|
2429
|
+
/**
|
|
2430
|
+
* Register a ConversationListener for conversation pin/unpin events.
|
|
2431
|
+
*
|
|
2432
|
+
* @param {string} listenerId - Unique identifier for this listener.
|
|
2433
|
+
* @param {ConversationListener} listener - The listener instance.
|
|
2434
|
+
* @memberof CometChat
|
|
2435
|
+
*/
|
|
2436
|
+
static addConversationListener(listenerId: string, listener: ConversationListener): void;
|
|
2437
|
+
/**
|
|
2438
|
+
* Remove a previously registered ConversationListener.
|
|
2439
|
+
*
|
|
2440
|
+
* @param {string} listenerId - The listener ID to remove.
|
|
2441
|
+
* @memberof CometChat
|
|
2442
|
+
*/
|
|
2443
|
+
static removeConversationListener(listenerId: string): void;
|
|
2444
|
+
/**
|
|
2445
|
+
* Whether Pin Conversation is enabled for this app's plan. Resolves `false` rather
|
|
2446
|
+
* than rejecting — see `isPinMessageEnabled`.
|
|
2447
|
+
*
|
|
2448
|
+
* @returns {Promise<boolean>}
|
|
2449
|
+
* @memberof CometChat
|
|
2450
|
+
*/
|
|
2451
|
+
static isPinConversationEnabled(): Promise<boolean>;
|
|
2452
|
+
/**
|
|
2453
|
+
* Whether Pin Message is enabled for this app's plan (§7.3). Resolves `false` rather
|
|
2454
|
+
* than rejecting when the flag is missing or settings are unavailable, so a consumer
|
|
2455
|
+
* can gate UI with a plain `if` and an unavailable setting degrades to "hidden"
|
|
2456
|
+
* rather than to an unhandled rejection.
|
|
2457
|
+
*
|
|
2458
|
+
* @returns {Promise<boolean>}
|
|
2459
|
+
* @memberof CometChat
|
|
2460
|
+
*/
|
|
2461
|
+
static isPinMessageEnabled(): Promise<boolean>;
|
|
2462
|
+
/**
|
|
2463
|
+
* Whether Save Message is enabled for this app's plan (§7.3). Resolves `false`
|
|
2464
|
+
* rather than rejecting — see `isPinMessageEnabled`.
|
|
2465
|
+
*
|
|
2466
|
+
* @returns {Promise<boolean>}
|
|
2467
|
+
* @memberof CometChat
|
|
2468
|
+
*/
|
|
2469
|
+
static isSaveMessageEnabled(): Promise<boolean>;
|
|
2470
|
+
/**
|
|
2471
|
+
* Max pinned messages allowed in one conversation, per user (§7.3). `null` when the
|
|
2472
|
+
* app settings carry no value — show generic copy then rather than guessing a number.
|
|
2473
|
+
*
|
|
2474
|
+
* Use this to disable a pin control at the cap, rather than letting the user
|
|
2475
|
+
* discover it by rejection.
|
|
2476
|
+
*
|
|
2477
|
+
* @returns {Promise<number | null>}
|
|
2478
|
+
* @memberof CometChat
|
|
2479
|
+
*/
|
|
2480
|
+
static getPinnedMessagesLimit(): Promise<number | null>;
|
|
2481
|
+
/**
|
|
2482
|
+
* Max admin/system (`app_system`) pinned messages in one conversation (§7.3).
|
|
2483
|
+
* Enforced independently of the per-user cap. `null` when unset.
|
|
2484
|
+
*
|
|
2485
|
+
* @returns {Promise<number | null>}
|
|
2486
|
+
* @memberof CometChat
|
|
2487
|
+
*/
|
|
2488
|
+
static getSystemPinnedMessagesLimit(): Promise<number | null>;
|
|
2489
|
+
/**
|
|
2490
|
+
* Max saved messages per user, across all conversations (§7.3). `null` when unset.
|
|
2491
|
+
*
|
|
2492
|
+
* @returns {Promise<number | null>}
|
|
2493
|
+
* @memberof CometChat
|
|
2494
|
+
*/
|
|
2495
|
+
static getSavedMessagesLimit(): Promise<number | null>;
|
|
2496
|
+
/**
|
|
2497
|
+
* Max pinned conversations per user (§7.3). `null` when unset.
|
|
2498
|
+
*
|
|
2499
|
+
* @returns {Promise<number | null>}
|
|
2500
|
+
* @memberof CometChat
|
|
2501
|
+
*/
|
|
2502
|
+
static getPinnedConversationsLimit(): Promise<number | null>;
|
|
2503
|
+
/**
|
|
2504
|
+
* Max admin/system (`app_system`) pinned conversations for the app (§7.3). Enforced
|
|
2505
|
+
* independently of the per-user cap. `null` when unset.
|
|
2506
|
+
*
|
|
2507
|
+
* @returns {Promise<number | null>}
|
|
2508
|
+
* @memberof CometChat
|
|
2509
|
+
*/
|
|
2510
|
+
static getSystemPinnedConversationsLimit(): Promise<number | null>;
|
|
2307
2511
|
}
|
|
2308
2512
|
|
|
2309
2513
|
export class CometChatNotifications {
|
|
2310
2514
|
static MessagesOptions: typeof MessagesOptions;
|
|
2311
2515
|
static RepliesOptions: typeof RepliesOptions;
|
|
2312
2516
|
static ReactionsOptions: typeof ReactionsOptions;
|
|
2517
|
+
static QuotedRepliesOptions: typeof QuotedRepliesOptions;
|
|
2313
2518
|
static MemberActionsOptions: typeof MemberActionsOptions;
|
|
2314
2519
|
static DayOfWeek: typeof DayOfWeek;
|
|
2315
2520
|
static DNDOptions: typeof DNDOptions;
|
|
@@ -2455,6 +2660,344 @@ export interface CometChatSettings {
|
|
|
2455
2660
|
uiKit?: Record<string, unknown>;
|
|
2456
2661
|
}
|
|
2457
2662
|
|
|
2663
|
+
/**
|
|
2664
|
+
* @module MessageThread
|
|
2665
|
+
*
|
|
2666
|
+
* A thread is the root message decorated with a few extra keys, produced by the
|
|
2667
|
+
* SAME transformer as `/v3/messages` (A2). Identity is `parentMessageId` (the root
|
|
2668
|
+
* message id); there is no separate thread resource id, and `threadId` is
|
|
2669
|
+
* deliberately NOT used as a symbol (it is already taken by AI-assistant run
|
|
2670
|
+
* threads on all five platforms).
|
|
2671
|
+
*
|
|
2672
|
+
* This class is a pure typed holder. ALL JSON-key extraction and nested-message
|
|
2673
|
+
* parsing happens in `ThreadParser` (the single chokepoint, §4.1) — `ThreadParser`
|
|
2674
|
+
* constructs `MessageThread` from already-parsed values, so no wire-key string
|
|
2675
|
+
* ever appears here.
|
|
2676
|
+
*
|
|
2677
|
+
* Note the receiver naming: the raw id is exposed as `receiverId` (JS/RN spelling),
|
|
2678
|
+
* NOT `receiver` — because `BaseMessage.receiver` is the hydrated `User | Group`
|
|
2679
|
+
* entity, and a String `receiver` one dot away would be a silent-cast landmine
|
|
2680
|
+
* (§5.4). The untouched wire key stays available via `rawData`.
|
|
2681
|
+
*/
|
|
2682
|
+
/** @internal — the already-parsed values ThreadParser hands to the constructor. */
|
|
2683
|
+
export interface MessageThreadParams {
|
|
2684
|
+
parentMessageId: number;
|
|
2685
|
+
parentMessage: BaseMessage | null;
|
|
2686
|
+
replyCount: number;
|
|
2687
|
+
lastReply: BaseMessage | null;
|
|
2688
|
+
updatedAt: number;
|
|
2689
|
+
conversationId: string;
|
|
2690
|
+
receiverType: string;
|
|
2691
|
+
receiverId: string;
|
|
2692
|
+
subscribed: boolean;
|
|
2693
|
+
unreadReplyCount: number | null;
|
|
2694
|
+
rawData: Record<string, any>;
|
|
2695
|
+
}
|
|
2696
|
+
export class MessageThread {
|
|
2697
|
+
constructor(params: MessageThreadParams);
|
|
2698
|
+
/** @returns {number} the root message id — the thread's identity. */
|
|
2699
|
+
getParentMessageId(): number;
|
|
2700
|
+
/** @returns {BaseMessage | null} the root message. */
|
|
2701
|
+
getParentMessage(): BaseMessage | null;
|
|
2702
|
+
/** @returns {number} the reply count. */
|
|
2703
|
+
getReplyCount(): number;
|
|
2704
|
+
/** @param {number} replyCount */
|
|
2705
|
+
setReplyCount(replyCount: number): void;
|
|
2706
|
+
/** @returns {BaseMessage | null} the last reply, or null on a zero-reply thread. */
|
|
2707
|
+
getLastReply(): BaseMessage | null;
|
|
2708
|
+
/**
|
|
2709
|
+
* @returns {number} the opaque cursor value (unix seconds). Do NOT sort a UI on
|
|
2710
|
+
* this (A17); sort on `lastReply?.sentAt ?? parentMessage.sentAt` instead.
|
|
2711
|
+
*/
|
|
2712
|
+
getUpdatedAt(): number;
|
|
2713
|
+
/** @returns {string} the conversation id. */
|
|
2714
|
+
getConversationId(): string;
|
|
2715
|
+
/** @returns {string} "user" | "group" (open string). */
|
|
2716
|
+
getReceiverType(): string;
|
|
2717
|
+
/** @returns {string} the raw `guid`/`uid`. Hydrate name/avatar lazily on a cache miss. */
|
|
2718
|
+
getReceiverId(): string;
|
|
2719
|
+
/** @returns {boolean} whether the logged-in user follows this thread. */
|
|
2720
|
+
isSubscribed(): boolean;
|
|
2721
|
+
/** @param {boolean} subscribed */
|
|
2722
|
+
setSubscribed(subscribed: boolean): void;
|
|
2723
|
+
/** @returns {number | null} `null` = unknown (A5), never `0`. */
|
|
2724
|
+
getUnreadReplyCount(): number | null;
|
|
2725
|
+
/** @returns {Record<string, any>} the untouched raw wire object — the escape hatch. */
|
|
2726
|
+
getRawData(): Record<string, any>;
|
|
2727
|
+
}
|
|
2728
|
+
|
|
2729
|
+
export class ThreadsRequest {
|
|
2730
|
+
/** @private */
|
|
2731
|
+
constructor(builder?: ThreadsRequestBuilder);
|
|
2732
|
+
/**
|
|
2733
|
+
* Get the next page of threads. The developer calls this repeatedly on the SAME
|
|
2734
|
+
* object to page through the list, using `hasMore()` to know when to stop.
|
|
2735
|
+
*
|
|
2736
|
+
* `hasMore()` is the end-of-list signal, not the length of the returned page. The
|
|
2737
|
+
* server's cursor is inclusive, so each page repeats the previous boundary row;
|
|
2738
|
+
* that duplicate is filtered out, which can make a returned page shorter than the
|
|
2739
|
+
* requested limit without meaning the list has ended.
|
|
2740
|
+
* @returns {Promise<MessageThread[]>}
|
|
2741
|
+
*/
|
|
2742
|
+
fetchNext(): Promise<MessageThread[]>;
|
|
2743
|
+
/** @returns {number} the page size. */
|
|
2744
|
+
getLimit(): number;
|
|
2745
|
+
/** @returns {boolean} */
|
|
2746
|
+
isParticipatedByMe(): boolean;
|
|
2747
|
+
/** @returns {string} the group id this request is scoped to, if any (A14). */
|
|
2748
|
+
getGuid(): string;
|
|
2749
|
+
/** @returns {string} the user id this request is scoped to, if any (A14). */
|
|
2750
|
+
getUid(): string;
|
|
2751
|
+
/**
|
|
2752
|
+
* Whether more pages remain. This is the loop condition to page on, rather than the
|
|
2753
|
+
* size of the last returned page.
|
|
2754
|
+
* @returns {boolean}
|
|
2755
|
+
*/
|
|
2756
|
+
hasMore(): boolean;
|
|
2757
|
+
}
|
|
2758
|
+
export class ThreadsRequestBuilder {
|
|
2759
|
+
/** @private */ limit: number;
|
|
2760
|
+
/** @private */ participatedByMe: boolean;
|
|
2761
|
+
/** @private */ guid: string;
|
|
2762
|
+
/** @private */ uid: string;
|
|
2763
|
+
/**
|
|
2764
|
+
* Set the page size. Default 30; server max is 1000 (A8) — a thread row is heavy
|
|
2765
|
+
* (root + last reply, both hydrated).
|
|
2766
|
+
*
|
|
2767
|
+
* The setter only assigns, matching every other request builder in the SDK. The
|
|
2768
|
+
* 1…1000 range and the type are checked on the first `fetchNext()`, which rejects
|
|
2769
|
+
* with INVALID_SET_LIMIT — an out-of-range value is never silently clamped.
|
|
2770
|
+
* @param {number} limit
|
|
2771
|
+
* @returns {this}
|
|
2772
|
+
*/
|
|
2773
|
+
setLimit(limit: number): this;
|
|
2774
|
+
/**
|
|
2775
|
+
* Fetch threads the logged-in user participates in (started / replied / mentioned /
|
|
2776
|
+
* subscribed). Default true; always sent on the wire (A1).
|
|
2777
|
+
* @param {boolean} participatedByMe
|
|
2778
|
+
* @returns {this}
|
|
2779
|
+
*/
|
|
2780
|
+
setParticipatedByMe(participatedByMe: boolean): this;
|
|
2781
|
+
/**
|
|
2782
|
+
* Scope the list to a single group's threads (`/groups/{guid}/threads`, A14).
|
|
2783
|
+
* Mutually exclusive with `setUid`.
|
|
2784
|
+
* @param {string} guid
|
|
2785
|
+
* @returns {this}
|
|
2786
|
+
*/
|
|
2787
|
+
setGuid(guid: string): this;
|
|
2788
|
+
/**
|
|
2789
|
+
* Scope the list to a single 1-1 conversation's threads (`/users/{uid}/threads`, A14).
|
|
2790
|
+
* Mutually exclusive with `setGuid`.
|
|
2791
|
+
* @param {string} uid
|
|
2792
|
+
* @returns {this}
|
|
2793
|
+
*/
|
|
2794
|
+
setUid(uid: string): this;
|
|
2795
|
+
/**
|
|
2796
|
+
* @returns {ThreadsRequest}
|
|
2797
|
+
*/
|
|
2798
|
+
build(): ThreadsRequest;
|
|
2799
|
+
}
|
|
2800
|
+
|
|
2801
|
+
/** Registered endpoint names (see EndpointFactory.uriEndpoints). */
|
|
2802
|
+
export const PIN_SAVE_ENDPOINTS: {
|
|
2803
|
+
PIN_MESSAGE: string;
|
|
2804
|
+
UNPIN_MESSAGE: string;
|
|
2805
|
+
SAVE_MESSAGE: string;
|
|
2806
|
+
UNSAVE_MESSAGE: string;
|
|
2807
|
+
/** §8-Q5: the pinned list is the ordinary conversation message list, filtered. */
|
|
2808
|
+
USER_MESSAGES: string;
|
|
2809
|
+
GROUP_MESSAGES: string;
|
|
2810
|
+
/** The saved list is user-level and cross-conversation — the bare messages route. */
|
|
2811
|
+
MESSAGES: string;
|
|
2812
|
+
/**
|
|
2813
|
+
* Pin Conversation. Addressed by the conversation's peer — `users/{uid}` for a 1-1,
|
|
2814
|
+
* `groups/{guid}` for a group — NOT by `conversationId`: the backend moved off the
|
|
2815
|
+
* `/conversations/{conversationId}/pin` shape because that route 404s without a
|
|
2816
|
+
* `conversation_user` row (you could not pin a conversation before its first
|
|
2817
|
+
* message).
|
|
2818
|
+
*/
|
|
2819
|
+
PIN_USER_CONVERSATION: string;
|
|
2820
|
+
UNPIN_USER_CONVERSATION: string;
|
|
2821
|
+
PIN_GROUP_CONVERSATION: string;
|
|
2822
|
+
UNPIN_GROUP_CONVERSATION: string;
|
|
2823
|
+
};
|
|
2824
|
+
/** Pagination + validation bounds for both list builders (§5.3). */
|
|
2825
|
+
export const PIN_SAVE_DEFAULTS: {
|
|
2826
|
+
/** Client default page size. */
|
|
2827
|
+
LIMIT: number;
|
|
2828
|
+
MIN_LIMIT: number;
|
|
2829
|
+
/**
|
|
2830
|
+
* Server-side cap on pins-per-conversation and saves-per-user is 100 (§3), so a
|
|
2831
|
+
* list can never exceed 100 rows. `setLimit(100)` therefore always fetches the
|
|
2832
|
+
* whole list in one hop — which is what the "fetch-all-and-count" title count
|
|
2833
|
+
* (§6.3, Q10) needs.
|
|
2834
|
+
*/
|
|
2835
|
+
MAX_LIMIT: number;
|
|
2836
|
+
};
|
|
2837
|
+
/**
|
|
2838
|
+
* Tokens for `ConversationsRequestBuilder.setPinnedBy()`. A client may only ask for
|
|
2839
|
+
* these two; anything else is rejected server-side.
|
|
2840
|
+
*/
|
|
2841
|
+
export const PINNED_BY: {
|
|
2842
|
+
/** Conversations pinned globally by an admin, for every user. */
|
|
2843
|
+
SYSTEM: string;
|
|
2844
|
+
/** Conversations the logged-in user pinned themselves. */
|
|
2845
|
+
ME: string;
|
|
2846
|
+
};
|
|
2847
|
+
/**
|
|
2848
|
+
* Internal event type stamped on a parsed pin/save socket frame. NOT a wire value —
|
|
2849
|
+
* the wire `type` is resolved by `PinSaveParser.resolveWsEventAction` and normalised
|
|
2850
|
+
* to this, so the rest of the SDK switches on one stable string.
|
|
2851
|
+
*/
|
|
2852
|
+
export const PIN_SAVE_EVENT: {
|
|
2853
|
+
TYPE: string;
|
|
2854
|
+
};
|
|
2855
|
+
/**
|
|
2856
|
+
* The one wire VALUE that has to be readable outside the parse site: `BaseMessage`
|
|
2857
|
+
* needs it for `isSystemPinned()` and cannot import `PinSaveParser` without a
|
|
2858
|
+
* require cycle (the parser depends on the message transformer, which depends on
|
|
2859
|
+
* BaseMessage). This file is a leaf with no imports, so it is the safe home.
|
|
2860
|
+
* `PIN_SAVE_CONTRACT.SYSTEM_PINNER_SENTINEL` re-exports it — change it here only.
|
|
2861
|
+
*/
|
|
2862
|
+
export const PIN_SAVE_SENTINELS: {
|
|
2863
|
+
/** `pinnedBy` value meaning "pinned by the app/admin", not by a member (§4.1). */
|
|
2864
|
+
SYSTEM_PINNER: string;
|
|
2865
|
+
};
|
|
2866
|
+
/** The normalised actions carried by a pin/save event. */
|
|
2867
|
+
export const PIN_SAVE_ACTION: {
|
|
2868
|
+
PINNED: string;
|
|
2869
|
+
UNPINNED: string;
|
|
2870
|
+
SAVED: string;
|
|
2871
|
+
UNSAVED: string;
|
|
2872
|
+
CONVERSATION_PINNED: string;
|
|
2873
|
+
CONVERSATION_UNPINNED: string;
|
|
2874
|
+
};
|
|
2875
|
+
/**
|
|
2876
|
+
* Feature flags (§7.3). Both are already part of the SDK settings cache-bust hash,
|
|
2877
|
+
* so `CometChat.isFeatureEnabled` picks them up with no extra plumbing.
|
|
2878
|
+
*/
|
|
2879
|
+
export const PIN_SAVE_FEATURES: {
|
|
2880
|
+
PIN_MESSAGE: string;
|
|
2881
|
+
SAVE_MESSAGE: string;
|
|
2882
|
+
/**
|
|
2883
|
+
* ⚠️ Unlike the two message flags, this one is NOT yet in the backend's SDK
|
|
2884
|
+
* settings cache-bust hash (flagged on the backend design doc). Until it is added
|
|
2885
|
+
* there, flipping it will not invalidate a cached settings payload, so a client
|
|
2886
|
+
* may keep reading the old value until the hash changes for another reason.
|
|
2887
|
+
* `isPinConversationEnabled()` reads it correctly today; the staleness is
|
|
2888
|
+
* server-side.
|
|
2889
|
+
*/
|
|
2890
|
+
PIN_CONVERSATION: string;
|
|
2891
|
+
};
|
|
2892
|
+
/**
|
|
2893
|
+
* The server-owned caps, read from the same `parameters` map as the feature flags
|
|
2894
|
+
* above (§7.3).
|
|
2895
|
+
*
|
|
2896
|
+
* These make the caps knowable BEFORE the user hits one, which is what lets a UI
|
|
2897
|
+
* disable a pin control at the cap instead of letting the user discover it by error.
|
|
2898
|
+
* They are the ONLY supported source for a cap: the values ride the cached settings
|
|
2899
|
+
* payload, so a tenant override applied mid-session is picked up on the next refresh.
|
|
2900
|
+
*
|
|
2901
|
+
* `.system.*` are the admin/app-level caps (`app_system` pins), separate from the
|
|
2902
|
+
* per-user caps — the two are enforced independently server-side.
|
|
2903
|
+
*/
|
|
2904
|
+
export const PIN_SAVE_LIMITS: {
|
|
2905
|
+
/** Max pinned messages in one conversation, per user. */
|
|
2906
|
+
PINNED_MESSAGES: string;
|
|
2907
|
+
/** Max admin/system pinned messages in one conversation. */
|
|
2908
|
+
PINNED_MESSAGES_SYSTEM: string;
|
|
2909
|
+
/** Max saved messages per user, across all conversations. */
|
|
2910
|
+
SAVED_MESSAGES: string;
|
|
2911
|
+
/** Max pinned conversations per user. */
|
|
2912
|
+
PINNED_CONVERSATIONS: string;
|
|
2913
|
+
/** Max admin/system pinned conversations for the app. */
|
|
2914
|
+
PINNED_CONVERSATIONS_SYSTEM: string;
|
|
2915
|
+
};
|
|
2916
|
+
/**
|
|
2917
|
+
* Backend error codes worth naming. Every other `ERR_*` the server returns passes
|
|
2918
|
+
* through verbatim (§5.6) — do NOT enumerate codes here just to switch on them.
|
|
2919
|
+
* The pin/save limit is never hard-coded, take it from
|
|
2920
|
+
* app settings via `PIN_SAVE_LIMITS`, whatever the code.
|
|
2921
|
+
*/
|
|
2922
|
+
export const PIN_SAVE_ERROR_CODES: {
|
|
2923
|
+
/** SBAC rejection — the acting user may not pin/unpin here (§8-Q4). */
|
|
2924
|
+
ACTION_NOT_ALLOWED: string;
|
|
2925
|
+
};
|
|
2926
|
+
/**
|
|
2927
|
+
* Client-side validation errors for the two request builders and the four facade
|
|
2928
|
+
* methods. Mirrors the shape used by THREAD_ERROR / MESSAGES_REQUEST_ERRORS.
|
|
2929
|
+
*/
|
|
2930
|
+
export const PIN_SAVE_ERROR: {
|
|
2931
|
+
REQUEST_IN_PROGRESS: {
|
|
2932
|
+
code: string;
|
|
2933
|
+
name: string;
|
|
2934
|
+
message: string;
|
|
2935
|
+
details: {};
|
|
2936
|
+
};
|
|
2937
|
+
LIMIT_NOT_A_NUMBER: {
|
|
2938
|
+
code: string;
|
|
2939
|
+
name: string;
|
|
2940
|
+
message: string;
|
|
2941
|
+
details: {};
|
|
2942
|
+
};
|
|
2943
|
+
LIMIT_OUT_OF_RANGE: {
|
|
2944
|
+
code: string;
|
|
2945
|
+
name: string;
|
|
2946
|
+
message: string;
|
|
2947
|
+
details: {};
|
|
2948
|
+
};
|
|
2949
|
+
UID_GUID_MUTUALLY_EXCLUSIVE: {
|
|
2950
|
+
code: string;
|
|
2951
|
+
name: string;
|
|
2952
|
+
message: string;
|
|
2953
|
+
details: {};
|
|
2954
|
+
};
|
|
2955
|
+
UID_OR_GUID_REQUIRED: {
|
|
2956
|
+
code: string;
|
|
2957
|
+
name: string;
|
|
2958
|
+
message: string;
|
|
2959
|
+
details: {};
|
|
2960
|
+
};
|
|
2961
|
+
INVALID_MESSAGE_ID: {
|
|
2962
|
+
code: string;
|
|
2963
|
+
name: string;
|
|
2964
|
+
message: string;
|
|
2965
|
+
details: {};
|
|
2966
|
+
};
|
|
2967
|
+
/**
|
|
2968
|
+
* The write succeeded on the wire but its response body could not be parsed into a
|
|
2969
|
+
* message/conversation. The parsers swallow their own throws and return null, so
|
|
2970
|
+
* without this the facade would resolve `null` typed as a BaseMessage/Conversation
|
|
2971
|
+
* and the TypeError would surface in consumer code with nothing pointing here.
|
|
2972
|
+
*/
|
|
2973
|
+
UNPARSEABLE_RESPONSE: {
|
|
2974
|
+
code: string;
|
|
2975
|
+
name: string;
|
|
2976
|
+
message: string;
|
|
2977
|
+
details: {};
|
|
2978
|
+
};
|
|
2979
|
+
};
|
|
2980
|
+
|
|
2981
|
+
export class ConversationListener {
|
|
2982
|
+
/**
|
|
2983
|
+
* Triggered when a conversation is pinned — by this user on another device, or
|
|
2984
|
+
* globally by an admin. Receives the full, updated `Conversation`.
|
|
2985
|
+
*/
|
|
2986
|
+
onConversationPinned?: (conversation: Conversation) => void;
|
|
2987
|
+
/**
|
|
2988
|
+
* Triggered when a conversation is unpinned. Receives the full `Conversation`
|
|
2989
|
+
* with the pin attributes cleared.
|
|
2990
|
+
*/
|
|
2991
|
+
onConversationUnpinned?: (conversation: Conversation) => void;
|
|
2992
|
+
constructor(...args: any[]);
|
|
2993
|
+
}
|
|
2994
|
+
/** @internal */
|
|
2995
|
+
export class ConversationListenerWrapper {
|
|
2996
|
+
_name: string;
|
|
2997
|
+
_eventListener: ConversationListener;
|
|
2998
|
+
constructor(name: string, listener: ConversationListener);
|
|
2999
|
+
}
|
|
3000
|
+
|
|
2458
3001
|
/**
|
|
2459
3002
|
*
|
|
2460
3003
|
* @module UploadFileListener
|
|
@@ -3077,6 +3620,28 @@ export class BaseMessage implements Message {
|
|
|
3077
3620
|
protected mentionedMe?: boolean;
|
|
3078
3621
|
protected quotedMessageId?: number;
|
|
3079
3622
|
protected quotedMessage?: BaseMessage;
|
|
3623
|
+
/**
|
|
3624
|
+
* Pin & Save attributes (§5.4). Present ONLY when set — an unpinned/unsaved
|
|
3625
|
+
* message has no key at all, so the presence of `pinnedAt` IS "is pinned" and the
|
|
3626
|
+
* presence of `savedAt` IS "is saved". `pinnedAt`/`pinnedBy` are global (everyone
|
|
3627
|
+
* in the conversation sees the same values); `savedAt` is per-viewer and only ever
|
|
3628
|
+
* appears in the acting user's own context. Normalised at the single parse site by
|
|
3629
|
+
* `PinSaveParser` — never assign these directly from a raw payload.
|
|
3630
|
+
*/
|
|
3631
|
+
protected pinnedAt?: number;
|
|
3632
|
+
protected pinnedBy?: string;
|
|
3633
|
+
protected savedAt?: number;
|
|
3634
|
+
/**
|
|
3635
|
+
* Whether the LOGGED-IN user follows this message's thread. Per-viewer. Populated only when the request opted in with
|
|
3636
|
+
* `withThreadSubscribed=true` — which every SDK message fetch does — so a
|
|
3637
|
+
* socket-delivered message reads `false` until the next fetch. Normalised at the
|
|
3638
|
+
* single parse site by `ThreadParser`; never assign it from a raw payload.
|
|
3639
|
+
*
|
|
3640
|
+
* The SDK keeps NO subscription state of its own: this flag, as the server sent
|
|
3641
|
+
* it, is the whole truth. A consumer that needs certainty for a thread it has not
|
|
3642
|
+
* fetched should fetch the parent message.
|
|
3643
|
+
*/
|
|
3644
|
+
protected threadSubscribed?: boolean;
|
|
3080
3645
|
constructor(receiverId: string, messageType: string, receiverType: string, category: MessageCategory);
|
|
3081
3646
|
/**
|
|
3082
3647
|
* Get unread replies count of the message
|
|
@@ -3362,6 +3927,87 @@ export class BaseMessage implements Message {
|
|
|
3362
3927
|
* Set quoted message of the message.
|
|
3363
3928
|
*/
|
|
3364
3929
|
setQuotedMessage(value: BaseMessage): void;
|
|
3930
|
+
/**
|
|
3931
|
+
* Get the timestamp at which the message was pinned to its conversation.
|
|
3932
|
+
* Conversation-wide: the same value for every member. `undefined` when the
|
|
3933
|
+
* message is not pinned — prefer `isPinned()` over comparing this to 0.
|
|
3934
|
+
* @returns {number | undefined}
|
|
3935
|
+
*/
|
|
3936
|
+
getPinnedAt(): number | undefined;
|
|
3937
|
+
/**
|
|
3938
|
+
* @param {number | null} [pinnedAt]
|
|
3939
|
+
* Set the pin timestamp. Passing `null`/`undefined` CLEARS the attribute rather
|
|
3940
|
+
* than leaving a stale value, which is what an unpin must do.
|
|
3941
|
+
*/
|
|
3942
|
+
setPinnedAt(pinnedAt?: number | null): void;
|
|
3943
|
+
/**
|
|
3944
|
+
* Get the UID of the user who pinned the message. Only the MOST RECENT pinner is
|
|
3945
|
+
* kept — a message has a single pinner. The sentinel `"app_system"` means the pin
|
|
3946
|
+
* came from the app/admin rather than a member; check `isSystemPinned()`.
|
|
3947
|
+
* @returns {string | undefined}
|
|
3948
|
+
*/
|
|
3949
|
+
getPinnedBy(): string | undefined;
|
|
3950
|
+
/**
|
|
3951
|
+
* @param {string | null} [pinnedBy]
|
|
3952
|
+
* Set the UID of the pinner. Passing `null`/`undefined` clears the attribute.
|
|
3953
|
+
*/
|
|
3954
|
+
setPinnedBy(pinnedBy?: string | null): void;
|
|
3955
|
+
/**
|
|
3956
|
+
* Get the timestamp at which the LOGGED-IN user saved this message. Private and
|
|
3957
|
+
* per-viewer: it is never populated for anyone else. `undefined` when the message
|
|
3958
|
+
* is not saved — prefer `isSaved()`.
|
|
3959
|
+
* @returns {number | undefined}
|
|
3960
|
+
*/
|
|
3961
|
+
getSavedAt(): number | undefined;
|
|
3962
|
+
/**
|
|
3963
|
+
* @param {number | null} [savedAt]
|
|
3964
|
+
* Set the save timestamp. Passing `null`/`undefined` CLEARS the attribute, which
|
|
3965
|
+
* is what an unsave must do.
|
|
3966
|
+
*/
|
|
3967
|
+
setSavedAt(savedAt?: number | null): void;
|
|
3968
|
+
/**
|
|
3969
|
+
* Whether the message is currently pinned in its conversation. The presence of a
|
|
3970
|
+
* pin timestamp IS the boolean — there is no separate flag on the wire.
|
|
3971
|
+
* @returns {boolean}
|
|
3972
|
+
*/
|
|
3973
|
+
isPinned(): boolean;
|
|
3974
|
+
/**
|
|
3975
|
+
* Whether the logged-in user has saved this message. Private to that user.
|
|
3976
|
+
* @returns {boolean}
|
|
3977
|
+
*/
|
|
3978
|
+
isSaved(): boolean;
|
|
3979
|
+
/**
|
|
3980
|
+
* Whether the logged-in user follows this message's thread — read straight off the
|
|
3981
|
+
* message as the server sent it, with no SDK-side cache behind it.
|
|
3982
|
+
*
|
|
3983
|
+
* On a thread's PARENT message this is the thread's subscription state. Because the
|
|
3984
|
+
* flag only rides responses to requests that asked for it, a message delivered over
|
|
3985
|
+
* the socket reads `false`; re-fetch to resolve.
|
|
3986
|
+
* @returns {boolean}
|
|
3987
|
+
*/
|
|
3988
|
+
isThreadSubscribed(): boolean;
|
|
3989
|
+
/**
|
|
3990
|
+
* @param {boolean} threadSubscribed
|
|
3991
|
+
* Set whether the logged-in user follows this message's thread.
|
|
3992
|
+
*
|
|
3993
|
+
* This exists because the SDK holds NO subscription state. When a consumer learns a
|
|
3994
|
+
* thread's state — a `subscribeToThread()` / `unsubscribeFromThread()` call
|
|
3995
|
+
* resolving, or one of the auto-subscribe cases it owns — it propagates that to the
|
|
3996
|
+
* message objects it is holding by calling this setter, rather than the SDK keeping
|
|
3997
|
+
* a cache the consumer cannot correct.
|
|
3998
|
+
*
|
|
3999
|
+
* Purely local: writing it does NOT notify the server. Call
|
|
4000
|
+
* `CometChat.subscribeToThread()` / `unsubscribeFromThread()` to change the actual
|
|
4001
|
+
* subscription. Anything other than `true` is stored as `false`, so an absent or
|
|
4002
|
+
* wrong-typed value can never make `isThreadSubscribed()` lie.
|
|
4003
|
+
*/
|
|
4004
|
+
setThreadSubscribed(threadSubscribed: boolean): void;
|
|
4005
|
+
/**
|
|
4006
|
+
* Whether the pin was placed by the app/admin (`pinnedBy === "app_system"`)
|
|
4007
|
+
* rather than by a member — render it as a system pin, not as a user.
|
|
4008
|
+
* @returns {boolean}
|
|
4009
|
+
*/
|
|
4010
|
+
isSystemPinned(): boolean;
|
|
3365
4011
|
}
|
|
3366
4012
|
|
|
3367
4013
|
/**
|
|
@@ -4825,7 +5471,7 @@ export class MessageListener {
|
|
|
4825
5471
|
/**
|
|
4826
5472
|
* This event is triggered when a reaction is added.
|
|
4827
5473
|
*/
|
|
4828
|
-
onMessageReactionAdded?: Function;
|
|
5474
|
+
onMessageReactionAdded?: Function;
|
|
4829
5475
|
|
|
4830
5476
|
/**
|
|
4831
5477
|
* This event is triggered when a reaction is removed.
|
|
@@ -4859,6 +5505,31 @@ export class MessageListener {
|
|
|
4859
5505
|
* This event is triggered when a card message is received.
|
|
4860
5506
|
*/
|
|
4861
5507
|
onCardMessageReceived?: Function;
|
|
5508
|
+
/**
|
|
5509
|
+
* This event is triggered when a message is pinned in a conversation. Broadcast:
|
|
5510
|
+
* every member of the conversation receives it. The callback is passed the full,
|
|
5511
|
+
* updated message, so `getPinnedAt()` / `getPinnedBy()` are ready to render.
|
|
5512
|
+
*/
|
|
5513
|
+
onMessagePinned?: Function;
|
|
5514
|
+
/**
|
|
5515
|
+
* This event is triggered when a message is unpinned from a conversation.
|
|
5516
|
+
* Broadcast. The callback is passed the full message with the pin attributes
|
|
5517
|
+
* cleared.
|
|
5518
|
+
*/
|
|
5519
|
+
onMessageUnpinned?: Function;
|
|
5520
|
+
/**
|
|
5521
|
+
* This event is triggered when the logged-in user saves a message. PRIVATE — it
|
|
5522
|
+
* is delivered only to that user's own devices, so a save made on one device
|
|
5523
|
+
* updates the others. The callback is passed the full message, with `getSavedAt()`
|
|
5524
|
+
* populated.
|
|
5525
|
+
*/
|
|
5526
|
+
onMessageSaved?: Function;
|
|
5527
|
+
/**
|
|
5528
|
+
* This event is triggered when the logged-in user unsaves a message. Private to
|
|
5529
|
+
* that user's devices. The callback is passed the full message with the save
|
|
5530
|
+
* attribute cleared.
|
|
5531
|
+
*/
|
|
5532
|
+
onMessageUnsaved?: Function;
|
|
4862
5533
|
constructor(...args: any[]);
|
|
4863
5534
|
}
|
|
4864
5535
|
export class CallListener {
|
|
@@ -6174,6 +6845,7 @@ export class ConversationsRequestBuilder {
|
|
|
6174
6845
|
/** @private */ page: number;
|
|
6175
6846
|
/** @private */ hideAgentic: boolean;
|
|
6176
6847
|
/** @private */ onlyAgentic: boolean;
|
|
6848
|
+
/** @private */ pinnedBy: string[];
|
|
6177
6849
|
/**
|
|
6178
6850
|
*
|
|
6179
6851
|
* @param {number} limit
|
|
@@ -6275,8 +6947,24 @@ export class ConversationsRequestBuilder {
|
|
|
6275
6947
|
*/
|
|
6276
6948
|
setHideAgentic(hideAgentic: boolean): this;
|
|
6277
6949
|
/**
|
|
6278
|
-
*
|
|
6950
|
+
* Restrict the list to pinned conversations, by who pinned them. Accepts
|
|
6951
|
+
* `CometChat.PINNED_BY.SYSTEM` (admin-global pins, shown to every user) and
|
|
6952
|
+
* `CometChat.PINNED_BY.ME` (the logged-in user's own pins); a client may not ask
|
|
6953
|
+
* for anyone else's.
|
|
6954
|
+
*
|
|
6955
|
+
* Most callers do NOT need this: the default conversation list is already
|
|
6956
|
+
* pin-ordered by the server — admin-global pins first, then the user's own, then
|
|
6957
|
+
* everything else — so a normal list renders correctly with no filter at all. Use
|
|
6958
|
+
* this only for a dedicated "pinned" surface.
|
|
6959
|
+
*
|
|
6960
|
+
* @param {string[]} pinnedBy - PINNED_BY tokens.
|
|
6961
|
+
* @returns {this}
|
|
6962
|
+
*/
|
|
6963
|
+
setPinnedBy(pinnedBy: Array<string>): this;
|
|
6964
|
+
/**
|
|
6965
|
+
*
|
|
6279
6966
|
* @param {boolean} onlyAgentic
|
|
6967
|
+
* A method to fetch only agentic conversations.
|
|
6280
6968
|
* @returns
|
|
6281
6969
|
*/
|
|
6282
6970
|
setOnlyAgentic(onlyAgentic: boolean): this;
|
|
@@ -6498,6 +7186,8 @@ export class MessagesRequestBuilder {
|
|
|
6498
7186
|
/** @private */ types?: Array<String>;
|
|
6499
7187
|
/** @private */ HideReplies?: boolean;
|
|
6500
7188
|
/** @private */ HideDeletedMessages?: boolean;
|
|
7189
|
+
/** @private */ Pinned?: boolean;
|
|
7190
|
+
/** @private */ Saved?: boolean;
|
|
6501
7191
|
/** @private */ tags?: Array<String>;
|
|
6502
7192
|
/** @private */ WithTags?: boolean;
|
|
6503
7193
|
/** @private */ interactionGoalCompletedOnly?: boolean;
|
|
@@ -6637,6 +7327,38 @@ export class MessagesRequestBuilder {
|
|
|
6637
7327
|
* @returns
|
|
6638
7328
|
*/
|
|
6639
7329
|
hasReactions(hasReactions: boolean): this;
|
|
7330
|
+
/**
|
|
7331
|
+
* Fetch only the PINNED messages of a conversation, newest pin first.
|
|
7332
|
+
*
|
|
7333
|
+
* Conversation-scoped: combine with `setUID` or `setGUID`. A conversation is
|
|
7334
|
+
* capped at 100 pins, so `setLimit(100)` returns the whole list in one call —
|
|
7335
|
+
* which is what a "{n} Pinned Messages" title needs, since the server exposes no
|
|
7336
|
+
* count field.
|
|
7337
|
+
*
|
|
7338
|
+
* Pagination follows the server: if the response carries a `meta.cursor`, keep
|
|
7339
|
+
* calling to page through it as with ordinary history; if it does not, the list came
|
|
7340
|
+
* back whole and the next fetch in the same direction resolves `[]`. Either way
|
|
7341
|
+
* `setLimit(100)` reads the entire capped list in one call.
|
|
7342
|
+
*
|
|
7343
|
+
* @param {boolean} pinned
|
|
7344
|
+
* @returns {this}
|
|
7345
|
+
*/
|
|
7346
|
+
setPinned(pinned?: boolean): this;
|
|
7347
|
+
/**
|
|
7348
|
+
* Fetch only the messages the logged-in user has SAVED, newest save first.
|
|
7349
|
+
*
|
|
7350
|
+
* User-level and cross-conversation, so do NOT set a uid/guid — leaving both
|
|
7351
|
+
* unset routes to the bare messages endpoint. Each row carries its own
|
|
7352
|
+
* `conversationId` / `receiver`, so it can be rendered and deep-linked on its
|
|
7353
|
+
* own. Capped at 100 per user, so `setLimit(100)` fetches everything in one call.
|
|
7354
|
+
*
|
|
7355
|
+
* As with `setPinned`, no cursor is required to call `fetchNext()` on it, and paging
|
|
7356
|
+
* follows whatever the response carries — see `setPinned`.
|
|
7357
|
+
*
|
|
7358
|
+
* @param {boolean} saved
|
|
7359
|
+
* @returns {this}
|
|
7360
|
+
*/
|
|
7361
|
+
setSaved(saved?: boolean): this;
|
|
6640
7362
|
/**
|
|
6641
7363
|
* Method to only fetch messages which have the given mentioned UIDs.
|
|
6642
7364
|
* @param {Array<String>} mentionedUIDs
|
|
@@ -7173,6 +7895,20 @@ export class Conversation {
|
|
|
7173
7895
|
protected lastReadMessageId: string;
|
|
7174
7896
|
protected latestMessageId: string;
|
|
7175
7897
|
protected tags: Array<String>;
|
|
7898
|
+
/**
|
|
7899
|
+
* Pin Conversation attributes. Present ONLY when set — an unpinned conversation
|
|
7900
|
+
* has no key at all, so the presence of `pinnedAt` IS "is pinned".
|
|
7901
|
+
*
|
|
7902
|
+
* A conversation can be pinned by the logged-in user OR globally by an admin for
|
|
7903
|
+
* every user; `pinnedBy` distinguishes them (`"app_system"` = admin-global, see
|
|
7904
|
+
* `isSystemPinned()`). When both exist the server resolves precedence — the
|
|
7905
|
+
* admin-global pin wins — and sends only the winner, so nothing is inferred here.
|
|
7906
|
+
*
|
|
7907
|
+
* Normalised by `PinSaveParser.applyConversationPinAttributes` at the transform
|
|
7908
|
+
* site; never assign these directly from a raw payload.
|
|
7909
|
+
*/
|
|
7910
|
+
protected pinnedAt?: number;
|
|
7911
|
+
protected pinnedBy?: string;
|
|
7176
7912
|
constructor(conversationId: string, conversationType: string, lastMessage: TextMessage | MediaMessage | CustomMessage | any, conversationWith: User | Group, unreadMessageCount: number, tags: Array<String>, unreadMentionsCount: number | any, lastReadMessageId: string | any, latestMessageId?: string | any);
|
|
7177
7913
|
/**
|
|
7178
7914
|
* Method to set conversation ID of the conversation.
|
|
@@ -7255,9 +7991,41 @@ export class Conversation {
|
|
|
7255
7991
|
*/
|
|
7256
7992
|
getUnreadMessageCount(): number;
|
|
7257
7993
|
/**
|
|
7258
|
-
*
|
|
7259
|
-
*
|
|
7260
|
-
|
|
7994
|
+
* Get the timestamp at which this conversation was pinned. `undefined` when it is
|
|
7995
|
+
* not pinned — prefer `isPinned()` over comparing this to 0.
|
|
7996
|
+
* @returns {number | undefined}
|
|
7997
|
+
*/
|
|
7998
|
+
getPinnedAt(): number | undefined;
|
|
7999
|
+
/**
|
|
8000
|
+
* @param {number | null} [pinnedAt]
|
|
8001
|
+
* Set the pin timestamp. Passing `null`/`undefined` CLEARS the attribute, which is
|
|
8002
|
+
* what an unpin must do.
|
|
8003
|
+
*/
|
|
8004
|
+
setPinnedAt(pinnedAt?: number | null): void;
|
|
8005
|
+
/**
|
|
8006
|
+
* Get the UID of whoever pinned this conversation, or `"app_system"` when it is an
|
|
8007
|
+
* admin-global pin shown to every user (`isSystemPinned()`).
|
|
8008
|
+
* @returns {string | undefined}
|
|
8009
|
+
*/
|
|
8010
|
+
getPinnedBy(): string | undefined;
|
|
8011
|
+
/**
|
|
8012
|
+
* @param {string | null} [pinnedBy]
|
|
8013
|
+
* Set the pinner. Passing `null`/`undefined` clears the attribute.
|
|
8014
|
+
*/
|
|
8015
|
+
setPinnedBy(pinnedBy?: string | null): void;
|
|
8016
|
+
/**
|
|
8017
|
+
* Whether this conversation is pinned to the top of the list — by the logged-in
|
|
8018
|
+
* user or globally by an admin. The presence of a pin timestamp IS the boolean.
|
|
8019
|
+
* @returns {boolean}
|
|
8020
|
+
*/
|
|
8021
|
+
isPinned(): boolean;
|
|
8022
|
+
/**
|
|
8023
|
+
* Whether the pin is an admin-global one (`pinnedBy === "app_system"`), shown to
|
|
8024
|
+
* every user. A user cannot unpin these — attempting it is rejected server-side —
|
|
8025
|
+
* so hide the unpin affordance when this is true.
|
|
8026
|
+
* @returns {boolean}
|
|
8027
|
+
*/
|
|
8028
|
+
isSystemPinned(): boolean;
|
|
7261
8029
|
getTags(): Array<String>;
|
|
7262
8030
|
}
|
|
7263
8031
|
|
|
@@ -7840,10 +8608,6 @@ export class InteractiveMessage extends BaseMessage implements Message {
|
|
|
7840
8608
|
GROUP: string;
|
|
7841
8609
|
};
|
|
7842
8610
|
/** @private */ static readonly CATEGORY: {
|
|
7843
|
-
/**
|
|
7844
|
-
* Method to set interaction goal of interactive message.
|
|
7845
|
-
* @param {InteractionGoal} interactionGoal
|
|
7846
|
-
*/
|
|
7847
8611
|
MESSAGE: string;
|
|
7848
8612
|
ACTION: string;
|
|
7849
8613
|
CALL: string;
|
|
@@ -7852,7 +8616,12 @@ export class InteractiveMessage extends BaseMessage implements Message {
|
|
|
7852
8616
|
AGENTIC: string;
|
|
7853
8617
|
CARD: string;
|
|
7854
8618
|
};
|
|
8619
|
+
private interactiveData;
|
|
8620
|
+
private interactionGoal;
|
|
7855
8621
|
protected data?: Object;
|
|
8622
|
+
private interactions?;
|
|
8623
|
+
private tags?;
|
|
8624
|
+
private allowSenderInteraction?;
|
|
7856
8625
|
constructor(...args: any[]);
|
|
7857
8626
|
/**
|
|
7858
8627
|
* Method to get sender of the message.
|
|
@@ -9068,7 +9837,14 @@ export enum MessagesOptions {
|
|
|
9068
9837
|
export enum RepliesOptions {
|
|
9069
9838
|
DONT_SUBSCRIBE,
|
|
9070
9839
|
SUBSCRIBE_TO_ALL,
|
|
9071
|
-
SUBSCRIBE_TO_MENTIONS
|
|
9840
|
+
SUBSCRIBE_TO_MENTIONS,
|
|
9841
|
+
SUBSCRIBE_TO_SUBSCRIBED_THREADS
|
|
9842
|
+
}
|
|
9843
|
+
export enum QuotedRepliesOptions {
|
|
9844
|
+
DONT_SUBSCRIBE,
|
|
9845
|
+
SUBSCRIBE_TO_ALL,
|
|
9846
|
+
SUBSCRIBE_TO_MENTIONS,
|
|
9847
|
+
SUBSCRIBE_TO_QUOTES_ON_OWN_MESSAGES
|
|
9072
9848
|
}
|
|
9073
9849
|
export enum ReactionsOptions {
|
|
9074
9850
|
DONT_SUBSCRIBE,
|
|
@@ -9104,6 +9880,7 @@ export const APIConstants: {
|
|
|
9104
9880
|
KEY_GROUP_MESSAGES: string;
|
|
9105
9881
|
KEY_GROUP_REACTIONS: string;
|
|
9106
9882
|
KEY_GROUP_REPLIES: string;
|
|
9883
|
+
KEY_GROUP_QUOTED_REPLIES: string;
|
|
9107
9884
|
KEY_GROUP_MEMBER_ADDED: string;
|
|
9108
9885
|
KEY_GROUP_MEMBER_LEFT: string;
|
|
9109
9886
|
KEY_GROUP_MEMBER_JOINED: string;
|
|
@@ -9118,6 +9895,7 @@ export const APIConstants: {
|
|
|
9118
9895
|
KEY_ONE_ON_ONE_MESSAGES: string;
|
|
9119
9896
|
KEY_ONE_ON_ONE_REACTIONS: string;
|
|
9120
9897
|
KEY_ONE_ON_ONE_REPLIES: string;
|
|
9898
|
+
KEY_ONE_ON_ONE_QUOTED_REPLIES: string;
|
|
9121
9899
|
KEY_USE_PRIVACY_TEMPLATE: string;
|
|
9122
9900
|
KEY_PROVIDER_ID: string;
|
|
9123
9901
|
KEY_TIMEZONE: string;
|
|
@@ -9202,6 +9980,11 @@ export class GroupPreferences {
|
|
|
9202
9980
|
* @returns {RepliesOptions}
|
|
9203
9981
|
*/
|
|
9204
9982
|
getRepliesPreference(): RepliesOptions;
|
|
9983
|
+
/**
|
|
9984
|
+
* Get the quoted replies preferences for groups.
|
|
9985
|
+
* @returns {QuotedRepliesOptions}
|
|
9986
|
+
*/
|
|
9987
|
+
getQuotedRepliesPreference(): QuotedRepliesOptions;
|
|
9205
9988
|
/**
|
|
9206
9989
|
* Get the reactions preferences for groups.
|
|
9207
9990
|
* @returns {ReactionsOptions}
|
|
@@ -9252,6 +10035,11 @@ export class GroupPreferences {
|
|
|
9252
10035
|
* Set replies preference for groups.
|
|
9253
10036
|
*/
|
|
9254
10037
|
setRepliesPreference(repliesPreference: RepliesOptions): void;
|
|
10038
|
+
/**
|
|
10039
|
+
* @param {QuotedRepliesOptions} quotedRepliesPreference
|
|
10040
|
+
* Set quoted replies preference for groups.
|
|
10041
|
+
*/
|
|
10042
|
+
setQuotedRepliesPreference(quotedRepliesPreference: QuotedRepliesOptions): void;
|
|
9255
10043
|
/**
|
|
9256
10044
|
* @param {ReactionsOptions} reactionsPreference
|
|
9257
10045
|
* Set reactions preference for groups.
|
|
@@ -9440,6 +10228,16 @@ export class OneOnOnePreferences {
|
|
|
9440
10228
|
* Set replies preference for groups.
|
|
9441
10229
|
*/
|
|
9442
10230
|
setRepliesPreference(repliesPreference: RepliesOptions): void;
|
|
10231
|
+
/**
|
|
10232
|
+
* Get the quoted replies preferences for groups.
|
|
10233
|
+
* @returns {QuotedRepliesOptions}
|
|
10234
|
+
*/
|
|
10235
|
+
getQuotedRepliesPreference(): QuotedRepliesOptions;
|
|
10236
|
+
/**
|
|
10237
|
+
* @param {QuotedRepliesOptions} quotedRepliesPreference
|
|
10238
|
+
* Set quoted replies preference for groups.
|
|
10239
|
+
*/
|
|
10240
|
+
setQuotedRepliesPreference(quotedRepliesPreference: QuotedRepliesOptions): void;
|
|
9443
10241
|
/**
|
|
9444
10242
|
* Get the messages preferences for groups.
|
|
9445
10243
|
* @returns {MessagesOptions}
|