@attentive-mobile/attentive-react-native-sdk 2.0.0-beta.4 → 2.0.0-beta.5

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/README.md CHANGED
@@ -169,11 +169,148 @@ Attentive.identify({phone: '+15556667777'};)
169
169
  // phone: '+15556667777'
170
170
  ```
171
171
 
172
- ### Push Notifications (iOS Only)
172
+ ### Push Notifications (iOS and Android)
173
173
 
174
- The SDK supports push notification integration for iOS. Android support is planned for a future release.
174
+ The SDK supports push notification integration on both iOS (APNs) and Android (runtime permission + optional FCM). The following sections cover iOS-specific flows and a full **App events on Android** implementation that mirrors the behavior of the [Bonni](https://github.com/attentive-mobile/attentive-react-native-sdk/tree/main/Bonni) example app.
175
175
 
176
- #### Request Push Permission
176
+ ---
177
+
178
+ ### App Events on Android
179
+
180
+ This section describes how to implement Attentive app events on Android so they behave like the iOS flow: **regular app opens** (launch and resume from background) and **notification permission** are handled using the SDK’s native Android APIs. You can add FCM token registration and push open handling when your app uses Firebase Cloud Messaging.
181
+
182
+ | SDK method | Purpose on Android |
183
+ |------------|--------------------|
184
+ | `getPushAuthorizationStatus()` | Returns `authorized`, `denied`, or `notDetermined` (uses `POST_NOTIFICATIONS` on API 33+). Use before `handleRegularOpen` so tracking uses the correct status. |
185
+ | `registerForPushNotifications()` | Requests `POST_NOTIFICATIONS` on Android 13+; no-op on older versions. |
186
+ | `handleRegularOpen(authStatus)` | Tracks a regular app open (launch or return to foreground). Call after `identify()` and pass the result of `getPushAuthorizationStatus()`. |
187
+ | `registerDeviceToken` / `registerDeviceTokenWithCallback` | Optional. Register your FCM token when using Firebase Cloud Messaging. |
188
+ | `handlePushOpen` / `handleForegroundPush` | Optional. Call when the user opens a notification or receives one in the foreground. |
189
+
190
+ #### Overview
191
+
192
+ - **Regular app open** – Call `handleRegularOpen(authorizationStatus)` when the app is opened (launch or returning to foreground). The SDK uses this for tracking and the `/mtctrl` endpoint.
193
+ - **Permission status** – On Android 13+ (API 33+), notification permission is `POST_NOTIFICATIONS`. The SDK exposes `getPushAuthorizationStatus()` so you can pass the correct status into `handleRegularOpen`.
194
+ - **Requesting permission** – Call `registerForPushNotifications()` to trigger the system permission dialog on Android 13+; it is a no-op on older versions.
195
+ - **Order of operations** – Always call `identify()` before any `handleRegularOpen()` so the SDK has user context for network requests.
196
+
197
+ #### Prerequisites
198
+
199
+ 1. **AndroidManifest** – Declare the notification permission for Android 13+:
200
+
201
+ ```xml
202
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
203
+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
204
+ <!-- other permissions -->
205
+ </manifest>
206
+ ```
207
+
208
+ 2. **Initialize and identify first** – In your app entry (e.g. root component `useEffect`), call `initialize(config)` and `identify(identifiers)` before any push or app-event logic.
209
+
210
+ #### 1. On app launch (Android)
211
+
212
+ Right after `identify()`, do the following for the Android path:
213
+
214
+ 1. Get the current notification authorization status with `getPushAuthorizationStatus()`.
215
+ 2. Call `handleRegularOpen(authStatus)` with that status.
216
+ 3. Optionally call `registerForPushNotifications()` to prompt for permission (Android 13+).
217
+
218
+ ```typescript
219
+ import { Platform } from 'react-native';
220
+ import {
221
+ initialize,
222
+ identify,
223
+ getPushAuthorizationStatus,
224
+ registerForPushNotifications,
225
+ handleRegularOpen,
226
+ type AttentiveSdkConfiguration,
227
+ type PushAuthorizationStatus,
228
+ } from 'attentive-react-native-sdk';
229
+
230
+ // Inside your root component (e.g. App.tsx useEffect):
231
+ initialize(config);
232
+ identify({ email: 'user@example.com', clientUserId: 'id-123' });
233
+
234
+ if (Platform.OS === 'android') {
235
+ getPushAuthorizationStatus()
236
+ .then((authStatus: PushAuthorizationStatus) => {
237
+ handleRegularOpen(authStatus);
238
+ })
239
+ .catch(() => {
240
+ handleRegularOpen('authorized'); // fallback
241
+ });
242
+ registerForPushNotifications(); // Shows permission dialog on Android 13+
243
+ }
244
+ ```
245
+
246
+ #### 2. When app returns to foreground (Android)
247
+
248
+ Subscribe to `AppState` and, when the app becomes `active`, get the current status and call `handleRegularOpen` again:
249
+
250
+ ```typescript
251
+ import { AppState } from 'react-native';
252
+ import { getPushAuthorizationStatus, handleRegularOpen } from 'attentive-react-native-sdk';
253
+ import type { PushAuthorizationStatus } from 'attentive-react-native-sdk';
254
+
255
+ const subscription = AppState.addEventListener('change', (nextAppState) => {
256
+ if (nextAppState === 'active' && Platform.OS === 'android') {
257
+ getPushAuthorizationStatus()
258
+ .then((authStatus: PushAuthorizationStatus) => {
259
+ handleRegularOpen(authStatus);
260
+ })
261
+ .catch(() => {
262
+ handleRegularOpen('authorized');
263
+ });
264
+ }
265
+ });
266
+
267
+ // Cleanup on unmount:
268
+ return () => subscription.remove();
269
+ ```
270
+
271
+ #### 3. Optional: Register FCM token (Android)
272
+
273
+ If your app uses Firebase Cloud Messaging and you have an FCM token, register it with the Attentive backend and then call `handleRegularOpen` in the callback (same pattern as iOS):
274
+
275
+ ```typescript
276
+ import { registerDeviceTokenWithCallback, handleRegularOpen } from 'attentive-react-native-sdk';
277
+
278
+ // When you receive the FCM token (e.g. from Firebase Messaging):
279
+ getPushAuthorizationStatus().then((authStatus) => {
280
+ registerDeviceTokenWithCallback(
281
+ fcmToken,
282
+ authStatus,
283
+ (data, url, response, error) => {
284
+ if (error) {
285
+ console.error('Attentive token registration failed', error);
286
+ }
287
+ handleRegularOpen(authStatus);
288
+ }
289
+ );
290
+ });
291
+ ```
292
+
293
+ #### 4. Optional: Handle notification opens and foreground (Android)
294
+
295
+ If you handle FCM messages (e.g. with `@react-native-firebase/messaging`), you can report notification opens and foreground receives the same way as on iOS:
296
+
297
+ - **User opened notification (background/inactive):** `handlePushOpen(payload, authorizationStatus)`
298
+ - **Notification received while app in foreground:** `handleForegroundPush(payload, authorizationStatus)`
299
+
300
+ Get `authorizationStatus` via `getPushAuthorizationStatus()` when handling the event.
301
+
302
+ #### Complete Android flow (reference)
303
+
304
+ The [Bonni](https://github.com/attentive-mobile/attentive-react-native-sdk/tree/main/Bonni) example app ([App.tsx](https://github.com/attentive-mobile/attentive-react-native-sdk/blob/main/Bonni/App.tsx)) implements the full flow:
305
+
306
+ 1. **Launch:** `initialize` → `identify` → (Android) `getPushAuthorizationStatus()` → `handleRegularOpen(authStatus)` → `registerForPushNotifications()`.
307
+ 2. **Foreground:** `AppState.addEventListener('change', …)` → when `active` and Android → `getPushAuthorizationStatus()` → `handleRegularOpen(authStatus)`.
308
+ 3. **Optional:** When FCM token is available → `registerDeviceTokenWithCallback(token, authStatus, callback)` → in callback call `handleRegularOpen(authStatus)`.
309
+ 4. **Optional:** When user opens a notification or receives one in foreground → `handlePushOpen` / `handleForegroundPush` with payload and status from `getPushAuthorizationStatus()`.
310
+
311
+ ---
312
+
313
+ #### Request Push Permission (iOS)
177
314
 
178
315
  ```typescript
179
316
  import { registerForPushNotifications } from 'attentive-react-native-sdk';
@@ -183,9 +320,9 @@ import { registerForPushNotifications } from 'attentive-react-native-sdk';
183
320
  registerForPushNotifications();
184
321
  ```
185
322
 
186
- #### Register Device Token
323
+ #### Register Device Token (iOS: APNs / Android: FCM)
187
324
 
188
- When your app receives a device token from APNs, register it with the Attentive backend:
325
+ When your app receives a device token (APNs on iOS, FCM on Android), register it with the Attentive backend:
189
326
 
190
327
  ```typescript
191
328
  import { registerDeviceToken } from 'attentive-react-native-sdk';
@@ -202,7 +339,7 @@ The `authorizationStatus` parameter should be one of:
202
339
  - `'provisional'` - Provisional authorization (quiet notifications)
203
340
  - `'ephemeral'` - App Clip notifications
204
341
 
205
- #### Handle Push Notification Opens
342
+ #### Handle Push Notification Opens (iOS and Android)
206
343
 
207
344
  When a user taps on a push notification, track the event:
208
345
 
@@ -218,7 +355,7 @@ handlePushOpened(
218
355
  );
