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,285 @@
|
|
|
1
|
+
// !$*UTF8*$!
|
|
2
|
+
{
|
|
3
|
+
archiveVersion = 1;
|
|
4
|
+
classes = {
|
|
5
|
+
};
|
|
6
|
+
objectVersion = 46;
|
|
7
|
+
objects = {
|
|
8
|
+
|
|
9
|
+
/* Begin PBXBuildFile section */
|
|
10
|
+
F4FF95D7245B92E800C19C63 /* CustomerioReactnative.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* CustomerioReactnative.swift */; };
|
|
11
|
+
F70A0C4829CB88AF00743116 /* StringExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70A0C4729CB88AF00743116 /* StringExtensions.swift */; };
|
|
12
|
+
/* End PBXBuildFile section */
|
|
13
|
+
|
|
14
|
+
/* Begin PBXCopyFilesBuildPhase section */
|
|
15
|
+
58B511D91A9E6C8500147676 /* CopyFiles */ = {
|
|
16
|
+
isa = PBXCopyFilesBuildPhase;
|
|
17
|
+
buildActionMask = 2147483647;
|
|
18
|
+
dstPath = "include/$(PRODUCT_NAME)";
|
|
19
|
+
dstSubfolderSpec = 16;
|
|
20
|
+
files = (
|
|
21
|
+
);
|
|
22
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
23
|
+
};
|
|
24
|
+
/* End PBXCopyFilesBuildPhase section */
|
|
25
|
+
|
|
26
|
+
/* Begin PBXFileReference section */
|
|
27
|
+
134814201AA4EA6300B7C361 /* libCustomerioReactnative.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCustomerioReactnative.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
28
|
+
4641179D284117EC00FB9CA9 /* CustomerioUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomerioUtils.swift; sourceTree = "<group>"; };
|
|
29
|
+
B3E7B5891CC2AC0600A0062D /* CustomerioReactnative.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomerioReactnative.m; sourceTree = "<group>"; };
|
|
30
|
+
F4FF95D5245B92E700C19C63 /* CustomerioReactnative-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CustomerioReactnative-Bridging-Header.h"; sourceTree = "<group>"; };
|
|
31
|
+
F4FF95D6245B92E800C19C63 /* CustomerioReactnative.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomerioReactnative.swift; sourceTree = "<group>"; };
|
|
32
|
+
F70A0C4729CB88AF00743116 /* StringExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringExtensions.swift; sourceTree = "<group>"; };
|
|
33
|
+
/* End PBXFileReference section */
|
|
34
|
+
|
|
35
|
+
/* Begin PBXFrameworksBuildPhase section */
|
|
36
|
+
58B511D81A9E6C8500147676 /* Frameworks */ = {
|
|
37
|
+
isa = PBXFrameworksBuildPhase;
|
|
38
|
+
buildActionMask = 2147483647;
|
|
39
|
+
files = (
|
|
40
|
+
);
|
|
41
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
42
|
+
};
|
|
43
|
+
/* End PBXFrameworksBuildPhase section */
|
|
44
|
+
|
|
45
|
+
/* Begin PBXGroup section */
|
|
46
|
+
134814211AA4EA7D00B7C361 /* Products */ = {
|
|
47
|
+
isa = PBXGroup;
|
|
48
|
+
children = (
|
|
49
|
+
134814201AA4EA6300B7C361 /* libCustomerioReactnative.a */,
|
|
50
|
+
);
|
|
51
|
+
name = Products;
|
|
52
|
+
sourceTree = "<group>";
|
|
53
|
+
};
|
|
54
|
+
58B511D21A9E6C8500147676 = {
|
|
55
|
+
isa = PBXGroup;
|
|
56
|
+
children = (
|
|
57
|
+
F70A0C4729CB88AF00743116 /* StringExtensions.swift */,
|
|
58
|
+
4641179D284117EC00FB9CA9 /* CustomerioUtils.swift */,
|
|
59
|
+
F4FF95D6245B92E800C19C63 /* CustomerioReactnative.swift */,
|
|
60
|
+
B3E7B5891CC2AC0600A0062D /* CustomerioReactnative.m */,
|
|
61
|
+
F4FF95D5245B92E700C19C63 /* CustomerioReactnative-Bridging-Header.h */,
|
|
62
|
+
134814211AA4EA7D00B7C361 /* Products */,
|
|
63
|
+
);
|
|
64
|
+
sourceTree = "<group>";
|
|
65
|
+
};
|
|
66
|
+
/* End PBXGroup section */
|
|
67
|
+
|
|
68
|
+
/* Begin PBXNativeTarget section */
|
|
69
|
+
58B511DA1A9E6C8500147676 /* CustomerioReactnative */ = {
|
|
70
|
+
isa = PBXNativeTarget;
|
|
71
|
+
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "CustomerioReactnative" */;
|
|
72
|
+
buildPhases = (
|
|
73
|
+
58B511D71A9E6C8500147676 /* Sources */,
|
|
74
|
+
58B511D81A9E6C8500147676 /* Frameworks */,
|
|
75
|
+
58B511D91A9E6C8500147676 /* CopyFiles */,
|
|
76
|
+
);
|
|
77
|
+
buildRules = (
|
|
78
|
+
);
|
|
79
|
+
dependencies = (
|
|
80
|
+
);
|
|
81
|
+
name = CustomerioReactnative;
|
|
82
|
+
productName = RCTDataManager;
|
|
83
|
+
productReference = 134814201AA4EA6300B7C361 /* libCustomerioReactnative.a */;
|
|
84
|
+
productType = "com.apple.product-type.library.static";
|
|
85
|
+
};
|
|
86
|
+
/* End PBXNativeTarget section */
|
|
87
|
+
|
|
88
|
+
/* Begin PBXProject section */
|
|
89
|
+
58B511D31A9E6C8500147676 /* Project object */ = {
|
|
90
|
+
isa = PBXProject;
|
|
91
|
+
attributes = {
|
|
92
|
+
LastUpgradeCheck = 0920;
|
|
93
|
+
ORGANIZATIONNAME = Facebook;
|
|
94
|
+
TargetAttributes = {
|
|
95
|
+
58B511DA1A9E6C8500147676 = {
|
|
96
|
+
CreatedOnToolsVersion = 6.1.1;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "CustomerioReactnative" */;
|
|
101
|
+
compatibilityVersion = "Xcode 3.2";
|
|
102
|
+
developmentRegion = English;
|
|
103
|
+
hasScannedForEncodings = 0;
|
|
104
|
+
knownRegions = (
|
|
105
|
+
English,
|
|
106
|
+
en,
|
|
107
|
+
);
|
|
108
|
+
mainGroup = 58B511D21A9E6C8500147676;
|
|
109
|
+
productRefGroup = 58B511D21A9E6C8500147676;
|
|
110
|
+
projectDirPath = "";
|
|
111
|
+
projectRoot = "";
|
|
112
|
+
targets = (
|
|
113
|
+
58B511DA1A9E6C8500147676 /* CustomerioReactnative */,
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
/* End PBXProject section */
|
|
117
|
+
|
|
118
|
+
/* Begin PBXSourcesBuildPhase section */
|
|
119
|
+
58B511D71A9E6C8500147676 /* Sources */ = {
|
|
120
|
+
isa = PBXSourcesBuildPhase;
|
|
121
|
+
buildActionMask = 2147483647;
|
|
122
|
+
files = (
|
|
123
|
+
F70A0C4829CB88AF00743116 /* StringExtensions.swift in Sources */,
|
|
124
|
+
F4FF95D7245B92E800C19C63 /* CustomerioReactnative.swift in Sources */,
|
|
125
|
+
);
|
|
126
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
127
|
+
};
|
|
128
|
+
/* End PBXSourcesBuildPhase section */
|
|
129
|
+
|
|
130
|
+
/* Begin XCBuildConfiguration section */
|
|
131
|
+
58B511ED1A9E6C8500147676 /* Debug */ = {
|
|
132
|
+
isa = XCBuildConfiguration;
|
|
133
|
+
buildSettings = {
|
|
134
|
+
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
135
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
136
|
+
CLANG_CXX_LIBRARY = "libc++";
|
|
137
|
+
CLANG_ENABLE_MODULES = YES;
|
|
138
|
+
CLANG_ENABLE_OBJC_ARC = YES;
|
|
139
|
+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
140
|
+
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
141
|
+
CLANG_WARN_COMMA = YES;
|
|
142
|
+
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
143
|
+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
144
|
+
CLANG_WARN_EMPTY_BODY = YES;
|
|
145
|
+
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
146
|
+
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
147
|
+
CLANG_WARN_INT_CONVERSION = YES;
|
|
148
|
+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
149
|
+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
150
|
+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
151
|
+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
152
|
+
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
153
|
+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
154
|
+
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
155
|
+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
156
|
+
COPY_PHASE_STRIP = NO;
|
|
157
|
+
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
158
|
+
ENABLE_TESTABILITY = YES;
|
|
159
|
+
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
160
|
+
GCC_DYNAMIC_NO_PIC = NO;
|
|
161
|
+
GCC_NO_COMMON_BLOCKS = YES;
|
|
162
|
+
GCC_OPTIMIZATION_LEVEL = 0;
|
|
163
|
+
GCC_PREPROCESSOR_DEFINITIONS = (
|
|
164
|
+
"DEBUG=1",
|
|
165
|
+
"$(inherited)",
|
|
166
|
+
);
|
|
167
|
+
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
|
168
|
+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
169
|
+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
170
|
+
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
171
|
+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
172
|
+
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
173
|
+
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
174
|
+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
|
175
|
+
MTL_ENABLE_DEBUG_INFO = YES;
|
|
176
|
+
ONLY_ACTIVE_ARCH = YES;
|
|
177
|
+
SDKROOT = iphoneos;
|
|
178
|
+
};
|
|
179
|
+
name = Debug;
|
|
180
|
+
};
|
|
181
|
+
58B511EE1A9E6C8500147676 /* Release */ = {
|
|
182
|
+
isa = XCBuildConfiguration;
|
|
183
|
+
buildSettings = {
|
|
184
|
+
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
185
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
186
|
+
CLANG_CXX_LIBRARY = "libc++";
|
|
187
|
+
CLANG_ENABLE_MODULES = YES;
|
|
188
|
+
CLANG_ENABLE_OBJC_ARC = YES;
|
|
189
|
+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
190
|
+
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
191
|
+
CLANG_WARN_COMMA = YES;
|
|
192
|
+
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
193
|
+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
194
|
+
CLANG_WARN_EMPTY_BODY = YES;
|
|
195
|
+
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
196
|
+
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
197
|
+
CLANG_WARN_INT_CONVERSION = YES;
|
|
198
|
+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
199
|
+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
200
|
+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
201
|
+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
202
|
+
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
203
|
+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
204
|
+
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
205
|
+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
206
|
+
COPY_PHASE_STRIP = YES;
|
|
207
|
+
ENABLE_NS_ASSERTIONS = NO;
|
|
208
|
+
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
209
|
+
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
210
|
+
GCC_NO_COMMON_BLOCKS = YES;
|
|
211
|
+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
212
|
+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
213
|
+
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
214
|
+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
215
|
+
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
216
|
+
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
217
|
+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
|
218
|
+
MTL_ENABLE_DEBUG_INFO = NO;
|
|
219
|
+
SDKROOT = iphoneos;
|
|
220
|
+
VALIDATE_PRODUCT = YES;
|
|
221
|
+
};
|
|
222
|
+
name = Release;
|
|
223
|
+
};
|
|
224
|
+
58B511F01A9E6C8500147676 /* Debug */ = {
|
|
225
|
+
isa = XCBuildConfiguration;
|
|
226
|
+
buildSettings = {
|
|
227
|
+
HEADER_SEARCH_PATHS = (
|
|
228
|
+
"$(inherited)",
|
|
229
|
+
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
230
|
+
"$(SRCROOT)/../../../React/**",
|
|
231
|
+
"$(SRCROOT)/../../react-native/React/**",
|
|
232
|
+
);
|
|
233
|
+
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
234
|
+
OTHER_LDFLAGS = "-ObjC";
|
|
235
|
+
PRODUCT_NAME = CustomerioReactnative;
|
|
236
|
+
SKIP_INSTALL = YES;
|
|
237
|
+
SWIFT_OBJC_BRIDGING_HEADER = "CustomerioReactnative-Bridging-Header.h";
|
|
238
|
+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
|
239
|
+
SWIFT_VERSION = 5.0;
|
|
240
|
+
};
|
|
241
|
+
name = Debug;
|
|
242
|
+
};
|
|
243
|
+
58B511F11A9E6C8500147676 /* Release */ = {
|
|
244
|
+
isa = XCBuildConfiguration;
|
|
245
|
+
buildSettings = {
|
|
246
|
+
HEADER_SEARCH_PATHS = (
|
|
247
|
+
"$(inherited)",
|
|
248
|
+
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
249
|
+
"$(SRCROOT)/../../../React/**",
|
|
250
|
+
"$(SRCROOT)/../../react-native/React/**",
|
|
251
|
+
);
|
|
252
|
+
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
253
|
+
OTHER_LDFLAGS = "-ObjC";
|
|
254
|
+
PRODUCT_NAME = CustomerioReactnative;
|
|
255
|
+
SKIP_INSTALL = YES;
|
|
256
|
+
SWIFT_OBJC_BRIDGING_HEADER = "CustomerioReactnative-Bridging-Header.h";
|
|
257
|
+
SWIFT_VERSION = 5.0;
|
|
258
|
+
};
|
|
259
|
+
name = Release;
|
|
260
|
+
};
|
|
261
|
+
/* End XCBuildConfiguration section */
|
|
262
|
+
|
|
263
|
+
/* Begin XCConfigurationList section */
|
|
264
|
+
58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "CustomerioReactnative" */ = {
|
|
265
|
+
isa = XCConfigurationList;
|
|
266
|
+
buildConfigurations = (
|
|
267
|
+
58B511ED1A9E6C8500147676 /* Debug */,
|
|
268
|
+
58B511EE1A9E6C8500147676 /* Release */,
|
|
269
|
+
);
|
|
270
|
+
defaultConfigurationIsVisible = 0;
|
|
271
|
+
defaultConfigurationName = Release;
|
|
272
|
+
};
|
|
273
|
+
58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "CustomerioReactnative" */ = {
|
|
274
|
+
isa = XCConfigurationList;
|
|
275
|
+
buildConfigurations = (
|
|
276
|
+
58B511F01A9E6C8500147676 /* Debug */,
|
|
277
|
+
58B511F11A9E6C8500147676 /* Release */,
|
|
278
|
+
);
|
|
279
|
+
defaultConfigurationIsVisible = 0;
|
|
280
|
+
defaultConfigurationName = Release;
|
|
281
|
+
};
|
|
282
|
+
/* End XCConfigurationList section */
|
|
283
|
+
};
|
|
284
|
+
rootObject = 58B511D31A9E6C8500147676 /* Project object */;
|
|
285
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#import "utils/RCTCustomerIOUtils.h"
|
|
2
|
+
#import <React/RCTBridgeModule.h>
|
|
3
|
+
#import <RNZixflowSpec/RNZixflowSpec.h>
|
|
4
|
+
|
|
5
|
+
// Objective-C wrapper for new architecture TurboModule implementation
|
|
6
|
+
@interface RCTNativeCustomerIO : NSObject <NativeCustomerIOSpec>
|
|
7
|
+
// Bridge to Swift implementation for cross-language compatibility
|
|
8
|
+
@property(nonatomic, strong) id<NativeCustomerIOSpec> swiftBridge;
|
|
9
|
+
@end
|
|
10
|
+
|
|
11
|
+
@implementation RCTNativeCustomerIO
|
|
12
|
+
|
|
13
|
+
RCT_EXPORT_MODULE()
|
|
14
|
+
|
|
15
|
+
// Create TurboModule instance for new architecture JSI integration
|
|
16
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
17
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params {
|
|
18
|
+
return std::make_shared<facebook::react::NativeCustomerIOSpecJSI>(params);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Validates Swift bridge is available before method calls
|
|
22
|
+
- (void)assertBridgeAvailable:(NSString *)context {
|
|
23
|
+
RCT_ASSERT_BRIDGE_AVAILABLE(self.swiftBridge, context);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
- (instancetype)init {
|
|
27
|
+
if (self = [super init]) {
|
|
28
|
+
// Use runtime class lookup to avoid import issues and circular dependencies
|
|
29
|
+
Class swiftClass = NSClassFromString(@"NativeCustomerIO");
|
|
30
|
+
RCT_ASSERT_NOT_NIL(swiftClass, @"NativeCustomerIO Swift class", @"during runtime lookup");
|
|
31
|
+
_swiftBridge = [[swiftClass alloc] init];
|
|
32
|
+
[self assertBridgeAvailable:@"creating NativeCustomerIO Swift instance"];
|
|
33
|
+
}
|
|
34
|
+
return self;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Module initialization can happen on background thread
|
|
38
|
+
+ (BOOL)requiresMainQueueSetup {
|
|
39
|
+
return NO;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
- (void)initialize:(NSDictionary *)config
|
|
43
|
+
args:(NSDictionary *)args
|
|
44
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
45
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
46
|
+
[self assertBridgeAvailable:@"during initialize"];
|
|
47
|
+
[_swiftBridge initialize:config args:args resolve:resolve reject:reject];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
- (void)identify:(NSDictionary *)params {
|
|
51
|
+
[self assertBridgeAvailable:@"during identify"];
|
|
52
|
+
[_swiftBridge identify:params];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
- (void)clearIdentify {
|
|
56
|
+
[self assertBridgeAvailable:@"during clearIdentify"];
|
|
57
|
+
[_swiftBridge clearIdentify];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
- (void)track:(NSString *)name properties:(NSDictionary *)properties {
|
|
61
|
+
[self assertBridgeAvailable:@"during track"];
|
|
62
|
+
[_swiftBridge track:name properties:properties];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
- (void)screen:(NSString *)title properties:(NSDictionary *)properties {
|
|
66
|
+
[self assertBridgeAvailable:@"during screen"];
|
|
67
|
+
[_swiftBridge screen:title properties:properties];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
- (void)setProfileAttributes:(NSDictionary *)attributes {
|
|
71
|
+
[self assertBridgeAvailable:@"during setProfileAttributes"];
|
|
72
|
+
[_swiftBridge setProfileAttributes:attributes];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
- (void)setDeviceAttributes:(NSDictionary *)attributes {
|
|
76
|
+
[self assertBridgeAvailable:@"during setDeviceAttributes"];
|
|
77
|
+
[_swiftBridge setDeviceAttributes:attributes];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
- (void)registerDeviceToken:(NSString *)token {
|
|
81
|
+
[self assertBridgeAvailable:@"during registerDeviceToken"];
|
|
82
|
+
[_swiftBridge registerDeviceToken:token];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
- (void)trackMetric:(NSString *)deliveryID
|
|
86
|
+
deviceToken:(NSString *)deviceToken
|
|
87
|
+
event:(NSString *)event {
|
|
88
|
+
[self assertBridgeAvailable:@"during trackMetric"];
|
|
89
|
+
[_swiftBridge trackMetric:deliveryID deviceToken:deviceToken event:event];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
- (void)deleteDeviceToken {
|
|
93
|
+
[self assertBridgeAvailable:@"during deleteDeviceToken"];
|
|
94
|
+
[_swiftBridge deleteDeviceToken];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Export class factory function for React Native component registration
|
|
98
|
+
Class<RCTBridgeModule> NativeCustomerIOCls(void) { return RCTNativeCustomerIO.class; }
|
|
99
|
+
|
|
100
|
+
@end
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import CioAnalytics
|
|
2
|
+
import CioDataPipelines
|
|
3
|
+
import CioInternalCommon
|
|
4
|
+
import CioMessagingInApp
|
|
5
|
+
|
|
6
|
+
@objc(NativeCustomerIO)
|
|
7
|
+
public class NativeCustomerIO: NSObject {
|
|
8
|
+
private let logger: CioInternalCommon.Logger = DIGraphShared.shared.logger
|
|
9
|
+
/// Checks whether the CustomerIO SDK has been initialized.
|
|
10
|
+
/// Returns `true` if the SDK has been successfully initialized, `false` otherwise.
|
|
11
|
+
private var isInitialized: Bool { CustomerIO.shared.implementation != nil }
|
|
12
|
+
|
|
13
|
+
/// Ensures that the CustomerIO SDK is initialized before performing operations.
|
|
14
|
+
/// Logs an error and returns false if the SDK is not initialized.
|
|
15
|
+
private func ensureInitialized() -> Bool {
|
|
16
|
+
guard isInitialized else {
|
|
17
|
+
logger.error("CustomerIO SDK is not initialized. Please call initialize() first.")
|
|
18
|
+
return false
|
|
19
|
+
}
|
|
20
|
+
return true
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@objc
|
|
24
|
+
func initialize(
|
|
25
|
+
_ config: [String: Any],
|
|
26
|
+
args: [String: Any],
|
|
27
|
+
resolve: @escaping (RCTPromiseResolveBlock),
|
|
28
|
+
reject: @escaping (RCTPromiseRejectBlock)
|
|
29
|
+
) {
|
|
30
|
+
// Skip initialization if already initialized
|
|
31
|
+
if isInitialized {
|
|
32
|
+
logger.info("CustomerIO SDK is already initialized. Skipping initialization.")
|
|
33
|
+
resolve(true)
|
|
34
|
+
return
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
do {
|
|
38
|
+
let packageSource = args["packageSource"] as? String
|
|
39
|
+
let packageVersion = args["packageVersion"] as? String
|
|
40
|
+
|
|
41
|
+
// Override SDK client info to include wrapper metadata in user agent
|
|
42
|
+
if let source = packageSource, let sdkVersion = packageVersion {
|
|
43
|
+
DIGraphShared.shared.override(
|
|
44
|
+
value: CustomerIOSdkClient(source: source, sdkVersion: sdkVersion),
|
|
45
|
+
forType: SdkClient.self
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
let sdkConfigBuilder = try SDKConfigBuilder.create(from: config)
|
|
50
|
+
|
|
51
|
+
#if CIO_LOCATION_ENABLED
|
|
52
|
+
if let locationModule = NativeLocation.module(from: config) {
|
|
53
|
+
_ = sdkConfigBuilder.addModule(locationModule)
|
|
54
|
+
}
|
|
55
|
+
#endif
|
|
56
|
+
|
|
57
|
+
let builtConfig = sdkConfigBuilder.build()
|
|
58
|
+
|
|
59
|
+
// Only CustomerIO.initialize must run on the main thread (e.g. for Location module).
|
|
60
|
+
DispatchQueue.main.async { [weak self] in
|
|
61
|
+
guard let self = self else {
|
|
62
|
+
reject(CustomerioConstants.cioTag, "Error initializing Customer.io SDK", nil)
|
|
63
|
+
return
|
|
64
|
+
}
|
|
65
|
+
CustomerIO.initialize(withConfig: builtConfig)
|
|
66
|
+
|
|
67
|
+
do {
|
|
68
|
+
// Initialize in-app messaging if config provided
|
|
69
|
+
if let inAppConfig = try MessagingInAppConfigBuilder.build(from: config) {
|
|
70
|
+
MessagingInApp.initialize(withConfig: inAppConfig)
|
|
71
|
+
MessagingInApp.shared.setEventListener(ReactInAppEventListener.shared)
|
|
72
|
+
}
|
|
73
|
+
} catch {
|
|
74
|
+
self.logger.error("[InApp] Failed to initialize module with error: \(error)")
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
self.logger.debug(
|
|
78
|
+
"Customer.io SDK (\(packageSource ?? "") \(packageVersion ?? "")) initialized with config: \(config)"
|
|
79
|
+
)
|
|
80
|
+
resolve(true)
|
|
81
|
+
}
|
|
82
|
+
} catch {
|
|
83
|
+
logger.error("Initializing Customer.io SDK failed with error: \(error)")
|
|
84
|
+
reject(CustomerioConstants.cioTag, "Error initializing Customer.io SDK", nil)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@objc
|
|
89
|
+
func identify(_ params: [String: Any]?) {
|
|
90
|
+
guard ensureInitialized() else { return }
|
|
91
|
+
|
|
92
|
+
let userId = params?["userId"] as? String
|
|
93
|
+
let traits = params?["traits"] as? [String: Any]
|
|
94
|
+
|
|
95
|
+
if let userId = userId {
|
|
96
|
+
// Identify with userId and optional traits
|
|
97
|
+
CustomerIO.shared.identify(userId: userId, traits: traits)
|
|
98
|
+
} else if traits != nil {
|
|
99
|
+
// Anonymous profile identification with traits only
|
|
100
|
+
if let traitsJson = try? JSON(traits as Any) {
|
|
101
|
+
CustomerIO.shared.identify(traits: traitsJson)
|
|
102
|
+
} else {
|
|
103
|
+
logger.error("Unable to parse traits to JSON: \(String(describing: traits))")
|
|
104
|
+
}
|
|
105
|
+
} else {
|
|
106
|
+
logger.error("Provide id or traits to identify a user profile.")
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@objc
|
|
111
|
+
func clearIdentify() {
|
|
112
|
+
guard ensureInitialized() else { return }
|
|
113
|
+
CustomerIO.shared.clearIdentify()
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@objc
|
|
117
|
+
func track(_ name: String, properties: [String: Any]?) {
|
|
118
|
+
guard ensureInitialized() else { return }
|
|
119
|
+
CustomerIO.shared.track(name: name, properties: properties)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@objc
|
|
123
|
+
func screen(_ title: String, properties: [String: Any]?) {
|
|
124
|
+
guard ensureInitialized() else { return }
|
|
125
|
+
CustomerIO.shared.screen(title: title, properties: properties)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@objc
|
|
129
|
+
func setProfileAttributes(_ attributes: [String: Any]) {
|
|
130
|
+
guard ensureInitialized() else { return }
|
|
131
|
+
CustomerIO.shared.setProfileAttributes(attributes)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@objc
|
|
135
|
+
func setDeviceAttributes(_ attributes: [String: Any]) {
|
|
136
|
+
guard ensureInitialized() else { return }
|
|
137
|
+
CustomerIO.shared.setDeviceAttributes(attributes)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@objc
|
|
141
|
+
func registerDeviceToken(_ token: String) {
|
|
142
|
+
guard ensureInitialized() else { return }
|
|
143
|
+
CustomerIO.shared.registerDeviceToken(token)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@objc
|
|
147
|
+
func trackMetric(_ deliveryId: String, deviceToken: String, event: String) {
|
|
148
|
+
guard ensureInitialized() else { return }
|
|
149
|
+
guard let metricEvent = Metric.getEvent(from: event) else {
|
|
150
|
+
logger.error("Invalid metric event: \(event)")
|
|
151
|
+
return
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
CustomerIO.shared.trackMetric(deliveryID: deliveryId, event: metricEvent, deviceToken: deviceToken)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@objc
|
|
158
|
+
func deleteDeviceToken() {
|
|
159
|
+
guard ensureInitialized() else { return }
|
|
160
|
+
CustomerIO.shared.deleteDeviceToken()
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import CioMessagingInApp
|
|
2
|
+
import Foundation
|
|
3
|
+
|
|
4
|
+
// MARK: - InboxMessage Conversion Extension
|
|
5
|
+
|
|
6
|
+
extension InboxMessage {
|
|
7
|
+
/// Converts InboxMessage to dictionary for React Native bridge
|
|
8
|
+
/// Note: Uses NSNull for nil optional values to match Android behavior (explicit null vs undefined)
|
|
9
|
+
func toDictionary() -> [String: Any] {
|
|
10
|
+
return [
|
|
11
|
+
"queueId": queueId,
|
|
12
|
+
"deliveryId": deliveryId ?? NSNull(),
|
|
13
|
+
"sentAt": sentAt.timeIntervalSince1970 * 1000, // Convert to milliseconds
|
|
14
|
+
"expiry": expiry.map { $0.timeIntervalSince1970 * 1000 } ?? NSNull(),
|
|
15
|
+
"type": type,
|
|
16
|
+
"opened": opened,
|
|
17
|
+
"topics": topics,
|
|
18
|
+
"priority": priority ?? NSNull(),
|
|
19
|
+
"properties": properties
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
}
|