zixflow-reactnative 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +451 -0
- package/android/build.gradle +155 -0
- package/android/cio-core.gradle +12 -0
- package/android/consumer-rules.pro +3 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +19 -0
- package/android/src/main/java/io/customer/reactnative/sdk/CustomerIOReactNativePackage.kt +85 -0
- package/android/src/main/java/io/customer/reactnative/sdk/NativeCustomerIOModule.kt +201 -0
- package/android/src/main/java/io/customer/reactnative/sdk/constant/Keys.kt +20 -0
- package/android/src/main/java/io/customer/reactnative/sdk/extension/MapExtensions.kt +92 -0
- package/android/src/main/java/io/customer/reactnative/sdk/extension/ReactExtensions.kt +11 -0
- package/android/src/main/java/io/customer/reactnative/sdk/extension/StringExtensions.kt +3 -0
- package/android/src/main/java/io/customer/reactnative/sdk/extension/ViewExtensions.kt +34 -0
- package/android/src/main/java/io/customer/reactnative/sdk/location/NativeLocationModule.kt +66 -0
- package/android/src/main/java/io/customer/reactnative/sdk/logging/NativeCustomerIOLoggingModule.kt +90 -0
- package/android/src/main/java/io/customer/reactnative/sdk/messaginginapp/InlineInAppMessageViewManager.kt +56 -0
- package/android/src/main/java/io/customer/reactnative/sdk/messaginginapp/NativeMessagingInAppModule.kt +215 -0
- package/android/src/main/java/io/customer/reactnative/sdk/messaginginapp/NotificationInboxExtensions.kt +23 -0
- package/android/src/main/java/io/customer/reactnative/sdk/messaginginapp/ReactInAppEventListener.kt +77 -0
- package/android/src/main/java/io/customer/reactnative/sdk/messaginginapp/ReactInAppPlatformDelegate.kt +37 -0
- package/android/src/main/java/io/customer/reactnative/sdk/messaginginapp/ReactInlineInAppMessageView.kt +44 -0
- package/android/src/main/java/io/customer/reactnative/sdk/messaginginapp/ReactNotificationInboxChangeListener.kt +47 -0
- package/android/src/main/java/io/customer/reactnative/sdk/messagingpush/NativeMessagingPushModule.kt +283 -0
- package/android/src/main/java/io/customer/reactnative/sdk/messagingpush/PermissionStatus.kt +9 -0
- package/android/src/main/java/io/customer/reactnative/sdk/messagingpush/PushMessagingExtensions.kt +58 -0
- package/android/src/main/java/io/customer/reactnative/sdk/util/Preconditions.kt +35 -0
- package/android/src/main/res/values/customer_io_config.xml +13 -0
- package/customerio-reactnative.podspec +60 -0
- package/ios/CustomerioReactnative.xcodeproj/project.pbxproj +285 -0
- package/ios/CustomerioReactnative.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -0
- package/ios/CustomerioReactnative.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/wrappers/CustomerioReactnative-Bridging-Header.h +2 -0
- package/ios/wrappers/NativeCustomerIO.mm +100 -0
- package/ios/wrappers/NativeCustomerIO.swift +162 -0
- package/ios/wrappers/inapp/InboxMessage+Conversion.swift +22 -0
- package/ios/wrappers/inapp/NativeMessagingInApp.mm +122 -0
- package/ios/wrappers/inapp/NativeMessagingInApp.swift +214 -0
- package/ios/wrappers/inapp/ReactInAppEventListener.swift +74 -0
- package/ios/wrappers/inapp/inline/InlineInAppMessageStateEvent.swift +23 -0
- package/ios/wrappers/inapp/inline/RCTInlineMessageNative.h +18 -0
- package/ios/wrappers/inapp/inline/RCTInlineMessageNative.mm +168 -0
- package/ios/wrappers/inapp/inline/ReactInlineMessageView.h +42 -0
- package/ios/wrappers/inapp/inline/ReactInlineMessageView.swift +124 -0
- package/ios/wrappers/location/NativeLocation.mm +52 -0
- package/ios/wrappers/location/NativeLocation.swift +37 -0
- package/ios/wrappers/logging/NativeCustomerIOLogging.mm +81 -0
- package/ios/wrappers/logging/NativeCustomerIOLogging.swift +62 -0
- package/ios/wrappers/push/NativeMessagingPush.mm +87 -0
- package/ios/wrappers/push/NativeMessagingPush.swift +119 -0
- package/ios/wrappers/utils/CioConfigUtils.swift +63 -0
- package/ios/wrappers/utils/CioConstants.swift +25 -0
- package/ios/wrappers/utils/Preconditions.swift +20 -0
- package/ios/wrappers/utils/RCTCustomerIOUtils.h +19 -0
- package/lib/commonjs/cio-params.js +2 -0
- package/lib/commonjs/cio-params.js.map +1 -0
- package/lib/commonjs/components/InlineInAppMessageView.js +146 -0
- package/lib/commonjs/components/InlineInAppMessageView.js.map +1 -0
- package/lib/commonjs/components/index.js +14 -0
- package/lib/commonjs/components/index.js.map +1 -0
- package/lib/commonjs/customerio-cdp.js +163 -0
- package/lib/commonjs/customerio-cdp.js.map +1 -0
- package/lib/commonjs/customerio-inapp.js +107 -0
- package/lib/commonjs/customerio-inapp.js.map +1 -0
- package/lib/commonjs/customerio-location.js +53 -0
- package/lib/commonjs/customerio-location.js.map +1 -0
- package/lib/commonjs/customerio-push.js +115 -0
- package/lib/commonjs/customerio-push.js.map +1 -0
- package/lib/commonjs/index.js +17 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/native-logger-listener.js +84 -0
- package/lib/commonjs/native-logger-listener.js.map +1 -0
- package/lib/commonjs/notification-inbox.js +132 -0
- package/lib/commonjs/notification-inbox.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/postInstall.js +13 -0
- package/lib/commonjs/postInstall.js.map +1 -0
- package/lib/commonjs/specs/components/InlineMessageNativeComponent.ts +59 -0
- package/lib/commonjs/specs/modules/NativeCustomerIO.js +40 -0
- package/lib/commonjs/specs/modules/NativeCustomerIO.js.map +1 -0
- package/lib/commonjs/specs/modules/NativeCustomerIOLocation.js +15 -0
- package/lib/commonjs/specs/modules/NativeCustomerIOLocation.js.map +1 -0
- package/lib/commonjs/specs/modules/NativeCustomerIOLogging.js +19 -0
- package/lib/commonjs/specs/modules/NativeCustomerIOLogging.js.map +1 -0
- package/lib/commonjs/specs/modules/NativeCustomerIOMessagingInApp.js +16 -0
- package/lib/commonjs/specs/modules/NativeCustomerIOMessagingInApp.js.map +1 -0
- package/lib/commonjs/specs/modules/NativeCustomerIOMessagingPush.js +15 -0
- package/lib/commonjs/specs/modules/NativeCustomerIOMessagingPush.js.map +1 -0
- package/lib/commonjs/types/data-pipelines.js +123 -0
- package/lib/commonjs/types/data-pipelines.js.map +1 -0
- package/lib/commonjs/types/in-app.js +43 -0
- package/lib/commonjs/types/in-app.js.map +1 -0
- package/lib/commonjs/types/index.js +39 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/commonjs/types/internal.js +2 -0
- package/lib/commonjs/types/internal.js.map +1 -0
- package/lib/commonjs/types/push.js +49 -0
- package/lib/commonjs/types/push.js.map +1 -0
- package/lib/commonjs/utils/native-bridge.js +31 -0
- package/lib/commonjs/utils/native-bridge.js.map +1 -0
- package/lib/commonjs/utils/param-validation.js +136 -0
- package/lib/commonjs/utils/param-validation.js.map +1 -0
- package/lib/commonjs/zixflow.js +71 -0
- package/lib/commonjs/zixflow.js.map +1 -0
- package/lib/module/cio-params.js +2 -0
- package/lib/module/cio-params.js.map +1 -0
- package/lib/module/components/InlineInAppMessageView.js +141 -0
- package/lib/module/components/InlineInAppMessageView.js.map +1 -0
- package/lib/module/components/index.js +6 -0
- package/lib/module/components/index.js.map +1 -0
- package/lib/module/customerio-cdp.js +157 -0
- package/lib/module/customerio-cdp.js.map +1 -0
- package/lib/module/customerio-inapp.js +92 -0
- package/lib/module/customerio-inapp.js.map +1 -0
- package/lib/module/customerio-location.js +48 -0
- package/lib/module/customerio-location.js.map +1 -0
- package/lib/module/customerio-push.js +111 -0
- package/lib/module/customerio-push.js.map +1 -0
- package/lib/module/index.js +12 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/native-logger-listener.js +79 -0
- package/lib/module/native-logger-listener.js.map +1 -0
- package/lib/module/notification-inbox.js +127 -0
- package/lib/module/notification-inbox.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/postInstall.js +13 -0
- package/lib/module/postInstall.js.map +1 -0
- package/lib/module/specs/components/InlineMessageNativeComponent.ts +59 -0
- package/lib/module/specs/modules/NativeCustomerIO.js +41 -0
- package/lib/module/specs/modules/NativeCustomerIO.js.map +1 -0
- package/lib/module/specs/modules/NativeCustomerIOLocation.js +13 -0
- package/lib/module/specs/modules/NativeCustomerIOLocation.js.map +1 -0
- package/lib/module/specs/modules/NativeCustomerIOLogging.js +18 -0
- package/lib/module/specs/modules/NativeCustomerIOLogging.js.map +1 -0
- package/lib/module/specs/modules/NativeCustomerIOMessagingInApp.js +15 -0
- package/lib/module/specs/modules/NativeCustomerIOMessagingInApp.js.map +1 -0
- package/lib/module/specs/modules/NativeCustomerIOMessagingPush.js +13 -0
- package/lib/module/specs/modules/NativeCustomerIOMessagingPush.js.map +1 -0
- package/lib/module/types/data-pipelines.js +126 -0
- package/lib/module/types/data-pipelines.js.map +1 -0
- package/lib/module/types/in-app.js +42 -0
- package/lib/module/types/in-app.js.map +1 -0
- package/lib/module/types/index.js +6 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/types/internal.js +2 -0
- package/lib/module/types/internal.js.map +1 -0
- package/lib/module/types/push.js +47 -0
- package/lib/module/types/push.js.map +1 -0
- package/lib/module/utils/native-bridge.js +25 -0
- package/lib/module/utils/native-bridge.js.map +1 -0
- package/lib/module/utils/param-validation.js +132 -0
- package/lib/module/utils/param-validation.js.map +1 -0
- package/lib/module/zixflow.js +23 -0
- package/lib/module/zixflow.js.map +1 -0
- package/lib/typescript/commonjs/cio-params.d.ts +5 -0
- package/lib/typescript/commonjs/cio-params.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/InlineInAppMessageView.d.ts +41 -0
- package/lib/typescript/commonjs/components/InlineInAppMessageView.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/customerio-cdp.d.ts +40 -0
- package/lib/typescript/commonjs/customerio-cdp.d.ts.map +1 -0
- package/lib/typescript/commonjs/customerio-inapp.d.ts +48 -0
- package/lib/typescript/commonjs/customerio-inapp.d.ts.map +1 -0
- package/lib/typescript/commonjs/customerio-location.d.ts +31 -0
- package/lib/typescript/commonjs/customerio-location.d.ts.map +1 -0
- package/lib/typescript/commonjs/customerio-push.d.ts +56 -0
- package/lib/typescript/commonjs/customerio-push.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +8 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/native-logger-listener.d.ts +8 -0
- package/lib/typescript/commonjs/native-logger-listener.d.ts.map +1 -0
- package/lib/typescript/commonjs/notification-inbox.d.ts +57 -0
- package/lib/typescript/commonjs/notification-inbox.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/postInstall.d.ts +2 -0
- package/lib/typescript/commonjs/postInstall.d.ts.map +1 -0
- package/lib/typescript/commonjs/specs/components/InlineMessageNativeComponent.d.ts +40 -0
- package/lib/typescript/commonjs/specs/components/InlineMessageNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/specs/modules/NativeCustomerIO.d.ts +46 -0
- package/lib/typescript/commonjs/specs/modules/NativeCustomerIO.d.ts.map +1 -0
- package/lib/typescript/commonjs/specs/modules/NativeCustomerIOLocation.d.ts +14 -0
- package/lib/typescript/commonjs/specs/modules/NativeCustomerIOLocation.d.ts.map +1 -0
- package/lib/typescript/commonjs/specs/modules/NativeCustomerIOLogging.d.ts +18 -0
- package/lib/typescript/commonjs/specs/modules/NativeCustomerIOLogging.d.ts.map +1 -0
- package/lib/typescript/commonjs/specs/modules/NativeCustomerIOMessagingInApp.d.ts +23 -0
- package/lib/typescript/commonjs/specs/modules/NativeCustomerIOMessagingInApp.d.ts.map +1 -0
- package/lib/typescript/commonjs/specs/modules/NativeCustomerIOMessagingPush.d.ts +20 -0
- package/lib/typescript/commonjs/specs/modules/NativeCustomerIOMessagingPush.d.ts.map +1 -0
- package/lib/typescript/commonjs/types/data-pipelines.d.ts +143 -0
- package/lib/typescript/commonjs/types/data-pipelines.d.ts.map +1 -0
- package/lib/typescript/commonjs/types/in-app.d.ts +67 -0
- package/lib/typescript/commonjs/types/in-app.d.ts.map +1 -0
- package/lib/typescript/commonjs/types/index.d.ts +4 -0
- package/lib/typescript/commonjs/types/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/types/internal.d.ts +20 -0
- package/lib/typescript/commonjs/types/internal.d.ts.map +1 -0
- package/lib/typescript/commonjs/types/push.d.ts +49 -0
- package/lib/typescript/commonjs/types/push.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/native-bridge.d.ts +9 -0
- package/lib/typescript/commonjs/utils/native-bridge.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/param-validation.d.ts +44 -0
- package/lib/typescript/commonjs/utils/param-validation.d.ts.map +1 -0
- package/lib/typescript/commonjs/zixflow.d.ts +14 -0
- package/lib/typescript/commonjs/zixflow.d.ts.map +1 -0
- package/lib/typescript/module/cio-params.d.ts +5 -0
- package/lib/typescript/module/cio-params.d.ts.map +1 -0
- package/lib/typescript/module/components/InlineInAppMessageView.d.ts +41 -0
- package/lib/typescript/module/components/InlineInAppMessageView.d.ts.map +1 -0
- package/lib/typescript/module/components/index.d.ts +3 -0
- package/lib/typescript/module/components/index.d.ts.map +1 -0
- package/lib/typescript/module/customerio-cdp.d.ts +40 -0
- package/lib/typescript/module/customerio-cdp.d.ts.map +1 -0
- package/lib/typescript/module/customerio-inapp.d.ts +48 -0
- package/lib/typescript/module/customerio-inapp.d.ts.map +1 -0
- package/lib/typescript/module/customerio-location.d.ts +31 -0
- package/lib/typescript/module/customerio-location.d.ts.map +1 -0
- package/lib/typescript/module/customerio-push.d.ts +56 -0
- package/lib/typescript/module/customerio-push.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +8 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/native-logger-listener.d.ts +8 -0
- package/lib/typescript/module/native-logger-listener.d.ts.map +1 -0
- package/lib/typescript/module/notification-inbox.d.ts +57 -0
- package/lib/typescript/module/notification-inbox.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/postInstall.d.ts +2 -0
- package/lib/typescript/module/postInstall.d.ts.map +1 -0
- package/lib/typescript/module/specs/components/InlineMessageNativeComponent.d.ts +40 -0
- package/lib/typescript/module/specs/components/InlineMessageNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/specs/modules/NativeCustomerIO.d.ts +46 -0
- package/lib/typescript/module/specs/modules/NativeCustomerIO.d.ts.map +1 -0
- package/lib/typescript/module/specs/modules/NativeCustomerIOLocation.d.ts +14 -0
- package/lib/typescript/module/specs/modules/NativeCustomerIOLocation.d.ts.map +1 -0
- package/lib/typescript/module/specs/modules/NativeCustomerIOLogging.d.ts +18 -0
- package/lib/typescript/module/specs/modules/NativeCustomerIOLogging.d.ts.map +1 -0
- package/lib/typescript/module/specs/modules/NativeCustomerIOMessagingInApp.d.ts +23 -0
- package/lib/typescript/module/specs/modules/NativeCustomerIOMessagingInApp.d.ts.map +1 -0
- package/lib/typescript/module/specs/modules/NativeCustomerIOMessagingPush.d.ts +20 -0
- package/lib/typescript/module/specs/modules/NativeCustomerIOMessagingPush.d.ts.map +1 -0
- package/lib/typescript/module/types/data-pipelines.d.ts +143 -0
- package/lib/typescript/module/types/data-pipelines.d.ts.map +1 -0
- package/lib/typescript/module/types/in-app.d.ts +67 -0
- package/lib/typescript/module/types/in-app.d.ts.map +1 -0
- package/lib/typescript/module/types/index.d.ts +4 -0
- package/lib/typescript/module/types/index.d.ts.map +1 -0
- package/lib/typescript/module/types/internal.d.ts +20 -0
- package/lib/typescript/module/types/internal.d.ts.map +1 -0
- package/lib/typescript/module/types/push.d.ts +49 -0
- package/lib/typescript/module/types/push.d.ts.map +1 -0
- package/lib/typescript/module/utils/native-bridge.d.ts +9 -0
- package/lib/typescript/module/utils/native-bridge.d.ts.map +1 -0
- package/lib/typescript/module/utils/param-validation.d.ts +44 -0
- package/lib/typescript/module/utils/param-validation.d.ts.map +1 -0
- package/lib/typescript/module/zixflow.d.ts +14 -0
- package/lib/typescript/module/zixflow.d.ts.map +1 -0
- package/package.json +165 -0
- package/src/cio-params.ts +4 -0
- package/src/components/InlineInAppMessageView.tsx +187 -0
- package/src/components/index.ts +3 -0
- package/src/customerio-cdp.ts +190 -0
- package/src/customerio-inapp.ts +127 -0
- package/src/customerio-location.ts +56 -0
- package/src/customerio-push.ts +127 -0
- package/src/index.ts +9 -0
- package/src/native-logger-listener.ts +84 -0
- package/src/notification-inbox.ts +154 -0
- package/src/postInstall.js +10 -0
- package/src/specs/components/InlineMessageNativeComponent.ts +59 -0
- package/src/specs/modules/NativeCustomerIO.ts +55 -0
- package/src/specs/modules/NativeCustomerIOLocation.ts +15 -0
- package/src/specs/modules/NativeCustomerIOLogging.ts +24 -0
- package/src/specs/modules/NativeCustomerIOMessagingInApp.ts +30 -0
- package/src/specs/modules/NativeCustomerIOMessagingPush.ts +27 -0
- package/src/types/data-pipelines.ts +150 -0
- package/src/types/in-app.ts +69 -0
- package/src/types/index.ts +3 -0
- package/src/types/internal.ts +20 -0
- package/src/types/push.ts +50 -0
- package/src/utils/native-bridge.ts +30 -0
- package/src/utils/param-validation.ts +178 -0
- package/src/zixflow.ts +24 -0
- package/zixflow-reactnative-richpush.podspec +42 -0
- package/zixflow-reactnative.podspec +66 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { type EventSubscription } from 'react-native';
|
|
2
|
+
import { NativeLoggerListener } from './native-logger-listener';
|
|
3
|
+
import type { Spec as CodegenSpec } from './specs/modules/NativeCustomerIOMessagingInApp';
|
|
4
|
+
import NativeCustomerIOMessagingInApp from './specs/modules/NativeCustomerIOMessagingInApp';
|
|
5
|
+
import type { InboxMessage, NotificationInboxChangeListener } from './types';
|
|
6
|
+
import { callNativeModule, ensureNativeModule } from './utils/native-bridge';
|
|
7
|
+
|
|
8
|
+
// Reference to the native CustomerIO In-App Messaging module
|
|
9
|
+
const nativeModule = ensureNativeModule(NativeCustomerIOMessagingInApp);
|
|
10
|
+
|
|
11
|
+
// Wrapper function that ensures SDK is initialized before calling native methods
|
|
12
|
+
const withNativeModule = <R>(fn: (native: CodegenSpec) => R): R => {
|
|
13
|
+
return callNativeModule(nativeModule, fn);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Public API methods for NotificationInbox.
|
|
18
|
+
* Define the TypeScript API here with proper types (InboxMessage instead of UnsafeObject).
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
interface NotificationInboxPublicSpec {
|
|
23
|
+
getMessages(topic?: string): Promise<InboxMessage[]>;
|
|
24
|
+
subscribeToMessages(
|
|
25
|
+
listener: NotificationInboxChangeListener,
|
|
26
|
+
topic?: string
|
|
27
|
+
): EventSubscription;
|
|
28
|
+
markMessageOpened(message: InboxMessage): void;
|
|
29
|
+
markMessageUnopened(message: InboxMessage): void;
|
|
30
|
+
markMessageDeleted(message: InboxMessage): void;
|
|
31
|
+
trackMessageClicked(message: InboxMessage, actionName?: string): void;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Native inbox methods from CodegenSpec that should be excluded from CustomerIOInAppMessaging.
|
|
36
|
+
* Includes both public methods (in NotificationInboxPublicSpec) and internal methods.
|
|
37
|
+
*
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
export type NotificationInboxSpec =
|
|
41
|
+
| keyof NotificationInboxPublicSpec
|
|
42
|
+
| 'subscribeToMessagesChanged'
|
|
43
|
+
| 'setupInboxListener';
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Helper function to parse raw inbox message from native layer
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
function parseInboxMessage(raw: any): InboxMessage {
|
|
50
|
+
return {
|
|
51
|
+
queueId: raw.queueId,
|
|
52
|
+
deliveryId: raw.deliveryId ?? undefined,
|
|
53
|
+
expiry: raw.expiry ?? undefined,
|
|
54
|
+
sentAt: raw.sentAt,
|
|
55
|
+
topics: raw.topics || [],
|
|
56
|
+
type: raw.type,
|
|
57
|
+
opened: raw.opened,
|
|
58
|
+
priority: raw.priority ?? undefined,
|
|
59
|
+
properties: raw.properties || {},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Manages inbox messages for the current user.
|
|
65
|
+
*
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
68
|
+
export class NotificationInbox implements NotificationInboxPublicSpec {
|
|
69
|
+
/**
|
|
70
|
+
* Gets inbox messages.
|
|
71
|
+
*/
|
|
72
|
+
async getMessages(topic?: string): Promise<InboxMessage[]> {
|
|
73
|
+
return withNativeModule(async (native) => {
|
|
74
|
+
const rawMessages = await native.getMessages(topic);
|
|
75
|
+
return rawMessages.map(parseInboxMessage);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Subscribes to inbox message changes.
|
|
81
|
+
* Optionally filter messages by topic.
|
|
82
|
+
*/
|
|
83
|
+
subscribeToMessages(
|
|
84
|
+
listener: NotificationInboxChangeListener,
|
|
85
|
+
topic?: string
|
|
86
|
+
): EventSubscription {
|
|
87
|
+
const emitter = (data: any) => {
|
|
88
|
+
let messages = (data.messages || []).map(parseInboxMessage);
|
|
89
|
+
|
|
90
|
+
// Filter by topic if specified (case-insensitive)
|
|
91
|
+
if (topic) {
|
|
92
|
+
const topicLower = topic.toLowerCase();
|
|
93
|
+
messages = messages.filter((msg: InboxMessage) =>
|
|
94
|
+
msg.topics.some((t) => t.toLowerCase() === topicLower)
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
listener.onMessagesChanged(messages);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
return withNativeModule((native) => {
|
|
102
|
+
try {
|
|
103
|
+
// Set up the native inbox listener before subscribing to events
|
|
104
|
+
// This will automatically trigger onMessagesChanged with current messages
|
|
105
|
+
native.setupInboxListener();
|
|
106
|
+
|
|
107
|
+
// Register TurboModule event listener and return subscription
|
|
108
|
+
return native.subscribeToMessagesChanged(emitter);
|
|
109
|
+
} catch (error) {
|
|
110
|
+
NativeLoggerListener.warn(
|
|
111
|
+
'Failed to attach inbox change listener:',
|
|
112
|
+
error
|
|
113
|
+
);
|
|
114
|
+
// Return a no-op subscription to maintain backwards compatibility
|
|
115
|
+
return {
|
|
116
|
+
remove: () => {},
|
|
117
|
+
eventType: '',
|
|
118
|
+
key: 0,
|
|
119
|
+
subscriber: null as any,
|
|
120
|
+
} as EventSubscription;
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Marks an inbox message as opened/read.
|
|
127
|
+
*/
|
|
128
|
+
markMessageOpened(message: InboxMessage) {
|
|
129
|
+
withNativeModule((native) => native.markMessageOpened(message));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Marks an inbox message as unopened/unread.
|
|
134
|
+
*/
|
|
135
|
+
markMessageUnopened(message: InboxMessage) {
|
|
136
|
+
withNativeModule((native) => native.markMessageUnopened(message));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Marks an inbox message as deleted.
|
|
141
|
+
*/
|
|
142
|
+
markMessageDeleted(message: InboxMessage) {
|
|
143
|
+
withNativeModule((native) => native.markMessageDeleted(message));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Tracks a click event for an inbox message.
|
|
148
|
+
*/
|
|
149
|
+
trackMessageClicked(message: InboxMessage, actionName?: string) {
|
|
150
|
+
withNativeModule((native) =>
|
|
151
|
+
native.trackMessageClicked(message, actionName)
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
This code block attempts to set expoVersion in package.json.
|
|
3
|
+
If it fails, the assumption is that Expo plugin is not installed,
|
|
4
|
+
therefore we are running on bare React Native project.
|
|
5
|
+
If it succeeds, we use Expo as the user agent instead of React Native.
|
|
6
|
+
*/
|
|
7
|
+
try {
|
|
8
|
+
const ph = require('customerio-expo-plugin/postinstall');
|
|
9
|
+
ph.runPostInstall();
|
|
10
|
+
} catch {}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// React Native docs now recommend Codegen types should be imported from the react-native package
|
|
2
|
+
// But it breaks on Expo and older React Native versions, so we import from react-native/Libraries/Types/CodegenTypes
|
|
3
|
+
// for compatibility with all versions until we can fully migrate to the new import style without breaking older versions
|
|
4
|
+
// https://reactnative.dev/docs/strict-typescript-api#codegen-types-should-now-be-imported-from-the-react-native-package
|
|
5
|
+
|
|
6
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
7
|
+
/* eslint-disable @react-native/no-deep-imports */
|
|
8
|
+
import type {
|
|
9
|
+
DirectEventHandler,
|
|
10
|
+
Double,
|
|
11
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
12
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
13
|
+
|
|
14
|
+
/** Event data for inline message size changes. */
|
|
15
|
+
export interface SizeChangeEvent {
|
|
16
|
+
width: Double;
|
|
17
|
+
height: Double;
|
|
18
|
+
duration?: Double;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** States representing the loading and display status of inline messages. */
|
|
22
|
+
export enum InlineMessageState {
|
|
23
|
+
LoadingStarted = 'LoadingStarted',
|
|
24
|
+
LoadingFinished = 'LoadingFinished',
|
|
25
|
+
NoMessageToDisplay = 'NoMessageToDisplay',
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Event data for inline message state changes. */
|
|
29
|
+
export interface StateChangeEvent {
|
|
30
|
+
state: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Event data for inline message action clicks. */
|
|
34
|
+
export interface ActionClickEvent {
|
|
35
|
+
/** Message data structure - defined inline for codegen compatibility (cannot import types) */
|
|
36
|
+
message: {
|
|
37
|
+
messageId: string;
|
|
38
|
+
deliveryId?: string;
|
|
39
|
+
elementId?: string;
|
|
40
|
+
};
|
|
41
|
+
actionValue: string;
|
|
42
|
+
actionName: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Props for the native inline message component. */
|
|
46
|
+
export interface NativeProps extends ViewProps {
|
|
47
|
+
/** Required element ID for retrieving inline message content. */
|
|
48
|
+
elementId: string;
|
|
49
|
+
onSizeChange: DirectEventHandler<SizeChangeEvent>;
|
|
50
|
+
onStateChange?: DirectEventHandler<StateChangeEvent>;
|
|
51
|
+
onActionClick?: DirectEventHandler<ActionClickEvent>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// React Native Codegen automatically generates the native component bridge based on the NativeProps interface
|
|
55
|
+
// This creates the low-level native component that handles communication between JS and native code
|
|
56
|
+
// Used by native iOS/Android components - the public view is InlineInAppMessageView in components directory
|
|
57
|
+
export default codegenNativeComponent<NativeProps>(
|
|
58
|
+
'InlineMessageNative'
|
|
59
|
+
) as HostComponent<NativeProps>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { TurboModuleRegistry, type TurboModule } from 'react-native';
|
|
2
|
+
import type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Native module specification for CustomerIO React Native SDK
|
|
6
|
+
*
|
|
7
|
+
* This module defines the TurboModule interface for CustomerIO SDK native bridge.
|
|
8
|
+
* Types use basic primitives for React Native Codegen compatibility, while the public
|
|
9
|
+
* API layer provides more specific TypeScript types for better developer experience.
|
|
10
|
+
*
|
|
11
|
+
* The separation allows:
|
|
12
|
+
* - Native bridge compatibility with Codegen constraints
|
|
13
|
+
* - Type-safe public API with proper TypeScript definitions
|
|
14
|
+
* - Alignment between codegen spec and public contract
|
|
15
|
+
*
|
|
16
|
+
* @see https://github.com/facebook/react-native/issues/38769 for Codegen limitations
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Generic object type for native bridge parameter passing.
|
|
21
|
+
*
|
|
22
|
+
* Used for all complex data structures passed to native methods to ensure
|
|
23
|
+
* React Native Codegen compatibility. The public API layer converts these
|
|
24
|
+
* to proper TypeScript types (CustomAttributes, CioConfig, etc.) for
|
|
25
|
+
* better type safety and developer experience.
|
|
26
|
+
*
|
|
27
|
+
* @internal - Not exported to avoid conflicts with public API types
|
|
28
|
+
*/
|
|
29
|
+
type NativeBridgeObject = UnsafeObject;
|
|
30
|
+
|
|
31
|
+
// =============================================================================
|
|
32
|
+
// TURBO MODULE SPEC – Defines native bridge interface
|
|
33
|
+
// =============================================================================
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* TurboModule specification for CustomerIO SDK native bridge methods.
|
|
37
|
+
* Uses generic Object types for React Native Codegen compatibility.
|
|
38
|
+
*/
|
|
39
|
+
export interface Spec extends TurboModule {
|
|
40
|
+
initialize(
|
|
41
|
+
config: NativeBridgeObject,
|
|
42
|
+
args: NativeBridgeObject
|
|
43
|
+
): Promise<void>;
|
|
44
|
+
identify(params?: NativeBridgeObject): void;
|
|
45
|
+
clearIdentify(): void;
|
|
46
|
+
track(name: string, properties?: NativeBridgeObject): void;
|
|
47
|
+
screen(title: string, properties?: NativeBridgeObject): void;
|
|
48
|
+
setProfileAttributes(attributes: NativeBridgeObject): void;
|
|
49
|
+
setDeviceAttributes(attributes: NativeBridgeObject): void;
|
|
50
|
+
registerDeviceToken(token: string): void;
|
|
51
|
+
trackMetric(deliveryID: string, deviceToken: string, event: string): void;
|
|
52
|
+
deleteDeviceToken(): void;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('NativeCustomerIO');
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TurboModuleRegistry, type TurboModule } from 'react-native';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Native module specification for CustomerIO Location React Native SDK
|
|
5
|
+
*
|
|
6
|
+
* @see NativeCustomerIO.ts for detailed documentation on TurboModule patterns,
|
|
7
|
+
* Codegen compatibility, and type safety approach.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export interface Spec extends TurboModule {
|
|
11
|
+
setLastKnownLocation(latitude: number, longitude: number): void;
|
|
12
|
+
requestLocationUpdate(): void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default TurboModuleRegistry.get<Spec>('NativeCustomerIOLocation');
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { TurboModuleRegistry, type TurboModule } from 'react-native';
|
|
2
|
+
import type {
|
|
3
|
+
EventEmitter,
|
|
4
|
+
UnsafeObject,
|
|
5
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Native module specification for CustomerIO Logging React Native SDK
|
|
9
|
+
*
|
|
10
|
+
* This module defines the TurboModule interface for CustomerIO logging bridge.
|
|
11
|
+
* Used internally for printing logs to React Native environment instead of native.
|
|
12
|
+
*
|
|
13
|
+
* @see NativeCustomerIO.ts for detailed documentation on TurboModule patterns,
|
|
14
|
+
* Codegen compatibility, and type safety approach.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** TurboModule interface for CustomerIO logging native operations */
|
|
18
|
+
export interface Spec extends TurboModule {
|
|
19
|
+
readonly onCioLogEvent: EventEmitter<UnsafeObject>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default TurboModuleRegistry.getEnforcing<Spec>(
|
|
23
|
+
'NativeCustomerIOLogging'
|
|
24
|
+
);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { TurboModuleRegistry, type TurboModule } from 'react-native';
|
|
2
|
+
import type {
|
|
3
|
+
EventEmitter,
|
|
4
|
+
UnsafeObject,
|
|
5
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Native module specification for CustomerIO In-App Messaging React Native SDK
|
|
9
|
+
*
|
|
10
|
+
* @see NativeCustomerIO.ts for detailed documentation on TurboModule patterns,
|
|
11
|
+
* Codegen compatibility, and type safety approach.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** TurboModule interface for CustomerIO In-App Messaging native operations */
|
|
15
|
+
export interface Spec extends TurboModule {
|
|
16
|
+
dismissMessage(): void;
|
|
17
|
+
readonly onInAppEventReceived: EventEmitter<UnsafeObject>;
|
|
18
|
+
// Notification Inbox related methods
|
|
19
|
+
setupInboxListener(): void;
|
|
20
|
+
readonly subscribeToMessagesChanged: EventEmitter<UnsafeObject>;
|
|
21
|
+
getMessages(topic?: string): Promise<UnsafeObject[]>;
|
|
22
|
+
markMessageOpened(message: UnsafeObject): void;
|
|
23
|
+
markMessageUnopened(message: UnsafeObject): void;
|
|
24
|
+
markMessageDeleted(message: UnsafeObject): void;
|
|
25
|
+
trackMessageClicked(message: UnsafeObject, actionName?: string): void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default TurboModuleRegistry.getEnforcing<Spec>(
|
|
29
|
+
'NativeCustomerIOMessagingInApp'
|
|
30
|
+
);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { TurboModuleRegistry, type TurboModule } from 'react-native';
|
|
2
|
+
import type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Native module specification for CustomerIO Push Messaging React Native SDK
|
|
6
|
+
*
|
|
7
|
+
* @see NativeCustomerIO.ts for detailed documentation on TurboModule patterns,
|
|
8
|
+
* Codegen compatibility, and type safety approach.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
type NativeBridgeObject = UnsafeObject;
|
|
12
|
+
|
|
13
|
+
export interface Spec extends TurboModule {
|
|
14
|
+
onMessageReceived(
|
|
15
|
+
message: NativeBridgeObject,
|
|
16
|
+
handleNotificationTrigger: boolean
|
|
17
|
+
): Promise<boolean>;
|
|
18
|
+
trackNotificationResponseReceived(payload: NativeBridgeObject): void;
|
|
19
|
+
trackNotificationReceived(payload: NativeBridgeObject): void;
|
|
20
|
+
getRegisteredDeviceToken(): Promise<string>;
|
|
21
|
+
showPromptForPushNotifications(options: NativeBridgeObject): Promise<string>;
|
|
22
|
+
getPushPermissionStatus(): Promise<string>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default TurboModuleRegistry.getEnforcing<Spec>(
|
|
26
|
+
'NativeCustomerIOMessagingPush'
|
|
27
|
+
);
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type { PushClickBehaviorAndroid } from './push';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Key-value pairs for custom user attributes and event properties.
|
|
5
|
+
*
|
|
6
|
+
* Provides a type-safe interface for passing custom data to CustomerIO.
|
|
7
|
+
* While the native bridge uses generic Object types for Codegen compatibility,
|
|
8
|
+
* this type gives developers better TypeScript intellisense and validation.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const attributes: CustomAttributes = {
|
|
13
|
+
* age: 25,
|
|
14
|
+
* email: 'user@example.com',
|
|
15
|
+
* preferences: { theme: 'dark' }
|
|
16
|
+
* };
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export type CustomAttributes = Record<string, any>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Parameters for identifying a user in CustomerIO.
|
|
25
|
+
*
|
|
26
|
+
* @param userId - Unique identifier for the user (email, username, etc.)
|
|
27
|
+
* @param traits - Additional user attributes and properties
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export interface IdentifyParams {
|
|
32
|
+
userId?: string;
|
|
33
|
+
traits?: CustomAttributes;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Configuration options for initializing the CustomerIO SDK.
|
|
38
|
+
*
|
|
39
|
+
* @param cdpApiKey - Customer Data Platform API key from CustomerIO dashboard
|
|
40
|
+
* @param migrationSiteId - Legacy site ID for migrating from tracking API
|
|
41
|
+
* @param region - Data center region (US or EU)
|
|
42
|
+
* @param logLevel - SDK logging verbosity level
|
|
43
|
+
* @param apiHost - Override the CDP API host. Use to route SDK traffic through a first-party proxy.
|
|
44
|
+
* @param cdnHost - Override the CDN host. Use to route SDK traffic through a first-party proxy.
|
|
45
|
+
* @param flushAt - Number of events to batch before sending
|
|
46
|
+
* @param flushInterval - Time interval (seconds) to flush events
|
|
47
|
+
* @param screenViewUse - How to handle screen view tracking
|
|
48
|
+
* @param trackApplicationLifecycleEvents - Auto-track app lifecycle events
|
|
49
|
+
* @param autoTrackDeviceAttributes - Auto-track device information
|
|
50
|
+
* @param inApp - In-app messaging configuration
|
|
51
|
+
* @param push - Push notification configuration
|
|
52
|
+
*
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
export type CioConfig = {
|
|
56
|
+
cdpApiKey: string;
|
|
57
|
+
migrationSiteId?: string;
|
|
58
|
+
region?: CioRegion;
|
|
59
|
+
logLevel?: CioLogLevel;
|
|
60
|
+
apiHost?: string;
|
|
61
|
+
cdnHost?: string;
|
|
62
|
+
flushAt?: number;
|
|
63
|
+
flushInterval?: number;
|
|
64
|
+
screenViewUse?: ScreenView;
|
|
65
|
+
trackApplicationLifecycleEvents?: boolean;
|
|
66
|
+
autoTrackDeviceAttributes?: boolean;
|
|
67
|
+
inApp?: {
|
|
68
|
+
siteId: string;
|
|
69
|
+
};
|
|
70
|
+
push?: {
|
|
71
|
+
android?: {
|
|
72
|
+
pushClickBehavior?: PushClickBehaviorAndroid;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
location?: {
|
|
76
|
+
/** Location tracking mode. Defaults to 'manual' if location config is provided. */
|
|
77
|
+
trackingMode?: CioLocationTrackingMode;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Log levels for CustomerIO SDK debugging and monitoring.
|
|
83
|
+
*
|
|
84
|
+
* Controls the verbosity of SDK logging output for debugging purposes.
|
|
85
|
+
*
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
export enum CioLogLevel {
|
|
89
|
+
/** No logging output */
|
|
90
|
+
None = 'none',
|
|
91
|
+
/** Only error messages */
|
|
92
|
+
Error = 'error',
|
|
93
|
+
/** Error and informational messages */
|
|
94
|
+
Info = 'info',
|
|
95
|
+
/** All messages including debug information */
|
|
96
|
+
Debug = 'debug',
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Data center regions for CustomerIO API endpoints.
|
|
101
|
+
*
|
|
102
|
+
* @public
|
|
103
|
+
*/
|
|
104
|
+
export enum CioRegion {
|
|
105
|
+
US = 'US',
|
|
106
|
+
EU = 'EU',
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Screen view tracking behavior configuration.
|
|
111
|
+
*
|
|
112
|
+
* Defines how the SDK should handle automatic screen view events
|
|
113
|
+
* for analytics and in-app message targeting.
|
|
114
|
+
*
|
|
115
|
+
* @public
|
|
116
|
+
*/
|
|
117
|
+
export enum ScreenView {
|
|
118
|
+
/** Send screen events to destinations and display in-app messages */
|
|
119
|
+
All = 'all',
|
|
120
|
+
/** Only display in-app messages, don't send to destinations */
|
|
121
|
+
InApp = 'inApp',
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Location tracking mode for the CustomerIO Location module.
|
|
126
|
+
*
|
|
127
|
+
* @public
|
|
128
|
+
*/
|
|
129
|
+
export enum CioLocationTrackingMode {
|
|
130
|
+
/** Location tracking is disabled. All location operations no-op. */
|
|
131
|
+
Off = 'OFF',
|
|
132
|
+
/** Host app controls when location is captured (default when location config is provided). */
|
|
133
|
+
Manual = 'MANUAL',
|
|
134
|
+
/** SDK auto-captures location once per app launch when the app becomes active. */
|
|
135
|
+
OnAppStart = 'ON_APP_START',
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Enum to specify the type of metric for tracking
|
|
140
|
+
*
|
|
141
|
+
* @public
|
|
142
|
+
*/
|
|
143
|
+
export enum MetricEvent {
|
|
144
|
+
/** Push notification was delivered to the device */
|
|
145
|
+
Delivered = 'delivered',
|
|
146
|
+
/** Push notification was opened by the user */
|
|
147
|
+
Opened = 'opened',
|
|
148
|
+
/** Push notification resulted in a conversion */
|
|
149
|
+
Converted = 'converted',
|
|
150
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-app message data structure for event callbacks.
|
|
3
|
+
*
|
|
4
|
+
* Contains metadata about displayed in-app messages that can be used
|
|
5
|
+
* for tracking user interactions and message performance analytics.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export interface InAppMessage {
|
|
10
|
+
/** Unique identifier for the message template */
|
|
11
|
+
messageId: string;
|
|
12
|
+
/** Unique identifier for this specific message delivery */
|
|
13
|
+
deliveryId?: string;
|
|
14
|
+
/** Element ID for inline message UI component that was interacted with */
|
|
15
|
+
elementId?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Enum to represent the type of event triggered by in-app event callback.
|
|
20
|
+
*
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export enum InAppMessageEventType {
|
|
24
|
+
errorWithMessage = 'errorWithMessage',
|
|
25
|
+
messageActionTaken = 'messageActionTaken',
|
|
26
|
+
messageDismissed = 'messageDismissed',
|
|
27
|
+
messageShown = 'messageShown',
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Represents an inbox message for a user.
|
|
32
|
+
*
|
|
33
|
+
* Inbox messages are persistent messages that can be displayed in a message center or inbox UI.
|
|
34
|
+
* They support read/unread states, expiration, and custom properties.
|
|
35
|
+
*
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
export interface InboxMessage {
|
|
39
|
+
/** Internal queue identifier (for SDK use) */
|
|
40
|
+
queueId: string;
|
|
41
|
+
/** Unique identifier for this message delivery */
|
|
42
|
+
deliveryId?: string;
|
|
43
|
+
/** Expiration date for the message. Messages may be hidden after this date. */
|
|
44
|
+
expiry?: number;
|
|
45
|
+
/** Date when the message was sent (Unix timestamp in milliseconds) */
|
|
46
|
+
sentAt: number;
|
|
47
|
+
/** List of topic identifiers associated with this message */
|
|
48
|
+
topics: string[];
|
|
49
|
+
/** Message type identifier */
|
|
50
|
+
type: string;
|
|
51
|
+
/** Whether the user has opened/read this message */
|
|
52
|
+
opened: boolean;
|
|
53
|
+
/** Priority for message ordering. Lower values = higher priority (e.g., 1 is higher priority than 100) */
|
|
54
|
+
priority?: number;
|
|
55
|
+
/** Custom key-value properties associated with this message */
|
|
56
|
+
properties: Record<string, any>;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Listener for notification inbox message changes.
|
|
61
|
+
*
|
|
62
|
+
* Receives real-time notifications when inbox messages are added, updated, or removed.
|
|
63
|
+
* Callbacks are invoked on the main thread for safe UI updates.
|
|
64
|
+
*
|
|
65
|
+
* @public
|
|
66
|
+
*/
|
|
67
|
+
export type NotificationInboxChangeListener = {
|
|
68
|
+
onMessagesChanged: (messages: InboxMessage[]) => void;
|
|
69
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal-only types used within the Customer.io React Native SDK implementation.
|
|
3
|
+
*
|
|
4
|
+
* Not intended for public use.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Arguments passed to native SDK for package identification.
|
|
9
|
+
*
|
|
10
|
+
* Provides metadata about the host environment and SDK version to native
|
|
11
|
+
* CustomerIO SDK for debugging and analytics.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export type NativeSDKArgs = {
|
|
16
|
+
/** The package manager or framework hosting the SDK (ReactNative, Expo) */
|
|
17
|
+
packageSource: string;
|
|
18
|
+
/** Version of the SDK package being used */
|
|
19
|
+
packageVersion: string;
|
|
20
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Android-specific behavior when a push notification is clicked.
|
|
3
|
+
*
|
|
4
|
+
* Controls how the Android system handles activity lifecycle
|
|
5
|
+
* when users tap on push notifications.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export enum PushClickBehaviorAndroid {
|
|
10
|
+
/** Clear the activity task stack and start fresh */
|
|
11
|
+
ResetTaskStack = 'RESET_TASK_STACK',
|
|
12
|
+
/** Prevent the current activity from restarting */
|
|
13
|
+
ActivityPreventRestart = 'ACTIVITY_PREVENT_RESTART',
|
|
14
|
+
/** Use default behavior without special flags */
|
|
15
|
+
ActivityNoFlags = 'ACTIVITY_NO_FLAGS',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Push notification permission request options.
|
|
20
|
+
*
|
|
21
|
+
* Configure which types of notifications to request permission for
|
|
22
|
+
* on different platforms.
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export type CioPushPermissionOptions = {
|
|
27
|
+
ios?: {
|
|
28
|
+
/** Request permission to show badge numbers on app icon */
|
|
29
|
+
badge: boolean;
|
|
30
|
+
/** Request permission to play notification sounds */
|
|
31
|
+
sound: boolean;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Current push notification permission status.
|
|
37
|
+
*
|
|
38
|
+
* Indicates whether the user has granted, denied, or not yet
|
|
39
|
+
* responded to push notification permission requests.
|
|
40
|
+
*
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
export enum CioPushPermissionStatus {
|
|
44
|
+
/** User has granted push notification permissions */
|
|
45
|
+
Granted = 'GRANTED',
|
|
46
|
+
/** User has denied push notification permissions */
|
|
47
|
+
Denied = 'DENIED',
|
|
48
|
+
/** User may not yet have been asked for permissions and permission status is unknown */
|
|
49
|
+
NotDetermined = 'NOTDETERMINED',
|
|
50
|
+
}
|