219
356
  ```
220
357
 
221
- #### Handle Foreground Notifications
358
+ #### Handle Foreground Notifications (iOS and Android)
222
359
 
223
360
  When a notification arrives while the app is in the foreground:
224
361
 
@@ -285,6 +422,4 @@ func application(
285
422
  - [Push Notifications Setup](./PUSH_NOTIFICATIONS_SETUP.md) - General push notification setup
286
423
  - [iOS Native SDK documentation](https://github.com/attentive-mobile/attentive-ios-sdk) - Native SDK reference
287
424
 
288
- #### Android Support
289
-
290
- Android push notification support is not yet implemented. The push notification methods will be no-ops on Android. FCM (Firebase Cloud Messaging) integration is planned for a future release.
425
+ For a full Android implementation (app launch, foreground, permission, and optional FCM), see the **[App Events on Android](#app-events-on-android)** section above.
@@ -1,4 +1,6 @@
1
1
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
2
  package="com.attentivereactnativesdk">
3
3
 
4
+ <!-- Required for push notification permission prompt on Android 13+ (API 33+) -->
5
+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
4
6
  </manifest>
@@ -0,0 +1,93 @@
1
+ package com.attentivereactnativesdk
2
+
3
+ import android.app.Activity
4
+ import android.content.Context
5
+ import android.content.pm.PackageManager
6
+ import android.os.Build
7
+ import android.util.Log
8
+ import androidx.core.app.ActivityCompat
9
+ import androidx.core.content.ContextCompat
10
+
11
+ /**
12
+ * Android push notification permission helper for the Attentive SDK.
13
+ *
14
+ * On Android 13+ (API 33+), push notifications require the runtime permission
15
+ * [android.permission.POST_NOTIFICATIONS]. On older versions, notifications
16
+ * are allowed by default (no runtime permission).
17
+ *
18
+ * This helper provides:
19
+ * - [getAuthorizationStatus] – current permission status for parity with iOS
20
+ * - [requestPermission] – request POST_NOTIFICATIONS when needed (used by registerForPushNotifications)
21
+ */
22
+ object AttentivePushHelper {
23
+
24
+ private const val TAG = "AttentivePushHelper"
25
+
26
+ /**
27
+ * Authorization status values aligned with iOS push authorization for use in handleRegularOpen etc.
28
+ * - "authorized" – user has granted notification permission (or API < 33)
29
+ * - "denied" – user denied or permission not granted
30
+ * - "notDetermined" – not yet requested (API 33+ only)
31
+ */
32
+ const val STATUS_AUTHORIZED = "authorized"
33
+ const val STATUS_DENIED = "denied"
34
+ const val STATUS_NOT_DETERMINED = "notDetermined"
35
+
36
+ /**
37
+ * Returns the current push notification authorization status.
38
+ *
39
+ * On API 33+: uses [android.permission.POST_NOTIFICATIONS].
40
+ * On API < 33: returns [STATUS_AUTHORIZED] (no runtime permission required).
41
+ *
42
+ * @param context Application or Activity context
43
+ * @return One of [STATUS_AUTHORIZED], [STATUS_DENIED], or [STATUS_NOT_DETERMINED]
44
+ */
45
+ @JvmStatic
46
+ fun getAuthorizationStatus(context: Context): String {
47
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
48
+ // API 32 and below: notification permission not required at runtime
49
+ return STATUS_AUTHORIZED
50
+ }
51
+ return when (ContextCompat.checkSelfPermission(context, android.Manifest.permission.POST_NOTIFICATIONS)) {
52
+ PackageManager.PERMISSION_GRANTED -> STATUS_AUTHORIZED
53
+ else -> {
54
+ // Not granted. Without an Activity we cannot distinguish "denied" vs "not yet asked".
55
+ // Return notDetermined so the app can call registerForPushNotifications to request.
56
+ STATUS_NOT_DETERMINED
57
+ }
58
+ }
59
+ }
60
+
61
+ /**
62
+ * Requests the push notification permission (POST_NOTIFICATIONS) if needed.
63
+ * Must be called from an [Activity] (e.g. [reactApplicationContext.currentActivity]).
64
+ *
65
+ * On API < 33 this is a no-op and returns immediately.
66
+ *
67
+ * @param activity Current activity (required for requestPermissions)
68
+ * @param requestCode Request code for [Activity.onRequestPermissionsResult]
69
+ * @return true if the permission request was started or already granted, false if activity is null or permission not applicable
70
+ */
71
+ @JvmStatic
72
+ fun requestPermissionIfNeeded(activity: Activity?, requestCode: Int): Boolean {
73
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
74
+ Log.d(TAG, "requestPermissionIfNeeded: API < 33, no runtime permission needed")
75
+ return true
76
+ }
77
+ if (activity == null) {
78
+ Log.w(TAG, "requestPermissionIfNeeded: activity is null, cannot request permission")
79
+ return false
80
+ }
81
+ if (ContextCompat.checkSelfPermission(activity, android.Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED) {
82
+ Log.d(TAG, "requestPermissionIfNeeded: POST_NOTIFICATIONS already granted")
83
+ return true
84
+ }
85
+ Log.i(TAG, "requestPermissionIfNeeded: requesting POST_NOTIFICATIONS")
86
+ ActivityCompat.requestPermissions(
87
+ activity,
88
+ arrayOf(android.Manifest.permission.POST_NOTIFICATIONS),
89
+ requestCode
90
+ )
91
+ return true
92
+ }
93
+ }
@@ -35,6 +35,7 @@ class AttentiveReactNativeSdkModule(reactContext: ReactApplicationContext) :
35
35
  companion object {
36
36
  const val NAME = "AttentiveReactNativeSdk"
37
37
  private const val TAG = NAME
38
+ private const val PUSH_PERMISSION_REQUEST_CODE = 3901
38
39
  }
39
40
 
40
41
  private var attentiveConfig: AttentiveConfig? = null
@@ -241,7 +242,7 @@ class AttentiveReactNativeSdkModule(reactContext: ReactApplicationContext) :
241
242
  // ==========================================================================
242
243
  //
243
244
  // These methods provide Android push notification support.
244
- //
245
+ //
245
246
  // IMPORTANT NOTE: The Attentive Android SDK version 1.0.1 has limited push notification
246
247
  // support compared to version 2.x. These methods provide logging and debugging infrastructure
247
248
  // but may require SDK upgrade or custom implementation for full functionality.
@@ -252,24 +253,42 @@ class AttentiveReactNativeSdkModule(reactContext: ReactApplicationContext) :
252
253
  /**
253
254
  * Request push notification permission from the user.
254
255
  *
255
- * Note: For Android 13+ (API 33+), you need to request POST_NOTIFICATIONS permission
256
- * in your app's AndroidManifest.xml and request it at runtime.
257
- * For older versions, permissions are granted at install time.
258
- *
259
- * This method is currently a logging placeholder for parity with iOS.
260
- * Actual permission handling should be done in the host app.
256
+ * On Android 13+ (API 33+), requests [android.permission.POST_NOTIFICATIONS] via the
257
+ * system dialog. On older versions, no-op (notifications allowed by default).
258
+ * Uses [AttentivePushHelper] for the actual request.
261
259
  */
262
260
  override fun registerForPushNotifications() {
263
261
  Log.i(TAG, "📱 [AttentiveSDK] registerForPushNotifications called (Android)")
264
- Log.i(TAG, " Note: Push notification permissions should be requested in your host app")
265
- Log.i(TAG, " For Android 13+, request POST_NOTIFICATIONS permission at runtime")
266
262
 
267
- if (debugHelper.isDebuggingEnabled()) {
268
- val debugData = mutableMapOf<String, Any>()
269
- debugData["platform"] = "Android"
270
- debugData["sdk_version"] = "1.0.1"
271
- debugData["note"] = "Permission handling should be done in host app"
272
- debugHelper.showDebugInfo("Push Registration Requested", debugData)
263
+ UiThreadUtil.runOnUiThread {
264
+ val activity = reactApplicationContext.currentActivity
265
+ val requested = AttentivePushHelper.requestPermissionIfNeeded(activity, PUSH_PERMISSION_REQUEST_CODE)
266
+ if (!requested && activity == null) {
267
+ Log.w(TAG, " Current activity is null; permission request deferred. Call again when app is in foreground.")
268
+ }
269
+ if (debugHelper.isDebuggingEnabled()) {
270
+ val debugData = mutableMapOf<String, Any>()
271
+ debugData["platform"] = "Android"
272
+ debugData["request_started"] = requested
273
+ debugHelper.showDebugInfo("Push Registration Requested", debugData)
274
+ }
275
+ }
276
+ }
277
+
278
+ /**
279
+ * Returns the current push notification authorization status for Android.
280
+ *
281
+ * On API 33+: returns "authorized" if POST_NOTIFICATIONS is granted, else "notDetermined".
282
+ * On API < 33: returns "authorized" (no runtime permission required).
283
+ */
284
+ override fun getPushAuthorizationStatus(promise: Promise) {
285
+ try {
286
+ val status = AttentivePushHelper.getAuthorizationStatus(reactApplicationContext)
287
+ Log.d(TAG, "getPushAuthorizationStatus: $status")
288
+ promise.resolve(status)
289
+ } catch (e: Exception) {
290
+ Log.e(TAG, "getPushAuthorizationStatus error: ${e.message}", e)
291
+ promise.reject("GET_STATUS_ERROR", e.message ?: "Unknown error", e)
273
292
  }
274
293
  }
275
294
 
@@ -292,7 +311,7 @@ class AttentiveReactNativeSdkModule(reactContext: ReactApplicationContext) :
292
311
  // Note: Attentive Android SDK 1.0.1 may not have direct push token registration
293
312
  // For SDK version 2.x, use: AttentiveConfig.setDeviceToken() or similar
294
313
  // For now, we log the token and make it available for custom implementation
295
-
314
+
296
315
  Log.i(TAG, "⚠️ [AttentiveSDK] Push token registration requires manual implementation")
297
316
  Log.i(TAG, " FCM token available: ${token.take(16)}...")
298
317
  Log.i(TAG, " Store this token and register it with Attentive backend manually")
@@ -405,22 +424,29 @@ class AttentiveReactNativeSdkModule(reactContext: ReactApplicationContext) :
405
424
  try {
406
425
  // Attentive Android SDK 1.0.1 doesn't have a built-in handleRegularOpen method
407
426
  // We can track this as a custom event or use AttentiveEventTracker
408
-
427
+
409
428
  // Option 1: Track as custom event
429
+
430
+ Log.i(TAG, " Tracking regular open as custom event 'app_open' with properties")
431
+
410
432
  val properties = mapOf(
411
433
  "event_type" to "app_open",
412
434
  "authorization_status" to authorizationStatus,
413
435
  "platform" to "Android"
414
436
  )
415
-
437
+
416
438
  try {
439
+ Log.i(TAG, " Attempting to track custom event for regular app open")
440
+
417
441
  val customEvent = com.attentive.androidsdk.events.CustomEvent.Builder(
418
442
  "app_open",
419
443
  properties
420
444
  ).build()
421
-
445
+
446
+ Log.i(TAG, " Custom event built successfully, recording event...")
447
+
422
448
  AttentiveEventTracker.getInstance().recordEvent(customEvent)
423
-
449
+
424
450
  Log.i(TAG, "✅ [AttentiveSDK] handleRegularOpen completed (tracked as custom event)")
425
451
  Log.i(TAG, " Event sent to Attentive backend")
426
452
  } catch (e: Exception) {
@@ -472,7 +498,7 @@ class AttentiveReactNativeSdkModule(reactContext: ReactApplicationContext) :
472
498
  properties["event_type"] = "push_open"
473
499
  properties["authorization_status"] = authorizationStatus
474
500
  properties["platform"] = "Android"
475
-
501
+
476
502
  // Add notification payload to properties (converting to strings)
477
503
  payload.forEach { (key, value) ->
478
504
  properties["notification_$key"] = value?.toString() ?: "null"
@@ -483,9 +509,9 @@ class AttentiveReactNativeSdkModule(reactContext: ReactApplicationContext) :
483
509
  "push_open",
484
510
  properties
485
511
  ).build()
486
-
512
+
487
513
  AttentiveEventTracker.getInstance().recordEvent(customEvent)
488
-
514
+
489
515
  Log.i(TAG, "✅ [AttentiveSDK] handlePushOpen completed (tracked as custom event)")
490
516
  Log.i(TAG, " Push open event sent to Attentive backend")
491
517
  } catch (e: Exception) {
@@ -538,7 +564,7 @@ class AttentiveReactNativeSdkModule(reactContext: ReactApplicationContext) :
538
564
  properties["event_type"] = "foreground_push"
539
565
  properties["authorization_status"] = authorizationStatus
540
566
  properties["platform"] = "Android"
541
-
567
+
542
568
  // Add notification payload to properties (converting to strings)
543
569
  payload.forEach { (key, value) ->
544
570
  properties["notification_$key"] = value?.toString() ?: "null"
@@ -549,9 +575,9 @@ class AttentiveReactNativeSdkModule(reactContext: ReactApplicationContext) :
549
575
  "foreground_push",
550
576
  properties
551
577
  ).build()
552
-
578
+
553
579
  AttentiveEventTracker.getInstance().recordEvent(customEvent)
554
-
580
+
555
581
  Log.i(TAG, "✅ [AttentiveSDK] handleForegroundPush completed (tracked as custom event)")
556
582
  Log.i(TAG, " Foreground push event sent to Attentive backend")
557
583
  } catch (e: Exception) {
@@ -335,6 +335,38 @@ customIdentifiers:(NSDictionary *)customIdentifiers {
335
335
  }
336
336
  return UNAuthorizationStatusNotDetermined;
337
337
  }
338
+
339
+ // Helper to convert UNAuthorizationStatus to string for getPushAuthorizationStatus
340
+ - (NSString *)authorizationStatusToRNString:(UNAuthorizationStatus)status {
341
+ switch (status) {
342
+ case UNAuthorizationStatusAuthorized:
343
+ return @"authorized";
344
+ case UNAuthorizationStatusDenied:
345
+ return @"denied";
346
+ case UNAuthorizationStatusNotDetermined:
347
+ return @"notDetermined";
348
+ #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 120000
349
+ case UNAuthorizationStatusProvisional:
350
+ return @"provisional";
351
+ #endif
352
+ #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000
353
+ case UNAuthorizationStatusEphemeral:
354
+ return @"ephemeral";
355
+ #endif
356
+ default:
357
+ return @"notDetermined";
358
+ }
359
+ }
360
+
361
+ - (void)getPushAuthorizationStatus:(RCTPromiseResolveBlock)resolve
362
+ reject:(RCTPromiseRejectBlock)reject {
363
+ UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
364
+ [center getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
365
+ NSString *status = [self authorizationStatusToRNString:settings.authorizationStatus];
366
+ resolve(status);
367
+ }];
368
+ }
369
+
338
370
  - (void)triggerCreative:(NSString *)creativeId {
339
371
  dispatch_async(dispatch_get_main_queue(), ^{
340
372
  UIWindow *window = [[UIApplication sharedApplication] keyWindow];
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","isTurboModuleEnabled","global","__turboModuleProxy","AttentiveReactNativeSdkModule","TurboModuleRegistry","get","NativeModules","AttentiveReactNativeSdk","_default","exports","default"],"sourceRoot":"../../src","sources":["NativeAttentiveReactNativeSdk.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AA8IA;AACA;AACA,MAAMC,oBAAoB,GAAIC,MAAM,CAASC,kBAAkB,IAAI,IAAI;AAEvE,MAAMC,6BAA6B,GAAGH,oBAAoB,GACtDI,gCAAmB,CAACC,GAAG,CAAO,yBAAyB,CAAC,GACxDC,0BAAa,CAACC,uBAAuB;AAAC,IAAAC,QAAA,GAE3BL,6BAA6B;AAAAM,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
1
+ {"version":3,"names":["_reactNative","require","isTurboModuleEnabled","global","__turboModuleProxy","AttentiveReactNativeSdkModule","TurboModuleRegistry","get","NativeModules","AttentiveReactNativeSdk","_default","exports","default"],"sourceRoot":"../../src","sources":["NativeAttentiveReactNativeSdk.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAuJA;AACA;AACA,MAAMC,oBAAoB,GAAIC,MAAM,CAASC,kBAAkB,IAAI,IAAI;AAEvE,MAAMC,6BAA6B,GAAGH,oBAAoB,GACtDI,gCAAmB,CAACC,GAAG,CAAO,yBAAyB,CAAC,GACxDC,0BAAa,CAACC,uBAAuB;AAAC,IAAAC,QAAA,GAE3BL,6BAA6B;AAAAM,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.clearUser = clearUser;
7
7
  exports.destroyCreative = destroyCreative;
8
8
  exports.exportDebugLogs = exportDebugLogs;
9
+ exports.getPushAuthorizationStatus = getPushAuthorizationStatus;
9
10
  exports.handleForegroundNotification = handleForegroundNotification;
10
11
  exports.handleForegroundPush = handleForegroundPush;
11
12
  exports.handlePushOpen = handlePushOpen;
@@ -130,13 +131,13 @@ function exportDebugLogs() {
130
131
  }
131
132
 
132
133
  // =============================================================================
133
- // Push Notification Methods (iOS only - Android is no-op with TODO stubs)
134
+ // Push Notification Methods (iOS and Android)
134
135
  // =============================================================================
135
136
 
136
137
  /**
137
138
  * Request push notification permission from the user.
138
139
  * On iOS, this will trigger the system permission dialog.
139
- * On Android, this is currently a no-op (TODO: implement FCM integration).
140
+ * On Android 13+, this requests POST_NOTIFICATIONS; on older versions, no-op.
140
141
  *
141
142
  * @example
142
143
  * ```typescript
