Skip to content

Commit 79137d1

Browse files
Aviatorscode2coderabbitai[bot]DianaHackmamba
authored
Docs for the inbox Schedule page (#976)
* Docs for the inbox Schedule page * Upate styling docs with Schdedule feature * Update content/docs/platform/inbox/features/schedule.mdx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Create docs for the useSchedule in React SDK * Update content/docs/platform/inbox/configuration/styling.mdx Co-authored-by: DianaHackmamba <[email protected]> * Update content/docs/platform/inbox/features/schedule.mdx Co-authored-by: DianaHackmamba <[email protected]> * Update content/docs/platform/inbox/features/schedule.mdx Co-authored-by: DianaHackmamba <[email protected]> * Update content/docs/platform/sdks/react/hooks/use-schedule.mdx Co-authored-by: DianaHackmamba <[email protected]> * Update base on feedback * Update content/docs/platform/inbox/features/schedule.mdx Co-authored-by: DianaHackmamba <[email protected]> * Update the docs for JS SDK * Update based on feedback --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: DianaHackmamba <[email protected]>
1 parent 47d0ab1 commit 79137d1

File tree

13 files changed

+542
-3
lines changed

13 files changed

+542
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"title": "Customize and configure",
33
"icon": "SlidersHorizontal",
4-
"pages": ["styling", "icons", "tabs", "preferences", "snooze", "data-object"],
4+
"pages": ["styling", "icons", "tabs", "preferences", "data-object"],
55
"description": "Learn how to configure your inbox with styling, tabs, preferences, data objects, and snooze functionality"
66
}

content/docs/platform/inbox/configuration/styling.mdx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,14 @@ Here's a list of some available elements that can be styled using the elements o
160160
| Snooze button | `notificationSnooze__button` |
161161
| Unread/read indicator button | `notificationUnread__button` |
162162
| Notification list container | `notificationList` |
163+
| Schedule container | `scheduleContainer` |
164+
| Schedule header | `scheduleHeader` |
165+
| Schedule body | `scheduleBody` |
166+
| Schedule table | `scheduleTable` |
167+
| Day schedule copy title | `dayScheduleCopyTitle` |
168+
| Day schedule copy menu | `dayScheduleCopy__dropdownContent` |
169+
| Time select drop-down list | `timeSelect__dropdownTrigger` |
170+
| Time select list | `timeSelect__dropdownContent` |
163171

164172
<Callout type="info" title="How to find other elements?">
165173
Any selector that appears before the 🔔 emoji in the Devtools, can be targeted via the elements property in the appearance prop (stripping the `nv-` prefix). You can also use TS autocomplete to find the available elements.
@@ -352,6 +360,31 @@ You can customize specific parts of the Inbox UI by providing callback functions
352360
| `notificationDeliveredAt__icon` | `(context: { notification: Notification }) => string` |
353361
| `notificationSnoozedUntil__icon` | `(context: { notification: Notification }) => string` |
354362
| `notificationDot` | `(context: { notification: Notification }) => string` |
363+
| **Schedule** | |
364+
| `scheduleContainer` | `(context: { schedule?: Schedule }) => string` |
365+
| `scheduleHeader` | `(context: { schedule?: Schedule }) => string` |
366+
| `scheduleLabelContainer` | `(context: { schedule?: Schedule }) => string` |
367+
| `scheduleLabelIcon` | `(context: { schedule?: Schedule }) => string` |
368+
| `scheduleLabel` | `(context: { schedule?: Schedule }) => string` |
369+
| `scheduleActionsContainer` | `(context: { schedule?: Schedule }) => string` |
370+
| `scheduleActionsContainerRight` | `(context: { schedule?: Schedule }) => string` |
371+
| `scheduleBody` | `(context: { schedule?: Schedule }) => string` |
372+
| `scheduleDescription` | `(context: { schedule?: Schedule }) => string` |
373+
| `scheduleTable` | `(context: { schedule?: Schedule }) => string` |
374+
| `scheduleTableHeader` | `(context: { schedule?: Schedule }) => string` |
375+
| `scheduleHeaderColumn` | `(context: { schedule?: Schedule }) => string` |
376+
| `scheduleTableBody` | `(context: { schedule?: Schedule }) => string` |
377+
| `scheduleBodyRow` | `(context: { schedule?: Schedule }) => string` |
378+
| `scheduleBodyColumn` | `(context: { schedule?: Schedule }) => string` |
379+
| `scheduleInfoContainer` | `(context: { schedule?: Schedule }) => string` |
380+
| `scheduleInfoIcon` | `(context: { schedule?: Schedule }) => string` |
381+
| `scheduleInfo` | `(context: { schedule?: Schedule }) => string` |
382+
| **Day Schedule Copy** | |
383+
| `dayScheduleCopyTitle` | `(context: { schedule?: Schedule }) => string` |
384+
| `dayScheduleCopyIcon` | `(context: { schedule?: Schedule }) => string` |
385+
| `dayScheduleCopySelectAll` | `(context: { schedule?: Schedule }) => string` |
386+
| `dayScheduleCopyDay` | `(context: { schedule?: Schedule }) => string` |
387+
| `dayScheduleCopyFooterContainer` | `(context: { schedule?: Schedule }) => string` |
355388

