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,19 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
|
|
3
|
+
#ifndef RCTCustomerIOUtils_h
|
|
4
|
+
#define RCTCustomerIOUtils_h
|
|
5
|
+
|
|
6
|
+
/// Utility macro for asserting object availability in React Native wrappers
|
|
7
|
+
#define RCT_ASSERT_NOT_NIL(object, label, context) \
|
|
8
|
+
NSAssert((object) != nil, @"%@ is nil when %@", (label), (context))
|
|
9
|
+
|
|
10
|
+
/// Alias for bridge-specific assertions
|
|
11
|
+
#define RCT_ASSERT_BRIDGE_AVAILABLE(bridge, context) \
|
|
12
|
+
RCT_ASSERT_NOT_NIL((bridge), @"Bridge", (context))
|
|
13
|
+
|
|
14
|
+
/// Logs a warning for methods that are only needed in legacy architecture
|
|
15
|
+
#define RCT_LEGACY_ARCH_WARNING(methodName) \
|
|
16
|
+
NSLog(@"Warning: '%@' is not required in the New Architecture and should not be called.", \
|
|
17
|
+
@ #methodName)
|
|
18
|
+
|
|
19
|
+
#endif /* RCTCustomerIOUtils_h */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["cio-params.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _InlineMessageNativeComponent = _interopRequireWildcard(require("../specs/components/InlineMessageNativeComponent"));
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
|
+
/**
|
|
13
|
+
* Props for the InlineInAppMessageView component.
|
|
14
|
+
*/
|
|
15
|
+
/** @public */
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A React Native component for displaying inline in-app messages with animated sizing
|
|
19
|
+
* and customizable loading states.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <InlineInAppMessageView
|
|
24
|
+
* elementId="my-message"
|
|
25
|
+
* loadingIndicatorProps={{ minimumHeight: 50 }}
|
|
26
|
+
* style={{ width: '100%' }}
|
|
27
|
+
* onActionClick={(message, actionValue, actionName) => {
|
|
28
|
+
* console.log('Action clicked:', { message, actionValue, actionName });
|
|
29
|
+
* }}
|
|
30
|
+
* />
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
/** @public */
|
|
34
|
+
const InlineInAppMessageView = ({
|
|
35
|
+
style,
|
|
36
|
+
loadingComponent,
|
|
37
|
+
loadingIndicatorProps,
|
|
38
|
+
loadingContainerStyle,
|
|
39
|
+
onActionClick,
|
|
40
|
+
...props
|
|
41
|
+
}) => {
|
|
42
|
+
// Animation values for dynamic sizing
|
|
43
|
+
const animatedWidth = (0, _react.useRef)(null);
|
|
44
|
+
const animatedHeight = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
|
|
45
|
+
const [isLoading, setIsLoading] = (0, _react.useState)(false);
|
|
46
|
+
|
|
47
|
+
// Extract width from style prop for priority handling
|
|
48
|
+
const styleProvidedWidth = (0, _react.useMemo)(() => {
|
|
49
|
+
const flatStyle = _reactNative.StyleSheet.flatten(style);
|
|
50
|
+
return flatStyle?.width;
|
|
51
|
+
}, [style]);
|
|
52
|
+
|
|
53
|
+
// Type guard to check if a value is a valid number to ensure we only animate valid dimensions
|
|
54
|
+
const isValidNumber = value => value !== null && value !== undefined;
|
|
55
|
+
|
|
56
|
+
// Helper function to create an animation for width or height changes
|
|
57
|
+
const createAnimation = (animatedValue, value, duration) => _reactNative.Animated.timing(animatedValue, {
|
|
58
|
+
toValue: value,
|
|
59
|
+
duration,
|
|
60
|
+
useNativeDriver: false // Layout animations require JS driver
|
|
61
|
+
});
|
|
62
|
+
const handleSizeChange = event => {
|
|
63
|
+
const {
|
|
64
|
+
width,
|
|
65
|
+
height,
|
|
66
|
+
duration = 200
|
|
67
|
+
} = event.nativeEvent;
|
|
68
|
+
const animations = [];
|
|
69
|
+
if (isValidNumber(width)) {
|
|
70
|
+
if (!animatedWidth.current) {
|
|
71
|
+
animatedWidth.current = new _reactNative.Animated.Value(width);
|
|
72
|
+
}
|
|
73
|
+
animations.push(createAnimation(animatedWidth.current, width, duration));
|
|
74
|
+
}
|
|
75
|
+
if (isValidNumber(height)) {
|
|
76
|
+
animations.push(createAnimation(animatedHeight, height, duration));
|
|
77
|
+
}
|
|
78
|
+
if (animations.length > 0) {
|
|
79
|
+
_reactNative.Animated.parallel(animations).start();
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const handleStateChange = event => {
|
|
83
|
+
// Native component sends state as 'result' property
|
|
84
|
+
const state = event.nativeEvent.result || event.nativeEvent.state;
|
|
85
|
+
switch (state) {
|
|
86
|
+
case _InlineMessageNativeComponent.InlineMessageState.LoadingStarted:
|
|
87
|
+
setIsLoading(true);
|
|
88
|
+
createAnimation(animatedHeight, loadingIndicatorProps?.minimumHeight ?? 48,
|
|
89
|
+
// Default: ActivityIndicator + padding
|
|
90
|
+
0 // Immediate height change for loading state
|
|
91
|
+
).start();
|
|
92
|
+
break;
|
|
93
|
+
case _InlineMessageNativeComponent.InlineMessageState.LoadingFinished:
|
|
94
|
+
case _InlineMessageNativeComponent.InlineMessageState.NoMessageToDisplay:
|
|
95
|
+
setIsLoading(false);
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const handleActionClick = event => {
|
|
100
|
+
const {
|
|
101
|
+
message,
|
|
102
|
+
actionValue,
|
|
103
|
+
actionName
|
|
104
|
+
} = event.nativeEvent;
|
|
105
|
+
onActionClick?.(message, actionValue, actionName);
|
|
106
|
+
};
|
|
107
|
+
const renderLoadingComponent = () => {
|
|
108
|
+
if (loadingComponent) {
|
|
109
|
+
return loadingComponent;
|
|
110
|
+
}
|
|
111
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
112
|
+
style: [styles.loadingContainer, loadingContainerStyle],
|
|
113
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
|
|
114
|
+
size: "small",
|
|
115
|
+
...loadingIndicatorProps
|
|
116
|
+
})
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Animated.View, {
|
|
120
|
+
style: [style, {
|
|
121
|
+
// Priority: Style prop -> Native width -> Default (100%)
|
|
122
|
+
width: styleProvidedWidth ?? (animatedWidth.current || '100%'),
|
|
123
|
+
height: animatedHeight
|
|
124
|
+
}],
|
|
125
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_InlineMessageNativeComponent.default, {
|
|
126
|
+
...props,
|
|
127
|
+
style: styles.nativeComponent,
|
|
128
|
+
onSizeChange: handleSizeChange,
|
|
129
|
+
onStateChange: handleStateChange,
|
|
130
|
+
onActionClick: handleActionClick
|
|
131
|
+
}), isLoading && renderLoadingComponent()]
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
const styles = _reactNative.StyleSheet.create({
|
|
135
|
+
nativeComponent: {
|
|
136
|
+
width: '100%',
|
|
137
|
+
height: '100%'
|
|
138
|
+
},
|
|
139
|
+
loadingContainer: {
|
|
140
|
+
..._reactNative.StyleSheet.absoluteFillObject,
|
|
141
|
+
justifyContent: 'center',
|
|
142
|
+
alignItems: 'center'
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
var _default = exports.default = InlineInAppMessageView;
|
|
146
|
+
//# sourceMappingURL=InlineInAppMessageView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_InlineMessageNativeComponent","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","InlineInAppMessageView","style","loadingComponent","loadingIndicatorProps","loadingContainerStyle","onActionClick","props","animatedWidth","useRef","animatedHeight","Animated","Value","current","isLoading","setIsLoading","useState","styleProvidedWidth","useMemo","flatStyle","StyleSheet","flatten","width","isValidNumber","value","undefined","createAnimation","animatedValue","duration","timing","toValue","useNativeDriver","handleSizeChange","event","height","nativeEvent","animations","push","length","parallel","start","handleStateChange","state","result","InlineMessageState","LoadingStarted","minimumHeight","LoadingFinished","NoMessageToDisplay","handleActionClick","message","actionValue","actionName","renderLoadingComponent","jsx","View","styles","loadingContainer","children","ActivityIndicator","size","jsxs","nativeComponent","onSizeChange","onStateChange","create","absoluteFillObject","justifyContent","alignItems","_default","exports"],"sourceRoot":"../../../src","sources":["components/InlineInAppMessageView.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAQA,IAAAE,6BAAA,GAAAH,uBAAA,CAAAC,OAAA;AAM0D,IAAAG,WAAA,GAAAH,OAAA;AAAA,SAAAD,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,CAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,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,GAAGpC,uBAAU,CAAC6C,MAAM,CAAC;EAC/BH,eAAe,EAAE;IACfxC,KAAK,EAAE,MAAM;IACbY,MAAM,EAAE;EACV,CAAC;EACDuB,gBAAgB,EAAE;IAChB,GAAGrC,uBAAU,CAAC8C,kBAAkB;IAChCC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA9E,OAAA,GAEYS,sBAAsB","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "InlineInAppMessageView", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _InlineInAppMessageView.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _InlineInAppMessageView = _interopRequireDefault(require("./InlineInAppMessageView.js"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_InlineInAppMessageView","_interopRequireDefault","require","e","__esModule","default"],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;;;;;;;;;;AAEA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA6E,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CustomerIO = void 0;
|
|
7
|
+
var _customerioInapp = require("./customerio-inapp.js");
|
|
8
|
+
var _customerioLocation = require("./customerio-location.js");
|
|
9
|
+
var _customerioPush = require("./customerio-push.js");
|
|
10
|
+
var _nativeLoggerListener = require("./native-logger-listener.js");
|
|
11
|
+
var _NativeCustomerIO = _interopRequireDefault(require("./specs/modules/NativeCustomerIO.js"));
|
|
12
|
+
var _index = require("./types/index.js");
|
|
13
|
+
var _nativeBridge = require("./utils/native-bridge.js");
|
|
14
|
+
var _paramValidation = require("./utils/param-validation.js");
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
const packageJson = require('../../package.json');
|
|
17
|
+
|
|
18
|
+
// Track whether CustomerIO SDK has been initialized to prevent usage before setup
|
|
19
|
+
let _initialized = false;
|
|
20
|
+
|
|
21
|
+
// Reference to the native CustomerIO Data Pipelines module for SDK operations
|
|
22
|
+
const nativeModule = (0, _nativeBridge.ensureNativeModule)(_NativeCustomerIO.default);
|
|
23
|
+
|
|
24
|
+
// Wrapper function that ensures SDK is initialized before calling native methods
|
|
25
|
+
const withNativeModule = fn => {
|
|
26
|
+
return (0, _nativeBridge.callNativeModule)(nativeModule, fn);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/** @public */
|
|
30
|
+
class CustomerIO {
|
|
31
|
+
/** Initialize the CustomerIO SDK with given configuration. */
|
|
32
|
+
static initialize = async config => {
|
|
33
|
+
_paramValidation.assert.config(config);
|
|
34
|
+
if (config.logLevel && config.logLevel !== _index.CioLogLevel.None) {
|
|
35
|
+
_nativeLoggerListener.NativeLoggerListener.initialize();
|
|
36
|
+
}
|
|
37
|
+
const expoVersion = packageJson.expoVersion ?? '';
|
|
38
|
+
const args = {
|
|
39
|
+
packageSource: expoVersion ? 'Expo' : 'ReactNative',
|
|
40
|
+
packageVersion: expoVersion || packageJson.version || ''
|
|
41
|
+
};
|
|
42
|
+
const promise = (0, _nativeBridge.callNativeModule)(_NativeCustomerIO.default, native => native.initialize(config, args));
|
|
43
|
+
return promise.then(() => {
|
|
44
|
+
_initialized = true;
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** Identify a user to start tracking their activity. Requires userId, traits, or both. */
|
|
49
|
+
static identify = async ({
|
|
50
|
+
userId,
|
|
51
|
+
traits
|
|
52
|
+
} = {}) => {
|
|
53
|
+
if (_paramValidation.validate.isUndefined(userId) && _paramValidation.validate.isUndefined(traits)) {
|
|
54
|
+
throw new Error('You must provide either userId or traits to identify');
|
|
55
|
+
}
|
|
56
|
+
_paramValidation.assert.string(userId, 'userId', {
|
|
57
|
+
allowEmpty: false,
|
|
58
|
+
usage: 'Identify',
|
|
59
|
+
optional: true
|
|
60
|
+
});
|
|
61
|
+
const normalizedTraits = _paramValidation.assert.attributes(traits, 'traits', {
|
|
62
|
+
usage: 'Identify',
|
|
63
|
+
optional: true
|
|
64
|
+
});
|
|
65
|
+
return withNativeModule(native => native.identify({
|
|
66
|
+
userId,
|
|
67
|
+
traits: normalizedTraits
|
|
68
|
+
}));
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/** Clear current user identification and stop tracking. */
|
|
72
|
+
static clearIdentify = async () => {
|
|
73
|
+
return withNativeModule(native => native.clearIdentify());
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/** Track an event with optional properties. */
|
|
77
|
+
static track = async (name, properties) => {
|
|
78
|
+
_paramValidation.assert.string(name, 'name', {
|
|
79
|
+
usage: 'Track Event'
|
|
80
|
+
});
|
|
81
|
+
const normalizedProps = _paramValidation.assert.attributes(properties, 'properties', {
|
|
82
|
+
usage: 'Track Event',
|
|
83
|
+
optional: true
|
|
84
|
+
});
|
|
85
|
+
return withNativeModule(native => native.track(name, normalizedProps));
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/** Track a screen view event with optional properties. */
|
|
89
|
+
static screen = async (title, properties) => {
|
|
90
|
+
_paramValidation.assert.string(title, 'title', {
|
|
91
|
+
usage: 'Screen'
|
|
92
|
+
});
|
|
93
|
+
const normalizedProps = _paramValidation.assert.attributes(properties, 'properties', {
|
|
94
|
+
usage: 'Screen',
|
|
95
|
+
optional: true
|
|
96
|
+
});
|
|
97
|
+
return withNativeModule(native => native.screen(title, normalizedProps));
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/** Set or update attributes for the currently identified user profile. */
|
|
101
|
+
static setProfileAttributes = async attributes => {
|
|
102
|
+
const normalizedAttrs = _paramValidation.assert.attributes(attributes, 'attributes', {
|
|
103
|
+
usage: 'Profile'
|
|
104
|
+
});
|
|
105
|
+
return withNativeModule(native => native.setProfileAttributes(normalizedAttrs));
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/** Set attributes for the current device. */
|
|
109
|
+
static setDeviceAttributes = async attributes => {
|
|
110
|
+
const normalizedAttrs = _paramValidation.assert.attributes(attributes, 'attributes', {
|
|
111
|
+
usage: 'Device'
|
|
112
|
+
});
|
|
113
|
+
return withNativeModule(native => native.setDeviceAttributes(normalizedAttrs));
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/** Register a device token for push notifications. */
|
|
117
|
+
static registerDeviceToken = async token => {
|
|
118
|
+
_paramValidation.assert.string(token, 'token', {
|
|
119
|
+
usage: 'Device'
|
|
120
|
+
});
|
|
121
|
+
return withNativeModule(native => native.registerDeviceToken(token));
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/** Remove the current device token to stop receiving push notifications. */
|
|
125
|
+
static deleteDeviceToken = async () => {
|
|
126
|
+
return withNativeModule(native => native.deleteDeviceToken());
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/** Track push notification metrics for delivered, opened, or converted events. */
|
|
130
|
+
static trackMetric = async ({
|
|
131
|
+
deliveryID,
|
|
132
|
+
deviceToken,
|
|
133
|
+
event
|
|
134
|
+
}) => {
|
|
135
|
+
_paramValidation.assert.string(deliveryID, 'deliveryID', {
|
|
136
|
+
usage: 'Track Metric'
|
|
137
|
+
});
|
|
138
|
+
_paramValidation.assert.string(deviceToken, 'deviceToken', {
|
|
139
|
+
usage: 'Track Metric'
|
|
140
|
+
});
|
|
141
|
+
_paramValidation.assert.string(event, 'event', {
|
|
142
|
+
usage: 'Track Metric'
|
|
143
|
+
});
|
|
144
|
+
return withNativeModule(native => native.trackMetric(deliveryID, deviceToken, event));
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Check if the CustomerIO SDK has been initialized.
|
|
149
|
+
* @deprecated This method will be removed in a future version. If you need this functionality, please contact us.
|
|
150
|
+
*/
|
|
151
|
+
static isInitialized = () => _initialized;
|
|
152
|
+
static inAppMessaging = new _customerioInapp.CustomerIOInAppMessaging();
|
|
153
|
+
static location = new _customerioLocation.CustomerIOLocation();
|
|
154
|
+
static pushMessaging = new _customerioPush.CustomerIOPushMessaging();
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Initialize native logger when this module loads to ensure it's always available.
|
|
158
|
+
// Since customerio-cdp.ts is the main SDK entry point and always imported,
|
|
159
|
+
// this guarantees logger initialization even when native-logger-listener.ts
|
|
160
|
+
// isn't directly accessed, also supporting auto-initialization in Expo apps.
|
|
161
|
+
exports.CustomerIO = CustomerIO;
|
|
162
|
+
_nativeLoggerListener.NativeLoggerListener.initNativeLogger();
|
|
163
|
+
//# sourceMappingURL=customerio-cdp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_customerioInapp","require","_customerioLocation","_customerioPush","_nativeLoggerListener","_NativeCustomerIO","_interopRequireDefault","_index","_nativeBridge","_paramValidation","e","__esModule","default","packageJson","_initialized","nativeModule","ensureNativeModule","NativeModule","withNativeModule","fn","callNativeModule","CustomerIO","initialize","config","assert","logLevel","CioLogLevel","None","NativeLoggerListener","expoVersion","args","packageSource","packageVersion","version","promise","native","then","identify","userId","traits","validate","isUndefined","Error","string","allowEmpty","usage","optional","normalizedTraits","attributes","clearIdentify","track","name","properties","normalizedProps","screen","title","setProfileAttributes","normalizedAttrs","setDeviceAttributes","registerDeviceToken","token","deleteDeviceToken","trackMetric","deliveryID","deviceToken","event","isInitialized","inAppMessaging","CustomerIOInAppMessaging","location","CustomerIOLocation","pushMessaging","CustomerIOPushMessaging","exports","initNativeLogger"],"sourceRoot":"../../src","sources":["customerio-cdp.ts"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAC,sBAAA,CAAAL,OAAA;AAIA,IAAAM,MAAA,GAAAN,OAAA;AAQA,IAAAO,aAAA,GAAAP,OAAA;AACA,IAAAQ,gBAAA,GAAAR,OAAA;AAA4D,SAAAK,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE5D,MAAMG,WAAW,GAAGZ,OAAO,CAAC,oBAAoB,CAAC;;AAEjD;AACA,IAAIa,YAAY,GAAG,KAAK;;AAExB;AACA,MAAMC,YAAY,GAAG,IAAAC,gCAAkB,EAACC,yBAAY,CAAC;;AAErD;AACA,MAAMC,gBAAgB,GAAOC,EAA8B,IAAQ;EACjE,OAAO,IAAAC,8BAAgB,EAACL,YAAY,EAAEI,EAAE,CAAC;AAC3C,CAAC;;AAED;AACO,MAAME,UAAU,CAAC;EACtB;EACA,OAAgBC,UAAU,GAAG,MAAOC,MAAiB,IAAK;IACxDC,uBAAM,CAACD,MAAM,CAACA,MAAM,CAAC;IAErB,IAAIA,MAAM,CAACE,QAAQ,IAAIF,MAAM,CAACE,QAAQ,KAAKC,kBAAW,CAACC,IAAI,EAAE;MAC3DC,0CAAoB,CAACN,UAAU,CAAC,CAAC;IACnC;IAEA,MAAMO,WAAW,GAAGhB,WAAW,CAACgB,WAAW,IAAI,EAAE;IACjD,MAAMC,IAAmB,GAAG;MAC1BC,aAAa,EAAEF,WAAW,GAAG,MAAM,G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D;;AAEA;AACA;AACA;AACA;AAAAC,OAAA,CAAApD,UAAA,GAAAA,UAAA;AACAO,0CAAoB,CAAC8C,gBAAgB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.InAppMessageEvent = exports.CustomerIOInAppMessaging = void 0;
|
|
7
|
+
Object.defineProperty(exports, "InlineInAppMessageView", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _index.InlineInAppMessageView;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "NotificationInbox", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _notificationInbox.NotificationInbox;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
var _index = require("./components/index.js");
|
|
20
|
+
var _nativeLoggerListener = require("./native-logger-listener.js");
|
|
21
|
+
var _notificationInbox = require("./notification-inbox.js");
|
|
22
|
+
var _NativeCustomerIOMessagingInApp = _interopRequireDefault(require("./specs/modules/NativeCustomerIOMessagingInApp.js"));
|
|
23
|
+
var _nativeBridge = require("./utils/native-bridge.js");
|
|
24
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
25
|
+
/**
|
|
26
|
+
* Ensures all methods defined in codegen spec are implemented by the public module
|
|
27
|
+
*
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
// Reference to the native CustomerIO Data Pipelines module for SDK operations
|
|
32
|
+
const nativeModule = (0, _nativeBridge.ensureNativeModule)(_NativeCustomerIOMessagingInApp.default);
|
|
33
|
+
|
|
34
|
+
// Wrapper function that ensures SDK is initialized before calling native methods
|
|
35
|
+
const withNativeModule = fn => {
|
|
36
|
+
return (0, _nativeBridge.callNativeModule)(nativeModule, fn);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Helper class so that registering event listeners is easier for customers.
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
class CustomerIOInAppMessaging {
|
|
45
|
+
registerEventsListener(listener) {
|
|
46
|
+
const emitter = data => {
|
|
47
|
+
// Convert raw native payload to InAppMessageEvent
|
|
48
|
+
const event = new InAppMessageEvent(data.eventType, data.messageId, data.deliveryId, data.actionValue, data.actionName);
|
|
49
|
+
listener(event);
|
|
50
|
+
};
|
|
51
|
+
return withNativeModule(native => {
|
|
52
|
+
try {
|
|
53
|
+
// Register TurboModule event listener and return subscription.
|
|
54
|
+
// This method is generated by codegen in the native modules.
|
|
55
|
+
// Wrapped in try-catch due to previous reports of crashes on certain Android architectures.
|
|
56
|
+
return native.onInAppEventReceived(emitter);
|
|
57
|
+
} catch (error) {
|
|
58
|
+
_nativeLoggerListener.NativeLoggerListener.warn('Failed to attach in-app event listener:', error);
|
|
59
|
+
// Return a no-op subscription to maintain backwards compatibility
|
|
60
|
+
return {
|
|
61
|
+
remove: () => {},
|
|
62
|
+
eventType: '',
|
|
63
|
+
key: 0,
|
|
64
|
+
subscriber: null
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Dismisses any currently displayed in-app message
|
|
72
|
+
*/
|
|
73
|
+
dismissMessage() {
|
|
74
|
+
withNativeModule(native => native.dismissMessage());
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Gets the message inbox instance for managing inbox messages
|
|
79
|
+
*
|
|
80
|
+
* @returns NotificationInbox instance for fetching and managing inbox messages
|
|
81
|
+
*/
|
|
82
|
+
inbox() {
|
|
83
|
+
if (!this._notificationInbox) {
|
|
84
|
+
this._notificationInbox = new _notificationInbox.NotificationInbox();
|
|
85
|
+
}
|
|
86
|
+
return this._notificationInbox;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Class to hold in-app event attributes.
|
|
92
|
+
*/
|
|
93
|
+
/** @public */
|
|
94
|
+
exports.CustomerIOInAppMessaging = CustomerIOInAppMessaging;
|
|
95
|
+
class InAppMessageEvent {
|
|
96
|
+
constructor(eventType, messageId, deliveryId, actionValue, actionName) {
|
|
97
|
+
this.eventType = eventType;
|
|
98
|
+
this.deliveryId = deliveryId;
|
|
99
|
+
this.messageId = messageId;
|
|
100
|
+
this.actionValue = actionValue;
|
|
101
|
+
this.actionName = actionName;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Export in-app messaging types and components for simplified imports
|
|
106
|
+
exports.InAppMessageEvent = InAppMessageEvent;
|
|
107
|
+
//# sourceMappingURL=customerio-inapp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_index","require","_nativeLoggerListener","_notificationInbox","_NativeCustomerIOMessagingInApp","_interopRequireDefault","_nativeBridge","e","__esModule","default","nativeModule","ensureNativeModule","NativeCustomerIOMessagingInApp","withNativeModule","fn","callNativeModule","CustomerIOInAppMessaging","registerEventsListener","listener","emitter","data","event","InAppMessageEvent","eventType","messageId","deliveryId","actionValue","actionName","native","onInAppEventReceived","error","NativeLoggerListener","warn","remove","key","subscriber","dismissMessage","inbox","NotificationInbox","exports","constructor"],"sourceRoot":"../../src","sources":["customerio-inapp.ts"],"mappings":";;;;;;;;;;;;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAF,OAAA;AAIA,IAAAG,+BAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAIA,IAAAK,aAAA,GAAAL,OAAA;AAA6E,SAAAI,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF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IACnD;IACA,OAAO,IAAI,CAACnC,kBAAkB;EAChC;AACF;;AAEA;AACA;AACA;AACA;AAAAoC,OAAA,CAAAvB,wBAAA,GAAAA,wBAAA;AACA,MAAMM,iBAAiB,CAAC;EAOtBkB,WAAWA,CACTjB,SAAgC,EAChCC,SAAiB,EACjBC,UAAmB,EACnBC,WAAoB,EACpBC,UAAmB,EACnB;IACA,IAAI,CAACJ,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACE,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACD,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACE,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACC,UAAU,GAAGA,UAAU;EAC9B;AACF;;AAEA;AAAAY,OAAA,CAAAjB,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CustomerIOLocation = void 0;
|
|
7
|
+
var _NativeCustomerIOLocation = _interopRequireDefault(require("./specs/modules/NativeCustomerIOLocation.js"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
/**
|
|
10
|
+
* Ensures all methods defined in codegen spec are implemented by the public module
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
// Location is an optional module — NativeModule may be null when location is not enabled.
|
|
16
|
+
// Methods silently no-op when the native module is unavailable, with a one-time dev warning.
|
|
17
|
+
let hasWarnedNotEnabled = false;
|
|
18
|
+
const withNativeModule = fn => {
|
|
19
|
+
if (_NativeCustomerIOLocation.default) {
|
|
20
|
+
fn(_NativeCustomerIOLocation.default);
|
|
21
|
+
} else if (__DEV__ && !hasWarnedNotEnabled) {
|
|
22
|
+
hasWarnedNotEnabled = true;
|
|
23
|
+
console.warn('Customer.io: Location module is not enabled. ' + 'To use location features, set customerio_location_enabled=true in ' + 'gradle.properties (Android) or add the location subspec to your Podfile (iOS).');
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/** @public */
|
|
28
|
+
class CustomerIOLocation {
|
|
29
|
+
/**
|
|
30
|
+
* Sets the last known location from the host app's existing location system.
|
|
31
|
+
* Use this when your app already manages location and you want to send that data
|
|
32
|
+
* to Customer.io without the SDK managing location permissions directly.
|
|
33
|
+
*
|
|
34
|
+
* @param latitude - Latitude in degrees, must be between -90 and 90
|
|
35
|
+
* @param longitude - Longitude in degrees, must be between -180 and 180
|
|
36
|
+
*/
|
|
37
|
+
setLastKnownLocation(latitude, longitude) {
|
|
38
|
+
return withNativeModule(native => native.setLastKnownLocation(latitude, longitude));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Requests a single location update and sends the result to Customer.io.
|
|
43
|
+
* No-ops if location tracking is disabled or permission is not granted.
|
|
44
|
+
*
|
|
45
|
+
* The SDK does not request location permission. The host app must request
|
|
46
|
+
* runtime permissions and only call this when permission is granted.
|
|
47
|
+
*/
|
|
48
|
+
requestLocationUpdate() {
|
|
49
|
+
return withNativeModule(native => native.requestLocationUpdate());
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.CustomerIOLocation = CustomerIOLocation;
|
|
53
|
+
//# sourceMappingURL=customerio-location.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_NativeCustomerIOLocation","_interopRequireDefault","require","e","__esModule","default","hasWarnedNotEnabled","withNativeModule","fn","NativeModule","__DEV__","console","warn","CustomerIOLocation","setLastKnownLocation","latitude","longitude","native","requestLocationUpdate","exports"],"sourceRoot":"../../src","sources":["customerio-location.ts"],"mappings":";;;;;;AACA,IAAAA,yBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGkD,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAElD;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA,IAAIG,mBAAmB,GAAG,KAAK;AAC/B,MAAMC,gBAAgB,GAAIC,EAAiC,IAAW;EACpE,IAAIC,iCAAY,EAAE;IAChBD,EAAE,CAACC,iCAAY,CAAC;EAClB,CAAC,MAAM,IAAIC,OAAO,IAAI,CAACJ,mBAAmB,EAAE;IAC1CA,mBAAmB,GAAG,IAAI;IAC1BK,OAAO,CAACC,IAAI,CACV,+CAA+C,GAC7C,oEAAoE,GACpE,gFACJ,CAAC;EACH;AACF,CAAC;;AAED;AACO,MAAMC,kBAAkB,CAA+B;EAC5D;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,oBAAoBA,CAACC,QAAgB,EAAEC,SAAiB,EAAQ;IAC9D,OAAOT,gBAAgB,CAAEU,MAAM,IAC7BA,MAAM,CAACH,oBAAoB,CAACC,QAAQ,EAAEC,SAAS,CACjD,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEE,qBAAqBA,CAAA,EAAS;IAC5B,OAAOX,gBAAgB,CAAEU,MAAM,IAAKA,MAAM,CAACC,qBAAqB,CAAC,CAAC,CAAC;EACrE;AACF;AAACC,OAAA,CAAAN,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|