@trycourier/courier-ui-inbox 1.2.1 → 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.
Files changed (30) hide show
  1. package/dist/components/courier-inbox-feed-button.d.ts +28 -0
  2. package/dist/components/courier-inbox-header.d.ts +28 -11
  3. package/dist/components/courier-inbox-list-item.d.ts +4 -4
  4. package/dist/components/courier-inbox-list.d.ts +9 -4
  5. package/dist/components/courier-inbox-option-menu-item.d.ts +3 -0
  6. package/dist/components/courier-inbox-option-menu.d.ts +19 -12
  7. package/dist/components/courier-inbox-popup-menu.d.ts +57 -10
  8. package/dist/components/courier-inbox-tabs.d.ts +33 -0
  9. package/dist/components/courier-inbox.d.ts +121 -9
  10. package/dist/components/courier-unread-count-badge.d.ts +10 -5
  11. package/dist/datastore/__tests__/inbox-datastore.test.d.ts +1 -0
  12. package/dist/datastore/datatore-events.d.ts +61 -8
  13. package/dist/datastore/inbox-dataset.d.ts +110 -0
  14. package/dist/datastore/inbox-datastore.d.ts +217 -0
  15. package/dist/index.d.ts +2 -2
  16. package/dist/index.js +1 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +3225 -1501
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/types/courier-inbox-theme.d.ts +64 -20
  21. package/dist/types/factories.d.ts +21 -8
  22. package/dist/types/inbox-data-set.d.ts +111 -2
  23. package/dist/types/inbox-defaults.d.ts +39 -0
  24. package/dist/types/snapshots.d.ts +6 -0
  25. package/dist/utils/utils.d.ts +7 -0
  26. package/package.json +3 -3
  27. package/dist/components/courier-inbox-header-title.d.ts +0 -23
  28. package/dist/datastore/datastore.d.ts +0 -114
  29. package/dist/types/feed-type.d.ts +0 -1
  30. /package/dist/datastore/__tests__/{datastore.test.d.ts → inbox-dataset.test.d.ts} +0 -0
@@ -0,0 +1,28 @@
1
+ import { CourierBaseElement } from '@trycourier/courier-ui-core';
2
+ import { CourierInboxThemeManager } from '../types/courier-inbox-theme-manager';
3
+ import { CourierInboxFeed } from '../types/inbox-data-set';
4
+ export declare class CourierInboxFeedButton extends CourierBaseElement {
5
+ static get id(): string;
6
+ private _themeSubscription;
7
+ private _feeds;
8
+ private _selectedFeed?;
9
+ get selectedFeed(): CourierInboxFeed | undefined;
10
+ private _style?;
11
+ private _iconElement?;
12
+ private _titleElement?;
13
+ private _switchIconElement?;
14
+ private _unreadBadge?;
15
+ private get theme();
16
+ constructor(themeManager: CourierInboxThemeManager, feeds: CourierInboxFeed[]);
17
+ private getStyles;
18
+ onComponentMounted(): void;
19
+ onComponentUnmounted(): void;
20
+ private render;
21
+ setUnreadCount(count: number): void;
22
+ setFeeds(feeds: CourierInboxFeed[]): void;
23
+ setSelectedFeed(feedId: string): void;
24
+ private refreshTheme;
25
+ private refreshSelectedFeed;
26
+ private refreshSwitchIcon;
27
+ private refreshUnreadBadge;
28
+ }
@@ -1,33 +1,50 @@
1
- import { CourierInboxFeedType } from '../types/feed-type';
2
1
  import { CourierFactoryElement } from '@trycourier/courier-ui-core';
3
2
  import { CourierInboxHeaderFactoryProps } from '../types/factories';
4
3
  import { CourierInboxThemeManager } from '../types/courier-inbox-theme-manager';
5
4
  import { CourierInboxTheme } from '../types/courier-inbox-theme';
