react-native-notification-sdk 1.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 (103) hide show
  1. package/README.md +3082 -0
  2. package/dist/NotificationSDK.d.ts +6 -0
  3. package/dist/NotificationSDK.d.ts.map +1 -0
  4. package/dist/background/BackgroundHandler.d.ts +7 -0
  5. package/dist/background/BackgroundHandler.d.ts.map +1 -0
  6. package/dist/background/registerBackgroundHandler.d.ts +5 -0
  7. package/dist/background/registerBackgroundHandler.d.ts.map +1 -0
  8. package/dist/constants/SDK.d.ts +2 -0
  9. package/dist/constants/SDK.d.ts.map +1 -0
  10. package/dist/core/NotificationManager.d.ts +28 -0
  11. package/dist/core/NotificationManager.d.ts.map +1 -0
  12. package/dist/core/NotificationSDK.d.ts +25 -0
  13. package/dist/core/NotificationSDK.d.ts.map +1 -0
  14. package/dist/core/SDKContainer.d.ts +16 -0
  15. package/dist/core/SDKContainer.d.ts.map +1 -0
  16. package/dist/errors/FirebaseInitializationError.d.ts +5 -0
  17. package/dist/errors/FirebaseInitializationError.d.ts.map +1 -0
  18. package/dist/errors/InvalidNotificationError.d.ts +5 -0
  19. package/dist/errors/InvalidNotificationError.d.ts.map +1 -0
  20. package/dist/errors/NotifeeInitializationError.d.ts +5 -0
  21. package/dist/errors/NotifeeInitializationError.d.ts.map +1 -0
  22. package/dist/errors/NotificationSDKError.d.ts +4 -0
  23. package/dist/errors/NotificationSDKError.d.ts.map +1 -0
  24. package/dist/errors/PermissionDeniedError.d.ts +5 -0
  25. package/dist/errors/PermissionDeniedError.d.ts.map +1 -0
  26. package/dist/errors/SDKNotInitializedError.d.ts +5 -0
  27. package/dist/errors/SDKNotInitializedError.d.ts.map +1 -0
  28. package/dist/errors/index.d.ts +7 -0
  29. package/dist/errors/index.d.ts.map +1 -0
  30. package/dist/events/EventBus.d.ts +11 -0
  31. package/dist/events/EventBus.d.ts.map +1 -0
  32. package/dist/firebase/FirebaseListener.d.ts +28 -0
  33. package/dist/firebase/FirebaseListener.d.ts.map +1 -0
  34. package/dist/firebase/FirebaseService.d.ts +24 -0
  35. package/dist/firebase/FirebaseService.d.ts.map +1 -0
  36. package/dist/index.cjs +858 -0
  37. package/dist/index.cjs.map +1 -0
  38. package/dist/index.d.ts +228 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +853 -0
  41. package/dist/index.js.map +1 -0
  42. package/dist/interfaces/IEventManager.d.ts +18 -0
  43. package/dist/interfaces/IEventManager.d.ts.map +1 -0
  44. package/dist/interfaces/ILogger.d.ts +6 -0
  45. package/dist/interfaces/ILogger.d.ts.map +1 -0
  46. package/dist/logger/Logger.d.ts +9 -0
  47. package/dist/logger/Logger.d.ts.map +1 -0
  48. package/dist/logging/ConsoleLogger.d.ts +9 -0
  49. package/dist/logging/ConsoleLogger.d.ts.map +1 -0
  50. package/dist/mappers/NotificationMapper.d.ts +14 -0
  51. package/dist/mappers/NotificationMapper.d.ts.map +1 -0
  52. package/dist/notifee/NotifeeService.d.ts +52 -0
  53. package/dist/notifee/NotifeeService.d.ts.map +1 -0
  54. package/dist/permissions/PermissionService.d.ts +35 -0
  55. package/dist/permissions/PermissionService.d.ts.map +1 -0
  56. package/dist/sdk/NotificationContainer.d.ts +16 -0
  57. package/dist/sdk/NotificationContainer.d.ts.map +1 -0
  58. package/dist/sdk/NotificationManager.d.ts +30 -0
  59. package/dist/sdk/NotificationManager.d.ts.map +1 -0
  60. package/dist/sdk/NotificationSDK.d.ts +29 -0
  61. package/dist/sdk/NotificationSDK.d.ts.map +1 -0
  62. package/dist/types/AndroidNotificationOptions.d.ts +12 -0
  63. package/dist/types/AndroidNotificationOptions.d.ts.map +1 -0
  64. package/dist/types/DisplayNotification.d.ts +37 -0
  65. package/dist/types/DisplayNotification.d.ts.map +1 -0
  66. package/dist/types/IOSNotificationOptions.d.ts +6 -0
  67. package/dist/types/IOSNotificationOptions.d.ts.map +1 -0
  68. package/dist/types/NotificationAction.d.ts +9 -0
  69. package/dist/types/NotificationAction.d.ts.map +1 -0
  70. package/dist/types/NotificationChannel.d.ts +11 -0
  71. package/dist/types/NotificationChannel.d.ts.map +1 -0
  72. package/dist/types/NotificationConfig.d.ts +47 -0
  73. package/dist/types/NotificationConfig.d.ts.map +1 -0
  74. package/dist/types/NotificationEvents.d.ts +30 -0
  75. package/dist/types/NotificationEvents.d.ts.map +1 -0
  76. package/dist/types/NotificationPayload.d.ts +15 -0
  77. package/dist/types/NotificationPayload.d.ts.map +1 -0
  78. package/dist/types/NotificationSDKStatus.d.ts +11 -0
  79. package/dist/types/NotificationSDKStatus.d.ts.map +1 -0
  80. package/dist/types/NotificationTrigger.d.ts +20 -0
  81. package/dist/types/NotificationTrigger.d.ts.map +1 -0
  82. package/dist/types/PermissionStatus.d.ts +2 -0
  83. package/dist/types/PermissionStatus.d.ts.map +1 -0
  84. package/dist/types/ScheduledNotification.d.ts +6 -0
  85. package/dist/types/ScheduledNotification.d.ts.map +1 -0
  86. package/dist/types/index.d.ts +10 -0
  87. package/dist/types/index.d.ts.map +1 -0
  88. package/dist/utils/NotificationMapper.d.ts +14 -0
  89. package/dist/utils/NotificationMapper.d.ts.map +1 -0
  90. package/dist/validators/DisplayNotificationValidator.d.ts +5 -0
  91. package/dist/validators/DisplayNotificationValidator.d.ts.map +1 -0
  92. package/dist/validators/NotificationActionValidator.d.ts +5 -0
  93. package/dist/validators/NotificationActionValidator.d.ts.map +1 -0
  94. package/dist/validators/NotificationChannelValidator.d.ts +5 -0
  95. package/dist/validators/NotificationChannelValidator.d.ts.map +1 -0
  96. package/dist/validators/ScheduledNotificationValidator.d.ts +5 -0
  97. package/dist/validators/ScheduledNotificationValidator.d.ts.map +1 -0
  98. package/dist/validators/ValidationAssertions.d.ts +6 -0
  99. package/dist/validators/ValidationAssertions.d.ts.map +1 -0
  100. package/package.json +77 -0
  101. package/plugins/android/withMaven.js +22 -0
  102. package/plugins/app.plugin.js +7 -0
  103. package/plugins/ios/withModularHeaders.js +16 -0
