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,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { ActivityIndicator, Animated, StyleSheet, View } from 'react-native';
|
|
5
|
+
import InlineMessageNativeComponent, { InlineMessageState } from '../specs/components/InlineMessageNativeComponent';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Props for the InlineInAppMessageView component.
|
|
9
|
+
*/
|
|
10
|
+
/** @public */
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
/**
|
|
13
|
+
* A React Native component for displaying inline in-app messages with animated sizing
|
|
14
|
+
* and customizable loading states.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <InlineInAppMessageView
|
|
19
|
+
* elementId="my-message"
|
|
20
|
+
* loadingIndicatorProps={{ minimumHeight: 50 }}
|
|
21
|
+
* style={{ width: '100%' }}
|
|
22
|
+
* onActionClick={(message, actionValue, actionName) => {
|
|
23
|
+
* console.log('Action clicked:', { message, actionValue, actionName });
|
|
24
|
+
* }}
|
|
25
|
+
* />
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
/** @public */
|
|
29
|
+
const InlineInAppMessageView = ({
|
|
30
|
+
style,
|
|
31
|
+
loadingComponent,
|
|
32
|
+
loadingIndicatorProps,
|
|
33
|
+
loadingContainerStyle,
|
|
34
|
+
onActionClick,
|
|
35
|
+
...props
|
|
36
|
+
}) => {
|
|
37
|
+
// Animation values for dynamic sizing
|
|
38
|
+
const animatedWidth = useRef(null);
|
|
39
|
+
const animatedHeight = useRef(new Animated.Value(0)).current;
|
|
40
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
41
|
+
|
|
42
|
+
// Extract width from style prop for priority handling
|
|
43
|
+
const styleProvidedWidth = useMemo(() => {
|
|
44
|
+
const flatStyle = StyleSheet.flatten(style);
|
|
45
|
+
return flatStyle?.width;
|
|
46
|
+
}, [style]);
|
|
47
|
+
|
|
48
|
+
// Type guard to check if a value is a valid number to ensure we only animate valid dimensions
|
|
49
|
+
const isValidNumber = value => value !== null && value !== undefined;
|
|
50
|
+
|
|
51
|
+
// Helper function to create an animation for width or height changes
|
|
52
|
+
const createAnimation = (animatedValue, value, duration) => Animated.timing(animatedValue, {
|
|
53
|
+
toValue: value,
|
|
54
|
+
duration,
|
|
55
|
+
useNativeDriver: false // Layout animations require JS driver
|
|
56
|
+
});
|
|
57
|
+
const handleSizeChange = event => {
|
|
58
|
+
const {
|
|
59
|
+
width,
|
|
60
|
+
height,
|
|
61
|
+
duration = 200
|
|
62
|
+
} = event.nativeEvent;
|
|
63
|
+
const animations = [];
|
|
64
|
+
if (isValidNumber(width)) {
|
|
65
|
+
if (!animatedWidth.current) {
|
|
66
|
+
animatedWidth.current = new Animated.Value(width);
|
|
67
|
+
}
|
|
68
|
+
animations.push(createAnimation(animatedWidth.current, width, duration));
|
|
69
|
+
}
|
|
70
|
+
if (isValidNumber(height)) {
|
|
71
|
+
animations.push(createAnimation(animatedHeight, height, duration));
|
|
72
|
+
}
|
|
73
|
+
if (animations.length > 0) {
|
|
74
|
+
Animated.parallel(animations).start();
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const handleStateChange = event => {
|
|
78
|
+
// Native component sends state as 'result' property
|
|
79
|
+
const state = event.nativeEvent.result || event.nativeEvent.state;
|
|
80
|
+
switch (state) {
|
|
81
|
+
case InlineMessageState.LoadingStarted:
|
|
82
|
+
setIsLoading(true);
|
|
83
|
+
createAnimation(animatedHeight, loadingIndicatorProps?.minimumHeight ?? 48,
|
|
84
|
+
// Default: ActivityIndicator + padding
|
|
85
|
+
0 // Immediate height change for loading state
|
|
86
|
+
).start();
|
|
87
|
+
break;
|
|
88
|
+
case InlineMessageState.LoadingFinished:
|
|
89
|
+
case InlineMessageState.NoMessageToDisplay:
|
|
90
|
+
setIsLoading(false);
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const handleActionClick = event => {
|
|
95
|
+
const {
|
|
96
|
+
message,
|
|
97
|
+
actionValue,
|
|
98
|
+
actionName
|
|
99
|
+
} = event.nativeEvent;
|
|
100
|
+
onActionClick?.(message, actionValue, actionName);
|
|
101
|
+
};
|
|
102
|
+
const renderLoadingComponent = () => {
|
|
103
|
+
if (loadingComponent) {
|
|
104
|
+
return loadingComponent;
|
|
105
|
+
}
|
|
106
|
+
return /*#__PURE__*/_jsx(View, {
|
|
107
|
+
style: [styles.loadingContainer, loadingContainerStyle],
|
|
108
|
+
children: /*#__PURE__*/_jsx(ActivityIndicator, {
|
|
109
|
+
size: "small",
|
|
110
|
+
...loadingIndicatorProps
|
|
111
|
+
})
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
return /*#__PURE__*/_jsxs(Animated.View, {
|
|
115
|
+
style: [style, {
|
|
116
|
+
// Priority: Style prop -> Native width -> Default (100%)
|
|
117
|
+
width: styleProvidedWidth ?? (animatedWidth.current || '100%'),
|
|
118
|
+
height: animatedHeight
|
|
119
|
+
}],
|
|
120
|
+
children: [/*#__PURE__*/_jsx(InlineMessageNativeComponent, {
|
|
121
|
+
...props,
|
|
122
|
+
style: styles.nativeComponent,
|
|
123
|
+
onSizeChange: handleSizeChange,
|
|
124
|
+
onStateChange: handleStateChange,
|
|
125
|
+
onActionClick: handleActionClick
|
|
126
|
+
}), isLoading && renderLoadingComponent()]
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
const styles = StyleSheet.create({
|
|
130
|
+
nativeComponent: {
|
|
131
|
+
width: '100%',
|
|
132
|
+
height: '100%'
|
|
133
|
+
},
|
|
134
|
+
loadingContainer: {
|
|
135
|
+
...StyleSheet.absoluteFillObject,
|
|
136
|
+
justifyContent: 'center',
|
|
137
|
+
alignItems: 'center'
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
export default InlineInAppMessageView;
|
|
141
|
+
//# sourceMappingURL=InlineInAppMessageView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useMemo","useRef","useState","ActivityIndicator","Animated","StyleSheet","View","InlineMessageNativeComponent","InlineMessageState","jsx","_jsx","jsxs","_jsxs","InlineInAppMessageView","style","loadingComponent","loadingIndicatorProps","loadingContainerStyle","onActionClick","props","animatedWidth","animatedHeight","Value","current","isLoading","setIsLoading","styleProvidedWidth","flatStyle","flatten","width","isValidNumber","value","undefined","createAnimation","animatedValue","duration","timing","toValue","useNativeDriver","handleSizeChange","event","height","nativeEvent","animations","push","length","parallel","start","handleStateChange","state","result","LoadingStarted","minimumHeight","LoadingFinished","NoMessageToDisplay","handleActionClick","message","actionValue","actionName","renderLoadingComponent","styles","loadingContainer","children","size","nativeComponent","onSizeChange","onStateChange","create","absoluteFillObject","justifyContent","alignItems"],"sourceRoot":"../../../src","sources":["components/InlineInAppMessageView.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACxD,SACEC,iBAAiB,EAEjBC,QAAQ,EACRC,UAAU,EACVC,IAAI,QAEC,cAAc;AACrB,OAAOC,4BAA4B,IACjCC,kBAAkB,QAKb,kDAAkD;;AAGzD;AACA;AACA;AACA;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAsBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,sBAA6D,GAAGA,CAAC;EACrEC,KAAK;EACLC,gBAAgB;EAChBC,qBAAqB;EACrBC,qBAAqB;EACrBC,aAAa;EACb,GAAGC;AACL,CAAC,KAAK;EACJ;EACA,MAAMC,aAAa,GAAGnB,MAAM,CAAwB,IAAI,CAAC;EACzD,MAAMoB,cAAc,GAAGpB,MAAM,CAAC,IAAIG,QAAQ,CAACkB,KAAK,CAAC,CAAC,CAAC,CAAC,CAACC,OAAO;EAC5D,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGvB,QAAQ,CAAC,KAAK,CAAC;;EAEjD;EACA,MAAMwB,kBAAkB,GAAG1B,OAAO,CAAC,MAAM;IACvC,MAAM2B,SAAS,GAAGtB,UAAU,CAACuB,OAAO,CAACd,KAAK,CAAC;IAC3C,OAAOa,SAAS,EAAEE,KAAK;EACzB,CAAC,EAAE,CAACf,KAAK,CAAC,CAAC;;EAEX;EACA,MAAMgB,aAAa,GAAIC,KAAU,IAC/BA,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAKC,SAAS;;EAEvC;EACA,MAAMC,eAAe,GAAGA,CACtBC,aAA6B,EAC7BH,KAAa,EACbI,QA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AAE,MAAM;IACbY,MAAM,EAAE;EACV,CAAC;EACDoB,gBAAgB,EAAE;IAChB,GAAGxD,UAAU,CAAC+D,kBAAkB;IAChCC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAEF,eAAezD,sBAAsB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["default","InlineInAppMessageView"],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;AAAA;;AAEA,SAASA,OAAO,IAAIC,sBAAsB,QAAQ,6BAA0B","ignoreList":[]}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { CustomerIOInAppMessaging } from "./customerio-inapp.js";
|
|
4
|
+
import { CustomerIOLocation } from "./customerio-location.js";
|
|
5
|
+
import { CustomerIOPushMessaging } from "./customerio-push.js";
|
|
6
|
+
import { NativeLoggerListener } from "./native-logger-listener.js";
|
|
7
|
+
import { default as NativeModule } from "./specs/modules/NativeCustomerIO.js";
|
|
8
|
+
import { CioLogLevel } from "./types/index.js";
|
|
9
|
+
import { callNativeModule, ensureNativeModule } from "./utils/native-bridge.js";
|
|
10
|
+
import { assert, validate } from "./utils/param-validation.js";
|
|
11
|
+
const packageJson = require('../../package.json');
|
|
12
|
+
|
|
13
|
+
// Track whether CustomerIO SDK has been initialized to prevent usage before setup
|
|
14
|
+
let _initialized = false;
|
|
15
|
+
|
|
16
|
+
// Reference to the native CustomerIO Data Pipelines module for SDK operations
|
|
17
|
+
const nativeModule = ensureNativeModule(NativeModule);
|
|
18
|
+
|
|
19
|
+
// Wrapper function that ensures SDK is initialized before calling native methods
|
|
20
|
+
const withNativeModule = fn => {
|
|
21
|
+
return callNativeModule(nativeModule, fn);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** @public */
|
|
25
|
+
export class CustomerIO {
|
|
26
|
+
/** Initialize the CustomerIO SDK with given configuration. */
|
|
27
|
+
static initialize = async config => {
|
|
28
|
+
assert.config(config);
|
|
29
|
+
if (config.logLevel && config.logLevel !== CioLogLevel.None) {
|
|
30
|
+
NativeLoggerListener.initialize();
|
|
31
|
+
}
|
|
32
|
+
const expoVersion = packageJson.expoVersion ?? '';
|
|
33
|
+
const args = {
|
|
34
|
+
packageSource: expoVersion ? 'Expo' : 'ReactNative',
|
|
35
|
+
packageVersion: expoVersion || packageJson.version || ''
|
|
36
|
+
};
|
|
37
|
+
const promise = callNativeModule(NativeModule, native => native.initialize(config, args));
|
|
38
|
+
return promise.then(() => {
|
|
39
|
+
_initialized = true;
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** Identify a user to start tracking their activity. Requires userId, traits, or both. */
|
|
44
|
+
static identify = async ({
|
|
45
|
+
userId,
|
|
46
|
+
traits
|
|
47
|
+
} = {}) => {
|
|
48
|
+
if (validate.isUndefined(userId) && validate.isUndefined(traits)) {
|
|
49
|
+
throw new Error('You must provide either userId or traits to identify');
|
|
50
|
+
}
|
|
51
|
+
assert.string(userId, 'userId', {
|
|
52
|
+
allowEmpty: false,
|
|
53
|
+
usage: 'Identify',
|
|
54
|
+
optional: true
|
|
55
|
+
});
|
|
56
|
+
const normalizedTraits = assert.attributes(traits, 'traits', {
|
|
57
|
+
usage: 'Identify',
|
|
58
|
+
optional: true
|
|
59
|
+
});
|
|
60
|
+
return withNativeModule(native => native.identify({
|
|
61
|
+
userId,
|
|
62
|
+
traits: normalizedTraits
|
|
63
|
+
}));
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/** Clear current user identification and stop tracking. */
|
|
67
|
+
static clearIdentify = async () => {
|
|
68
|
+
return withNativeModule(native => native.clearIdentify());
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/** Track an event with optional properties. */
|
|
72
|
+
static track = async (name, properties) => {
|
|
73
|
+
assert.string(name, 'name', {
|
|
74
|
+
usage: 'Track Event'
|
|
75
|
+
});
|
|
76
|
+
const normalizedProps = assert.attributes(properties, 'properties', {
|
|
77
|
+
usage: 'Track Event',
|
|
78
|
+
optional: true
|
|
79
|
+
});
|
|
80
|
+
return withNativeModule(native => native.track(name, normalizedProps));
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/** Track a screen view event with optional properties. */
|
|
84
|
+
static screen = async (title, properties) => {
|
|
85
|
+
assert.string(title, 'title', {
|
|
86
|
+
usage: 'Screen'
|
|
87
|
+
});
|
|
88
|
+
const normalizedProps = assert.attributes(properties, 'properties', {
|
|
89
|
+
usage: 'Screen',
|
|
90
|
+
optional: true
|
|
91
|
+
});
|
|
92
|
+
return withNativeModule(native => native.screen(title, normalizedProps));
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/** Set or update attributes for the currently identified user profile. */
|
|
96
|
+
static setProfileAttributes = async attributes => {
|
|
97
|
+
const normalizedAttrs = assert.attributes(attributes, 'attributes', {
|
|
98
|
+
usage: 'Profile'
|
|
99
|
+
});
|
|
100
|
+
return withNativeModule(native => native.setProfileAttributes(normalizedAttrs));
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
/** Set attributes for the current device. */
|
|
104
|
+
static setDeviceAttributes = async attributes => {
|
|
105
|
+
const normalizedAttrs = assert.attributes(attributes, 'attributes', {
|
|
106
|
+
usage: 'Device'
|
|
107
|
+
});
|
|
108
|
+
return withNativeModule(native => native.setDeviceAttributes(normalizedAttrs));
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/** Register a device token for push notifications. */
|
|
112
|
+
static registerDeviceToken = async token => {
|
|
113
|
+
assert.string(token, 'token', {
|
|
114
|
+
usage: 'Device'
|
|
115
|
+
});
|
|
116
|
+
return withNativeModule(native => native.registerDeviceToken(token));
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/** Remove the current device token to stop receiving push notifications. */
|
|
120
|
+
static deleteDeviceToken = async () => {
|
|
121
|
+
return withNativeModule(native => native.deleteDeviceToken());
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/** Track push notification metrics for delivered, opened, or converted events. */
|
|
125
|
+
static trackMetric = async ({
|
|
126
|
+
deliveryID,
|
|
127
|
+
deviceToken,
|
|
128
|
+
event
|
|
129
|
+
}) => {
|
|
130
|
+
assert.string(deliveryID, 'deliveryID', {
|
|
131
|
+
usage: 'Track Metric'
|
|
132
|
+
});
|
|
133
|
+
assert.string(deviceToken, 'deviceToken', {
|
|
134
|
+
usage: 'Track Metric'
|
|
135
|
+
});
|
|
136
|
+
assert.string(event, 'event', {
|
|
137
|
+
usage: 'Track Metric'
|
|
138
|
+
});
|
|
139
|
+
return withNativeModule(native => native.trackMetric(deliveryID, deviceToken, event));
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Check if the CustomerIO SDK has been initialized.
|
|
144
|
+
* @deprecated This method will be removed in a future version. If you need this functionality, please contact us.
|
|
145
|
+
*/
|
|
146
|
+
static isInitialized = () => _initialized;
|
|
147
|
+
static inAppMessaging = new CustomerIOInAppMessaging();
|
|
148
|
+
static location = new CustomerIOLocation();
|
|
149
|
+
static pushMessaging = new CustomerIOPushMessaging();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Initialize native logger when this module loads to ensure it's always available.
|
|
153
|
+
// Since customerio-cdp.ts is the main SDK entry point and always imported,
|
|
154
|
+
// this guarantees logger initialization even when native-logger-listener.ts
|
|
155
|
+
// isn't directly accessed, also supporting auto-initialization in Expo apps.
|
|
156
|
+
NativeLoggerListener.initNativeLogger();
|
|
157
|
+
//# sourceMappingURL=customerio-cdp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CustomerIOInAppMessaging","CustomerIOLocation","CustomerIOPushMessaging","NativeLoggerListener","default","NativeModule","CioLogLevel","callNativeModule","ensureNativeModule","assert","validate","packageJson","require","_initialized","nativeModule","withNativeModule","fn","CustomerIO","initialize","config","logLevel","None","expoVersion","args","packageSource","packageVersion","version","promise","native","then","identify","userId","traits","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","location","pushMessaging","initNativeLogger"],"sourceRoot":"../../src","sources":["customerio-cdp.ts"],"mappings":";;AAAA,SAASA,wBAAwB,QAAQ,uBAAoB;AAC7D,SAASC,kBAAkB,QAAQ,0BAAuB;AAC1D,SAASC,uBAAuB,QAAQ,sBAAmB;AAC3D,SAASC,oBAAoB,QAAQ,6BAA0B;AAC/D,SACEC,OAAO,IAAIC,YAAY,QAElB,qCAAkC;AACzC,SACEC,WAAW,QAKN,kBAAS;AAEhB,SAASC,gBAAgB,EAAEC,kBAAkB,QAAQ,0BAAuB;AAC5E,SAASC,MAAM,EAAEC,QAAQ,QAAQ,6BAA0B;AAE3D,MAAMC,WAAW,GAAGC,OAAO,CAAC,oBAAoB,CAAC;;AAEjD;AACA,IAAIC,YAAY,GAAG,KAAK;;AAExB;AACA,MAAMC,YAAY,GAAGN,kBAAkB,CAACH,YAAY,CAAC;;AAErD;AACA,MAAMU,gBAAgB,GAAOC,EAA8B,IAAQ;EACjE,OAAOT,gBAAgB,CAACO,YAAY,EAAEE,EAAE,CAAC;AAC3C,CAAC;;AAED;AACA,OAAO,MAAMC,UAAU,CAAC;EACtB;EACA,OAAgBC,UAAU,GAAG,MAAOC,MAAiB,IAAK;IACxDV,MAAM,CAACU,MAAM,CAACA,MAAM,CAAC;IAErB,IAAIA,MAAM,CAACC,QAAQ,IAAID,MAAM,CAACC,QAAQ,KAAKd,WAAW,CAACe,IAAI,EAAE;MAC3DlB,oBAAoB,CAACe,UAAU,CAAC,CAAC;IACnC;IAEA,MAAMI,WAAW,GAAGX,WAAW,CAACW,WAAW,IAAI,EAAE;IACjD,MAAMC,IAAmB,GAAG;MAC1BC,aAAa,EAAEF,WAAW,GAAG,MAAM,GAAG,aAAa;M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;AACAC,oBAAoB,CAAC2D,gBAAgB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { InlineInAppMessageView } from "./components/index.js";
|
|
4
|
+
import { NativeLoggerListener } from "./native-logger-listener.js";
|
|
5
|
+
import { NotificationInbox } from "./notification-inbox.js";
|
|
6
|
+
import NativeCustomerIOMessagingInApp from "./specs/modules/NativeCustomerIOMessagingInApp.js";
|
|
7
|
+
import { callNativeModule, ensureNativeModule } from "./utils/native-bridge.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Ensures all methods defined in codegen spec are implemented by the public module
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
// Reference to the native CustomerIO Data Pipelines module for SDK operations
|
|
16
|
+
const nativeModule = ensureNativeModule(NativeCustomerIOMessagingInApp);
|
|
17
|
+
|
|
18
|
+
// Wrapper function that ensures SDK is initialized before calling native methods
|
|
19
|
+
const withNativeModule = fn => {
|
|
20
|
+
return callNativeModule(nativeModule, fn);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Helper class so that registering event listeners is easier for customers.
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
class CustomerIOInAppMessaging {
|
|
29
|
+
registerEventsListener(listener) {
|
|
30
|
+
const emitter = data => {
|
|
31
|
+
// Convert raw native payload to InAppMessageEvent
|
|
32
|
+
const event = new InAppMessageEvent(data.eventType, data.messageId, data.deliveryId, data.actionValue, data.actionName);
|
|
33
|
+
listener(event);
|
|
34
|
+
};
|
|
35
|
+
return withNativeModule(native => {
|
|
36
|
+
try {
|
|
37
|
+
// Register TurboModule event listener and return subscription.
|
|
38
|
+
// This method is generated by codegen in the native modules.
|
|
39
|
+
// Wrapped in try-catch due to previous reports of crashes on certain Android architectures.
|
|
40
|
+
return native.onInAppEventReceived(emitter);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
NativeLoggerListener.warn('Failed to attach in-app event listener:', error);
|
|
43
|
+
// Return a no-op subscription to maintain backwards compatibility
|
|
44
|
+
return {
|
|
45
|
+
remove: () => {},
|
|
46
|
+
eventType: '',
|
|
47
|
+
key: 0,
|
|
48
|
+
subscriber: null
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Dismisses any currently displayed in-app message
|
|
56
|
+
*/
|
|
57
|
+
dismissMessage() {
|
|
58
|
+
withNativeModule(native => native.dismissMessage());
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Gets the message inbox instance for managing inbox messages
|
|
63
|
+
*
|
|
64
|
+
* @returns NotificationInbox instance for fetching and managing inbox messages
|
|
65
|
+
*/
|
|
66
|
+
inbox() {
|
|
67
|
+
if (!this._notificationInbox) {
|
|
68
|
+
this._notificationInbox = new NotificationInbox();
|
|
69
|
+
}
|
|
70
|
+
return this._notificationInbox;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Class to hold in-app event attributes.
|
|
76
|
+
*/
|
|
77
|
+
/** @public */
|
|
78
|
+
class InAppMessageEvent {
|
|
79
|
+
constructor(eventType, messageId, deliveryId, actionValue, actionName) {
|
|
80
|
+
this.eventType = eventType;
|
|
81
|
+
this.deliveryId = deliveryId;
|
|
82
|
+
this.messageId = messageId;
|
|
83
|
+
this.actionValue = actionValue;
|
|
84
|
+
this.actionName = actionName;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Export in-app messaging types and components for simplified imports
|
|
89
|
+
|
|
90
|
+
export { NotificationInbox } from "./notification-inbox.js";
|
|
91
|
+
export { CustomerIOInAppMessaging, InAppMessageEvent, InlineInAppMessageView };
|
|
92
|
+
//# sourceMappingURL=customerio-inapp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["InlineInAppMessageView","NativeLoggerListener","NotificationInbox","NativeCustomerIOMessagingInApp","callNativeModule","ensureNativeModule","nativeModule","withNativeModule","fn","CustomerIOInAppMessaging","registerEventsListener","listener","emitter","data","event","InAppMessageEvent","eventType","messageId","deliveryId","actionValue","actionName","native","onInAppEventReceived","error","warn","remove","key","subscriber","dismissMessage","inbox","_notificationInbox","constructor"],"sourceRoot":"../../src","sources":["customerio-inapp.ts"],"mappings":";;AACA,SAASA,sBAAsB,QAAQ,uBAAc;AACrD,SAASC,oBAAoB,QAAQ,6BAA0B;AAC/D,SACEC,iBAAiB,QAEZ,yBAAsB;AAC7B,OAAOC,8BAA8B,MAE9B,mDAAgD;AAEvD,SAASC,gBAAgB,EAAEC,kBAAkB,QAAQ,0BAAuB;;AAE5E;AACA;AACA;AACA;AACA;;AAMA;AACA,MAAMC,YAAY,GAAGD,kBAAkB,CAACF,8BAA8B,CAAC;;AAEvE;AACA,MAAMI,gBAAgB,GAAOC,EAA8B,IAAQ;EACjE,OAAOJ,gBAAgB,CAACE,YAAY,EAAEE,EAAE,CAAC;AAC3C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMC,wBAAwB,CAA4B;EAGxDC,sBAAsBA,CACpBC,QAA4C,EACzB;IACnB,MAAMC,OAAO,GAAIC,IAAS,IAAK;MAC7B;MACA,MAAMC,KAAK,GAAG,IAAIC,iBAAiB,CACjCF,IAAI,CAACG,SAAS,EACdH,IAAI,CAACI,SAAS,EACdJ,IAAI,CAACK,UAAU,EACfL,IAAI,CAACM,WAAW,EAChBN,IAAI,CAACO,UACP,CAAC;MACDT,QAAQ,CAACG,KAAK,CAAC;IACjB,CAAC;IAED,OAAOP,gBAAgB,CAAEc,MAAM,IAAK;MAClC,IAAI;QACF;QACA;QACA;QACA,OAAOA,MAAM,CAACC,oBAAoB,CAACV,OAAO,CAAC;MAC7C,CAAC,CAAC,OAAOW,KAAK,EAAE;QACdtB,oBAAoB,CAACuB,IAAI,CACvB,yCAAyC,EACzCD,KACF,CAAC;QACD;QACA,OAAO;UACLE,MAAM,EAAEA,CAAA,KAAM,CAAC,CAAC;UAChBT,SAAS,EAAE,EAAE;UACbU,GAAG,EAAE,CAAC;UACNC,UAAU,EAAE;QACd,CAAC;MACH;IACF,CAAC,CAAC;EACJ;;EAEA;AACF;AACA;EACEC,cAAcA,CAAA,EAAG;IACfrB,gBAAgB,CAAEc,MAAM,IAAKA,MAAM,CAACO,cAAc,CAAC,CAAC,CAAC;EACvD;;EAEA;AACF;AACA;AACA;AACA;EACEC,KAAKA,CAAA,EAAsB;IACzB,IAAI,CAAC,IAAI,CAACC,kBAAkB,EAAE;MAC5B,IAAI,CAACA,kBAAkB,GAAG,IAAI5B,iBAAiB,CAAC,CAAC;IACnD;IACA,OAAO,IAAI,CAAC4B,kBAAkB;EAChC;AACF;;AAEA;AACA;AACA;AACA;AACA,MAAMf,iBAAiB,CAAC;EAOtBgB,WAAWA,CACTf,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;;AAEA,SAASlB,iBAAiB,QAAQ,yBAAsB;AAExD,SAASO,wBAAwB,EAAEM,iBAAiB,EAAEf,sBAAsB","ignoreList":[]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { default as NativeModule } from "./specs/modules/NativeCustomerIOLocation.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Ensures all methods defined in codegen spec are implemented by the public module
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// Location is an optional module — NativeModule may be null when location is not enabled.
|
|
12
|
+
// Methods silently no-op when the native module is unavailable, with a one-time dev warning.
|
|
13
|
+
let hasWarnedNotEnabled = false;
|
|
14
|
+
const withNativeModule = fn => {
|
|
15
|
+
if (NativeModule) {
|
|
16
|
+
fn(NativeModule);
|
|
17
|
+
} else if (__DEV__ && !hasWarnedNotEnabled) {
|
|
18
|
+
hasWarnedNotEnabled = true;
|
|
19
|
+
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).');
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/** @public */
|
|
24
|
+
export class CustomerIOLocation {
|
|
25
|
+
/**
|
|
26
|
+
* Sets the last known location from the host app's existing location system.
|
|
27
|
+
* Use this when your app already manages location and you want to send that data
|
|
28
|
+
* to Customer.io without the SDK managing location permissions directly.
|
|
29
|
+
*
|
|
30
|
+
* @param latitude - Latitude in degrees, must be between -90 and 90
|
|
31
|
+
* @param longitude - Longitude in degrees, must be between -180 and 180
|
|
32
|
+
*/
|
|
33
|
+
setLastKnownLocation(latitude, longitude) {
|
|
34
|
+
return withNativeModule(native => native.setLastKnownLocation(latitude, longitude));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Requests a single location update and sends the result to Customer.io.
|
|
39
|
+
* No-ops if location tracking is disabled or permission is not granted.
|
|
40
|
+
*
|
|
41
|
+
* The SDK does not request location permission. The host app must request
|
|
42
|
+
* runtime permissions and only call this when permission is granted.
|
|
43
|
+
*/
|
|
44
|
+
requestLocationUpdate() {
|
|
45
|
+
return withNativeModule(native => native.requestLocationUpdate());
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=customerio-location.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["default","NativeModule","hasWarnedNotEnabled","withNativeModule","fn","__DEV__","console","warn","CustomerIOLocation","setLastKnownLocation","latitude","longitude","native","requestLocationUpdate"],"sourceRoot":"../../src","sources":["customerio-location.ts"],"mappings":";;AACA,SACEA,OAAO,IAAIC,YAAY,QAElB,6CAA0C;;AAEjD;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA,IAAIC,mBAAmB,GAAG,KAAK;AAC/B,MAAMC,gBAAgB,GAAIC,EAAiC,IAAW;EACpE,IAAIH,YAAY,EAAE;IAChBG,EAAE,CAACH,YAAY,CAAC;EAClB,CAAC,MAAM,IAAII,OAAO,IAAI,CAACH,mBAAmB,EAAE;IAC1CA,mBAAmB,GAAG,IAAI;IAC1BI,OAAO,CAACC,IAAI,CACV,+CAA+C,GAC7C,oEAAoE,GACpE,gFACJ,CAAC;EACH;AACF,CAAC;;AAED;AACA,OAAO,MAAMC,kBAAkB,CAA+B;EAC5D;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,oBAAoBA,CAACC,QAAgB,EAAEC,SAAiB,EAAQ;IAC9D,OAAOR,gBAAgB,CAAES,MAAM,IAC7BA,MAAM,CAACH,oBAAoB,CAACC,QAAQ,EAAEC,SAAS,CACjD,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEE,qBAAqBA,CAAA,EAAS;IAC5B,OAAOV,gBAAgB,CAAES,MAAM,IAAKA,MAAM,CAACC,qBAAqB,CAAC,CAAC,CAAC;EACrE;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Platform } from 'react-native';
|
|
4
|
+
import NativeCustomerIOMessagingPush from "./specs/modules/NativeCustomerIOMessagingPush.js";
|
|
5
|
+
import { callNativeModule, ensureNativeModule } from "./utils/native-bridge.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Ensures all methods defined in codegen spec are implemented by the public module
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// Reference to the native CustomerIO Data Pipelines module for SDK operations
|
|
14
|
+
const nativeModule = ensureNativeModule(NativeCustomerIOMessagingPush);
|
|
15
|
+
|
|
16
|
+
// Wrapper function that ensures SDK is initialized before calling native methods
|
|
17
|
+
const withNativeModule = fn => {
|
|
18
|
+
return callNativeModule(nativeModule, fn);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** @public */
|
|
22
|
+
class CustomerIOPushMessaging {
|
|
23
|
+
/**
|
|
24
|
+
* Processes push notification received outside the CIO SDK. The method displays notification on
|
|
25
|
+
* device and tracks CIO metrics for push notification.
|
|
26
|
+
*
|
|
27
|
+
* @param message - push payload received from FCM. The payload must contain data payload received in push
|
|
28
|
+
* notification.
|
|
29
|
+
* @param handleNotificationTrigger - indicates whether it should display the notification or not.
|
|
30
|
+
* true (default): The SDK will display the notification and track associated metrics.
|
|
31
|
+
* false: The SDK will only process the notification to track metrics but will not display any notification.
|
|
32
|
+
* @returns promise that resolves to boolean indicating if the notification was handled by the SDK or not.
|
|
33
|
+
*/
|
|
34
|
+
onMessageReceived(message, handleNotificationTrigger = true) {
|
|
35
|
+
if (Platform.OS === 'ios') {
|
|
36
|
+
// Since push notifications on iOS work fine with multiple notification services,
|
|
37
|
+
// We don't need to process them on iOS for now.
|
|
38
|
+
// Resolving promise to true makes it easier for callers to avoid adding
|
|
39
|
+
// unnecessary platform specific checks.
|
|
40
|
+
return Promise.resolve(true);
|
|
41
|
+
} else {
|
|
42
|
+
return withNativeModule(native => native.onMessageReceived(message, handleNotificationTrigger));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Handles push notification received when app is background. Since FCM itself displays the notification
|
|
48
|
+
* when app is background, this method makes it easier to determine whether the notification should be
|
|
49
|
+
* displayed or not.
|
|
50
|
+
*
|
|
51
|
+
* @see [onMessageReceived] for more details
|
|
52
|
+
*/
|
|
53
|
+
onBackgroundMessageReceived(message) {
|
|
54
|
+
return this.onMessageReceived(message, !message.notification);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Track push notifications metrics using this method.
|
|
59
|
+
* Call this method when a user interacts and taps open the push notification.
|
|
60
|
+
* @param payload - Customer.io payload as received from the push notification
|
|
61
|
+
*/
|
|
62
|
+
trackNotificationResponseReceived(payload) {
|
|
63
|
+
// Tracking push notification metrics on Android is handled automatically
|
|
64
|
+
// through the Google Services API, so there is no need to make a specific call for it.
|
|
65
|
+
// This method is specific to iOS and works as expected on Android without any additional intervention.
|
|
66
|
+
if (payload == null || this.isAndroid()) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
withNativeModule(native => native.trackNotificationResponseReceived(payload));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Track push notifications metrics using this method.
|
|
74
|
+
* Call this method when a push notification is received.
|
|
75
|
+
* @param payload - Customer.io payload as received from the push notification
|
|
76
|
+
*/
|
|
77
|
+
trackNotificationReceived(payload) {
|
|
78
|
+
// Tracking push notification metrics on Android is handled automatically
|
|
79
|
+
// through the Google Services API, so there is no need to make a specific call for it.
|
|
80
|
+
// This method is specific to iOS and works as expected on Android without any additional intervention.
|
|
81
|
+
if (payload == null || this.isAndroid()) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
withNativeModule(native => native.trackNotificationReceived(payload));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Get the registered device token for the app.
|
|
89
|
+
* @returns Promise with device token as a string, or error if no token is
|
|
90
|
+
* registered or the method fails to fetch token.
|
|
91
|
+
*/
|
|
92
|
+
getRegisteredDeviceToken() {
|
|
93
|
+
return withNativeModule(native => native.getRegisteredDeviceToken());
|
|
94
|
+
}
|
|
95
|
+
showPromptForPushNotifications(options = {
|
|
96
|
+
ios: {
|
|
97
|
+
badge: true,
|
|
98
|
+
sound: true
|
|
99
|
+
}
|
|
100
|
+
}) {
|
|
101
|
+
return withNativeModule(native => native.showPromptForPushNotifications(options)).then(status => status);
|
|
102
|
+
}
|
|
103
|
+
getPushPermissionStatus() {
|
|
104
|
+
return withNativeModule(native => native.getPushPermissionStatus()).then(status => status);
|
|
105
|
+
}
|
|
106
|
+
isAndroid() {
|
|
107
|
+
return Platform.OS === 'android';
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
export { CustomerIOPushMessaging };
|
|
111
|
+
//# sourceMappingURL=customerio-push.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Platform","NativeCustomerIOMessagingPush","callNativeModule","ensureNativeModule","nativeModule","withNativeModule","fn","CustomerIOPushMessaging","onMessageReceived","message","handleNotificationTrigger","OS","Promise","resolve","native","onBackgroundMessageReceived","notification","trackNotificationResponseReceived","payload","isAndroid","trackNotificationReceived","getRegisteredDeviceToken","showPromptForPushNotifications","options","ios","badge","sound","then","status","getPushPermissionStatus"],"sourceRoot":"../../src","sources":["customerio-push.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAA0B,cAAc;AACzD,OAAOC,6BAA6B,MAE7B,kDAA+C;AAKtD,SAASC,gBAAgB,EAAEC,kBAAkB,QAAQ,0BAAuB;;AAE5E;AACA;AACA;AACA;AACA;;AAGA;AACA,MAAMC,YAAY,GAAGD,kBAAkB,CAACF,6BAA6B,CAAC;;AAEtE;AACA,MAAMI,gBAAgB,GAAOC,EAA8B,IAAQ;EACjE,OAAOJ,gBAAgB,CAACE,YAAY,EAAEE,EAAE,CAAC;AAC3C,CAAC;;AAED;AACA,MAAMC,uBAAuB,CAA2B;EACtD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,iBAAiBA,CACfC,OAAY,EACZC,yBAAkC,GAAG,IAAI,EACvB;IAClB,IAAIV,QAAQ,CAACW,EAAE,KAAK,KAAK,EAAE;MACzB;MACA;MACA;MACA;MACA,OAAOC,OAAO,CAACC,OAA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AAqC;IAC1D,OAAOxB,gBAAgB,CAAES,MAAM,IAAKA,MAAM,CAACe,uBAAuB,CAAC,CAAC,CAAC,CAACF,IAAI,CACvEC,MAAM,IAAKA,MACd,CAAC;EACH;EAEAT,SAASA,CAAA,EAAY;IACnB,OAAOnB,QAAQ,CAACW,EAAE,KAAK,SAAS;EAClC;AACF;AAEA,SAASJ,uBAAuB","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This file serves as the entry point for the module zixflow-reactnative.
|
|
5
|
+
*
|
|
6
|
+
* This SDK is a customized fork of the Customer.io React Native SDK,
|
|
7
|
+
* optimized for use with the Zixflow platform.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// Export ONLY the Zixflow-branded API (no backward compatibility with CustomerIO names)
|
|
11
|
+
export * from "./zixflow.js";
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc,cAAW","ignoreList":[]}
|