@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,663 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Swan React Native SDK
|
|
3
|
+
* Copyright (c) 2025 Loyalytics. All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* PROPRIETARY AND CONFIDENTIAL
|
|
6
|
+
* Unauthorized copying, modification, distribution, or use of this software
|
|
7
|
+
* is strictly prohibited. See LICENSE file for full terms.
|
|
8
|
+
*
|
|
9
|
+
* For licensing inquiries: support@loyalytics.ai
|
|
10
|
+
*/
|
|
11
|
+
import type { SwanSDKConfig } from './types/SDK';
|
|
12
|
+
import { SharedCredentialsManager } from './utils/SharedCredentialsManager';
|
|
13
|
+
export declare const SWAN_NOTIFICATION_CHANNELS: Readonly<{
|
|
14
|
+
TRANSACTIONAL: "swan_transactional";
|
|
15
|
+
ALERTS: "swan_alerts";
|
|
16
|
+
PROMOTIONAL: "swan_promotional";
|
|
17
|
+
GENERAL: "swan_general";
|
|
18
|
+
DEFAULT: "swan_notifications";
|
|
19
|
+
}>;
|
|
20
|
+
declare const ECOM_EVENTS: Readonly<{
|
|
21
|
+
APP_LAUNCHED: "appLaunched";
|
|
22
|
+
USER_LOGOUT: "userLogout";
|
|
23
|
+
USER_LOGIN: "userLogin";
|
|
24
|
+
FORGOT_PASSWORD: "forgotPassword";
|
|
25
|
+
SEARCH: "search";
|
|
26
|
+
PRODUCT_VIEWED: "productViewed";
|
|
27
|
+
PRODUCT_CLICKED: "productClicked";
|
|
28
|
+
PRODUCT_LIST_VIEWED: "productListViewed";
|
|
29
|
+
PRODUCT_ADDED_TO_ADD_TO_CART: "productAddedToaddTocart";
|
|
30
|
+
PRODUCT_REMOVED_FROM_ADD_TO_CART: "productRemovedFromAddToCart";
|
|
31
|
+
CLEAR_CART: "clearCart";
|
|
32
|
+
SELECT_CATEGORY: "selectCategory";
|
|
33
|
+
CATEGORY_VIEWED_PAGE: "categoryViewedPage";
|
|
34
|
+
PRODUCT_ADDED_TO_WISHLIST: "productAddedToWishlist";
|
|
35
|
+
PRODUCT_REMOVED_FROM_WISHLIST: "productRemovedFromWishlist";
|
|
36
|
+
PRODUCT_RATED_OR_REVIEWED: "productRatedOrReviewed";
|
|
37
|
+
CART_VIEWED: "cartViewed";
|
|
38
|
+
OFFER_AVAILED: "offerAvailed";
|
|
39
|
+
CHECKOUT_STARTED: "checkoutStarted";
|
|
40
|
+
CHECKOUT_COMPLETED: "checkoutCompleted";
|
|
41
|
+
CHECKOUT_CANCELED: "checkoutCanceled";
|
|
42
|
+
PAYMENT_INFO_ENTERED: "paymentInfoEntered";
|
|
43
|
+
ORDER_COMPLETED: "orderCompleted";
|
|
44
|
+
ORDER_REFUNDED: "orderRefunded";
|
|
45
|
+
ORDER_CANCELLED: "orderCancelled";
|
|
46
|
+
ORDER_EXPERIANCE_RATING: "orderExperianceRating";
|
|
47
|
+
PRODUCT_REVIEW: "productReview";
|
|
48
|
+
PURCHASED: "purchased";
|
|
49
|
+
APP_UPDATED: "appUpdated";
|
|
50
|
+
ACCOUNT_DELETION: "accountDeletion";
|
|
51
|
+
SHARE: "share";
|
|
52
|
+
SCREEN: "screen";
|
|
53
|
+
WISHLIST_PRODUCT_ADDED_TO_CART: "wishlistProductAddedToCart";
|
|
54
|
+
SHIPPED: "shipped";
|
|
55
|
+
PRODUCT_QUANTITY_SELECTED: "productQuantitySelected";
|
|
56
|
+
}>;
|
|
57
|
+
type EventCallback = (data: any) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Notification deep link payload
|
|
60
|
+
* Emitted when user clicks on a push notification
|
|
61
|
+
*/
|
|
62
|
+
export interface NotificationOpenedPayload {
|
|
63
|
+
/**
|
|
64
|
+
* Route field from notification - can be either:
|
|
65
|
+
* - A route path: "/products/123"
|
|
66
|
+
* - A full deep link URL: "myapp://products/123" or "https://example.com/products/123"
|
|
67
|
+
*/
|
|
68
|
+
route?: string;
|
|
69
|
+
/** Raw notification data object with all custom fields */
|
|
70
|
+
data: Record<string, any>;
|
|
71
|
+
/** Notification title */
|
|
72
|
+
title?: string;
|
|
73
|
+
/** Notification body */
|
|
74
|
+
body?: string;
|
|
75
|
+
}
|
|
76
|
+
export type { SwanSDKConfig } from './types/SDK';
|
|
77
|
+
export default class SwanSDK {
|
|
78
|
+
private listeners;
|
|
79
|
+
private SDK_VERSION;
|
|
80
|
+
private isProduction;
|
|
81
|
+
private appId;
|
|
82
|
+
private deviceId;
|
|
83
|
+
private static modalInstances;
|
|
84
|
+
private db;
|
|
85
|
+
private isDatabaseConfigured;
|
|
86
|
+
private notificationToShow;
|
|
87
|
+
private currentScreenName;
|
|
88
|
+
private country;
|
|
89
|
+
private currency;
|
|
90
|
+
private businessUnit;
|
|
91
|
+
private deviceModel;
|
|
92
|
+
private deviceBrand;
|
|
93
|
+
private firebaseManager;
|
|
94
|
+
private eventQueueManager;
|
|
95
|
+
private flushManager;
|
|
96
|
+
private networkMonitor;
|
|
97
|
+
private batchConfig;
|
|
98
|
+
private initializationPromise;
|
|
99
|
+
private resolveInitialization;
|
|
100
|
+
private config;
|
|
101
|
+
private deviceStateMachine;
|
|
102
|
+
private pushStateMachine;
|
|
103
|
+
private authStateMachine;
|
|
104
|
+
private deviceService;
|
|
105
|
+
private pushService;
|
|
106
|
+
private pendingPushEventListeners;
|
|
107
|
+
private appStateSubscription;
|
|
108
|
+
private initialNotificationHandled;
|
|
109
|
+
private static instance;
|
|
110
|
+
private static styles;
|
|
111
|
+
private constructor();
|
|
112
|
+
static getInstance(appId: string, config?: SwanSDKConfig): SwanSDK;
|
|
113
|
+
/**
|
|
114
|
+
* Get current SDK instance (if initialized)
|
|
115
|
+
* Used internally by module-level handlers
|
|
116
|
+
*/
|
|
117
|
+
static getCurrentInstance(): SwanSDK | null;
|
|
118
|
+
private initializeSDK;
|
|
119
|
+
/**
|
|
120
|
+
* Initialize push notifications (new method)
|
|
121
|
+
* Called only if push is enabled in config
|
|
122
|
+
*/
|
|
123
|
+
private initializePushNotifications;
|
|
124
|
+
/**
|
|
125
|
+
* Load push notification provider based on config
|
|
126
|
+
*/
|
|
127
|
+
private loadPushProvider;
|
|
128
|
+
/**
|
|
129
|
+
* Setup event listeners for push token service
|
|
130
|
+
*/
|
|
131
|
+
private setupPushEventListeners;
|
|
132
|
+
/**
|
|
133
|
+
* Sync push token to push-subscription API
|
|
134
|
+
* Now queues the call instead of making immediate network request
|
|
135
|
+
*/
|
|
136
|
+
private syncPushSubscription;
|
|
137
|
+
/**
|
|
138
|
+
* Sync push unsubscription to push-subscription API
|
|
139
|
+
* Now queues the call instead of making immediate network request
|
|
140
|
+
*/
|
|
141
|
+
private syncPushUnsubscription;
|
|
142
|
+
/**
|
|
143
|
+
* Re-sync push subscription after profile switch (login/logout)
|
|
144
|
+
* Updates the CDID associated with the push token on the backend
|
|
145
|
+
*/
|
|
146
|
+
private resyncPushSubscriptionAfterProfileSwitch;
|
|
147
|
+
private ensureInitialized;
|
|
148
|
+
addListener(event: string, callback: EventCallback): {
|
|
149
|
+
remove: () => void;
|
|
150
|
+
};
|
|
151
|
+
private emit;
|
|
152
|
+
/**
|
|
153
|
+
* Emit notification opened event
|
|
154
|
+
* @internal - Used by module-level notification handlers
|
|
155
|
+
*/
|
|
156
|
+
emitNotificationOpened(payload: NotificationOpenedPayload): void;
|
|
157
|
+
static setLoggingEnabled(enabled: boolean): void;
|
|
158
|
+
protected buttonClickHandler: ((event: any) => void) | null;
|
|
159
|
+
protected setButtonClickHandler(handler: (event: any) => void): void;
|
|
160
|
+
protected notifyButtonClick(event: any): void;
|
|
161
|
+
protected notificationShowHandler: ((notification: any) => void) | null;
|
|
162
|
+
protected setNotificationShowHandler(handler: (event: any) => void): Promise<void>;
|
|
163
|
+
protected notifyNotificationShow(notification: any): void;
|
|
164
|
+
private initializeDatabase;
|
|
165
|
+
private initializeEventQueue;
|
|
166
|
+
/**
|
|
167
|
+
* Set up AppState listener to track app lifecycle events
|
|
168
|
+
*/
|
|
169
|
+
private setupAppStateListener;
|
|
170
|
+
private createTable;
|
|
171
|
+
private ensureDatabaseReady;
|
|
172
|
+
private insertNotification;
|
|
173
|
+
private selectAllFromTable;
|
|
174
|
+
private deleteFromTableByValue;
|
|
175
|
+
private lzw64_encode;
|
|
176
|
+
setCurrentScreenName(screenName: string): void;
|
|
177
|
+
setCountry(country: string): void;
|
|
178
|
+
setCurrency(currency: string): void;
|
|
179
|
+
setBusinessUnit(businessUnit: string): void;
|
|
180
|
+
private static generateId;
|
|
181
|
+
private sendToSwan;
|
|
182
|
+
/**
|
|
183
|
+
* Send a single event directly to the server (SYNCHRONOUS - bypasses queue)
|
|
184
|
+
* Used for critical events like login/logout that require immediate processing
|
|
185
|
+
* @param eventName Event name
|
|
186
|
+
* @param eventData Event data
|
|
187
|
+
* @returns Server response with CDID and profileSwitched info
|
|
188
|
+
*/
|
|
189
|
+
private sendEventDirectly;
|
|
190
|
+
/**
|
|
191
|
+
* Send batch of events to backend
|
|
192
|
+
* Routes different call types to appropriate endpoints
|
|
193
|
+
* Called by FlushManager when flushing queue
|
|
194
|
+
* @param events Array of events to send (includes standard events, push calls, enrichment, acks)
|
|
195
|
+
*/
|
|
196
|
+
private sendEventBatch;
|
|
197
|
+
getSwanIdentifier(): Promise<any>;
|
|
198
|
+
private getStoredCredentials;
|
|
199
|
+
private saveCredentials;
|
|
200
|
+
private hasLocationPermission;
|
|
201
|
+
/**
|
|
202
|
+
* Get current device location
|
|
203
|
+
* Returns location data with latitude, longitude, accuracy, and timestamp
|
|
204
|
+
* Returns null if location permission is not granted or location fetch fails
|
|
205
|
+
*
|
|
206
|
+
* @param checkOnly - If true, only checks for existing permission without requesting (non-blocking)
|
|
207
|
+
*/
|
|
208
|
+
private getDeviceLocation;
|
|
209
|
+
/**
|
|
210
|
+
* Register device (simplified)
|
|
211
|
+
* Now delegates to DeviceStateMachine and DeviceRegistrationService
|
|
212
|
+
*
|
|
213
|
+
* @deprecated This method is kept for backward compatibility but is no longer needed
|
|
214
|
+
* in most cases as device registration happens automatically during SDK initialization.
|
|
215
|
+
*/
|
|
216
|
+
protected registerDevice(): Promise<void>;
|
|
217
|
+
/**
|
|
218
|
+
* Enriches an existing customer profile with additional data.
|
|
219
|
+
* All fields are validated against metastore custom attributes
|
|
220
|
+
* Note: Profile creation happens automatically during device registration.
|
|
221
|
+
* This method only updates existing profiles.
|
|
222
|
+
*
|
|
223
|
+
* The CDID is automatically retrieved from AsyncStorage:
|
|
224
|
+
* - Uses currentCDID (credentials) if user is logged in
|
|
225
|
+
* - Uses generatedCDID if user is anonymous
|
|
226
|
+
*
|
|
227
|
+
* BREAKING CHANGE: Now returns void instead of server response
|
|
228
|
+
* Enrichment is processed asynchronously via queue
|
|
229
|
+
*
|
|
230
|
+
* @param profileData - Customer profile data (CDID not required, automatically retrieved)
|
|
231
|
+
* @returns Promise<void> - No return value (async processing)
|
|
232
|
+
*/
|
|
233
|
+
enrichProfile(profileData: any): Promise<void>;
|
|
234
|
+
private switchProfile;
|
|
235
|
+
private getSessionId;
|
|
236
|
+
private trackEvent;
|
|
237
|
+
/**
|
|
238
|
+
* Track custom event
|
|
239
|
+
* To use in segments, journeys it needs to be added to metastore
|
|
240
|
+
* @param name Event name
|
|
241
|
+
* @param data Event data
|
|
242
|
+
*/
|
|
243
|
+
customEvent(name: string, data?: any): void;
|
|
244
|
+
/**
|
|
245
|
+
* Track app launched event
|
|
246
|
+
* Automatically triggered when app comes to foreground from background
|
|
247
|
+
* Can also be called manually if needed
|
|
248
|
+
* @param {any} data - Optional event data
|
|
249
|
+
*/
|
|
250
|
+
appLaunched(data?: any): void;
|
|
251
|
+
/**
|
|
252
|
+
* @param { { success: boolean } } data
|
|
253
|
+
*/
|
|
254
|
+
forgotPassword(data: any): void;
|
|
255
|
+
/**
|
|
256
|
+
* @param { { searchKeyword: string } } data
|
|
257
|
+
*/
|
|
258
|
+
search(data: any): void;
|
|
259
|
+
/**
|
|
260
|
+
* @param { { productId: string } } data
|
|
261
|
+
*/
|
|
262
|
+
productViewed(data: any): void;
|
|
263
|
+
/**
|
|
264
|
+
* @param { { productId: string } } data
|
|
265
|
+
*/
|
|
266
|
+
productClicked(data: any): void;
|
|
267
|
+
/**
|
|
268
|
+
* @param { { productListId: string } } data
|
|
269
|
+
*/
|
|
270
|
+
productListViewed(data: any): void;
|
|
271
|
+
/**
|
|
272
|
+
* @param { { productId: string, quantity: string } } data
|
|
273
|
+
*/
|
|
274
|
+
productAddedToAddTocart(data: any): void;
|
|
275
|
+
/**
|
|
276
|
+
* @param { { productId: string, quantity: string } } data
|
|
277
|
+
*/
|
|
278
|
+
productRemovedFromAddToCart(data: any): void;
|
|
279
|
+
clearCart(): void;
|
|
280
|
+
/**
|
|
281
|
+
* @param { { categoryId: string } } data
|
|
282
|
+
*/
|
|
283
|
+
selectCategory(data: any): void;
|
|
284
|
+
/**
|
|
285
|
+
* @param { { categoryId: string } } data
|
|
286
|
+
*/
|
|
287
|
+
categoryViewedPage(data: any): void;
|
|
288
|
+
/**
|
|
289
|
+
* @param { { productId: string } } data
|
|
290
|
+
*/
|
|
291
|
+
productAddedToWishlist(data: any): void;
|
|
292
|
+
/**
|
|
293
|
+
* @param { { productId: string } } data
|
|
294
|
+
*/
|
|
295
|
+
productRemovedFromWishlist(data: any): void;
|
|
296
|
+
/**
|
|
297
|
+
* @param { { productId: string, rateValue: string, rateSubjectId: string } } data
|
|
298
|
+
*/
|
|
299
|
+
productRatedOrReviewed(data: any): void;
|
|
300
|
+
/**
|
|
301
|
+
* @param { { productIds: string[] } } data
|
|
302
|
+
*/
|
|
303
|
+
cartViewed(data: any): void;
|
|
304
|
+
/**
|
|
305
|
+
* @param { { couponCode: string, orderId: string, expiryDate: Date } } data
|
|
306
|
+
*/
|
|
307
|
+
offerAvailed(data: any): void;
|
|
308
|
+
/**
|
|
309
|
+
* @param { { checkoutId: string, orderId: string, totalAmount: float, productIds: {productId: string, quantity: float, price: float}[] } } data
|
|
310
|
+
*/
|
|
311
|
+
checkoutStarted(data: any): void;
|
|
312
|
+
/**
|
|
313
|
+
* @param { { checkoutId: string, orderId: string, totalAmount: float, productIds: {productId: string, quantity: float, price: float}[] } } data
|
|
314
|
+
*/
|
|
315
|
+
checkoutCompleted(data: any): void;
|
|
316
|
+
/**
|
|
317
|
+
* @param { { checkoutId: string, orderId: string, productIds: {productId: string, quantity: float, price: float}[] } } data
|
|
318
|
+
*/
|
|
319
|
+
checkoutCanceled(data: any): void;
|
|
320
|
+
/**
|
|
321
|
+
* @param { { currency: string, value: string, productIds: string[], paymentType: string } } data
|
|
322
|
+
*/
|
|
323
|
+
paymentInfoEntered(data: any): void;
|
|
324
|
+
/**
|
|
325
|
+
* @param { { orderId: string, totalAmount: float, productIds: {productId: string, quantity: float, price: float}[] } } data
|
|
326
|
+
*/
|
|
327
|
+
orderCompleted(data: any): void;
|
|
328
|
+
/**
|
|
329
|
+
* @param { { orderId: string, totalAmount: float, productIds: {productId: string, quantity: float, price: float}[] } } data
|
|
330
|
+
*/
|
|
331
|
+
orderRefunded(data: any): void;
|
|
332
|
+
/**
|
|
333
|
+
* @param { { orderId: string, totalAmount: float, productIds: {productId: string, quantity: float, price: float}[] } } data
|
|
334
|
+
*/
|
|
335
|
+
orderCancelled(data: any): void;
|
|
336
|
+
/**
|
|
337
|
+
* @param { { orderId: string, rateValue: float, rateSubjectId: string } } data
|
|
338
|
+
*/
|
|
339
|
+
orderExperianceRating(data: any): void;
|
|
340
|
+
/**
|
|
341
|
+
* @param { { productId: string, deliveryType: string, extraNote: string, rateValue: string, rateSubjectId: string } } data
|
|
342
|
+
*/
|
|
343
|
+
productReview(data: any): void;
|
|
344
|
+
/**
|
|
345
|
+
* @param { { orderId: string, brandId: string, sku: string, purchaseDate: string, orderCreatedDate: string } } data
|
|
346
|
+
*/
|
|
347
|
+
purchased(data: any): void;
|
|
348
|
+
/**
|
|
349
|
+
* @param { { appVersion: string, updateType: string, previousVersion: string, updateId: string } } data
|
|
350
|
+
*/
|
|
351
|
+
appUpdated(data: any): void;
|
|
352
|
+
/**
|
|
353
|
+
* @param { { apiCode: string, success: boolean, comment: string } } data
|
|
354
|
+
*/
|
|
355
|
+
accountDeletion(data: any): void;
|
|
356
|
+
/**
|
|
357
|
+
* @param { { productId: string } } data
|
|
358
|
+
*/
|
|
359
|
+
share(data: any): void;
|
|
360
|
+
/**
|
|
361
|
+
* @param { { screenName: string } } data
|
|
362
|
+
*/
|
|
363
|
+
screen(data: any): void;
|
|
364
|
+
/**
|
|
365
|
+
* @param { { wishlistId: string, productId: string } } data
|
|
366
|
+
*/
|
|
367
|
+
wishlistProductAddedToCart(data: any): void;
|
|
368
|
+
/**
|
|
369
|
+
* @param { { productId: string, orderId: string, price: float, postalCode: string } } data
|
|
370
|
+
*/
|
|
371
|
+
shipped(data: any): void;
|
|
372
|
+
/**
|
|
373
|
+
* @param { { quantity: string, productId: string } } data
|
|
374
|
+
*/
|
|
375
|
+
productQuantitySelected(data: any): void;
|
|
376
|
+
/**
|
|
377
|
+
* Track user login event and handle profile switching if mobile is provided
|
|
378
|
+
* @param identifier - identifier to check for profile switching
|
|
379
|
+
* @param data - Optional customer profile data
|
|
380
|
+
* @returns Promise with profile switch information if applicable
|
|
381
|
+
*/
|
|
382
|
+
/**
|
|
383
|
+
* Track user login event (SYNCHRONOUS - bypasses queue)
|
|
384
|
+
* Uses AuthStateMachine to prevent concurrent login calls
|
|
385
|
+
* Sends directly to server for immediate profile switching
|
|
386
|
+
*/
|
|
387
|
+
login(identifier: string, data?: any): Promise<any>;
|
|
388
|
+
/**
|
|
389
|
+
* Track user logout event and switch back to anonymous profile (generatedCDID)
|
|
390
|
+
* Uses AuthStateMachine to prevent concurrent logout calls (SYNCHRONOUS - bypasses queue)
|
|
391
|
+
* Sends directly to server for immediate profile switching
|
|
392
|
+
* @returns Promise with logout response
|
|
393
|
+
*/
|
|
394
|
+
logout(): Promise<any>;
|
|
395
|
+
/**
|
|
396
|
+
* Send notification ACK (delivered/clicked) to Swan API
|
|
397
|
+
* ACKs are queued and sent with other events
|
|
398
|
+
*/
|
|
399
|
+
sendNotificationAck(messageId: string, event: 'delivered' | 'clicked' | 'showed'): Promise<void>;
|
|
400
|
+
/**
|
|
401
|
+
* Get notification priority from payload
|
|
402
|
+
* Maps priority string to AndroidPriority constants
|
|
403
|
+
* Used for Android 7.1 and below (Android 8+ uses channel importance)
|
|
404
|
+
*/
|
|
405
|
+
private getPriorityFromPayload;
|
|
406
|
+
/**
|
|
407
|
+
* Auto-display notification in foreground using notifee
|
|
408
|
+
* This provides automatic notification handling like CleverTap, OneSignal, etc.
|
|
409
|
+
*/
|
|
410
|
+
private displayForegroundNotification;
|
|
411
|
+
protected showPopUp({ designConfig }: any): import("react/jsx-runtime").JSX.Element;
|
|
412
|
+
private processNotification;
|
|
413
|
+
protected showHeader({ designConfig }: any): import("react/jsx-runtime").JSX.Element;
|
|
414
|
+
protected showFooter({ designConfig }: any): import("react/jsx-runtime").JSX.Element;
|
|
415
|
+
protected showFullScreen({ designConfig }: any): import("react/jsx-runtime").JSX.Element;
|
|
416
|
+
private fetchNotificationFromAPI;
|
|
417
|
+
private fetchNotificationFromDB;
|
|
418
|
+
private flattenDesignConfig;
|
|
419
|
+
protected getNotificationComponent(): Promise<import("react/jsx-runtime").JSX.Element | null>;
|
|
420
|
+
private isGreaterThanTimePeriod;
|
|
421
|
+
static EVENTS: {
|
|
422
|
+
PUSH_NOTIFICATION_RECEIVED: string;
|
|
423
|
+
NOTIFICATION_OPENED: string;
|
|
424
|
+
TOKEN_RECEIVED: string;
|
|
425
|
+
TOKEN_REFRESH: string;
|
|
426
|
+
PERMISSION_CHANGED: string;
|
|
427
|
+
};
|
|
428
|
+
/**
|
|
429
|
+
* Intialize Firebase Notification Manager
|
|
430
|
+
* This sets up FCM token generation and notification handling
|
|
431
|
+
*/
|
|
432
|
+
initializeFirebase(): Promise<void>;
|
|
433
|
+
/**
|
|
434
|
+
* Setup Notifee event listeners for notification clicks
|
|
435
|
+
* Handles both foreground clicks and initial notification (app opened from quit state)
|
|
436
|
+
*/
|
|
437
|
+
private setupNotifeeEventListeners;
|
|
438
|
+
/**
|
|
439
|
+
* Check if app was opened from killed state via Firebase notification tap
|
|
440
|
+
* This handles notifications auto-displayed by iOS (notification+data payload with NES)
|
|
441
|
+
* For data-only notifications displayed via Notifee, use notifee.getInitialNotification() instead
|
|
442
|
+
*/
|
|
443
|
+
private checkFirebaseInitialNotification;
|
|
444
|
+
/**
|
|
445
|
+
* Setup Firebase event listeners
|
|
446
|
+
*/
|
|
447
|
+
private setupFirebaseEventListeners;
|
|
448
|
+
/**
|
|
449
|
+
* Get the Firebase Manager instance
|
|
450
|
+
*/
|
|
451
|
+
getFirebaseManager(): any | null;
|
|
452
|
+
/**
|
|
453
|
+
* Check if push notifications are enabled in SDK config
|
|
454
|
+
* Used internally by handler functions to verify push should be processed
|
|
455
|
+
*/
|
|
456
|
+
isPushEnabled(): boolean;
|
|
457
|
+
/**
|
|
458
|
+
* Check if SDK is fully initialized and ready to send events
|
|
459
|
+
* Used by background handlers to determine if SDK instance can send ACKs
|
|
460
|
+
*/
|
|
461
|
+
isReady(): boolean;
|
|
462
|
+
/**
|
|
463
|
+
* Get current push token
|
|
464
|
+
*/
|
|
465
|
+
getPushToken(): Promise<string | null>;
|
|
466
|
+
/**
|
|
467
|
+
* Delete Firebase token and sync unsubscription to backend
|
|
468
|
+
*/
|
|
469
|
+
unsubscribePush(): Promise<boolean>;
|
|
470
|
+
/**
|
|
471
|
+
* Check if notification permission is granted
|
|
472
|
+
*/
|
|
473
|
+
hasNotificationPermission(): Promise<boolean>;
|
|
474
|
+
/**
|
|
475
|
+
* Request notification permission
|
|
476
|
+
*/
|
|
477
|
+
/**
|
|
478
|
+
* Request notification permission
|
|
479
|
+
* Uses the new PushTokenService if available, falls back to firebaseManager for backward compatibility
|
|
480
|
+
*/
|
|
481
|
+
requestNotificationPermission(): Promise<boolean>;
|
|
482
|
+
/**
|
|
483
|
+
* Create a Notification Channel (Android only)
|
|
484
|
+
* @param channelName - User visible name
|
|
485
|
+
* @param importance - Importance level (default: 4 - High)
|
|
486
|
+
* @param description - User visible description
|
|
487
|
+
* @param channelId - Custom Channel ID (defaults to App ID)
|
|
488
|
+
*/
|
|
489
|
+
createNotificationChannel(channelName?: string, importance?: number, description?: string, channelId?: string): Promise<string | null>;
|
|
490
|
+
/**
|
|
491
|
+
* Delete a Notification Channel (Android only)
|
|
492
|
+
*/
|
|
493
|
+
deleteNotificationChannel(channelId: string): Promise<boolean>;
|
|
494
|
+
/**
|
|
495
|
+
* Get the Notification Channel ID
|
|
496
|
+
* Returns the App ID as the channel ID
|
|
497
|
+
*/
|
|
498
|
+
getNotificationChannelId(): string;
|
|
499
|
+
/**
|
|
500
|
+
* Get app badge count
|
|
501
|
+
*/
|
|
502
|
+
getBadgeCount(): Promise<number>;
|
|
503
|
+
/**
|
|
504
|
+
* Set app badge count
|
|
505
|
+
*/
|
|
506
|
+
setBadgeCount(count: number): Promise<boolean>;
|
|
507
|
+
/**
|
|
508
|
+
* Add listener for push notification events
|
|
509
|
+
* Listeners registered before push initialization are queued and attached when ready
|
|
510
|
+
*/
|
|
511
|
+
addEventListener(eventName: string, callback: (data: any) => void): void;
|
|
512
|
+
/**
|
|
513
|
+
* Attach pending event listeners after push service initialization
|
|
514
|
+
* Called automatically when push notifications are ready
|
|
515
|
+
*/
|
|
516
|
+
private attachPendingEventListeners;
|
|
517
|
+
/**
|
|
518
|
+
* Remove listener for push notification events
|
|
519
|
+
*/
|
|
520
|
+
removeEventListener(eventName: string, callback: (data: any) => void): void;
|
|
521
|
+
/**
|
|
522
|
+
* Log a message using SwanSDK Logger
|
|
523
|
+
* @param message - Message to log
|
|
524
|
+
* @param args - Additional arguments
|
|
525
|
+
*/
|
|
526
|
+
log(message: string, ...args: any[]): void;
|
|
527
|
+
/**
|
|
528
|
+
* Log a warning using SwanSDK Logger
|
|
529
|
+
* @param message - Warning message
|
|
530
|
+
* @param args - Additional arguments
|
|
531
|
+
*/
|
|
532
|
+
warn(message: string, ...args: any[]): void;
|
|
533
|
+
/**
|
|
534
|
+
* Log an error using SwanSDK Logger
|
|
535
|
+
* @param message - Error message
|
|
536
|
+
* @param args - Additional arguments
|
|
537
|
+
*/
|
|
538
|
+
error(message: string, ...args: any[]): void;
|
|
539
|
+
/**
|
|
540
|
+
* Enable or disable SDK logs
|
|
541
|
+
* @param enabled - boolean to enable/disable logs
|
|
542
|
+
*/
|
|
543
|
+
enableLogs(enabled: boolean): void;
|
|
544
|
+
/**
|
|
545
|
+
* Get device information from AsyncStorage
|
|
546
|
+
* @returns Device info including deviceId, generatedCDID, and currentCDID (credentials)
|
|
547
|
+
*/
|
|
548
|
+
getDeviceInfo(): Promise<any>;
|
|
549
|
+
/**
|
|
550
|
+
* Manually flush pending events
|
|
551
|
+
* Forces immediate send of queued events regardless of batch size or timer
|
|
552
|
+
* Useful before critical navigation or app closure
|
|
553
|
+
* @returns Promise that resolves when flush is complete
|
|
554
|
+
*/
|
|
555
|
+
flushEvents(): Promise<void>;
|
|
556
|
+
/**
|
|
557
|
+
* Get current queue size
|
|
558
|
+
* Returns number of pending events waiting to be sent
|
|
559
|
+
* @returns Number of pending events in queue
|
|
560
|
+
*/
|
|
561
|
+
getQueueSize(): Promise<number>;
|
|
562
|
+
/**
|
|
563
|
+
* Update device location
|
|
564
|
+
* Call this method when location permission is granted to update device location
|
|
565
|
+
* This fetches current location and updates device details on the backend
|
|
566
|
+
* @returns Promise that resolves when location is updated
|
|
567
|
+
*/
|
|
568
|
+
updateLocation(): Promise<void>;
|
|
569
|
+
/**
|
|
570
|
+
* Handle background notification delivery ACK
|
|
571
|
+
* Uses Firebase messageId for tracking
|
|
572
|
+
* @internal
|
|
573
|
+
*/
|
|
574
|
+
handleBackgroundNotification(remoteMessage: any): Promise<void>;
|
|
575
|
+
/**
|
|
576
|
+
* Check if a push notification is silent (should not display UI)
|
|
577
|
+
* @param remoteMessage FCM remote message
|
|
578
|
+
* @returns true if silent push
|
|
579
|
+
*/
|
|
580
|
+
private isSilentPush;
|
|
581
|
+
/**
|
|
582
|
+
* Handle foreground notification (called from createForegroundMessageHandler)
|
|
583
|
+
* Expects data-only FCM payload
|
|
584
|
+
* Supports silent push notifications (no UI display)
|
|
585
|
+
* @internal
|
|
586
|
+
*/
|
|
587
|
+
handleForegroundNotification(remoteMessage: any): Promise<void>;
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Foreground Message Handler for index.js
|
|
591
|
+
*
|
|
592
|
+
* Handles data-only FCM messages when app is in foreground.
|
|
593
|
+
* React Native Firebase requires onMessage() to be registered at module level in index.js.
|
|
594
|
+
*
|
|
595
|
+
* NOTE: This SDK expects DATA-ONLY FCM payloads (no "notification" field).
|
|
596
|
+
* Backend should set sdkCapabilities.dataOnlyPush check before sending.
|
|
597
|
+
*
|
|
598
|
+
* @example
|
|
599
|
+
* ```javascript
|
|
600
|
+
* // index.js
|
|
601
|
+
* import messaging from '@react-native-firebase/messaging';
|
|
602
|
+
* import { createForegroundMessageHandler } from 'swan-react-native-sdk';
|
|
603
|
+
*
|
|
604
|
+
* messaging().onMessage(createForegroundMessageHandler());
|
|
605
|
+
* ```
|
|
606
|
+
*/
|
|
607
|
+
export declare function createForegroundMessageHandler(): (remoteMessage: any) => Promise<void>;
|
|
608
|
+
/**
|
|
609
|
+
* Background Message Handler for index.js
|
|
610
|
+
*
|
|
611
|
+
* Handles data-only FCM messages when app is in background or killed state.
|
|
612
|
+
* React Native Firebase requires setBackgroundMessageHandler() to be registered at module level.
|
|
613
|
+
*
|
|
614
|
+
* NOTE: This SDK expects DATA-ONLY FCM payloads (no "notification" field).
|
|
615
|
+
* Backend should set sdkCapabilities.dataOnlyPush check before sending.
|
|
616
|
+
*
|
|
617
|
+
* @example
|
|
618
|
+
* ```javascript
|
|
619
|
+
* // index.js
|
|
620
|
+
* import messaging from '@react-native-firebase/messaging';
|
|
621
|
+
* import { createBackgroundMessageHandler } from 'swan-react-native-sdk';
|
|
622
|
+
*
|
|
623
|
+
* messaging().setBackgroundMessageHandler(createBackgroundMessageHandler());
|
|
624
|
+
* ```
|
|
625
|
+
*/
|
|
626
|
+
export declare function createBackgroundMessageHandler(): (remoteMessage: any) => Promise<void>;
|
|
627
|
+
export declare function createNotificationOpenedHandler(): (event: any) => Promise<void>;
|
|
628
|
+
/**
|
|
629
|
+
* Notifee Foreground Event Handler for index.js
|
|
630
|
+
*
|
|
631
|
+
* Handles notification clicks when app is in foreground.
|
|
632
|
+
* Notifee requires onForegroundEvent() to be registered at module level in index.js.
|
|
633
|
+
*
|
|
634
|
+
* @example
|
|
635
|
+
* ```javascript
|
|
636
|
+
* // index.js
|
|
637
|
+
* import notifee from '@notifee/react-native';
|
|
638
|
+
* import { createNotifeeForegroundHandler } from 'swan-react-native-sdk';
|
|
639
|
+
*
|
|
640
|
+
* notifee.onForegroundEvent(createNotifeeForegroundHandler());
|
|
641
|
+
* ```
|
|
642
|
+
*/
|
|
643
|
+
export declare function createNotifeeForegroundHandler(): (event: any) => Promise<void>;
|
|
644
|
+
/**
|
|
645
|
+
* Notifee Background Event Handler
|
|
646
|
+
*
|
|
647
|
+
* Handles notification clicks when app is in background or killed state.
|
|
648
|
+
* Must be registered at module level in index.js.
|
|
649
|
+
*
|
|
650
|
+
* @example
|
|
651
|
+
* ```javascript
|
|
652
|
+
* // index.js
|
|
653
|
+
* import notifee from '@notifee/react-native';
|
|
654
|
+
* import { createNotifeeBackgroundHandler } from 'swan-react-native-sdk';
|
|
655
|
+
*
|
|
656
|
+
* notifee.onBackgroundEvent(createNotifeeBackgroundHandler());
|
|
657
|
+
* ```
|
|
658
|
+
*/
|
|
659
|
+
export declare function createNotifeeBackgroundHandler(): ({ type, detail }: any) => Promise<void>;
|
|
660
|
+
export { SwanSDK as SwanEcomSDK };
|
|
661
|
+
export { ECOM_EVENTS };
|
|
662
|
+
export { SharedCredentialsManager };
|
|
663
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAuCH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAM5E,eAAO,MAAM,0BAA0B;;;;;;EAMrC,CAAC;AAEH,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCf,CAAC;AAGH,KAAK,aAAa,GAAG,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;AAEzC;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,yBAAyB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAGD,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,CAAC,OAAO,OAAO,OAAO;IAC1B,OAAO,CAAC,SAAS,CAAuC;IAExD,OAAO,CAAC,WAAW,CAAmB;IACtC,OAAO,CAAC,YAAY,CAA6B;IAEjD,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,QAAQ,CAAc;IAE9B,OAAO,CAAC,MAAM,CAAC,cAAc,CAIrB;IAER,OAAO,CAAC,EAAE,CAAM;IAChB,OA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