@loyalytics/swan-react-native-sdk 2.0.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 (204) hide show
  1. package/LICENSE +55 -0
  2. package/README.md +67 -0
  3. package/docs/IOS_NOTIFICATION_EXTENSION_SETUP.md +335 -0
  4. package/ios/README.md +64 -0
  5. package/ios/SwanNotificationServiceExtension/Info.plist +31 -0
  6. package/ios/SwanNotificationServiceExtension/NotificationService.swift +337 -0
  7. package/ios/SwanNotificationServiceExtension/SwanNotificationServiceExtension.entitlements +10 -0
  8. package/lib/commonjs/components/FooterView.js +125 -0
  9. package/lib/commonjs/components/FooterView.js.map +1 -0
  10. package/lib/commonjs/components/FullScreenView.js +172 -0
  11. package/lib/commonjs/components/FullScreenView.js.map +1 -0
  12. package/lib/commonjs/components/HeaderView.js +205 -0
  13. package/lib/commonjs/components/HeaderView.js.map +1 -0
  14. package/lib/commonjs/components/PopUpView.js +186 -0
  15. package/lib/commonjs/components/PopUpView.js.map +1 -0
  16. package/lib/commonjs/config/BatchConfig.js +53 -0
  17. package/lib/commonjs/config/BatchConfig.js.map +1 -0
  18. package/lib/commonjs/constants/ApiUrls.js +56 -0
  19. package/lib/commonjs/constants/ApiUrls.js.map +1 -0
  20. package/lib/commonjs/core/EventQueueManager.js +345 -0
  21. package/lib/commonjs/core/EventQueueManager.js.map +1 -0
  22. package/lib/commonjs/core/FlushManager.js +245 -0
  23. package/lib/commonjs/core/FlushManager.js.map +1 -0
  24. package/lib/commonjs/core/NetworkMonitor.js +97 -0
  25. package/lib/commonjs/core/NetworkMonitor.js.map +1 -0
  26. package/lib/commonjs/index.js +3506 -0
  27. package/lib/commonjs/index.js.map +1 -0
  28. package/lib/commonjs/providers/FirebasePushProvider.js +130 -0
  29. package/lib/commonjs/providers/FirebasePushProvider.js.map +1 -0
  30. package/lib/commonjs/providers/NullPushProvider.js +59 -0
  31. package/lib/commonjs/providers/NullPushProvider.js.map +1 -0
  32. package/lib/commonjs/providers/PushNotificationProvider.js +30 -0
  33. package/lib/commonjs/providers/PushNotificationProvider.js.map +1 -0
  34. package/lib/commonjs/services/DeviceRegistrationService.js +248 -0
  35. package/lib/commonjs/services/DeviceRegistrationService.js.map +1 -0
  36. package/lib/commonjs/services/PushTokenService.js +284 -0
  37. package/lib/commonjs/services/PushTokenService.js.map +1 -0
  38. package/lib/commonjs/state/AuthStateMachine.js +161 -0
  39. package/lib/commonjs/state/AuthStateMachine.js.map +1 -0
  40. package/lib/commonjs/state/DeviceStateMachine.js +104 -0
  41. package/lib/commonjs/state/DeviceStateMachine.js.map +1 -0
  42. package/lib/commonjs/state/PushStateMachine.js +129 -0
  43. package/lib/commonjs/state/PushStateMachine.js.map +1 -0
  44. package/lib/commonjs/types/EventQueue.js +50 -0
  45. package/lib/commonjs/types/EventQueue.js.map +1 -0
  46. package/lib/commonjs/types/SDK.js +2 -0
  47. package/lib/commonjs/types/SDK.js.map +1 -0
  48. package/lib/commonjs/utils/FirebaseNotificationManager.js +492 -0
  49. package/lib/commonjs/utils/FirebaseNotificationManager.js.map +1 -0
  50. package/lib/commonjs/utils/Logger.js +56 -0
  51. package/lib/commonjs/utils/Logger.js.map +1 -0
  52. package/lib/commonjs/utils/SharedCredentialsManager.js +146 -0
  53. package/lib/commonjs/utils/SharedCredentialsManager.js.map +1 -0
  54. package/lib/commonjs/version.js +12 -0
  55. package/lib/commonjs/version.js.map +1 -0
  56. package/lib/module/components/FooterView.js +121 -0
  57. package/lib/module/components/FooterView.js.map +1 -0
  58. package/lib/module/components/FullScreenView.js +167 -0
  59. package/lib/module/components/FullScreenView.js.map +1 -0
  60. package/lib/module/components/HeaderView.js +199 -0
  61. package/lib/module/components/HeaderView.js.map +1 -0
  62. package/lib/module/components/PopUpView.js +181 -0
  63. package/lib/module/components/PopUpView.js.map +1 -0
  64. package/lib/module/config/BatchConfig.js +49 -0
  65. package/lib/module/config/BatchConfig.js.map +1 -0
  66. package/lib/module/constants/ApiUrls.js +52 -0
  67. package/lib/module/constants/ApiUrls.js.map +1 -0
  68. package/lib/module/core/EventQueueManager.js +340 -0
  69. package/lib/module/core/EventQueueManager.js.map +1 -0
  70. package/lib/module/core/FlushManager.js +240 -0
  71. package/lib/module/core/FlushManager.js.map +1 -0
  72. package/lib/module/core/NetworkMonitor.js +92 -0
  73. package/lib/module/core/NetworkMonitor.js.map +1 -0
  74. package/lib/module/index.js +3494 -0
  75. package/lib/module/index.js.map +1 -0
  76. package/lib/module/providers/FirebasePushProvider.js +124 -0
  77. package/lib/module/providers/FirebasePushProvider.js.map +1 -0
  78. package/lib/module/providers/NullPushProvider.js +53 -0
  79. package/lib/module/providers/NullPushProvider.js.map +1 -0
  80. package/lib/module/providers/PushNotificationProvider.js +26 -0
  81. package/lib/module/providers/PushNotificationProvider.js.map +1 -0
  82. package/lib/module/services/DeviceRegistrationService.js +243 -0
  83. package/lib/module/services/DeviceRegistrationService.js.map +1 -0
  84. package/lib/module/services/PushTokenService.js +278 -0
  85. package/lib/module/services/PushTokenService.js.map +1 -0
  86. package/lib/module/state/AuthStateMachine.js +155 -0
  87. package/lib/module/state/AuthStateMachine.js.map +1 -0
  88. package/lib/module/state/DeviceStateMachine.js +98 -0
  89. package/lib/module/state/DeviceStateMachine.js.map +1 -0
  90. package/lib/module/state/PushStateMachine.js +123 -0
  91. package/lib/module/state/PushStateMachine.js.map +1 -0
  92. package/lib/module/types/EventQueue.js +46 -0
  93. package/lib/module/types/EventQueue.js.map +1 -0
  94. package/lib/module/types/SDK.js +2 -0
  95. package/lib/module/types/SDK.js.map +1 -0
  96. package/lib/module/utils/FirebaseNotificationManager.js +486 -0
  97. package/lib/module/utils/FirebaseNotificationManager.js.map +1 -0
  98. package/lib/module/utils/Logger.js +52 -0
  99. package/lib/module/utils/Logger.js.map +1 -0
  100. package/lib/module/utils/SharedCredentialsManager.js +140 -0
  101. package/lib/module/utils/SharedCredentialsManager.js.map +1 -0
  102. package/lib/module/version.js +8 -0
  103. package/lib/module/version.js.map +1 -0
  104. package/lib/typescript/commonjs/package.json +1 -0
  105. package/lib/typescript/commonjs/src/components/FooterView.d.ts +3 -0
  106. package/lib/typescript/commonjs/src/components/FooterView.d.ts.map +1 -0
  107. package/lib/typescript/commonjs/src/components/FullScreenView.d.ts +3 -0
  108. package/lib/typescript/commonjs/src/components/FullScreenView.d.ts.map +1 -0
  109. package/lib/typescript/commonjs/src/components/HeaderView.d.ts +3 -0
  110. package/lib/typescript/commonjs/src/components/HeaderView.d.ts.map +1 -0
  111. package/lib/typescript/commonjs/src/components/PopUpView.d.ts +3 -0
  112. package/lib/typescript/commonjs/src/components/PopUpView.d.ts.map +1 -0
  113. package/lib/typescript/commonjs/src/config/BatchConfig.d.ts +7 -0
  114. package/lib/typescript/commonjs/src/config/BatchConfig.d.ts.map +1 -0
  115. package/lib/typescript/commonjs/src/constants/ApiUrls.d.ts +56 -0
  116. package/lib/typescript/commonjs/src/constants/ApiUrls.d.ts.map +1 -0
  117. package/lib/typescript/commonjs/src/core/EventQueueManager.d.ts +63 -0
  118. package/lib/typescript/commonjs/src/core/EventQueueManager.d.ts.map +1 -0
  119. package/lib/typescript/commonjs/src/core/FlushManager.d.ts +63 -0
  120. package/lib/typescript/commonjs/src/core/FlushManager.d.ts.map +1 -0
  121. package/lib/typescript/commonjs/src/core/NetworkMonitor.d.ts +38 -0
  122. package/lib/typescript/commonjs/src/core/NetworkMonitor.d.ts.map +1 -0
  123. package/lib/typescript/commonjs/src/index.d.ts +663 -0
  124. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  125. package/lib/typescript/commonjs/src/providers/FirebasePushProvider.d.ts +28 -0
  126. package/lib/typescript/commonjs/src/providers/FirebasePushProvider.d.ts.map +1 -0
  127. package/lib/typescript/commonjs/src/providers/NullPushProvider.d.ts +25 -0
  128. package/lib/typescript/commonjs/src/providers/NullPushProvider.d.ts.map +1 -0
  129. package/lib/typescript/commonjs/src/providers/PushNotificationProvider.d.ts +105 -0
  130. package/lib/typescript/commonjs/src/providers/PushNotificationProvider.d.ts.map +1 -0
  131. package/lib/typescript/commonjs/src/services/DeviceRegistrationService.d.ts +60 -0
  132. package/lib/typescript/commonjs/src/services/DeviceRegistrationService.d.ts.map +1 -0
  133. package/lib/typescript/commonjs/src/services/PushTokenService.d.ts +82 -0
  134. package/lib/typescript/commonjs/src/services/PushTokenService.d.ts.map +1 -0
  135. package/lib/typescript/commonjs/src/state/AuthStateMachine.d.ts +61 -0
  136. package/lib/typescript/commonjs/src/state/AuthStateMachine.d.ts.map +1 -0
  137. package/lib/typescript/commonjs/src/state/DeviceStateMachine.d.ts +51 -0
  138. package/lib/typescript/commonjs/src/state/DeviceStateMachine.d.ts.map +1 -0
  139. package/lib/typescript/commonjs/src/state/PushStateMachine.d.ts +61 -0
  140. package/lib/typescript/commonjs/src/state/PushStateMachine.d.ts.map +1 -0
  141. package/lib/typescript/commonjs/src/types/EventQueue.d.ts +85 -0
  142. package/lib/typescript/commonjs/src/types/EventQueue.d.ts.map +1 -0
  143. package/lib/typescript/commonjs/src/types/SDK.d.ts +54 -0
  144. package/lib/typescript/commonjs/src/types/SDK.d.ts.map +1 -0
  145. package/lib/typescript/commonjs/src/utils/FirebaseNotificationManager.d.ts +169 -0
  146. package/lib/typescript/commonjs/src/utils/FirebaseNotificationManager.d.ts.map +1 -0
  147. package/lib/typescript/commonjs/src/utils/Logger.d.ts +32 -0
  148. package/lib/typescript/commonjs/src/utils/Logger.d.ts.map +1 -0
  149. package/lib/typescript/commonjs/src/utils/SharedCredentialsManager.d.ts +54 -0
  150. package/lib/typescript/commonjs/src/utils/SharedCredentialsManager.d.ts.map +1 -0
  151. package/lib/typescript/commonjs/src/version.d.ts +2 -0
  152. package/lib/typescript/commonjs/src/version.d.ts.map +1 -0
  153. package/lib/typescript/module/package.json +1 -0
  154. package/lib/typescript/module/src/components/FooterView.d.ts +3 -0
  155. package/lib/typescript/module/src/components/FooterView.d.ts.map +1 -0
  156. package/lib/typescript/module/src/components/FullScreenView.d.ts +3 -0
  157. package/lib/typescript/module/src/components/FullScreenView.d.ts.map +1 -0
  158. package/lib/typescript/module/src/components/HeaderView.d.ts +3 -0
  159. package/lib/typescript/module/src/components/HeaderView.d.ts.map +1 -0
  160. package/lib/typescript/module/src/components/PopUpView.d.ts +3 -0
  161. package/lib/typescript/module/src/components/PopUpView.d.ts.map +1 -0
  162. package/lib/typescript/module/src/config/BatchConfig.d.ts +7 -0
  163. package/lib/typescript/module/src/config/BatchConfig.d.ts.map +1 -0
  164. package/lib/typescript/module/src/constants/ApiUrls.d.ts +56 -0
  165. package/lib/typescript/module/src/constants/ApiUrls.d.ts.map +1 -0
  166. package/lib/typescript/module/src/core/EventQueueManager.d.ts +63 -0
  167. package/lib/typescript/module/src/core/EventQueueManager.d.ts.map +1 -0
  168. package/lib/typescript/module/src/core/FlushManager.d.ts +63 -0
  169. package/lib/typescript/module/src/core/FlushManager.d.ts.map +1 -0
  170. package/lib/typescript/module/src/core/NetworkMonitor.d.ts +38 -0
  171. package/lib/typescript/module/src/core/NetworkMonitor.d.ts.map +1 -0
  172. package/lib/typescript/module/src/index.d.ts +663 -0
  173. package/lib/typescript/module/src/index.d.ts.map +1 -0
  174. package/lib/typescript/module/src/providers/FirebasePushProvider.d.ts +28 -0
  175. package/lib/typescript/module/src/providers/FirebasePushProvider.d.ts.map +1 -0
  176. package/lib/typescript/module/src/providers/NullPushProvider.d.ts +25 -0
  177. package/lib/typescript/module/src/providers/NullPushProvider.d.ts.map +1 -0
  178. package/lib/typescript/module/src/providers/PushNotificationProvider.d.ts +105 -0
  179. package/lib/typescript/module/src/providers/PushNotificationProvider.d.ts.map +1 -0
  180. package/lib/typescript/module/src/services/DeviceRegistrationService.d.ts +60 -0
  181. package/lib/typescript/module/src/services/DeviceRegistrationService.d.ts.map +1 -0
  182. package/lib/typescript/module/src/services/PushTokenService.d.ts +82 -0
  183. package/lib/typescript/module/src/services/PushTokenService.d.ts.map +1 -0
  184. package/lib/typescript/module/src/state/AuthStateMachine.d.ts +61 -0
  185. package/lib/typescript/module/src/state/AuthStateMachine.d.ts.map +1 -0
  186. package/lib/typescript/module/src/state/DeviceStateMachine.d.ts +51 -0
  187. package/lib/typescript/module/src/state/DeviceStateMachine.d.ts.map +1 -0
  188. package/lib/typescript/module/src/state/PushStateMachine.d.ts +61 -0
  189. package/lib/typescript/module/src/state/PushStateMachine.d.ts.map +1 -0
  190. package/lib/typescript/module/src/types/EventQueue.d.ts +85 -0
  191. package/lib/typescript/module/src/types/EventQueue.d.ts.map +1 -0
  192. package/lib/typescript/module/src/types/SDK.d.ts +54 -0
  193. package/lib/typescript/module/src/types/SDK.d.ts.map +1 -0
  194. package/lib/typescript/module/src/utils/FirebaseNotificationManager.d.ts +169 -0
  195. package/lib/typescript/module/src/utils/FirebaseNotificationManager.d.ts.map +1 -0
  196. package/lib/typescript/module/src/utils/Logger.d.ts +32 -0
  197. package/lib/typescript/module/src/utils/Logger.d.ts.map +1 -0
  198. package/lib/typescript/module/src/utils/SharedCredentialsManager.d.ts +54 -0
  199. package/lib/typescript/module/src/utils/SharedCredentialsManager.d.ts.map +1 -0
  200. package/lib/typescript/module/src/version.d.ts +2 -0
  201. package/lib/typescript/module/src/version.d.ts.map +1 -0
  202. package/package.json +230 -0
  203. package/scripts/generate-version.js +25 -0
  204. package/scripts/setup-ios-extension.js +275 -0
