@cometchat/chat-sdk-javascript 4.0.4-beta1 → 4.0.4

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 CHANGED
@@ -9,6 +9,7 @@
9
9
  */
10
10
  export function init(appId: string): CometChat;
11
11
  export as namespace CometChat;
12
+ export as namespace CometChatNotifications;
12
13
 
13
14
  export class CometChat {
14
15
  static GroupType: typeof GroupType;
@@ -1967,6 +1968,78 @@ export class CometChat {
1967
1968
  static markAsInteracted(messageId: string | any, elementId: string): Promise<string>;
1968
1969
  }
1969
1970
 
1971
+ export class CometChatNotifications {
1972
+ static MessagesOptions: typeof MessagesOptions;
1973
+ static RepliesOptions: typeof RepliesOptions;
1974
+ static ReactionsOptions: typeof ReactionsOptions;
1975
+ static MemberActionsOptions: typeof MemberActionsOptions;
1976
+ static DayOfWeek: typeof DayOfWeek;
1977
+ static DNDOptions: typeof DNDOptions;
1978
+ static MutedConversationType: typeof MutedConversationType;
1979
+ static PushPlatforms: typeof PushPlatforms;
1980
+ static DaySchedule: typeof DaySchedule;
1981
+ static PushPreferences: typeof PushPreferences;
1982
+ static GroupPreferences: typeof GroupPreferences;
1983
+ static OneOnOnePreferences: typeof OneOnOnePreferences;
1984
+ static MutePreferences: typeof MutePreferences;
1985
+ static MutedConversation: typeof MutedConversation;
1986
+ static UnmutedConversation: typeof UnmutedConversation;
1987
+ /**
1988
+ * Function to get preferences set for the logged-in user.
1989
+ * @returns {Promise<PushPreferences>}
1990
+ * @memberof CometChatNotifications
1991
+ */
1992
+ static fetchPushPreferences(): Promise<PushPreferences>;
1993
+ /**
1994
+ * Function to update preferences for the logged-in user.
1995
+ * @param {PushPreferences} pushPreferences
1996
+ * @returns {Promise<PushPreferences>}
1997
+ * @memberof CometChatNotifications
1998
+ */
1999
+ static updatePushPreferences(pushPreferences: PushPreferences): Promise<PushPreferences>;
2000
+ /**
2001
+ * Function to reset preferences for the logged-in user.
2002
+ * @returns {Promise<PushPreferences>}
2003
+ * @memberof CometChatNotifications
2004
+ */
2005
+ static resetPushPreferences(): Promise<PushPreferences>;
2006
+ /**
2007
+ * Function to register push token for the current authToken of the logged-in user.
2008
+ * @returns {Promise<string>}
2009
+ * @param {string} pushToken
2010
+ * @param {PushPlatforms} platform
2011
+ * @param {string} providerId - Optional, default value is `default`.
2012
+ * @memberof CometChatNotifications
2013
+ */
2014
+ static registerPushToken(pushToken: string, platform: PushPlatforms, providerId?: string): Promise<string>;
2015
+ /**
2016
+ * Function to unregister push token registered for the current authToken of the logged-in user.
2017
+ * @returns {Promise<string>}
2018
+ * @memberof CometChatNotifications
2019
+ */
2020
+ static unregisterPushToken(): Promise<string>;
2021
+ /**
2022
+ * Function to mute conversations for the logged-in user.
2023
+ * @returns {Promise<string>}
2024
+ * @param {MutedConversation[]} mutedConversations
2025
+ * @memberof CometChatNotifications
2026
+ */
2027
+ static muteConversations(mutedConversations: MutedConversation[]): Promise<string>;
2028
+ /**
2029
+ * Function to unmute conversations for the logged-in user.
2030
+ * @returns {Promise<string>}
2031
+ * @param {UnmutedConversation[]} unmutedConversations
2032
+ * @memberof CometChatNotifications
2033
+ */
2034
+ static unmuteConversations(unmutedConversations: UnmutedConversation[]): Promise<string>;
2035
+ /**
2036
+ * Function to retrieve list of muted conversations for the logged-in user.
2037
+ * @returns {Promise<MutedConversation[]>}
2038
+ * @memberof CometChatNotifications
2039
+ */
2040
+ static getMutedConversations(): Promise<MutedConversation[]>;
2041
+ }
2042
+
1970
2043
  /**
1971
2044
  *
1972
2045
  * @module CometChatException
@@ -6424,6 +6497,422 @@ export class Reaction {
6424
6497
  setReactedBy(reactedBy: User): void;
6425
6498
  }
6426
6499
 
6500
+ /** Push Notification Preferences Enums */
6501
+ export enum MessagesOptions {
6502
+ DONT_SUBSCRIBE,
6503
+ SUBSCRIBE_TO_ALL,
6504
+ SUBSCRIBE_TO_MENTIONS
6505
+ }
6506
+ export enum RepliesOptions {
6507
+ DONT_SUBSCRIBE,
6508
+ SUBSCRIBE_TO_ALL,
6509
+ SUBSCRIBE_TO_MENTIONS
6510
+ }
6511
+ export enum ReactionsOptions {
6512
+ DONT_SUBSCRIBE,
6513
+ SUBSCRIBE_TO_REACTIONS_ON_OWN_MESSAGES,
6514
+ SUBSCRIBE_TO_REACTIONS_ON_ALL_MESSAGES
6515
+ }
6516
+ export enum MemberActionsOptions {
6517
+ DONT_SUBSCRIBE,
6518
+ SUBSCRIBE
6519
+ }
6520
+ export enum DNDOptions {
6521
+ DISABLED,
6522
+ ENABLED
6523
+ }
6524
+ export enum DayOfWeek {
6525
+ MONDAY = "monday",
6526
+ TUESDAY = "tuesday",
6527
+ WEDNESDAY = "wednesday",
6528
+ THURSDAY = "thursday",
6529
+ FRIDAY = "friday",
6530
+ SATURDAY = "saturday",
6531
+ SUNDAY = "sunday"
6532
+ }
6533
+ export enum MutedConversationType {
6534
+ ONE_ON_ONE = "oneOnOne",
6535
+ GROUP = "group"
6536
+ }
6537
+ export enum PushPlatforms {
6538
+ FCM_WEB = "fcm_web"
6539
+ }
6540
+ export const APIConstants: {
6541
+ KEY_GROUP_PREFERENCES: string;
6542
+ KEY_GROUP_MESSAGES: string;
6543
+ KEY_GROUP_REACTIONS: string;
6544
+ KEY_GROUP_REPLIES: string;
6545
+ KEY_GROUP_MEMBER_ADDED: string;
6546
+ KEY_GROUP_MEMBER_LEFT: string;
6547
+ KEY_GROUP_MEMBER_JOINED: string;
6548
+ KEY_GROUP_MEMBER_KICKED: string;
6549
+ KEY_GROUP_MEMBER_BANNED: string;
6550
+ KEY_GROUP_MEMBER_UNBANNED: string;
6551
+ KEY_GROUP_MEMBER_SCOPE_CHANGED: string;
6552
+ KEY_MUTE_PREFERENCES: string;
6553
+ KEY_MUTE_DND: string;
6554
+ KEY_MUTE_SCHEDULE: string;
6555
+ KEY_ONE_ON_ONE_PREFERENCES: string;
6556
+ KEY_ONE_ON_ONE_MESSAGES: string;
6557
+ KEY_ONE_ON_ONE_REACTIONS: string;
6558
+ KEY_ONE_ON_ONE_REPLIES: string;
6559
+ KEY_USE_PRIVACY_TEMPLATE: string;
6560
+ KEY_PROVIDER_ID: string;
6561
+ KEY_TIMEZONE: string;
6562
+ KEY_PLATFORM: string;
6563
+ KEY_FCM_TOKEN: string;
6564
+ KEY_CONVERSATIONS: string;
6565
+ KEY_GET_PREFERENCES: string;
6566
+ KEY_UPDATE_PREFERENCES: string;
6567
+ KEY_RESET_PREFERENCES: string;
6568
+ KEY_REGISTER_TOKEN: string;
6569
+ KEY_UNREGISTER_TOKEN: string;
6570
+ KEY_MUTE_CONVERSATIONS: string;
6571
+ KEY_UNMUTE_CONVERSATIONS: string;
6572
+ KEY_GET_MUTED_CONVERSATIONS: string;
6573
+ KEY_MUTED_CONVERSATIONS: string;
6574
+ KEY_FROM: string;
6575
+ KEY_TO: string;
6576
+ };
6577
+ export const APIResponseConstants: {
6578
+ TOKEN_REGISTER_SUCCESS: string;
6579
+ TOKEN_REGISTER_ERROR: string;
6580
+ TOKEN_UNREGISTER_SUCCESS: string;
6581
+ TOKEN_UNREGISTER_ERROR: string;
6582
+ MUTE_CONVERSATION_SUCCESS: string;
6583
+ MUTE_CONVERSATION_ERROR: string;
6584
+ UNMUTE_CONVERSATION_SUCCESS: string;
6585
+ UNMUTE_CONVERSATION_ERROR: string;
6586
+ };
6587
+ export const DEFAULT_PROVIDER_ID = "default";
6588
+
6589
+ export class DaySchedule {
6590
+ constructor(from: number, to: number, dnd: boolean);
6591
+ /**
6592
+ * Get the from value of Day Schedule.
6593
+ * @returns {number}
6594
+ */
6595
+ getFrom(): number;
6596
+ /**
6597
+ * @param {number} from
6598
+ * Set the from value of Day Schedule.
6599
+ */
6600
+ setFrom(from: number): void;
6601
+ /**
6602
+ * Get the to value of Day Schedule.
6603
+ * @returns {number}
6604
+ */
6605
+ getTo(): number;
6606
+ /**
6607
+ * @param {number} to
6608
+ * Set the to value of Day Schedule.
6609
+ */
6610
+ setTo(to: number): void;
6611
+ /**
6612
+ * Get the value of DND of Day Schedule.
6613
+ * @returns {boolean}
6614
+ */
6615
+ getDND(): boolean;
6616
+ /**
6617
+ * @param {boolean} dnd
6618
+ * Set the value of DND of Day Schedule.
6619
+ */
6620
+ setDND(dnd: boolean): void;
6621
+ }
6622
+
6623
+ /**
6624
+ *
6625
+ * @module GroupPreferences
6626
+ */
6627
+ export class GroupPreferences {
6628
+ /**
6629
+ * Get the messages preferences for groups.
6630
+ * @returns {MessagesOptions}
6631
+ */
6632
+ getMessagesPreference(): MessagesOptions;
6633
+ /**
6634
+ * Get the replies preferences for groups.
6635
+ * @returns {RepliesOptions}
6636
+ */
6637
+ getRepliesPreference(): RepliesOptions;
6638
+ /**
6639
+ * Get the reactions preferences for groups.
6640
+ * @returns {ReactionsOptions}
6641
+ */
6642
+ getReactionsPreference(): ReactionsOptions;
6643
+ /**
6644
+ * Get the member left preferences for groups.
6645
+ * @returns {MemberActionsOptions}
6646
+ */
6647
+ getMemberLeftPreference(): MemberActionsOptions;
6648
+ /**
6649
+ * Get the member added preferences for groups.
6650
+ * @returns {MemberActionsOptions}
6651
+ */
6652
+ getMemberAddedPreference(): MemberActionsOptions;
6653
+ /**
6654
+ * Get the member joined preferences for groups.
6655
+ * @returns {MemberActionsOptions}
6656
+ */
6657
+ getMemberJoinedPreference(): MemberActionsOptions;
6658
+ /**
6659
+ * Get the member kicked preferences for groups.
6660
+ * @returns {MemberActionsOptions}
6661
+ */
6662
+ getMemberKickedPreference(): MemberActionsOptions;
6663
+ /**
6664
+ * Get the member banned preferences for groups.
6665
+ * @returns {MemberActionsOptions}
6666
+ */
6667
+ getMemberBannedPreference(): MemberActionsOptions;
6668
+ /**
6669
+ * Get the member unbanned preferences for groups.
6670
+ * @returns {MemberActionsOptions}
6671
+ */
6672
+ getMemberUnbannedPreference(): MemberActionsOptions;
6673
+ /**
6674
+ * Get the member scope change preferences for groups.
6675
+ * @returns {MemberActionsOptions}
6676
+ */
6677
+ getMemberScopeChangedPreference(): MemberActionsOptions;
6678
+ /**
6679
+ * @param {MessagesOptions} messagesPreference
6680
+ * Set messages preference for groups.
6681
+ */
6682
+ setMessagesPreference(messagesPreference: MessagesOptions): void;
6683
+ /**
6684
+ * @param {RepliesOptions} repliesPreference
6685
+ * Set replies preference for groups.
6686
+ */
6687
+ setRepliesPreference(repliesPreference: RepliesOptions): void;
6688
+ /**
6689
+ * @param {ReactionsOptions} reactionsPreference
6690
+ * Set reactions preference for groups.
6691
+ */
6692
+ setReactionsPreference(reactionsPreference: ReactionsOptions): void;
6693
+ /**
6694
+ * @param {MemberActionsOptions} memberLeftPreference
6695
+ * Set member left preference for groups.
6696
+ */
6697
+ setMemberLeftPreference(memberLeftPreference: MemberActionsOptions): void;
6698
+ /**
6699
+ * @param {MemberActionsOptions} memberAddedPreference
6700
+ * Set member added preference for groups.
6701
+ */
6702
+ setMemberAddedPreference(memberAddedPreference: MemberActionsOptions): void;
6703
+ /**
6704
+ * @param {MemberActionsOptions} memberJoinedPreference
6705
+ * Set member joined preference for groups.
6706
+ */
6707
+ setMemberJoinedPreference(memberJoinedPreference: MemberActionsOptions): void;
6708
+ /**
6709
+ * @param {MemberActionsOptions} memberKickedPreference
6710
+ * Set member kicked preference for groups.
6711
+ */
6712
+ setMemberKickedPreference(memberKickedPreference: MemberActionsOptions): void;
6713
+ /**
6714
+ * @param {MemberActionsOptions} memberBannedPreference
6715
+ * Set member banned preference for groups.
6716
+ */
6717
+ setMemberBannedPreference(memberBannedPreference: MemberActionsOptions): void;
6718
+ /**
6719
+ * @param {MemberActionsOptions} memberUnbannedPreference
6720
+ * Set member unbanned preference for groups.
6721
+ */
6722
+ setMemberUnbannedPreference(memberUnbannedPreference: MemberActionsOptions): void;
6723
+ /**
6724
+ * @param {MemberActionsOptions} memberScopeChangedPreference
6725
+ * Set member scope change preference for groups.
6726
+ */
6727
+ setMemberScopeChangedPreference(memberScopeChangedPreference: MemberActionsOptions): void;
6728
+ /**
6729
+ * @param {Object} jsonData
6730
+ * Convert JSON object to GroupPreferences.
6731
+ */
6732
+ static fromJSON(jsonData: Object): GroupPreferences;
6733
+ }
6734
+
6735
+ export class MutedConversation {
6736
+ /**
6737
+ * Get the id of muted conversation
6738
+ * @returns {string}
6739
+ */
6740
+ getId(): string;
6741
+ /**
6742
+ * Set the id of muted conversation
6743
+ * @param {string} id
6744
+ */
6745
+ setId(id: string): void;
6746
+ /**
6747
+ * Get the conversation type of muted conversation.
6748
+ * @returns {MutedConversationType}
6749
+ */
6750
+ getType(): MutedConversationType;
6751
+ /**
6752
+ * Set the conversation type of muted conversation.
6753
+ * @param {MutedConversationType} type
6754
+ */
6755
+ setType(type: MutedConversationType): void;
6756
+ /**
6757
+ * Get the date until which the conversation should be muted.
6758
+ * @returns {number}
6759
+ */
6760
+ getUntil(): number;
6761
+ /**
6762
+ * Set the date until which the conversation should be muted.
6763
+ * @param {number} until
6764
+ */
6765
+ setUntil(until: number): void;
6766
+ }
6767
+
6768
+ export class MutePreferences {
6769
+ /**
6770
+ * Get the DND preferences.
6771
+ * @returns {DNDOptions}
6772
+ */
6773
+ getDNDPreference(): DNDOptions;
6774
+ /**
6775
+ * @param {DNDOptions} dndPreferences
6776
+ * Set DND preferences.
6777
+ */
6778
+ setDNDPreference(dndPreferences: DNDOptions): void;
6779
+ /**
6780
+ * Get the schedule preferences.
6781
+ * @returns {Map<DayOfWeek, DaySchedule>}
6782
+ */
6783
+ getSchedulePreference(): Map<DayOfWeek, DaySchedule>;
6784
+ /**
6785
+ * @param {Map<DayOfWeek, DaySchedule>} schedule
6786
+ * Set the schedule preferences.
6787
+ */
6788
+ setSchedulePreference(schedule: Map<DayOfWeek, DaySchedule>): void;
6789
+ /**
6790
+ * Get the schedule for a day.
6791
+ * @returns {DaySchedule}
6792
+ */
6793
+ getScheduleFor(day: DayOfWeek): DaySchedule;
6794
+ /**
6795
+ * @param {DayOfWeek} day
6796
+ * @param {DaySchedule} schedule
6797
+ * Set the schedule for a day.
6798
+ */
6799
+ setScheduleFor(day: DayOfWeek, schedule: DaySchedule): void;
6800
+ /**
6801
+ * @param {Object} jsonData
6802
+ * Convert JSON object to MutePreferences.
6803
+ */
6804
+ static fromJSON(jsonData: Object): MutePreferences;
6805
+ }
6806
+
6807
+ export class OneOnOnePreferences {
6808
+ /**
6809
+ * Get the reactions preferences for groups.
6810
+ * @returns {ReactionsOptions}
6811
+ */
6812
+ getReactionsPreference(): ReactionsOptions;
6813
+ /**
6814
+ * @param {ReactionsOptions} reactionsPreference
6815
+ * Set reactions preference for groups.
6816
+ */
6817
+ setReactionsPreference(reactionsPreference: ReactionsOptions): void;
6818
+ /**
6819
+ * Get the replies preferences for groups.
6820
+ * @returns {RepliesOptions}
6821
+ */
6822
+ getRepliesPreference(): RepliesOptions;
6823
+ /**
6824
+ * @param {RepliesOptions} repliesPreference
6825
+ * Set replies preference for groups.
6826
+ */
6827
+ setRepliesPreference(repliesPreference: RepliesOptions): void;
6828
+ /**
6829
+ * Get the messages preferences for groups.
6830
+ * @returns {MessagesOptions}
6831
+ */
6832
+ getMessagesPreference(): MessagesOptions;
6833
+ /**
6834
+ * @param {MessagesOptions} messagesPreference
6835
+ * Set messages preference for groups.
6836
+ */
6837
+ setMessagesPreference(messagesPreference: MessagesOptions): void;
6838
+ /**
6839
+ * @param {Object} jsonData
6840
+ * Convert JSON object to OneOnOnePreferences.
6841
+ */
6842
+ static fromJSON(jsonData: Object): OneOnOnePreferences;
6843
+ }
6844
+
6845
+ export class PushPreferences {
6846
+ /**
6847
+ * Get the OneOnOne preferences.
6848
+ * @returns {OneOnOnePreferences}
6849
+ */
6850
+ getOneOnOnePreferences(): OneOnOnePreferences;
6851
+ /**
6852
+ * @param {OneOnOnePreferences} oneOnOnePreferences
6853
+ * Set the OneOnOne preferences.
6854
+ */
6855
+ setOneOnOnePreferences(oneOnOnePreferences: OneOnOnePreferences): void;
6856
+ /**
6857
+ * Get the Muted preferences.
6858
+ * @returns {MutePreferences}
6859
+ */
6860
+ getMutePreferences(): MutePreferences;
6861
+ /**
6862
+ * @param {MutePreferences} mutePreferences
6863
+ * Set the Mute preferences.
6864
+ */
6865
+ setMutePreferences(mutePreferences: MutePreferences): void;
6866
+ /**
6867
+ * Get the Group preferences.
6868
+ * @returns {GroupPreferences}
6869
+ */
6870
+ getGroupPreferences(): GroupPreferences;
6871
+ /**
6872
+ * @param {GroupPreferences} groupPreferences
6873
+ * Set the Group preferences.
6874
+ */
6875
+ setGroupPreferences(groupPreferences: GroupPreferences): void;
6876
+ /**
6877
+ * Returns whether to use privacy template or not.
6878
+ * @returns {boolean}
6879
+ */
6880
+ getUsePrivacyTemplate(): boolean;
6881
+ /**
6882
+ * @param {boolean} usePrivacyTemplate
6883
+ * Set whether to use privacy template or not.
6884
+ */
6885
+ setUsePrivacyTemplate(usePrivacyTemplate: boolean): void;
6886
+ /**
6887
+ * @param {Object} jsonData
6888
+ * Convert JSON object to PushPreferences.
6889
+ */
6890
+ static fromJSON(jsonData: Object): PushPreferences;
6891
+ }
6892
+
6893
+ export class UnmutedConversation {
6894
+ /**
6895
+ * Get the id of unmuted conversation
6896
+ * @returns {string}
6897
+ */
6898
+ getId(): string;
6899
+ /**
6900
+ * Set the id of unmuted conversation
6901
+ * @param {string} id
6902
+ */
6903
+ setId(id: string): void;
6904
+ /**
6905
+ * Get the conversation type of unmuted conversation.
6906
+ * @returns {MutedConversationType}
6907
+ */
6908
+ getType(): MutedConversationType;
6909
+ /**
6910
+ * Set the conversation type of unmuted conversation.
6911
+ * @param {MutedConversationType} type
6912
+ */
6913
+ setType(type: MutedConversationType): void;
6914
+ }
6915
+
6427
6916
  /**
6428
6917
  *
6429
6918
  *