react-native-notify-kit 9.7.0 → 10.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 (101) hide show
  1. package/README.md +71 -2
  2. package/RNNotifeeCore.podspec +2 -0
  3. package/cli/bin/react-native-notify-kit +2 -0
  4. package/cli/dist/cli.bundle.js +20834 -0
  5. package/cli/dist/cli.d.ts +2 -0
  6. package/cli/dist/cli.js +87 -0
  7. package/cli/dist/cli.js.map +1 -0
  8. package/cli/dist/commands/initNse.d.ts +12 -0
  9. package/cli/dist/commands/initNse.js +212 -0
  10. package/cli/dist/commands/initNse.js.map +1 -0
  11. package/cli/dist/lib/detectProject.d.ts +15 -0
  12. package/cli/dist/lib/detectProject.js +156 -0
  13. package/cli/dist/lib/detectProject.js.map +1 -0
  14. package/cli/dist/lib/logger.d.ts +4 -0
  15. package/cli/dist/lib/logger.js +24 -0
  16. package/cli/dist/lib/logger.js.map +1 -0
  17. package/cli/dist/lib/patchPodfile.d.ts +12 -0
  18. package/cli/dist/lib/patchPodfile.js +143 -0
  19. package/cli/dist/lib/patchPodfile.js.map +1 -0
  20. package/cli/dist/lib/patchXcodeProject.d.ts +25 -0
  21. package/cli/dist/lib/patchXcodeProject.js +239 -0
  22. package/cli/dist/lib/patchXcodeProject.js.map +1 -0
  23. package/cli/dist/lib/writeTemplates.d.ts +11 -0
  24. package/cli/dist/lib/writeTemplates.js +82 -0
  25. package/cli/dist/lib/writeTemplates.js.map +1 -0
  26. package/cli/dist/templates/Info.plist.tmpl +29 -0
  27. package/cli/dist/templates/NotificationService.swift.tmpl +32 -0
  28. package/cli/dist/templates/NotifyKitNSE.entitlements.tmpl +6 -0
  29. package/cli/dist/templates/templates/Info.plist.tmpl +29 -0
  30. package/cli/dist/templates/templates/NotificationService.swift.tmpl +73 -0
  31. package/cli/dist/templates/templates/NotifyKitNSE.entitlements.tmpl +6 -0
  32. package/dist/NotifeeApiModule.d.ts +17 -0
  33. package/dist/NotifeeApiModule.js +66 -1
  34. package/dist/NotifeeApiModule.js.map +1 -1
  35. package/dist/fcm/index.d.ts +4 -0
  36. package/dist/fcm/index.js +3 -0
  37. package/dist/fcm/index.js.map +1 -0
  38. package/dist/fcm/parseFcmPayload.d.ts +16 -0
  39. package/dist/fcm/parseFcmPayload.js +37 -0
  40. package/dist/fcm/parseFcmPayload.js.map +1 -0
  41. package/dist/fcm/reconstructNotification.d.ts +8 -0
  42. package/dist/fcm/reconstructNotification.js +167 -0
  43. package/dist/fcm/reconstructNotification.js.map +1 -0
  44. package/dist/fcm/types.d.ts +51 -0
  45. package/dist/fcm/types.js +6 -0
  46. package/dist/fcm/types.js.map +1 -0
  47. package/dist/index.d.ts +2 -0
  48. package/dist/index.js +1 -0
  49. package/dist/index.js.map +1 -1
  50. package/dist/types/Module.d.ts +21 -0
  51. package/dist/version.d.ts +1 -1
  52. package/dist/version.js +1 -1
  53. package/dist/version.js.map +1 -1
  54. package/package.json +38 -3
  55. package/server/README.md +129 -0
  56. package/server/dist/android.d.ts +8 -0
  57. package/server/dist/android.d.ts.map +1 -0
  58. package/server/dist/android.js +20 -0
  59. package/server/dist/android.js.map +1 -0
  60. package/server/dist/buildPayload.d.ts +3 -0
  61. package/server/dist/buildPayload.d.ts.map +1 -0
  62. package/server/dist/buildPayload.js +82 -0
  63. package/server/dist/buildPayload.js.map +1 -0
  64. package/server/dist/index.d.ts +6 -0
  65. package/server/dist/index.d.ts.map +1 -0
  66. package/server/dist/index.js +12 -0
  67. package/server/dist/index.js.map +1 -0
  68. package/server/dist/ios.d.ts +11 -0
  69. package/server/dist/ios.d.ts.map +1 -0
  70. package/server/dist/ios.js +61 -0
  71. package/server/dist/ios.js.map +1 -0
  72. package/server/dist/serialize.d.ts +11 -0
  73. package/server/dist/serialize.d.ts.map +1 -0
  74. package/server/dist/serialize.js +32 -0
  75. package/server/dist/serialize.js.map +1 -0
  76. package/server/dist/types.d.ts +2 -0
  77. package/server/dist/types.d.ts.map +1 -0
  78. package/server/dist/types.js +3 -0
  79. package/server/dist/types.js.map +1 -0
  80. package/server/dist/validation.d.ts +3 -0
  81. package/server/dist/validation.d.ts.map +1 -0
  82. package/server/dist/validation.js +101 -0
  83. package/server/dist/validation.js.map +1 -0
  84. package/server/package.json +5 -0
  85. package/server/src/android.ts +27 -0
  86. package/server/src/buildPayload.ts +91 -0
  87. package/server/src/index.ts +12 -0
  88. package/server/src/ios.ts +88 -0
  89. package/server/src/serialize.ts +39 -0
  90. package/server/src/types.ts +24 -0
  91. package/server/src/validation.ts +134 -0
  92. package/server/tsconfig.json +25 -0
  93. package/src/NotifeeApiModule.ts +80 -1
  94. package/src/fcm/index.ts +4 -0
  95. package/src/fcm/parseFcmPayload.ts +56 -0
  96. package/src/fcm/reconstructNotification.ts +201 -0
  97. package/src/fcm/types.ts +57 -0
  98. package/src/index.ts +2 -0
  99. package/src/internal/fcmContract.d.ts +150 -0
  100. package/src/types/Module.ts +23 -0
  101. package/src/version.ts +1 -1