356389
</Accordion>
357390
</Accordions>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"title": "<Inbox /> Features",
3+
"icon": "Blocks",
4+
"pages": ["snooze", "schedule"],
5+
"description": "Learn how to customize the appearance and behavior of the inbox component to match your application’s design system."
6+
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
title: 'Schedule'
3+
description: "Learn how subscribers can use the Schedule feature in the Inbox component to control when they receive notifications from email, SMS and push channels."
4+
icon: 'CalendarCheck'
5+
---
6+
7+
The **Schedule** feature in the <Method href="/platform/inbox/overview">{`<Inbox />`}</Method> lets subscribers control when they want to receive notifications from email, SMS, and push channels.
8+
9+
By defining their hours of availability from the <Method href="/platform/inbox/overview">{`<Inbox />`}</Method> UI, subscribers can automatically skip notifications outside of their chosen time range.
10+
11+
![](/images/inbox/schedule.png)
12+
13+
<Callout>In-app notifications and notifications from critical workflows are never paused and will always be delivered, regardless of schedule settings.</Callout>
14+
15+
## How scheduling works
16+
17+
The schedule functionality is based on a clear set of rules controlled by the subscriber within the <Method href="/platform/inbox/overview">{`<Inbox />`}</Method>. When a subscriber enables their schedule, they can then manage their availability for each day of the week.
18+
19+
### Daily availability
20+
For any day that the main schedule is active, there will be two possible states:
21+
22+
- **Day is enabled**: If a day is toggled on, then the subscriber must set a time range. Notifications will only be delivered within these hours.
23+
24+
- **Day is disabled**: If a day is toggled off, then the subscriber will not receive any non-critical notifications for that entire day.
25+
26+
### Automatic timezone handling
27+
28+
The schedule operates in the subscriber's local timezone, detected automatically from their system settings. There is no need for manual configuration.
29+
30+
For example, if a subscriber in Warsaw sets their schedule from 9:00 AM to 5:00 PM, they will receive notifications during those hours in Central European Time (CET).
31+
32+
## Manage Schedule
33+
34+
The schedule UI in the preferences section is designed to be intuitive, giving subscribers several tools to quickly configure their availability.
35+
36+
You can access **Schedule** from the **Preferences** section of the <Method href="/platform/inbox/overview">{`<Inbox />`}</Method> UI. By default, scheduling is turned off, and all notifications will be delivered normally.
37+
38+
![Manage schedule](/images/inbox/inbox-schedule.png)
39+
40+
### Enable the main schedule
41+
42+
The entire feature is controlled by a main schedule toggle. When a subscriber turns this on, they can begin configuring individual days. When it's off, all other settings will be inactive, and notifications will be delivered normally.
43+
44+
### Setting daily availability
45+
46+
For each day of the week, the subscriber can:
47+
48+
- Use the toggle next to the day's name to activate or deactivate it.
49+
- If activated, use the time-selector menus to set a "from" and "to" time. The time pickers are set to 30-minute increments for ease of use.
50+
51+
### Edit or remove schedules
52+
53+
Existing availability can be adjusted at any time. Subscribers can:
54+
- Change the start and end times for a day.
55+
- Re-enable a previously disabled day.
56+
- Clear a schedule entirely to return to unrestricted delivery.
57+
58+
### Copying times to multiple days
59+
60+
To make setup faster, subscribers can configure the time for one day and apply it to others in a few clicks:
61+
62+
1. Set the desired time range for a single day.
63+
2. Click **Copy times to...** associated with that day.
64+
3. In the menu that appears, select the other days of the week to apply this schedule to.
65+
4. Click "Apply." The selected days will automatically be enabled and updated with the new time range.
66+
67+
![Copying times to multiple days](/images/inbox/schedule.gif)
68+
69+
### Automatic saving
70+
71+
All changes made in the schedule interface will be saved automatically in the background. The UI updates optimistically, providing a seamless experience without requiring the subscriber to click save.
72+
73+
## Set default schedule for Subscribers
74+
75+
You can provide a default schedule for your subscribers by passing the `defaultSchedule` prop to the <Method href="/platform/inbox/overview">{`<Inbox />`}</Method>. This is useful for pre-configuring a recommended schedule that your subscribers can then customize.
76+
77+
This default schedule only applies if a subscriber has not yet configured their own schedule. Once they make any changes, their custom schedule takes precedence.
78+
79+
```tsx
80+
import { Inbox } from '@novu/react';
81+
82+
function InboxWithDefaultSchedule() {
83+
return (
84+
<Inbox
85+
applicationIdentifier="YOUR_APP_IDENTIFIER"
86+
subscriberId="YOUR_SUBSCRIBER_ID"
87+
defaultSchedule={{
88+
isEnabled: true,
89+
weeklySchedule: {
90+
tuesday: {
91+
isEnabled: true,
92+
hours: [{start: '09:00 AM', end: '07:00 PM'}]
93+
}
94+
}
95+
}}
96+
/>
97+
);
98+
}
99+
100+
export default InboxWithDefaultSchedule;
101+
```
File renamed without changes.

