@cometchat/chat-sdk-javascript 4.1.11 → 4.1.12
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 +233 -3
- package/CometChat.js +1 -1
- package/package.json +1 -1
package/CometChat.d.ts
CHANGED
|
@@ -23,6 +23,9 @@ export class CometChat {
|
|
|
23
23
|
static AIAssistantToolEndedEvent: typeof AIAssistantToolEndedEvent;
|
|
24
24
|
static AIAssistantToolArgumentEvent: typeof AIAssistantToolArgumentEvent;
|
|
25
25
|
static AIAssistantToolResultEvent: typeof AIAssistantToolResultEvent;
|
|
26
|
+
static AIAssistantCardStartedEvent: typeof AIAssistantCardStartedEvent;
|
|
27
|
+
static AIAssistantCardReceivedEvent: typeof AIAssistantCardReceivedEvent;
|
|
28
|
+
static AIAssistantCardEndedEvent: typeof AIAssistantCardEndedEvent;
|
|
26
29
|
static AI_ASSISTANT_EVENTS: {
|
|
27
30
|
RUN_STARTED: string;
|
|
28
31
|
RUN_FINISHED: string;
|
|
@@ -33,6 +36,9 @@ export class CometChat {
|
|
|
33
36
|
TOOL_CALL_ENDED: string;
|
|
34
37
|
TOOL_CALL_RESULT: string;
|
|
35
38
|
TOOL_CALL_ARGUMENT: string;
|
|
39
|
+
CARD_START: string;
|
|
40
|
+
CARD: string;
|
|
41
|
+
CARD_END: string;
|
|
36
42
|
};
|
|
37
43
|
static GroupType: typeof GroupType;
|
|
38
44
|
static GroupMemberScope: typeof GroupMemberScope;
|
|
@@ -338,6 +344,7 @@ export class CometChat {
|
|
|
338
344
|
CUSTOM: string;
|
|
339
345
|
INTERACTIVE: string;
|
|
340
346
|
AGENTIC: string;
|
|
347
|
+
CARD: string;
|
|
341
348
|
};
|
|
342
349
|
RECEIVER_TYPE: {
|
|
343
350
|
USER: string;
|
|
@@ -383,6 +390,9 @@ export class CometChat {
|
|
|
383
390
|
TOOL_CALL_ID: string;
|
|
384
391
|
DISPLAY_NAME: string;
|
|
385
392
|
EXECUTION_TEXT: string;
|
|
393
|
+
CARD: string;
|
|
394
|
+
CARD_ID: string;
|
|
395
|
+
ELEMENTS: string;
|
|
386
396
|
};
|
|
387
397
|
KNOWN_MEDIA_TYPE: {
|
|
388
398
|
IMAGE: any[];
|
|
@@ -459,6 +469,11 @@ export class CometChat {
|
|
|
459
469
|
WEBRTC_HTTPS_BIND_PORT: string;
|
|
460
470
|
EXTENSION_LIST: string;
|
|
461
471
|
EXTENSION_KEYS: {
|
|
472
|
+
/**
|
|
473
|
+
* This method removes data from the session storage.
|
|
474
|
+
* @internal
|
|
475
|
+
* @memberof CometChat
|
|
476
|
+
*/
|
|
462
477
|
ID: string;
|
|
463
478
|
NAME: string;
|
|
464
479
|
};
|
|
@@ -540,6 +555,11 @@ export class CometChat {
|
|
|
540
555
|
};
|
|
541
556
|
};
|
|
542
557
|
static PresenceConstants: {
|
|
558
|
+
/**
|
|
559
|
+
* This method checks if Analytics Ping has started.
|
|
560
|
+
* @internal
|
|
561
|
+
* @returns {boolean}
|
|
562
|
+
*/
|
|
543
563
|
STATUS: {
|
|
544
564
|
ONLINE: string;
|
|
545
565
|
AVAILABLE: string;
|
|
@@ -629,7 +649,7 @@ export class CometChat {
|
|
|
629
649
|
code: string;
|
|
630
650
|
name: string;
|
|
631
651
|
message: string;
|
|
632
|
-
details: {};
|
|
652
|
+
/** @internal */ details: {};
|
|
633
653
|
};
|
|
634
654
|
MUST_BE_A_POSITIVE_NUMBER: {
|
|
635
655
|
code: string;
|
|
@@ -804,7 +824,11 @@ export class CometChat {
|
|
|
804
824
|
details: {};
|
|
805
825
|
};
|
|
806
826
|
FEATURE_NOT_FOUND: {
|
|
807
|
-
code: string;
|
|
827
|
+
code: string; /**
|
|
828
|
+
* This method triggers before a page unloads.
|
|
829
|
+
* @internal
|
|
830
|
+
* @memberof CometChat
|
|
831
|
+
*/
|
|
808
832
|
name: string;
|
|
809
833
|
message: string;
|
|
810
834
|
details: {};
|
|
@@ -1037,6 +1061,8 @@ export class CometChat {
|
|
|
1037
1061
|
static InteractionReceipt: typeof InteractionReceipt;
|
|
1038
1062
|
static MessageReceipt: typeof MessageReceipt;
|
|
1039
1063
|
static AIAssistantMessage: typeof AIAssistantMessage;
|
|
1064
|
+
static AIAssistantElement: typeof AIAssistantElement;
|
|
1065
|
+
static CardMessage: typeof CardMessage;
|
|
1040
1066
|
static AIToolCall: typeof AIToolCall;
|
|
1041
1067
|
static AIToolCallFunction: typeof AIToolCallFunction;
|
|
1042
1068
|
static AIAssistantMessageData: typeof AIAssistantMessageData;
|
|
@@ -2600,6 +2626,7 @@ export class MediaMessage extends BaseMessage implements Message {
|
|
|
2600
2626
|
CUSTOM: string;
|
|
2601
2627
|
INTERACTIVE: string;
|
|
2602
2628
|
AGENTIC: string;
|
|
2629
|
+
CARD: string;
|
|
2603
2630
|
};
|
|
2604
2631
|
private url;
|
|
2605
2632
|
private file;
|
|
@@ -3295,6 +3322,7 @@ export const MessageConstatnts: {
|
|
|
3295
3322
|
CUSTOM: string;
|
|
3296
3323
|
INTERACTIVE: string;
|
|
3297
3324
|
AGENTIC: string;
|
|
3325
|
+
CARD: string;
|
|
3298
3326
|
};
|
|
3299
3327
|
RECEIVER_TYPE: {
|
|
3300
3328
|
USER: string;
|
|
@@ -3340,6 +3368,9 @@ export const MessageConstatnts: {
|
|
|
3340
3368
|
TOOL_CALL_ID: string;
|
|
3341
3369
|
DISPLAY_NAME: string;
|
|
3342
3370
|
EXECUTION_TEXT: string;
|
|
3371
|
+
CARD: string;
|
|
3372
|
+
CARD_ID: string;
|
|
3373
|
+
ELEMENTS: string;
|
|
3343
3374
|
};
|
|
3344
3375
|
KNOWN_MEDIA_TYPE: {
|
|
3345
3376
|
IMAGE: any[];
|
|
@@ -3410,7 +3441,8 @@ export enum MessageCategory {
|
|
|
3410
3441
|
CALL = "call",
|
|
3411
3442
|
CUSTOM = "custom",
|
|
3412
3443
|
INTERACTIVE = "interactive",
|
|
3413
|
-
AGENTIC = "agentic"
|
|
3444
|
+
AGENTIC = "agentic",
|
|
3445
|
+
CARD = "card"
|
|
3414
3446
|
}
|
|
3415
3447
|
export enum GoalType {
|
|
3416
3448
|
ANY_ACTION = "anyAction",
|
|
@@ -4211,6 +4243,9 @@ export const AI_ASSISTANT_EVENTS: {
|
|
|
4211
4243
|
TOOL_CALL_ENDED: string;
|
|
4212
4244
|
TOOL_CALL_RESULT: string;
|
|
4213
4245
|
TOOL_CALL_ARGUMENT: string;
|
|
4246
|
+
CARD_START: string;
|
|
4247
|
+
CARD: string;
|
|
4248
|
+
CARD_END: string;
|
|
4214
4249
|
};
|
|
4215
4250
|
export interface FlagReason {
|
|
4216
4251
|
id: string;
|
|
@@ -4499,6 +4534,10 @@ export class MessageListener {
|
|
|
4499
4534
|
* This event is triggered when an AI assistant message is received.
|
|
4500
4535
|
*/
|
|
4501
4536
|
onAIAssistantMessageReceived?: Function;
|
|
4537
|
+
/**
|
|
4538
|
+
* This event is triggered when a card message is received.
|
|
4539
|
+
*/
|
|
4540
|
+
onCardMessageReceived?: Function;
|
|
4502
4541
|
constructor(...args: any[]);
|
|
4503
4542
|
}
|
|
4504
4543
|
export class CallListener {
|
|
@@ -4759,6 +4798,7 @@ export class Call extends BaseMessage implements Message {
|
|
|
4759
4798
|
CUSTOM: string;
|
|
4760
4799
|
INTERACTIVE: string;
|
|
4761
4800
|
AGENTIC: string;
|
|
4801
|
+
CARD: string;
|
|
4762
4802
|
};
|
|
4763
4803
|
static readonly ACTION_TYPE: {
|
|
4764
4804
|
TYPE_MEMBER_JOINED: string;
|
|
@@ -5056,6 +5096,7 @@ export class Action extends BaseMessage implements Message {
|
|
|
5056
5096
|
CUSTOM: string;
|
|
5057
5097
|
INTERACTIVE: string;
|
|
5058
5098
|
AGENTIC: string;
|
|
5099
|
+
CARD: string;
|
|
5059
5100
|
};
|
|
5060
5101
|
static readonly ACTION_TYPE: {
|
|
5061
5102
|
TYPE_MEMBER_JOINED: string;
|
|
@@ -7488,6 +7529,7 @@ export class InteractiveMessage extends BaseMessage implements Message {
|
|
|
7488
7529
|
CUSTOM: string;
|
|
7489
7530
|
INTERACTIVE: string;
|
|
7490
7531
|
AGENTIC: string;
|
|
7532
|
+
CARD: string;
|
|
7491
7533
|
};
|
|
7492
7534
|
protected data?: Object;
|
|
7493
7535
|
constructor(...args: any[]);
|
|
@@ -8328,6 +8370,19 @@ export class AIAssistantMessage extends BaseMessage implements Message {
|
|
|
8328
8370
|
* Set the tags for the message.
|
|
8329
8371
|
*/
|
|
8330
8372
|
setTags(tags: Array<String>): void;
|
|
8373
|
+
/**
|
|
8374
|
+
* Method to get the ordered list of content blocks (`data.elements`).
|
|
8375
|
+
* Returns an empty array when the field is absent (e.g. older messages),
|
|
8376
|
+
* in which case the renderer should fall back to getText().
|
|
8377
|
+
* @returns {Array<AIAssistantElement>}
|
|
8378
|
+
*/
|
|
8379
|
+
getElements(): Array<AIAssistantElement>;
|
|
8380
|
+
/**
|
|
8381
|
+
* Method to set the ordered list of content blocks. Called by the factory
|
|
8382
|
+
* to populate the field from `data.elements`.
|
|
8383
|
+
* @param {Array<AIAssistantElement>} elements
|
|
8384
|
+
*/
|
|
8385
|
+
setElements(elements: Array<AIAssistantElement>): void;
|
|
8331
8386
|
}
|
|
8332
8387
|
|
|
8333
8388
|
/**
|
|
@@ -8592,6 +8647,97 @@ export class AIToolArgumentMessage extends BaseMessage implements Message {
|
|
|
8592
8647
|
setTags(tags: Array<String>): void;
|
|
8593
8648
|
}
|
|
8594
8649
|
|
|
8650
|
+
/**
|
|
8651
|
+
*
|
|
8652
|
+
* @module CardMessage
|
|
8653
|
+
*/
|
|
8654
|
+
export class CardMessage extends BaseMessage implements Message {
|
|
8655
|
+
protected data?: any;
|
|
8656
|
+
constructor(receiverId: string, receiverType: string);
|
|
8657
|
+
/**
|
|
8658
|
+
* Method to get the raw card JSON object.
|
|
8659
|
+
* @returns {Object | undefined}
|
|
8660
|
+
*/
|
|
8661
|
+
getCard(): Object | undefined;
|
|
8662
|
+
/**
|
|
8663
|
+
* Method to get the text content of the card message.
|
|
8664
|
+
* @returns {string}
|
|
8665
|
+
*/
|
|
8666
|
+
getText(): string;
|
|
8667
|
+
/**
|
|
8668
|
+
* Method to get the fallback text from the card object.
|
|
8669
|
+
* @returns {string}
|
|
8670
|
+
*/
|
|
8671
|
+
getFallbackText(): string;
|
|
8672
|
+
/**
|
|
8673
|
+
* Method to get sender of the message.
|
|
8674
|
+
* @returns {User}
|
|
8675
|
+
*/
|
|
8676
|
+
getSender(): User;
|
|
8677
|
+
/**
|
|
8678
|
+
* Method to get receiver of the message.
|
|
8679
|
+
* @returns {User | Group}
|
|
8680
|
+
*/
|
|
8681
|
+
getReceiver(): User | Group;
|
|
8682
|
+
/**
|
|
8683
|
+
* Method to get data of the message.
|
|
8684
|
+
* @returns {any}
|
|
8685
|
+
*/
|
|
8686
|
+
getData(): any;
|
|
8687
|
+
/**
|
|
8688
|
+
* Get the tags of the message.
|
|
8689
|
+
* @returns {Array<String>}
|
|
8690
|
+
*/
|
|
8691
|
+
getTags(): Array<String>;
|
|
8692
|
+
/**
|
|
8693
|
+
* @param {Array<String>} tags
|
|
8694
|
+
* Set the tags for the message.
|
|
8695
|
+
*/
|
|
8696
|
+
setTags(tags: Array<String>): void;
|
|
8697
|
+
}
|
|
8698
|
+
|
|
8699
|
+
/**
|
|
8700
|
+
* A single ordered content block from an AIAssistantMessage's `data.elements`
|
|
8701
|
+
* array. Each entry is a `{ type, value }` envelope; the SDK never parses the
|
|
8702
|
+
* value — the caller branches on getType() to interpret what getData() returns.
|
|
8703
|
+
*
|
|
8704
|
+
* - type "text" → getData() is the block's text string
|
|
8705
|
+
* - type "card" → getData() is `{ card, cardId }`
|
|
8706
|
+
* - other types → getData() is that type's raw JSON value
|
|
8707
|
+
*/
|
|
8708
|
+
export class AIAssistantElement {
|
|
8709
|
+
constructor(type: string, data: any);
|
|
8710
|
+
/**
|
|
8711
|
+
* Method to get the element's type string ("text" | "card" | "graph" | ...).
|
|
8712
|
+
* @returns {string}
|
|
8713
|
+
*/
|
|
8714
|
+
getType(): string;
|
|
8715
|
+
/**
|
|
8716
|
+
* Method to set the element's type string.
|
|
8717
|
+
* @param {string} type
|
|
8718
|
+
*/
|
|
8719
|
+
setType(type: string): void;
|
|
8720
|
+
/**
|
|
8721
|
+
* Method to get the element's body data (the entry's `value`), returned raw
|
|
8722
|
+
* and typed by getType(). The SDK never interprets the body.
|
|
8723
|
+
* @returns {any}
|
|
8724
|
+
*/
|
|
8725
|
+
getData(): any;
|
|
8726
|
+
/**
|
|
8727
|
+
* Method to set the element's body data.
|
|
8728
|
+
* @param {any} data
|
|
8729
|
+
*/
|
|
8730
|
+
setData(data: any): void;
|
|
8731
|
+
/**
|
|
8732
|
+
* Build an ordered list of AIAssistantElement from a raw `data.elements`
|
|
8733
|
+
* array. Returns an empty array when the field is absent (e.g. older
|
|
8734
|
+
* messages). The `value` of each entry is preserved raw.
|
|
8735
|
+
* @param {any[]} elements
|
|
8736
|
+
* @returns {AIAssistantElement[]}
|
|
8737
|
+
*/
|
|
8738
|
+
static fromArray(elements: any[]): AIAssistantElement[];
|
|
8739
|
+
}
|
|
8740
|
+
|
|
8595
8741
|
/** Push Notification Preferences Enums */
|
|
8596
8742
|
export enum MessagesOptions {
|
|
8597
8743
|
DONT_SUBSCRIBE,
|
|
@@ -9576,3 +9722,87 @@ export class AIAssistantToolResultEvent extends AIAssistantBaseEvent<AssistantTo
|
|
|
9576
9722
|
setRole(role: string): void;
|
|
9577
9723
|
}
|
|
9578
9724
|
|
|
9725
|
+
/**
|
|
9726
|
+
* Data interface for card started events
|
|
9727
|
+
*/
|
|
9728
|
+
export interface AssistantCardStartedEventData extends AssistantBaseEventData {
|
|
9729
|
+
streamMessageId?: string;
|
|
9730
|
+
cardId?: string;
|
|
9731
|
+
executionText?: string;
|
|
9732
|
+
}
|
|
9733
|
+
/**
|
|
9734
|
+
* Event fired when AI assistant card generation starts
|
|
9735
|
+
*/
|
|
9736
|
+
export class AIAssistantCardStartedEvent extends AIAssistantBaseEvent<AssistantCardStartedEventData> {
|
|
9737
|
+
constructor(conversationId: string, messageId: string, parentMessageId: string, data: AssistantCardStartedEventData);
|
|
9738
|
+
/**
|
|
9739
|
+
* Get the stream message ID for the card event.
|
|
9740
|
+
* @returns {string}
|
|
9741
|
+
*/
|
|
9742
|
+
getStreamMessageId(): string;
|
|
9743
|
+
/**
|
|
9744
|
+
* Get the card ID for the card event.
|
|
9745
|
+
* @returns {string}
|
|
9746
|
+
*/
|
|
9747
|
+
getCardId(): string;
|
|
9748
|
+
/**
|
|
9749
|
+
* Get the execution text shown while the card is being generated.
|
|
9750
|
+
* @returns {string}
|
|
9751
|
+
*/
|
|
9752
|
+
getExecutionText(): string;
|
|
9753
|
+
}
|
|
9754
|
+
|
|
9755
|
+
/**
|
|
9756
|
+
* Data interface for card received events
|
|
9757
|
+
*/
|
|
9758
|
+
export interface AssistantCardReceivedEventData extends AssistantBaseEventData {
|
|
9759
|
+
streamMessageId?: string;
|
|
9760
|
+
cardId?: string;
|
|
9761
|
+
card?: any;
|
|
9762
|
+
}
|
|
9763
|
+
/**
|
|
9764
|
+
* Event fired when AI assistant card payload is delivered
|
|
9765
|
+
*/
|
|
9766
|
+
export class AIAssistantCardReceivedEvent extends AIAssistantBaseEvent<AssistantCardReceivedEventData> {
|
|
9767
|
+
constructor(conversationId: string, messageId: string, parentMessageId: string, data: AssistantCardReceivedEventData);
|
|
9768
|
+
/**
|
|
9769
|
+
* Get the stream message ID for the card event.
|
|
9770
|
+
* @returns {string}
|
|
9771
|
+
*/
|
|
9772
|
+
getStreamMessageId(): string;
|
|
9773
|
+
/**
|
|
9774
|
+
* Get the card ID for the card event.
|
|
9775
|
+
* @returns {string}
|
|
9776
|
+
*/
|
|
9777
|
+
getCardId(): string;
|
|
9778
|
+
/**
|
|
9779
|
+
* Get the raw card object from the event data.
|
|
9780
|
+
* @returns {any} The card object or undefined
|
|
9781
|
+
*/
|
|
9782
|
+
getCard(): any;
|
|
9783
|
+
}
|
|
9784
|
+
|
|
9785
|
+
/**
|
|
9786
|
+
* Data interface for card ended events
|
|
9787
|
+
*/
|
|
9788
|
+
export interface AssistantCardEndedEventData extends AssistantBaseEventData {
|
|
9789
|
+
streamMessageId?: string;
|
|
9790
|
+
cardId?: string;
|
|
9791
|
+
}
|
|
9792
|
+
/**
|
|
9793
|
+
* Event fired when AI assistant card generation finishes
|
|
9794
|
+
*/
|
|
9795
|
+
export class AIAssistantCardEndedEvent extends AIAssistantBaseEvent<AssistantCardEndedEventData> {
|
|
9796
|
+
constructor(conversationId: string, messageId: string, parentMessageId: string, data: AssistantCardEndedEventData);
|
|
9797
|
+
/**
|
|
9798
|
+
* Get the stream message ID for the card event.
|
|
9799
|
+
* @returns {string}
|
|
9800
|
+
*/
|
|
9801
|
+
getStreamMessageId(): string;
|
|
9802
|
+
/**
|
|
9803
|
+
* Get the card ID for the card event.
|
|
9804
|
+
* @returns {string}
|
|
9805
|
+
*/
|
|
9806
|
+
getCardId(): string;
|
|
9807
|
+
}
|
|
9808
|
+
|