6
- export type CourierInboxHeaderMenuItemId = CourierInboxFeedType | 'markAllRead' | 'archiveAll' | 'archiveRead';
5
+ import { CourierInboxFeed, CourierInboxTab } from '../types/inbox-data-set';
6
+ import { CourierInboxTabs } from './courier-inbox-tabs';
7
+ import { CourierInboxHeaderAction } from '../types/inbox-defaults';
7
8
  export declare class CourierInboxHeader extends CourierFactoryElement {
8
9
  static get id(): string;
9
10
  private _themeSubscription;
10
- private _feedType;
11
- private _unreadCount;
12
- private _titleSection?;
13
- private _filterMenu?;
11
+ private _feeds;
12
+ private _currentFeedId?;
13
+ private _actions;
14
+ private _feedButton?;
15
+ private _feedMenu?;
16
+ private _actionMenuButton?;
14
17
  private _actionMenu?;
18
+ tabs?: CourierInboxTabs;
15
19
  private _style?;
16
- private _onFeedTypeChange;
17
- static get observedAttributes(): string[];
20
+ private _feedButtonClickHandler?;
21
+ private _onFeedChange;
22
+ private _onFeedReselected;
23
+ private _onTabChange;
24
+ private _onTabReselected;
18
25
  private get theme();
26
+ /** Returns whether the tabs are currently visible based on the current feed having more than 1 tab. */
27
+ get showTabs(): boolean;
19
28
  constructor(props: {
20
29
  themeManager: CourierInboxThemeManager;
21
- onFeedTypeChange: (feedType: CourierInboxFeedType) => void;
30
+ actions?: CourierInboxHeaderAction[];
31
+ onFeedChange: (feed: CourierInboxFeed) => void;
32
+ onFeedReselected: (feed: CourierInboxFeed) => void;
33
+ onTabChange: (tab: CourierInboxTab) => void;
34
+ onTabReselected: (tab: CourierInboxTab) => void;
22
35
  });
23
36
  onComponentMounted(): void;
24
37
  onComponentUmounted(): void;
25
- private getFilterOptions;
26
38
  private getActionOptions;
27
39
  private refreshTheme;
28
- private handleOptionMenuItemClick;
40
+ private getFeedMenuOptions;
29
41
  render(props: CourierInboxHeaderFactoryProps): void;
30
42
  build(newElement: HTMLElement | undefined | null): void;
31
43
  defaultElement(): HTMLElement;
44
+ private refreshActionMenuButton;
45
+ private updateFeedButtonInteraction;
46
+ setFeeds(feeds: CourierInboxFeed[]): void;
47
+ setActions(actions: CourierInboxHeaderAction[]): void;
48
+ selectFeed(feedId: string, tabId: string): void;
32
49
  static getStyles(theme: CourierInboxTheme): string;
33
50
  }
@@ -1,16 +1,16 @@
1
1
  import { InboxAction, InboxMessage } from '@trycourier/courier-js';
2
2
  import { CourierBaseElement } from '@trycourier/courier-ui-core';
3
- import { CourierInboxFeedType } from '../types/feed-type';
4
3
  import { CourierInboxTheme } from '../types/courier-inbox-theme';
5
4
  import { CourierInboxThemeManager } from '../types/courier-inbox-theme-manager';
