@rajeev02/notify 0.1.0 → 0.2.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 (2) hide show
  1. package/README.md +146 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,146 @@
1
+ # @rajeev02/notify
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@rajeev02/notify.svg)](https://www.npmjs.com/package/@rajeev02/notify)
4
+ [![license](https://img.shields.io/npm/l/@rajeev02/notify.svg)](https://github.com/Rajeev02/rajeev-sdk/blob/main/LICENSE)
5
+
6
+ **Unified notification layer** with cross-platform scheduling, priority-based delivery, quiet hours, grouped channels, and an in-app notification inbox.
7
+
8
+ Part of [Rajeev SDK](https://github.com/Rajeev02/rajeev-sdk) — cross-platform infrastructure libraries for building apps that work everywhere.
9
+
10
+ ## Why use this?
11
+
12
+ - **One API for all platforms** — Schedule local/push notifications with a single call. Platform-specific config (APNs, FCM, Web Push) is handled via overrides.
13
+ - **Smart scheduling** — Quiet hours, repeat intervals (daily/weekly/monthly), timezone-aware delivery
14
+ - **Priority system** — Critical, high, normal, low — with platform-appropriate behavior
15
+ - **In-app inbox** — Built-in notification inbox with read/unread, categories, actions, and persistence
16
+ - **Channel management** — Grouped notification channels for Android (auto-created), categories for iOS
17
+ - **Pure TypeScript** — No native dependencies. Drop in and use immediately.
18
+
19
+ ## Platform Support
20
+
21
+ | Platform | Engine | Status |
22
+ | -------- | ---------- | ------ |
23
+ | iOS | TypeScript | ✅ |
24
+ | Android | TypeScript | ✅ |
25
+ | Web | TypeScript | ✅ |
26
+ | watchOS | TypeScript | ✅ |
27
+ | Wear OS | TypeScript | ✅ |
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ npm install @rajeev02/notify
33
+ ```
34
+
35
+ ### Peer Dependencies
36
+
37
+ - `react` >= 18.3.0
38
+ - `react-native` >= 0.84.0 _(optional)_
39
+
40
+ ## Quick Start
41
+
42
+ ### Schedule Notifications
43
+
44
+ ```typescript
45
+ import { NotificationScheduler } from "@rajeev02/notify";
46
+
47
+ const scheduler = new NotificationScheduler();
48
+
49
+ // Schedule a daily reminder
50
+ scheduler.schedule({
51
+ id: "meditation-001",
52
+ title: "Time to meditate 🧘",
53
+ body: "Your daily 10-minute session awaits",
54
+ priority: "normal",
55
+ schedule: { at: "2026-02-08T07:00:00", repeat: "day" },
56
+ });
57
+
58
+ // Schedule with platform-specific overrides
59
+ scheduler.schedule({
60
+ id: "payment-received",
61
+ title: "Payment received",
62
+ body: "₹5,000 from Rajeev",
63
+ priority: "high",
64
+ platform: {
65
+ ios: {
66
+ sound: "payment.wav",
67
+ badge: 1,
68
+ categoryId: "payments",
69
+ threadId: "transactions",
70
+ },
71
+ android: {
72
+ channelId: "payments",
73
+ smallIcon: "ic_payment",
74
+ color: "#10B981",
75
+ autoCancel: true,
76
+ },
77
+ },
78
+ });
79
+
80
+ // Cancel or manage
81
+ scheduler.cancel("meditation-001");
82
+ const pending = scheduler.getPending();
83
+ ```
84
+
85
+ ### In-App Inbox
86
+
87
+ ```typescript
88
+ import { NotificationInbox } from "@rajeev02/notify";
89
+
90
+ const inbox = new NotificationInbox();
91
+
92
+ // Add notifications to inbox
93
+ inbox.add({
94
+ id: "msg-001",
95
+ title: "Order shipped!",
96
+ body: "Your order #1234 is on its way",
97
+ category: "orders",
98
+ actions: [
99
+ { id: "track", label: "Track Order" },
100
+ { id: "details", label: "View Details" },
101
+ ],
102
+ });
103
+
104
+ // Query inbox
105
+ const unread = inbox.getUnread();
106
+ const orders = inbox.getByCategory("orders");
107
+ const count = inbox.getUnreadCount(); // → 1
108
+
109
+ // Mark as read
110
+ inbox.markRead("msg-001");
111
+ inbox.markAllRead();
112
+ ```
113
+
114
+ ## API Reference
115
+
116
+ ### `NotificationScheduler`
117
+
118
+ | Method | Returns | Description |
119
+ | -------------------------- | ------------------------- | ----------------------------------------- |
120
+ | `schedule(notification)` | `string` | Schedule a notification, returns ID |
121
+ | `cancel(id)` | `void` | Cancel a scheduled notification |
122
+ | `cancelAll()` | `void` | Cancel all scheduled notifications |
123
+ | `getPending()` | `ScheduledNotification[]` | List all pending notifications |
124
+ | `reschedule(id, schedule)` | `void` | Update schedule for existing notification |
125
+
126
+ ### `NotificationInbox`
127
+
128
+ | Method | Returns | Description |
129
+ | -------------------- | --------------------- | --------------------- |
130
+ | `add(notification)` | `void` | Add to inbox |
131
+ | `remove(id)` | `void` | Remove from inbox |
132
+ | `markRead(id)` | `void` | Mark as read |
133
+ | `markAllRead()` | `void` | Mark all as read |
134
+ | `getAll()` | `InboxNotification[]` | Get all inbox items |
135
+ | `getUnread()` | `InboxNotification[]` | Get unread items |
136
+ | `getByCategory(cat)` | `InboxNotification[]` | Filter by category |
137
+ | `getUnreadCount()` | `number` | Count of unread items |
138
+ | `clear()` | `void` | Clear entire inbox |
139
+
140
+ ## Full Documentation
141
+
142
+ 📖 [Complete API docs with platform-specific examples](https://github.com/Rajeev02/rajeev-sdk/blob/main/docs/usage/NOTIFY.md)
143
+
144
+ ## License
145
+
146
+ MIT © 2026 [Rajeev Kumar Joshi](https://rajeev02.github.io)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rajeev02/notify",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Unified notification & messaging layer for React Native — local, push, in-app inbox, cross-device sync",
5
5
  "main": "lib/index.js",
6
6
  "author": "Rajeev Kumar Joshi <rajeevjoshi91@gmail.com> (https://rajeev02.github.io)",