zixflow-reactnative 1.1.2 → 1.1.4
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/README.md +2224 -322
- package/android/build.gradle +18 -1
- package/android/consumer-rules.pro +3 -2
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/zixflow/reactnative/sdk/NativeZixflowModule.kt +69 -24
- package/android/src/main/java/com/zixflow/reactnative/sdk/ZixflowReactNativePackage.kt +25 -1
- package/android/src/main/java/com/zixflow/reactnative/sdk/constant/Keys.kt +19 -3
- package/android/src/main/java/com/zixflow/reactnative/sdk/geofence/NativeGeofenceModule.kt +65 -0
- package/android/src/main/java/com/zixflow/reactnative/sdk/liveactivities/NativeLiveActivitiesModule.kt +310 -0
- package/android/src/main/java/com/zixflow/reactnative/sdk/logging/NativeZixflowLoggingModule.kt +2 -2
- package/android/src/main/java/com/zixflow/reactnative/sdk/messaginginapp/NativeMessagingInAppModule.kt +149 -10
- package/android/src/main/java/com/zixflow/reactnative/sdk/messaginginapp/ReactInboxEventListener.kt +99 -0
- package/android/src/main/java/com/zixflow/reactnative/sdk/messaginginbox/NotificationInboxBellViewManager.kt +38 -0
- package/android/src/main/java/com/zixflow/reactnative/sdk/messaginginbox/NotificationInboxViewManager.kt +30 -0
- package/android/src/main/java/com/zixflow/reactnative/sdk/messaginginbox/ReactComposeHostView.kt +96 -0
- package/android/src/main/java/com/zixflow/reactnative/sdk/messaginginbox/ReactNotificationInboxBellView.kt +48 -0
- package/android/src/main/java/com/zixflow/reactnative/sdk/messaginginbox/ReactNotificationInboxView.kt +17 -0
- package/android/src/main/java/com/zixflow/reactnative/sdk/messagingpush/NativeMessagingPushModule.kt +11 -1
- package/android/src/main/res/values/zixflow_config.xml +1 -1
- package/android/zixflow-core.gradle +17 -7
- package/docs/cocoapods-deployment-target-normalization.md +139 -0
- package/ios/cocoapods_deployment_target.rb +432 -0
- package/ios/wrappers/NativeZixflow.mm +37 -0
- package/ios/wrappers/NativeZixflow.swift +135 -1
- package/ios/wrappers/ZixflowReactNativeDeepLinkRequestStore.swift +123 -0
- package/ios/wrappers/ZixflowReactNativeDeepLinkRouter.swift +312 -0
- package/ios/wrappers/geofence/NativeGeofence.mm +46 -0
- package/ios/wrappers/geofence/NativeGeofence.swift +27 -0
- package/ios/wrappers/inapp/NativeMessagingInApp.mm +22 -0
- package/ios/wrappers/inapp/NativeMessagingInApp.swift +90 -0
- package/ios/wrappers/inbox/InboxHostContainment.swift +40 -0
- package/ios/wrappers/inbox/RCTNotificationInboxBellNative.h +12 -0
- package/ios/wrappers/inbox/RCTNotificationInboxBellNative.mm +98 -0
- package/ios/wrappers/inbox/RCTNotificationInboxViewNative.h +12 -0
- package/ios/wrappers/inbox/RCTNotificationInboxViewNative.mm +78 -0
- package/ios/wrappers/inbox/ReactInboxEventListener.swift +76 -0
- package/ios/wrappers/inbox/ReactNotificationInboxBellView.h +22 -0
- package/ios/wrappers/inbox/ReactNotificationInboxBellView.swift +109 -0
- package/ios/wrappers/inbox/ReactNotificationInboxView.h +22 -0
- package/ios/wrappers/inbox/ReactNotificationInboxView.swift +69 -0
- package/ios/wrappers/liveactivities/NativeLiveActivities.mm +83 -0
- package/ios/wrappers/liveactivities/NativeLiveActivities.swift +390 -0
- package/ios/wrappers/location/NativeLocation.swift +7 -5
- package/ios/wrappers/utils/ZixflowConfigUtils.swift +5 -9
- package/ios/wrappers/utils/ZixflowConstants.swift +4 -0
- package/ios/wrappers/zixflow_reactnative.h +6 -0
- package/lib/commonjs/components/NotificationInboxBellView.js +49 -0
- package/lib/commonjs/components/NotificationInboxBellView.js.map +1 -0
- package/lib/commonjs/components/NotificationInboxView.js +36 -0
- package/lib/commonjs/components/NotificationInboxView.js.map +1 -0
- package/lib/commonjs/components/index.js +14 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/index.js +81 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/notification-inbox.js +1 -0
- package/lib/commonjs/notification-inbox.js.map +1 -1
- package/lib/commonjs/specs/components/NotificationInboxBellNativeComponent.ts +24 -0
- package/lib/commonjs/specs/components/NotificationInboxViewNativeComponent.ts +22 -0
- package/lib/commonjs/specs/modules/NativeZixflow.js.map +1 -1
- package/lib/commonjs/specs/modules/NativeZixflowGeofence.js +15 -0
- package/lib/commonjs/specs/modules/NativeZixflowGeofence.js.map +1 -0
- package/lib/commonjs/specs/modules/NativeZixflowLiveActivities.js +23 -0
- package/lib/commonjs/specs/modules/NativeZixflowLiveActivities.js.map +1 -0
- package/lib/commonjs/specs/modules/NativeZixflowMessagingInApp.js +3 -1
- package/lib/commonjs/specs/modules/NativeZixflowMessagingInApp.js.map +1 -1
- package/lib/commonjs/specs/modules/NativeZixflowMessagingPush.js +3 -1
- package/lib/commonjs/specs/modules/NativeZixflowMessagingPush.js.map +1 -1
- package/lib/commonjs/types/data-pipelines.js +15 -15
- package/lib/commonjs/types/data-pipelines.js.map +1 -1
- package/lib/commonjs/types/in-app.js +24 -1
- package/lib/commonjs/types/in-app.js.map +1 -1
- package/lib/commonjs/types/inbox.js +79 -0
- package/lib/commonjs/types/inbox.js.map +1 -0
- package/lib/commonjs/types/index.js +22 -0
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/types/live-activities.js +85 -0
- package/lib/commonjs/types/live-activities.js.map +1 -0
- package/lib/commonjs/utils/param-validation.js +77 -2
- package/lib/commonjs/utils/param-validation.js.map +1 -1
- package/lib/commonjs/zixflow-cdp.js +101 -11
- package/lib/commonjs/zixflow-cdp.js.map +1 -1
- package/lib/commonjs/zixflow-geofence.js +55 -0
- package/lib/commonjs/zixflow-geofence.js.map +1 -0
- package/lib/commonjs/zixflow-inapp.js +120 -0
- package/lib/commonjs/zixflow-inapp.js.map +1 -1
- package/lib/commonjs/zixflow-liveactivities.js +85 -0
- package/lib/commonjs/zixflow-liveactivities.js.map +1 -0
- package/lib/commonjs/zixflow.js.map +1 -1
- package/lib/module/components/NotificationInboxBellView.js +44 -0
- package/lib/module/components/NotificationInboxBellView.js.map +1 -0
- package/lib/module/components/NotificationInboxView.js +31 -0
- package/lib/module/components/NotificationInboxView.js.map +1 -0
- package/lib/module/components/index.js +5 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/index.js +8 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/notification-inbox.js +1 -1
- package/lib/module/notification-inbox.js.map +1 -1
- package/lib/module/specs/components/NotificationInboxBellNativeComponent.ts +24 -0
- package/lib/module/specs/components/NotificationInboxViewNativeComponent.ts +22 -0
- package/lib/module/specs/modules/NativeZixflow.js.map +1 -1
- package/lib/module/specs/modules/NativeZixflowGeofence.js +13 -0
- package/lib/module/specs/modules/NativeZixflowGeofence.js.map +1 -0
- package/lib/module/specs/modules/NativeZixflowLiveActivities.js +21 -0
- package/lib/module/specs/modules/NativeZixflowLiveActivities.js.map +1 -0
- package/lib/module/specs/modules/NativeZixflowMessagingInApp.js +3 -1
- package/lib/module/specs/modules/NativeZixflowMessagingInApp.js.map +1 -1
- package/lib/module/specs/modules/NativeZixflowMessagingPush.js +3 -1
- package/lib/module/specs/modules/NativeZixflowMessagingPush.js.map +1 -1
- package/lib/module/types/data-pipelines.js +15 -15
- package/lib/module/types/data-pipelines.js.map +1 -1
- package/lib/module/types/in-app.js +24 -0
- package/lib/module/types/in-app.js.map +1 -1
- package/lib/module/types/inbox.js +75 -0
- package/lib/module/types/inbox.js.map +1 -0
- package/lib/module/types/index.js +2 -0
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/types/live-activities.js +88 -0
- package/lib/module/types/live-activities.js.map +1 -0
- package/lib/module/utils/param-validation.js +77 -2
- package/lib/module/utils/param-validation.js.map +1 -1
- package/lib/module/zixflow-cdp.js +101 -11
- package/lib/module/zixflow-cdp.js.map +1 -1
- package/lib/module/zixflow-geofence.js +50 -0
- package/lib/module/zixflow-geofence.js.map +1 -0
- package/lib/module/zixflow-inapp.js +99 -1
- package/lib/module/zixflow-inapp.js.map +1 -1
- package/lib/module/zixflow-liveactivities.js +80 -0
- package/lib/module/zixflow-liveactivities.js.map +1 -0
- package/lib/module/zixflow.js +0 -6
- package/lib/module/zixflow.js.map +1 -1
- package/lib/typescript/commonjs/components/NotificationInboxBellView.d.ts +39 -0
- package/lib/typescript/commonjs/components/NotificationInboxBellView.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/NotificationInboxView.d.ts +25 -0
- package/lib/typescript/commonjs/components/NotificationInboxView.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/index.d.ts +4 -0
- package/lib/typescript/commonjs/components/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +8 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/notification-inbox.d.ts +5 -0
- package/lib/typescript/commonjs/notification-inbox.d.ts.map +1 -1
- package/lib/typescript/commonjs/specs/components/NotificationInboxBellNativeComponent.d.ts +13 -0
- package/lib/typescript/commonjs/specs/components/NotificationInboxBellNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/specs/components/NotificationInboxViewNativeComponent.d.ts +12 -0
- package/lib/typescript/commonjs/specs/components/NotificationInboxViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/specs/modules/NativeZixflow.d.ts +6 -1
- package/lib/typescript/commonjs/specs/modules/NativeZixflow.d.ts.map +1 -1
- package/lib/typescript/commonjs/specs/modules/NativeZixflowGeofence.d.ts +13 -0
- package/lib/typescript/commonjs/specs/modules/NativeZixflowGeofence.d.ts.map +1 -0
- package/lib/typescript/commonjs/specs/modules/NativeZixflowLiveActivities.d.ts +31 -0
- package/lib/typescript/commonjs/specs/modules/NativeZixflowLiveActivities.d.ts.map +1 -0
- package/lib/typescript/commonjs/specs/modules/NativeZixflowMessagingInApp.d.ts +5 -1
- package/lib/typescript/commonjs/specs/modules/NativeZixflowMessagingInApp.d.ts.map +1 -1
- package/lib/typescript/commonjs/specs/modules/NativeZixflowMessagingPush.d.ts +1 -1
- package/lib/typescript/commonjs/specs/modules/NativeZixflowMessagingPush.d.ts.map +1 -1
- package/lib/typescript/commonjs/types/data-pipelines.d.ts +54 -18
- package/lib/typescript/commonjs/types/data-pipelines.d.ts.map +1 -1
- package/lib/typescript/commonjs/types/in-app.d.ts +22 -0
- package/lib/typescript/commonjs/types/in-app.d.ts.map +1 -1
- package/lib/typescript/commonjs/types/inbox.d.ts +97 -0
- package/lib/typescript/commonjs/types/inbox.d.ts.map +1 -0
- package/lib/typescript/commonjs/types/index.d.ts +2 -0
- package/lib/typescript/commonjs/types/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/types/live-activities.d.ts +161 -0
- package/lib/typescript/commonjs/types/live-activities.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/param-validation.d.ts +7 -0
- package/lib/typescript/commonjs/utils/param-validation.d.ts.map +1 -1
- package/lib/typescript/commonjs/zixflow-cdp.d.ts +38 -0
- package/lib/typescript/commonjs/zixflow-cdp.d.ts.map +1 -1
- package/lib/typescript/commonjs/zixflow-geofence.d.ts +36 -0
- package/lib/typescript/commonjs/zixflow-geofence.d.ts.map +1 -0
- package/lib/typescript/commonjs/zixflow-inapp.d.ts +36 -2
- package/lib/typescript/commonjs/zixflow-inapp.d.ts.map +1 -1
- package/lib/typescript/commonjs/zixflow-liveactivities.d.ts +66 -0
- package/lib/typescript/commonjs/zixflow-liveactivities.d.ts.map +1 -0
- package/lib/typescript/commonjs/zixflow.d.ts +0 -5
- package/lib/typescript/commonjs/zixflow.d.ts.map +1 -1
- package/lib/typescript/module/components/NotificationInboxBellView.d.ts +39 -0
- package/lib/typescript/module/components/NotificationInboxBellView.d.ts.map +1 -0
- package/lib/typescript/module/components/NotificationInboxView.d.ts +25 -0
- package/lib/typescript/module/components/NotificationInboxView.d.ts.map +1 -0
- package/lib/typescript/module/components/index.d.ts +4 -0
- package/lib/typescript/module/components/index.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +8 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/notification-inbox.d.ts +5 -0
- package/lib/typescript/module/notification-inbox.d.ts.map +1 -1
- package/lib/typescript/module/specs/components/NotificationInboxBellNativeComponent.d.ts +13 -0
- package/lib/typescript/module/specs/components/NotificationInboxBellNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/specs/components/NotificationInboxViewNativeComponent.d.ts +12 -0
- package/lib/typescript/module/specs/components/NotificationInboxViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/specs/modules/NativeZixflow.d.ts +6 -1
- package/lib/typescript/module/specs/modules/NativeZixflow.d.ts.map +1 -1
- package/lib/typescript/module/specs/modules/NativeZixflowGeofence.d.ts +13 -0
- package/lib/typescript/module/specs/modules/NativeZixflowGeofence.d.ts.map +1 -0
- package/lib/typescript/module/specs/modules/NativeZixflowLiveActivities.d.ts +31 -0
- package/lib/typescript/module/specs/modules/NativeZixflowLiveActivities.d.ts.map +1 -0
- package/lib/typescript/module/specs/modules/NativeZixflowMessagingInApp.d.ts +5 -1
- package/lib/typescript/module/specs/modules/NativeZixflowMessagingInApp.d.ts.map +1 -1
- package/lib/typescript/module/specs/modules/NativeZixflowMessagingPush.d.ts +1 -1
- package/lib/typescript/module/specs/modules/NativeZixflowMessagingPush.d.ts.map +1 -1
- package/lib/typescript/module/types/data-pipelines.d.ts +54 -18
- package/lib/typescript/module/types/data-pipelines.d.ts.map +1 -1
- package/lib/typescript/module/types/in-app.d.ts +22 -0
- package/lib/typescript/module/types/in-app.d.ts.map +1 -1
- package/lib/typescript/module/types/inbox.d.ts +97 -0
- package/lib/typescript/module/types/inbox.d.ts.map +1 -0
- package/lib/typescript/module/types/index.d.ts +2 -0
- package/lib/typescript/module/types/index.d.ts.map +1 -1
- package/lib/typescript/module/types/live-activities.d.ts +161 -0
- package/lib/typescript/module/types/live-activities.d.ts.map +1 -0
- package/lib/typescript/module/utils/param-validation.d.ts +7 -0
- package/lib/typescript/module/utils/param-validation.d.ts.map +1 -1
- package/lib/typescript/module/zixflow-cdp.d.ts +38 -0
- package/lib/typescript/module/zixflow-cdp.d.ts.map +1 -1
- package/lib/typescript/module/zixflow-geofence.d.ts +36 -0
- package/lib/typescript/module/zixflow-geofence.d.ts.map +1 -0
- package/lib/typescript/module/zixflow-inapp.d.ts +36 -2
- package/lib/typescript/module/zixflow-inapp.d.ts.map +1 -1
- package/lib/typescript/module/zixflow-liveactivities.d.ts +66 -0
- package/lib/typescript/module/zixflow-liveactivities.d.ts.map +1 -0
- package/lib/typescript/module/zixflow.d.ts +0 -5
- package/lib/typescript/module/zixflow.d.ts.map +1 -1
- package/package.json +14 -5
- package/src/components/NotificationInboxBellView.tsx +55 -0
- package/src/components/NotificationInboxView.tsx +30 -0
- package/src/components/index.ts +6 -0
- package/src/index.ts +8 -3
- package/src/notification-inbox.ts +1 -1
- package/src/specs/components/NotificationInboxBellNativeComponent.ts +24 -0
- package/src/specs/components/NotificationInboxViewNativeComponent.ts +22 -0
- package/src/specs/modules/NativeZixflow.ts +9 -1
- package/src/specs/modules/NativeZixflowGeofence.ts +14 -0
- package/src/specs/modules/NativeZixflowLiveActivities.ts +39 -0
- package/src/specs/modules/NativeZixflowMessagingInApp.ts +12 -1
- package/src/specs/modules/NativeZixflowMessagingPush.ts +3 -1
- package/src/types/data-pipelines.ts +55 -19
- package/src/types/in-app.ts +23 -0
- package/src/types/inbox.ts +110 -0
- package/src/types/index.ts +2 -0
- package/src/types/live-activities.ts +170 -0
- package/src/utils/param-validation.ts +104 -1
- package/src/zixflow-cdp.ts +119 -13
- package/src/zixflow-geofence.ts +56 -0
- package/src/zixflow-inapp.ts +125 -2
- package/src/zixflow-liveactivities.ts +86 -0
- package/src/zixflow.ts +0 -6
- package/zixflow-reactnative-richpush.podspec +6 -3
- package/zixflow-reactnative.podspec +28 -2
package/src/index.ts
CHANGED
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
* Zixflow React Native SDK - A powerful SDK for building
|
|
5
5
|
* customer engagement features in React Native applications.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export * from './zixflow';
|
|
7
|
+
export * from './zixflow-cdp';
|
|
8
|
+
export * from './zixflow-geofence';
|
|
9
|
+
export * from './zixflow-inapp';
|
|
10
|
+
export * from './zixflow-liveactivities';
|
|
11
|
+
export * from './zixflow-location';
|
|
12
|
+
export * from './zixflow-push';
|
|
13
|
+
export * from './components';
|
|
14
|
+
export * from './types';
|
|
@@ -46,7 +46,7 @@ export type NotificationInboxSpec =
|
|
|
46
46
|
* Helper function to parse raw inbox message from native layer
|
|
47
47
|
* @internal
|
|
48
48
|
*/
|
|
49
|
-
function parseInboxMessage(raw: any): InboxMessage {
|
|
49
|
+
export function parseInboxMessage(raw: any): InboxMessage {
|
|
50
50
|
return {
|
|
51
51
|
queueId: raw.queueId,
|
|
52
52
|
deliveryId: raw.deliveryId ?? undefined,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// React Native docs now recommend Codegen types should be imported from the react-native package
|
|
2
|
+
// But it breaks on Expo and older React Native versions, so we import from react-native/Libraries/Types/CodegenTypes
|
|
3
|
+
// for compatibility with all versions until we can fully migrate to the new import style without breaking older versions
|
|
4
|
+
// https://reactnative.dev/docs/strict-typescript-api#codegen-types-should-now-be-imported-from-the-react-native-package
|
|
5
|
+
|
|
6
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
7
|
+
/* eslint-disable @react-native/no-deep-imports */
|
|
8
|
+
import type { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
|
|
9
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
10
|
+
|
|
11
|
+
/** Event data for inbox bell taps. Carries no payload; presence indicates a tap. */
|
|
12
|
+
export interface BellTapEvent {}
|
|
13
|
+
|
|
14
|
+
/** Props for the native NotificationInboxBell component. */
|
|
15
|
+
export interface NativeProps extends ViewProps {
|
|
16
|
+
/** Fired when the user taps the bell. Host should present its own inbox UI. */
|
|
17
|
+
onTap?: DirectEventHandler<BellTapEvent>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// React Native Codegen automatically generates the native component bridge based on the NativeProps interface.
|
|
21
|
+
// Public view is NotificationInboxBellView in the components directory.
|
|
22
|
+
export default codegenNativeComponent<NativeProps>(
|
|
23
|
+
'NotificationInboxBellNative'
|
|
24
|
+
) as HostComponent<NativeProps>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// React Native docs now recommend Codegen types should be imported from the react-native package
|
|
2
|
+
// But it breaks on Expo and older React Native versions, so we import from react-native/Libraries/Types/CodegenTypes
|
|
3
|
+
// for compatibility with all versions until we can fully migrate to the new import style without breaking older versions
|
|
4
|
+
// https://reactnative.dev/docs/strict-typescript-api#codegen-types-should-now-be-imported-from-the-react-native-package
|
|
5
|
+
|
|
6
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
7
|
+
/* eslint-disable @react-native/no-deep-imports */
|
|
8
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Props for the native NotificationInboxView component (the Jist-rendered message list).
|
|
12
|
+
* No required props; the host controls sizing via standard ViewProps style.
|
|
13
|
+
* Message actions are handled by the existing global InboxEventListener, so this
|
|
14
|
+
* component needs no per-component action callback.
|
|
15
|
+
*/
|
|
16
|
+
export interface NativeProps extends ViewProps {}
|
|
17
|
+
|
|
18
|
+
// React Native Codegen automatically generates the native component bridge based on the NativeProps interface.
|
|
19
|
+
// Public view is NotificationInboxView in the components directory.
|
|
20
|
+
export default codegenNativeComponent<NativeProps>(
|
|
21
|
+
'NotificationInboxViewNative'
|
|
22
|
+
) as HostComponent<NativeProps>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { TurboModuleRegistry, type TurboModule } from 'react-native';
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
EventEmitter,
|
|
4
|
+
UnsafeObject,
|
|
5
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
6
|
|
|
4
7
|
/**
|
|
5
8
|
* Native module specification for Zixflow React Native SDK
|
|
@@ -41,6 +44,11 @@ export interface Spec extends TurboModule {
|
|
|
41
44
|
config: NativeBridgeObject,
|
|
42
45
|
args: NativeBridgeObject
|
|
43
46
|
): Promise<void>;
|
|
47
|
+
setDeepLinkRoutingReady(): void;
|
|
48
|
+
readonly onDeepLinkReceived: EventEmitter<UnsafeObject>;
|
|
49
|
+
registerDeepLinkHandler(): void;
|
|
50
|
+
unregisterDeepLinkHandler(): void;
|
|
51
|
+
acknowledgeDeepLink(id: string, handled: boolean): void;
|
|
44
52
|
identify(params?: NativeBridgeObject): void;
|
|
45
53
|
clearIdentify(): void;
|
|
46
54
|
track(name: string, properties?: NativeBridgeObject): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TurboModuleRegistry, type TurboModule } from 'react-native';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Native module specification for Zixflow Geofence React Native SDK
|
|
5
|
+
*
|
|
6
|
+
* @see NativeZixflow.ts for detailed documentation on TurboModule patterns,
|
|
7
|
+
* Codegen compatibility, and type safety approach.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export interface Spec extends TurboModule {
|
|
11
|
+
refreshFromCurrentLocation(): void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default TurboModuleRegistry.get<Spec>('NativeZixflowGeofence');
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { TurboModuleRegistry, type TurboModule } from 'react-native';
|
|
2
|
+
import type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Native module specification for Zixflow Live Activities React Native SDK
|
|
6
|
+
*
|
|
7
|
+
* Live Activities (iOS) / Live Notifications (Android) let you show a live,
|
|
8
|
+
* updating notification driven by a built-in template (Segments, Countdown Timer)
|
|
9
|
+
* or by a custom type you render yourself.
|
|
10
|
+
*
|
|
11
|
+
* @see NativeZixflow.ts for detailed documentation on TurboModule patterns,
|
|
12
|
+
* Codegen compatibility, and type safety approach.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
type NativeBridgeObject = UnsafeObject;
|
|
16
|
+
|
|
17
|
+
export interface Spec extends TurboModule {
|
|
18
|
+
/** Report a Live Activity open and return the destination URL to route. */
|
|
19
|
+
handleWidgetUrl(url: string): Promise<string | null>;
|
|
20
|
+
/** Start an activity. Resolves with the SDK-minted activity id. */
|
|
21
|
+
start(payload: NativeBridgeObject): Promise<string>;
|
|
22
|
+
/** Replace the whole content-state of a running activity. Pass the full desired state. */
|
|
23
|
+
update(activityId: string, payload: NativeBridgeObject): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* End a running activity, optionally rendering a final content-state.
|
|
26
|
+
*
|
|
27
|
+
* `payload` is iOS-only: ActivityKit keeps the last content-state on screen unless a final one
|
|
28
|
+
* is supplied. Android renders its own terminal state, so it ignores the payload.
|
|
29
|
+
*/
|
|
30
|
+
end(activityId: string, payload?: NativeBridgeObject): Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Registered unconditionally on both platforms — Android in ZixflowReactNativePackage, iOS via
|
|
34
|
+
// an ObjC bridge that is always compiled. When the Live Activities pods are absent the module is
|
|
35
|
+
// still present and its methods reject with `live_activity_module_unavailable`, so `getEnforcing`
|
|
36
|
+
// is accurate here (unlike Location, which really can be absent and uses `get`).
|
|
37
|
+
export default TurboModuleRegistry.getEnforcing<Spec>(
|
|
38
|
+
'NativeZixflowLiveActivities'
|
|
39
|
+
);
|
|
@@ -14,7 +14,16 @@ import type {
|
|
|
14
14
|
/** TurboModule interface for Zixflow In-App Messaging native operations */
|
|
15
15
|
export interface Spec extends TurboModule {
|
|
16
16
|
dismissMessage(): void;
|
|
17
|
+
// Carries the ZixflowColorScheme string value; the enum itself cannot cross Codegen.
|
|
18
|
+
setColorScheme(colorScheme: string): void;
|
|
17
19
|
readonly onInAppEventReceived: EventEmitter<UnsafeObject>;
|
|
20
|
+
// Notification Inbox event listener methods.
|
|
21
|
+
// Registers/unregisters a native forwarder with the SDK so inbox events
|
|
22
|
+
// (action taken, shown, opened, dismissed) are emitted to JS. Distinct from
|
|
23
|
+
// onInAppEventReceived so inbox events never collide with in-app events.
|
|
24
|
+
registerInboxEventListener(): void;
|
|
25
|
+
unregisterInboxEventListener(): void;
|
|
26
|
+
readonly onInboxEventReceived: EventEmitter<UnsafeObject>;
|
|
18
27
|
// Notification Inbox related methods
|
|
19
28
|
setupInboxListener(): void;
|
|
20
29
|
readonly subscribeToMessagesChanged: EventEmitter<UnsafeObject>;
|
|
@@ -25,6 +34,8 @@ export interface Spec extends TurboModule {
|
|
|
25
34
|
trackMessageClicked(message: UnsafeObject, actionName?: string): void;
|
|
26
35
|
}
|
|
27
36
|
|
|
28
|
-
|
|
37
|
+
// Registered unconditionally on both platforms, like MessagingPush and DataPipelines — not
|
|
38
|
+
// gated by an optional subspec/module flag the way Location and Geofence are.
|
|
39
|
+
export default TurboModuleRegistry.getEnforcing<Spec>(
|
|
29
40
|
'NativeZixflowMessagingInApp'
|
|
30
41
|
);
|
|
@@ -22,6 +22,8 @@ export interface Spec extends TurboModule {
|
|
|
22
22
|
getPushPermissionStatus(): Promise<string>;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
// Registered unconditionally on both platforms, like MessagingInApp and DataPipelines — not
|
|
26
|
+
// gated by an optional subspec/module flag the way Location and Geofence are.
|
|
27
|
+
export default TurboModuleRegistry.getEnforcing<Spec>(
|
|
26
28
|
'NativeZixflowMessagingPush'
|
|
27
29
|
);
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { ZixflowColorScheme } from './in-app';
|
|
2
|
+
import type { NotificationInboxAccessibilityLabels } from './inbox';
|
|
3
|
+
import type { LiveActivitiesConfig } from './live-activities';
|
|
1
4
|
import type { PushClickBehaviorAndroid } from './push';
|
|
2
5
|
|
|
3
6
|
/**
|
|
@@ -36,11 +39,9 @@ export interface IdentifyParams {
|
|
|
36
39
|
/**
|
|
37
40
|
* Configuration options for initializing the Zixflow SDK.
|
|
38
41
|
*
|
|
39
|
-
* @param
|
|
40
|
-
* @param migrationSiteId - Legacy site ID for migrating from tracking API
|
|
41
|
-
* @param region - Data center region (US or EU)
|
|
42
|
+
* @param apiKey - API key from Zixflow dashboard
|
|
42
43
|
* @param logLevel - SDK logging verbosity level
|
|
43
|
-
* @param apiHost - Override the
|
|
44
|
+
* @param apiHost - Override the API host. Use to route SDK traffic through a first-party proxy.
|
|
44
45
|
* @param cdnHost - Override the CDN host. Use to route SDK traffic through a first-party proxy.
|
|
45
46
|
* @param flushAt - Number of events to batch before sending
|
|
46
47
|
* @param flushInterval - Time interval (seconds) to flush events
|
|
@@ -53,9 +54,7 @@ export interface IdentifyParams {
|
|
|
53
54
|
* @public
|
|
54
55
|
*/
|
|
55
56
|
export type ZixflowConfig = {
|
|
56
|
-
|
|
57
|
-
migrationSiteId?: string;
|
|
58
|
-
region?: ZixflowRegion;
|
|
57
|
+
apiKey: string;
|
|
59
58
|
logLevel?: ZixflowLogLevel;
|
|
60
59
|
apiHost?: string;
|
|
61
60
|
cdnHost?: string;
|
|
@@ -65,7 +64,19 @@ export type ZixflowConfig = {
|
|
|
65
64
|
trackApplicationLifecycleEvents?: boolean;
|
|
66
65
|
autoTrackDeviceAttributes?: boolean;
|
|
67
66
|
inApp?: {
|
|
68
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Color scheme used to render in-app messages. Defaults to `ZixflowColorScheme.Auto`, which
|
|
69
|
+
* follows the device appearance. Set it when the app has its own appearance setting that
|
|
70
|
+
* can disagree with the operating system.
|
|
71
|
+
*
|
|
72
|
+
* Can be changed after initialization with `Zixflow.inAppMessaging.setColorScheme`.
|
|
73
|
+
*/
|
|
74
|
+
colorScheme?: ZixflowColorScheme;
|
|
75
|
+
/**
|
|
76
|
+
* Accessibility labels for the Visual Notification Inbox. Optional; an omitted label leaves
|
|
77
|
+
* that element unlabeled rather than falling back to English.
|
|
78
|
+
*/
|
|
79
|
+
notificationInboxAccessibilityLabels?: NotificationInboxAccessibilityLabels;
|
|
69
80
|
};
|
|
70
81
|
push?: {
|
|
71
82
|
android?: {
|
|
@@ -73,9 +84,32 @@ export type ZixflowConfig = {
|
|
|
73
84
|
};
|
|
74
85
|
};
|
|
75
86
|
location?: {
|
|
76
|
-
/** Location tracking mode. Defaults to 'manual' if location config is provided. */
|
|
77
87
|
trackingMode?: ZixflowLocationTrackingMode;
|
|
78
88
|
};
|
|
89
|
+
/**
|
|
90
|
+
* Geofence configuration. Providing this opts the app into geofence monitoring,
|
|
91
|
+
* which runs automatically once enabled. Enabling geofence also enables the
|
|
92
|
+
* Location module, which geofence depends on.
|
|
93
|
+
*/
|
|
94
|
+
geofence?: {
|
|
95
|
+
/**
|
|
96
|
+
* How the SDK acquires location fixes for geofence monitoring. Defaults to
|
|
97
|
+
* `AUTOMATIC` (the SDK acquires location itself on identify and app launch). Use
|
|
98
|
+
* `MANUAL` to drive refreshes yourself via
|
|
99
|
+
* `Zixflow.geofence.refreshFromCurrentLocation()`.
|
|
100
|
+
*/
|
|
101
|
+
locationMode?: ZixflowGeofenceLocationMode;
|
|
102
|
+
};
|
|
103
|
+
/** iOS-only SDK configuration. Has no effect on Android. */
|
|
104
|
+
ios?: {
|
|
105
|
+
/**
|
|
106
|
+
* Whether geofence transitions are delivered in real time on a background cold-wake.
|
|
107
|
+
* When unset, defaults to on if the geofence module is enabled, off otherwise.
|
|
108
|
+
*/
|
|
109
|
+
allowBackgroundDelivery?: boolean;
|
|
110
|
+
};
|
|
111
|
+
/** Live Activities (iOS) / Live Notifications (Android) configuration. */
|
|
112
|
+
liveNotifications?: LiveActivitiesConfig;
|
|
79
113
|
};
|
|
80
114
|
|
|
81
115
|
/**
|
|
@@ -96,16 +130,6 @@ export enum ZixflowLogLevel {
|
|
|
96
130
|
Debug = 'debug',
|
|
97
131
|
}
|
|
98
132
|
|
|
99
|
-
/**
|
|
100
|
-
* Data center regions for Zixflow API endpoints.
|
|
101
|
-
*
|
|
102
|
-
* @public
|
|
103
|
-
*/
|
|
104
|
-
export enum ZixflowRegion {
|
|
105
|
-
US = 'US',
|
|
106
|
-
EU = 'EU',
|
|
107
|
-
}
|
|
108
|
-
|
|
109
133
|
/**
|
|
110
134
|
* Screen view tracking behavior configuration.
|
|
111
135
|
*
|
|
@@ -135,6 +159,18 @@ export enum ZixflowLocationTrackingMode {
|
|
|
135
159
|
OnAppStart = 'ON_APP_START',
|
|
136
160
|
}
|
|
137
161
|
|
|
162
|
+
/**
|
|
163
|
+
* How the Geofence module acquires location fixes.
|
|
164
|
+
*
|
|
165
|
+
* @public
|
|
166
|
+
*/
|
|
167
|
+
export enum ZixflowGeofenceLocationMode {
|
|
168
|
+
/** SDK acquires location itself (on identify and app launch). Default. */
|
|
169
|
+
Automatic = 'AUTOMATIC',
|
|
170
|
+
/** Host drives refreshes via `Zixflow.geofence.refreshFromCurrentLocation()`. */
|
|
171
|
+
Manual = 'MANUAL',
|
|
172
|
+
}
|
|
173
|
+
|
|
138
174
|
/**
|
|
139
175
|
* Enum to specify the type of metric for tracking
|
|
140
176
|
*
|
package/src/types/in-app.ts
CHANGED
|
@@ -27,6 +27,29 @@ export enum InAppMessageEventType {
|
|
|
27
27
|
messageShown = 'messageShown',
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Color scheme used to render in-app messages.
|
|
32
|
+
*
|
|
33
|
+
* Selects which of the light/dark variants authored in the Zixflow editor is
|
|
34
|
+
* rendered. Use it when the app has its own appearance setting that can disagree with
|
|
35
|
+
* the operating system: `Auto` follows the device, while `Light` and `Dark` pin the
|
|
36
|
+
* variant regardless of it.
|
|
37
|
+
*
|
|
38
|
+
* The string values are the wire contract shared with both native SDKs, which match
|
|
39
|
+
* them lowercase and resolve anything unrecognized to `auto` — so they must stay
|
|
40
|
+
* exactly as written here even if the members are renamed.
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
export enum ZixflowColorScheme {
|
|
45
|
+
/** Follow the device's current appearance. The default when unset. */
|
|
46
|
+
Auto = 'auto',
|
|
47
|
+
/** Always render the light variant, whatever the device is set to. */
|
|
48
|
+
Light = 'light',
|
|
49
|
+
/** Always render the dark variant, whatever the device is set to. */
|
|
50
|
+
Dark = 'dark',
|
|
51
|
+
}
|
|
52
|
+
|
|
30
53
|
/**
|
|
31
54
|
* Represents an inbox message for a user.
|
|
32
55
|
*
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { InboxMessage } from './in-app';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Enum representing the type of event triggered by an inbox event callback.
|
|
5
|
+
*
|
|
6
|
+
* Mirrors the native `InboxEventListener` contract on iOS and Android.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export enum InboxEventType {
|
|
11
|
+
/** A non-dismiss action (e.g. a button/link) was taken on an inbox message. */
|
|
12
|
+
messageActionTaken = 'messageActionTaken',
|
|
13
|
+
/** An inbox message was first shown/rendered in the visible inbox view. */
|
|
14
|
+
messageShown = 'messageShown',
|
|
15
|
+
/** An inbox message was marked opened (e.g. when the panel opens). */
|
|
16
|
+
messageOpened = 'messageOpened',
|
|
17
|
+
/** An inbox message was dismissed/removed from the inbox. */
|
|
18
|
+
messageDismissed = 'messageDismissed',
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Event delivered to a registered inbox event listener.
|
|
23
|
+
*
|
|
24
|
+
* `messageActionTaken` carries `actionName`/`actionValue`; the observational
|
|
25
|
+
* events (`messageShown`, `messageOpened`, `messageDismissed`) carry only the
|
|
26
|
+
* message.
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
export class InboxMessageEvent {
|
|
31
|
+
/** The type of inbox event. */
|
|
32
|
+
eventType: InboxEventType;
|
|
33
|
+
/** The inbox message the event relates to. */
|
|
34
|
+
message: InboxMessage;
|
|
35
|
+
/** The Jist action name (only present for `messageActionTaken`). */
|
|
36
|
+
actionName?: string;
|
|
37
|
+
/** The resolved action value, typically a url (only present for `messageActionTaken`). */
|
|
38
|
+
actionValue?: string;
|
|
39
|
+
|
|
40
|
+
constructor(
|
|
41
|
+
eventType: InboxEventType,
|
|
42
|
+
message: InboxMessage,
|
|
43
|
+
actionName?: string,
|
|
44
|
+
actionValue?: string
|
|
45
|
+
) {
|
|
46
|
+
this.eventType = eventType;
|
|
47
|
+
this.message = message;
|
|
48
|
+
this.actionName = actionName;
|
|
49
|
+
this.actionValue = actionValue;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Host-provided accessibility labels for the Visual Notification Inbox UI.
|
|
55
|
+
*
|
|
56
|
+
* The SDK ships no text of its own in the visual inbox — the empty state is an icon and the
|
|
57
|
+
* loading state is a spinner — so accessibility labels are the one place a string is still
|
|
58
|
+
* needed. Because the SDK cannot know your app's language, every label is optional and unset by
|
|
59
|
+
* default, and an omitted label leaves that element unlabeled rather than falling back to
|
|
60
|
+
* English. Pass strings already localized for the user's language.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* Zixflow.initialize({
|
|
65
|
+
* apiKey: '...',
|
|
66
|
+
* inApp: {
|
|
67
|
+
* siteId: '...',
|
|
68
|
+
* notificationInboxAccessibilityLabels: {
|
|
69
|
+
* bell: t('inbox.bell'),
|
|
70
|
+
* bellWithUnreadCount: t('inbox.unread'), // e.g. "{count} unread notifications"
|
|
71
|
+
* loadingIndicator: t('inbox.loading'),
|
|
72
|
+
* emptyState: t('inbox.empty'),
|
|
73
|
+
* },
|
|
74
|
+
* },
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
80
|
+
export type NotificationInboxAccessibilityLabels = {
|
|
81
|
+
/**
|
|
82
|
+
* Label for the inbox bell button. Also used when the bell shows an unread badge but
|
|
83
|
+
* `bellWithUnreadCount` is not provided. Unset → the bell is announced as an unnamed button
|
|
84
|
+
* (it stays focusable and tappable; hiding it would leave screen reader users no way in).
|
|
85
|
+
*/
|
|
86
|
+
bell?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Label for the bell while it shows an unread badge. Include `{count}` where the number of
|
|
89
|
+
* unread messages should appear; it is substituted at render time. Unset → falls back to `bell`.
|
|
90
|
+
*
|
|
91
|
+
* The badge itself is always hidden from assistive technologies, so the count is announced
|
|
92
|
+
* only through this label, never as bare digits appended to the button.
|
|
93
|
+
*
|
|
94
|
+
* This is a template rather than a function because configuration crosses the native bridge,
|
|
95
|
+
* which carries data but not callbacks. One template cannot express languages whose plural
|
|
96
|
+
* rules need a distinct form per count.
|
|
97
|
+
*/
|
|
98
|
+
bellWithUnreadCount?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Label announced for the loading spinner.
|
|
101
|
+
*
|
|
102
|
+
* Unset behaves differently per platform: on Android the spinner keeps its indeterminate
|
|
103
|
+
* progress role, which TalkBack describes in the device's own language, while on iOS it is not
|
|
104
|
+
* an accessibility element at all, so VoiceOver skips it rather than focusing an unnamed
|
|
105
|
+
* control. Set a label if you want the loading state announced on both.
|
|
106
|
+
*/
|
|
107
|
+
loadingIndicator?: string;
|
|
108
|
+
/** Label announced for the empty-state icon. Unset → the icon is treated as decorative. */
|
|
109
|
+
emptyState?: string;
|
|
110
|
+
};
|
package/src/types/index.ts
CHANGED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public types for the Live Activities module.
|
|
3
|
+
*
|
|
4
|
+
* Live Activities (iOS) / Live Notifications (Android) render live, updating
|
|
5
|
+
* notifications from built-in templates. Two templates ship today: Segments and
|
|
6
|
+
* Countdown Timer. Field names and identifiers are identical across platforms.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Built-in activity type identifiers usable from the wrapper.
|
|
11
|
+
*
|
|
12
|
+
* The values are the reverse-DNS identifiers Zixflow uses everywhere — the
|
|
13
|
+
* `notificationType` on the wire, Android's `LiveNotificationType`, and iOS's
|
|
14
|
+
* `CIOSegmentsAttributes.identifier` — so JS, both native SDKs, and the backend
|
|
15
|
+
* share one vocabulary.
|
|
16
|
+
*
|
|
17
|
+
* Use these enum members (not raw strings) for `LiveActivitiesConfig.types` and a
|
|
18
|
+
* payload's `type` to avoid typos.
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export enum LiveActivityTemplate {
|
|
23
|
+
Segments = 'com.zixflow.livenotifications.segments',
|
|
24
|
+
CountdownTimer = 'com.zixflow.livenotifications.countdowntimer',
|
|
25
|
+
/**
|
|
26
|
+
* Your own activity type, rendered by SwiftUI you write.
|
|
27
|
+
*
|
|
28
|
+
* Unlike the members above, this value is a marker rather than an identifier — your activity is
|
|
29
|
+
* named by {@link LiveActivitiesConfig.customType}, and the SDK reports it under that name. It
|
|
30
|
+
* belongs in a payload's `type`, never in {@link LiveActivitiesConfig.types}.
|
|
31
|
+
*/
|
|
32
|
+
Custom = 'custom',
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Segments template — a progress activity split into N segments.
|
|
37
|
+
* `header` is a static attribute (fixed at start); the rest are content-state.
|
|
38
|
+
*
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
export interface LiveActivitySegmentsPayload {
|
|
42
|
+
type: LiveActivityTemplate.Segments;
|
|
43
|
+
/** Static header line (set at start, never changes). */
|
|
44
|
+
header: string;
|
|
45
|
+
/** Primary status line. */
|
|
46
|
+
status: string;
|
|
47
|
+
/** Optional secondary status line. */
|
|
48
|
+
substatus?: string;
|
|
49
|
+
/** Total number of segments. */
|
|
50
|
+
segmentsTotal: number;
|
|
51
|
+
/** Number of completed segments (clamped to 0..segmentsTotal). */
|
|
52
|
+
segmentsComplete: number;
|
|
53
|
+
/** Optional trailing text (e.g. an ETA). */
|
|
54
|
+
trailingText?: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Custom template — your own activity type, rendered by SwiftUI you write.
|
|
59
|
+
*
|
|
60
|
+
* Unlike the built-in templates there is no schema: `data` is an untyped map, because a bridge
|
|
61
|
+
* payload carries nothing for the SDK to validate against. Every value is a string, so your widget
|
|
62
|
+
* parses whichever ones it needs.
|
|
63
|
+
*
|
|
64
|
+
* Requires {@link LiveActivitiesConfig.customType} to be set. On iOS you must also render
|
|
65
|
+
* `CIOCustomAttributes` in your Widget Extension; on Android your `createLiveNotification`
|
|
66
|
+
* callback receives the same map.
|
|
67
|
+
*
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
export interface LiveActivityCustomPayload {
|
|
71
|
+
type: LiveActivityTemplate.Custom;
|
|
72
|
+
/**
|
|
73
|
+
* The full content-state, re-sent in its entirety on every update. Neither platform keeps a
|
|
74
|
+
* static/dynamic split for custom types, so include anything your widget needs each time.
|
|
75
|
+
*
|
|
76
|
+
* Values must be strings. Numbers and booleans are coerced, but nested objects and arrays are
|
|
77
|
+
* not supported and the platforms disagree on them — iOS drops them, Android stringifies them —
|
|
78
|
+
* so flatten anything structured before sending it.
|
|
79
|
+
*/
|
|
80
|
+
data: Record<string, string>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Countdown Timer template — a live countdown to a target time.
|
|
85
|
+
* `header` is a static attribute (fixed at start); the rest are content-state.
|
|
86
|
+
*
|
|
87
|
+
* @public
|
|
88
|
+
*/
|
|
89
|
+
export interface LiveActivityCountdownTimerPayload {
|
|
90
|
+
type: LiveActivityTemplate.CountdownTimer;
|
|
91
|
+
/** Static header line (set at start, never changes). */
|
|
92
|
+
header: string;
|
|
93
|
+
/** Primary title line. */
|
|
94
|
+
title: string;
|
|
95
|
+
/** Optional status message. */
|
|
96
|
+
statusMessage?: string;
|
|
97
|
+
/** Target time as epoch **seconds**. Omit to render the finished state. */
|
|
98
|
+
endTime?: number;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Payload for {@link ZixflowLiveActivities.start} and
|
|
103
|
+
* {@link ZixflowLiveActivities.update}.
|
|
104
|
+
*
|
|
105
|
+
* Because ActivityKit replaces content-state wholesale on update, `update` takes the
|
|
106
|
+
* same full payload as `start` — pass the complete desired state each time.
|
|
107
|
+
*
|
|
108
|
+
* @public
|
|
109
|
+
*/
|
|
110
|
+
export type LiveActivityPayload =
|
|
111
|
+
| LiveActivitySegmentsPayload
|
|
112
|
+
| LiveActivityCountdownTimerPayload
|
|
113
|
+
| LiveActivityCustomPayload;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Live Activities branding (Android only). On iOS, branding is compiled into the
|
|
117
|
+
* widget extension's SwiftUI, so these values are ignored there.
|
|
118
|
+
*
|
|
119
|
+
* @public
|
|
120
|
+
*/
|
|
121
|
+
export interface LiveActivitiesBranding {
|
|
122
|
+
/** Reserved for future use. */
|
|
123
|
+
companyName?: string;
|
|
124
|
+
/** Accent color as "#RRGGBB". */
|
|
125
|
+
accentColorHex?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Bundled Android drawable resource name for the logo, resolved natively.
|
|
128
|
+
* Preferred over {@link LiveActivitiesBranding.logoUrl} when both are set — it
|
|
129
|
+
* needs no network.
|
|
130
|
+
*/
|
|
131
|
+
logoResource?: string;
|
|
132
|
+
/** Remote logo URL (downloaded and cached natively). */
|
|
133
|
+
logoUrl?: string;
|
|
134
|
+
/** Android drawable resource name, resolved natively. */
|
|
135
|
+
smallIconResource?: string;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Live Activities configuration, passed under the `liveNotifications` key of the SDK config.
|
|
140
|
+
*
|
|
141
|
+
* @public
|
|
142
|
+
*/
|
|
143
|
+
export interface LiveActivitiesConfig {
|
|
144
|
+
/**
|
|
145
|
+
* Built-in activity types to enable. Enables the matching native type on each
|
|
146
|
+
* platform and registers push-to-start for it. Unrecognized identifiers are
|
|
147
|
+
* ignored, so a newer native template can't break an older wrapper build.
|
|
148
|
+
*
|
|
149
|
+
* `Custom` is excluded on purpose — it is enabled by {@link LiveActivitiesConfig.customType},
|
|
150
|
+
* and both platforms would silently drop it from this list.
|
|
151
|
+
*/
|
|
152
|
+
types?: Exclude<LiveActivityTemplate, LiveActivityTemplate.Custom>[];
|
|
153
|
+
/**
|
|
154
|
+
* Your own reverse-DNS identifier for the custom activity type, e.g.
|
|
155
|
+
* `'com.myapp.rideshare'`. Setting it enables the custom template on both platforms.
|
|
156
|
+
*
|
|
157
|
+
* Start one with `{ type: LiveActivityTemplate.Custom, data: { … } }`; the SDK reports it
|
|
158
|
+
* under this identifier, and your campaigns target it by the same name.
|
|
159
|
+
*
|
|
160
|
+
* Singular by design: iOS resolves an activity's type from its Swift attributes type, and
|
|
161
|
+
* every custom activity shares one. A second identifier could not be told apart, so one
|
|
162
|
+
* identifier is the limit rather than a silent mis-attribution.
|
|
163
|
+
*
|
|
164
|
+
* You must also render it yourself — `CIOCustomAttributes` in an iOS Widget Extension, and
|
|
165
|
+
* the `createLiveNotification` callback on Android.
|
|
166
|
+
*/
|
|
167
|
+
customType?: string;
|
|
168
|
+
/** Android Live Notification branding (ignored on iOS). */
|
|
169
|
+
branding?: LiveActivitiesBranding;
|
|
170
|
+
}
|