@trycourier/courier-ui-inbox 1.0.4-beta → 1.0.6-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.
@@ -22,12 +22,30 @@ export declare class CourierInboxDatastore {
22
22
  feedType: CourierInboxFeedType;
23
23
  canUseCache: boolean;
24
24
  }): Promise<void>;
25
+ /** Listen for inbox and archive dataset updates. */
26
+ listenForUpdates(): Promise<void>;
27
+ /** Fetch either/both datasets if they aren't already loaded. */
28
+ private ensureDataSetsLoaded;
25
29
  private connectSocket;
30
+ /**
31
+ * Get a message by messageId from the inbox or archive data set
32
+ * @param props - The message ID
33
+ * @returns The message or undefined if it is not found
34
+ */
26
35
  private getMessage;
36
+ /**
37
+ * Fetch the next page of messages
38
+ * @param props - The feed type
39
+ * @returns The next page of messages or null if there is no next page
40
+ */
27
41
  fetchNextPageOfMessages(props: {
28
42
  feedType: CourierInboxFeedType;
29
43
  }): Promise<InboxDataSet | null>;
30
- private applyLocalMessageChange;
44
+ /**
45
+ * Check if the datastore is loaded and ready to perform mutations
46
+ * @returns True if the datastore is loaded and ready to perform mutations, false otherwise
47
+ */
48
+ private canMutate;
31
49
  readMessage({ message, canCallApi }: {
32
50
  message: InboxMessage;
33
51
  canCallApi?: boolean;
@@ -48,15 +66,52 @@ export declare class CourierInboxDatastore {
48
66
  message: InboxMessage;
49
67
  canCallApi?: boolean;
50
68
  }): Promise<void>;
69
+ unarchiveMessage({ message, canCallApi }: {
70
+ message: InboxMessage;
71
+ canCallApi?: boolean;
72
+ }): Promise<void>;
51
73
  archiveReadMessages({ canCallApi }?: {
52
74
  canCallApi?: boolean;
53
75
  }): Promise<void>;
76
+ archiveAllMessages({ canCallApi }?: {
77
+ canCallApi?: boolean;
78
+ }): Promise<void>;
54
79
  readAllMessages({ canCallApi }?: {
55
80
  canCallApi?: boolean;
56
81
  }): Promise<void>;
82
+ /**
83
+ * Find the insert index for a new message in a data set
84
+ * @param newMessage - The new message to insert
85
+ * @param dataSet - The data set to insert the message into
86
+ * @returns The index to insert the message at
87
+ */
57
88
  private findInsertIndex;
58
89
  private addPage;
59
90
  private addMessage;
60
91
  private removeMessage;
92
+ /**
93
+ * Apply a message snapshot to the data store
94
+ * @param snapshot - The message snapshot to apply
95
+ */
96
+ private applyMessageSnapshot;
97
+ private applyDatastoreSnapshot;
98
+ /**
99
+ * Update a message in the data store
100
+ * @param message - The message to update
101
+ * @param index - The index of the message
102
+ * @param feedType - The feed type of the message
103
+ */
61
104
  private updateMessage;
105
+ /**
106
+ * Copy an inbox data set
107
+ * @param dataSet - The inbox data set to copy
108
+ * @returns A copy of the inbox data set
109
+ */
110
+ private getDatastoreSnapshot;
111
+ /**
112
+ * Copy an inbox message with its archive and inbox indices
113
+ * @param message - The inbox message to copy
114
+ * @returns A copy of the inbox message with its archive and inbox indices
115
+ */
116
+ private getMessageSnapshot;
62
117
  }