package/README.md CHANGED
@@ -135,10 +135,30 @@ useEffect(() => {
135
135
  }, []);
136
136
  ```
137
137
 
138
+ ## Notifee FCM Mode (NEW in 10.0.0)
139
+
140
+ **Use `react-native-notify-kit` as the sole FCM display layer on both Android and iOS** — one developer API, no duplicate notifications on Android, no silent-push drops on iOS. Ship a server SDK payload, let the client handle it in one line, and scaffold the iOS Notification Service Extension with a single CLI command:
141
+
142
+ ```bash
143
+ # server: build the payload
144
+ import { buildNotifyKitPayload } from 'react-native-notify-kit/server';
145
+ await admin.messaging().send(buildNotifyKitPayload({ token, notification: { title, body, android, ios } }));
146
+
147
+ # client (Android + iOS): one line in setBackgroundMessageHandler / onMessage
148
+ await notifee.handleFcmMessage(remoteMessage);
149
+
150
+ # iOS NSE scaffold
151
+ npx react-native-notify-kit init-nse && cd ios && pod install
152
+ ```
153
+
154
+ See the full guide: **[docs/fcm-mode.md](docs/fcm-mode.md)** — covers architecture, server SDK reference, client API, NSE setup, payload schema, migration, troubleshooting, and known limitations.
155
+
138
156
  ## Push Notifications (Firebase)
139
157
 
140
158
  This library handles notification **display and management**. For receiving push notifications, pair it with [`@react-native-firebase/messaging`](https://rnfirebase.io/messaging/usage):
141
159
 
160
+ > **New in 10.0.0:** for a turnkey FCM integration that handles both platforms (no duplicate on Android, APNs-reliable on iOS), use **[Notifee FCM Mode](docs/fcm-mode.md)** instead of the manual pattern below. The sections that follow still apply for basic Firebase setup (google-services plugin, permissions, APNs capability).
161
+
142
162
  ### Android setup
143
163
 
144
164
  1. Add Firebase dependencies to your app:
@@ -196,7 +216,22 @@ messaging().onMessage(async remoteMessage => {
196
216
 
197
217
  ## iOS Notification Service Extension
198
218
 
199
- To modify push notification content before display (e.g., attach images), create a Notification Service Extension:
219
+ To modify push notification content before display (e.g., attach images), create a Notification Service Extension.
220
+
221
+ ### Automated setup (recommended)
222
+
223
+ From your project root, with `react-native-notify-kit` installed:
224
+
225
+ ```bash
226
+ npx react-native-notify-kit init-nse
227
+ cd ios && pod install
228
+ ```
229
+
230
+ The CLI scaffolds a Swift NSE target (default name: `NotifyKitNSE`), patches your Podfile, and wires `.pbxproj`. Open your `.xcworkspace` in Xcode, verify the NSE target's signing, and build. See [docs/fcm-mode.md#ios-nse-setup](docs/fcm-mode.md#ios-nse-setup) for the full CLI reference (target name, bundle suffix, `--dry-run`, `--force`).
231
+
232
+ ### Manual setup
233
+
234
+ For Expo, monorepos with non-standard iOS paths, or heavily-customized Xcode configurations where the CLI can't patch the project cleanly:
200
235
 
201
236
  1. In Xcode: **File > New > Target > Notification Service Extension**
202
237
  2. Add to your Podfile:
@@ -234,6 +269,40 @@ To modify push notification content before display (e.g., attach images), create
234
269
 
235
270
  5. Run `cd ios && pod install`
236
271
 
272
+ ## Server SDK
273
+
274
+ `react-native-notify-kit` ships a **zero-dependency server SDK** under the `/server` subpath, for building FCM HTTP v1 payloads that the client `handleFcmMessage` handler consumes. Runs in Node.js 22+ and Firebase Cloud Functions.
275
+
276
+ ```ts
277
+ import { buildNotifyKitPayload } from 'react-native-notify-kit/server';
278
+ import * as admin from 'firebase-admin';
279
+
280
+ const message = buildNotifyKitPayload({
281
+ token: '<device FCM token>',
282
+ notification: {
283
+ id: 'order-42',
284
+ title: 'Your order is on the way',
285
+ body: 'Tap to see live tracking',
286
+ data: { orderId: '42' },
287
+ android: { channelId: 'orders', smallIcon: 'ic_notification' },
288
+ ios: { sound: 'default', interruptionLevel: 'timeSensitive' },
289
+ },
290
+ options: { androidPriority: 'high', ttl: 3600 },
291
+ });
292
+
293
+ await admin.messaging().send(message);
294
+ ```
295
+
296
+ Full reference: [docs/fcm-mode.md#server-sdk-reference](docs/fcm-mode.md#server-sdk-reference) (types, validation rules, payload shape, FCM 4 KB limit).
297
+
298
+ ## CLI Tools
299
+
300
+ The library ships a small CLI at `npx react-native-notify-kit`. Currently one command is available:
301
+
302
+ - `npx react-native-notify-kit init-nse` — scaffolds an iOS Notification Service Extension (Swift), patches the Podfile, and wires `.pbxproj`. See [docs/fcm-mode.md#ios-nse-setup](docs/fcm-mode.md#ios-nse-setup) for options.
303
+
304
+ The CLI is prepacked into the main package at publish time, so `npx react-native-notify-kit` works immediately after `yarn add react-native-notify-kit` — no separate install.
305
+
237
306
  ## Jest Testing
238
307
 
239
308
  Mock the native module in your Jest setup file:
@@ -688,7 +757,7 @@ The script runs the macrobenchmark test in `apps/smoke/android/baselineprofile/`
688
757
 
689
758
  ## Documentation
690
759
 
691
- The upstream Notifee documentation remains the best reference for the public API and platform guides used by this fork.
760
+ The full `react-native-notify-kit` documentation is hosted on docs.page and is kept in sync with this repo. It covers the public API, platform guides, FCM Mode, the server SDK, and the `init-nse` CLI.
692
761
 
693
762
  - [Overview](https://docs.page/marcocrupi/react-native-notify-kit/react-native/overview)
694
763
  - [Reference](https://docs.page/marcocrupi/react-native-notify-kit/react-native/reference)
@@ -16,6 +16,8 @@ Pod::Spec.new do |s|
16
16
 
17
17
  s.cocoapods_version = '>= 1.10.0'
18
18
  s.ios.deployment_target = '15.1'
19
+ s.module_name = 'RNNotifeeCore'
20
+ s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
19
21
 
20
22
  if defined?($NotifeeCoreFromSources) && $NotifeeCoreFromSources == true
21
23
  # internal dev flag used by Notifee devs, ignore
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('../dist/cli.js');