@@ -0,0 +1,169 @@
1
+ /**
2
+ * FirebaseNotificationManager
3
+ * Handles all Firebase Cloud Messaging operations for Swan SDK
4
+ *
5
+ * Features:
6
+ * - Automatic FCM token generation and refresh
7
+ * - Notification handling (foreground, background, quit state)
8
+ * - Event system for notification lifecycle
9
+ * - Permission management
10
+ * - Notification Channel Management (Android)
11
+ */
12
+ export declare const SWAN_NOTIFICATION_EVENTS: {
13
+ PUSH_NOTIFICATION_RECEIVED: string;
14
+ NOTIFICATION_OPENED: string;
15
+ TOKEN_RECEIVED: string;
16
+ TOKEN_REFRESH: string;
17
+ PERMISSION_CHANGED: string;
18
+ };
19
+ interface RemoteMessage {
20
+ messageId?: string;
21
+ notification?: {
22
+ title?: string;
23
+ body?: string;
24
+ android?: {
25
+ channelId?: string;
26
+ imageUrl?: string;
27
+ [key: string]: any;
28
+ };
29
+ ios?: {
30
+ [key: string]: any;
31
+ };
32
+ [key: string]: any;
33
+ };
34
+ data?: {
35
+ [key: string]: any;
36
+ };
37
+ sentTime?: number;
38
+ from?: string;
39
+ [key: string]: any;
40
+ }
41
+ interface AuthorizationStatus {
42
+ AUTHORIZED: number;
43
+ DENIED: number;
44
+ NOT_DETERMINED: number;
45
+ PROVISIONAL: number;
46
+ EPHEMERAL: number;
47
+ }
48
+ interface FirebaseMessagingModule {
49
+ (): {
50
+ onTokenRefresh(callback: (token: string) => void): () => void;
51
+ onMessage(callback: (message: RemoteMessage) => void): () => void;
52
+ onNotificationOpenedApp(callback: (message: RemoteMessage) => void): () => void;
53
+ getInitialNotification(): Promise<RemoteMessage | null>;
54
+ hasPermission(): Promise<number>;
55
+ requestPermission(): Promise<number>;
56
+ getToken(): Promise<string>;
57
+ deleteToken(): Promise<void>;
58
+ getBadge(): Promise<number>;
59
+ setBadge(count: number): Promise<void>;
60
+ unsubscribeFromTopic(topic: string): Promise<void>;
61
+ subscribeToTopic(topic: string): Promise<void>;
62
+ registerDeviceForRemoteMessages(): Promise<void>;
63
+ isDeviceRegisteredForRemoteMessages: boolean;
64
+ };
65
+ AuthorizationStatus: AuthorizationStatus;
66
+ default: FirebaseMessagingModule;
67
+ }
68
+ type EventCallback = (data: any) => void;
69
+ interface EventListeners {
70
+ [key: string]: EventCallback[];
71
+ }
72
+ declare class FirebaseNotificationManager {
73
+ messaging: FirebaseMessagingModule | null;
74
+ notifee: any;
75
+ fcmToken: string | null;
76
+ eventListeners: EventListeners;
77
+ unsubscribeTokenRefresh: (() => void) | null;
78
+ unsubscribeOnMessage: (() => void) | null;
79
+ unsubscribeOnNotificationOpenedApp: (() => void) | null;
80
+ backgroundMessageHandler: (() => Promise<void>) | null;
81
+ static instance: FirebaseNotificationManager | null;
82
+ constructor();
83
+ /**
84
+ * Get singleton instance
85
+ */
86
+ static getInstance(): FirebaseNotificationManager;
87
+ /**
88
+ * Initialize Firebase Messaging and Notifee (if available)
89
+ * This should be called when SDK is initialized
90
+ */
91
+ initialize(): Promise<boolean>;
92
+ /**
93
+ * Dynamically import Firebase Messaging module
94
+ */
95
+ getMessagingModule(): Promise<FirebaseMessagingModule | null>;
96
+ /**
97
+ * Dynamically load Notifee
98
+ */
99
+ loadNotifee(): Promise<void>;
100
+ /**
101
+ * Setup all notification handlers
102
+ */
103
+ setupNotificationHandlers(): Promise<void>;
104
+ /**
105
+ * Request notification permission and get FCM token
106
+ */
107
+ requestPermissionAndGetToken(): Promise<string | null>;
108
+ /**
109
+ * Get current FCM token
110
+ * @returns {Promise<string|null>} FCM token or null
111
+ */
112
+ getToken(): Promise<string | null>;
113
+ /**
114
+ * Delete FCM token
115
+ */
116
+ deleteToken(): Promise<boolean>;
117
+ /**
118
+ * Check if notifications are enabled
119
+ */
120
+ hasPermission(): Promise<boolean>;
121
+ /**
122
+ * Request notification permission
123
+ */
124
+ requestPermission(): Promise<boolean>;
125
+ /**
126
+ * Create a notification channel
127
+ * @param channelId - Unique channel ID
128
+ * @param channelName - User visible channel name
129
+ * @param importance - Importance level (default: 4 - High)
130
+ * @param description - User visible description
131
+ */
132
+ createNotificationChannel(channelId: string, channelName: string, importance?: number, description?: string): Promise<string | null>;
133
+ /**
134
+ * Delete a notification channel
135
+ */
136
+ deleteNotificationChannel(channelId: string): Promise<boolean>;
137
+ /**
138
+ * Subscribe to badge count (iOS only)
139
+ */
140
+ getBadgeCount(): Promise<number>;
141
+ /**
142
+ * Set badge count (iOS only)
143
+ */
144
+ setBadgeCount(count: number): Promise<boolean>;
145
+ /**
146
+ * Register event listener
147
+ * @param {string} eventName - Event name
148
+ * @param {Function} callback - Callback function
149
+ */
150
+ addEventListener(eventName: string, callback: EventCallback): void;
151
+ /**
152
+ * Remove event listener
153
+ * @param {string} eventName - Event name
154
+ * @param {Function} callback - Callback function to remove
155
+ */
156
+ removeEventListener(eventName: string, callback: EventCallback): void;
157
+ /**
158
+ * Emit event to all registered listeners
159
+ * @param {string} eventName - Event name
160
+ * @param {any} data - Event data
161
+ */
162
+ emitEvent(eventName: string, data: any): void;
163
+ /**
164
+ * Cleanup all listeners and handlers
165
+ */
166
+ cleanup(): void;
167
+ }
168
+ export default FirebaseNotificationManager;
169
+ //# sourceMappingURL=FirebaseNotificationManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FirebaseNotificationManager.d.ts","sourceRoot":"","sources":["../../../../../src/utils/FirebaseNotificationManager.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Logger utility for Swan SDK
3
+ * Allows enabling/disabling internal SDK logs
4
+ */
5
+ declare class Logger {
6
+ private static enabled;
7
+ /**
8
+ * Enable or disable logs
9
+ * @param enabled - boolean to enable/disable logs
10
+ */
11
+ static enableLogs(enabled: boolean): void;
12
+ /**
13
+ * Log message to console
14
+ * @param message - Message to log
15
+ * @param args - Additional arguments
16
+ */
17
+ static log(message: string, ...args: any[]): void;
18
+ /**
19
+ * Log warning to console
20
+ * @param message - Warning message
21
+ * @param args - Additional arguments
22
+ */
23
+ static warn(message: string, ...args: any[]): void;
24
+ /**
25
+ * Log error to console
26
+ * @param message - Error message
27
+ * @param args - Additional arguments
28
+ */
29
+ static error(message: string, ...args: any[]): void;
30
+ }
31
+ export default Logger;
32
+ //# sourceMappingURL=Logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../../../../src/utils/Logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAM,MAAM;IACR,OAAO,CAAC,MAAM,CAAC,OAAO,CAAS;IAE/B;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO;IAIlC;;;;OAIG;IACH,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;IAM1C;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;IAM3C;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;CAK/C;AAED,eAAe,MAAM,CAAC"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * SharedCredentialsManager
3
+ *
4
+ * Manages credentials storage in iOS App Groups for sharing between
5
+ * the main app and Notification Service Extension.
6
+ *
7
+ * This allows the extension to send delivery ACKs even when the app is killed.
8
+ */
9
+ export interface SharedCredentials {
10
+ appId: string;
11
+ deviceId: string;
12
+ cdid?: string;
13
+ ackUrl: string;
14
+ isProduction: string;
15
+ }
16
+ export declare class SharedCredentialsManager {
17
+ private static APP_GROUP_ID;
18
+ private static CREDENTIALS_KEY;
19
+ /**
20
+ * Save credentials to iOS App Group (for Notification Service Extension)
21
+ * On Android, this is a no-op as extensions don't exist.
22
+ */
23
+ static saveToAppGroup(credentials: SharedCredentials): Promise<void>;
24
+ /**
25
+ * Read credentials from iOS App Group
26
+ * Useful for debugging or fallback scenarios.
27
+ */
28
+ static readFromAppGroup(): Promise<SharedCredentials | null>;
29
+ /**
30
+ * Clear credentials from iOS App Group
31
+ * Useful during logout or SDK reset.
32
+ */
33
+ static clearFromAppGroup(): Promise<void>;
34
+ /**
35
+ * Configure custom App Group ID
36
+ * Call this before SDK init if you want to use a different App Group ID.
37
+ *
38
+ * @param appGroupId - Custom App Group ID (e.g., "group.com.yourcompany.app")
39
+ */
40
+ static setAppGroupId(appGroupId: string): void;
41
+ /**
42
+ * Get current App Group ID
43
+ */
44
+ static getAppGroupId(): string;
45
+ /**
46
+ * Check if iOS Notification Service Extension is active/configured
47
+ * Returns true if App Group is accessible (meaning NES is configured)
48
+ *
49
+ * This is used to determine if delivery ACKs should be skipped in the
50
+ * React Native background handler (since NES handles them)
51
+ */
52
+ static isNotificationServiceExtensionActive(): Promise<boolean>;
53
+ }
54
+ //# sourceMappingURL=SharedCredentialsManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SharedCredentialsManager.d.ts","sourceRoot":"","sources":["../../../../../src/utils/SharedCredentialsManager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,wBAAwB;IACnC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAkC;IAC7D,OAAO,CAAC,MAAM,CAAC,eAAe,CAAqB;IAEnD;;;OAGG;WACU,cAAc,CAAC,WAAW,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAmC1E;;;OAGG;WACU,gBAAgB,IAAI,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IA2BlE;;;OAGG;WACU,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAkB/C;;;;;OAKG;IACH,MAAM,CAAC,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAK9C;;OAEG;IACH,MAAM,CAAC,aAAa,IAAI,MAAM;IAI9B;;;;;;OAMG;WACU,oCAAoC,IAAI,OAAO,CAAC,OAAO,CAAC;CA0BtE"}
@@ -0,0 +1,2 @@
1
+ export declare const SDK_VERSION = "2.0.1";
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../../src/version.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,UAAU,CAAC"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,3 @@
1
+ declare const FooterNotification: ({ designConfig, onClose, onButtonClick }: any) => import("react/jsx-runtime").JSX.Element;
2
+ export default FooterNotification;
3
+ //# sourceMappingURL=FooterView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FooterView.d.ts","sourceRoot":"","sources":["../../../../../src/components/FooterView.tsx"],"names":[],"mappings":"AAWA,QAAA,MAAM,kBAAkB,GAAI,0CAA0C,GAAG,4CA+DxE,CAAC;AAiDF,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const FullScreenView: ({ designConfig, onClose, onButtonClick }: any) => import("react/jsx-runtime").JSX.Element;
2
+ export default FullScreenView;
3
+ //# sourceMappingURL=FullScreenView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FullScreenView.d.ts","sourceRoot":"","sources":["../../../../../src/components/FullScreenView.tsx"],"names":[],"mappings":"AAGA,QAAA,MAAM,cAAc,GAAI,0CAA0C,GAAG,4CAsGpE,CAAC;AA+DF,eAAe,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const HeaderView: ({ designConfig, onClose, onButtonClick }: any) => import("react/jsx-runtime").JSX.Element;
2
+ export default HeaderView;
3
+ //# sourceMappingURL=HeaderView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeaderView.d.ts","sourceRoot":"","sources":["../../../../../src/components/HeaderView.tsx"],"names":[],"mappings":"AAYA,QAAA,MAAM,UAAU,GAAI,0CAA+C,GAAG,4CAoIrE,CAAC;AA+EF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const PopUpView: ({ designConfig, onClose, onButtonClick }: any) => import("react/jsx-runtime").JSX.Element;
2
+ export default PopUpView;
3
+ //# sourceMappingURL=PopUpView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PopUpView.d.ts","sourceRoot":"","sources":["../../../../../src/components/PopUpView.tsx"],"names":[],"mappings":"AAGA,QAAA,MAAM,SAAS,GAAI,0CAA0C,GAAG,4CAoH/D,CAAC;AAuEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type BatchConfiguration } from '../types/EventQueue';
2
+ /**
3
+ * Default configuration for event batching
4
+ * Based on industry standards (CleverTap, Segment, Mixpanel)
5
+ */
6
+ export declare const DEFAULT_BATCH_CONFIG: BatchConfiguration;
7
+ //# sourceMappingURL=BatchConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BatchConfig.d.ts","sourceRoot":"","sources":["../../../../../src/config/BatchConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,kBA+ClC,CAAC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * API URLs used across the SDK
3
+ * Centralized to avoid circular dependencies
4
+ */
5
+ export declare const ECOM_ENRICH_PROFILE_URL: {
6
+ STAGE: string;
7
+ PROD: string;
8
+ };
9
+ export declare const ECOM_TRACK_EVENT_URL: {
10
+ STAGE: string;
11
+ PROD: string;
12
+ };
13
+ export declare const ECOM_DEVICE_REGISTER_URL: {
14
+ STAGE: string;
15
+ PROD: string;
16
+ };
17
+ export declare const ECOM_PUSH_SUBSCRIPTION_URL: {
18
+ STAGE: string;
19
+ PROD: string;
20
+ };
21
+ export declare const WEBHOOK_MOBILE_PUSH_URL: {
22
+ STAGE: string;
23
+ PROD: string;
24
+ };
25
+ export declare const NOTIFICATION_GET_URL: {
26
+ STAGE: string;
27
+ PROD: string;
28
+ };
29
+ declare const _default: {
30
+ ECOM_ENRICH_PROFILE_URL: {
31
+ STAGE: string;
32
+ PROD: string;
33
+ };
34
+ ECOM_TRACK_EVENT_URL: {
35
+ STAGE: string;
36
+ PROD: string;
37
+ };
38
+ ECOM_DEVICE_REGISTER_URL: {
39
+ STAGE: string;
40
+ PROD: string;
41
+ };
42
+ ECOM_PUSH_SUBSCRIPTION_URL: {
43
+ STAGE: string;
44
+ PROD: string;
45
+ };
46
+ WEBHOOK_MOBILE_PUSH_URL: {
47
+ STAGE: string;
48
+ PROD: string;
49
+ };
50
+ NOTIFICATION_GET_URL: {
51
+ STAGE: string;
52
+ PROD: string;
53
+ };
54
+ };
55
+ export default _default;
56
+ //# sourceMappingURL=ApiUrls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiUrls.d.ts","sourceRoot":"","sources":["../../../../../src/constants/ApiUrls.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiBH,eAAO,MAAM,uBAAuB;;;CAGnC,CAAA;AAED,eAAO,MAAM,oBAAoB;;;CAGhC,CAAA;AAED,eAAO,MAAM,wBAAwB;;;CAGpC,CAAA;AAED,eAAO,MAAM,0BAA0B;;;CAGtC,CAAA;AAED,eAAO,MAAM,uBAAuB;;;CAGnC,CAAA;AAED,eAAO,MAAM,oBAAoB;;;CAGhC,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAED,wBAOC"}
@@ -0,0 +1,63 @@
1
+ import { type QueuedEvent } from '../types/EventQueue';
2
+ /**
3
+ * EventQueueManager
4
+ * Manages persistent event queue using SQLite
5
+ * Handles enqueue, dequeue, status updates, and cleanup operations
6
+ */
7
+ export declare class EventQueueManager {
8
+ private db;
9
+ private maxRetries;
10
+ constructor(db: any, maxRetries?: number);
11
+ /**
12
+ * Create EventQueue table with indexes
13
+ * Called during SDK initialization
14
+ */
15
+ createTable(): Promise<void>;
16
+ /**
17
+ * Add event to queue
18
+ * @param event Event to enqueue
19
+ */
20
+ enqueue(event: QueuedEvent): Promise<void>;
21
+ /**
22
+ * Retrieve events from queue for batch sending
23
+ * Priority events first, then FIFO
24
+ * @param batchSize Maximum number of events to retrieve
25
+ * @returns Array of queued events
26
+ */
27
+ dequeue(batchSize: number): Promise<QueuedEvent[]>;
28
+ /**
29
+ * Mark events as successfully sent and remove from queue
30
+ * @param eventIds Array of event IDs to mark as sent
31
+ */
32
+ markAsSent(eventIds: string[]): Promise<void>;
33
+ /**
34
+ * Mark events as failed and update retry count
35
+ * @param eventIds Array of event IDs that failed
36
+ * @param retryCount New retry count
37
+ */
38
+ markAsFailed(eventIds: string[], retryCount: number): Promise<void>;
39
+ /**
40
+ * Get current queue size (pending events only)
41
+ * @returns Number of pending events in queue
42
+ */
43
+ getQueueSize(): Promise<number>;
44
+ /**
45
+ * Clean up old failed events
46
+ * Deletes events older than specified days with status 'failed'
47
+ * @param daysOld Number of days old to consider for deletion
48
+ */
49
+ clearOldEvents(daysOld: number): Promise<void>;
50
+ /**
51
+ * Drop oldest events when queue is full
52
+ * Keeps queue size within limits by removing oldest pending events
53
+ * @param maxSize Maximum queue size to maintain
54
+ */
55
+ enforceQueueLimit(maxSize: number): Promise<void>;
56
+ /**
57
+ * Recover stale 'sending' events back to 'pending'
58
+ * Called on SDK initialization to handle app crashes during flush
59
+ * Resets events stuck in 'sending' status for more than 5 minutes
60
+ */
61
+ recoverStaleEvents(): Promise<void>;
62
+ }
63
+ //# sourceMappingURL=EventQueueManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventQueueManager.d.ts","sourceRoot":"","sources":["../../../../../src/core/EventQueueManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGvD;;;;GAIG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,EAAE,CAAM;IAChB,OAAO,CAAC,UAAU,CAAS;gBAEf,EAAE,EAAE,GAAG,EAAE,UAAU,GAAE,MAAU;IAK3C;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAkElC;;;OAGG;IACG,OAAO,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAuChD;;;;;OAKG;IACG,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IA2ExD;;;OAGG;IACG,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAoCnD;;;;OAIG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA4CzE;;;OAGG;IACG,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IA4BrC;;;;OAIG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA8BpD;;;;OAIG;IACG,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsCvD;;;;OAIG;IACG,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;CAoC1C"}
@@ -0,0 +1,63 @@
1
+ import { EventQueueManager } from './EventQueueManager';
2
+ import { NetworkMonitor } from './NetworkMonitor';
3
+ import { type BatchConfiguration, type QueuedEvent } from '../types/EventQueue';
4
+ /**
5
+ * FlushManager
6
+ * Orchestrates batch sending with multiple flush triggers:
7
+ * - Time interval (every 30s)
8
+ * - Queue size (when batchSize reached)
9
+ * - App lifecycle (on background)
10
+ * - Network restoration (when back online)
11
+ */
12
+ export declare class FlushManager {
13
+ private queueManager;
14
+ private networkMonitor;
15
+ private config;
16
+ private sendBatchCallback;
17
+ private flushTimer;
18
+ private isFlushing;
19
+ private appStateSubscription;
20
+ private retryTimeouts;
21
+ constructor(queueManager: EventQueueManager, networkMonitor: NetworkMonitor, config: BatchConfiguration, sendBatchCallback: (events: QueuedEvent[]) => Promise<any>);
22
+ /**
23
+ * Start flush manager
24
+ * - Initializes timer-based flushing
25
+ * - Sets up AppState listener
26
+ * - Sets up network state listener
27
+ */
28
+ start(): void;
29
+ /**
30
+ * Stop flush manager
31
+ * - Clears timer
32
+ * - Removes listeners
33
+ * - Cancels pending retries
34
+ */
35
+ stop(): void;
36
+ /**
37
+ * Trigger batch flush
38
+ * Prevents concurrent flushes using promise-based lock
39
+ * @param force If true, bypasses online check
40
+ * @returns Batch response from server
41
+ */
42
+ flush(force?: boolean): Promise<any>;
43
+ /**
44
+ * Handle batch response with granular event-level success/failure
45
+ * Parses individual event results and handles each one appropriately
46
+ * @param events Events that were sent in the batch
47
+ * @param batchResponse Response from server with individual event results
48
+ */
49
+ private handleBatchResponse;
50
+ /**
51
+ * Handle failed batch with retry logic (entire batch failed due to network/server error)
52
+ * Implements exponential backoff: 2s, 4s, 8s, 16s, 32s
53
+ * @param events Events that failed to send
54
+ * @param error Error that occurred
55
+ */
56
+ private handleFailedBatch;
57
+ /**
58
+ * Check if flush is needed based on queue size
59
+ * Called after each event is enqueued
60
+ */
61
+ checkFlushNeeded(): Promise<void>;
62
+ }
63
+ //# sourceMappingURL=FlushManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlushManager.d.ts","sourceRoot":"","sources":["../../../../../src/core/FlushManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGhF;;;;;;;GAOG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,YAAY,CAAoB;IACxC,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,iBAAiB,CAA0C;IAEnE,OAAO,CAAC,UAAU,CAA+B;IACjD,OAAO,CAAC,UAAU,CAA6B;IAC/C,OAAO,CAAC,oBAAoB,CAAa;IACzC,OAAO,CAAC,aAAa,CAA0C;gBAG7D,YAAY,EAAE,iBAAiB,EAC/B,cAAc,EAAE,cAAc,EAC9B,MAAM,EAAE,kBAAkB,EAC1B,iBAAiB,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC;IAQ5D;;;;;OAKG;IACH,KAAK,IAAI,IAAI;IA8Bb;;;;;OAKG;IACH,IAAI,IAAI,IAAI;IAoBZ;;;;;OAKG;IACG,KAAK,CAAC,KAAK,GAAE,OAAe,GAAG,OAAO,CAAC,GAAG,CAAC;IAoDjD;;;;;OAKG;YACW,mBAAmB;IAgFjC;;;;;OAKG;YACW,iBAAiB;IAmC/B;;;OAGG;IACG,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;CAcxC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * NetworkMonitor
3
+ * Monitors network connectivity status
4
+ * Notifies when connection status changes
5
+ */
6
+ export declare class NetworkMonitor {
7
+ private isOnline;
8
+ private unsubscribe;
9
+ private listeners;
10
+ /**
11
+ * Start monitoring network state
12
+ */
13
+ start(): void;
14
+ /**
15
+ * Stop monitoring network state
16
+ */
17
+ stop(): void;
18
+ /**
19
+ * Check if currently connected to network
20
+ * @returns true if connected, false otherwise
21
+ */
22
+ isConnected(): boolean;
23
+ /**
24
+ * Add listener for connection state changes
25
+ * @param callback Function called when connection state changes
26
+ */
27
+ addListener(callback: (isOnline: boolean) => void): void;
28
+ /**
29
+ * Remove listener
30
+ * @param callback Listener to remove
31
+ */
32
+ removeListener(callback: (isOnline: boolean) => void): void;
33
+ /**
34
+ * Notify all listeners of connection state change
35
+ */
36
+ private notifyListeners;
37
+ }
38
+ //# sourceMappingURL=NetworkMonitor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NetworkMonitor.d.ts","sourceRoot":"","sources":["../../../../../src/core/NetworkMonitor.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,WAAW,CAAoC;IACvD,OAAO,CAAC,SAAS,CAA+C;IAEhE;;OAEG;IACH,KAAK,IAAI,IAAI;IA8Bb;;OAEG;IACH,IAAI,IAAI,IAAI;IAQZ;;;OAGG;IACH,WAAW,IAAI,OAAO;IAItB;;;OAGG;IACH,WAAW,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;IAIxD;;;OAGG;IACH,cAAc,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;IAI3D;;OAEG;IACH,OAAO,CAAC,eAAe;CASxB"}