@@ -150,12 +151,30 @@ function registerForPushNotifications() {
150
151
  AttentiveReactNativeSdk.registerForPushNotifications();
151
152
  }
152
153
 
154
+ /**
155
+ * Get the current push notification authorization status.
156
+ * On Android, uses the SDK's native check (POST_NOTIFICATIONS on API 33+).
157
+ * On iOS, uses UNUserNotificationCenter notification settings.
158
+ *
159
+ * @returns Promise resolving to 'authorized' | 'denied' | 'notDetermined' (and on iOS possibly 'provisional' | 'ephemeral')
160
+ *
161
+ * @example
162
+ * ```typescript
163
+ * import { getPushAuthorizationStatus, handleRegularOpen } from 'attentive-react-native-sdk';
164
+ *
165
+ * getPushAuthorizationStatus().then((status) => handleRegularOpen(status));
166
+ * ```
167
+ */
168
+ function getPushAuthorizationStatus() {
169
+ return AttentiveReactNativeSdk.getPushAuthorizationStatus();
170
+ }
171
+
153
172
  /**
154
173
  * Register the device token received from APNs/FCM with the Attentive backend.
155
174
  * Call this from your AppDelegate's didRegisterForRemoteNotificationsWithDeviceToken.
156
175
  *
157
176
  * On iOS, the token should be the hex-encoded string representation of the device token Data.
158
- * On Android, this is currently a no-op (TODO: implement FCM integration).
177
+ * On Android, registers the FCM token when provided by the host app.
159
178
  *
160
179
  * @param token - The device token as a hex-encoded string
161
180
  * @param authorizationStatus - Current push authorization status
@@ -178,7 +197,7 @@ function registerDeviceToken(token, authorizationStatus) {
178
197
  *
179
198
  * On iOS, this will register the device token with the Attentive SDK and invoke the callback
180
199
  * after the registration completes (success or failure).
181
- * On Android, this is currently a no-op (TODO: implement FCM integration).
200
+ * On Android, registers the FCM token when provided by the host app.
182
201
  *
183
202
  * @param token - The hex-encoded device token string from APNs
184
203
  * @param authorizationStatus - Current push authorization status
@@ -225,7 +244,7 @@ function registerDeviceTokenWithCallback(token, authorizationStatus, callback) {
225
244
  *
226
245
  * On iOS, this will notify the Attentive SDK that the app was opened directly
227
246
  * (not from a push notification tap).
228
- * On Android, this is currently a no-op (TODO: implement FCM integration).
247
+ * On Android, registers the FCM token when provided by the host app.
229
248
  *
230
249
  * @param authorizationStatus - Current push authorization status
231
250
  *
@@ -268,7 +287,7 @@ function handleRegularOpen(authorizationStatus) {
268
287
  *
269
288
  * On iOS, this will track the push open event and handle the notification appropriately
270
289
  * based on whether the app was in the foreground, background, or not running.
271
- * On Android, this is currently a no-op (TODO: implement FCM integration).
290
+ * On Android, registers the FCM token when provided by the host app.
272
291
  *
273
292
  * @param userInfo - The notification payload from the push notification
274
293
  * @param applicationState - The app state when the notification was opened ('active', 'inactive', 'background')
@@ -295,7 +314,7 @@ function handlePushOpened(userInfo, applicationState, authorizationStatus) {
295
314
  * Call this from your notification handler when a notification is received while the app is active.
296
315
  *
297
316
  * On iOS, this allows the Attentive SDK to track the notification event.
298
- * On Android, this is currently a no-op (TODO: implement FCM integration).
317
+ * On Android, registers the FCM token when provided by the host app.
299
318
  *
300
319
  * @param userInfo - The notification payload from the push notification
301
320
  *
@@ -323,7 +342,7 @@ function handleForegroundNotification(userInfo) {
323
342
  * ```
324
343
  *
325
344
  * On iOS, this properly tracks foreground push notifications.
326
- * On Android, this is currently a no-op (TODO: implement FCM integration).
345
+ * On Android, registers the FCM token when provided by the host app.
327
346
  *
328
347
  * @param userInfo - The notification payload from the push notification
329
348
  * @param authorizationStatus - Current push authorization status
@@ -356,7 +375,7 @@ function handleForegroundPush(userInfo, authorizationStatus) {
356
375
  * ```
357
376
  *
358
377
  * On iOS, this properly tracks push notification opens.
359
- * On Android, this is currently a no-op (TODO: implement FCM integration).
378
+ * On Android, registers the FCM token when provided by the host app.
360
379
  *
361
380
  * @param userInfo - The notification payload from the push notification
362
381
  * @param authorizationStatus - Current push authorization status
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_NativeAttentiveReactNativeSdk","_interopRequireDefault","obj","__esModule","default","LINKING_ERROR","Platform","select","ios","AttentiveReactNativeSdk","NativeAttentiveReactNativeSdkModule","Proxy","get","Error","initialize","configuration","attentiveDomain","mode","skipFatigueOnCreatives","enableDebugger","triggerCreative","creativeId","destroyCreative","updateDomain","domain","identify","identifiers","phone","email","klaviyoId","shopifyId","clientUserId","customIdentifiers","clearUser","recordAddToCartEvent","attrs","items","deeplink","recordProductViewEvent","recordPurchaseEvent","orderId","cartId","cartCoupon","recordCustomEvent","type","properties","invokeAttentiveDebugHelper","exportDebugLogs","registerForPushNotifications","registerDeviceToken","token","authorizationStatus","registerDeviceTokenWithCallback","callback","handleRegularOpen","console","log","handlePushOpened","userInfo","applicationState","handleForegroundNotification","handleForegroundPush","handlePushOpen"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAcA,IAAAC,8BAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEwC,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAExC,MAAMG,aAAa,GAChB,qFAAoF,GACrFC,qBAAQ,CAACC,MAAM,CAAC;EACdC,GAAG,EAAE,gCAAgC;EACrCJ,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,KAAK,CAACC,KAAK,EAAED,KAAK,CAACE,QAAQ,CAAC;AAC3E;;AAEA;AACA;AACA;AACA;AACA,SAASC,sBAAsBA,CAACH,KAAkB,EAAE;EAClD1B,uBAAuB,CAAC6B,sBAAsB,CAACH,KAAK,CAACC,KAAK,EAAED,KAAK,CAACE,QAAQ,CAAC;AAC7E;;AAEA;AACA;AACA;AACA;AACA,SAASE,mBAAmBA,CAACJ,KAAe,EAAE;EAC5C1B,uBAAuB,CAAC8B,mBAAmB,CACzCJ,KAAK,CAACC,KAAK,EACXD,KAAK,CAACK,OAAO,EACbL,KAAK,CAACM,MAAM,EACZN,KAAK,CAACO,UAAU,CACjB;AACH;;AAEA;AACA;AACA;AACA;AACA,SAASC,iBAAiBA,CAACR,KAAkB,EAAE;EAC7C1B,uBAAuB,CAACkC,iBAAiB,CAACR,KAAK,CAACS,IAAI,EAAET,KAAK,CAACU,UAAU,CAAC;AACzE;;AAEA;AACA;AACA;AACA,SAASC,0BAA0BA,CAAA,EAAG;EACpCrC,uBAAuB,CAACqC,0BAA0B,EAAE;AACtD;;AAEA;AACA;AACA;AACA;AACA,SAASC,eAAeA,CAAA,EAAoB;EAC1C,OAAOtC,uBAAuB,CAACsC,eAAe,EAAE;AAClD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,4BAA4BA,CAAA,EAAS;EAC5CvC,uBAAuB,CAACuC,4BAA4B,EAAE;AACxD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,mBAAmBA,CAC1BC,KAAa,EACbC,mBAA4C,EACtC;EACN1C,uBAAuB,CAACwC,mBAAmB,CAACC,KAAK,EAAEC,mBAAmB,CAAC;AACzE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,+BAA+BA,CACtCF,KAAa,EACbC,mBAA4C,EAC5CE,QAKS,EACH;EACN5C,uBAAuB,CAAC2C,+BAA+B,CACrDF,KAAK,EACLC,mBAAmB,EACnBE,QAAQ,CACT;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,iBAAiBA,CAACH,mBAA4C,EAAQ;EAC7EI,OAAO,CAACC,GAAG,CAAC,6DAA6D,CAAC;EAC1ED,OAAO,CAACC,GAAG,CAAE,4BAA2BL,mBAAoB,EAAC,CAAC;EAC9DI,OAAO,CAACC,GAAG,CACT,mEAAmE,CACpE;EAED/C,uBAAuB,CAAC6C,iBAAiB,CAACH,mBAAmB,CAAC;EAE9DI,OAAO,CAACC,GAAG,CAAC,mDAAmD,CAAC;AAClE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,gBAAgBA,CACvBC,QAAkC,EAClCC,gBAAkC,EAClCR,mBAA4C,EACtC;EACN1C,uBAAuB,CAACgD,gBAAgB,CACtCC,QAAQ,EACRC,gBAAgB,EAChBR,mBAAmB,CACpB;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASS,4BAA4BA,CACnCF,QAAkC,EAC5B;EACNjD,uBAAuB,CAACmD,4BAA4B,CAACF,QAAQ,CAAW;AAC1E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASG,oBAAoBA,CAC3BH,QAAkC,EAClCP,mBAA4C,EACtC;EACN1C,uBAAuB,CAACoD,oBAAoB,CAC1CH,QAAQ,EACRP,mBAAmB,CACpB;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASW,cAAcA,CACrBJ,QAAkC,EAClCP,mBAA4C,EACtC;EACN1C,uBAAuB,CAACqD,cAAc,CACpCJ,QAAQ,EACRP,mBAAmB,CACpB;AACH"}
1
+ {"version":3,"names":["_reactNative","require","_NativeAttentiveReactNativeSdk","_interopRequireDefault","obj","__esModule","default","LINKING_ERROR","Platform","select","ios","AttentiveReactNativeSdk","NativeAttentiveReactNativeSdkModule","Proxy","get","Error","initialize","configuration","attentiveDomain","mode","skipFatigueOnCreatives","enableDebugger","triggerCreative","creativeId","destroyCreative","updateDomain","domain","identify","identifiers","phone","email","klaviyoId","shopifyId","clientUserId","customIdentifiers","clearUser","recordAddToCartEvent","attrs","items","deeplink","recordProductViewEvent","recordPurchaseEvent","orderId","cartId","cartCoupon","recordCustomEvent","type","properties","invokeAttentiveDebugHelper","exportDebugLogs","registerForPushNotifications","getPushAuthorizationStatus","registerDeviceToken","token","authorizationStatus","registerDeviceTokenWithCallback","callback","handleRegularOpen","console","log","handlePushOpened","userInfo","applicationState","handleForegroundNotification","handleForegroundPush","handlePushOpen"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAcA,IAAAC,8BAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEwC,SAAAE,uBAAAC,G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OxC,uBAAuB,CAACwC,0BAA0B,EAAE;AAC7D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,mBAAmBA,CAC1BC,KAAa,EACbC,mBAA4C,EACtC;EACN3C,uBAAuB,CAACyC,mBAAmB,CAACC,KAAK,EAAEC,mBAAmB,CAAC;AACzE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,+BAA+BA,CACtCF,KAAa,EACbC,mBAA4C,EAC5CE,QAKS,EACH;EACN7C,uBAAuB,CAAC4C,+BAA+B,CACrDF,KAAK,EACLC,mBAAmB,EACnBE,QAAQ,CACT;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,iBAAiBA,CAACH,mBAA4C,EAAQ;EAC7EI,OAAO,CAACC,GAAG,CAAC,6DAA6D,CAAC;EAC1ED,OAAO,CAACC,GAAG,CAAE,4BAA2BL,mBAAoB,EAAC,CAAC;EAC9DI,OAAO,CAACC,GAAG,CACT,mEAAmE,CACpE;EAEDhD,uBAAuB,CAAC8C,iBAAiB,CAACH,mBAAmB,CAAC;EAE9DI,OAAO,CAACC,GAAG,CAAC,mDAAmD,CAAC;AAClE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,gBAAgBA,CACvBC,QAAkC,EAClCC,gBAAkC,EAClCR,mBAA4C,EACtC;EACN3C,uBAAuB,CAACiD,gBAAgB,CACtCC,QAAQ,EACRC,gBAAgB,EAChBR,mBAAmB,CACpB;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASS,4BAA4BA,CACnCF,QAAkC,EAC5B;EACNlD,uBAAuB,CAACoD,4BAA4B,CAACF,QAAQ,CAAW;AAC1E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASG,oBAAoBA,CAC3BH,QAAkC,EAClCP,mBAA4C,EACtC;EACN3C,uBAAuB,CAACqD,oBAAoB,CAC1CH,QAAQ,EACRP,mBAAmB,CACpB;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASW,cAAcA,CACrBJ,QAAkC,EAClCP,mBAA4C,EACtC;EACN3C,uBAAuB,CAACsD,cAAc,CACpCJ,QAAQ,EACRP,mBAAmB,CACpB;AACH"}
@@ -1 +1 @@
1
- {"version":3,"names":["TurboModuleRegistry","NativeModules","isTurboModuleEnabled","global","__turboModuleProxy","AttentiveReactNativeSdkModule","get","AttentiveReactNativeSdk"],"sourceRoot":"../../src","sources":["NativeAttentiveReactNativeSdk.ts"],"mappings":"AACA,SAASA,mBAAmB,EAAEC,aAAa,QAAQ,cAAc;AA8IjE;AACA;AACA,MAAMC,oBAAoB,GAAIC,MAAM,CAASC,kBAAkB,IAAI,IAAI;AAEvE,MAAMC,6BAA6B,GAAGH,oBAAoB,GACtDF,mBAAmB,CAACM,GAAG,CAAO,yBAAyB,CAAC,GACxDL,aAAa,CAACM,uBAAuB;AAEzC,eAAeF,6BAA6B"}
1
+ {"version":3,"names":["TurboModuleRegistry","NativeModules","isTurboModuleEnabled","global","__turboModuleProxy","AttentiveReactNativeSdkModule","get","AttentiveReactNativeSdk"],"sourceRoot":"../../src","sources":["NativeAttentiveReactNativeSdk.ts"],"mappings":"AACA,SAASA,mBAAmB,EAAEC,aAAa,QAAQ,cAAc;AAuJjE;AACA;AACA,MAAMC,oBAAoB,GAAIC,MAAM,CAASC,kBAAkB,IAAI,IAAI;AAEvE,MAAMC,6BAA6B,GAAGH,oBAAoB,GACtDF,mBAAmB,CAACM,GAAG,CAAO,yBAAyB,CAAC,GACxDL,aAAa,CAACM,uBAAuB;AAEzC,eAAeF,6BAA6B"}
@@ -104,13 +104,13 @@ function exportDebugLogs() {
104
104
  }
105
105
 
106
106
  // =============================================================================
107
- // Push Notification Methods (iOS only - Android is no-op with TODO stubs)
107
+ // Push Notification Methods (iOS and Android)
108
108
  // =============================================================================
109
109
 
110
110
  /**
111
111
  * Request push notification permission from the user.
112
112
  * On iOS, this will trigger the system permission dialog.
113
- * On Android, this is currently a no-op (TODO: implement FCM integration).
113
+ * On Android 13+, this requests POST_NOTIFICATIONS; on older versions, no-op.
114
114
  *
115
115
  * @example
116
116
  * ```typescript
@@ -124,12 +124,30 @@ function registerForPushNotifications() {
124
124
  AttentiveReactNativeSdk.registerForPushNotifications();
125
125
  }
126
126
 
127
+ /**
128
+ * Get the current push notification authorization status.
129
+ * On Android, uses the SDK's native check (POST_NOTIFICATIONS on API 33+).
130
+ * On iOS, uses UNUserNotificationCenter notification settings.
131
+ *
132
+ * @returns Promise resolving to 'authorized' | 'denied' | 'notDetermined' (and on iOS possibly 'provisional' | 'ephemeral')
133
+ *
134
+ * @example
135
+ * ```typescript
136
+ * import { getPushAuthorizationStatus, handleRegularOpen } from 'attentive-react-native-sdk';
137
+ *
138
+ * getPushAuthorizationStatus().then((status) => handleRegularOpen(status));
139
+ * ```
140
+ */
141
+ function getPushAuthorizationStatus() {
142
+ return AttentiveReactNativeSdk.getPushAuthorizationStatus();
143
+ }
144
+
127
145
  /**
128
146
  * Register the device token received from APNs/FCM with the Attentive backend.
129
147
  * Call this from your AppDelegate's didRegisterForRemoteNotificationsWithDeviceToken.
130
148
  *
131
149
  * On iOS, the token should be the hex-encoded string representation of the device token Data.
132
- * On Android, this is currently a no-op (TODO: implement FCM integration).
150
+ * On Android, registers the FCM token when provided by the host app.
133
151
  *
134
152
  * @param token - The device token as a hex-encoded string
135
153
  * @param authorizationStatus - Current push authorization status
@@ -152,7 +170,7 @@ function registerDeviceToken(token, authorizationStatus) {
152
170
  *
153
171
  * On iOS, this will register the device token with the Attentive SDK and invoke the callback
154
172
  * after the registration completes (success or failure).
155
- * On Android, this is currently a no-op (TODO: implement FCM integration).
173
+ * On Android, registers the FCM token when provided by the host app.
156
174
  *
157
175
  * @param token - The hex-encoded device token string from APNs
158
176
  * @param authorizationStatus - Current push authorization status
@@ -199,7 +217,7 @@ function registerDeviceTokenWithCallback(token, authorizationStatus, callback) {
199
217
  *
200
218
  * On iOS, this will notify the Attentive SDK that the app was opened directly
201
219
  * (not from a push notification tap).
202
- * On Android, this is currently a no-op (TODO: implement FCM integration).
220
+ * On Android, registers the FCM token when provided by the host app.
203
221
  *
204
222
  * @param authorizationStatus - Current push authorization status
205
223
  *
@@ -242,7 +260,7 @@ function handleRegularOpen(authorizationStatus) {
242
260
  *
243
261
  * On iOS, this will track the push open event and handle the notification appropriately
244
262
  * based on whether the app was in the foreground, background, or not running.
245
- * On Android, this is currently a no-op (TODO: implement FCM integration).
263
+ * On Android, registers the FCM token when provided by the host app.
246
264
  *
247
265
  * @param userInfo - The notification payload from the push notification
248
266
  * @param applicationState - The app state when the notification was opened ('active', 'inactive', 'background')
@@ -269,7 +287,7 @@ function handlePushOpened(userInfo, applicationState, authorizationStatus) {
269
287
  * Call this from your notification handler when a notification is received while the app is active.
270
288
  *
271
289
  * On iOS, this allows the Attentive SDK to track the notification event.
272
- * On Android, this is currently a no-op (TODO: implement FCM integration).
290
+ * On Android, registers the FCM token when provided by the host app.
273
291
  *
274
292
  * @param userInfo - The notification payload from the push notification
275
293
  *
@@ -297,7 +315,7 @@ function handleForegroundNotification(userInfo) {
297
315
  * ```
298
316
  *
299
317
  * On iOS, this properly tracks foreground push notifications.
300
- * On Android, this is currently a no-op (TODO: implement FCM integration).
318
+ * On Android, registers the FCM token when provided by the host app.
301
319
  *
302
320
  * @param userInfo - The notification payload from the push notification
303
321
  * @param authorizationStatus - Current push authorization status
@@ -330,7 +348,7 @@ function handleForegroundPush(userInfo, authorizationStatus) {
330
348
  * ```
331
349
  *
332
350
  * On iOS, this properly tracks push notification opens.
333
- * On Android, this is currently a no-op (TODO: implement FCM integration).
351
+ * On Android, registers the FCM token when provided by the host app.
334
352
  *
335
353
  * @param userInfo - The notification payload from the push notification
336
354
  * @param authorizationStatus - Current push authorization status
@@ -351,6 +369,6 @@ function handlePushOpen(userInfo, authorizationStatus) {
351
369
  AttentiveReactNativeSdk.handlePushOpen(userInfo, authorizationStatus);
352
370
  }
353
371
  export { initialize, triggerCreative, destroyCreative, updateDomain, identify, clearUser, recordAddToCartEvent, recordProductViewEvent, recordPurchaseEvent, recordCustomEvent, invokeAttentiveDebugHelper, exportDebugLogs,
354
- // Push Notification Methods (iOS only)
355
- registerForPushNotifications, registerDeviceToken, registerDeviceTokenWithCallback, handleRegularOpen, handlePushOpened, handleForegroundNotification, handleForegroundPush, handlePushOpen };
372
+ // Push Notification Methods
373
+ registerForPushNotifications, getPushAuthorizationStatus, registerDeviceToken, registerDeviceTokenWithCallback, handleRegularOpen, handlePushOpened, handleForegroundNotification, handleForegroundPush, handlePushOpen };
356
374
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","NativeAttentiveReactNativeSdkModule","LINKING_ERROR","select","ios","default","AttentiveReactNativeSdk","Proxy","get","Error","initialize","configuration","attentiveDomain","mode","skipFatigueOnCreatives","enableDebugger","triggerCreative","creativeId","destroyCreative","updateDomain","domain","identify","identifiers","phone","email","klaviyoId","shopifyId","clientUserId","customIdentifiers","clearUser","recordAddToCartEvent","attrs","items","deeplink","recordProductViewEvent","recordPurchaseEvent","orderId","cartId","cartCoupon","recordCustomEvent","type","properties","invokeAttentiveDebugHelper","exportDebugLogs","registerForPushNotifications","registerDeviceToken","token","authorizationStatus","registerDeviceTokenWithCallback","callback","handleRegularOpen","console","log","handlePushOpened","userInfo","applicationState","handleForegroundNotification","handleForegroundPush","handlePushOpen"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAcvC,OAAOC,mCAAmC,MAEnC,iCAAiC;AAExC,MAAMC,aAAa,GAChB,qFAAoF,GACrFF,QAAQ,CAACG,MAAM,CAAC;EACdC,GAAG,EAAE,gCAAgC;EACrCC,OAAO,EAAE;AACX,CAAC,CAAC,GACF,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,uBAAuB,GAC3BL,mCAAmC,GAC/BA,mCAAmC,GACnC,IAAIM,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CAAC,CAEA;;AAET;AACA;AACA;AACA;AACA,SAASQ,UAAUA,CAACC,aAAwC,EAAE;EAC5DL,uBAAuB,CAACI,UAAU,CAChCC,aAAa,CAACC,eAAe,EAC7BD,aAAa,CAACE,IAAI,EAClBF,aAAa,CAACG,sBAAsB,IAAI,KAAK,EAC7CH,aAAa,CAACI,cAAc,IAAI,KAAK,CACtC;AACH;;AAEA;AACA;AACA;AACA;AACA,SAASC,eAAeA,CAACC,UAAmB,EAAE;EAC5CX,uBAAuB,CAACU,eAAe,CAACC,UAAU,CAAC;AACrD;;AAEA;AACA;AACA;AACA,SAASC,eAAeA,CAAA,EAAG;EACzBZ,uBAAuB,CAACY,eAAe,EAAE;AAC3C;;A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AACA;AACA;AACA;AACA,SAASC,eAAeA,CAAA,EAAoB;EAC1C,OAAOrC,uBAAuB,CAACqC,eAAe,EAAE;AAClD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,4BAA4BA,CAAA,EAAS;EAC5CtC,uBAAuB,CAACsC,4BAA4B,EAAE;AACxD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,mBAAmBA,CAC1BC,KAAa,EACbC,mBAA4C,EACtC;EACNzC,uBAAuB,CAACuC,mBAAmB,CAACC,KAAK,EAAEC,mBAAmB,CAAC;AACzE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,+BAA+BA,CACtCF,KAAa,EACbC,mBAA4C,EAC5CE,QAKS,EACH;EACN3C,uBAAuB,CAAC0C,+BAA+B,CACrDF,KAAK,EACLC,mBAAmB,EACnBE,QAAQ,CACT;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,iBAAiBA,CAACH,mBAA4C,EAAQ;EAC7EI,OAAO,CAACC,GAAG,CAAC,6DAA6D,CAAC;EAC1ED,OAAO,CAACC,GAAG,CAAE,4BAA2BL,mBAAoB,EAAC,CAAC;EAC9DI,OAAO,CAACC,GAAG,CACT,mEAAmE,CACpE;EAED9C,uBAAuB,CAAC4C,iBAAiB,CAACH,mBAAmB,CAAC;EAE9DI,OAAO,CAACC,GAAG,CAAC,mDAAmD,CAAC;AAClE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,gBAAgBA,CACvBC,QAAkC,EAClCC,gBAAkC,EAClCR,mBAA4C,EACtC;EACNzC,uBAAuB,CAAC+C,gBAAgB,CACtCC,QAAQ,EACRC,gBAAgB,EAChBR,mBAAmB,CACpB;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASS,4BAA4BA,CACnCF,QAAkC,EAC5B;EACNhD,uBAAuB,CAACkD,4BAA4B,CAACF,QAAQ,CAAW;AAC1E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASG,oBAAoBA,CAC3BH,QAAkC,EAClCP,mBAA4C,EACtC;EACNzC,uBAAuB,CAACmD,oBAAoB,CAC1CH,QAAQ,EACRP,mBAAmB,CACpB;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASW,cAAcA,CACrBJ,QAAkC,EAClCP,mBAA4C,EACtC;EACNzC,uBAAuB,CAACoD,cAAc,CACpCJ,QAAQ,EACRP,mBAAmB,CACpB;AACH;AAEA,SACErC,UAAU,EACVM,eAAe,EACfE,eAAe,EACfC,YAAY,EACZE,QAAQ,EACRQ,SAAS,EACTC,oBAAoB,EACpBI,sBAAsB,EACtBC,mBAAmB,EACnBI,iBAAiB,EACjBG,0BAA0B,EAC1BC,eAAe;AACf;AACAC,4BAA4B,EAC5BC,mBAAmB,EACnBG,+BAA+B,EAC/BE,iBAAiB,EACjBG,gBAAgB,EAChBG,4BAA4B,EAC5BC,oBAAoB,EACpBC,cAAc"}
1
+ {"version":3,"names":["Platform","NativeAttentiveReactNativeSdkModule","LINKING_ERROR","select","ios","default","AttentiveReactNativeSdk","Proxy","get","Error","initialize","configuration","attentiveDomain","mode","skipFatigueOnCreatives","enableDebugger","triggerCreative","creativeId","destroyCreative","updateDomain","domain","identify","identifiers","phone","email","klaviyoId","shopifyId","clientUserId","customIdentifiers","clearUser","recordAddToCartEvent","attrs","items","deeplink","recordProductViewEvent","recordPurchaseEvent","orderId","cartId","cartCoupon","recordCustomEvent","type","properties","invokeAttentiveDebugHelper","exportDebugLogs","registerForPushNotifications","getPushAuthorizationStatus","registerDeviceToken","token","authorizationStatus","registerDeviceTokenWithCallback","callback","handleRegularOpen","console","log","handlePushOpened","userInfo","applicationState","handleForegroundNotification","handleForegroundPush","handlePushOpen"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAcvC,OAAOC,mCAAmC,MAEnC,iCAAiC;AAExC,MAAMC,aAAa,GAChB,qFAAoF,GACrFF,QAAQ,CAACG,MAAM,CAAC;EACdC,GAAG,EAAE,gCAAgC;EACrCC,OAAO,EAAE;AACX,CAAC,CAAC,GACF,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,uBAAuB,GAC3BL,mCAAmC,GAC/BA,mCAAmC,GACnC,IAAIM,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CAAC,CAEA;;AAET;AACA;AACA;AACA;AACA,SAASQ,UAAUA,CAACC,aAAwC,EAAE;EAC5DL,uBAAuB,CAACI,UAAU,CAChCC,aAAa,CAACC,eAAe,EAC7BD,aAAa,CAACE,IAAI,EAClBF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,KAAK,CAACO,UAAU,CACjB;AACH;;AAEA;AACA;AACA;AACA;AACA,SAASC,iBAAiBA,CAACR,KAAkB,EAAE;EAC7CzB,uBAAuB,CAACiC,iBAAiB,CAACR,KAAK,CAACS,IAAI,EAAET,KAAK,CAACU,UAAU,CAAC;AACzE;;AAEA;AACA;AACA;AACA,SAASC,0BAA0BA,CAAA,EAAG;EACpCpC,uBAAuB,CAACoC,0BAA0B,EAAE;AACtD;;AAEA;AACA;AACA;AACA;AACA,SAASC,eAAeA,CAAA,EAAoB;EAC1C,OAAOrC,uBAAuB,CAACqC,eAAe,EAAE;AAClD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,4BAA4BA,CAAA,EAAS;EAC5CtC,uBAAuB,CAACsC,4BAA4B,EAAE;AACxD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,0BAA0BA,CAAA,EAAqC;EACtE,OAAOvC,uBAAuB,CAACuC,0BAA0B,EAAE;AAC7D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,mBAAmBA,CAC1BC,KAAa,EACbC,mBAA4C,EACtC;EACN1C,uBAAuB,CAACwC,mBAAmB,CAACC,KAAK,EAAEC,mBAAmB,CAAC;AACzE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,+BAA+BA,CACtCF,KAAa,EACbC,mBAA4C,EAC5CE,QAKS,EACH;EACN5C,uBAAuB,CAAC2C,+BAA+B,CACrDF,KAAK,EACLC,mBAAmB,EACnBE,QAAQ,CACT;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,iBAAiBA,CAACH,mBAA4C,EAAQ;EAC7EI,OAAO,CAACC,GAAG,CAAC,6DAA6D,CAAC;EAC1ED,OAAO,CAACC,GAAG,CAAE,4BAA2BL,mBAAoB,EAAC,CAAC;EAC9DI,OAAO,CAACC,GAAG,CACT,mEAAmE,CACpE;EAED/C,uBAAuB,CAAC6C,iBAAiB,CAACH,mBAAmB,CAAC;EAE9DI,OAAO,CAACC,GAAG,CAAC,mDAAmD,CAAC;AAClE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,gBAAgBA,CACvBC,QAAkC,EAClCC,gBAAkC,EAClCR,mBAA4C,EACtC;EACN1C,uBAAuB,CAACgD,gBAAgB,CACtCC,QAAQ,EACRC,gBAAgB,EAChBR,mBAAmB,CACpB;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASS,4BAA4BA,CACnCF,QAAkC,EAC5B;EACNjD,uBAAuB,CAACmD,4BAA4B,CAACF,QAAQ,CAAW;AAC1E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASG,oBAAoBA,CAC3BH,QAAkC,EAClCP,mBAA4C,EACtC;EACN1C,uBAAuB,CAACoD,oBAAoB,CAC1CH,QAAQ,EACRP,mBAAmB,CACpB;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASW,cAAcA,CACrBJ,QAAkC,EAClCP,mBAA4C,EACtC;EACN1C,uBAAuB,CAACqD,cAAc,CACpCJ,QAAQ,EACRP,mBAAmB,CACpB;AACH;AAEA,SACEtC,UAAU,EACVM,eAAe,EACfE,eAAe,EACfC,YAAY,EACZE,QAAQ,EACRQ,SAAS,EACTC,oBAAoB,EACpBI,sBAAsB,EACtBC,mBAAmB,EACnBI,iBAAiB,EACjBG,0BAA0B,EAC1BC,eAAe;AACf;AACAC,4BAA4B,EAC5BC,0BAA0B,EAC1BC,mBAAmB,EACnBG,+BAA+B,EAC/BE,iBAAiB,EACjBG,gBAAgB,EAChBG,4BAA4B,EAC5BC,oBAAoB,EACpBC,cAAc"}
@@ -41,9 +41,17 @@ export interface Spec extends TurboModule {
41
41
  exportDebugLogs: () => Promise<string>;
42
42
  /**
43
43
  * Request push notification permission from the user.
44
- * iOS only - Android is a no-op.
44
+ * On iOS, triggers the system permission dialog.
45
+ * On Android 13+, requests POST_NOTIFICATIONS; on older versions, no-op.
45
46
  */
