react-native-fluxsens-syaxon 0.1.1

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 (277) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +406 -0
  3. package/SyaxonReactNativeSdk.podspec +29 -0
  4. package/android/build.gradle +65 -0
  5. package/android/src/main/AndroidManifest.xml +18 -0
  6. package/android/src/main/java/com/syaxonreactnativesdk/SyaxonDeviceInfoModule.kt +70 -0
  7. package/android/src/main/java/com/syaxonreactnativesdk/SyaxonReactNativeSdkModule.kt +133 -0
  8. package/android/src/main/java/com/syaxonreactnativesdk/SyaxonReactNativeSdkPackage.kt +59 -0
  9. package/android/src/main/java/com/syaxonreactnativesdk/SyaxonStorageModule.kt +61 -0
  10. package/android/src/main/java/com/syaxonreactnativesdk/event/EventConstants.kt +9 -0
  11. package/android/src/main/java/com/syaxonreactnativesdk/event/EventEmitter.kt +203 -0
  12. package/android/src/main/java/com/syaxonreactnativesdk/firebase/FirebaseInitializer.kt +20 -0
  13. package/android/src/main/java/com/syaxonreactnativesdk/firebase/FirebaseManager.kt +122 -0
  14. package/android/src/main/java/com/syaxonreactnativesdk/firebase/InAppNotificationHelper.kt +231 -0
  15. package/android/src/main/java/com/syaxonreactnativesdk/firebase/NotificationDisplayContent.kt +27 -0
  16. package/android/src/main/java/com/syaxonreactnativesdk/firebase/NotificationEventStore.kt +155 -0
  17. package/android/src/main/java/com/syaxonreactnativesdk/firebase/NotificationHelper.kt +145 -0
  18. package/android/src/main/java/com/syaxonreactnativesdk/firebase/NotificationOpenedReceiver.kt +103 -0
  19. package/android/src/main/java/com/syaxonreactnativesdk/firebase/NotificationParser.kt +34 -0
  20. package/android/src/main/java/com/syaxonreactnativesdk/firebase/NotificationPayload.kt +16 -0
  21. package/android/src/main/java/com/syaxonreactnativesdk/firebase/PermissionManager.kt +42 -0
  22. package/android/src/main/java/com/syaxonreactnativesdk/firebase/SyaxonFirebaseMessagingService.kt +52 -0
  23. package/android/src/main/java/com/syaxonreactnativesdk/firebase/TokenManager.kt +23 -0
  24. package/android/src/main/java/com/syaxonreactnativesdk/network/ApiClient.kt +35 -0
  25. package/android/src/main/java/com/syaxonreactnativesdk/network/ApiResponse.kt +7 -0
  26. package/android/src/main/java/com/syaxonreactnativesdk/network/ApiService.kt +17 -0
  27. package/android/src/main/java/com/syaxonreactnativesdk/network/HeaderInterceptor.kt +20 -0
  28. package/android/src/main/java/com/syaxonreactnativesdk/network/NetworkConstants.kt +7 -0
  29. package/android/src/main/java/com/syaxonreactnativesdk/network/NetworkInterceptor.kt +22 -0
  30. package/android/src/main/java/com/syaxonreactnativesdk/network/model/DeviceRegistrationRequest.kt +15 -0
  31. package/android/src/main/java/com/syaxonreactnativesdk/network/model/DeviceRegistrationResponse.kt +8 -0
  32. package/ios/Firebase/SyaxonFirebaseManager.h +27 -0
  33. package/ios/Firebase/SyaxonFirebaseManager.m +168 -0
  34. package/ios/Firebase/SyaxonNotificationDisplayContent.h +15 -0
  35. package/ios/Firebase/SyaxonNotificationDisplayContent.m +127 -0
  36. package/ios/Firebase/SyaxonNotificationEventStore.h +16 -0
  37. package/ios/Firebase/SyaxonNotificationEventStore.m +153 -0
  38. package/ios/Firebase/SyaxonNotificationHelper.h +17 -0
  39. package/ios/Firebase/SyaxonNotificationHelper.m +243 -0
  40. package/ios/Firebase/SyaxonNotificationParser.h +13 -0
  41. package/ios/Firebase/SyaxonNotificationParser.m +93 -0
  42. package/ios/Firebase/SyaxonNotificationPayload.h +23 -0
  43. package/ios/Firebase/SyaxonNotificationPayload.m +42 -0
  44. package/ios/Firebase/SyaxonPermissionManager.h +15 -0
  45. package/ios/Firebase/SyaxonPermissionManager.m +71 -0
  46. package/ios/Firebase/SyaxonTokenManager.h +22 -0
  47. package/ios/Firebase/SyaxonTokenManager.m +79 -0
  48. package/ios/Integration/SyaxonIntegration.h +21 -0
  49. package/ios/Integration/SyaxonIntegration.m +40 -0
  50. package/ios/SyaxonDeviceInfo.h +18 -0
  51. package/ios/SyaxonDeviceInfo.mm +60 -0
  52. package/ios/SyaxonReactNativeSdk.h +19 -0
  53. package/ios/SyaxonReactNativeSdk.mm +162 -0
  54. package/ios/SyaxonStorage.h +9 -0
  55. package/ios/SyaxonStorage.mm +69 -0
  56. package/ios/event/EventConstants.h +7 -0
  57. package/ios/event/EventConstants.m +7 -0
  58. package/ios/event/SyaxonEventEmitter.h +11 -0
  59. package/ios/event/SyaxonEventEmitter.m +46 -0
  60. package/lib/module/NativeSyaxonReactNativeSdk.js +5 -0
  61. package/lib/module/NativeSyaxonReactNativeSdk.js.map +1 -0
  62. package/lib/module/analytics/AnalyticsManager.js +236 -0
  63. package/lib/module/analytics/AnalyticsManager.js.map +1 -0
  64. package/lib/module/analytics/EventManager.js +22 -0
  65. package/lib/module/analytics/EventManager.js.map +1 -0
  66. package/lib/module/analytics/StandardEventBuilder.js +41 -0
  67. package/lib/module/analytics/StandardEventBuilder.js.map +1 -0
  68. package/lib/module/apis/EventBatchApi.js +108 -0
  69. package/lib/module/apis/EventBatchApi.js.map +1 -0
  70. package/lib/module/apis/apiService.js +100 -0
  71. package/lib/module/apis/apiService.js.map +1 -0
  72. package/lib/module/apis/baseUrl.js +12 -0
  73. package/lib/module/apis/baseUrl.js.map +1 -0
  74. package/lib/module/apis/endpoints.js +36 -0
  75. package/lib/module/apis/endpoints.js.map +1 -0
  76. package/lib/module/constants/EventTypes.js +22 -0
  77. package/lib/module/constants/EventTypes.js.map +1 -0
  78. package/lib/module/constants/SDKConstants.js +11 -0
  79. package/lib/module/constants/SDKConstants.js.map +1 -0
  80. package/lib/module/constants/StorageKeys.js +11 -0
  81. package/lib/module/constants/StorageKeys.js.map +1 -0
  82. package/lib/module/core/AppRegistrationManager.js +19 -0
  83. package/lib/module/core/AppRegistrationManager.js.map +1 -0
  84. package/lib/module/core/ConfigManager.js +53 -0
  85. package/lib/module/core/ConfigManager.js.map +1 -0
  86. package/lib/module/core/HealthManager.js +14 -0
  87. package/lib/module/core/HealthManager.js.map +1 -0
  88. package/lib/module/core/NavigationTracker.js +38 -0
  89. package/lib/module/core/NavigationTracker.js.map +1 -0
  90. package/lib/module/core/NetworkManager.js +41 -0
  91. package/lib/module/core/NetworkManager.js.map +1 -0
  92. package/lib/module/core/SDKManager.js +243 -0
  93. package/lib/module/core/SDKManager.js.map +1 -0
  94. package/lib/module/core/SessionManager.js +99 -0
  95. package/lib/module/core/SessionManager.js.map +1 -0
  96. package/lib/module/core/StateManager.js +20 -0
  97. package/lib/module/core/StateManager.js.map +1 -0
  98. package/lib/module/core/Syaxon.js +23 -0
  99. package/lib/module/core/Syaxon.js.map +1 -0
  100. package/lib/module/identity/UserManager.js +2 -0
  101. package/lib/module/identity/UserManager.js.map +1 -0
  102. package/lib/module/index.js +14 -0
  103. package/lib/module/index.js.map +1 -0
  104. package/lib/module/metadata/MetadataManager.js +22 -0
  105. package/lib/module/metadata/MetadataManager.js.map +1 -0
  106. package/lib/module/metadata/models/AppInfo.js +2 -0
  107. package/lib/module/metadata/models/AppInfo.js.map +1 -0
  108. package/lib/module/metadata/models/DeviceInfo.js +2 -0
  109. package/lib/module/metadata/models/DeviceInfo.js.map +1 -0
  110. package/lib/module/metadata/models/LocaleInfo.js +2 -0
  111. package/lib/module/metadata/models/LocaleInfo.js.map +1 -0
  112. package/lib/module/metadata/models/Metadata.js +4 -0
  113. package/lib/module/metadata/models/Metadata.js.map +1 -0
  114. package/lib/module/models/AppInfo.js +2 -0
  115. package/lib/module/models/AppInfo.js.map +1 -0
  116. package/lib/module/models/DeviceInfo.js +2 -0
  117. package/lib/module/models/DeviceInfo.js.map +1 -0
  118. package/lib/module/models/Event.js +2 -0
  119. package/lib/module/models/Event.js.map +1 -0
  120. package/lib/module/models/SDKAttributes.js +2 -0
  121. package/lib/module/models/SDKAttributes.js.map +1 -0
  122. package/lib/module/models/Session.js +2 -0
  123. package/lib/module/models/Session.js.map +1 -0
  124. package/lib/module/models/User.js +2 -0
  125. package/lib/module/models/User.js.map +1 -0
  126. package/lib/module/multiply.js +9 -0
  127. package/lib/module/multiply.js.map +1 -0
  128. package/lib/module/multiply.native.js +10 -0
  129. package/lib/module/multiply.native.js.map +1 -0
  130. package/lib/module/package.json +1 -0
  131. package/lib/module/queue/QueueManager.js +138 -0
  132. package/lib/module/queue/QueueManager.js.map +1 -0
  133. package/lib/module/specs/NativeSyaxonDeviceInfo.js +5 -0
  134. package/lib/module/specs/NativeSyaxonDeviceInfo.js.map +1 -0
  135. package/lib/module/specs/NativeSyaxonStorage.js +5 -0
  136. package/lib/module/specs/NativeSyaxonStorage.js.map +1 -0
  137. package/lib/module/storage/providers/MemoryStorageProvider.js +55 -0
  138. package/lib/module/storage/providers/MemoryStorageProvider.js.map +1 -0
  139. package/lib/module/storage/providers/Storage.js +36 -0
  140. package/lib/module/storage/providers/Storage.js.map +1 -0
  141. package/lib/module/types/SDKConfig.js +4 -0
  142. package/lib/module/types/SDKConfig.js.map +1 -0
  143. package/lib/module/types/SDKState.js +10 -0
  144. package/lib/module/types/SDKState.js.map +1 -0
  145. package/lib/module/utils/Logger.js +36 -0
  146. package/lib/module/utils/Logger.js.map +1 -0
  147. package/lib/typescript/package.json +1 -0
  148. package/lib/typescript/src/NativeSyaxonReactNativeSdk.d.ts +14 -0
  149. package/lib/typescript/src/NativeSyaxonReactNativeSdk.d.ts.map +1 -0
  150. package/lib/typescript/src/analytics/AnalyticsManager.d.ts +24 -0
  151. package/lib/typescript/src/analytics/AnalyticsManager.d.ts.map +1 -0
  152. package/lib/typescript/src/analytics/EventManager.d.ts +7 -0
  153. package/lib/typescript/src/analytics/EventManager.d.ts.map +1 -0
  154. package/lib/typescript/src/analytics/StandardEventBuilder.d.ts +4 -0
  155. package/lib/typescript/src/analytics/StandardEventBuilder.d.ts.map +1 -0
  156. package/lib/typescript/src/apis/EventBatchApi.d.ts +10 -0
  157. package/lib/typescript/src/apis/EventBatchApi.d.ts.map +1 -0
  158. package/lib/typescript/src/apis/apiService.d.ts +21 -0
  159. package/lib/typescript/src/apis/apiService.d.ts.map +1 -0
  160. package/lib/typescript/src/apis/baseUrl.d.ts +4 -0
  161. package/lib/typescript/src/apis/baseUrl.d.ts.map +1 -0
  162. package/lib/typescript/src/apis/endpoints.d.ts +34 -0
  163. package/lib/typescript/src/apis/endpoints.d.ts.map +1 -0
  164. package/lib/typescript/src/constants/EventTypes.d.ts +21 -0
  165. package/lib/typescript/src/constants/EventTypes.d.ts.map +1 -0
  166. package/lib/typescript/src/constants/SDKConstants.d.ts +9 -0
  167. package/lib/typescript/src/constants/SDKConstants.d.ts.map +1 -0
  168. package/lib/typescript/src/constants/StorageKeys.d.ts +9 -0
  169. package/lib/typescript/src/constants/StorageKeys.d.ts.map +1 -0
  170. package/lib/typescript/src/core/AppRegistrationManager.d.ts +11 -0
  171. package/lib/typescript/src/core/AppRegistrationManager.d.ts.map +1 -0
  172. package/lib/typescript/src/core/ConfigManager.d.ts +15 -0
  173. package/lib/typescript/src/core/ConfigManager.d.ts.map +1 -0
  174. package/lib/typescript/src/core/HealthManager.d.ts +7 -0
  175. package/lib/typescript/src/core/HealthManager.d.ts.map +1 -0
  176. package/lib/typescript/src/core/NavigationTracker.d.ts +11 -0
  177. package/lib/typescript/src/core/NavigationTracker.d.ts.map +1 -0
  178. package/lib/typescript/src/core/NetworkManager.d.ts +12 -0
  179. package/lib/typescript/src/core/NetworkManager.d.ts.map +1 -0
  180. package/lib/typescript/src/core/SDKManager.d.ts +28 -0
  181. package/lib/typescript/src/core/SDKManager.d.ts.map +1 -0
  182. package/lib/typescript/src/core/SessionManager.d.ts +20 -0
  183. package/lib/typescript/src/core/SessionManager.d.ts.map +1 -0
  184. package/lib/typescript/src/core/StateManager.d.ts +11 -0
  185. package/lib/typescript/src/core/StateManager.d.ts.map +1 -0
  186. package/lib/typescript/src/core/Syaxon.d.ts +7 -0
  187. package/lib/typescript/src/core/Syaxon.d.ts.map +1 -0
  188. package/lib/typescript/src/identity/UserManager.d.ts +1 -0
  189. package/lib/typescript/src/identity/UserManager.d.ts.map +1 -0
  190. package/lib/typescript/src/index.d.ts +9 -0
  191. package/lib/typescript/src/index.d.ts.map +1 -0
  192. package/lib/typescript/src/metadata/MetadataManager.d.ts +6 -0
  193. package/lib/typescript/src/metadata/MetadataManager.d.ts.map +1 -0
  194. package/lib/typescript/src/metadata/models/AppInfo.d.ts +7 -0
  195. package/lib/typescript/src/metadata/models/AppInfo.d.ts.map +1 -0
  196. package/lib/typescript/src/metadata/models/DeviceInfo.d.ts +9 -0
  197. package/lib/typescript/src/metadata/models/DeviceInfo.d.ts.map +1 -0
  198. package/lib/typescript/src/metadata/models/LocaleInfo.d.ts +6 -0
  199. package/lib/typescript/src/metadata/models/LocaleInfo.d.ts.map +1 -0
  200. package/lib/typescript/src/metadata/models/Metadata.d.ts +9 -0
  201. package/lib/typescript/src/metadata/models/Metadata.d.ts.map +1 -0
  202. package/lib/typescript/src/models/AppInfo.d.ts +9 -0
  203. package/lib/typescript/src/models/AppInfo.d.ts.map +1 -0
  204. package/lib/typescript/src/models/DeviceInfo.d.ts +7 -0
  205. package/lib/typescript/src/models/DeviceInfo.d.ts.map +1 -0
  206. package/lib/typescript/src/models/Event.d.ts +34 -0
  207. package/lib/typescript/src/models/Event.d.ts.map +1 -0
  208. package/lib/typescript/src/models/SDKAttributes.d.ts +20 -0
  209. package/lib/typescript/src/models/SDKAttributes.d.ts.map +1 -0
  210. package/lib/typescript/src/models/Session.d.ts +8 -0
  211. package/lib/typescript/src/models/Session.d.ts.map +1 -0
  212. package/lib/typescript/src/models/User.d.ts +10 -0
  213. package/lib/typescript/src/models/User.d.ts.map +1 -0
  214. package/lib/typescript/src/multiply.d.ts +3 -0
  215. package/lib/typescript/src/multiply.d.ts.map +1 -0
  216. package/lib/typescript/src/multiply.native.d.ts +3 -0
  217. package/lib/typescript/src/multiply.native.d.ts.map +1 -0
  218. package/lib/typescript/src/queue/QueueManager.d.ts +29 -0
  219. package/lib/typescript/src/queue/QueueManager.d.ts.map +1 -0
  220. package/lib/typescript/src/specs/NativeSyaxonDeviceInfo.d.ts +21 -0
  221. package/lib/typescript/src/specs/NativeSyaxonDeviceInfo.d.ts.map +1 -0
  222. package/lib/typescript/src/specs/NativeSyaxonStorage.d.ts +16 -0
  223. package/lib/typescript/src/specs/NativeSyaxonStorage.d.ts.map +1 -0
  224. package/lib/typescript/src/storage/providers/MemoryStorageProvider.d.ts +16 -0
  225. package/lib/typescript/src/storage/providers/MemoryStorageProvider.d.ts.map +1 -0
  226. package/lib/typescript/src/storage/providers/Storage.d.ts +13 -0
  227. package/lib/typescript/src/storage/providers/Storage.d.ts.map +1 -0
  228. package/lib/typescript/src/types/SDKConfig.d.ts +15 -0
  229. package/lib/typescript/src/types/SDKConfig.d.ts.map +1 -0
  230. package/lib/typescript/src/types/SDKState.d.ts +7 -0
  231. package/lib/typescript/src/types/SDKState.d.ts.map +1 -0
  232. package/lib/typescript/src/utils/Logger.d.ts +12 -0
  233. package/lib/typescript/src/utils/Logger.d.ts.map +1 -0
  234. package/package.json +179 -0
  235. package/src/NativeSyaxonReactNativeSdk.ts +22 -0
  236. package/src/analytics/AnalyticsManager.ts +370 -0
  237. package/src/analytics/EventManager.ts +22 -0
  238. package/src/analytics/StandardEventBuilder.ts +50 -0
  239. package/src/apis/EventBatchApi.ts +125 -0
  240. package/src/apis/apiService.ts +155 -0
  241. package/src/apis/baseUrl.ts +13 -0
  242. package/src/apis/endpoints.ts +34 -0
  243. package/src/constants/EventTypes.ts +30 -0
  244. package/src/constants/SDKConstants.ts +11 -0
  245. package/src/constants/StorageKeys.ts +8 -0
  246. package/src/core/AppRegistrationManager.ts +23 -0
  247. package/src/core/ConfigManager.ts +57 -0
  248. package/src/core/HealthManager.ts +18 -0
  249. package/src/core/NavigationTracker.ts +42 -0
  250. package/src/core/NetworkManager.ts +49 -0
  251. package/src/core/SDKManager.ts +310 -0
  252. package/src/core/SessionManager.ts +125 -0
  253. package/src/core/StateManager.ts +23 -0
  254. package/src/core/Syaxon.ts +24 -0
  255. package/src/identity/UserManager.ts +0 -0
  256. package/src/index.tsx +15 -0
  257. package/src/metadata/MetadataManager.ts +24 -0
  258. package/src/metadata/models/AppInfo.ts +6 -0
  259. package/src/metadata/models/DeviceInfo.ts +8 -0
  260. package/src/metadata/models/LocaleInfo.ts +5 -0
  261. package/src/metadata/models/Metadata.ts +9 -0
  262. package/src/models/AppInfo.ts +8 -0
  263. package/src/models/DeviceInfo.ts +6 -0
  264. package/src/models/Event.ts +35 -0
  265. package/src/models/SDKAttributes.ts +25 -0
  266. package/src/models/Session.ts +7 -0
  267. package/src/models/User.ts +10 -0
  268. package/src/multiply.native.tsx +9 -0
  269. package/src/multiply.tsx +7 -0
  270. package/src/queue/QueueManager.ts +163 -0
  271. package/src/specs/NativeSyaxonDeviceInfo.ts +25 -0
  272. package/src/specs/NativeSyaxonStorage.ts +20 -0
  273. package/src/storage/providers/MemoryStorageProvider.ts +74 -0
  274. package/src/storage/providers/Storage.ts +34 -0
  275. package/src/types/SDKConfig.ts +16 -0
  276. package/src/types/SDKState.ts +6 -0
  277. package/src/utils/Logger.ts +43 -0
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Empover
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,406 @@
1
+ # Syaxon React Native SDK
2
+
3
+ The **Syaxon React Native SDK** enables React Native applications to integrate Syaxon services including:
4
+
5
+ - Push Notifications (Firebase Cloud Messaging)
6
+ - Notification Permission Management
7
+ - Device Token Management
8
+ - Event Tracking
9
+ - Offline Event Queue
10
+ - Persistent Local Storage (MMKV)
11
+
12
+ The SDK supports:
13
+
14
+ - ✅ React Native New Architecture (TurboModules)
15
+ - ✅ Android
16
+ - ✅ iOS
17
+ - ✅ React Native 0.76+
18
+
19
+ ---
20
+
21
+ # Installation
22
+
23
+ ## Install the SDK
24
+
25
+ ```bash
26
+ yarn add syaxon-react-native-sdk
27
+ ```
28
+
29
+ or
30
+
31
+ ```bash
32
+ npm install syaxon-react-native-sdk
33
+ ```
34
+
35
+ ---
36
+
37
+ # iOS Installation
38
+
39
+ Navigate to the iOS folder.
40
+
41
+ ```bash
42
+ cd ios
43
+ pod install
44
+ ```
45
+
46
+ ---
47
+
48
+ # Android Installation
49
+
50
+ No additional configuration is required.
51
+
52
+ ---
53
+
54
+ # Firebase Setup
55
+
56
+ The SDK uses Firebase Cloud Messaging.
57
+
58
+ ## Android
59
+
60
+ Add your Firebase configuration file.
61
+
62
+ ```
63
+ android/app/google-services.json
64
+ ```
65
+
66
+ Configure Gradle according to the Firebase documentation.
67
+
68
+ ---
69
+
70
+ ## iOS
71
+
72
+ Add
73
+
74
+ ```
75
+ GoogleService-Info.plist
76
+ ```
77
+
78
+ to your Xcode project.
79
+
80
+ Enable the following capabilities.
81
+
82
+ - Push Notifications
83
+ - Background Modes
84
+ - Remote Notifications
85
+
86
+ ---
87
+
88
+ # SDK Initialization
89
+
90
+ Initialize the SDK once during application startup.
91
+
92
+ ```typescript
93
+ import SyaxonSdk from 'syaxon-react-native-sdk';
94
+
95
+ await SyaxonSdk.initialize('YOUR_API_KEY');
96
+ ```
97
+
98
+ ---
99
+
100
+ # Request Notification Permission
101
+
102
+ ```typescript
103
+ const granted =
104
+ await SyaxonSdk.requestPushPermission();
105
+
106
+ console.log(granted);
107
+ ```
108
+
109
+ Returns
110
+
111
+ ```
112
+ true
113
+ ```
114
+
115
+ or
116
+
117
+ ```
118
+ false
119
+ ```
120
+
121
+ ---
122
+
123
+ # Check Notification Permission
124
+
125
+ ```typescript
126
+ const granted =
127
+ await SyaxonSdk.hasPushPermission();
128
+ ```
129
+
130
+ ---
131
+
132
+ # Get FCM Token
133
+
134
+ ```typescript
135
+ const token =
136
+ await SyaxonSdk.getPushToken();
137
+
138
+ console.log(token);
139
+ ```
140
+
141
+ Returns
142
+
143
+ ```typescript
144
+ string | null
145
+ ```
146
+
147
+ ---
148
+
149
+ # iOS AppDelegate Configuration
150
+
151
+ The SDK requires the host application to forward APNS lifecycle callbacks.
152
+
153
+ Open
154
+
155
+ ```
156
+ AppDelegate.swift
157
+ ```
158
+
159
+ Import the SDK bridge (or expose `SyaxonIntegration` using your bridging header if required by your project).
160
+
161
+ Forward the following callbacks.
162
+
163
+ ## Register Device Token
164
+
165
+ ```swift
166
+ func application(
167
+ _ application: UIApplication,
168
+ didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data
169
+ ) {
170
+ SyaxonIntegration.didRegisterForRemoteNotifications(
171
+ withDeviceToken: deviceToken
172
+ )
173
+ }
174
+ ```
175
+
176
+ ---
177
+
178
+ ## Registration Failed
179
+
180
+ ```swift
181
+ func application(
182
+ _ application: UIApplication,
183
+ didFailToRegisterForRemoteNotificationsWithError error: Error
184
+ ) {
185
+ SyaxonIntegration.didFailToRegisterForRemoteNotificationsWithError(error)
186
+ }
187
+ ```
188
+
189
+ ---
190
+
191
+ ## Silent Notification
192
+
193
+ ```swift
194
+ func application(
195
+ _ application: UIApplication,
196
+ didReceiveRemoteNotification userInfo: [AnyHashable : Any],
197
+ fetchCompletionHandler completionHandler:
198
+ @escaping (UIBackgroundFetchResult) -> Void
199
+ ) {
200
+
201
+ SyaxonIntegration.didReceiveRemoteNotification(userInfo)
202
+
203
+ completionHandler(.newData)
204
+ }
205
+ ```
206
+
207
+ ---
208
+
209
+ ## Foreground Notification
210
+
211
+ ```swift
212
+ func userNotificationCenter(
213
+ _ center: UNUserNotificationCenter,
214
+ willPresent notification: UNNotification,
215
+ withCompletionHandler completionHandler:
216
+ @escaping (UNNotificationPresentationOptions) -> Void
217
+ ) {
218
+
219
+ SyaxonIntegration.willPresentNotification(notification)
220
+
221
+ completionHandler([.banner, .badge, .sound])
222
+ }
223
+ ```
224
+
225
+ ---
226
+
227
+ ## Notification Opened
228
+
229
+ ```swift
230
+ func userNotificationCenter(
231
+ _ center: UNUserNotificationCenter,
232
+ didReceive response: UNNotificationResponse,
233
+ withCompletionHandler completionHandler:
234
+ @escaping () -> Void
235
+ ) {
236
+
237
+ SyaxonIntegration.didReceiveNotificationResponse(response)
238
+
239
+ completionHandler()
240
+ }
241
+ ```
242
+
243
+ ---
244
+
245
+ # Android
246
+
247
+ No additional native configuration is required.
248
+
249
+ ---
250
+
251
+ # API
252
+
253
+ ## initialize
254
+
255
+ ```typescript
256
+ initialize(apiKey: string): Promise<boolean>
257
+ ```
258
+
259
+ Initializes the SDK.
260
+
261
+ ---
262
+
263
+ ## requestPushPermission
264
+
265
+ ```typescript
266
+ requestPushPermission(): Promise<boolean>
267
+ ```
268
+
269
+ Requests notification permission.
270
+
271
+ ---
272
+
273
+ ## hasPushPermission
274
+
275
+ ```typescript
276
+ hasPushPermission(): Promise<boolean>
277
+ ```
278
+
279
+ Returns current notification permission status.
280
+
281
+ ---
282
+
283
+ ## getPushToken
284
+
285
+ ```typescript
286
+ getPushToken(): Promise<string | null>
287
+ ```
288
+
289
+ Returns the current FCM registration token.
290
+
291
+ ---
292
+
293
+ ## multiply
294
+
295
+ ```typescript
296
+ multiply(a: number, b: number): number
297
+ ```
298
+
299
+ Example TurboModule method.
300
+
301
+ ---
302
+
303
+ # Requirements
304
+
305
+ | Platform | Minimum Version |
306
+ |-----------|-----------------|
307
+ | iOS | 13.0 |
308
+ | Android | API 24+ |
309
+ | React Native | 0.76+ |
310
+
311
+ ---
312
+ ## Firebase Prerequisites
313
+
314
+ The Syaxon React Native SDK uses **Firebase Cloud Messaging (FCM)** to deliver push notifications.
315
+
316
+ Before integrating the SDK, you must:
317
+
318
+ 1. Create or use an existing Firebase project.
319
+ 2. Enable **Firebase Cloud Messaging** in the Firebase Console.
320
+ 3. Add your Android and/or iOS application to the Firebase project.
321
+ 4. Download the Firebase configuration files:
322
+ - Android: `google-services.json`
323
+ - iOS: `GoogleService-Info.plist`
324
+ 5. Configure Firebase in your application as described in the installation steps.
325
+
326
+ > **Note:** The SDK does not create or manage Firebase projects. Your application must use a Firebase project that you own and configure.
327
+
328
+ ---
329
+ ## Granting Firebase Access
330
+
331
+ To enable the Syaxon platform to send push notifications on your behalf, you must provide the Syaxon team with access to your Firebase project.
332
+
333
+ Depending on your organization's security policies, this can be done by either:
334
+
335
+ - Adding the Syaxon service account to your Firebase project with the required permissions, or
336
+ - Sharing the Firebase Cloud Messaging service account credentials securely with the Syaxon team.
337
+
338
+ The minimum required permissions are those necessary to send Firebase Cloud Messaging (FCM) notifications.
339
+
340
+ > **Important:** Do not share Firebase project owner credentials. Follow your organization's security policies when granting access.
341
+
342
+ ---
343
+
344
+ # Example
345
+
346
+ ```typescript
347
+ import SyaxonSdk from 'syaxon-react-native-sdk';
348
+
349
+ async function setup() {
350
+ await SyaxonSdk.initialize("YOUR_API_KEY");
351
+
352
+ const granted =
353
+ await SyaxonSdk.requestPushPermission();
354
+
355
+ if (granted) {
356
+ const token =
357
+ await SyaxonSdk.getPushToken();
358
+
359
+ console.log(token);
360
+ }
361
+ }
362
+
363
+ setup();
364
+ ```
365
+
366
+ ---
367
+
368
+ # Troubleshooting
369
+
370
+ ## TurboModule could not be found
371
+
372
+ If you receive
373
+
374
+ ```
375
+ TurboModuleRegistry.getEnforcing(...):
376
+ 'SyaxonReactNativeSdk' could not be found
377
+ ```
378
+
379
+ Ensure:
380
+
381
+ - React Native New Architecture is enabled.
382
+ - CocoaPods have been installed.
383
+ - The application has been rebuilt after installing the SDK.
384
+ - The generated TurboModule implementation (`getTurboModule`) is present in the native module.
385
+
386
+ ---
387
+
388
+ ## iOS Build Issues
389
+
390
+ If you modify native files:
391
+
392
+ ```bash
393
+ cd ios
394
+
395
+ rm -rf Pods Podfile.lock
396
+
397
+ pod install
398
+ ```
399
+
400
+ Then clean the Xcode build folder and rebuild the application.
401
+
402
+ ---
403
+
404
+ # License
405
+
406
+ MIT
@@ -0,0 +1,29 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "SyaxonReactNativeSdk"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+ s.platforms = { :ios => "13.0" }
13
+ s.source = { :git => package["repository"]["url"], :tag => "#{s.version}" }
14
+
15
+ s.source_files = "ios/**/*.{h,m,mm,cpp}"
16
+ s.public_header_files = [
17
+ "ios/Integration/SyaxonIntegration.h"
18
+ ]
19
+ # Vendor Tencent MMKV directly. Consumers only ever autolink THIS module —
20
+ # MMKV comes along transitively via CocoaPods, same pattern OneSignal/
21
+ # AppsFlyer/Branch use for their own native dependencies.
22
+ s.dependency "MMKV", "~> 2.0"
23
+ s.dependency 'FirebaseCore'
24
+ s.dependency 'FirebaseMessaging'
25
+ # s.pod_target_xcconfig = {
26
+ # 'DEFINES_MODULE' => 'YES'
27
+ # }
28
+ install_modules_dependencies(s)
29
+ end
@@ -0,0 +1,65 @@
1
+ buildscript {
2
+ ext.SyaxonReactNativeSdk = [
3
+ kotlinVersion: "2.0.21",
4
+ minSdkVersion: 24,
5
+ compileSdkVersion: 36
6
+ ]
7
+
8
+ ext.getExtOrDefault = { prop ->
9
+ if (rootProject.ext.has(prop)) {
10
+ return rootProject.ext.get(prop)
11
+ }
12
+
13
+ return SyaxonReactNativeSdk[prop]
14
+ }
15
+
16
+ repositories {
17
+ google()
18
+ mavenCentral()
19
+ }
20
+
21
+ dependencies {
22
+ classpath "com.android.tools.build:gradle:8.7.2"
23
+ // noinspection DifferentKotlinGradleVersion
24
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
25
+ }
26
+ }
27
+
28
+
29
+ apply plugin: "com.android.library"
30
+ apply plugin: "kotlin-android"
31
+
32
+ apply plugin: "com.facebook.react"
33
+
34
+ android {
35
+ namespace "com.syaxonreactnativesdk"
36
+
37
+ compileSdkVersion getExtOrDefault("compileSdkVersion")
38
+
39
+ defaultConfig {
40
+ minSdkVersion getExtOrDefault("minSdkVersion")
41
+ }
42
+
43
+ compileOptions {
44
+ sourceCompatibility JavaVersion.VERSION_17
45
+ targetCompatibility JavaVersion.VERSION_17
46
+ }
47
+ kotlinOptions {
48
+ jvmTarget = "17"
49
+ }
50
+ }
51
+
52
+ dependencies {
53
+ implementation "com.facebook.react:react-android"
54
+ implementation "com.tencent:mmkv:1.3.9"
55
+ implementation platform("com.google.firebase:firebase-bom:34.10.0")
56
+ implementation "com.google.firebase:firebase-messaging"
57
+ implementation "com.google.firebase:firebase-installations"
58
+ implementation "androidx.core:core:1.17.0"
59
+ implementation "com.squareup.retrofit2:retrofit:2.11.0"
60
+ implementation "com.squareup.retrofit2:converter-gson:2.11.0"
61
+ // OkHttp
62
+ implementation "com.squareup.okhttp3:okhttp:4.12.0"
63
+ implementation "com.squareup.okhttp3:logging-interceptor:4.12.0"
64
+ implementation "com.google.code.gson:gson:2.13.1"
65
+ }
@@ -0,0 +1,18 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ <uses-permission android:name="android.permission.INTERNET"/>
3
+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
4
+
5
+ <application>
6
+ <receiver
7
+ android:name="com.syaxonreactnativesdk.firebase.NotificationOpenedReceiver"
8
+ android:exported="false"/>
9
+
10
+ <service
11
+ android:name="com.syaxonreactnativesdk.firebase.SyaxonFirebaseMessagingService"
12
+ android:exported="false">
13
+ <intent-filter>
14
+ <action android:name="com.google.firebase.MESSAGING_EVENT"/>
15
+ </intent-filter>
16
+ </service>
17
+ </application>
18
+ </manifest>
@@ -0,0 +1,70 @@
1
+ package com.syaxonreactnativesdk
2
+
3
+ import android.content.pm.PackageManager
4
+ import android.os.Build
5
+ import android.provider.Settings
6
+ import com.facebook.react.bridge.Arguments
7
+ import com.facebook.react.bridge.Promise
8
+
9
+ class SyaxonDeviceInfoModule(
10
+ reactContext: com.facebook.react.bridge.ReactApplicationContext
11
+ ) : NativeSyaxonDeviceInfoSpec(reactContext) {
12
+
13
+ companion object {
14
+ const val NAME = "SyaxonDeviceInfo"
15
+ }
16
+
17
+ override fun getName(): String = NAME
18
+
19
+ override fun getSDKAttributes(promise: Promise) {
20
+ try {
21
+ val context = reactApplicationContext
22
+
23
+ val packageManager = context.packageManager
24
+ val packageName = context.packageName
25
+
26
+ val packageInfo = packageManager.getPackageInfo(packageName, 0)
27
+
28
+ val appName = packageManager
29
+ .getApplicationLabel(context.applicationInfo)
30
+ .toString()
31
+
32
+ val versionName = packageInfo.versionName ?: ""
33
+
34
+ val buildNumber =
35
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
36
+ packageInfo.longVersionCode.toString()
37
+ } else {
38
+ @Suppress("DEPRECATION")
39
+ packageInfo.versionCode.toString()
40
+ }
41
+
42
+ val deviceId = Settings.Secure.getString(
43
+ context.contentResolver,
44
+ Settings.Secure.ANDROID_ID
45
+ ) ?: ""
46
+
47
+ val locale = context.resources.configuration.locales[0]
48
+
49
+ val map = Arguments.createMap()
50
+
51
+ map.putString("sxn-device-id", deviceId)
52
+ map.putString("sxn-device-model", Build.MODEL)
53
+ map.putString("sxn-manufacturer", Build.MANUFACTURER)
54
+ map.putString("sxn-os", "Android")
55
+ map.putString("sxn-os-version", Build.VERSION.RELEASE)
56
+ map.putString("sxn-app-name", appName)
57
+ map.putString("sxn-package-name", packageName)
58
+ map.putString("sxn-app-version", versionName)
59
+ map.putString("sxn-build-number", buildNumber)
60
+ map.putString("sxn-country", locale.country)
61
+ map.putString("sxn-language", locale.language)
62
+ map.putString("sxn-timezone", java.util.TimeZone.getDefault().id)
63
+
64
+ promise.resolve(map)
65
+
66
+ } catch (e: Exception) {
67
+ promise.reject("DEVICE_INFO_ERROR", e)
68
+ }
69
+ }
70
+ }