@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.
- package/LICENSE +55 -0
- package/README.md +67 -0
- package/docs/IOS_NOTIFICATION_EXTENSION_SETUP.md +335 -0
- package/ios/README.md +64 -0
- package/ios/SwanNotificationServiceExtension/Info.plist +31 -0
- package/ios/SwanNotificationServiceExtension/NotificationService.swift +337 -0
- package/ios/SwanNotificationServiceExtension/SwanNotificationServiceExtension.entitlements +10 -0
- package/lib/commonjs/components/FooterView.js +125 -0
- package/lib/commonjs/components/FooterView.js.map +1 -0
- package/lib/commonjs/components/FullScreenView.js +172 -0
- package/lib/commonjs/components/FullScreenView.js.map +1 -0
- package/lib/commonjs/components/HeaderView.js +205 -0
- package/lib/commonjs/components/HeaderView.js.map +1 -0
- package/lib/commonjs/components/PopUpView.js +186 -0
- package/lib/commonjs/components/PopUpView.js.map +1 -0
- package/lib/commonjs/config/BatchConfig.js +53 -0
- package/lib/commonjs/config/BatchConfig.js.map +1 -0
- package/lib/commonjs/constants/ApiUrls.js +56 -0
- package/lib/commonjs/constants/ApiUrls.js.map +1 -0
- package/lib/commonjs/core/EventQueueManager.js +345 -0
- package/lib/commonjs/core/EventQueueManager.js.map +1 -0
- package/lib/commonjs/core/FlushManager.js +245 -0
- package/lib/commonjs/core/FlushManager.js.map +1 -0
- package/lib/commonjs/core/NetworkMonitor.js +97 -0
- package/lib/commonjs/core/NetworkMonitor.js.map +1 -0
- package/lib/commonjs/index.js +3506 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/providers/FirebasePushProvider.js +130 -0
- package/lib/commonjs/providers/FirebasePushProvider.js.map +1 -0
- package/lib/commonjs/providers/NullPushProvider.js +59 -0
- package/lib/commonjs/providers/NullPushProvider.js.map +1 -0
- package/lib/commonjs/providers/PushNotificationProvider.js +30 -0
- package/lib/commonjs/providers/PushNotificationProvider.js.map +1 -0
- package/lib/commonjs/services/DeviceRegistrationService.js +248 -0
- package/lib/commonjs/services/DeviceRegistrationService.js.map +1 -0
- package/lib/commonjs/services/PushTokenService.js +284 -0
- package/lib/commonjs/services/PushTokenService.js.map +1 -0
- package/lib/commonjs/state/AuthStateMachine.js +161 -0
- package/lib/commonjs/state/AuthStateMachine.js.map +1 -0
- package/lib/commonjs/state/DeviceStateMachine.js +104 -0
- package/lib/commonjs/state/DeviceStateMachine.js.map +1 -0
- package/lib/commonjs/state/PushStateMachine.js +129 -0
- package/lib/commonjs/state/PushStateMachine.js.map +1 -0
- package/lib/commonjs/types/EventQueue.js +50 -0
- package/lib/commonjs/types/EventQueue.js.map +1 -0
- package/lib/commonjs/types/SDK.js +2 -0
- package/lib/commonjs/types/SDK.js.map +1 -0
- package/lib/commonjs/utils/FirebaseNotificationManager.js +492 -0
- package/lib/commonjs/utils/FirebaseNotificationManager.js.map +1 -0
- package/lib/commonjs/utils/Logger.js +56 -0
- package/lib/commonjs/utils/Logger.js.map +1 -0
- package/lib/commonjs/utils/SharedCredentialsManager.js +146 -0
- package/lib/commonjs/utils/SharedCredentialsManager.js.map +1 -0
- package/lib/commonjs/version.js +12 -0
- package/lib/commonjs/version.js.map +1 -0
- package/lib/module/components/FooterView.js +121 -0
- package/lib/module/components/FooterView.js.map +1 -0
- package/lib/module/components/FullScreenView.js +167 -0
- package/lib/module/components/FullScreenView.js.map +1 -0
- package/lib/module/components/HeaderView.js +199 -0
- package/lib/module/components/HeaderView.js.map +1 -0
- package/lib/module/components/PopUpView.js +181 -0
- package/lib/module/components/PopUpView.js.map +1 -0
- package/lib/module/config/BatchConfig.js +49 -0
- package/lib/module/config/BatchConfig.js.map +1 -0
- package/lib/module/constants/ApiUrls.js +52 -0
- package/lib/module/constants/ApiUrls.js.map +1 -0
- package/lib/module/core/EventQueueManager.js +340 -0
- package/lib/module/core/EventQueueManager.js.map +1 -0
- package/lib/module/core/FlushManager.js +240 -0
- package/lib/module/core/FlushManager.js.map +1 -0
- package/lib/module/core/NetworkMonitor.js +92 -0
- package/lib/module/core/NetworkMonitor.js.map +1 -0
- package/lib/module/index.js +3494 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/providers/FirebasePushProvider.js +124 -0
- package/lib/module/providers/FirebasePushProvider.js.map +1 -0
- package/lib/module/providers/NullPushProvider.js +53 -0
- package/lib/module/providers/NullPushProvider.js.map +1 -0
- package/lib/module/providers/PushNotificationProvider.js +26 -0
- package/lib/module/providers/PushNotificationProvider.js.map +1 -0
- package/lib/module/services/DeviceRegistrationService.js +243 -0
- package/lib/module/services/DeviceRegistrationService.js.map +1 -0
- package/lib/module/services/PushTokenService.js +278 -0
- package/lib/module/services/PushTokenService.js.map +1 -0
- package/lib/module/state/AuthStateMachine.js +155 -0
- package/lib/module/state/AuthStateMachine.js.map +1 -0
- package/lib/module/state/DeviceStateMachine.js +98 -0
- package/lib/module/state/DeviceStateMachine.js.map +1 -0
- package/lib/module/state/PushStateMachine.js +123 -0
- package/lib/module/state/PushStateMachine.js.map +1 -0
- package/lib/module/types/EventQueue.js +46 -0
- package/lib/module/types/EventQueue.js.map +1 -0
- package/lib/module/types/SDK.js +2 -0
- package/lib/module/types/SDK.js.map +1 -0
- package/lib/module/utils/FirebaseNotificationManager.js +486 -0
- package/lib/module/utils/FirebaseNotificationManager.js.map +1 -0
- package/lib/module/utils/Logger.js +52 -0
- package/lib/module/utils/Logger.js.map +1 -0
- package/lib/module/utils/SharedCredentialsManager.js +140 -0
- package/lib/module/utils/SharedCredentialsManager.js.map +1 -0
- package/lib/module/version.js +8 -0
- package/lib/module/version.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/components/FooterView.d.ts +3 -0
- package/lib/typescript/commonjs/src/components/FooterView.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/FullScreenView.d.ts +3 -0
- package/lib/typescript/commonjs/src/components/FullScreenView.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/HeaderView.d.ts +3 -0
- package/lib/typescript/commonjs/src/components/HeaderView.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/PopUpView.d.ts +3 -0
- package/lib/typescript/commonjs/src/components/PopUpView.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/config/BatchConfig.d.ts +7 -0
- package/lib/typescript/commonjs/src/config/BatchConfig.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/constants/ApiUrls.d.ts +56 -0
- package/lib/typescript/commonjs/src/constants/ApiUrls.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/EventQueueManager.d.ts +63 -0
- package/lib/typescript/commonjs/src/core/EventQueueManager.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/FlushManager.d.ts +63 -0
- package/lib/typescript/commonjs/src/core/FlushManager.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/NetworkMonitor.d.ts +38 -0
- package/lib/typescript/commonjs/src/core/NetworkMonitor.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +663 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/FirebasePushProvider.d.ts +28 -0
- package/lib/typescript/commonjs/src/providers/FirebasePushProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/NullPushProvider.d.ts +25 -0
- package/lib/typescript/commonjs/src/providers/NullPushProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/PushNotificationProvider.d.ts +105 -0
- package/lib/typescript/commonjs/src/providers/PushNotificationProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/services/DeviceRegistrationService.d.ts +60 -0
- package/lib/typescript/commonjs/src/services/DeviceRegistrationService.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/services/PushTokenService.d.ts +82 -0
- package/lib/typescript/commonjs/src/services/PushTokenService.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/state/AuthStateMachine.d.ts +61 -0
- package/lib/typescript/commonjs/src/state/AuthStateMachine.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/state/DeviceStateMachine.d.ts +51 -0
- package/lib/typescript/commonjs/src/state/DeviceStateMachine.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/state/PushStateMachine.d.ts +61 -0
- package/lib/typescript/commonjs/src/state/PushStateMachine.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/EventQueue.d.ts +85 -0
- package/lib/typescript/commonjs/src/types/EventQueue.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/SDK.d.ts +54 -0
- package/lib/typescript/commonjs/src/types/SDK.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/FirebaseNotificationManager.d.ts +169 -0
- package/lib/typescript/commonjs/src/utils/FirebaseNotificationManager.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/Logger.d.ts +32 -0
- package/lib/typescript/commonjs/src/utils/Logger.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/SharedCredentialsManager.d.ts +54 -0
- package/lib/typescript/commonjs/src/utils/SharedCredentialsManager.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/version.d.ts +2 -0
- package/lib/typescript/commonjs/src/version.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/components/FooterView.d.ts +3 -0
- package/lib/typescript/module/src/components/FooterView.d.ts.map +1 -0
- package/lib/typescript/module/src/components/FullScreenView.d.ts +3 -0
- package/lib/typescript/module/src/components/FullScreenView.d.ts.map +1 -0
- package/lib/typescript/module/src/components/HeaderView.d.ts +3 -0
- package/lib/typescript/module/src/components/HeaderView.d.ts.map +1 -0
- package/lib/typescript/module/src/components/PopUpView.d.ts +3 -0
- package/lib/typescript/module/src/components/PopUpView.d.ts.map +1 -0
- package/lib/typescript/module/src/config/BatchConfig.d.ts +7 -0
- package/lib/typescript/module/src/config/BatchConfig.d.ts.map +1 -0
- package/lib/typescript/module/src/constants/ApiUrls.d.ts +56 -0
- package/lib/typescript/module/src/constants/ApiUrls.d.ts.map +1 -0
- package/lib/typescript/module/src/core/EventQueueManager.d.ts +63 -0
- package/lib/typescript/module/src/core/EventQueueManager.d.ts.map +1 -0
- package/lib/typescript/module/src/core/FlushManager.d.ts +63 -0
- package/lib/typescript/module/src/core/FlushManager.d.ts.map +1 -0
- package/lib/typescript/module/src/core/NetworkMonitor.d.ts +38 -0
- package/lib/typescript/module/src/core/NetworkMonitor.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +663 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/FirebasePushProvider.d.ts +28 -0
- package/lib/typescript/module/src/providers/FirebasePushProvider.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/NullPushProvider.d.ts +25 -0
- package/lib/typescript/module/src/providers/NullPushProvider.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/PushNotificationProvider.d.ts +105 -0
- package/lib/typescript/module/src/providers/PushNotificationProvider.d.ts.map +1 -0
- package/lib/typescript/module/src/services/DeviceRegistrationService.d.ts +60 -0
- package/lib/typescript/module/src/services/DeviceRegistrationService.d.ts.map +1 -0
- package/lib/typescript/module/src/services/PushTokenService.d.ts +82 -0
- package/lib/typescript/module/src/services/PushTokenService.d.ts.map +1 -0
- package/lib/typescript/module/src/state/AuthStateMachine.d.ts +61 -0
- package/lib/typescript/module/src/state/AuthStateMachine.d.ts.map +1 -0
- package/lib/typescript/module/src/state/DeviceStateMachine.d.ts +51 -0
- package/lib/typescript/module/src/state/DeviceStateMachine.d.ts.map +1 -0
- package/lib/typescript/module/src/state/PushStateMachine.d.ts +61 -0
- package/lib/typescript/module/src/state/PushStateMachine.d.ts.map +1 -0
- package/lib/typescript/module/src/types/EventQueue.d.ts +85 -0
- package/lib/typescript/module/src/types/EventQueue.d.ts.map +1 -0
- package/lib/typescript/module/src/types/SDK.d.ts +54 -0
- package/lib/typescript/module/src/types/SDK.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/FirebaseNotificationManager.d.ts +169 -0
- package/lib/typescript/module/src/utils/FirebaseNotificationManager.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/Logger.d.ts +32 -0
- package/lib/typescript/module/src/utils/Logger.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/SharedCredentialsManager.d.ts +54 -0
- package/lib/typescript/module/src/utils/SharedCredentialsManager.d.ts.map +1 -0
- package/lib/typescript/module/src/version.d.ts +2 -0
- package/lib/typescript/module/src/version.d.ts.map +1 -0
- package/package.json +230 -0
- package/scripts/generate-version.js +25 -0
- 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":"AAAA;;;;;;;;;;GAUG;AAMH,eAAO,MAAM,wBAAwB;;;;;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IAWrE;;;;OAIG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,IAAI;IAc7C;;OAEG;IACH,OAAO,IAAI,IAAI;CA2BhB;AAED,eAAe,2BAA2B,CAAC"}
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../../src/version.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,UAAU,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@loyalytics/swan-react-native-sdk",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "React Native SDK for Swan",
|
|
5
|
+
"source": "./src/index.tsx",
|
|
6
|
+
"main": "./lib/commonjs/index.js",
|
|
7
|
+
"module": "./lib/module/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./lib/typescript/module/src/index.d.ts",
|
|
12
|
+
"default": "./lib/module/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./lib/typescript/commonjs/src/index.d.ts",
|
|
16
|
+
"default": "./lib/commonjs/index.js"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"lib",
|
|
22
|
+
"android",
|
|
23
|
+
"ios",
|
|
24
|
+
"cpp",
|
|
25
|
+
"scripts",
|
|
26
|
+
"docs",
|
|
27
|
+
"*.podspec",
|
|
28
|
+
"react-native.config.json",
|
|
29
|
+
"!ios/build",
|
|
30
|
+
"!android/build",
|
|
31
|
+
"!android/gradle",
|
|
32
|
+
"!android/gradlew",
|
|
33
|
+
"!android/gradlew.bat",
|
|
34
|
+
"!android/local.properties",
|
|
35
|
+
"!**/__tests__",
|
|
36
|
+
"!**/__fixtures__",
|
|
37
|
+
"!**/__mocks__",
|
|
38
|
+
"!**/.*"
|
|
39
|
+
],
|
|
40
|
+
"scripts": {
|
|
41
|
+
"example": "yarn workspace swan-react-native-sdk-example start",
|
|
42
|
+
"test": "jest",
|
|
43
|
+
"typecheck": "tsc",
|
|
44
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
45
|
+
"clean": "del-cli lib",
|
|
46
|
+
"prepare": "node scripts/generate-version.js && bob build",
|
|
47
|
+
"release": "release-it",
|
|
48
|
+
"android": "expo run:android",
|
|
49
|
+
"ios": "expo run:ios",
|
|
50
|
+
"setup-ios-extension": "node ./scripts/setup-ios-extension.js",
|
|
51
|
+
"changeset": "changeset",
|
|
52
|
+
"release:version": "changeset version && yarn install --immutable",
|
|
53
|
+
"release:publish": "yarn prepare && changeset publish"
|
|
54
|
+
},
|
|
55
|
+
"keywords": [
|
|
56
|
+
"react-native",
|
|
57
|
+
"ios",
|
|
58
|
+
"android"
|
|
59
|
+
],
|
|
60
|
+
"repository": {
|
|
61
|
+
"type": "git",
|
|
62
|
+
"url": "git++ssh:///git@github.com/loyalytics/swan-react-native-sdk.git"
|
|
63
|
+
},
|
|
64
|
+
"author": "Loyalytics <support@loyalytics.ai> (https://www.loyalytics.ai/)",
|
|
65
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
66
|
+
"bugs": {
|
|
67
|
+
"url": "https://github.com/loyalytics/swan-react-native-sdk/issues"
|
|
68
|
+
},
|
|
69
|
+
"homepage": "https://github.com/loyalytics/swan-react-native-sdk#readme",
|
|
70
|
+
"publishConfig": {
|
|
71
|
+
"registry": "https://registry.npmjs.org/",
|
|
72
|
+
"access": "public"
|
|
73
|
+
},
|
|
74
|
+
"devDependencies": {
|
|
75
|
+
"@changesets/cli": "^2.27.1",
|
|
76
|
+
"@commitlint/config-conventional": "^17.0.2",
|
|
77
|
+
"@evilmartians/lefthook": "^1.5.0",
|
|
78
|
+
"@react-native/eslint-config": "^0.73.1",
|
|
79
|
+
"@release-it/conventional-changelog": "^9.0.2",
|
|
80
|
+
"@types/jest": "^29.5.5",
|
|
81
|
+
"@types/react": "^18.2.44",
|
|
82
|
+
"@types/react-native": "^0.73.0",
|
|
83
|
+
"@types/react-native-base64": "^0.2.2",
|
|
84
|
+
"@types/react-native-sqlite-storage": "^6.0.5",
|
|
85
|
+
"@types/react-native-vector-icons": "^6.4.18",
|
|
86
|
+
"changeset-conventional-commits": "^0.2.5",
|
|
87
|
+
"commitlint": "^17.0.2",
|
|
88
|
+
"del-cli": "^5.1.0",
|
|
89
|
+
"eslint": "^8.51.0",
|
|
90
|
+
"eslint-config-prettier": "^9.0.0",
|
|
91
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
92
|
+
"firebase-admin": "^13.6.0",
|
|
93
|
+
"jest": "^29.7.0",
|
|
94
|
+
"prettier": "^3.0.3",
|
|
95
|
+
"react": "18.3.1",
|
|
96
|
+
"react-native": "0.76.2",
|
|
97
|
+
"react-native-builder-bob": "^0.32.1",
|
|
98
|
+
"release-it": "^17.10.0",
|
|
99
|
+
"typescript": "^5.2.2"
|
|
100
|
+
},
|
|
101
|
+
"resolutions": {
|
|
102
|
+
"@types/react": "^18.2.44"
|
|
103
|
+
},
|
|
104
|
+
"peerDependencies": {
|
|
105
|
+
"@notifee/react-native": "^9.1.8",
|
|
106
|
+
"@react-native-firebase/app": "^21.14.0",
|
|
107
|
+
"@react-native-firebase/messaging": "^21.14.0",
|
|
108
|
+
"react": "*",
|
|
109
|
+
"react-native": "*"
|
|
110
|
+
},
|
|
111
|
+
"peerDependenciesMeta": {
|
|
112
|
+
"@notifee/react-native": {
|
|
113
|
+
"optional": true
|
|
114
|
+
},
|
|
115
|
+
"@react-native-firebase/app": {
|
|
116
|
+
"optional": true
|
|
117
|
+
},
|
|
118
|
+
"@react-native-firebase/messaging": {
|
|
119
|
+
"optional": true
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"workspaces": [
|
|
123
|
+
"example"
|
|
124
|
+
],
|
|
125
|
+
"packageManager": "yarn@3.6.1",
|
|
126
|
+
"jest": {
|
|
127
|
+
"preset": "react-native",
|
|
128
|
+
"modulePathIgnorePatterns": [
|
|
129
|
+
"<rootDir>/example/node_modules",
|
|
130
|
+
"<rootDir>/lib/"
|
|
131
|
+
]
|
|
132
|
+
},
|
|
133
|
+
"commitlint": {
|
|
134
|
+
"extends": [
|
|
135
|
+
"@commitlint/config-conventional"
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
"release-it": {
|
|
139
|
+
"git": {
|
|
140
|
+
"commitMessage": "chore: release ${version}",
|
|
141
|
+
"tagName": "v${version}"
|
|
142
|
+
},
|
|
143
|
+
"npm": {
|
|
144
|
+
"publish": true
|
|
145
|
+
},
|
|
146
|
+
"github": {
|
|
147
|
+
"release": true
|
|
148
|
+
},
|
|
149
|
+
"plugins": {
|
|
150
|
+
"@release-it/conventional-changelog": {
|
|
151
|
+
"preset": "angular"
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"eslintConfig": {
|
|
156
|
+
"root": true,
|
|
157
|
+
"extends": [
|
|
158
|
+
"@react-native",
|
|
159
|
+
"prettier"
|
|
160
|
+
],
|
|
161
|
+
"rules": {
|
|
162
|
+
"react/react-in-jsx-scope": "off",
|
|
163
|
+
"prettier/prettier": [
|
|
164
|
+
"error",
|
|
165
|
+
{
|
|
166
|
+
"quoteProps": "consistent",
|
|
167
|
+
"singleQuote": true,
|
|
168
|
+
"tabWidth": 2,
|
|
169
|
+
"trailingComma": "es5",
|
|
170
|
+
"useTabs": false
|
|
171
|
+
}
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
"eslintIgnore": [
|
|
176
|
+
"node_modules/",
|
|
177
|
+
"lib/"
|
|
178
|
+
],
|
|
179
|
+
"prettier": {
|
|
180
|
+
"quoteProps": "consistent",
|
|
181
|
+
"singleQuote": true,
|
|
182
|
+
"tabWidth": 2,
|
|
183
|
+
"trailingComma": "es5",
|
|
184
|
+
"useTabs": false
|
|
185
|
+
},
|
|
186
|
+
"react-native-builder-bob": {
|
|
187
|
+
"source": "src",
|
|
188
|
+
"output": "lib",
|
|
189
|
+
"targets": [
|
|
190
|
+
[
|
|
191
|
+
"commonjs",
|
|
192
|
+
{
|
|
193
|
+
"esm": true
|
|
194
|
+
}
|
|
195
|
+
],
|
|
196
|
+
[
|
|
197
|
+
"module",
|
|
198
|
+
{
|
|
199
|
+
"esm": true
|
|
200
|
+
}
|
|
201
|
+
],
|
|
202
|
+
[
|
|
203
|
+
"typescript",
|
|
204
|
+
{
|
|
205
|
+
"project": "tsconfig.build.json",
|
|
206
|
+
"esm": true
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
]
|
|
210
|
+
},
|
|
211
|
+
"create-react-native-library": {
|
|
212
|
+
"languages": "js",
|
|
213
|
+
"type": "library",
|
|
214
|
+
"version": "0.44.1"
|
|
215
|
+
},
|
|
216
|
+
"dependencies": {
|
|
217
|
+
"@react-native-async-storage/async-storage": "2.2.0",
|
|
218
|
+
"@react-native-community/geolocation": "^3.4.0",
|
|
219
|
+
"@react-native-community/netinfo": "^11.0.0",
|
|
220
|
+
"expo": "~52.0.47",
|
|
221
|
+
"react": "*",
|
|
222
|
+
"react-native": "*",
|
|
223
|
+
"react-native-base64": "^0.2.1",
|
|
224
|
+
"react-native-device-info": "^14.0.1",
|
|
225
|
+
"react-native-shared-group-preferences": "^1.1.24",
|
|
226
|
+
"react-native-sqlite-2": "^3.6.2",
|
|
227
|
+
"react-native-uuid": "^2.0.3",
|
|
228
|
+
"react-native-vector-icons": "^10.2.0"
|
|
229
|
+
}
|
|
230
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Generate src/version.ts from package.json version
|
|
5
|
+
* This ensures the version is bundled correctly in React Native
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
|
|
11
|
+
const packageJsonPath = path.join(__dirname, '..', 'package.json');
|
|
12
|
+
const versionFilePath = path.join(__dirname, '..', 'src', 'version.ts');
|
|
13
|
+
|
|
14
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
15
|
+
const version = packageJson.version;
|
|
16
|
+
|
|
17
|
+
const content = `// Auto-generated file. Do not edit manually.
|
|
18
|
+
// This file is generated from package.json version during build.
|
|
19
|
+
// See scripts/generate-version.js
|
|
20
|
+
|
|
21
|
+
export const SDK_VERSION = '${version}';
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
fs.writeFileSync(versionFilePath, content, 'utf8');
|
|
25
|
+
console.log(`✅ Generated version.ts with version: ${version}`);
|