46
47
  registerForPushNotifications: () => void;
48
+ /**
49
+ * Get the current push notification authorization status.
50
+ * On Android, uses POST_NOTIFICATIONS (API 33+); on older versions returns 'authorized'.
51
+ * On iOS, use PushNotificationIOS.checkPermissions instead; this method is for Android parity.
52
+ * @returns Promise resolving to 'authorized' | 'denied' | 'notDetermined'
53
+ */
54
+ getPushAuthorizationStatus: () => Promise<string>;
47
55
  /**
48
56
  * Register the device token received from APNs (simple version without callback).
49
57
  * iOS only - Android is a no-op.
@@ -1 +1 @@
1
- {"version":3,"file":"NativeAttentiveReactNativeSdk.d.ts","sourceRoot":"","sources":["../../src/NativeAttentiveReactNativeSdk.ts"],"names":[],"mappings":"AAAA,OA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61
  * On iOS, this will trigger the system permission dialog.
62
- * On Android, this is currently a no-op (TODO: implement FCM integration).
62
+ * On Android 13+, this requests POST_NOTIFICATIONS; on older versions, no-op.
63
63
  *
64
64
  * @example
65
65
  * ```typescript
@@ -70,12 +70,27 @@ declare function exportDebugLogs(): Promise<string>;
70
70
  * ```
71
71
  */
