@trycourier/courier-ui-inbox 1.2.3 → 2.0.0
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/dist/components/courier-inbox-feed-button.d.ts +28 -0
- package/dist/components/courier-inbox-header.d.ts +28 -11
- package/dist/components/courier-inbox-list-item.d.ts +4 -4
- package/dist/components/courier-inbox-list.d.ts +9 -4
- package/dist/components/courier-inbox-option-menu-item.d.ts +3 -0
- package/dist/components/courier-inbox-option-menu.d.ts +19 -12
- package/dist/components/courier-inbox-popup-menu.d.ts +57 -10
- package/dist/components/courier-inbox-tabs.d.ts +33 -0
- package/dist/components/courier-inbox.d.ts +121 -9
- package/dist/components/courier-unread-count-badge.d.ts +10 -5
- package/dist/datastore/__tests__/inbox-datastore.test.d.ts +1 -0
- package/dist/datastore/datatore-events.d.ts +61 -8
- package/dist/datastore/inbox-dataset.d.ts +110 -0
- package/dist/datastore/inbox-datastore.d.ts +217 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3225 -1501
- package/dist/index.mjs.map +1 -1
- package/dist/types/courier-inbox-theme.d.ts +64 -20
- package/dist/types/factories.d.ts +21 -8
- package/dist/types/inbox-data-set.d.ts +111 -2
- package/dist/types/inbox-defaults.d.ts +39 -0
- package/dist/types/snapshots.d.ts +6 -0
- package/dist/utils/utils.d.ts +7 -0
- package/package.json +3 -3
- package/dist/components/courier-inbox-header-title.d.ts +0 -23
- package/dist/datastore/datastore.d.ts +0 -114
- package/dist/types/feed-type.d.ts +0 -1
- /package/dist/datastore/__tests__/{datastore.test.d.ts → inbox-dataset.test.d.ts} +0 -0
|
@@ -3,10 +3,6 @@ export type CourierInboxFontTheme = CourierFontTheme;
|
|
|
3
3
|
export type CourierInboxIconTheme = CourierIconTheme;
|
|
4
4
|
export type CourierInboxButtonTheme = CourierButtonTheme;
|
|
5
5
|
export type CourierInboxIconButtonTheme = CourierIconButtonTheme;
|
|
6
|
-
export type CourierInboxFilterItemTheme = {
|
|
7
|
-
icon?: CourierInboxIconTheme;
|
|
8
|
-
text?: string;
|
|
9
|
-
};
|
|
10
6
|
export type CourierInboxUnreadDotIndicatorTheme = {
|
|
11
7
|
backgroundColor?: string;
|
|
12
8
|
borderRadius?: string;
|
|
@@ -22,14 +18,20 @@ export type CourierInboxUnreadCountIndicatorTheme = {
|
|
|
22
18
|
export type CourierInboxMenuButtonTheme = CourierInboxIconButtonTheme & {
|
|
23
19
|
unreadDotIndicator?: CourierInboxUnreadDotIndicatorTheme;
|
|
24
20
|
};
|
|
21
|
+
export type CourierInboxAnimationTheme = {
|
|
22
|
+
transition?: string;
|
|
23
|
+
initialTransform?: string;
|
|
24
|
+
visibleTransform?: string;
|
|
25
|
+
};
|
|
25
26
|
export type CourierInboxPopupTheme = {
|
|
26
27
|
backgroundColor?: string;
|
|
27
28
|
border?: string;
|
|
28
29
|
borderRadius?: string;
|
|
29
30
|
shadow?: string;
|
|
31
|
+
animation?: CourierInboxAnimationTheme;
|
|
30
32
|
list?: {
|
|
31
33
|
font?: CourierInboxFontTheme;
|
|
32
|
-
|
|
34
|
+
selectedIcon?: CourierInboxIconTheme;
|
|
33
35
|
hoverBackgroundColor?: string;
|
|
34
36
|
activeBackgroundColor?: string;
|
|
35
37
|
divider?: string;
|
|
@@ -40,6 +42,7 @@ export type CourierInboxListItemTheme = {
|
|
|
40
42
|
backgroundColor?: string;
|
|
41
43
|
hoverBackgroundColor?: string;
|
|
42
44
|
activeBackgroundColor?: string;
|
|
45
|
+
transition?: string;
|
|
43
46
|
title?: CourierInboxFontTheme;
|
|
44
47
|
subtitle?: CourierInboxFontTheme;
|
|
45
48
|
time?: CourierInboxFontTheme;
|
|
@@ -60,6 +63,7 @@ export type CourierInboxListItemTheme = {
|
|
|
60
63
|
border?: string;
|
|
61
64
|
borderRadius?: string;
|
|
62
65
|
shadow?: string;
|
|
66
|
+
animation?: CourierInboxAnimationTheme;
|
|
63
67
|
longPress?: {
|
|
64
68
|
displayDuration?: number;
|
|
65
69
|
vibrationDuration?: number;
|
|
@@ -95,16 +99,49 @@ export type CourierMenuItemTheme = {
|
|
|
95
99
|
icon?: CourierInboxIconTheme;
|
|
96
100
|
text?: string;
|
|
97
101
|
};
|
|
98
|
-
export type CourierFilterMenuTheme = {
|
|
99
|
-
button?: CourierInboxIconButtonTheme;
|
|
100
|
-
inbox?: CourierMenuItemTheme;
|
|
101
|
-
archive?: CourierMenuItemTheme;
|
|
102
|
-
};
|
|
103
102
|
export type CourierActionMenuTheme = {
|
|
104
103
|
button?: CourierInboxIconButtonTheme;
|
|
105
104
|
markAllRead?: CourierMenuItemTheme;
|
|
106
105
|
archiveAll?: CourierMenuItemTheme;
|
|
107
106
|
archiveRead?: CourierMenuItemTheme;
|
|
107
|
+
animation?: CourierInboxAnimationTheme;
|
|
108
|
+
menu?: CourierInboxPopupTheme;
|
|
109
|
+
};
|
|
110
|
+
export type CourierInboxTabsBorderRadius = string | {
|
|
111
|
+
topLeft?: string;
|
|
112
|
+
topRight?: string;
|
|
113
|
+
bottomLeft?: string;
|
|
114
|
+
bottomRight?: string;
|
|
115
|
+
};
|
|
116
|
+
export type CourierInboxListScrollbarTheme = {
|
|
117
|
+
trackBackgroundColor?: string;
|
|
118
|
+
thumbColor?: string;
|
|
119
|
+
thumbHoverColor?: string;
|
|
120
|
+
width?: string;
|
|
121
|
+
height?: string;
|
|
122
|
+
borderRadius?: string;
|
|
123
|
+
};
|
|
124
|
+
export type CourierInboxTabsTheme = {
|
|
125
|
+
borderRadius?: CourierInboxTabsBorderRadius;
|
|
126
|
+
transition?: string;
|
|
127
|
+
default?: {
|
|
128
|
+
backgroundColor?: string;
|
|
129
|
+
hoverBackgroundColor?: string;
|
|
130
|
+
activeBackgroundColor?: string;
|
|
131
|
+
font?: CourierInboxFontTheme;
|
|
132
|
+
indicatorColor?: string;
|
|
133
|
+
indicatorHeight?: string;
|
|
134
|
+
unreadIndicator?: CourierInboxUnreadCountIndicatorTheme;
|
|
135
|
+
};
|
|
136
|
+
selected?: {
|
|
137
|
+
backgroundColor?: string;
|
|
138
|
+
hoverBackgroundColor?: string;
|
|
139
|
+
activeBackgroundColor?: string;
|
|
140
|
+
font?: CourierInboxFontTheme;
|
|
141
|
+
indicatorColor?: string;
|
|
142
|
+
indicatorHeight?: string;
|
|
143
|
+
unreadIndicator?: CourierInboxUnreadCountIndicatorTheme;
|
|
144
|
+
};
|
|
108
145
|
};
|
|
109
146
|
export type CourierInboxTheme = {
|
|
110
147
|
popup?: {
|
|
@@ -114,26 +151,33 @@ export type CourierInboxTheme = {
|
|
|
114
151
|
borderRadius?: string;
|
|
115
152
|
border?: string;
|
|
116
153
|
shadow?: string;
|
|
154
|
+
animation?: CourierInboxAnimationTheme;
|
|
117
155
|
};
|
|
118
156
|
};
|
|
119
157
|
inbox?: {
|
|
120
158
|
header?: {
|
|
121
159
|
backgroundColor?: string;
|
|
122
160
|
shadow?: string;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
161
|
+
border?: string;
|
|
162
|
+
feeds?: {
|
|
163
|
+
button?: {
|
|
164
|
+
selectedFeedIconColor?: string;
|
|
165
|
+
font?: CourierInboxFontTheme;
|
|
166
|
+
changeFeedIcon?: CourierIconTheme;
|
|
167
|
+
unreadCountIndicator?: CourierInboxUnreadCountIndicatorTheme;
|
|
168
|
+
hoverBackgroundColor?: string;
|
|
169
|
+
activeBackgroundColor?: string;
|
|
170
|
+
transition?: string;
|
|
171
|
+
};
|
|
172
|
+
menu?: CourierInboxPopupTheme;
|
|
173
|
+
tabs?: CourierInboxTabsTheme;
|
|
133
174
|
};
|
|
175
|
+
tabs?: CourierInboxTabsTheme;
|
|
176
|
+
actions?: CourierActionMenuTheme;
|
|
134
177
|
};
|
|
135
178
|
list?: {
|
|
136
179
|
backgroundColor?: string;
|
|
180
|
+
scrollbar?: CourierInboxListScrollbarTheme;
|
|
137
181
|
item?: CourierInboxListItemTheme;
|
|
138
182
|
};
|
|
139
183
|
loading?: CourierInboxSkeletonLoadingStateTheme;
|
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
import { InboxAction, InboxMessage } from '@trycourier/courier-js';
|
|
2
|
-
import {
|
|
2
|
+
import { CourierInboxDatasetFilter } from './inbox-data-set';
|
|
3
3
|
export type CourierInboxHeaderFactoryProps = {
|
|
4
|
-
|
|
4
|
+
feeds: CourierInboxHeaderFeed[];
|
|
5
|
+
};
|
|
6
|
+
export type CourierInboxHeaderFeed = {
|
|
7
|
+
feedId: string;
|
|
8
|
+
title: string;
|
|
9
|
+
iconSVG?: string;
|
|
10
|
+
tabs: CourierInboxHeaderFeedTab[];
|
|
11
|
+
isSelected: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type CourierInboxHeaderFeedTab = {
|
|
14
|
+
datasetId: string;
|
|
15
|
+
title: string;
|
|
5
16
|
unreadCount: number;
|
|
6
|
-
|
|
17
|
+
isSelected: boolean;
|
|
18
|
+
filter: CourierInboxDatasetFilter;
|
|
7
19
|
};
|
|
8
20
|
export type CourierInboxStateLoadingFactoryProps = {
|
|
9
|
-
|
|
21
|
+
datasetId: string;
|
|
10
22
|
};
|
|
11
23
|
export type CourierInboxStateEmptyFactoryProps = {
|
|
12
|
-
|
|
24
|
+
datasetId: string;
|
|
13
25
|
};
|
|
14
26
|
export type CourierInboxStateErrorFactoryProps = {
|
|
15
|
-
|
|
27
|
+
datasetId: string;
|
|
16
28
|
error: Error;
|
|
17
29
|
};
|
|
18
30
|
export type CourierInboxListItemFactoryProps = {
|
|
@@ -25,8 +37,9 @@ export type CourierInboxListItemActionFactoryProps = {
|
|
|
25
37
|
index: number;
|
|
26
38
|
};
|
|
27
39
|
export type CourierInboxPaginationItemFactoryProps = {
|
|
28
|
-
|
|
40
|
+
datasetId: string;
|
|
29
41
|
};
|
|
30
42
|
export type CourierInboxMenuButtonFactoryProps = {
|
|
31
|
-
|
|
43
|
+
totalUnreadCount: number;
|
|
44
|
+
feeds: CourierInboxHeaderFeed[];
|
|
32
45
|
};
|
|
@@ -1,8 +1,117 @@
|
|
|
1
1
|
import { InboxMessage } from '@trycourier/courier-js';
|
|
2
|
-
import { CourierInboxFeedType } from './feed-type';
|
|
3
2
|
export type InboxDataSet = {
|
|
4
|
-
|
|
3
|
+
id: string;
|
|
5
4
|
messages: InboxMessage[];
|
|
5
|
+
unreadCount: number;
|
|
6
6
|
canPaginate: boolean;
|
|
7
7
|
paginationCursor: string | null;
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* The set of message filters.
|
|
11
|
+
*
|
|
12
|
+
* Filters are AND'd together to produce a set of messages.
|
|
13
|
+
* For example, if the filter is `{ archived: true, status: 'read' }`
|
|
14
|
+
* the filter will produce messages that are archived AND read.
|
|
15
|
+
*/
|
|
16
|
+
export type CourierInboxDatasetFilter = {
|
|
17
|
+
/**
|
|
18
|
+
* The set of tags to match to a message's tags. If a message has any of the tags,
|
|
19
|
+
* the message will be included in the dataset.
|
|
20
|
+
*/
|
|
21
|
+
tags?: string[];
|
|
22
|
+
/** Whether to include archived messages. Defaults to false if unset. */
|
|
23
|
+
archived?: boolean;
|
|
24
|
+
status?: 'read' | 'unread';
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* A tab represents a filtered view of messages within a feed.
|
|
28
|
+
*
|
|
29
|
+
* Each tab corresponds to a dataset in the CourierInboxDatastore. When feeds are
|
|
30
|
+
* registered via `CourierInboxDatastore.registerFeeds()`, each tab's `datasetId`
|
|
31
|
+
* is used to create a dataset that applies the tab's filter to the message store.
|
|
32
|
+
* This dataset ID is then used throughout the system to:
|
|
33
|
+
* - Identify which dataset a tab displays
|
|
34
|
+
* - Match datastore events (message add/remove/update, unread count changes) to their corresponding tabs
|
|
35
|
+
* - Programmatically select tabs via `CourierInbox.selectTab()`
|
|
36
|
+
* - Fetch paginated messages for a specific tab
|
|
37
|
+
* - Update unread count badges on tabs
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* {
|
|
42
|
+
* datasetId: 'inbox', // Used to create and reference the dataset in the datastore and to select the tab
|
|
43
|
+
* title: 'Inbox', // Display name shown in the UI
|
|
44
|
+
* filter: {} // No filter = all unarchived messages
|
|
45
|
+
* }
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export type CourierInboxTab = {
|
|
49
|
+
/**
|
|
50
|
+
* The unique identifier that links this tab to its corresponding dataset in the datastore.
|
|
51
|
+
*
|
|
52
|
+
* This ID is used as the key when creating datasets from feeds, and must be unique
|
|
53
|
+
* across all tabs in all feeds. It's recommended to use a slug-ified version of the
|
|
54
|
+
* tab's title (e.g., `'my-tab'` for title `"My Tab"`).
|
|
55
|
+
*
|
|
56
|
+
* When a tab is selected, this ID is used to:
|
|
57
|
+
* - Load messages from the corresponding dataset via `CourierInboxDatastore.getDatasetById()`
|
|
58
|
+
* - Listen for datastore events specific to this dataset
|
|
59
|
+
* - Update the tab's unread count badge when the dataset's unread count changes
|
|
60
|
+
*/
|
|
61
|
+
datasetId: string;
|
|
62
|
+
/** The display name for this tab. */
|
|
63
|
+
title: string;
|
|
64
|
+
/** The message filters to apply to this tab. */
|
|
65
|
+
filter: CourierInboxDatasetFilter;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* A feed is a container that groups related tabs together in the inbox UI.
|
|
69
|
+
*
|
|
70
|
+
* Feeds provide a way to organize tabs into logical sections (e.g., "Inbox", "Archive", "Notifications").
|
|
71
|
+
* Each feed appears as a selectable option in the inbox header, and when selected, displays its
|
|
72
|
+
* associated tabs. When feeds are registered via `CourierInboxDatastore.registerFeeds()`, all tabs
|
|
73
|
+
* from all feeds are flattened and used to create datasets in the datastore. The feed itself doesn't
|
|
74
|
+
* create a dataset - only the tabs within it do.
|
|
75
|
+
*
|
|
76
|
+
* The `feedId` is used throughout the system to:
|
|
77
|
+
* - Programmatically select feeds via `CourierInbox.selectFeed()`
|
|
78
|
+
* - Track which feed is currently active in the inbox
|
|
79
|
+
* - Map feeds to their default (first) tab for navigation
|
|
80
|
+
* - Display feeds in the header UI with selection state
|
|
81
|
+
* - Validate that tabs belong to the current feed when selecting them
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* {
|
|
86
|
+
* feedId: 'inbox', // Used to select and identify this feed
|
|
87
|
+
* title: 'Inbox', // Display name shown in the header
|
|
88
|
+
* iconSVG: '<svg>...</svg>', // Optional icon for the feed button
|
|
89
|
+
* tabs: [
|
|
90
|
+
* { datasetId: 'inbox', title: 'Inbox', filter: {} },
|
|
91
|
+
* { datasetId: 'unread', title: 'Unread', filter: { status: 'unread' } }
|
|
92
|
+
* ]
|
|
93
|
+
* }
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export type CourierInboxFeed = {
|
|
97
|
+
/**
|
|
98
|
+
* The unique identifier for this feed, used to programmatically select and reference it.
|
|
99
|
+
*
|
|
100
|
+
* This ID must be unique among all feeds. It's used to:
|
|
101
|
+
* - Select feeds programmatically via `CourierInbox.selectFeed(feedId)`
|
|
102
|
+
* - Track the currently active feed in the inbox component
|
|
103
|
+
* - Map feeds to their default tabs for navigation
|
|
104
|
+
* - Display feeds in the header with proper selection state
|
|
105
|
+
* - Validate tab selections (ensuring tabs belong to the current feed)
|
|
106
|
+
*
|
|
107
|
+
* It's recommended to use a slug-ified version of the feed's title
|
|
108
|
+
* (e.g., `'my-inbox'` for title `"My Inbox"`).
|
|
109
|
+
*/
|
|
110
|
+
feedId: string;
|
|
111
|
+
/** The display name for this feed. */
|
|
112
|
+
title: string;
|
|
113
|
+
/** The icon for this feed as an SVG. */
|
|
114
|
+
iconSVG?: string;
|
|
115
|
+
/** The tabs that make up this feed. */
|
|
116
|
+
tabs: CourierInboxTab[];
|
|
117
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { CourierInboxFeed } from './inbox-data-set';
|
|
2
|
+
/**
|
|
3
|
+
* Header action ID types.
|
|
4
|
+
*/
|
|
5
|
+
export type CourierInboxHeaderActionId = 'readAll' | 'archiveRead' | 'archiveAll';
|
|
6
|
+
/**
|
|
7
|
+
* List item action ID types.
|
|
8
|
+
*/
|
|
9
|
+
export type CourierInboxListItemActionId = 'read_unread' | 'archive_unarchive';
|
|
10
|
+
/**
|
|
11
|
+
* Configuration for a header action.
|
|
12
|
+
*/
|
|
13
|
+
export type CourierInboxHeaderAction = {
|
|
14
|
+
id: CourierInboxHeaderActionId;
|
|
15
|
+
iconSVG?: string;
|
|
16
|
+
text?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Configuration for a list item action.
|
|
20
|
+
*/
|
|
21
|
+
export type CourierInboxListItemAction = {
|
|
22
|
+
id: CourierInboxListItemActionId;
|
|
23
|
+
readIconSVG?: string;
|
|
24
|
+
unreadIconSVG?: string;
|
|
25
|
+
archiveIconSVG?: string;
|
|
26
|
+
unarchiveIconSVG?: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Returns the default feeds for the inbox.
|
|
30
|
+
*/
|
|
31
|
+
export declare function defaultFeeds(): CourierInboxFeed[];
|
|
32
|
+
/**
|
|
33
|
+
* Returns the default header actions.
|
|
34
|
+
*/
|
|
35
|
+
export declare function defaultActions(): CourierInboxHeaderAction[];
|
|
36
|
+
/**
|
|
37
|
+
* Returns the default list item actions.
|
|
38
|
+
*/
|
|
39
|
+
export declare function defaultListItemActions(): CourierInboxListItemAction[];
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { InboxMessage } from '@trycourier/courier-js';
|
|
2
2
|
import { InboxDataSet } from './inbox-data-set';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated - this type has been superceded by the snapshot interface in inbox-datastore.ts
|
|
5
|
+
*/
|
|
3
6
|
export type MessageSnapshot = {
|
|
4
7
|
message: InboxMessage;
|
|
5
8
|
archiveIndex?: number;
|
|
6
9
|
inboxIndex?: number;
|
|
7
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated - this type has been superceded by the snapshot interface in inbox-datastore.ts
|
|
13
|
+
*/
|
|
8
14
|
export type DataSetSnapshot = {
|
|
9
15
|
unreadCount: number;
|
|
10
16
|
inbox?: InboxDataSet;
|
package/dist/utils/utils.d.ts
CHANGED
|
@@ -18,4 +18,11 @@ export declare function copyInboxAction(action: InboxAction): InboxAction;
|
|
|
18
18
|
* @returns A copy of the inbox data set
|
|
19
19
|
*/
|
|
20
20
|
export declare function copyInboxDataSet(dataSet?: InboxDataSet): InboxDataSet | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Compare the mutable fields of two InboxMessages.
|
|
23
|
+
* @param message1 - The first inbox message to compare
|
|
24
|
+
* @param message2 - The second inbox message to compare
|
|
25
|
+
* @returns True if the mutable fields are equal, false otherwise
|
|
26
|
+
*/
|
|
27
|
+
export declare function mutableInboxMessageFieldsEqual(message1: InboxMessage, message2: InboxMessage): boolean;
|
|
21
28
|
export declare function getMessageTime(message: InboxMessage): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trycourier/courier-ui-inbox",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Inbox components for the Courier web UI",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"dist"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@trycourier/courier-js": "
|
|
35
|
-
"@trycourier/courier-ui-core": "
|
|
34
|
+
"@trycourier/courier-js": "3.0.0",
|
|
35
|
+
"@trycourier/courier-ui-core": "2.0.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/jest": "29.5.14",
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { CourierBaseElement } from '@trycourier/courier-ui-core';
|
|
2
|
-
import { CourierInboxMenuOption } from './courier-inbox-option-menu';
|
|
3
|
-
import { CourierInboxFeedType } from '../types/feed-type';
|
|
4
|
-
import { CourierInboxThemeManager } from '../types/courier-inbox-theme-manager';
|
|
5
|
-
import { CourierInboxTheme } from '../types/courier-inbox-theme';
|
|
6
|
-
export declare class CourierInboxHeaderTitle extends CourierBaseElement {
|
|
7
|
-
static get id(): string;
|
|
8
|
-
private _themeSubscription;
|
|
9
|
-
private _option;
|
|
10
|
-
private _feedType?;
|
|
11
|
-
private _style?;
|
|
12
|
-
private _titleElement?;
|
|
13
|
-
private _iconElement?;
|
|
14
|
-
private _unreadBadge?;
|
|
15
|
-
private get theme();
|
|
16
|
-
constructor(themeManager: CourierInboxThemeManager, option: CourierInboxMenuOption);
|
|
17
|
-
static getStyles(theme: CourierInboxTheme): string;
|
|
18
|
-
onComponentMounted(): void;
|
|
19
|
-
onComponentUnmounted(): void;
|
|
20
|
-
private refreshTheme;
|
|
21
|
-
updateSelectedOption(option: CourierInboxMenuOption, feedType: CourierInboxFeedType, unreadCount: number): void;
|
|
22
|
-
private updateFilter;
|
|
23
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { InboxMessage } from '@trycourier/courier-js';
|
|
2
|
-
import { InboxDataSet } from '../types/inbox-data-set';
|
|
3
|
-
import { CourierInboxDataStoreListener } from './datastore-listener';
|
|
4
|
-
import { CourierInboxFeedType } from '../types/feed-type';
|
|
5
|
-
export declare class CourierInboxDatastore {
|
|
6
|
-
private static instance;
|
|
7
|
-
private _inboxDataSet?;
|
|
8
|
-
private _archiveDataSet?;
|
|
9
|
-
private _dataStoreListeners;
|
|
10
|
-
private _unreadCount?;
|
|
11
|
-
private _removeMessageEventListener?;
|
|
12
|
-
private isPaginatingInbox;
|
|
13
|
-
private isPaginatingArchive;
|
|
14
|
-
static get shared(): CourierInboxDatastore;
|
|
15
|
-
get unreadCount(): number;
|
|
16
|
-
get inboxDataSet(): InboxDataSet;
|
|
17
|
-
get archiveDataSet(): InboxDataSet;
|
|
18
|
-
addDataStoreListener(listener: CourierInboxDataStoreListener): void;
|
|
19
|
-
removeDataStoreListener(listener: CourierInboxDataStoreListener): void;
|
|
20
|
-
private fetchCachableDataSet;
|
|
21
|
-
private fetchUnreadCount;
|
|
22
|
-
load(props?: {
|
|
23
|
-
canUseCache: boolean;
|
|
24
|
-
}): Promise<void>;
|
|
25
|
-
listenForUpdates(): Promise<void>;
|
|
26
|
-
private connectSocket;
|
|
27
|
-
/**
|
|
28
|
-
* Get a message by messageId from the inbox or archive data set
|
|
29
|
-
* @param props - The message ID
|
|
30
|
-
* @returns The message or undefined if it is not found
|
|
31
|
-
*/
|
|
32
|
-
private getMessage;
|
|
33
|
-
/**
|
|
34
|
-
* Fetch the next page of messages
|
|
35
|
-
* @param props - The feed type
|
|
36
|
-
* @returns The next page of messages or null if there is no next page
|
|
37
|
-
*/
|
|
38
|
-
fetchNextPageOfMessages(props: {
|
|
39
|
-
feedType: CourierInboxFeedType;
|
|
40
|
-
}): Promise<InboxDataSet | null>;
|
|
41
|
-
/**
|
|
42
|
-
* Check if the datastore is loaded and ready to perform mutations
|
|
43
|
-
* @returns True if the datastore is loaded and ready to perform mutations, false otherwise
|
|
44
|
-
*/
|
|
45
|
-
private canMutate;
|
|
46
|
-
readMessage({ message, canCallApi }: {
|
|
47
|
-
message: InboxMessage;
|
|
48
|
-
canCallApi?: boolean;
|
|
49
|
-
}): Promise<void>;
|
|
50
|
-
unreadMessage({ message, canCallApi }: {
|
|
51
|
-
message: InboxMessage;
|
|
52
|
-
canCallApi?: boolean;
|
|
53
|
-
}): Promise<void>;
|
|
54
|
-
openMessage({ message, canCallApi }: {
|
|
55
|
-
message: InboxMessage;
|
|
56
|
-
canCallApi?: boolean;
|
|
57
|
-
}): Promise<void>;
|
|
58
|
-
clickMessage({ message, canCallApi }: {
|
|
59
|
-
message: InboxMessage;
|
|
60
|
-
canCallApi?: boolean;
|
|
61
|
-
}): Promise<void>;
|
|
62
|
-
archiveMessage({ message, canCallApi }: {
|
|
63
|
-
message: InboxMessage;
|
|
64
|
-
canCallApi?: boolean;
|
|
65
|
-
}): Promise<void>;
|
|
66
|
-
unarchiveMessage({ message, canCallApi }: {
|
|
67
|
-
message: InboxMessage;
|
|
68
|
-
canCallApi?: boolean;
|
|
69
|
-
}): Promise<void>;
|
|
70
|
-
archiveReadMessages({ canCallApi }?: {
|
|
71
|
-
canCallApi?: boolean;
|
|
72
|
-
}): Promise<void>;
|
|
73
|
-
archiveAllMessages({ canCallApi }?: {
|
|
74
|
-
canCallApi?: boolean;
|
|
75
|
-
}): Promise<void>;
|
|
76
|
-
readAllMessages({ canCallApi }?: {
|
|
77
|
-
canCallApi?: boolean;
|
|
78
|
-
}): Promise<void>;
|
|
79
|
-
/**
|
|
80
|
-
* Find the insert index for a new message in a data set
|
|
81
|
-
* @param newMessage - The new message to insert
|
|
82
|
-
* @param dataSet - The data set to insert the message into
|
|
83
|
-
* @returns The index to insert the message at
|
|
84
|
-
*/
|
|
85
|
-
private findInsertIndex;
|
|
86
|
-
private addPage;
|
|
87
|
-
private addMessage;
|
|
88
|
-
private removeMessage;
|
|
89
|
-
/**
|
|
90
|
-
* Apply a message snapshot to the data store
|
|
91
|
-
* @param snapshot - The message snapshot to apply
|
|
92
|
-
*/
|
|
93
|
-
private applyMessageSnapshot;
|
|
94
|
-
private applyDatastoreSnapshot;
|
|
95
|
-
/**
|
|
96
|
-
* Update a message in the data store
|
|
97
|
-
* @param message - The message to update
|
|
98
|
-
* @param index - The index of the message in its respective data set
|
|
99
|
-
* @param feedType - The feed type of the message
|
|
100
|
-
*/
|
|
101
|
-
private updateMessage;
|
|
102
|
-
/**
|
|
103
|
-
* Copy an inbox data set
|
|
104
|
-
* @param dataSet - The inbox data set to copy
|
|
105
|
-
* @returns A copy of the inbox data set
|
|
106
|
-
*/
|
|
107
|
-
private getDatastoreSnapshot;
|
|
108
|
-
/**
|
|
109
|
-
* Copy an inbox message with its archive and inbox indices
|
|
110
|
-
* @param message - The inbox message to copy
|
|
111
|
-
* @returns A copy of the inbox message with its archive and inbox indices
|
|
112
|
-
*/
|
|
113
|
-
private getMessageSnapshot;
|
|
114
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type CourierInboxFeedType = 'inbox' | 'archive';
|
|
File without changes
|