@attentive-mobile/attentive-react-native-sdk 2.0.0-beta.3 → 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 +145 -10
- package/android/build.gradle +4 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/kotlin/com/attentivereactnativesdk/AttentivePushHelper.kt +93 -0
- package/android/src/main/kotlin/com/attentivereactnativesdk/AttentiveReactNativeSdkModule.kt +382 -56
- package/android/src/main/kotlin/com/attentivereactnativesdk/debug/NetworkingHelper.kt +220 -0
- package/ios/AttentiveReactNativeSdk.mm +33 -0
- package/ios/AttentiveReactNativeSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/AttentiveReactNativeSdk.xcodeproj/project.xcworkspace/xcuserdata/zheref.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/AttentiveReactNativeSdk.xcodeproj/xcuserdata/zheref.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/ios/Bridging/ATTNNativeSDK.swift +47 -6
- package/lib/commonjs/NativeAttentiveReactNativeSdk.js.map +1 -1
- package/lib/commonjs/eventTypes.js.map +1 -1
- package/lib/commonjs/index.js +28 -9
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/NativeAttentiveReactNativeSdk.js.map +1 -1
- package/lib/module/eventTypes.js.map +1 -1
- package/lib/module/index.js +29 -11
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/NativeAttentiveReactNativeSdk.d.ts +9 -1
- package/lib/typescript/NativeAttentiveReactNativeSdk.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +24 -9
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +7 -3
- package/src/NativeAttentiveReactNativeSdk.ts +11 -2
- package/src/index.tsx +29 -10
- package/ios/AttentiveReactNativeSdk.xcworkspace/contents.xcworkspacedata +0 -10
package/lib/module/index.js
CHANGED
|
@@ -104,13 +104,13 @@ function exportDebugLogs() {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
// =============================================================================
|
|
107
|
-
// Push Notification Methods (iOS
|
|
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
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
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
|
package/lib/module/index.js.map
CHANGED
|
@@ -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,
|
|
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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AK,EAAED,KAAK,CAACE,QAAQ,CAAC;AAC3E;;AAEA;AACA;AACA;AACA;AACA,SAASC,sBAAsBA,CAACH,KAAkB,EAAE;EAClDzB,uBAAuB,CAAC4B,sBAAsB,CAACH,KAAK,CAACC,KAAK,EAAED,KAAK,CAACE,QAAQ,CAAC;AAC7E;;AAEA;AACA;AACA;AACA;AACA,SAASE,mBAAmBA,CAACJ,KAAe,EAAE;EAC5CzB,uBAAuB,CAAC6B,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;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
|
|
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,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8CAA8C,CAAC;AAGhF,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,UAAU,EAAE,CACV,eAAe,EAAE,MAAM,EACvB,IAAI,EAAE,MAAM,EACZ,sBAAsB,EAAE,OAAO,EAC/B,cAAc,EAAE,OAAO,KACpB,IAAI,CAAC;IACV,eAAe,EAAE,CAAC,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,CACR,KAAK,CAAC,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,YAAY,CAAC,EAAE,MAAM,EACrB,iBAAiB,CAAC,EAAE,MAAM,KACvB,IAAI,CAAC;IACV,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,oBAAoB,EAAE,CACpB,KAAK,EAAE,KAAK,CAAC;QACX,SAAS,EAAE,MAAM,CAAC;QAClB,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BAAmB,EAAE,MAAM,EAC3B,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,KAC/E,IAAI,CAAC;IAEV;;;;;OAKG;IACH,iBAAiB,EAAE,CAAC,mBAAmB,EAAE,MAAM,KAAK,IAAI,CAAC;IAEzD;;;;;;OAMG;IACH,gBAAgB,EAAE,CAChB,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,EACxB,mBAAmB,EAAE,MAAM,KACxB,IAAI,CAAC;IAEV;;;;OAIG;IACH,4BAA4B,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAEzD;;;;;;OAMG;IACH,oBAAoB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,KAAK,IAAI,CAAC;IAE9E;;;;;;OAMG;IACH,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,KAAK,IAAI,CAAC;CACzE;;AAUD,wBAA4D"}
|
|
@@ -59,7 +59,7 @@ declare function exportDebugLogs(): Promise<string>;
|
|
|
59
59
|
/**
|
|
60
60
|
* Request push notification permission from the user.
|
|
61
61
|
* On iOS, this will trigger the system permission dialog.
|
|
62
|
-
* On Android
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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;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EAAE,uBAAuB,GAAG,IAAI,CAU7E;AAED;;;;;;;;;;;;;;;;;;;;;;;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.
|
|
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":
|
|
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
|
|
68
|
+
// Push Notification Methods
|
|
69
69
|
/**
|
|
70
70
|
* Request push notification permission from the user.
|
|
71
|
-
* iOS
|
|
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
|
|
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
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
472
|
+
// Push Notification Methods
|
|
455
473
|
registerForPushNotifications,
|
|
474
|
+
getPushAuthorizationStatus,
|
|
456
475
|
registerDeviceToken,
|
|
457
476
|
registerDeviceTokenWithCallback,
|
|
458
477
|
handleRegularOpen,
|