72
72
  declare function registerForPushNotifications(): void;
73
+ /**
74
+ * Get the current push notification authorization status.
75
+ * On Android, uses the SDK's native check (POST_NOTIFICATIONS on API 33+).
76
+ * On iOS, uses UNUserNotificationCenter notification settings.
77
+ *
78
+ * @returns Promise resolving to 'authorized' | 'denied' | 'notDetermined' (and on iOS possibly 'provisional' | 'ephemeral')
79
+ *
80
+ * @example
81
+ * ```typescript
82
+ * import { getPushAuthorizationStatus, handleRegularOpen } from 'attentive-react-native-sdk';
83
+ *
84
+ * getPushAuthorizationStatus().then((status) => handleRegularOpen(status));
85
+ * ```
86
+ */
87
+ declare function getPushAuthorizationStatus(): Promise<PushAuthorizationStatus>;
73
88
  /**
74
89
  * Register the device token received from APNs/FCM with the Attentive backend.
75
90
  * Call this from your AppDelegate's didRegisterForRemoteNotificationsWithDeviceToken.
76
91
  *
77
92
  * On iOS, the token should be the hex-encoded string representation of the device token Data.
78
- * On Android, this is currently a no-op (TODO: implement FCM integration).
93
+ * On Android, registers the FCM token when provided by the host app.
79
94
  *
80
95
  * @param token - The device token as a hex-encoded string
81
96
  * @param authorizationStatus - Current push authorization status
@@ -95,7 +110,7 @@ declare function registerDeviceToken(token: string, authorizationStatus: PushAut
95
110
  *
96
111
  * On iOS, this will register the device token with the Attentive SDK and invoke the callback
97
112
  * after the registration completes (success or failure).
98
- * On Android, this is currently a no-op (TODO: implement FCM integration).
113
+ * On Android, registers the FCM token when provided by the host app.
99
114
  *
100
115
  * @param token - The hex-encoded device token string from APNs
101
116
  * @param authorizationStatus - Current push authorization status
@@ -139,7 +154,7 @@ declare function registerDeviceTokenWithCallback(token: string, authorizationSta
139
154
  *
140
155
  * On iOS, this will notify the Attentive SDK that the app was opened directly
141
156
  * (not from a push notification tap).
142
- * On Android, this is currently a no-op (TODO: implement FCM integration).
157
+ * On Android, registers the FCM token when provided by the host app.
143
158
  *
144
159
  * @param authorizationStatus - Current push authorization status
145
160
  *
@@ -175,7 +190,7 @@ declare function handleRegularOpen(authorizationStatus: PushAuthorizationStatus)
175
190
  *
176
191
  * On iOS, this will track the push open event and handle the notification appropriately
177
192
  * based on whether the app was in the foreground, background, or not running.
178
- * On Android, this is currently a no-op (TODO: implement FCM integration).
193
+ * On Android, registers the FCM token when provided by the host app.
179
194
  *
180
195
  * @param userInfo - The notification payload from the push notification
181
196
  * @param applicationState - The app state when the notification was opened ('active', 'inactive', 'background')
@@ -199,7 +214,7 @@ declare function handlePushOpened(userInfo: PushNotificationUserInfo, applicatio
199
214
  * Call this from your notification handler when a notification is received while the app is active.
200
215
  *
201
216
  * On iOS, this allows the Attentive SDK to track the notification event.
202
- * On Android, this is currently a no-op (TODO: implement FCM integration).
217
+ * On Android, registers the FCM token when provided by the host app.
203
218
  *
204
219
  * @param userInfo - The notification payload from the push notification
205
220
  *
@@ -224,7 +239,7 @@ declare function handleForegroundNotification(userInfo: PushNotificationUserInfo
224
239
  * ```
225
240
  *
226
241
  * On iOS, this properly tracks foreground push notifications.
227
- * On Android, this is currently a no-op (TODO: implement FCM integration).
242
+ * On Android, registers the FCM token when provided by the host app.
228
243
  *
229
244
  * @param userInfo - The notification payload from the push notification
230
245
  * @param authorizationStatus - Current push authorization status
@@ -254,7 +269,7 @@ declare function handleForegroundPush(userInfo: PushNotificationUserInfo, author
254
269
  * ```
255
270
  *
256
271
  * On iOS, this properly tracks push notification opens.
257
- * On Android, this is currently a no-op (TODO: implement FCM integration).
272
+ * On Android, registers the FCM token when provided by the host app.
258
273
  *
259
274
  * @param userInfo - The notification payload from the push notification
260
275
  * @param authorizationStatus - Current push authorization status
@@ -272,6 +287,6 @@ declare function handleForegroundPush(userInfo: PushNotificationUserInfo, author
272
287
  * ```
273
288
  */