@@ -0,0 +1,14 @@
1
+ import { FirebaseMessagingTypes } from "@react-native-firebase/messaging";
2
+ import { DisplayNotification } from "../types/DisplayNotification";
3
+ import { NotificationPayload } from "../types/NotificationPayload";
4
+ export declare class NotificationMapper {
5
+ /**
6
+ * Converts a Firebase RemoteMessage into the SDK NotificationPayload.
7
+ */
8
+ static fromRemoteMessage(remoteMessage: FirebaseMessagingTypes.RemoteMessage): NotificationPayload;
9
+ /**
10
+ * Converts NotificationPayload into DisplayNotification.
11
+ */
12
+ static toDisplayNotification(notification: NotificationPayload): DisplayNotification;
13
+ }
14
+ //# sourceMappingURL=NotificationMapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationMapper.d.ts","sourceRoot":"","sources":["../../src/utils/NotificationMapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAE1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,qBAAa,kBAAkB;IAC7B;;OAEG;IACH,MAAM,CAAC,iBAAiB,CACtB,aAAa,EAAE,sBAAsB,CAAC,aAAa,GAClD,mBAAmB;IA2BtB;;OAEG;IACH,MAAM,CAAC,qBAAqB,CAC1B,YAAY,EAAE,mBAAmB,GAChC,mBAAmB;CAQvB"}
@@ -0,0 +1,5 @@
1
+ import { DisplayNotification } from "../types";
2
+ export declare class DisplayNotificationValidator {
3
+ static validate(notification: DisplayNotification): void;
4
+ }
5
+ //# sourceMappingURL=DisplayNotificationValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DisplayNotificationValidator.d.ts","sourceRoot":"","sources":["../../src/validators/DisplayNotificationValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAM/C,qBAAa,4BAA4B;IACvC,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE,mBAAmB,GAAG,IAAI;CAazD"}
@@ -0,0 +1,5 @@
1
+ import { NotificationAction } from "../types";
2
+ export declare class NotificationActionValidator {
3
+ static validate(actions?: NotificationAction[]): void;
4
+ }
5
+ //# sourceMappingURL=NotificationActionValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationActionValidator.d.ts","sourceRoot":"","sources":["../../src/validators/NotificationActionValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAG9C,qBAAa,2BAA2B;IACtC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,kBAAkB,EAAE,GAAG,IAAI;CAWtD"}
@@ -0,0 +1,5 @@
1
+ import { DisplayNotification } from "../types";
2
+ export declare class NotificationChannelValidator {
3
+ static validate(notification: DisplayNotification): void;
4
+ }
5
+ //# sourceMappingURL=NotificationChannelValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationChannelValidator.d.ts","sourceRoot":"","sources":["../../src/validators/NotificationChannelValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAI/C,qBAAa,4BAA4B;IACvC,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE,mBAAmB,GAAG,IAAI;CAYzD"}
@@ -0,0 +1,5 @@
1
+ import { ScheduledNotification } from "../types";
2
+ export declare class ScheduledNotificationValidator {
3
+ static validate(notification: ScheduledNotification): void;
4
+ }
5
+ //# sourceMappingURL=ScheduledNotificationValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScheduledNotificationValidator.d.ts","sourceRoot":"","sources":["../../src/validators/ScheduledNotificationValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAKjD,qBAAa,8BAA8B;IACzC,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE,qBAAqB,GAAG,IAAI;CAK3D"}
@@ -0,0 +1,6 @@
1
+ export declare class ValidationAssertions {
2
+ static required(value: unknown, field: string): void;
3
+ static maxLength(value: string | undefined, field: string, max: number): void;
4
+ static isUrl(value: string | undefined, field: string): void;
5
+ }
6
+ //# sourceMappingURL=ValidationAssertions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidationAssertions.d.ts","sourceRoot":"","sources":["../../src/validators/ValidationAssertions.ts"],"names":[],"mappings":"AAEA,qBAAa,oBAAoB;IAC/B,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAUpD,MAAM,CAAC,SAAS,CACd,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,GACV,IAAI;IAQP,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CAW7D"}
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "react-native-notification-sdk",
3
+ "version": "1.0.0",
4
+ "description": "A production-ready React Native notification SDK built on Firebase Cloud Messaging and Notifee with Expo support.",
5
+ "keywords": [
6
+ "react-native",
7
+ "notification",
8
+ "notifications",
9
+ "push-notification",
10
+ "firebase",
11
+ "fcm",
12
+ "notifee",
13
+ "expo",
14
+ "android",
15
+ "ios",
16
+ "typescript"
17
+ ],
18
+ "author": "Omnics Technologies",
19
+ "homepage": "https://omnics.in",
20
+ "license": "MIT",
21
+ "main": "./dist/index.cjs",
22
+ "module": "./dist/index.js",
23
+ "types": "./dist/index.d.ts",
24
+ "react-native": "./src/index.ts",
25
+ "source": "./src/index.ts",
26
+ "files": [
27
+ "dist",
28
+ "plugins",
29
+ "README.md",
30
+ "LICENSE"
31
+ ],
32
+ "exports": {
33
+ ".": {
34
+ "types": "./dist/index.d.ts",
35
+ "import": "./dist/index.js",
36
+ "require": "./dist/index.cjs"
37
+ },
38
+ "./plugins": "./plugins/app.plugin.js"
39
+ },
40
+ "scripts": {
41
+ "build": "rollup -c",
42
+ "clean": "rimraf dist",
43
+ "dev": "rollup -c -w",
44
+ "lint": "eslint .",
45
+ "test": "jest"
46
+ },
47
+ "peerDependencies": {
48
+ "@notifee/react-native": "^9.1.8",
49
+ "@react-native-firebase/app": "^24.1.1",
50
+ "@react-native-firebase/messaging": "^24.1.1",
51
+ "react": ">=19.0.0",
52
+ "react-native": ">=0.80.0"
53
+ },
54
+ "peerDependenciesMeta": {
55
+ "@notifee/react-native": {
56
+ "optional": true
57
+ },
58
+ "@react-native-firebase/app": {
59
+ "optional": true
60
+ },
61
+ "@react-native-firebase/messaging": {
62
+ "optional": true
63
+ }
64
+ },
65
+ "devDependencies": {
66
+ "@expo/config-plugins": "^56.0.8",
67
+ "@rollup/plugin-commonjs": "^29.0.3",
68
+ "@rollup/plugin-node-resolve": "^16.0.3",
69
+ "@rollup/plugin-typescript": "^12.3.0",
70
+ "expo-build-properties": "^56.0.18",
71
+ "rimraf": "^6.1.3",
72
+ "rollup": "^4.61.1",
73
+ "rollup-plugin-dts": "^6.4.1",
74
+ "tslib": "^2.8.1",
75
+ "typescript": "^5.9.3"
76
+ }
77
+ }
@@ -0,0 +1,22 @@
1
+ const { withProjectBuildGradle } = require("@expo/config-plugins");
2
+
3
+ module.exports = function withAndroidGradle(config) {
4
+ return withProjectBuildGradle(config, (config) => {
5
+ let contents = config.modResults.contents;
6
+
7
+ const repo = `maven { url("$rootDir/../node_modules/@notifee/react-native/android/libs") }`;
8
+
9
+ if (contents.includes("@notifee/react-native/android/libs")) {
10
+ return config;
11
+ }
12
+
13
+ contents = contents.replace(
14
+ /(allprojects\s*\{\s*repositories\s*\{)/,
15
+ `$1\n ${repo}`,
16
+ );
17
+
18
+ config.modResults.contents = contents;
19
+
20
+ return config;
21
+ });
22
+ };
@@ -0,0 +1,7 @@
1
+ const withAndroidMaven = require("./android/withMaven");
2
+ const withModularHeaders = require("./ios/withModularHeaders");
3
+ module.exports = function withNotificationSDK(config) {
4
+ config = withAndroidMaven(config);
5
+ config = withModularHeaders(config);
6
+ return config;
7
+ };
@@ -0,0 +1,16 @@
1
+ const { withPodfile } = require("@expo/config-plugins");
2
+
3
+ const withModularHeaders = (config) => {
4
+ return withPodfile(config, (config) => {
5
+ const contents = config.modResults.contents;
6
+ if (!contents.includes("use_modular_headers!")) {
7
+ config.modResults.contents = contents.replace(
8
+ /^(platform :ios.*\n)/m,
9
+ `$1\nuse_modular_headers!\n`,
10
+ );
11
+ }
12
+ return config;
13
+ });
14
+ };
15
+
16
+ module.exports = withModularHeaders;