zixflow-reactnative 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +8 -8
- package/android/build.gradle +4 -13
- package/android/gradle.properties +1 -1
- package/android/src/main/AndroidManifest.xml +5 -5
- package/android/src/main/java/{io/customer/reactnative/sdk/NativeCustomerIOModule.kt → com/zixflow/reactnative/sdk/NativeZixflowModule.kt} +35 -35
- package/android/src/main/java/{io/customer/reactnative/sdk/CustomerIOReactNativePackage.kt → com/zixflow/reactnative/sdk/ZixflowReactNativePackage.kt} +15 -15
- package/android/src/main/java/{io/customer → com/zixflow}/reactnative/sdk/constant/Keys.kt +1 -1
- package/android/src/main/java/{io/customer → com/zixflow}/reactnative/sdk/extension/MapExtensions.kt +1 -1
- package/android/src/main/java/{io/customer → com/zixflow}/reactnative/sdk/extension/ReactExtensions.kt +1 -1
- package/android/src/main/java/{io/customer → com/zixflow}/reactnative/sdk/extension/StringExtensions.kt +1 -1
- package/android/src/main/java/{io/customer → com/zixflow}/reactnative/sdk/extension/ViewExtensions.kt +1 -1
- package/android/src/main/java/{io/customer → com/zixflow}/reactnative/sdk/location/NativeLocationModule.kt +15 -15
- package/android/src/main/java/{io/customer/reactnative/sdk/logging/NativeCustomerIOLoggingModule.kt → com/zixflow/reactnative/sdk/logging/NativeZixflowLoggingModule.kt} +10 -10
- package/android/src/main/java/{io/customer → com/zixflow}/reactnative/sdk/messaginginapp/InlineInAppMessageViewManager.kt +2 -2
- package/android/src/main/java/{io/customer → com/zixflow}/reactnative/sdk/messaginginapp/NativeMessagingInAppModule.kt +26 -26
- package/android/src/main/java/{io/customer → com/zixflow}/reactnative/sdk/messaginginapp/NotificationInboxExtensions.kt +5 -5
- package/android/src/main/java/{io/customer → com/zixflow}/reactnative/sdk/messaginginapp/ReactInAppEventListener.kt +4 -4
- package/android/src/main/java/{io/customer → com/zixflow}/reactnative/sdk/messaginginapp/ReactInAppPlatformDelegate.kt +3 -3
- package/android/src/main/java/{io/customer → com/zixflow}/reactnative/sdk/messaginginapp/ReactInlineInAppMessageView.kt +5 -5
- package/android/src/main/java/{io/customer → com/zixflow}/reactnative/sdk/messaginginapp/ReactNotificationInboxChangeListener.kt +3 -3
- package/android/src/main/java/{io/customer → com/zixflow}/reactnative/sdk/messagingpush/NativeMessagingPushModule.kt +25 -25
- package/android/src/main/java/{io/customer → com/zixflow}/reactnative/sdk/messagingpush/PermissionStatus.kt +1 -1
- package/android/src/main/java/{io/customer → com/zixflow}/reactnative/sdk/messagingpush/PushMessagingExtensions.kt +2 -2
- package/android/src/main/java/{io/customer → com/zixflow}/reactnative/sdk/util/Preconditions.kt +3 -3
- package/android/src/main/res/values/{customer_io_config.xml → zixflow_config.xml} +2 -2
- package/ios/wrappers/{NativeCustomerIO.mm → NativeZixflow.mm} +9 -9
- package/ios/wrappers/{NativeCustomerIO.swift → NativeZixflow.swift} +31 -31
- package/ios/wrappers/inapp/InboxMessage+Conversion.swift +1 -1
- package/ios/wrappers/inapp/NativeMessagingInApp.mm +8 -8
- package/ios/wrappers/inapp/NativeMessagingInApp.swift +7 -7
- package/ios/wrappers/inapp/ReactInAppEventListener.swift +12 -12
- package/ios/wrappers/inapp/inline/ReactInlineMessageView.swift +1 -1
- package/ios/wrappers/location/NativeLocation.mm +8 -8
- package/ios/wrappers/location/NativeLocation.swift +6 -6
- package/ios/wrappers/logging/{NativeCustomerIOLogging.mm → NativeZixflowLogging.mm} +14 -14
- package/ios/wrappers/logging/{NativeCustomerIOLogging.swift → NativeZixflowLogging.swift} +6 -6
- package/ios/wrappers/push/NativeMessagingPush.mm +8 -8
- package/ios/wrappers/push/NativeMessagingPush.swift +12 -12
- package/ios/wrappers/utils/Preconditions.swift +1 -1
- package/ios/wrappers/utils/{RCTCustomerIOUtils.h → RCTZixflowUtils.h} +3 -3
- package/ios/wrappers/utils/{CioConfigUtils.swift → ZixflowConfigUtils.swift} +4 -4
- package/ios/wrappers/utils/{CioConstants.swift → ZixflowConstants.swift} +4 -4
- package/lib/commonjs/native-logger-listener.js +10 -10
- package/lib/commonjs/native-logger-listener.js.map +1 -1
- package/lib/commonjs/notification-inbox.js +4 -4
- package/lib/commonjs/notification-inbox.js.map +1 -1
- package/lib/commonjs/postInstall.js +1 -1
- package/lib/commonjs/postInstall.js.map +1 -1
- package/lib/commonjs/specs/modules/{NativeCustomerIO.js → NativeZixflow.js} +6 -6
- package/lib/commonjs/specs/modules/NativeZixflow.js.map +1 -0
- package/lib/commonjs/specs/modules/{NativeCustomerIOLocation.js → NativeZixflowLocation.js} +4 -4
- package/lib/commonjs/specs/modules/NativeZixflowLocation.js.map +1 -0
- package/lib/commonjs/specs/modules/NativeZixflowLogging.js +19 -0
- package/lib/commonjs/specs/modules/NativeZixflowLogging.js.map +1 -0
- package/lib/commonjs/specs/modules/NativeZixflowMessagingInApp.js +16 -0
- package/lib/commonjs/specs/modules/NativeZixflowMessagingInApp.js.map +1 -0
- package/lib/commonjs/specs/modules/{NativeCustomerIOMessagingPush.js → NativeZixflowMessagingPush.js} +4 -4
- package/lib/commonjs/specs/modules/NativeZixflowMessagingPush.js.map +1 -0
- package/lib/commonjs/types/data-pipelines.js +23 -23
- package/lib/commonjs/types/data-pipelines.js.map +1 -1
- package/lib/commonjs/types/push.js +6 -6
- package/lib/commonjs/types/push.js.map +1 -1
- package/lib/commonjs/utils/native-bridge.js +1 -1
- package/lib/commonjs/utils/native-bridge.js.map +1 -1
- package/lib/commonjs/utils/param-validation.js +4 -4
- package/lib/commonjs/utils/param-validation.js.map +1 -1
- package/lib/commonjs/{customerio-cdp.js → zixflow-cdp.js} +19 -19
- package/lib/commonjs/zixflow-cdp.js.map +1 -0
- package/lib/commonjs/{customerio-inapp.js → zixflow-inapp.js} +8 -7
- package/lib/commonjs/zixflow-inapp.js.map +1 -0
- package/lib/commonjs/{customerio-location.js → zixflow-location.js} +10 -10
- package/lib/commonjs/zixflow-location.js.map +1 -0
- package/lib/commonjs/zixflow-params.js +2 -0
- package/lib/commonjs/zixflow-params.js.map +1 -0
- package/lib/commonjs/{customerio-push.js → zixflow-push.js} +11 -11
- package/lib/commonjs/zixflow-push.js.map +1 -0
- package/lib/commonjs/zixflow.js +19 -26
- package/lib/commonjs/zixflow.js.map +1 -1
- package/lib/module/index.js +3 -3
- package/lib/module/native-logger-listener.js +11 -11
- package/lib/module/native-logger-listener.js.map +1 -1
- package/lib/module/notification-inbox.js +4 -4
- package/lib/module/notification-inbox.js.map +1 -1
- package/lib/module/postInstall.js +1 -1
- package/lib/module/postInstall.js.map +1 -1
- package/lib/module/specs/modules/{NativeCustomerIO.js → NativeZixflow.js} +6 -6
- package/lib/module/specs/modules/NativeZixflow.js.map +1 -0
- package/lib/module/specs/modules/NativeZixflowLocation.js +13 -0
- package/lib/module/specs/modules/NativeZixflowLocation.js.map +1 -0
- package/lib/module/specs/modules/NativeZixflowLogging.js +18 -0
- package/lib/module/specs/modules/NativeZixflowLogging.js.map +1 -0
- package/lib/module/specs/modules/NativeZixflowMessagingInApp.js +15 -0
- package/lib/module/specs/modules/NativeZixflowMessagingInApp.js.map +1 -0
- package/lib/module/specs/modules/NativeZixflowMessagingPush.js +13 -0
- package/lib/module/specs/modules/NativeZixflowMessagingPush.js.map +1 -0
- package/lib/module/types/data-pipelines.js +22 -22
- package/lib/module/types/data-pipelines.js.map +1 -1
- package/lib/module/types/push.js +5 -5
- package/lib/module/types/push.js.map +1 -1
- package/lib/module/utils/native-bridge.js +1 -1
- package/lib/module/utils/native-bridge.js.map +1 -1
- package/lib/module/utils/param-validation.js +4 -4
- package/lib/module/utils/param-validation.js.map +1 -1
- package/lib/module/{customerio-cdp.js → zixflow-cdp.js} +16 -16
- package/lib/module/zixflow-cdp.js.map +1 -0
- package/lib/module/{customerio-inapp.js → zixflow-inapp.js} +6 -6
- package/lib/module/zixflow-inapp.js.map +1 -0
- package/lib/module/{customerio-location.js → zixflow-location.js} +6 -6
- package/lib/module/zixflow-location.js.map +1 -0
- package/lib/module/zixflow-params.js +2 -0
- package/lib/module/zixflow-params.js.map +1 -0
- package/lib/module/{customerio-push.js → zixflow-push.js} +10 -10
- package/lib/module/zixflow-push.js.map +1 -0
- package/lib/module/zixflow.js +5 -11
- package/lib/module/zixflow.js.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +2 -2
- package/lib/typescript/commonjs/native-logger-listener.d.ts.map +1 -1
- package/lib/typescript/commonjs/notification-inbox.d.ts +1 -1
- package/lib/typescript/commonjs/specs/modules/{NativeCustomerIO.d.ts → NativeZixflow.d.ts} +5 -5
- package/lib/typescript/commonjs/specs/modules/NativeZixflow.d.ts.map +1 -0
- package/lib/typescript/commonjs/specs/modules/{NativeCustomerIOLocation.d.ts → NativeZixflowLocation.d.ts} +3 -3
- package/lib/typescript/commonjs/specs/modules/NativeZixflowLocation.d.ts.map +1 -0
- package/lib/typescript/commonjs/specs/modules/NativeZixflowLogging.d.ts +18 -0
- package/lib/typescript/commonjs/specs/modules/NativeZixflowLogging.d.ts.map +1 -0
- package/lib/typescript/commonjs/specs/modules/{NativeCustomerIOMessagingInApp.d.ts → NativeZixflowMessagingInApp.d.ts} +4 -4
- package/lib/typescript/commonjs/specs/modules/NativeZixflowMessagingInApp.d.ts.map +1 -0
- package/lib/typescript/{module/specs/modules/NativeCustomerIOMessagingPush.d.ts → commonjs/specs/modules/NativeZixflowMessagingPush.d.ts} +3 -3
- package/lib/typescript/commonjs/specs/modules/NativeZixflowMessagingPush.d.ts.map +1 -0
- package/lib/typescript/commonjs/types/data-pipelines.d.ts +14 -14
- package/lib/typescript/commonjs/types/data-pipelines.d.ts.map +1 -1
- package/lib/typescript/commonjs/types/internal.d.ts +2 -2
- package/lib/typescript/commonjs/types/push.d.ts +2 -2
- package/lib/typescript/commonjs/types/push.d.ts.map +1 -1
- package/lib/typescript/commonjs/utils/param-validation.d.ts +2 -2
- package/lib/typescript/commonjs/utils/param-validation.d.ts.map +1 -1
- package/lib/typescript/commonjs/{customerio-cdp.d.ts → zixflow-cdp.d.ts} +12 -12
- package/lib/typescript/commonjs/zixflow-cdp.d.ts.map +1 -0
- package/lib/typescript/{module/customerio-inapp.d.ts → commonjs/zixflow-inapp.d.ts} +4 -4
- package/lib/typescript/commonjs/zixflow-inapp.d.ts.map +1 -0
- package/lib/typescript/commonjs/{customerio-location.d.ts → zixflow-location.d.ts} +5 -5
- package/lib/typescript/commonjs/zixflow-location.d.ts.map +1 -0
- package/lib/typescript/commonjs/{cio-params.d.ts → zixflow-params.d.ts} +1 -1
- package/lib/typescript/commonjs/zixflow-params.d.ts.map +1 -0
- package/lib/typescript/{module/customerio-push.d.ts → commonjs/zixflow-push.d.ts} +11 -11
- package/lib/typescript/commonjs/zixflow-push.d.ts.map +1 -0
- package/lib/typescript/commonjs/zixflow.d.ts +5 -7
- package/lib/typescript/commonjs/zixflow.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +2 -2
- package/lib/typescript/module/native-logger-listener.d.ts.map +1 -1
- package/lib/typescript/module/notification-inbox.d.ts +1 -1
- package/lib/typescript/module/specs/modules/{NativeCustomerIO.d.ts → NativeZixflow.d.ts} +5 -5
- package/lib/typescript/module/specs/modules/NativeZixflow.d.ts.map +1 -0
- package/lib/typescript/module/specs/modules/{NativeCustomerIOLocation.d.ts → NativeZixflowLocation.d.ts} +3 -3
- package/lib/typescript/module/specs/modules/NativeZixflowLocation.d.ts.map +1 -0
- package/lib/typescript/module/specs/modules/NativeZixflowLogging.d.ts +18 -0
- package/lib/typescript/module/specs/modules/NativeZixflowLogging.d.ts.map +1 -0
- package/lib/typescript/module/specs/modules/{NativeCustomerIOMessagingInApp.d.ts → NativeZixflowMessagingInApp.d.ts} +4 -4
- package/lib/typescript/module/specs/modules/NativeZixflowMessagingInApp.d.ts.map +1 -0
- package/lib/typescript/{commonjs/specs/modules/NativeCustomerIOMessagingPush.d.ts → module/specs/modules/NativeZixflowMessagingPush.d.ts} +3 -3
- package/lib/typescript/module/specs/modules/NativeZixflowMessagingPush.d.ts.map +1 -0
- package/lib/typescript/module/types/data-pipelines.d.ts +14 -14
- package/lib/typescript/module/types/data-pipelines.d.ts.map +1 -1
- package/lib/typescript/module/types/internal.d.ts +2 -2
- package/lib/typescript/module/types/push.d.ts +2 -2
- package/lib/typescript/module/types/push.d.ts.map +1 -1
- package/lib/typescript/module/utils/param-validation.d.ts +2 -2
- package/lib/typescript/module/utils/param-validation.d.ts.map +1 -1
- package/lib/typescript/module/{customerio-cdp.d.ts → zixflow-cdp.d.ts} +12 -12
- package/lib/typescript/module/zixflow-cdp.d.ts.map +1 -0
- package/lib/typescript/{commonjs/customerio-inapp.d.ts → module/zixflow-inapp.d.ts} +4 -4
- package/lib/typescript/module/zixflow-inapp.d.ts.map +1 -0
- package/lib/typescript/module/{customerio-location.d.ts → zixflow-location.d.ts} +5 -5
- package/lib/typescript/module/zixflow-location.d.ts.map +1 -0
- package/lib/typescript/module/{cio-params.d.ts → zixflow-params.d.ts} +1 -1
- package/lib/typescript/module/zixflow-params.d.ts.map +1 -0
- package/lib/typescript/{commonjs/customerio-push.d.ts → module/zixflow-push.d.ts} +11 -11
- package/lib/typescript/module/zixflow-push.d.ts.map +1 -0
- package/lib/typescript/module/zixflow.d.ts +5 -7
- package/lib/typescript/module/zixflow.d.ts.map +1 -1
- package/package.json +11 -12
- package/src/index.ts +3 -3
- package/src/native-logger-listener.ts +14 -14
- package/src/notification-inbox.ts +5 -5
- package/src/postInstall.js +1 -1
- package/src/specs/modules/{NativeCustomerIO.ts → NativeZixflow.ts} +5 -5
- package/src/specs/modules/{NativeCustomerIOLocation.ts → NativeZixflowLocation.ts} +3 -3
- package/src/specs/modules/NativeZixflowLogging.ts +22 -0
- package/src/specs/modules/{NativeCustomerIOMessagingInApp.ts → NativeZixflowMessagingInApp.ts} +4 -4
- package/src/specs/modules/{NativeCustomerIOMessagingPush.ts → NativeZixflowMessagingPush.ts} +3 -3
- package/src/types/data-pipelines.ts +14 -14
- package/src/types/internal.ts +2 -2
- package/src/types/push.ts +2 -2
- package/src/utils/native-bridge.ts +1 -1
- package/src/utils/param-validation.ts +8 -8
- package/src/{customerio-cdp.ts → zixflow-cdp.ts} +17 -17
- package/src/{customerio-inapp.ts → zixflow-inapp.ts} +6 -6
- package/src/{customerio-location.ts → zixflow-location.ts} +6 -6
- package/src/{customerio-push.ts → zixflow-push.ts} +19 -17
- package/src/zixflow.ts +5 -15
- package/zixflow-reactnative.podspec +16 -22
- package/customerio-reactnative.podspec +0 -60
- package/lib/commonjs/cio-params.js +0 -2
- package/lib/commonjs/cio-params.js.map +0 -1
- package/lib/commonjs/customerio-cdp.js.map +0 -1
- package/lib/commonjs/customerio-inapp.js.map +0 -1
- package/lib/commonjs/customerio-location.js.map +0 -1
- package/lib/commonjs/customerio-push.js.map +0 -1
- package/lib/commonjs/specs/modules/NativeCustomerIO.js.map +0 -1
- package/lib/commonjs/specs/modules/NativeCustomerIOLocation.js.map +0 -1
- package/lib/commonjs/specs/modules/NativeCustomerIOLogging.js +0 -19
- package/lib/commonjs/specs/modules/NativeCustomerIOLogging.js.map +0 -1
- package/lib/commonjs/specs/modules/NativeCustomerIOMessagingInApp.js +0 -16
- package/lib/commonjs/specs/modules/NativeCustomerIOMessagingInApp.js.map +0 -1
- package/lib/commonjs/specs/modules/NativeCustomerIOMessagingPush.js.map +0 -1
- package/lib/module/cio-params.js +0 -2
- package/lib/module/cio-params.js.map +0 -1
- package/lib/module/customerio-cdp.js.map +0 -1
- package/lib/module/customerio-inapp.js.map +0 -1
- package/lib/module/customerio-location.js.map +0 -1
- package/lib/module/customerio-push.js.map +0 -1
- package/lib/module/specs/modules/NativeCustomerIO.js.map +0 -1
- package/lib/module/specs/modules/NativeCustomerIOLocation.js +0 -13
- package/lib/module/specs/modules/NativeCustomerIOLocation.js.map +0 -1
- package/lib/module/specs/modules/NativeCustomerIOLogging.js +0 -18
- package/lib/module/specs/modules/NativeCustomerIOLogging.js.map +0 -1
- package/lib/module/specs/modules/NativeCustomerIOMessagingInApp.js +0 -15
- package/lib/module/specs/modules/NativeCustomerIOMessagingInApp.js.map +0 -1
- package/lib/module/specs/modules/NativeCustomerIOMessagingPush.js +0 -13
- package/lib/module/specs/modules/NativeCustomerIOMessagingPush.js.map +0 -1
- package/lib/typescript/commonjs/cio-params.d.ts.map +0 -1
- package/lib/typescript/commonjs/customerio-cdp.d.ts.map +0 -1
- package/lib/typescript/commonjs/customerio-inapp.d.ts.map +0 -1
- package/lib/typescript/commonjs/customerio-location.d.ts.map +0 -1
- package/lib/typescript/commonjs/customerio-push.d.ts.map +0 -1
- package/lib/typescript/commonjs/specs/modules/NativeCustomerIO.d.ts.map +0 -1
- package/lib/typescript/commonjs/specs/modules/NativeCustomerIOLocation.d.ts.map +0 -1
- package/lib/typescript/commonjs/specs/modules/NativeCustomerIOLogging.d.ts +0 -18
- package/lib/typescript/commonjs/specs/modules/NativeCustomerIOLogging.d.ts.map +0 -1
- package/lib/typescript/commonjs/specs/modules/NativeCustomerIOMessagingInApp.d.ts.map +0 -1
- package/lib/typescript/commonjs/specs/modules/NativeCustomerIOMessagingPush.d.ts.map +0 -1
- package/lib/typescript/module/cio-params.d.ts.map +0 -1
- package/lib/typescript/module/customerio-cdp.d.ts.map +0 -1
- package/lib/typescript/module/customerio-inapp.d.ts.map +0 -1
- package/lib/typescript/module/customerio-location.d.ts.map +0 -1
- package/lib/typescript/module/customerio-push.d.ts.map +0 -1
- package/lib/typescript/module/specs/modules/NativeCustomerIO.d.ts.map +0 -1
- package/lib/typescript/module/specs/modules/NativeCustomerIOLocation.d.ts.map +0 -1
- package/lib/typescript/module/specs/modules/NativeCustomerIOLogging.d.ts +0 -18
- package/lib/typescript/module/specs/modules/NativeCustomerIOLogging.d.ts.map +0 -1
- package/lib/typescript/module/specs/modules/NativeCustomerIOMessagingInApp.d.ts.map +0 -1
- package/lib/typescript/module/specs/modules/NativeCustomerIOMessagingPush.d.ts.map +0 -1
- package/src/specs/modules/NativeCustomerIOLogging.ts +0 -24
- /package/android/{cio-core.gradle → zixflow-core.gradle} +0 -0
- /package/src/{cio-params.ts → zixflow-params.ts} +0 -0
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ The official Zixflow SDK for React Native enables you to integrate customer enga
|
|
|
22
22
|
|
|
23
23
|
## About Zixflow
|
|
24
24
|
|
|
25
|
-
Zixflow is a customer engagement platform built on proven
|
|
25
|
+
Zixflow is a customer engagement platform built on proven Zixflow technology. This SDK is a customized fork of the Zixflow React Native SDK, optimized for use with the Zixflow platform.
|
|
26
26
|
|
|
27
27
|
### Key Features
|
|
28
28
|
|
|
@@ -61,16 +61,16 @@ Here's a simplified example showing how to initialize the SDK to enable mobile f
|
|
|
61
61
|
import {
|
|
62
62
|
Zixflow,
|
|
63
63
|
ZixflowConfig,
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
ZixflowLogLevel,
|
|
65
|
+
ZixflowRegion,
|
|
66
66
|
} from 'zixflow-reactnative';
|
|
67
67
|
|
|
68
68
|
useEffect(() => {
|
|
69
69
|
const config: ZixflowConfig = {
|
|
70
70
|
cdpApiKey: 'your-api-key', // Required
|
|
71
71
|
migrationSiteId: 'your-site-id', // Optional, for migrating from older SDKs
|
|
72
|
-
region:
|
|
73
|
-
logLevel:
|
|
72
|
+
region: ZixflowRegion.US, // Or ZixflowRegion.EU
|
|
73
|
+
logLevel: ZixflowLogLevel.Debug,
|
|
74
74
|
trackApplicationLifecycleEvents: true,
|
|
75
75
|
inApp: {
|
|
76
76
|
siteId: 'your-site-id', // Required for in-app messaging
|
|
@@ -313,8 +313,8 @@ zixflow_location_enabled=true
|
|
|
313
313
|
|--------|------|----------|-------------|
|
|
314
314
|
| `cdpApiKey` | `string` | ✅ | Your Zixflow API key |
|
|
315
315
|
| `migrationSiteId` | `string` | ❌ | Site ID for migration from older SDKs |
|
|
316
|
-
| `region` | `
|
|
317
|
-
| `logLevel` | `
|
|
316
|
+
| `region` | `ZixflowRegion` | ❌ | US or EU region (default: US) |
|
|
317
|
+
| `logLevel` | `ZixflowLogLevel` | ❌ | Logging verbosity (default: error) |
|
|
318
318
|
| `trackApplicationLifecycleEvents` | `boolean` | ❌ | Auto-track app lifecycle events |
|
|
319
319
|
| `inApp` | `object` | ❌ | In-app messaging configuration |
|
|
320
320
|
| `push` | `object` | ❌ | Push notification configuration |
|
|
@@ -448,4 +448,4 @@ We welcome contributions! To get started:
|
|
|
448
448
|
|
|
449
449
|
## Acknowledgments
|
|
450
450
|
|
|
451
|
-
This SDK is based on the
|
|
451
|
+
This SDK is based on the Zixflow React Native SDK and maintains compatibility with the Zixflow platform while providing Zixflow-specific optimizations and branding.
|
package/android/build.gradle
CHANGED
|
@@ -28,12 +28,12 @@ def getExtOrIntegerDefault(name) {
|
|
|
28
28
|
ext.zixflowLocationEnabled = rootProject.findProperty("zixflow_location_enabled")?.toBoolean() ?: false
|
|
29
29
|
|
|
30
30
|
android {
|
|
31
|
-
namespace = '
|
|
31
|
+
namespace = 'com.zixflow.reactnative.sdk'
|
|
32
32
|
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
|
|
33
33
|
defaultConfig {
|
|
34
34
|
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
|
|
35
35
|
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
|
|
36
|
-
buildConfigField "boolean", "
|
|
36
|
+
buildConfigField "boolean", "ZIXFLOW_LOCATION_ENABLED", "${project.zixflowLocationEnabled}"
|
|
37
37
|
consumerProguardFiles 'consumer-rules.pro'
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -132,21 +132,12 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
|
|
|
132
132
|
kotlinOptions {
|
|
133
133
|
freeCompilerArgs += [
|
|
134
134
|
'-Xopt-in=kotlin.RequiresOptIn',
|
|
135
|
-
'-Xopt-in=
|
|
135
|
+
'-Xopt-in=com.zixflow.base.internal.InternalZixflowApi',
|
|
136
136
|
]
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
|
|
141
|
-
kotlinOptions {
|
|
142
|
-
freeCompilerArgs += [
|
|
143
|
-
'-Xopt-in=kotlin.RequiresOptIn',
|
|
144
|
-
'-Xopt-in=io.customer.base.internal.InternalCustomerIOApi',
|
|
145
|
-
]
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
apply from: "./cio-core.gradle"
|
|
140
|
+
apply from: "./zixflow-core.gradle"
|
|
150
141
|
|
|
151
142
|
dependencies {
|
|
152
143
|
// noinspection GradleDynamicVersion
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
|
|
6
6
|
<application>
|
|
7
7
|
<!--
|
|
8
|
-
Provide source and version of
|
|
8
|
+
Provide source and version of Zixflow React Native SDK so user agent can be
|
|
9
9
|
generated based on this information.
|
|
10
10
|
-->
|
|
11
11
|
<meta-data
|
|
12
|
-
android:name="
|
|
13
|
-
android:value="@string/
|
|
12
|
+
android:name="com.zixflow.sdk.android.core.SDK_SOURCE"
|
|
13
|
+
android:value="@string/zixflow_react_native_sdk_client_source" />
|
|
14
14
|
<meta-data
|
|
15
|
-
android:name="
|
|
16
|
-
android:value="@string/
|
|
15
|
+
android:name="com.zixflow.sdk.android.core.SDK_VERSION"
|
|
16
|
+
android:value="@string/zixflow_react_native_sdk_client_version" />
|
|
17
17
|
</application>
|
|
18
18
|
|
|
19
19
|
</manifest>
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
package
|
|
1
|
+
package com.zixflow.reactnative.sdk
|
|
2
2
|
|
|
3
3
|
import android.app.Application
|
|
4
4
|
import com.facebook.react.bridge.Promise
|
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
6
|
import com.facebook.react.bridge.ReadableMap
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
7
|
+
import com.zixflow.datapipelines.config.ScreenView
|
|
8
|
+
import com.zixflow.reactnative.sdk.constant.Keys
|
|
9
|
+
import com.zixflow.reactnative.sdk.extension.getTypedValue
|
|
10
|
+
import com.zixflow.reactnative.sdk.extension.toMap
|
|
11
|
+
import com.zixflow.reactnative.sdk.location.NativeLocationModule
|
|
12
|
+
import com.zixflow.reactnative.sdk.messaginginapp.NativeMessagingInAppModule
|
|
13
|
+
import com.zixflow.reactnative.sdk.messagingpush.NativeMessagingPushModule
|
|
14
|
+
import com.zixflow.reactnative.sdk.util.assertNotNull
|
|
15
|
+
import com.zixflow.sdk.Zixflow
|
|
16
|
+
import com.zixflow.sdk.ZixflowBuilder
|
|
17
|
+
import com.zixflow.sdk.core.di.SDKComponent
|
|
18
|
+
import com.zixflow.sdk.core.util.CioLogLevel
|
|
19
|
+
import com.zixflow.sdk.core.util.Logger
|
|
20
|
+
import com.zixflow.sdk.data.model.Region
|
|
21
|
+
import com.zixflow.sdk.events.Metric
|
|
22
|
+
import com.zixflow.sdk.events.TrackMetric
|
|
23
|
+
import com.zixflow.sdk.events.serializedName
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* React Native module implementation for
|
|
26
|
+
* React Native module implementation for Zixflow Native SDK
|
|
27
27
|
* using TurboModules with new architecture.
|
|
28
28
|
*/
|
|
29
|
-
class
|
|
29
|
+
class NativeZixflowModule(
|
|
30
30
|
private val reactContext: ReactApplicationContext,
|
|
31
|
-
) :
|
|
31
|
+
) : NativeZixflowSpec(reactContext) {
|
|
32
32
|
private val logger: Logger
|
|
33
33
|
get() = SDKComponent.logger
|
|
34
34
|
|
|
35
|
-
// Returns
|
|
35
|
+
// Returns SDK instance if initialized, null otherwise, with configurable failure handling.
|
|
36
36
|
private inline fun getSDKInstanceOrNull(
|
|
37
37
|
onFailure: (exception: Throwable) -> Unit = {}
|
|
38
|
-
):
|
|
39
|
-
// If the SDK is not initialized, `
|
|
40
|
-
|
|
38
|
+
): Zixflow? = runCatching {
|
|
39
|
+
// If the SDK is not initialized, `Zixflow.instance()` throws an exception
|
|
40
|
+
Zixflow.instance()
|
|
41
41
|
}.onFailure(onFailure).getOrNull()
|
|
42
42
|
|
|
43
|
-
// Returns
|
|
44
|
-
private fun requireSDKInstance():
|
|
45
|
-
logger.error("
|
|
43
|
+
// Returns SDK instance if initialized, null otherwise, logging error on failure.
|
|
44
|
+
private fun requireSDKInstance(): Zixflow? = getSDKInstanceOrNull {
|
|
45
|
+
logger.error("Zixflow SDK is not initialized. Please call initialize() first.")
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
override fun initialize(config: ReadableMap?, args: ReadableMap?, promise: Promise?) {
|
|
50
50
|
// Skip initialization if already initialized
|
|
51
51
|
if (getSDKInstanceOrNull() != null) {
|
|
52
|
-
logger.info("
|
|
52
|
+
logger.info("Zixflow SDK is already initialized. Skipping initialization.")
|
|
53
53
|
promise?.resolve(true)
|
|
54
54
|
return
|
|
55
55
|
}
|
|
@@ -58,7 +58,7 @@ class NativeCustomerIOModule(
|
|
|
58
58
|
val packageConfig = config.toMap()
|
|
59
59
|
val cdpApiKey = packageConfig.getTypedValue<String>(
|
|
60
60
|
Keys.Config.CDP_API_KEY
|
|
61
|
-
) ?: throw IllegalArgumentException("CDP API Key is required to initialize
|
|
61
|
+
) ?: throw IllegalArgumentException("CDP API Key is required to initialize Zixflow")
|
|
62
62
|
|
|
63
63
|
val logLevelRawValue = packageConfig.getTypedValue<String>(Keys.Config.LOG_LEVEL)
|
|
64
64
|
val regionRawValue = packageConfig.getTypedValue<String>(Keys.Config.REGION)
|
|
@@ -66,7 +66,7 @@ class NativeCustomerIOModule(
|
|
|
66
66
|
val screenViewRawValue =
|
|
67
67
|
packageConfig.getTypedValue<String>(Keys.Config.SCREEN_VIEW_USE)
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
ZixflowBuilder(
|
|
70
70
|
applicationContext = reactContext.applicationContext as Application,
|
|
71
71
|
cdpApiKey = cdpApiKey
|
|
72
72
|
).apply {
|
|
@@ -105,7 +105,7 @@ class NativeCustomerIOModule(
|
|
|
105
105
|
)
|
|
106
106
|
}
|
|
107
107
|
// Configure location module if enabled via gradle property
|
|
108
|
-
if (BuildConfig.
|
|
108
|
+
if (BuildConfig.ZIXFLOW_LOCATION_ENABLED) {
|
|
109
109
|
packageConfig.getTypedValue<Map<String, Any>>(key = "location")?.let { locationConfig ->
|
|
110
110
|
NativeLocationModule.addNativeModuleFromConfig(
|
|
111
111
|
builder = this,
|
|
@@ -115,10 +115,10 @@ class NativeCustomerIOModule(
|
|
|
115
115
|
}
|
|
116
116
|
}.build()
|
|
117
117
|
|
|
118
|
-
logger.info("
|
|
118
|
+
logger.info("Zixflow instance initialized successfully from app")
|
|
119
119
|
promise?.resolve(true)
|
|
120
120
|
} catch (ex: Exception) {
|
|
121
|
-
logger.error("Failed to initialize
|
|
121
|
+
logger.error("Failed to initialize Zixflow instance from app, ${ex.message}")
|
|
122
122
|
promise?.reject(ex)
|
|
123
123
|
}
|
|
124
124
|
}
|
|
@@ -196,6 +196,6 @@ class NativeCustomerIOModule(
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
companion object {
|
|
199
|
-
internal const val NAME = "
|
|
199
|
+
internal const val NAME = "NativeZixflow"
|
|
200
200
|
}
|
|
201
201
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package
|
|
1
|
+
package com.zixflow.reactnative.sdk
|
|
2
2
|
|
|
3
3
|
import com.facebook.react.BaseReactPackage
|
|
4
4
|
import com.facebook.react.bridge.NativeModule
|
|
@@ -6,20 +6,20 @@ import com.facebook.react.bridge.ReactApplicationContext
|
|
|
6
6
|
import com.facebook.react.module.model.ReactModuleInfo
|
|
7
7
|
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
8
8
|
import com.facebook.react.uimanager.ViewManager
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
9
|
+
import com.zixflow.reactnative.sdk.location.NativeLocationModule
|
|
10
|
+
import com.zixflow.reactnative.sdk.logging.NativeZixflowLoggingModule
|
|
11
|
+
import com.zixflow.reactnative.sdk.messaginginapp.InlineInAppMessageViewManager
|
|
12
|
+
import com.zixflow.reactnative.sdk.messaginginapp.NativeMessagingInAppModule
|
|
13
|
+
import com.zixflow.reactnative.sdk.messagingpush.NativeMessagingPushModule
|
|
14
|
+
import com.zixflow.reactnative.sdk.util.assertNotNull
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* React Native package for
|
|
17
|
+
* React Native package for Zixflow SDK that registers all TurboModules and ViewManagers.
|
|
18
18
|
* Implements new architecture support for React Native.
|
|
19
19
|
*/
|
|
20
|
-
class
|
|
20
|
+
class ZixflowReactNativePackage : BaseReactPackage() {
|
|
21
21
|
/**
|
|
22
|
-
* Creates the list of view managers for the
|
|
22
|
+
* Creates the list of view managers for the Zixflow React Native SDK.
|
|
23
23
|
*/
|
|
24
24
|
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
25
25
|
return listOf(InlineInAppMessageViewManager())
|
|
@@ -31,9 +31,9 @@ class CustomerIOReactNativePackage : BaseReactPackage() {
|
|
|
31
31
|
// See: https://reactnative.dev/docs/fabric-native-components-introduction?platforms=android#4-write-the-reactwebviewpackage
|
|
32
32
|
return when (name) {
|
|
33
33
|
InlineInAppMessageViewManager.NAME -> InlineInAppMessageViewManager()
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
NativeLocationModule.NAME -> if (BuildConfig.
|
|
34
|
+
NativeZixflowLoggingModule.NAME -> NativeZixflowLoggingModule(reactContext)
|
|
35
|
+
NativeZixflowModule.NAME -> NativeZixflowModule(reactContext = reactContext)
|
|
36
|
+
NativeLocationModule.NAME -> if (BuildConfig.ZIXFLOW_LOCATION_ENABLED) {
|
|
37
37
|
NativeLocationModule(reactContext)
|
|
38
38
|
} else null
|
|
39
39
|
NativeMessagingInAppModule.NAME -> NativeMessagingInAppModule(reactContext)
|
|
@@ -69,8 +69,8 @@ class CustomerIOReactNativePackage : BaseReactPackage() {
|
|
|
69
69
|
// doesn't crash at import time. getModule() returns null when disabled.
|
|
70
70
|
val moduleNames: List<String> = listOf(
|
|
71
71
|
InlineInAppMessageViewManager.NAME,
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
NativeZixflowLoggingModule.NAME,
|
|
73
|
+
NativeZixflowModule.NAME,
|
|
74
74
|
NativeLocationModule.NAME,
|
|
75
75
|
NativeMessagingInAppModule.NAME,
|
|
76
76
|
NativeMessagingPushModule.NAME,
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
package
|
|
1
|
+
package com.zixflow.reactnative.sdk.location
|
|
2
2
|
|
|
3
3
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
4
4
|
import com.facebook.react.module.annotations.ReactModule
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
5
|
+
import com.zixflow.location.LocationModuleConfig
|
|
6
|
+
import com.zixflow.location.LocationTrackingMode
|
|
7
|
+
import com.zixflow.location.ModuleLocation
|
|
8
|
+
import com.zixflow.reactnative.sdk.NativeZixflowLocationSpec
|
|
9
|
+
import com.zixflow.reactnative.sdk.extension.getTypedValue
|
|
10
|
+
import com.zixflow.sdk.ZixflowBuilder
|
|
11
|
+
import com.zixflow.sdk.core.di.SDKComponent
|
|
12
|
+
import com.zixflow.sdk.core.util.Logger
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* React Native module implementation for
|
|
15
|
+
* React Native module implementation for Zixflow Location Native SDK
|
|
16
16
|
* using TurboModules with new architecture.
|
|
17
17
|
*/
|
|
18
18
|
@ReactModule(name = NativeLocationModule.NAME)
|
|
19
19
|
class NativeLocationModule(
|
|
20
20
|
private val reactContext: ReactApplicationContext,
|
|
21
|
-
) :
|
|
21
|
+
) : NativeZixflowLocationSpec(reactContext) {
|
|
22
22
|
private val logger: Logger
|
|
23
23
|
get() = SDKComponent.logger
|
|
24
24
|
|
|
@@ -37,17 +37,17 @@ class NativeLocationModule(
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
companion object {
|
|
40
|
-
const val NAME = "
|
|
40
|
+
const val NAME = "NativeZixflowLocation"
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* Adds location module to native Android SDK based on the configuration provided by
|
|
44
44
|
* customer app.
|
|
45
45
|
*
|
|
46
|
-
* @param builder instance of
|
|
46
|
+
* @param builder instance of ZixflowBuilder to add location module.
|
|
47
47
|
* @param config configuration provided by customer app for location module.
|
|
48
48
|
*/
|
|
49
49
|
internal fun addNativeModuleFromConfig(
|
|
50
|
-
builder:
|
|
50
|
+
builder: ZixflowBuilder,
|
|
51
51
|
config: Map<String, Any>
|
|
52
52
|
) {
|
|
53
53
|
val trackingModeValue = config.getTypedValue<String>("trackingMode")
|
|
@@ -60,7 +60,7 @@ class NativeLocationModule(
|
|
|
60
60
|
.setLocationTrackingMode(trackingMode)
|
|
61
61
|
.build()
|
|
62
62
|
)
|
|
63
|
-
builder.
|
|
63
|
+
builder.addZixflowModule(module)
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
package
|
|
1
|
+
package com.zixflow.reactnative.sdk.logging
|
|
2
2
|
|
|
3
3
|
import android.util.Log
|
|
4
4
|
import com.facebook.react.bridge.Arguments
|
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
6
|
import com.facebook.react.bridge.ReadableMap
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
7
|
+
import com.zixflow.reactnative.sdk.NativeZixflowLoggingSpec
|
|
8
|
+
import com.zixflow.sdk.core.di.SDKComponent
|
|
9
|
+
import com.zixflow.sdk.core.util.CioLogLevel
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* React Native module implementation for
|
|
12
|
+
* React Native module implementation for Zixflow Logging Native SDK
|
|
13
13
|
* using TurboModules with new architecture.
|
|
14
14
|
*/
|
|
15
|
-
class
|
|
15
|
+
class NativeZixflowLoggingModule(
|
|
16
16
|
reactContext: ReactApplicationContext,
|
|
17
|
-
) :
|
|
17
|
+
) : NativeZixflowLoggingSpec(reactContext) {
|
|
18
18
|
override fun getName(): String = NAME
|
|
19
19
|
|
|
20
20
|
// Log event emitter function to send events to React Native layer
|
|
@@ -29,7 +29,7 @@ class NativeCustomerIOLoggingModule(
|
|
|
29
29
|
action()
|
|
30
30
|
} catch (ex: Exception) {
|
|
31
31
|
// Use Android logger to avoid cyclic calls from internal SDK logging
|
|
32
|
-
Log.e("[
|
|
32
|
+
Log.e("[Zixflow]", "Error in NativeZixflowLoggingModule: ${ex.message}", ex)
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -37,7 +37,7 @@ class NativeCustomerIOLoggingModule(
|
|
|
37
37
|
runWithTryCatch {
|
|
38
38
|
super.initialize()
|
|
39
39
|
setLogEventEmitter { data ->
|
|
40
|
-
|
|
40
|
+
emitOnZixflowLogEvent(data)
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -85,6 +85,6 @@ class NativeCustomerIOLoggingModule(
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
companion object {
|
|
88
|
-
internal const val NAME = "
|
|
88
|
+
internal const val NAME = "NativeZixflowLogging"
|
|
89
89
|
}
|
|
90
90
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package
|
|
1
|
+
package com.zixflow.reactnative.sdk.messaginginapp
|
|
2
2
|
|
|
3
3
|
import com.facebook.react.module.annotations.ReactModule
|
|
4
4
|
import com.facebook.react.uimanager.SimpleViewManager
|
|
@@ -7,7 +7,7 @@ import com.facebook.react.uimanager.ViewManagerDelegate
|
|
|
7
7
|
import com.facebook.react.uimanager.annotations.ReactProp
|
|
8
8
|
import com.facebook.react.viewmanagers.InlineMessageNativeManagerDelegate
|
|
9
9
|
import com.facebook.react.viewmanagers.InlineMessageNativeManagerInterface
|
|
10
|
-
import
|
|
10
|
+
import com.zixflow.messaginginapp.ui.bridge.WrapperPlatformDelegate
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Base view manager for inline in-app message components.
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
package
|
|
1
|
+
package com.zixflow.reactnative.sdk.messaginginapp
|
|
2
2
|
|
|
3
3
|
import com.facebook.react.bridge.Arguments
|
|
4
4
|
import com.facebook.react.bridge.Promise
|
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
6
|
import com.facebook.react.bridge.ReadableMap
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
7
|
+
import com.zixflow.messaginginapp.MessagingInAppModuleConfig
|
|
8
|
+
import com.zixflow.messaginginapp.ModuleMessagingInApp
|
|
9
|
+
import com.zixflow.messaginginapp.di.inAppMessaging
|
|
10
|
+
import com.zixflow.messaginginapp.gist.data.model.InboxMessage
|
|
11
|
+
import com.zixflow.messaginginapp.gist.data.model.response.InboxMessageFactory
|
|
12
|
+
import com.zixflow.messaginginapp.inbox.NotificationInbox
|
|
13
|
+
import com.zixflow.reactnative.sdk.NativeZixflowMessagingInAppSpec
|
|
14
|
+
import com.zixflow.reactnative.sdk.constant.Keys
|
|
15
|
+
import com.zixflow.reactnative.sdk.extension.getTypedValue
|
|
16
|
+
import com.zixflow.reactnative.sdk.extension.toMap
|
|
17
|
+
import com.zixflow.sdk.Zixflow
|
|
18
|
+
import com.zixflow.sdk.ZixflowBuilder
|
|
19
|
+
import com.zixflow.sdk.core.di.SDKComponent
|
|
20
|
+
import com.zixflow.sdk.core.util.Logger
|
|
21
|
+
import com.zixflow.sdk.data.model.Region
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* React Native module implementation for
|
|
24
|
+
* React Native module implementation for Zixflow In-App Messaging Native SDK
|
|
25
25
|
* using TurboModules with new architecture.
|
|
26
26
|
*/
|
|
27
27
|
class NativeMessagingInAppModule(
|
|
28
28
|
reactContext: ReactApplicationContext,
|
|
29
|
-
) :
|
|
29
|
+
) : NativeZixflowMessagingInAppSpec(reactContext) {
|
|
30
30
|
private val logger: Logger = SDKComponent.logger
|
|
31
31
|
private val inAppMessagingModule: ModuleMessagingInApp?
|
|
32
|
-
get() = runCatching {
|
|
32
|
+
get() = runCatching { Zixflow.instance().inAppMessaging() }.getOrNull()
|
|
33
33
|
|
|
34
34
|
private val inAppEventListener = ReactInAppEventListener.instance
|
|
35
35
|
private val inboxChangeListener = ReactNotificationInboxChangeListener.instance
|
|
@@ -45,7 +45,7 @@ class NativeMessagingInAppModule(
|
|
|
45
45
|
private fun requireInboxInstance(): NotificationInbox? {
|
|
46
46
|
val inbox = inAppMessagingModule?.inbox()
|
|
47
47
|
if (inbox == null) {
|
|
48
|
-
logger.error("Notification Inbox is not available. Ensure
|
|
48
|
+
logger.error("Notification Inbox is not available. Ensure Zixflow SDK is initialized.")
|
|
49
49
|
}
|
|
50
50
|
return inbox
|
|
51
51
|
}
|
|
@@ -57,7 +57,7 @@ class NativeMessagingInAppModule(
|
|
|
57
57
|
}
|
|
58
58
|
// Note: Inbox change listener is set up lazily when inbox is first accessed via
|
|
59
59
|
// setupInboxListener() and not here as Notification Inbox becomes available only after
|
|
60
|
-
//
|
|
60
|
+
// Zixflow.initialize() is called, which may not have happened yet at this point.
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
override fun invalidate() {
|
|
@@ -79,7 +79,7 @@ class NativeMessagingInAppModule(
|
|
|
79
79
|
val inbox = requireInboxInstance() ?: run {
|
|
80
80
|
promise?.reject(
|
|
81
81
|
"INBOX_NOT_AVAILABLE",
|
|
82
|
-
"Notification Inbox is not available. Ensure
|
|
82
|
+
"Notification Inbox is not available. Ensure Zixflow SDK is initialized."
|
|
83
83
|
)
|
|
84
84
|
return
|
|
85
85
|
}
|
|
@@ -183,18 +183,18 @@ class NativeMessagingInAppModule(
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
companion object {
|
|
186
|
-
internal const val NAME = "
|
|
186
|
+
internal const val NAME = "NativeZixflowMessagingInApp"
|
|
187
187
|
|
|
188
188
|
/**
|
|
189
189
|
* Adds InAppMessaging module to native Android SDK based on configuration provided by customer
|
|
190
190
|
* app.
|
|
191
191
|
*
|
|
192
|
-
* @param builder
|
|
192
|
+
* @param builder ZixflowBuilder instance to add InAppMessaging module
|
|
193
193
|
* @param config Configuration provided by customer app for InAppMessaging module
|
|
194
194
|
* @param region Region to be used for InAppMessaging module
|
|
195
195
|
*/
|
|
196
196
|
internal fun addNativeModuleFromConfig(
|
|
197
|
-
builder:
|
|
197
|
+
builder: ZixflowBuilder,
|
|
198
198
|
config: Map<String, Any>,
|
|
199
199
|
region: Region
|
|
200
200
|
) {
|
|
@@ -209,7 +209,7 @@ class NativeMessagingInAppModule(
|
|
|
209
209
|
setEventListener(eventListener = ReactInAppEventListener.instance)
|
|
210
210
|
}.build(),
|
|
211
211
|
)
|
|
212
|
-
builder.
|
|
212
|
+
builder.addZixflowModule(module)
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
package
|
|
1
|
+
package com.zixflow.reactnative.sdk.messaginginapp
|
|
2
2
|
|
|
3
3
|
import com.facebook.react.bridge.Arguments
|
|
4
4
|
import com.facebook.react.bridge.WritableMap
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
5
|
+
import com.zixflow.messaginginapp.gist.data.model.InboxMessage
|
|
6
|
+
import com.zixflow.reactnative.sdk.extension.putOrNull
|
|
7
|
+
import com.zixflow.reactnative.sdk.extension.toWritableArray
|
|
8
|
+
import com.zixflow.reactnative.sdk.extension.toWritableMap
|
|
9
9
|
|
|
10
10
|
// Converts an [InboxMessage] to a [WritableMap] for React Native bridge
|
|
11
11
|
internal fun InboxMessage.toWritableMap(): WritableMap {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
package
|
|
1
|
+
package com.zixflow.reactnative.sdk.messaginginapp
|
|
2
2
|
|
|
3
3
|
import com.facebook.react.bridge.Arguments
|
|
4
4
|
import com.facebook.react.bridge.ReadableMap
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import com.zixflow.messaginginapp.type.InAppEventListener
|
|
6
|
+
import com.zixflow.messaginginapp.type.InAppMessage
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* React Native bridge for
|
|
9
|
+
* React Native bridge for Zixflow in-app messaging events.
|
|
10
10
|
* Converts native SDK events to JavaScript compatible format.
|
|
11
11
|
*/
|
|
12
12
|
class ReactInAppEventListener private constructor() : InAppEventListener {
|