274
289
  declare function handlePushOpen(userInfo: PushNotificationUserInfo, authorizationStatus: PushAuthorizationStatus): void;
275
- export { initialize, triggerCreative, destroyCreative, updateDomain, identify, clearUser, recordAddToCartEvent, recordProductViewEvent, recordPurchaseEvent, recordCustomEvent, invokeAttentiveDebugHelper, exportDebugLogs, registerForPushNotifications, registerDeviceToken, registerDeviceTokenWithCallback, handleRegularOpen, handlePushOpened, handleForegroundNotification, handleForegroundPush, handlePushOpen, };
290
+ export { initialize, triggerCreative, destroyCreative, updateDomain, identify, clearUser, recordAddToCartEvent, recordProductViewEvent, recordPurchaseEvent, recordCustomEvent, invokeAttentiveDebugHelper, exportDebugLogs, registerForPushNotifications, getPushAuthorizationStatus, registerDeviceToken, registerDeviceTokenWithCallback, handleRegularOpen, handlePushOpened, handleForegroundNotification, handleForegroundPush, handlePushOpen, };
276
291
  export type { UserIdentifiers, AttentiveSdkConfiguration, ProductView, Purchase, AddToCart, CustomEvent, Item, PushAuthorizationStatus, ApplicationState, PushNotificationUserInfo, PushRegistrationResult, };