5
+ import { CourierInboxListItemAction } from '../types/inbox-defaults';
6
6
  export declare class CourierInboxListItem extends CourierBaseElement {
7
7
  static get id(): string;
8
8
  private _themeManager;
9
9
  private _theme;
10
10
  private _message;
11
- private _feedType;
12
11
  private _isMobile;
13
12
  private _canClick;
13
+ private _listItemActions;
14
14
  private _titleElement?;
15
15
  private _subtitleElement?;
16
16
  private _timeElement?;
@@ -24,7 +24,7 @@ export declare class CourierInboxListItem extends CourierBaseElement {
24
24
  private onItemLongPress;
25
25
  private onItemActionClick;
26
26
  private onItemVisible;
27
- constructor(themeManager: CourierInboxThemeManager, canClick: boolean, _canLongPress: boolean);
27
+ constructor(themeManager: CourierInboxThemeManager, canClick: boolean, _canLongPress: boolean, listItemActions?: CourierInboxListItemAction[]);
28
28
  private render;
29
29
  private _setupIntersectionObserver;
30
30
  onComponentUnmounted(): void;
@@ -34,7 +34,7 @@ export declare class CourierInboxListItem extends CourierBaseElement {
34
34
  private _getMenuOptions;
35
35
  private _showMenu;
36
36
  private _hideMenu;
37
- setMessage(message: InboxMessage, feedType: CourierInboxFeedType): void;
37
+ setMessage(message: InboxMessage): void;
38
38
  setOnItemClick(cb: (message: InboxMessage) => void): void;
39
39
  setOnItemActionClick(cb: (message: InboxMessage, action: InboxAction) => void): void;
40
40
  setOnItemLongPress(cb: (message: InboxMessage) => void): void;
@@ -1,20 +1,21 @@
1
1
  import { InboxAction, InboxMessage } from '@trycourier/courier-js';
2
2
  import { CourierBaseElement } from '@trycourier/courier-ui-core';
3
3
  import { InboxDataSet } from '../types/inbox-data-set';
4
- import { CourierInboxFeedType } from '../types/feed-type';
5
4
  import { CourierInboxStateErrorFactoryProps, CourierInboxStateEmptyFactoryProps, CourierInboxStateLoadingFactoryProps, CourierInboxListItemFactoryProps, CourierInboxPaginationItemFactoryProps } from '../types/factories';
6
5
  import { CourierInboxTheme } from '../types/courier-inbox-theme';
7
6
  import { CourierInboxThemeManager } from '../types/courier-inbox-theme-manager';
7
+ import { CourierInboxListItemAction } from '../types/inbox-defaults';
8
8
  export declare class CourierInboxList extends CourierBaseElement {
9
9
  static get id(): string;
10
10
  private _themeSubscription;
11
11
  private _messages;
12
- private _feedType;
12
+ private _datasetId;
13
13
  private _isLoading;
14
14
  private _error;
15
15
  private _canPaginate;
16
16
  private _canClickListItems;
17
17
  private _canLongPressListItems;
18
+ private _listItemActions;
18
19
  private _onMessageClick;
19
20
  private _onMessageActionClick;
20
21
  private _onMessageLongPress;
@@ -34,10 +35,11 @@ export declare class CourierInboxList extends CourierBaseElement {
34
35
  private _emptyContainer?;
35
36
  constructor(props: {
36
37
  themeManager: CourierInboxThemeManager;
38
+ listItemActions?: CourierInboxListItemAction[];
37
39
  canClickListItems: boolean;
38
40
  canLongPressListItems: boolean;
39
41
  onRefresh: () => void;
40
- onPaginationTrigger: (feedType: CourierInboxFeedType) => void;
42
+ onPaginationTrigger: (datasetId: string) => void;
41
43
  onMessageClick: (message: InboxMessage, index: number) => void;
42
44
  onMessageActionClick: (message: InboxMessage, action: InboxAction, index: number) => void;
43
45
  onMessageLongPress: (message: InboxMessage, index: number) => void;
@@ -46,18 +48,20 @@ export declare class CourierInboxList extends CourierBaseElement {
46
48
  onComponentUnmounted(): void;
47
49
  setCanClickListItems(canClick: boolean): void;
48
50
  setCanLongPressListItems(canLongPress: boolean): void;
51
+ setListItemActions(actions: CourierInboxListItemAction[]): void;
49
52
  static getStyles(theme: CourierInboxTheme): string;
50
53
  setDataSet(dataSet: InboxDataSet): void;
51
54
  addPage(dataSet: InboxDataSet): void;
52
55
  addMessage(message: InboxMessage, index?: number): void;
53
56
  removeMessage(index?: number): void;
54
57
  updateMessage(message: InboxMessage, index?: number): void;
55
- setFeedType(feedType: CourierInboxFeedType): void;
58
+ selectDataset(datasetId: string): void;
56
59
  setLoading(isLoading: boolean): void;
57
60
  setError(error: Error | null): void;
58
61
  setErrorNoClient(): void;
59
62
  private handleRetry;
60
63
  private handleRefresh;
64
+ private refreshTheme;
61
65
  refreshInfoStateThemes(): void;
62
66
  get errorProps(): any;
63
67
  get emptyProps(): any;
@@ -68,4 +72,5 @@ export declare class CourierInboxList extends CourierBaseElement {
68
72
  setErrorStateFactory(factory: (props: CourierInboxStateErrorFactoryProps | undefined | null) => HTMLElement): void;
69
73
  setListItemFactory(factory: (props: CourierInboxListItemFactoryProps | undefined | null) => HTMLElement): void;
70
74
  setPaginationItemFactory(factory: (props: CourierInboxPaginationItemFactoryProps | undefined | null) => HTMLElement): void;
75
+ scrollToTop(animate?: boolean): void;
71
76
  }
@@ -6,6 +6,7 @@ export declare class CourierInboxOptionMenuItem extends CourierBaseElement {
6
6
  private _option;
7
7
  private _isSelectedable;
8
8
  private _isSelected?;
9
+ private _theme;
9
10
  private _content?;
10
11
  private _itemIcon?;
11
12
  private _title?;
@@ -18,4 +19,6 @@ export declare class CourierInboxOptionMenuItem extends CourierBaseElement {
18
19
  });
19
20
  onComponentMounted(): void;
20
21
  refreshTheme(): void;
22
+ setSelected(isSelected: boolean): void;
23
+ private updateSelectionState;
21
24
  }
@@ -1,35 +1,42 @@
1
1
  import { CourierBaseElement } from '@trycourier/courier-ui-core';
2
2
  import { CourierInboxThemeManager } from '../types/courier-inbox-theme-manager';
3
- import { CourierInboxHeaderMenuItemId } from './courier-inbox-header';
4
3
  import { CourierInboxIconTheme } from '../types/courier-inbox-theme';
5
- export type CourierInboxMenuOptionType = 'filters' | 'actions';
6
4
  export type CourierInboxMenuOption = {
7
- id: CourierInboxHeaderMenuItemId;
5
+ id: string;
8
6
  text: string;
9
7
  icon: CourierInboxIconTheme;
10
- selectionIcon?: CourierInboxIconTheme | null;
11
8
  onClick: (option: CourierInboxMenuOption) => void;
12
9
  };
10
+ export type CourierInboxOptionMenuType = 'feed' | 'action';
13
11
  export declare class CourierInboxOptionMenu extends CourierBaseElement {
14
12
  static get id(): string;
15
13
  private _themeSubscription;
16
- private _type;
17
14
  private _selectedIndex;
18
15
  private _options;
19
16
  private _selectable;
20
- private _onMenuOpen;
21
- private _menuButton?;
22
- private _menu?;
17
+ private _onMenuOpen?;
18
+ private _isOpen;
19
+ private _menuType;
23
20
  private _style?;
24
- constructor(themeManager: CourierInboxThemeManager, type: CourierInboxMenuOptionType, selectable: boolean, options: CourierInboxMenuOption[], onMenuOpen: () => void);
21
+ private _shadowRoot?;
22
+ private _container?;
23
+ constructor(themeManager: CourierInboxThemeManager, selectable: boolean, options: CourierInboxMenuOption[], menuType: CourierInboxOptionMenuType, onMenuOpen?: () => void);
25
24
  onComponentMounted(): void;
26
25
  onComponentUnmounted(): void;
26
+ private attachElements;
27
27
  private getStyles;
28
+ setPosition(position: {
29
+ right?: string;
30
+ left?: string;
31
+ top?: string;
32
+ }): void;
28
33
  private refreshTheme;
29
34
  setOptions(options: CourierInboxMenuOption[]): void;
30
35
  private refreshMenuItems;
31
- private toggleMenu;
32
- private handleOutsideClick;
36
+ toggleMenu(): void;
37
+ private showMenu;
38
+ private hideMenu;
33
39
  closeMenu(): void;
34
- selectOption(option: CourierInboxMenuOption): void;
40
+ private handleOutsideClick;
41
+ selectionItemAtIndex(index: number): void;
35
42
  }
@@ -1,8 +1,9 @@
1
1
  import { CourierInboxDatastoreEvents } from '../datastore/datatore-events';
2
2
  import { CourierInboxHeaderFactoryProps, CourierInboxListItemActionFactoryProps, CourierInboxListItemFactoryProps, CourierInboxMenuButtonFactoryProps, CourierInboxPaginationItemFactoryProps, CourierInboxStateEmptyFactoryProps, CourierInboxStateErrorFactoryProps, CourierInboxStateLoadingFactoryProps } from '../types/factories';
3
- import { CourierInboxFeedType } from '../types/feed-type';
3
+ import { CourierInboxFeed } from '../types/inbox-data-set';
4
4
  import { CourierInboxTheme } from '../types/courier-inbox-theme';
5
5
  import { CourierComponentThemeMode, CourierBaseElement } from '@trycourier/courier-ui-core';
6
+ import { CourierInboxHeaderAction, CourierInboxListItemAction } from '../types/inbox-defaults';
6
7
  export type CourierInboxPopupAlignment = 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center' | 'center-right' | 'center-left' | 'center-center';
7
8
  export declare class CourierInboxPopupMenu extends CourierBaseElement implements CourierInboxDatastoreEvents {
8
9
  static get id(): string;
@@ -16,8 +17,6 @@ export declare class CourierInboxPopupMenu extends CourierBaseElement implements
16
17
  private _themeManager;
17
18
  /** Returns the current theme object. */
18
19
  get theme(): CourierInboxTheme;
19
- /** Returns the current feed type. */
20
- get currentFeed(): CourierInboxFeedType;
21
20
  /**
22
21
  * Set the light theme for the popup menu.
23
22
  * @param theme The light theme object to set.
@@ -38,19 +37,27 @@ export declare class CourierInboxPopupMenu extends CourierBaseElement implements
38
37
  private _inbox?;
39
38
  private _style?;
40
39
  private _datastoreListener?;
40
+ private _totalUnreadCount;
41
41
  private _popupMenuButtonFactory?;
42
42
  static get observedAttributes(): string[];
43
43
  constructor();
44
44
  onComponentMounted(): void;
45
45
  onComponentUnmounted(): void;
46
+ private readInitialThemeAttributes;
46
47
  private refreshTheme;
47
48
  static getStyles(theme: CourierInboxTheme, width: string, height: string): string;
48
49
  attributeChangedCallback(name: string, _: string, newValue: string): void;
49
50
  /**
50
- * Called when the unread count changes.
51
- * @param _ The new unread count (unused).
51
+ * Called when the per-dataset unread count changes.
52
+ * Triggers a render to update the factory with latest feeds data
53
+ * (which includes per-tab unread counts).
52
54
  */
53
55
  onUnreadCountChange(_: number): void;
56
+ /**
57
+ * Called when the total unread count across all datasets changes.
58
+ * Updates the popup trigger button badge.
59
+ */
60
+ onTotalUnreadCountChange(totalUnreadCount: number): void;
54
61
  /**
55
62
  * Set a handler for message click events.
56
63
  * @param handler The function to call when a message is clicked.
@@ -73,6 +80,14 @@ export declare class CourierInboxPopupMenu extends CourierBaseElement implements
73
80
  * @param event The click event that triggered the toggle.
74
81
  */
75
82
  private togglePopup;
83
+ /**
84
+ * Show the popup menu with transition.
85
+ */
86
+ showPopup(): void;
87
+ /**
88
+ * Hide the popup menu with transition.
89
+ */
90
+ hidePopup(): void;
76
91
  /**
77
92
  * Close the popup menu.
78
93
  */
@@ -94,11 +109,6 @@ export declare class CourierInboxPopupMenu extends CourierBaseElement implements
94
109
  * @param position The alignment/position to set.
95
110
  */
96
111
  setPosition(position: CourierInboxPopupAlignment): void;
97
- /**
98
- * Set the feed type for the inbox.
99
- * @param feedType The feed type to set.
100
- */
101
- setFeedType(feedType: CourierInboxFeedType): void;
102
112
  /**
103
113
  * Set a custom header factory for the inbox.
104
114
  * @param factory The factory function for the header.
@@ -138,5 +148,42 @@ export declare class CourierInboxPopupMenu extends CourierBaseElement implements
138
148
  * @param factory The factory function for the menu button.
139
149
  */
140
150
  setMenuButton(factory: (props: CourierInboxMenuButtonFactoryProps | undefined | null) => HTMLElement): void;
151
+ /**
152
+ * Sets the active feed for the inbox.
153
+ * @param feedId The feed ID to display.
154
+ */
155
+ selectFeed(feedId: string): void;
156
+ /**
157
+ * Switches to a tab by updating components and loading data.
158
+ * @param tabId The tab ID to switch to.
159
+ */
160
+ selectTab(tabId: string): void;
161
+ /**
162
+ * Set the feeds for this Inbox, replacing any existing feeds.
163
+ * @param feeds The list of feeds to set for the Inbox.
164
+ */
165
+ setFeeds(feeds: CourierInboxFeed[]): void;
166
+ /**
167
+ * Get the current set of feeds.
168
+ */
169
+ getFeeds(): CourierInboxFeed[];
170
+ /**
171
+ * Sets the enabled header actions for the inbox.
172
+ * @param actions - The header actions to enable (e.g., [{ id: 'readAll', iconSVG: '...', text: '...' }]).
173
+ */
174
+ setActions(actions: CourierInboxHeaderAction[]): void;
175
+ /**
176
+ * Sets the enabled list item actions for the inbox.
177
+ * @param actions - The list item actions to enable (e.g., [{ id: 'read_unread', readIconSVG: '...', unreadIconSVG: '...' }]).
178
+ */
179
+ setListItemActions(actions: CourierInboxListItemAction[]): void;
180
+ /**
181
+ * Returns the current feed type.
182
+ */
183
+ get currentFeedId(): string;
184
+ /**
185
+ * Forces a reload of the inbox data, bypassing the cache.
186
+ */
187
+ refresh(): Promise<void | undefined>;
141
188
  private render;
142
189
  }
@@ -0,0 +1,33 @@
1
+ import { CourierBaseElement } from '@trycourier/courier-ui-core';
2
+ import { CourierInboxTheme } from '../types/courier-inbox-theme';
3
+ import { CourierInboxThemeManager } from '../types/courier-inbox-theme-manager';
4
+ import { CourierInboxTab } from '../types/inbox-data-set';
5
+ export declare class CourierInboxTabs extends CourierBaseElement {
6
+ static get id(): string;
7
+ private _themeManager;
8
+ private _themeSubscription;
9
+ private _selectedTabId?;
10
+ private _tabs;
11
+ private _onTabClick;
12
+ private _onTabReselected;
13
+ private _tabBadges;
14
+ private _style?;
15
+ get theme(): CourierInboxTheme;
16
+ constructor(props: {
17
+ themeManager: CourierInboxThemeManager;
18
+ onTabClick: (tab: CourierInboxTab) => void;
19
+ onTabReselected: (tab: CourierInboxTab) => void;
20
+ });
21
+ onComponentMounted(): void;
22
+ onComponentUnmounted(): void;
23
+ private render;
24
+ static getStyles(theme: CourierInboxTheme): string;
25
+ setTabs(tabs: CourierInboxTab[]): void;
26
+ setSelectedTab(tabId: string): void;
27
+ updateTabUnreadCount(tabId: string, count: number): void;
28
+ scrollToStart(animate?: boolean): void;
29
+ private refreshTheme;
30
+ private reloadTabs;
31
+ private updateBadgeStates;
32
+ private createTab;
33
+ }
@@ -1,13 +1,81 @@
1
1
  import { CourierBaseElement, CourierComponentThemeMode } from '@trycourier/courier-ui-core';
2
- import { CourierInboxFeedType } from '../types/feed-type';
3
- import { CourierInboxHeaderFactoryProps, CourierInboxListItemActionFactoryProps, CourierInboxListItemFactoryProps, CourierInboxPaginationItemFactoryProps, CourierInboxStateEmptyFactoryProps, CourierInboxStateErrorFactoryProps, CourierInboxStateLoadingFactoryProps } from '../types/factories';
2
+ import { CourierInboxFeed } from '../types/inbox-data-set';
3
+ import { CourierInboxHeaderFactoryProps, CourierInboxHeaderFeed, CourierInboxListItemActionFactoryProps, CourierInboxListItemFactoryProps, CourierInboxPaginationItemFactoryProps, CourierInboxStateEmptyFactoryProps, CourierInboxStateErrorFactoryProps, CourierInboxStateLoadingFactoryProps } from '../types/factories';
4
4
  import { CourierInboxTheme } from '../types/courier-inbox-theme';
5
5
  import { CourierInboxThemeManager } from '../types/courier-inbox-theme-manager';
6
+ import { CourierInboxHeaderAction, CourierInboxListItemAction } from '../types/inbox-defaults';
6
7
  export declare class CourierInbox extends CourierBaseElement {
7
8
  static get id(): string;
8
- private _currentFeed;
9
+ /**
10
+ * Returns the default set of feeds used by CourierInbox.
11
+ * Exposed as a convenience for constructing matching datasets in
12
+ * custom integrations (for example, when using CourierInboxDatastore directly).
13
+ *
14
+ * @example
15
+ * Returns:
16
+ * [
17
+ * {
18
+ * feedId: 'inbox_feed',
19
+ * title: 'Inbox',
20
+ * iconSVG: CourierIconSVGs.inbox,
21
+ * tabs: [
22
+ * {
23
+ * datasetId: 'all_messages',
24
+ * title: 'All Messages',
25
+ * filter: {}
26
+ * }
27
+ * ]
28
+ * },
29
+ * {
30
+ * feedId: 'archive_feed',
31
+ * title: 'Archive',
32
+ * iconSVG: CourierIconSVGs.archive,
33
+ * tabs: [
34
+ * {
35
+ * datasetId: 'archived_messages',
36
+ * title: 'Archived Messages',
37
+ * filter: {
38
+ * archived: true
39
+ * }
40
+ * }
41
+ * ]
42
+ * }
43
+ * ]
44
+ */
45
+ static defaultFeeds(): CourierInboxFeed[];
46
+ /**
47
+ * Returns the default header actions used by CourierInbox.
48
+ * Exposed as a convenience for building matching headers in custom UIs.
49
+ *
50
+ * @example
51
+ * Returns:
52
+ * [
53
+ * { id: 'readAll' },
54
+ * { id: 'archiveRead' },
55
+ * { id: 'archiveAll' }
56
+ * ]
57
+ */
58
+ static defaultActions(): CourierInboxHeaderAction[];
59
+ /**
60
+ * Returns the default list item actions used by CourierInbox.
61
+ * Exposed as a convenience for building matching message menus in custom UIs.
62
+ *
63
+ * @example
64
+ * Returns:
65
+ * [
66
+ * { id: 'read_unread' },
67
+ * { id: 'archive_unarchive' }
68
+ * ]
69
+ */
70
+ static defaultListItemActions(): CourierInboxListItemAction[];
71
+ private _currentFeedId;
72
+ private _feedTabMap;
9
73
  /** Returns the current feed type. */
10
- get currentFeed(): CourierInboxFeedType;
74
+ get currentFeedId(): string;
75
+ /** Returns the current tab ID for the current feed. */
76
+ private get _currentTabId();
77
+ /** Returns the selected tab ID for a given feed ID. */
78
+ private getSelectedTabIdForFeed;
11
79
  private _themeManager;
12
80
  /** Returns the current theme object. */
13
81
  get theme(): CourierInboxTheme;
@@ -27,19 +95,27 @@ export declare class CourierInbox extends CourierBaseElement {
27
95
  */
28
96
  setMode(mode: CourierComponentThemeMode): void;
29
97
  private _inboxStyle?;
30
- private _unreadIndicatorStyle?;
31
98
  private _list?;
32
99
  private _datastoreListener;
33
100
  private _authListener;
101
+ private _feeds;
34
102
  private _header?;
35
103
  private _headerFactory;
104
+ private _actions;
36
105
  private _onMessageClick?;
37
106
  private _onMessageActionClick?;
38
107
  private _onMessageLongPress?;
108
+ private _listItemActions;
39
109
  private _defaultProps;
40
110
  static get observedAttributes(): string[];
41
111
  constructor(themeManager?: CourierInboxThemeManager);
112
+ private resetInitialFeedAndTab;
42
113
  onComponentMounted(): void;
114
+ private readInitialThemeAttributes;
115
+ private setupThemeSubscription;
116
+ private setupAuthListener;
117
+ private initializeInboxData;
118
+ private attachElements;
43
119
  onComponentUnmounted(): void;
44
120
  private refreshTheme;
45
121
  private getStyles;
@@ -92,16 +168,52 @@ export declare class CourierInbox extends CourierBaseElement {
92
168
  * @param handler - A function to be called when a message is long-pressed.
93
169
  */
94
170
  onMessageLongPress(handler?: (props: CourierInboxListItemFactoryProps) => void): void;
171
+ private reloadListForTab;
172
+ /**
173
+ * Sets the active feed for the inbox.
174
+ * @param feedId - The feed ID to display.
175
+ */
176
+ selectFeed(feedId: string): void;
177
+ /**
178
+ * Switches to a tab by updating components and loading data.
179
+ * @param tabId - The tab ID to switch to.
180
+ * @param animate - Whether to animate the scroll to top.
181
+ */
182
+ selectTab(tabId: string): void;
183
+ /**
184
+ * Updates unread counts for a list of tabs.
185
+ * @param tabs - The tabs to update unread counts for.
186
+ */
187
+ private updateTabUnreadCounts;
188
+ /**
189
+ * Sets the enabled header actions for the inbox.
190
+ * Pass an empty array to remove all actions.
191
+ * @param actions - The header actions to enable (e.g., [{ id: 'readAll', iconSVG: '...', text: '...' }]).
192
+ */
193
+ setActions(actions: CourierInboxHeaderAction[]): void;
194
+ /**
195
+ * Sets the enabled list item actions for the inbox.
196
+ * Pass an empty array to remove all actions.
197
+ * @param actions - The list item actions to enable (e.g., [{ id: 'read_unread', readIconSVG: '...', unreadIconSVG: '...' }]).
198
+ */
199
+ setListItemActions(actions: CourierInboxListItemAction[]): void;
200
+ /**
201
+ * Sets the feeds for the inbox.
202
+ * @param feeds - The feeds to set for the inbox.
203
+ */
204
+ setFeeds(feeds: CourierInboxFeed[]): void;
205
+ /** Get the current set of feeds. */
206
+ getFeeds(): CourierInboxFeed[];
95
207
  /**
96
- * Sets the feed type for the inbox (e.g., "inbox" or "archive").
97
- * @param feedType - The feed type to display.
208
+ * Returns the header feeds in the format expected by header factories.
209
+ * @public
98
210
  */
99
- setFeedType(feedType: CourierInboxFeedType): void;
211
+ getHeaderFeeds(): CourierInboxHeaderFeed[];
100
212
  private updateHeader;
101
213
  private load;
102
214
  /**
103
215
  * Forces a reload of the inbox data, bypassing the cache.
104
216
  */
105
- refresh(): void;
217
+ refresh(): Promise<void>;
106
218
  attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
107
219
  }
@@ -1,23 +1,28 @@
1
1
  import { CourierBaseElement } from '@trycourier/courier-ui-core';
2
2
  import { CourierInboxTheme } from '../types/courier-inbox-theme';
3
3
  import { CourierInboxThemeManager } from '../types/courier-inbox-theme-manager';
4
- export type CourierUnreadCountLocation = 'button' | 'header';
4
+ export type CourierUnreadCountBadgeLocation = "feed" | "tab";
5
5
  export declare class CourierUnreadCountBadge extends CourierBaseElement {
6
6
  static get id(): string;
7
7
  private _themeSubscription;
8
8
  private _location;
9
9
  private _count;
10
- private _badge?;
11
10
  private _style?;
11
+ private _shadowRoot?;
12
+ private _container?;
12
13
  get theme(): CourierInboxTheme;
13
14
  constructor(props: {
14
15
  themeBus: CourierInboxThemeManager;
15
- location: CourierUnreadCountLocation;
16
+ location: CourierUnreadCountBadgeLocation;
16
17
  });
17
18
  onComponentMounted(): void;
19
+ private attachElements;
18
20
  onComponentUnmounted(): void;
19
- static getStyles(theme: CourierInboxTheme): string;
21
+ private static getThemePath;
22
+ static getStyles(theme: CourierInboxTheme, location?: CourierUnreadCountBadgeLocation): string;
23
+ private getStyles;
20
24
  setCount(count: number): void;
21
- refreshTheme(location: CourierUnreadCountLocation): void;
25
+ setActive(active: boolean): void;
26
+ refreshTheme(): void;
22
27
  private updateBadge;
23
28
  }
@@ -0,0 +1 @@
1
+ export {};