@trycourier/courier-ui-inbox 1.0.0-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.
@@ -0,0 +1,50 @@
1
+ import { CourierComponentThemeMode, SystemThemeMode } from '@trycourier/courier-ui-core';
2
+ import { CourierInboxTheme } from './courier-inbox-theme';
3
+ export interface CourierInboxThemeSubscription {
4
+ manager: CourierInboxThemeManager;
5
+ unsubscribe: () => void;
6
+ }
7
+ export declare class CourierInboxThemeManager {
8
+ private readonly THEME_CHANGE_EVENT;
9
+ private _theme;
10
+ private _lightTheme;
11
+ private _darkTheme;
12
+ private _target;
13
+ private _subscriptions;
14
+ private _userMode;
15
+ private _systemMode;
16
+ private _systemThemeCleanup;
17
+ setLightTheme(theme: CourierInboxTheme): void;
18
+ setDarkTheme(theme: CourierInboxTheme): void;
19
+ constructor(initialTheme: CourierInboxTheme);
20
+ /**
21
+ * Get the current system theme
22
+ */
23
+ get currentSystemTheme(): SystemThemeMode;
24
+ /**
25
+ * Get the current theme
26
+ */
27
+ getTheme(): CourierInboxTheme;
28
+ /**
29
+ * Update the theme
30
+ */
31
+ private updateTheme;
32
+ /**
33
+ * Set the theme and notify all listeners
34
+ */
35
+ private setTheme;
36
+ /**
37
+ * Set the mode and notify all listeners
38
+ */
39
+ setMode(mode: CourierComponentThemeMode): void;
40
+ /**
41
+ * Subscribe to theme changes
42
+ * @param {Function} callback - Function to run when the theme changes
43
+ * @returns {CourierInboxThemeSubscription} - Object with remove method to stop listening
44
+ */
45
+ subscribe(callback: (theme: CourierInboxTheme) => void): CourierInboxThemeSubscription;
46
+ /**
47
+ * Clean up event listeners
48
+ */
49
+ cleanup(): void;
50
+ }
@@ -0,0 +1,161 @@
1
+ import { SystemThemeMode } from '@trycourier/courier-ui-core';
2
+ export type CourierInboxFont = {
3
+ family?: string;
4
+ weight?: string;
5
+ size?: string;
6
+ color?: string;
7
+ };
8
+ export type CourierInboxIcon = {
9
+ color?: string;
10
+ svg?: string;
11
+ };
12
+ export type CourierInboxFilterItem = {
13
+ icon?: CourierInboxIcon;
14
+ text?: string;
15
+ };
16
+ export type CourierInboxUnreadIndicator = {
17
+ font?: CourierInboxFont;
18
+ backgroundColor?: string;
19
+ borderRadius?: string;
20
+ };
21
+ export type CourierInboxIconButton = {
22
+ icon?: CourierInboxIcon;
23
+ backgroundColor?: string;
24
+ hoverBackgroundColor?: string;
25
+ activeBackgroundColor?: string;
26
+ };
27
+ export type CourierInboxButton = {
28
+ font?: CourierInboxFont;
29
+ text?: string;
30
+ shadow?: string;
31
+ border?: string;
32
+ borderRadius?: string;
33
+ backgroundColor?: string;
34
+ hoverBackgroundColor?: string;
35
+ activeBackgroundColor?: string;
36
+ };
37
+ export type CourierInboxMenuButton = CourierInboxIconButton & {
38
+ unreadIndicator?: CourierInboxUnreadIndicator;
39
+ };
40
+ export type CourierInboxPopup = {
41
+ backgroundColor?: string;
42
+ border?: string;
43
+ borderRadius?: string;
44
+ shadow?: string;
45
+ list?: {
46
+ font?: CourierInboxFont;
47
+ selectionIcon?: CourierInboxIcon;
48
+ hoverBackgroundColor?: string;
49
+ activeBackgroundColor?: string;
50
+ divider?: string;
51
+ };
52
+ };
53
+ export type CourierInboxListItem = {
54
+ unreadIndicatorColor?: string;
55
+ backgroundColor?: string;
56
+ hoverBackgroundColor?: string;
57
+ activeBackgroundColor?: string;
58
+ title?: CourierInboxFont;
59
+ subtitle?: CourierInboxFont;
60
+ time?: CourierInboxFont;
61
+ archiveIcon?: CourierInboxIcon;
62
+ divider?: string;
63
+ actions?: {
64
+ backgroundColor?: string;
65
+ hoverBackgroundColor?: string;
66
+ activeBackgroundColor?: string;
67
+ border?: string;
68
+ borderRadius?: string;
69
+ shadow?: string;
70
+ font?: CourierInboxFont;
71
+ };
72
+ menu?: {
73
+ enabled?: boolean;
74
+ backgroundColor?: string;
75
+ border?: string;
76
+ borderRadius?: string;
77
+ shadow?: string;
78
+ longPress?: {
79
+ displayDuration?: number;
80
+ vibrationDuration?: number;
81
+ };
82
+ item?: {
83
+ hoverBackgroundColor?: string;
84
+ activeBackgroundColor?: string;
85
+ borderRadius?: string;
86
+ read?: CourierInboxIcon;
87
+ unread?: CourierInboxIcon;
88
+ archive?: CourierInboxIcon;
89
+ unarchive?: CourierInboxIcon;
90
+ };
91
+ };
92
+ };
93
+ export type CourierInboxSkeletonLoadingState = {
94
+ animation?: {
95
+ barColor?: string;
96
+ barHeight?: string;
97
+ barBorderRadius?: string;
98
+ duration?: string;
99
+ };
100
+ divider?: string;
101
+ };
102
+ export type CourierInboxInfoState = {
103
+ title?: {
104
+ font?: CourierInboxFont;
105
+ text?: string;
106
+ };
107
+ button?: CourierInboxButton;
108
+ };
109
+ export type CourierMenuItem = {
110
+ icon?: CourierInboxIcon;
111
+ text?: string;
112
+ };
113
+ export type CourierFilterMenu = {
114
+ button?: CourierInboxIconButton;
115
+ inbox?: CourierMenuItem;
116
+ archive?: CourierMenuItem;
117
+ };
118
+ export type CourierActionMenu = {
119
+ button?: CourierInboxIconButton;
120
+ markAllRead?: CourierMenuItem;
121
+ archiveAll?: CourierMenuItem;
122
+ archiveRead?: CourierMenuItem;
123
+ };
124
+ export type CourierInboxTheme = {
125
+ popup?: {
126
+ button?: CourierInboxMenuButton;
127
+ window?: {
128
+ backgroundColor?: string;
129
+ borderRadius?: string;
130
+ border?: string;
131
+ shadow?: string;
132
+ };
133
+ };
134
+ inbox?: {
135
+ header?: {
136
+ backgroundColor?: string;
137
+ shadow?: string;
138
+ filters?: {
139
+ font?: CourierInboxFont;
140
+ inbox?: CourierInboxFilterItem;
141
+ archive?: CourierInboxFilterItem;
142
+ unreadIndicator?: CourierInboxUnreadIndicator;
143
+ };
144
+ menus?: {
145
+ popup?: CourierInboxPopup;
146
+ filters?: CourierFilterMenu;
147
+ actions?: CourierActionMenu;
148
+ };
149
+ };
150
+ list?: {
151
+ backgroundColor?: string;
152
+ item?: CourierInboxListItem;
153
+ };
154
+ loading?: CourierInboxSkeletonLoadingState;
155
+ empty?: CourierInboxInfoState;
156
+ error?: CourierInboxInfoState;
157
+ };
158
+ };
159
+ export declare const defaultLightTheme: CourierInboxTheme;
160
+ export declare const defaultDarkTheme: CourierInboxTheme;
161
+ export declare const mergeTheme: (mode: SystemThemeMode, theme: CourierInboxTheme) => CourierInboxTheme;
@@ -0,0 +1,32 @@
1
+ import { InboxAction, InboxMessage } from '../../@trycourier/courier-js/src';
2
+ import { CourierInboxFeedType } from './feed-type';
3
+ export type CourierInboxHeaderFactoryProps = {
4
+ feedType: CourierInboxFeedType;
5
+ unreadCount: number;
6
+ messageCount: number;
7
+ };
8
+ export type CourierInboxStateLoadingFactoryProps = {
9
+ feedType: CourierInboxFeedType;
10
+ };
11
+ export type CourierInboxStateEmptyFactoryProps = {
12
+ feedType: CourierInboxFeedType;
13
+ };
14
+ export type CourierInboxStateErrorFactoryProps = {
15
+ feedType: CourierInboxFeedType;
16
+ error: Error;
17
+ };
18
+ export type CourierInboxListItemFactoryProps = {
19
+ message: InboxMessage;
20
+ index: number;
21
+ };
22
+ export type CourierInboxListItemActionFactoryProps = {
23
+ message: InboxMessage;
24
+ action: InboxAction;
25
+ index: number;
26
+ };
27
+ export type CourierInboxPaginationItemFactoryProps = {
28
+ feedType: CourierInboxFeedType;
29
+ };
30
+ export type CourierInboxMenuButtonFactoryProps = {
31
+ unreadCount: number;
32
+ };
@@ -0,0 +1 @@
1
+ export type CourierInboxFeedType = 'inbox' | 'archive';
@@ -0,0 +1,6 @@
1
+ import { InboxMessage } from '../../@trycourier/courier-js/src';
2
+ export type InboxDataSet = {
3
+ messages: InboxMessage[];
4
+ canPaginate: boolean;
5
+ paginationCursor: string | null;
6
+ };
@@ -0,0 +1,7 @@
1
+ import { InboxMessage } from '../../@trycourier/courier-js/src';
2
+ export declare function markAsRead(message: InboxMessage): Promise<void>;
3
+ export declare function markAsUnread(message: InboxMessage): Promise<void>;
4
+ export declare function clickMessage(message: InboxMessage): Promise<void>;
5
+ export declare function archiveMessage(message: InboxMessage): Promise<void>;
6
+ export declare function openMessage(message: InboxMessage): Promise<void>;
7
+ export declare function getMessageTime(message: InboxMessage): string;
@@ -0,0 +1 @@
1
+ export declare function replaceElementInShadowRoot(shadowRoot: ShadowRoot, elementId: string, newElement: HTMLElement): void;
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@trycourier/courier-ui-inbox",
3
+ "version": "1.0.0-beta",
4
+ "description": "Inbox components for the Courier web UI",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
+ "scripts": {
9
+ "dev": "vite",
10
+ "build": "vite build",
11
+ "watch": "vite build --watch",
12
+ "preview": "vite preview",
13
+ "prepare": "npm run build"
14
+ },
15
+ "keywords": [
16
+ "courier",
17
+ "ui",
18
+ "inbox",
19
+ "typescript",
20
+ "browser"
21
+ ],
22
+ "author": "Courier",
23
+ "license": "MIT",
24
+ "files": [
25
+ "dist"
26
+ ],
27
+ "peerDependencies": {
28
+ "@trycourier/courier-js": "file:../@trycourier/courier-js",
29
+ "@trycourier/courier-ui-core": "file:../@trycourier/courier-ui-core"
30
+ },
31
+ "devDependencies": {
32
+ "@trycourier/courier-js": "file:../@trycourier/courier-js",
33
+ "@trycourier/courier-ui-core": "file:../@trycourier/courier-ui-core"
34
+ }
35
+ }