277
292
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,yBAAyB,EACzB,WAAW,EACX,QAAQ,EACR,SAAS,EACT,WAAW,EACX,IAAI,EACJ,uBAAuB,EACvB,gBAAgB,EAChB,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,cAAc,CAAA;AA2BrB;;;GAGG;AACH,iBAAS,UAAU,CAAC,aAAa,EAAE,yBAAyB,QAO3D;AAED;;;GAGG;AACH,iBAAS,eAAe,CAAC,UAAU,CAAC,EAAE,MAAM,QAE3C;AAED;;GAEG;AACH,iBAAS,eAAe,SAEvB;AAED;;;GAGG;AACH,iBAAS,YAAY,CAAC,MAAM,EAAE,MAAM,QAEnC;AAED;;;GAGG;AACH,iBAAS,QAAQ,CAAC,WAAW,EAAE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AS,4BAA4B,CACnC,QAAQ,EAAE,wBAAwB,GACjC,IAAI,CAEN;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,iBAAS,oBAAoB,CAC3B,QAAQ,EAAE,wBAAwB,EAClC,mBAAmB,EAAE,uBAAuB,GAC3C,IAAI,CAKN;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,iBAAS,cAAc,CACrB,QAAQ,EAAE,wBAAwB,EAClC,mBAAmB,EAAE,uBAAuB,GAC3C,IAAI,CAKN;AAED,OAAO,EACL,UAAU,EACV,eAAe,EACf,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,0BAA0B,EAC1B,eAAe,EAEf,4BAA4B,EAC5B,mBAAmB,EACnB,+BAA+B,EAC/B,iBAAiB,EACjB,gBAAgB,EAChB,4BAA4B,EAC5B,oBAAoB,EACpB,cAAc,GACf,CAAA;AAED,YAAY,EACV,eAAe,EACf,yBAAyB,EACzB,WAAW,EACX,QAAQ,EACR,SAAS,EACT,WAAW,EACX,IAAI,EAEJ,uBAAuB,EACvB,gBAAgB,EAChB,wBAAwB,EACxB,sBAAsB,GACvB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,yBAAyB,EACzB,WAAW,EACX,QAAQ,EACR,SAAS,EACT,WAAW,EACX,IAAI,EACJ,uBAAuB,EACvB,gBAAgB,EAChB,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,cAAc,CAAA;AA2BrB;;;GAGG;AACH,iBAAS,UAAU,CAAC,aAAa,EAAE,yBAAyB,QAO3D;AAED;;;GAGG;AACH,iBAAS,eAAe,CAAC,UAAU,CAAC,EAAE,MAAM,QAE3C;AAED;;GAEG;AACH,iBAAS,eAAe,SAEvB;AAED;;;GAGG;AACH,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;;;;;;;GAuBG;AACH,iBAAS,gBAAgB,CACvB,QAAQ,EAAE,wBAAwB,EAClC,gBAAgB,EAAE,gBAAgB,EAClC,mBAAmB,EAAE,uBAAuB,GAC3C,IAAI,CAMN;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,iBAAS,4BAA4B,CACnC,QAAQ,EAAE,wBAAwB,GACjC,IAAI,CAEN;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,iBAAS,oBAAoB,CAC3B,QAAQ,EAAE,wBAAwB,EAClC,mBAAmB,EAAE,uBAAuB,GAC3C,IAAI,CAKN;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,iBAAS,cAAc,CACrB,QAAQ,EAAE,wBAAwB,EAClC,mBAAmB,EAAE,uBAAuB,GAC3C,IAAI,CAKN;AAED,OAAO,EACL,UAAU,EACV,eAAe,EACf,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,0BAA0B,EAC1B,eAAe,EAEf,4BAA4B,EAC5B,0BAA0B,EAC1B,mBAAmB,EACnB,+BAA+B,EAC/B,iBAAiB,EACjB,gBAAgB,EAChB,4BAA4B,EAC5B,oBAAoB,EACpB,cAAc,GACf,CAAA;AAED,YAAY,EACV,eAAe,EACf,yBAAyB,EACzB,WAAW,EACX,QAAQ,EACR,SAAS,EACT,WAAW,EACX,IAAI,EAEJ,uBAAuB,EACvB,gBAAgB,EAChB,wBAAwB,EACxB,sBAAsB,GACvB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@attentive-mobile/attentive-react-native-sdk",
3
- "version": "2.0.0-beta.4",
3
+ "version": "2.0.0-beta.5",
4
4
  "description": "React Native Module for the Attentive SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -48,7 +48,10 @@
