zixflow-reactnative 1.1.3 → 1.1.5
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 +631 -261
- 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 +41 -5
- 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 -0
- 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/messaginginapp/NativeMessagingInAppModule.kt +150 -0
- 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 +15 -2
- 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 +91 -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/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 +13 -1
- 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 +76 -1
- package/lib/commonjs/utils/param-validation.js.map +1 -1
- package/lib/commonjs/zixflow-cdp.js +99 -1
- 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/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 +13 -0
- 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 +76 -1
- package/lib/module/utils/param-validation.js.map +1 -1
- package/lib/module/zixflow-cdp.js +99 -1
- 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/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 +53 -1
- 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/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 +53 -1
- 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/package.json +11 -2
- 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 +54 -1
- 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 +103 -0
- package/src/zixflow-cdp.ts +117 -1
- package/src/zixflow-geofence.ts +56 -0
- package/src/zixflow-inapp.ts +125 -2
- package/src/zixflow-liveactivities.ts +86 -0
- package/zixflow-reactnative-richpush.podspec +4 -1
- package/zixflow-reactnative.podspec +26 -0
package/src/zixflow-inapp.ts
CHANGED
|
@@ -3,13 +3,16 @@ import { InlineInAppMessageView } from './components';
|
|
|
3
3
|
import { NativeLoggerListener } from './native-logger-listener';
|
|
4
4
|
import {
|
|
5
5
|
NotificationInbox,
|
|
6
|
+
parseInboxMessage,
|
|
6
7
|
type NotificationInboxSpec,
|
|
7
8
|
} from './notification-inbox';
|
|
8
9
|
import NativeZixflowMessagingInApp, {
|
|
9
10
|
type Spec as CodegenSpec,
|
|
10
11
|
} from './specs/modules/NativeZixflowMessagingInApp';
|
|
11
|
-
import type { InAppMessageEventType } from './types';
|
|
12
|
+
import type { ZixflowColorScheme, InAppMessageEventType } from './types';
|
|
13
|
+
import { InboxEventType, InboxMessageEvent } from './types';
|
|
12
14
|
import { callNativeModule, ensureNativeModule } from './utils/native-bridge';
|
|
15
|
+
import { assert } from './utils/param-validation';
|
|
13
16
|
|
|
14
17
|
/**
|
|
15
18
|
* Ensures all methods defined in codegen spec are implemented by the public module
|
|
@@ -18,7 +21,12 @@ import { callNativeModule, ensureNativeModule } from './utils/native-bridge';
|
|
|
18
21
|
*/
|
|
19
22
|
interface NativeInAppSpec extends Omit<
|
|
20
23
|
CodegenSpec,
|
|
21
|
-
keyof TurboModule
|
|
24
|
+
| keyof TurboModule
|
|
25
|
+
| NotificationInboxSpec
|
|
26
|
+
| 'onInAppEventReceived'
|
|
27
|
+
| 'registerInboxEventListener'
|
|
28
|
+
| 'unregisterInboxEventListener'
|
|
29
|
+
| 'onInboxEventReceived'
|
|
22
30
|
> {}
|
|
23
31
|
|
|
24
32
|
// Reference to the native Zixflow Data Pipelines module for SDK operations
|
|
@@ -37,6 +45,13 @@ const withNativeModule = <R>(fn: (native: CodegenSpec) => R): R => {
|
|
|
37
45
|
class ZixflowInAppMessaging implements NativeInAppSpec {
|
|
38
46
|
private _notificationInbox?: NotificationInbox;
|
|
39
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Live inbox subscriptions. The SDK's inbox forwarder is a SINGLE global listener, so it is
|
|
50
|
+
* registered when the first subscription is created and unregistered when the last one goes away —
|
|
51
|
+
* never per subscription, or one `remove()` would tear it out from under the others.
|
|
52
|
+
*/
|
|
53
|
+
private _inboxListenerCount = 0;
|
|
54
|
+
|
|
40
55
|
registerEventsListener(
|
|
41
56
|
listener: (event: InAppMessageEvent) => void
|
|
42
57
|
): EventSubscription {
|
|
@@ -74,6 +89,91 @@ class ZixflowInAppMessaging implements NativeInAppSpec {
|
|
|
74
89
|
});
|
|
75
90
|
}
|
|
76
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Registers a listener for Visual Notification Inbox events (action taken,
|
|
94
|
+
* shown, opened, dismissed).
|
|
95
|
+
*
|
|
96
|
+
* While a listener is registered the host owns action navigation: the native
|
|
97
|
+
* SDK suppresses its default action handling and forwards the event here.
|
|
98
|
+
* Call `.remove()` on the returned subscription to unregister and restore the
|
|
99
|
+
* SDK's default behavior.
|
|
100
|
+
*
|
|
101
|
+
* @param listener - callback invoked with an {@link InboxMessageEvent}
|
|
102
|
+
* @returns an EventSubscription; call `.remove()` to stop listening
|
|
103
|
+
*/
|
|
104
|
+
registerInboxEventListener(
|
|
105
|
+
listener: (event: InboxMessageEvent) => void
|
|
106
|
+
): EventSubscription {
|
|
107
|
+
const emitter = (data: any) => {
|
|
108
|
+
// Convert raw native payload to InboxMessageEvent with a parsed message
|
|
109
|
+
const event = new InboxMessageEvent(
|
|
110
|
+
data.eventType as InboxEventType,
|
|
111
|
+
parseInboxMessage(data.message),
|
|
112
|
+
data.actionName,
|
|
113
|
+
data.actionValue
|
|
114
|
+
);
|
|
115
|
+
listener(event);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
return withNativeModule((native) => {
|
|
119
|
+
let registeredNativeForwarder = false;
|
|
120
|
+
try {
|
|
121
|
+
// Register the native forwarder with the SDK, then subscribe to the
|
|
122
|
+
// codegen-generated event emitter.
|
|
123
|
+
// Wrapped in try-catch due to previous reports of crashes on certain Android architectures.
|
|
124
|
+
if (this._inboxListenerCount === 0) {
|
|
125
|
+
native.registerInboxEventListener();
|
|
126
|
+
registeredNativeForwarder = true;
|
|
127
|
+
}
|
|
128
|
+
const subscription = native.onInboxEventReceived(emitter);
|
|
129
|
+
this._inboxListenerCount += 1;
|
|
130
|
+
|
|
131
|
+
// Wrap remove() so unregistering the LAST JS listener also unregisters the native forwarder
|
|
132
|
+
// (restoring the SDK's default action handling). Guarded so a double remove() cannot
|
|
133
|
+
// unbalance the count and drop the forwarder while other subscriptions are still live.
|
|
134
|
+
const originalRemove = subscription.remove.bind(subscription);
|
|
135
|
+
let removed = false;
|
|
136
|
+
subscription.remove = () => {
|
|
137
|
+
if (removed) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
removed = true;
|
|
141
|
+
originalRemove();
|
|
142
|
+
this._inboxListenerCount -= 1;
|
|
143
|
+
if (this._inboxListenerCount === 0) {
|
|
144
|
+
withNativeModule((n) => n.unregisterInboxEventListener());
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
return subscription;
|
|
148
|
+
} catch (error) {
|
|
149
|
+
// If the forwarder was registered and subscribing then failed, roll it back. Otherwise the
|
|
150
|
+
// SDK keeps suppressing its own action handling while nothing in JS is listening, so inbox
|
|
151
|
+
// actions are reported as handled and silently go nowhere.
|
|
152
|
+
if (registeredNativeForwarder) {
|
|
153
|
+
try {
|
|
154
|
+
native.unregisterInboxEventListener();
|
|
155
|
+
} catch (rollbackError) {
|
|
156
|
+
NativeLoggerListener.warn(
|
|
157
|
+
'Failed to roll back inbox listener registration:',
|
|
158
|
+
rollbackError
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
NativeLoggerListener.warn(
|
|
163
|
+
'Failed to attach inbox event listener:',
|
|
164
|
+
error
|
|
165
|
+
);
|
|
166
|
+
// Return a no-op subscription to maintain backwards compatibility
|
|
167
|
+
return {
|
|
168
|
+
remove: () => {},
|
|
169
|
+
eventType: '',
|
|
170
|
+
key: 0,
|
|
171
|
+
subscriber: null as any,
|
|
172
|
+
} as EventSubscription;
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
77
177
|
/**
|
|
78
178
|
* Dismisses any currently displayed in-app message
|
|
79
179
|
*/
|
|
@@ -81,6 +181,23 @@ class ZixflowInAppMessaging implements NativeInAppSpec {
|
|
|
81
181
|
withNativeModule((native) => native.dismissMessage());
|
|
82
182
|
}
|
|
83
183
|
|
|
184
|
+
/**
|
|
185
|
+
* Overrides the color scheme used to render in-app messages.
|
|
186
|
+
*
|
|
187
|
+
* Takes effect immediately: messages already on screen — inline views included — are
|
|
188
|
+
* re-themed in place, so this can be called whenever the app's appearance setting
|
|
189
|
+
* changes rather than only before a message is shown.
|
|
190
|
+
*
|
|
191
|
+
* @param colorScheme - scheme to render with; `ZixflowColorScheme.Auto` returns to following
|
|
192
|
+
* the device appearance
|
|
193
|
+
*/
|
|
194
|
+
setColorScheme(colorScheme: ZixflowColorScheme) {
|
|
195
|
+
// Validated here as well as in `initialize`: this is a public method reachable from
|
|
196
|
+
// untyped JavaScript, and without it a bad value reaches the native fallback silently.
|
|
197
|
+
assert.colorScheme(colorScheme);
|
|
198
|
+
withNativeModule((native) => native.setColorScheme(colorScheme));
|
|
199
|
+
}
|
|
200
|
+
|
|
84
201
|
/**
|
|
85
202
|
* Gets the message inbox instance for managing inbox messages
|
|
86
203
|
*
|
|
@@ -122,6 +239,12 @@ class InAppMessageEvent {
|
|
|
122
239
|
|
|
123
240
|
// Export in-app messaging types and components for simplified imports
|
|
124
241
|
export type { InlineInAppMessageViewProps } from './components';
|
|
242
|
+
export type {
|
|
243
|
+
NotificationInboxBellViewProps,
|
|
244
|
+
NotificationInboxViewProps,
|
|
245
|
+
} from './components';
|
|
246
|
+
export { NotificationInboxBellView, NotificationInboxView } from './components';
|
|
125
247
|
export { NotificationInbox } from './notification-inbox';
|
|
126
248
|
export type { InboxMessage, NotificationInboxChangeListener } from './types';
|
|
249
|
+
export { InboxEventType, InboxMessageEvent } from './types';
|
|
127
250
|
export { ZixflowInAppMessaging, InAppMessageEvent, InlineInAppMessageView };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type TurboModule } from 'react-native';
|
|
2
|
+
import {
|
|
3
|
+
default as NativeModule,
|
|
4
|
+
type Spec as CodegenSpec,
|
|
5
|
+
} from './specs/modules/NativeZixflowLiveActivities';
|
|
6
|
+
import type { LiveActivityPayload } from './types/live-activities';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Ensures all methods defined in codegen spec are implemented by the public module
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
interface NativeLiveActivitiesSpec extends Omit<
|
|
14
|
+
CodegenSpec,
|
|
15
|
+
keyof TurboModule
|
|
16
|
+
> {}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Live Activities (iOS) / Live Notifications (Android).
|
|
20
|
+
*
|
|
21
|
+
* Start, update, and end live, updating notifications from built-in templates
|
|
22
|
+
* (Segments, Countdown Timer). Enable the activity types via the `liveNotifications`
|
|
23
|
+
* key of the SDK config passed to {@link Zixflow.initialize}.
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export class ZixflowLiveActivities implements NativeLiveActivitiesSpec {
|
|
28
|
+
/**
|
|
29
|
+
* Report an opened Live Activity and return the URL the app should route.
|
|
30
|
+
*
|
|
31
|
+
* Zixflow tracking URLs are unwrapped to their destination after attribution is recorded.
|
|
32
|
+
* A tracking URL without a destination returns `null`; any other URL is returned unchanged.
|
|
33
|
+
* This method never rejects, so it can safely compose with Expo Router's
|
|
34
|
+
* `redirectSystemPath` hook. On Android it is a pass-through.
|
|
35
|
+
*
|
|
36
|
+
* Use this in exactly one URL-routing layer. Calling it more than once for the same Zixflow
|
|
37
|
+
* tracking URL reports more than one opened event.
|
|
38
|
+
*
|
|
39
|
+
* @param url - The incoming URL from the host's linking lifecycle.
|
|
40
|
+
* @returns The URL to route, or `null` when the Zixflow URL has no destination.
|
|
41
|
+
*/
|
|
42
|
+
async handleWidgetUrl(url: string): Promise<string | null> {
|
|
43
|
+
try {
|
|
44
|
+
return await NativeModule.handleWidgetUrl(url);
|
|
45
|
+
} catch {
|
|
46
|
+
return url;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Start a built-in-template activity.
|
|
52
|
+
*
|
|
53
|
+
* @param payload - Template payload; `payload.type` selects the template.
|
|
54
|
+
* @returns The SDK-minted activity id, used for later `update`/`end`.
|
|
55
|
+
*/
|
|
56
|
+
start(payload: LiveActivityPayload): Promise<string> {
|
|
57
|
+
return NativeModule.start(payload);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Replace the whole content-state of a running activity.
|
|
62
|
+
*
|
|
63
|
+
* ActivityKit (iOS) replaces content-state wholesale, so pass the **full** desired
|
|
64
|
+
* state — not just the changed fields. Static attributes (e.g. `header`) cannot
|
|
65
|
+
* change after start and are ignored on iOS.
|
|
66
|
+
*
|
|
67
|
+
* @param activityId - Id returned by {@link ZixflowLiveActivities.start}.
|
|
68
|
+
* @param payload - The complete desired state.
|
|
69
|
+
*/
|
|
70
|
+
update(activityId: string, payload: LiveActivityPayload): Promise<void> {
|
|
71
|
+
return NativeModule.update(activityId, payload);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* End a running activity, optionally rendering a final content-state.
|
|
76
|
+
*
|
|
77
|
+
* @param activityId - Id returned by {@link ZixflowLiveActivities.start}.
|
|
78
|
+
* @param payload - **iOS only.** The final content-state to render as the activity ends.
|
|
79
|
+
* ActivityKit keeps the last content-state on screen when none is given, so pass one to show
|
|
80
|
+
* a terminal state (e.g. all segments complete). Android renders its own terminal state and
|
|
81
|
+
* ignores this.
|
|
82
|
+
*/
|
|
83
|
+
end(activityId: string, payload?: LiveActivityPayload): Promise<void> {
|
|
84
|
+
return NativeModule.end(activityId, payload);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -15,7 +15,10 @@ Pod::Spec.new do |s|
|
|
|
15
15
|
|
|
16
16
|
s.source = { :git => "https://github.com/zixflow/zixflow-reactnative.git", :tag => "#{s.version}" }
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
# Dependency-only pod: installed into the NSE target, whose job is purely to pull in the minimal
|
|
19
|
+
# CIO push dependency below. It must NOT compile any sources — everything under ios/ is the React
|
|
20
|
+
# Native bridge (React + DataPipelines + InApp + Inbox), none of which the NSE target has or should
|
|
21
|
+
# have. Globbing them here made the NSE compile the whole bridge and fail on React headers.
|
|
19
22
|
|
|
20
23
|
# Note: Zixflow iOS SDK dependencies need to be added to NSE target via CocoaPods
|
|
21
24
|
# Add these pods to your NotificationServiceExtension target in your Podfile:
|
|
@@ -14,6 +14,9 @@ Pod::Spec.new do |s|
|
|
|
14
14
|
s.platforms = { :ios => min_ios_version_supported }
|
|
15
15
|
s.source = { :git => "https://github.com/zixflow/zixflow-reactnative.git", :tag => "#{s.version}" }
|
|
16
16
|
|
|
17
|
+
# The generated Swift compatibility header imports
|
|
18
|
+
# <zixflow_reactnative/zixflow_reactnative.h> in static-library builds.
|
|
19
|
+
s.header_dir = "zixflow_reactnative"
|
|
17
20
|
s.source_files = "ios/wrappers/**/*.{h,m,mm,swift}"
|
|
18
21
|
|
|
19
22
|
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
@@ -28,6 +31,9 @@ Pod::Spec.new do |s|
|
|
|
28
31
|
# Reference: https://guides.cocoapods.org/syntax/podfile.html#pod
|
|
29
32
|
s.dependency "Zixflow/DataPipelines", package["zixflowNativeiOSSdkVersion"]
|
|
30
33
|
s.dependency "Zixflow/MessagingInApp", package["zixflowNativeiOSSdkVersion"]
|
|
34
|
+
# Visual Notification Inbox UI (SwiftUI). Not optional: the bridge in ios/wrappers/inbox/* imports
|
|
35
|
+
# ZixflowMessagingInbox, and a pod target only sees the modules its podspec declares.
|
|
36
|
+
s.dependency "Zixflow/MessagingInbox", package["zixflowNativeiOSSdkVersion"]
|
|
31
37
|
|
|
32
38
|
# If we do not specify a default_subspec, then *all* dependencies inside of *all* the subspecs will be downloaded by cocoapods.
|
|
33
39
|
# Users should opt into push dependencies - FCM subspec downloads Firebase dependencies while APN does not.
|
|
@@ -57,4 +63,24 @@ Pod::Spec.new do |s|
|
|
|
57
63
|
'OTHER_SWIFT_FLAGS' => '$(inherited) -DZIXFLOW_LOCATION_ENABLED'
|
|
58
64
|
}
|
|
59
65
|
end
|
|
66
|
+
|
|
67
|
+
# Geofence module is optional - customers must opt in by adding this subspec.
|
|
68
|
+
# It pulls in Location transitively (Zixflow/LocationGeofence depends on it).
|
|
69
|
+
# Geofence implies Location, so this subspec also enables the Location wrapper code.
|
|
70
|
+
s.subspec "geofence" do |ss|
|
|
71
|
+
ss.dependency "Zixflow/LocationGeofence", package["zixflowNativeiOSSdkVersion"]
|
|
72
|
+
ss.pod_target_xcconfig = {
|
|
73
|
+
'OTHER_SWIFT_FLAGS' => '$(inherited) -DZIXFLOW_GEOFENCE_ENABLED -DZIXFLOW_LOCATION_ENABLED'
|
|
74
|
+
}
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Live Activities module is optional - customers must opt in by adding this subspec, and must
|
|
78
|
+
# also add a Widget Extension target that renders the built-in templates. See the docs.
|
|
79
|
+
s.subspec "liveactivities" do |ss|
|
|
80
|
+
ss.dependency "Zixflow/LiveActivities", package["zixflowNativeiOSSdkVersion"]
|
|
81
|
+
ss.dependency "Zixflow/LiveActivitiesTemplates", package["zixflowNativeiOSSdkVersion"]
|
|
82
|
+
ss.pod_target_xcconfig = {
|
|
83
|
+
'OTHER_SWIFT_FLAGS' => '$(inherited) -DZIXFLOW_LIVEACTIVITIES_ENABLED'
|
|
84
|
+
}
|
|
85
|
+
end
|
|
60
86
|
end
|