content/docs/platform/inbox/meta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"pages": [
33
"overview",
44
"setup-inbox",
5-
"navigation-and-events",
5+
"features",
66
"configuration",
77
"advanced-customization",
88
"advanced-concepts",

content/docs/platform/sdks/javascript/index.mdx

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,64 @@ The response will be of type:
466466
}
467467
}} />
468468

469+
470+
### Schedule
471+
472+
The `preferences.schedule` submodule lets you fetch and update a subscriber’s delivery schedule.
473+
474+
#### get
475+
476+
Fetches the subscriber’s schedule.
477+
478+
```tsx
479+
const novu = new Novu(...);
480+
481+
const { data: { schedule } } = await novu.preferences.schedule.get();
482+
```
483+
484+
#### update
485+
486+
Updates the subscriber’s schedule. You can update the entire weekly schedule or only specific days.
487+
488+
```tsx
489+
const novu = new Novu(...);
490+
491+
// Update schedule via preferences
492+
const { data: { schedule } } = await novu.preferences.schedule.update({
493+
weeklySchedule: {
494+
monday: {
495+
isEnabled: true,
496+
hours: [{ start: '09:00 AM', end: '05:00 PM' }],
497+
},
498+
},
499+
});
500+
501+
// Or update directly from a Schedule instance
502+
const { data: { schedule: updatedSchedule } } =
503+
await schedule.update({ isEnabled: false });
504+
```
505+
506+
### Schedule Class
507+
508+
A `Schedule` instance is returned when fetching or updating a schedule.
509+
510+
<TypeTable name="Schedule" type={{
511+
"isEnabled": {
512+
"description": "Whether the schedule is active",
513+
"type": "boolean"
514+
},
515+
"weeklySchedule": {
516+
"description": "A map of days with availability settings",
517+
"type": "WeeklySchedule"
518+
},
519+
"update": {
520+
"description": "Update the schedule with partial data",
521+
"type": "(schedule: Partial<WeeklySchedule>) => Result<Schedule>"
522+
}
523+
}}
524+
/>
525+
526+
469527
## Events
470528

471529
The Novu client provides real-time event handling through WebSocket connections.
@@ -475,6 +533,10 @@ The Novu client provides real-time event handling through WebSocket connections.
475533
- `notifications.notification_received`: Triggered when a new notification is received
476534
- `notifications.unread_count_changed`: Triggered when the unread count changes
477535
- `notifications.unseen_count_changed`: Triggered when the unseen count changes
536+
- `preferences.schedule.get.pending`: Triggered when fetching a schedule starts
537+
- `preferences.schedule.get.resolved`: Triggered when fetching a schedule succeeds
538+
- `preferences.schedule.update.pending`: Triggered when updating a schedule starts
539+
- `preferences.schedule.update.resolved`: Triggered when updating a schedule succeeds
478540

479541
### Usage
480542

@@ -496,6 +558,10 @@ novu.on('notifications.unread_count_changed', (data) => {
496558
novu.on('notifications.unseen_count_changed', (data) => {
497559
console.log('Unseen count:', data);
498560
});
561+
562+
novu.on('preferences.schedule.update.resolved', ({ data }) => {
563+
console.log('Schedule updated:', data.schedule);
564+
});
499565
```
500566

501567
## Types
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
{
2-
"pages": ["novu-provider", "use-novu", "use-notifications", "use-counts", "use-preferences"]
2+
"pages": [
3+
"novu-provider",
4+
"use-novu",
5+
"use-notifications",
6+
"use-counts",
7+
"use-preferences",
8+
"use-schedule"
9+
]
310
}

0 commit comments

Comments
 (0)