48
48
  "ios",
49
49
  "android"
50
50
  ],
51
- "repository": "https://github.com/attentive-mobile/attentive-react-native-sdk",
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "git+https://github.com/attentive-mobile/attentive-react-native-sdk.git"
54
+ },
52
55
  "author": "Attentive <epd-accounts+npm@attentivemobile.com> (https://www.attentive.com)",
53
56
  "contributors": [
54
57
  "Wyatt Davis"
@@ -59,7 +62,8 @@
59
62
  },
60
63
  "homepage": "https://github.com/attentive-mobile/attentive-react-native-sdk#readme",
61
64
  "publishConfig": {
62
- "registry": "https://registry.npmjs.org/"
65
+ "registry": "https://registry.npmjs.org/",
66
+ "access": "public"
63
67
  },
64
68
  "devDependencies": {
65
69
  "@commitlint/config-conventional": "^17.0.2",
@@ -65,13 +65,22 @@ export interface Spec extends TurboModule {
65
65
  invokeAttentiveDebugHelper: () => void;
66
66
  exportDebugLogs: () => Promise<string>;
67
67
 
68
- // Push Notification Methods (iOS only)
68
+ // Push Notification Methods
69
69
  /**
70
70
  * Request push notification permission from the user.
71
- * iOS only - Android is a no-op.
71
+ * On iOS, triggers the system permission dialog.
72
+ * On Android 13+, requests POST_NOTIFICATIONS; on older versions, no-op.
72
73
  */
73
74
  registerForPushNotifications: () => void;
74
75
 
76
+ /**
77
+ * Get the current push notification authorization status.
78
+ * On Android, uses POST_NOTIFICATIONS (API 33+); on older versions returns 'authorized'.
79
+ * On iOS, use PushNotificationIOS.checkPermissions instead; this method is for Android parity.
80
+ * @returns Promise resolving to 'authorized' | 'denied' | 'notDetermined'
81
+ */
82
+ getPushAuthorizationStatus: () => Promise<string>;
83
+
75
84
  /**
76
85
  * Register the device token received from APNs (simple version without callback).
77
86
  * iOS only - Android is a no-op.
package/src/index.tsx CHANGED
@@ -149,13 +149,13 @@ function exportDebugLogs(): Promise<string> {
149
149
  }
150
150
 
151
151
  // =============================================================================
152
- // Push Notification Methods (iOS only - Android is no-op with TODO stubs)
152
+ // Push Notification Methods (iOS and Android)
153
153
  // =============================================================================
154
154
 
155
155
  /**
156
156
  * Request push notification permission from the user.
157
157
  * On iOS, this will trigger the system permission dialog.
158
- * On Android, this is currently a no-op (TODO: implement FCM integration).
158
+ * On Android 13+, this requests POST_NOTIFICATIONS; on older versions, no-op.
159
159
  *
160
160
  * @example
161
161
  * ```typescript
@@ -169,12 +169,30 @@ function registerForPushNotifications(): void {
169
169
  AttentiveReactNativeSdk.registerForPushNotifications()
170
170
  }
171
171
 
172
+ /**
173
+ * Get the current push notification authorization status.
174
+ * On Android, uses the SDK's native check (POST_NOTIFICATIONS on API 33+).
175
+ * On iOS, uses UNUserNotificationCenter notification settings.
176
+ *
177
+ * @returns Promise resolving to 'authorized' | 'denied' | 'notDetermined' (and on iOS possibly 'provisional' | 'ephemeral')
178
+ *
179
+ * @example
180
+ * ```typescript
181
+ * import { getPushAuthorizationStatus, handleRegularOpen } from 'attentive-react-native-sdk';
182
+ *
183
+ * getPushAuthorizationStatus().then((status) => handleRegularOpen(status));
184
+ * ```
185
+ */
186
+ function getPushAuthorizationStatus(): Promise<PushAuthorizationStatus> {
187
+ return AttentiveReactNativeSdk.getPushAuthorizationStatus() as Promise<PushAuthorizationStatus>
188
+ }
189
+
172
190
  /**
173
191
  * Register the device token received from APNs/FCM with the Attentive backend.
174
192
  * Call this from your AppDelegate's didRegisterForRemoteNotificationsWithDeviceToken.
175
193
  *
176
194
  * On iOS, the token should be the hex-encoded string representation of the device token Data.
177
- * On Android, this is currently a no-op (TODO: implement FCM integration).
195
+ * On Android, registers the FCM token when provided by the host app.
178
196
  *
179
197
  * @param token - The device token as a hex-encoded string
180
198
  * @param authorizationStatus - Current push authorization status
@@ -200,7 +218,7 @@ function registerDeviceToken(
200
218
  *
201
219
  * On iOS, this will register the device token with the Attentive SDK and invoke the callback
202
220
  * after the registration completes (success or failure).
203
- * On Android, this is currently a no-op (TODO: implement FCM integration).
221
+ * On Android, registers the FCM token when provided by the host app.
204
222
  *
205
223
  * @param token - The hex-encoded device token string from APNs
206
224
  * @param authorizationStatus - Current push authorization status
@@ -260,7 +278,7 @@ function registerDeviceTokenWithCallback(
260
278
  *
261
279
  * On iOS, this will notify the Attentive SDK that the app was opened directly
262
280
  * (not from a push notification tap).
263
- * On Android, this is currently a no-op (TODO: implement FCM integration).
281
+ * On Android, registers the FCM token when provided by the host app.
264
282
  *
265
283
  * @param authorizationStatus - Current push authorization status
266
284
  *
@@ -307,7 +325,7 @@ function handleRegularOpen(authorizationStatus: PushAuthorizationStatus): void {
307
325
  *
308
326
  * On iOS, this will track the push open event and handle the notification appropriately
309
327
  * based on whether the app was in the foreground, background, or not running.
310
- * On Android, this is currently a no-op (TODO: implement FCM integration).
328
+ * On Android, registers the FCM token when provided by the host app.
311
329
  *
312
330
  * @param userInfo - The notification payload from the push notification
313
331
  * @param applicationState - The app state when the notification was opened ('active', 'inactive', 'background')
@@ -342,7 +360,7 @@ function handlePushOpened(
342
360
  * Call this from your notification handler when a notification is received while the app is active.
343
361
  *
344
362
  * On iOS, this allows the Attentive SDK to track the notification event.
345
- * On Android, this is currently a no-op (TODO: implement FCM integration).
363
+ * On Android, registers the FCM token when provided by the host app.
346
364
  *
347
365
  * @param userInfo - The notification payload from the push notification
348
366
  *
@@ -372,7 +390,7 @@ function handleForegroundNotification(
372
390
  * ```
373
391
  *
374
392
  * On iOS, this properly tracks foreground push notifications.
375
- * On Android, this is currently a no-op (TODO: implement FCM integration).
393
+ * On Android, registers the FCM token when provided by the host app.
376
394
  *
377
395
  * @param userInfo - The notification payload from the push notification
378
396
  * @param authorizationStatus - Current push authorization status
@@ -411,7 +429,7 @@ function handleForegroundPush(
411
429
  * ```
412
430
  *
413
431
  * On iOS, this properly tracks push notification opens.
414
- * On Android, this is currently a no-op (TODO: implement FCM integration).
432
+ * On Android, registers the FCM token when provided by the host app.
415
433
  *
416
434
  * @param userInfo - The notification payload from the push notification
417
435
  * @param authorizationStatus - Current push authorization status
@@ -451,8 +469,9 @@ export {
451
469
  recordCustomEvent,
452
470
  invokeAttentiveDebugHelper,
453
471
  exportDebugLogs,
454
- // Push Notification Methods (iOS only)
472
+ // Push Notification Methods
455
473
  registerForPushNotifications,
474
+ getPushAuthorizationStatus,
456
475
  registerDeviceToken,
457
476
  registerDeviceTokenWithCallback,
458
477
  handleRegularOpen,