@trycourier/courier-react 8.0.4-beta → 8.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/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # @trycourier/courier-js
1
+ # @trycourier/courier-react
2
2
 
3
- The base API client and shared instance singleton for Courier's JavaScript Browser SDK.
3
+ React UI components used to create an Inbox
4
4
 
5
5
  ## Installation
6
6
 
7
- ```ts
8
- npm i @trycourier/courier-react@8.0.2-beta
7
+ ```bash
8
+ npm i @trycourier/courier-react@8.0.6-beta
9
9
  ```
10
10
 
11
11
  ## Usage
@@ -26,10 +26,146 @@ function App() {
26
26
  }, []);
27
27
 
28
28
  return (
29
- <CourierInbox />
29
+ <CourierInbox
30
+ onMessageClick={(props) => {
31
+ console.log(props);
32
+ }}
33
+ onMessageActionClick={(props) => {
34
+ console.log(props);
35
+ }}
36
+ onMessageLongPress={(props) => {
37
+ console.log(props);
38
+ }}
39
+ />
40
+
41
+ // or
42
+
43
+ <CourierInboxMenu
44
+ onMessageClick={(props) => {
45
+ console.log(props);
46
+ }}
47
+ onMessageActionClick={(props) => {
48
+ console.log(props);
49
+ }}
50
+ onMessageLongPress={(props) => {
51
+ console.log(props);
52
+ }}
53
+ />
30
54
  );
31
55
 
32
56
  }
33
57
 
34
58
  export default App;
35
- ```
59
+ ```
60
+
61
+ ## Theme Customization
62
+
63
+ This allows you to style the prebuilt `<CourierInbox/>`. Tons of options live inside `CourierInboxTheme`. Command click in to see all options!
64
+
65
+ ```ts
66
+ import { CourierInboxTheme } from '@trycourier/courier-ui-inbox';
67
+
68
+ const theme: CourierInboxTheme = {
69
+ popup: {
70
+ button: {
71
+ unreadIndicator: {
72
+ backgroundColor: '#9b4dca',
73
+ ...
74
+ }
75
+ },
76
+ window: {
77
+ ...
78
+ }
79
+ },
80
+ inbox: {
81
+ header: {
82
+ filters: {
83
+ unreadIndicator: {
84
+ backgroundColor: '#9b4dca',
85
+ ...
86
+ }
87
+ }
88
+ },
89
+ list: {
90
+ item: {
91
+ unreadIndicatorColor: '#9b4dca',
92
+ ...
93
+ }
94
+ }
95
+ }
96
+ };
97
+
98
+ ...
99
+
100
+ <CourierInbox
101
+ height={'456px'}
102
+ mode='system'
103
+ feedType='archive'
104
+ lightTheme={theme}
105
+ darkTheme={theme}
106
+ />
107
+
108
+ // or
109
+
110
+ <CourierInboxMenu
111
+ popupAlignment='top-left'
112
+ popupWidth='456px'
113
+ popupHeight='456px'
114
+ mode='system'
115
+ feedType='archive'
116
+ />
117
+
118
+ ```
119
+
120
+ ## Fully Custom UI Elements
121
+
122
+ You can change any element in the Inbox to be custom. Here are the available options.
123
+
124
+ ```ts
125
+ <CourierInbox
126
+ renderHeader={(props) => {
127
+ return <div>...</div>
128
+ }}
129
+ renderListItem={(props) => {
130
+ return <div>...</div>
131
+ }}
132
+ renderEmptyState={(props) => {
133
+ return <div>...</div>
134
+ }}
135
+ renderErrorState={(props) => {
136
+ return <div>...</div>
137
+ }}
138
+ renderLoadingState={(props) => {
139
+ return <div>...</div>
140
+ }}
141
+ renderPaginationItem={(props) => {
142
+ return <div>...</div>
143
+ }}
144
+ />
145
+
146
+ // or
147
+
148
+ <CourierInboxMenu
149
+ renderPopupMenuButton={(props) => {
150
+ return <div>...</div>
151
+ }}
152
+ renderPopupHeader={(props) => {
153
+ return <div>...</div>
154
+ }}
155
+ renderPopupListItem={(props) => {
156
+ return <div>...</div>
157
+ }}
158
+ renderPopupEmptyState={(props) => {
159
+ return <div>...</div>
160
+ }}
161
+ renderPopupLoadingState={(props) => {
162
+ return <div>...</div>
163
+ }}
164
+ renderPopupErrorState={(props) => {
165
+ return <div>...</div>
166
+ }}
167
+ renderPopupPaginationItem={(props) => {
168
+ return <div>...</div>
169
+ }}
170
+ />
171
+ ```
@@ -19,6 +19,8 @@ type InboxHooks = {
19
19
  clickMessage: (message: InboxMessage) => Promise<void>;
20
20
  archiveMessage: (message: InboxMessage) => Promise<void>;
21
21
  openMessage: (message: InboxMessage) => Promise<void>;
22
+ unarchiveMessage: (message: InboxMessage) => Promise<void>;
23
+ readAllMessages: () => Promise<void>;
22
24
  inbox?: InboxDataSet;
23
25
  archive?: InboxDataSet;
24
26
  unreadCount?: number;