@trycourier/courier-ui-inbox 1.0.5-beta → 1.0.7-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/dist/components/courier-inbox-header-title.d.ts +2 -1
- package/dist/components/courier-inbox-list-item-menu.d.ts +4 -3
- package/dist/components/courier-inbox-list-item.d.ts +2 -1
- package/dist/components/courier-inbox-list.d.ts +2 -1
- package/dist/components/courier-inbox-option-menu-item.d.ts +2 -1
- package/dist/components/courier-inbox-option-menu.d.ts +2 -1
- package/dist/components/courier-inbox-pagination-list-item.d.ts +2 -1
- package/dist/components/{courier-inbox-menu.d.ts → courier-inbox-popup-menu.d.ts} +2 -1
- package/dist/components/courier-inbox-skeleton-list-item.d.ts +2 -1
- package/dist/components/courier-inbox.d.ts +2 -1
- package/dist/components/courier-unread-count-badge.d.ts +2 -1
- package/dist/datastore/__tests__/datastore.test.d.ts +1 -0
- package/dist/datastore/datastore.d.ts +56 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -632
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2593 -1598
- package/dist/index.mjs.map +1 -0
- package/dist/jest.setup.d.ts +0 -0
- package/dist/types/inbox-data-set.d.ts +2 -0
- package/dist/types/snapshots.d.ts +12 -0
- package/dist/utils/extensions.d.ts +0 -1
- package/dist/utils/utils.d.ts +21 -1
- package/package.json +8 -5
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { CourierInboxMenuOption } from './courier-inbox-option-menu';
|
|
2
2
|
import { CourierInboxFeedType } from '../types/feed-type';
|
|
3
3
|
import { CourierInboxThemeManager } from '../types/courier-inbox-theme-manager';
|
|
4
|
-
|
|
4
|
+
import { BaseElement } from '@trycourier/courier-ui-core';
|
|
5
|
+
export declare class CourierInboxHeaderTitle extends BaseElement {
|
|
5
6
|
private _themeSubscription;
|
|
6
7
|
private _option;
|
|
7
8
|
private _feedType?;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
import { BaseElement } from '@trycourier/courier-ui-core';
|
|
1
2
|
import { CourierInboxIcon, CourierInboxTheme } from '../types/courier-inbox-theme';
|
|
2
|
-
export type
|
|
3
|
+
export type CourierInboxListItemActionMenuOption = {
|
|
3
4
|
id: string;
|
|
4
5
|
icon: CourierInboxIcon;
|
|
5
6
|
onClick: () => void;
|
|
6
7
|
};
|
|
7
|
-
export declare class
|
|
8
|
+
export declare class CourierInboxListItemMenu extends BaseElement {
|
|
8
9
|
private _theme;
|
|
9
10
|
private _options;
|
|
10
11
|
private _style;
|
|
11
12
|
constructor(theme: CourierInboxTheme);
|
|
12
13
|
private getStyles;
|
|
13
|
-
setOptions(options:
|
|
14
|
+
setOptions(options: CourierInboxListItemActionMenuOption[]): void;
|
|
14
15
|
private renderMenu;
|
|
15
16
|
show(): void;
|
|
16
17
|
hide(): void;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { InboxAction, InboxMessage } from '@trycourier/courier-js';
|
|
2
|
+
import { BaseElement } from '@trycourier/courier-ui-core';
|
|
2
3
|
import { CourierInboxFeedType } from '../types/feed-type';
|
|
3
4
|
import { CourierInboxTheme } from '../types/courier-inbox-theme';
|
|
4
|
-
export declare class CourierListItem extends
|
|
5
|
+
export declare class CourierListItem extends BaseElement {
|
|
5
6
|
private _theme;
|
|
6
7
|
private _message;
|
|
7
8
|
private _feedType;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { InboxAction, InboxMessage } from '@trycourier/courier-js';
|
|
2
|
+
import { BaseElement } from '@trycourier/courier-ui-core';
|
|
2
3
|
import { InboxDataSet } from '../types/inbox-data-set';
|
|
3
4
|
import { CourierInboxFeedType } from '../types/feed-type';
|
|
4
5
|
import { CourierInboxStateErrorFactoryProps, CourierInboxStateEmptyFactoryProps, CourierInboxStateLoadingFactoryProps, CourierInboxListItemFactoryProps, CourierInboxPaginationItemFactoryProps } from '../types/factories';
|
|
5
6
|
import { CourierInboxThemeManager } from '../types/courier-inbox-theme-manager';
|
|
6
|
-
export declare class CourierInboxList extends
|
|
7
|
+
export declare class CourierInboxList extends BaseElement {
|
|
7
8
|
private _themeSubscription;
|
|
8
9
|
private _messages;
|
|
9
10
|
private _feedType;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { BaseElement } from '@trycourier/courier-ui-core';
|
|
1
2
|
import { CourierInboxThemeManager } from '../types/courier-inbox-theme-manager';
|
|
2
3
|
import { CourierInboxMenuOption } from './courier-inbox-option-menu';
|
|
3
|
-
export declare class CourierInboxOptionMenuItem extends
|
|
4
|
+
export declare class CourierInboxOptionMenuItem extends BaseElement {
|
|
4
5
|
private _option;
|
|
5
6
|
private _isSelected?;
|
|
6
7
|
private _content;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BaseElement } from '@trycourier/courier-ui-core';
|
|
1
2
|
import { CourierInboxThemeManager } from '../types/courier-inbox-theme-manager';
|
|
2
3
|
import { CourierInboxHeaderMenuItemId } from './courier-inbox-header';
|
|
3
4
|
import { CourierInboxIcon } from '../types/courier-inbox-theme';
|
|
@@ -9,7 +10,7 @@ export type CourierInboxMenuOption = {
|
|
|
9
10
|
selectionIcon?: CourierInboxIcon | null;
|
|
10
11
|
onClick: (option: CourierInboxMenuOption) => void;
|
|
11
12
|
};
|
|
12
|
-
export declare class CourierInboxOptionMenu extends
|
|
13
|
+
export declare class CourierInboxOptionMenu extends BaseElement {
|
|
13
14
|
private _themeSubscription;
|
|
14
15
|
private _type;
|
|
15
16
|
private _selectedIndex;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { BaseElement } from '@trycourier/courier-ui-core';
|
|
1
2
|
import { CourierInboxTheme } from '../types/courier-inbox-theme';
|
|
2
|
-
export declare class CourierInboxPaginationListItem extends
|
|
3
|
+
export declare class CourierInboxPaginationListItem extends BaseElement {
|
|
3
4
|
private skeletonLoadingList?;
|
|
4
5
|
private observer;
|
|
5
6
|
private customItem?;
|
|
@@ -2,8 +2,9 @@ import { CourierInboxDatastoreEvents } from '../datastore/datatore-events';
|
|
|
2
2
|
import { CourierInboxHeaderFactoryProps, CourierInboxListItemActionFactoryProps, CourierInboxListItemFactoryProps, CourierInboxMenuButtonFactoryProps, CourierInboxPaginationItemFactoryProps, CourierInboxStateEmptyFactoryProps, CourierInboxStateErrorFactoryProps, CourierInboxStateLoadingFactoryProps } from '../types/factories';
|
|
3
3
|
import { CourierInboxFeedType } from '../types/feed-type';
|
|
4
4
|
import { CourierInboxTheme } from '../types/courier-inbox-theme';
|
|
5
|
+
import { BaseElement } from '@trycourier/courier-ui-core';
|
|
5
6
|
export type CourierInboxPopupAlignment = 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center' | 'center-right' | 'center-left' | 'center-center';
|
|
6
|
-
export declare class
|
|
7
|
+
export declare class CourierInboxPopupMenu extends BaseElement implements CourierInboxDatastoreEvents {
|
|
7
8
|
private _width;
|
|
8
9
|
private _height;
|
|
9
10
|
private _popupAlignment;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { BaseElement } from '@trycourier/courier-ui-core';
|
|
1
2
|
import { CourierInboxTheme } from '../types/courier-inbox-theme';
|
|
2
|
-
export declare class CourierInboxSkeletonListItem extends
|
|
3
|
+
export declare class CourierInboxSkeletonListItem extends BaseElement {
|
|
3
4
|
private _shadow;
|
|
4
5
|
constructor(theme: CourierInboxTheme, opacity: number);
|
|
5
6
|
private getStyles;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { BaseElement } from '@trycourier/courier-ui-core';
|
|
1
2
|
import { CourierInboxFeedType } from '../types/feed-type';
|
|
2
3
|
import { CourierInboxHeaderFactoryProps, CourierInboxListItemActionFactoryProps, CourierInboxListItemFactoryProps, CourierInboxPaginationItemFactoryProps, CourierInboxStateEmptyFactoryProps, CourierInboxStateErrorFactoryProps, CourierInboxStateLoadingFactoryProps } from '../types/factories';
|
|
3
4
|
import { CourierInboxTheme } from '../types/courier-inbox-theme';
|
|
4
5
|
import { CourierInboxThemeManager } from '../types/courier-inbox-theme-manager';
|
|
5
|
-
export declare class CourierInbox extends
|
|
6
|
+
export declare class CourierInbox extends BaseElement {
|
|
6
7
|
private _currentFeed;
|
|
7
8
|
private _themeManager;
|
|
8
9
|
get theme(): CourierInboxTheme;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { BaseElement } from '@trycourier/courier-ui-core';
|
|
1
2
|
import { CourierInboxThemeManager } from '../types/courier-inbox-theme-manager';
|
|
2
3
|
export type CourierUnreadCountLocation = 'button' | 'header';
|
|
3
|
-
export declare class CourierUnreadCountBadge extends
|
|
4
|
+
export declare class CourierUnreadCountBadge extends BaseElement {
|
|
4
5
|
private _themeSubscription;
|
|
5
6
|
private _location;
|
|
6
7
|
private _count;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
-
|
|
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
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from './components/courier-inbox';
|
|
2
2
|
export * from './components/courier-inbox-header';
|
|
3
3
|
export * from './components/courier-inbox-list-item';
|
|
4
|
-
export * from './components/courier-inbox-menu';
|
|
4
|
+
export * from './components/courier-inbox-popup-menu';
|
|
5
5
|
export * from './utils/extensions';
|
|
6
6
|
export * from './types/factories';
|
|
7
7
|
export * from './types/feed-type';
|