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
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.validate = exports.assert = void 0;
|
|
7
|
+
var _index = require("../types/index.js");
|
|
7
8
|
// Argument validation utilities for SDK internal use
|
|
8
9
|
// Ensures input safety and throws clear errors when validation fails
|
|
9
10
|
|
|
@@ -32,6 +33,16 @@ function failIf(condition, message) {
|
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Logs a warning if the condition is true.
|
|
38
|
+
* Use this for misconfigurations that degrade behavior but must not fail initialization.
|
|
39
|
+
*/
|
|
40
|
+
function warnIf(condition, message) {
|
|
41
|
+
if (__DEV__ && condition) {
|
|
42
|
+
console.warn(`[Zixflow] ${message()}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
35
46
|
/**
|
|
36
47
|
* Validates that a value is defined (not undefined or null).
|
|
37
48
|
* Useful for checking required fields.
|
|
@@ -103,6 +114,67 @@ function validateAttributes(value, fieldName, options = {}) {
|
|
|
103
114
|
return attributes;
|
|
104
115
|
}
|
|
105
116
|
|
|
117
|
+
/**
|
|
118
|
+
* The placeholder the SDK substitutes with the unread count when rendering
|
|
119
|
+
* `bellWithUnreadCount`.
|
|
120
|
+
*/
|
|
121
|
+
const COUNT_PLACEHOLDER = '{count}';
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Warns when `bellWithUnreadCount` is missing its `{count}` placeholder.
|
|
125
|
+
*
|
|
126
|
+
* The label is a template, not a finished string. A misspelled placeholder (`{COUNT}`,
|
|
127
|
+
* `{{count}}`, `%d`) matches nothing, so the template is announced verbatim — braces and all —
|
|
128
|
+
* and the count is never spoken. The check lives here rather than in either native layer
|
|
129
|
+
* because neither can report it usefully: Android logs at `debug`, which the default `ERROR`
|
|
130
|
+
* level discards, and iOS does not check at all. Warning from JavaScript reaches the
|
|
131
|
+
* developer's console on both platforms, whatever the SDK log level.
|
|
132
|
+
*/
|
|
133
|
+
function validateInboxAccessibilityLabels(value) {
|
|
134
|
+
if (isUndefined(value) || typeof value !== 'object') {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const template = value.bellWithUnreadCount;
|
|
138
|
+
warnIf(typeof template === 'string' && !template.includes(COUNT_PLACEHOLDER), () => `"inApp.notificationInboxAccessibilityLabels.bellWithUnreadCount" has no ` + `"${COUNT_PLACEHOLDER}" placeholder, so the unread count will not be announced.`);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Warns when a value is not one of the `ZixflowColorScheme` values.
|
|
143
|
+
*
|
|
144
|
+
* TypeScript rejects a bad value already, but JavaScript callers reach both entry points
|
|
145
|
+
* untyped, and neither native layer reports the mistake at the default log level. The
|
|
146
|
+
* failure mode is a message rendered in the wrong theme with no error attached, so
|
|
147
|
+
* JavaScript is the only place the developer reliably sees it.
|
|
148
|
+
*
|
|
149
|
+
* `consequence` differs per entry point because the native fallback does: an unrecognized
|
|
150
|
+
* value at initialization resolves to `auto`, while the runtime setter leaves whatever
|
|
151
|
+
* scheme the app already chose in place.
|
|
152
|
+
*/
|
|
153
|
+
function warnIfNotColorScheme(value, fieldName, consequence) {
|
|
154
|
+
const allowed = Object.values(_index.ZixflowColorScheme);
|
|
155
|
+
warnIf(!(typeof value === 'string' && allowed.includes(value)), () => `"${fieldName}" is not a valid ZixflowColorScheme (expected one of ` + `${allowed.join(', ')}), so ${consequence}.`);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Validates `inApp.colorScheme`. An absent value is legitimate here — the native SDKs
|
|
160
|
+
* already default to `auto` — so only a value the host actually set is checked.
|
|
161
|
+
*/
|
|
162
|
+
function validateConfigColorScheme(value) {
|
|
163
|
+
if (isUndefined(value)) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
warnIfNotColorScheme(value, 'inApp.colorScheme', 'in-app messages will follow the device appearance');
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Validates the argument to `setColorScheme`. Unlike the config field, an absent value is
|
|
171
|
+
* itself the mistake: the caller asked for a scheme change and named none, and there is no
|
|
172
|
+
* default to fall back to, so null and undefined are reported rather than skipped.
|
|
173
|
+
*/
|
|
174
|
+
function validateColorSchemeArgument(value) {
|
|
175
|
+
warnIfNotColorScheme(value, 'colorScheme', 'the color scheme will be left unchanged');
|
|
176
|
+
}
|
|
177
|
+
|
|
106
178
|
/**
|
|
107
179
|
* Validates that the given value is a valid ZixflowConfig object.
|
|
108
180
|
* Throws if required fields are missing or incorrectly typed.
|
|
@@ -115,10 +187,12 @@ function validateConfig(value) {
|
|
|
115
187
|
usage: usage
|
|
116
188
|
});
|
|
117
189
|
const obj = value;
|
|
118
|
-
validateString(obj.
|
|
190
|
+
validateString(obj.apiKey, `${fieldName}.apiKey`, {
|
|
119
191
|
allowEmpty: false,
|
|
120
192
|
usage: usage
|
|
121
193
|
});
|
|
194
|
+
validateConfigColorScheme(obj.inApp?.colorScheme);
|
|
195
|
+
validateInboxAccessibilityLabels(obj.inApp?.notificationInboxAccessibilityLabels);
|
|
122
196
|
}
|
|
123
197
|
|
|
124
198
|
// For type safety, we define a ConfigValidator type that asserts the value is a ZixflowConfig
|
|
@@ -128,7 +202,8 @@ const assert = exports.assert = {
|
|
|
128
202
|
string: validateString,
|
|
129
203
|
record: validateRecord,
|
|
130
204
|
attributes: validateAttributes,
|
|
131
|
-
config: validateConfig
|
|
205
|
+
config: validateConfig,
|
|
206
|
+
colorScheme: validateColorSchemeArgument
|
|
132
207
|
};
|
|
133
208
|
const validate = exports.validate = {
|
|
134
209
|
isUndefined: isUndefined
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["buildErrorMessage","usage","fieldName","error","prefix","isUndefined","value","undefined","failIf","condition","message","__DEV__","Error","failIfUndefined","validateString","options","allowEmpty","optional","typedValue","trim","validateRecord","expectedType","typeName","Array","isArray","validateAttributes","exists","attributes","Map","Object","fromEntries","validateConfig","obj","
|
|
1
|
+
{"version":3,"names":["_index","require","buildErrorMessage","usage","fieldName","error","prefix","isUndefined","value","undefined","failIf","condition","message","__DEV__","Error","warnIf","console","warn","failIfUndefined","validateString","options","allowEmpty","optional","typedValue","trim","validateRecord","expectedType","typeName","Array","isArray","validateAttributes","exists","attributes","Map","Object","fromEntries","COUNT_PLACEHOLDER","validateInboxAccessibilityLabels","template","bellWithUnreadCount","includes","warnIfNotColorScheme","consequence","allowed","values","ZixflowColorScheme","join","validateConfigColorScheme","validateColorSchemeArgument","validateConfig","obj","apiKey","inApp","colorScheme","notificationInboxAccessibilityLabels","assert","exports","string","record","config","validate"],"sourceRoot":"../../../src","sources":["utils/param-validation.ts"],"mappings":";;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAHA;AACA;;AAKA;AACA;AACA;AACA,SAASC,iBAAiBA,CACxBC,KAAyB,EACzBC,SAAiB,EACjBC,KAAa,EACL;EACR,MAAMC,MAAM,GAAGH,KAAK,GAAG,GAAGA,KAAK,GAAG,GAAG,EAAE;EACvC,OAAO,GAAGG,MAAM,IAAIF,SAAS,KAAKC,KAAK,GAAG;AAC5C;;AAEA;AACA;AACA;AACA,SAASE,WAAWA,CAACC,KAAc,EAAW;EAC5C,OAAOA,KAAK,KAAKC,SAAS,IAAID,KAAK,KAAK,IAAI;AAC9C;;AAEA;AACA;AACA;AACA;AACA,SAASE,MAAMA,CAACC,SAAkB,EAAEC,OAAqB,EAAQ;EAC/D,IAAIC,OAAO,IAAIF,SAAS,EAAE;IACxB,MAAM,IAAIG,KAAK,CAAC,aAAaF,OAAO,CAAC,CAAC,EAAE,CAAC;EAC3C;AACF;;AAEA;AACA;AACA;AACA;AACA,SAASG,MAAMA,CAACJ,SAAkB,EAAEC,OAAqB,EAAQ;EAC/D,IAAIC,OAAO,IAAIF,SAAS,EAAE;IACxBK,OAAO,CAACC,IAAI,CAAC,aAAaL,OAAO,CAAC,CAAC,EAAE,CAAC;EACxC;AACF;;AAEA;AACA;AACA;AACA;AACA,SAASM,eAAeA,CACtBV,KAAc,EACdJ,SAAiB,EACjBD,KAAc,EACR;EACNO,MAAM,CA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D,MAAA,GAAG;EACFE,MAAM,EAAEtC,cAAc;EACtBuC,MAAM,EAAEjC,cAAc;EACtBO,UAAU,EAAEF,kBAAkB;EAC9B6B,MAAM,EAAEV,cAAc;EACtBI,WAAW,EAAEL;AACf,CAAC;AAEM,MAAMY,QAAQ,GAAAJ,OAAA,CAAAI,QAAA,GAAG;EACtBrD,WAAW,EAAEA;AACf,CAAC","ignoreList":[]}
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Zixflow = void 0;
|
|
7
|
+
var _zixflowGeofence = require("./zixflow-geofence.js");
|
|
7
8
|
var _zixflowInapp = require("./zixflow-inapp.js");
|
|
9
|
+
var _zixflowLiveactivities = require("./zixflow-liveactivities.js");
|
|
8
10
|
var _zixflowLocation = require("./zixflow-location.js");
|
|
9
11
|
var _zixflowPush = require("./zixflow-push.js");
|
|
10
12
|
var _nativeLoggerListener = require("./native-logger-listener.js");
|
|
@@ -13,10 +15,21 @@ var _index = require("./types/index.js");
|
|
|
13
15
|
var _nativeBridge = require("./utils/native-bridge.js");
|
|
14
16
|
var _paramValidation = require("./utils/param-validation.js");
|
|
15
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
-
const packageJson = require('
|
|
18
|
+
const packageJson = require('../package.json');
|
|
17
19
|
|
|
18
20
|
// Track whether Zixflow SDK has been initialized to prevent usage before setup
|
|
19
21
|
let _initialized = false;
|
|
22
|
+
let deepLinkHandlerSubscription;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Handles a Zixflow deep-link destination delivered from iOS.
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Removes a Zixflow deep-link handler.
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
20
33
|
|
|
21
34
|
// Reference to the native Zixflow Data Pipelines module for SDK operations
|
|
22
35
|
const nativeModule = (0, _nativeBridge.ensureNativeModule)(_NativeZixflow.default);
|
|
@@ -31,16 +44,8 @@ class Zixflow {
|
|
|
31
44
|
/** Initialize the Zixflow SDK with given configuration. */
|
|
32
45
|
static initialize = async config => {
|
|
33
46
|
_paramValidation.assert.config(config);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (config.inApp && !config.inApp.siteId) {
|
|
37
|
-
config.inApp.siteId = config.cdpApiKey;
|
|
38
|
-
console.log('[Zixflow] Auto-derived inApp.siteId from cdpApiKey');
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Warn if siteId doesn't match cdpApiKey (Customer.io legacy issue)
|
|
42
|
-
if (config.inApp && config.inApp.siteId && config.inApp.siteId !== config.cdpApiKey) {
|
|
43
|
-
console.warn('[Zixflow] Warning: inApp.siteId should equal cdpApiKey for Zixflow. ' + 'Using different values may cause in-app messaging to fail.');
|
|
47
|
+
if (config.inApp) {
|
|
48
|
+
config.inApp.siteId = config.apiKey;
|
|
44
49
|
}
|
|
45
50
|
if (config.logLevel && config.logLevel !== _index.ZixflowLogLevel.None) {
|
|
46
51
|
_nativeLoggerListener.NativeLoggerListener.initialize();
|
|
@@ -56,6 +61,89 @@ class Zixflow {
|
|
|
56
61
|
});
|
|
57
62
|
};
|
|
58
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Signal that the app's React Native Linking listener is ready to receive Zixflow URLs.
|
|
66
|
+
*
|
|
67
|
+
* This is only needed by UIScene hosts that initialize Zixflow natively, such as Expo
|
|
68
|
+
* config-plugin auto-initialization. Call it after registering the Linking listener.
|
|
69
|
+
*/
|
|
70
|
+
static setDeepLinkRoutingReady = () => {
|
|
71
|
+
return withNativeModule(native => native.setDeepLinkRoutingReady());
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Register an acknowledged deep-link handler for an iOS UIScene host.
|
|
76
|
+
*
|
|
77
|
+
* This API only handles Zixflow destinations delivered through an iOS UIScene lifecycle.
|
|
78
|
+
* In a native React Native scene host, pair this with
|
|
79
|
+
* `NativeZixflow.configureAcknowledgedSceneDeepLinkRouting()` in the SceneDelegate. Register
|
|
80
|
+
* this before `initialize` when possible. Return `true` after routing a URL. Returning `false`,
|
|
81
|
+
* throwing, or rejecting lets the native SDK try the host AppDelegate, then React Native Linking
|
|
82
|
+
* for a host-owned custom scheme or the system for other URLs. Cold URLs are buffered until this
|
|
83
|
+
* handler is registered, subject to the native timeout. After delivery, the handler has ten
|
|
84
|
+
* seconds to settle. Once that timeout runs the native fallback, a late handler cannot cancel it
|
|
85
|
+
* and may cause a second navigation if it also routes the URL.
|
|
86
|
+
*/
|
|
87
|
+
static setDeepLinkHandler = handler => {
|
|
88
|
+
if (typeof handler !== 'function') {
|
|
89
|
+
throw new Error('[Zixflow] "handler" must be a function.');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Native unregister is tokenless and removes the current native handler. Remove the old
|
|
93
|
+
// subscription first so its cleanup cannot unregister the replacement.
|
|
94
|
+
deepLinkHandlerSubscription?.remove();
|
|
95
|
+
return withNativeModule(native => {
|
|
96
|
+
const nativeSubscription = native.onDeepLinkReceived(async data => {
|
|
97
|
+
const event = data;
|
|
98
|
+
if (typeof event.id !== 'string' || typeof event.url !== 'string') {
|
|
99
|
+
_nativeLoggerListener.NativeLoggerListener.warn('Received an invalid native deep-link event.');
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
let handled = false;
|
|
103
|
+
try {
|
|
104
|
+
handled = (await handler(event.url)) === true;
|
|
105
|
+
} catch (error) {
|
|
106
|
+
_nativeLoggerListener.NativeLoggerListener.warn('Deep-link handler failed:', error);
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
native.acknowledgeDeepLink(event.id, handled);
|
|
110
|
+
} catch (error) {
|
|
111
|
+
_nativeLoggerListener.NativeLoggerListener.warn('Failed to acknowledge a deep-link result:', error);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
let removed = false;
|
|
115
|
+
const subscription = {
|
|
116
|
+
remove: () => {
|
|
117
|
+
if (removed) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
removed = true;
|
|
121
|
+
try {
|
|
122
|
+
native.unregisterDeepLinkHandler();
|
|
123
|
+
} finally {
|
|
124
|
+
nativeSubscription.remove();
|
|
125
|
+
if (deepLinkHandlerSubscription === subscription) {
|
|
126
|
+
deepLinkHandlerSubscription = undefined;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
try {
|
|
132
|
+
native.registerDeepLinkHandler();
|
|
133
|
+
} catch (error) {
|
|
134
|
+
try {
|
|
135
|
+
native.unregisterDeepLinkHandler();
|
|
136
|
+
} catch {
|
|
137
|
+
// Preserve the registration error; the native timeout still owns pending URLs.
|
|
138
|
+
}
|
|
139
|
+
nativeSubscription.remove();
|
|
140
|
+
throw error;
|
|
141
|
+
}
|
|
142
|
+
deepLinkHandlerSubscription = subscription;
|
|
143
|
+
return subscription;
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
|
|
59
147
|
/** Identify a user to start tracking their activity. Requires userId, traits, or both. */
|
|
60
148
|
static identify = async ({
|
|
61
149
|
userId,
|
|
@@ -160,7 +248,9 @@ class Zixflow {
|
|
|
160
248
|
* @deprecated This method will be removed in a future version. If you need this functionality, please contact us.
|
|
161
249
|
*/
|
|
162
250
|
static isInitialized = () => _initialized;
|
|
251
|
+
static geofence = new _zixflowGeofence.ZixflowGeofence();
|
|
163
252
|
static inAppMessaging = new _zixflowInapp.ZixflowInAppMessaging();
|
|
253
|
+
static liveActivities = new _zixflowLiveactivities.ZixflowLiveActivities();
|
|
164
254
|
static location = new _zixflowLocation.ZixflowLocation();
|
|
165
255
|
static pushMessaging = new _zixflowPush.ZixflowPushMessaging();
|
|
166
256
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_zixflowGeofence","require","_zixflowInapp","_zixflowLiveactivities","_zixflowLocation","_zixflowPush","_nativeLoggerListener","_NativeZixflow","_interopRequireDefault","_index","_nativeBridge","_paramValidation","e","__esModule","default","packageJson","_initialized","deepLinkHandlerSubscription","nativeModule","ensureNativeModule","NativeModule","withNativeModule","fn","callNativeModule","Zixflow","initialize","config","assert","inApp","siteId","apiKey","logLevel","ZixflowLogLevel","None","NativeLoggerListener","expoVersion","args","packageSource","packageVersion","version","promise","native","then","setDeepLinkRoutingReady","setDeepLinkHandler","handler","Error","remove","nativeSubscription","onDeepLinkReceived","data","event","id","url","warn","handled","error","acknowledgeDeepLink","removed","subscription","unregisterDeepLinkHandler","undefined","registerDeepLinkHandler","identify","userId","traits","validate","isUndefined","string","allowEmpty","usage","optional","normalizedTraits","attributes","clearIdentify","track","name","properties","normalizedProps","screen","title","setProfileAttributes","normalizedAttrs","setDeviceAttributes","registerDeviceToken","token","deleteDeviceToken","trackMetric","deliveryID","deviceToken","isInitialized","geofence","ZixflowGeofence","inAppMessaging","ZixflowInAppMessaging","liveActivities","ZixflowLiveActivities","location","ZixflowLocation","pushMessaging","ZixflowPushMessaging","exports","initNativeLogger"],"sourceRoot":"../../src","sources":["zixflow-cdp.ts"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,qBAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAC,sBAAA,CAAAP,OAAA;AAIA,IAAAQ,MAAA,GAAAR,OAAA;AAQA,IAAAS,aAAA,GAAAT,OAAA;AACA,IAAAU,gBAAA,GAAAV,OAAA;AAA4D,SAAAO,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE5D,MAAMG,WAAW,G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AED;AACF;AACA;AACA;EACE,OAAgBuC,aAAa,GAAGA,CAAA,KAAM1E,YAAY;EAElD,OAAgB2E,QAAQ,GAAG,IAAIC,gCAAe,CAAC,CAAC;EAChD,OAAgBC,cAAc,GAAG,IAAIC,mCAAqB,CAAC,CAAC;EAC5D,OAAgBC,cAAc,GAAG,IAAIC,4CAAqB,CAAC,CAAC;EAC5D,OAAgBC,QAAQ,GAAG,IAAIC,gCAAe,CAAC,CAAC;EAChD,OAAgBC,aAAa,GAAG,IAAIC,iCAAoB,CAAC,CAAC;AAC5D;;AAEA;AACA;AACA;AACA;AAAAC,OAAA,CAAA7E,OAAA,GAAAA,OAAA;AACAU,0CAAoB,CAACoE,gBAAgB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ZixflowGeofence = void 0;
|
|
7
|
+
var _NativeZixflowGeofence = _interopRequireDefault(require("./specs/modules/NativeZixflowGeofence.js"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
/**
|
|
10
|
+
* Ensures all methods defined in codegen spec are implemented by the public module
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
// Geofence is an optional module — NativeModule may be null when geofence is not enabled.
|
|
16
|
+
// Methods silently no-op when the native module is unavailable, with a one-time dev warning.
|
|
17
|
+
let hasWarnedNotEnabled = false;
|
|
18
|
+
const withNativeModule = fn => {
|
|
19
|
+
if (_NativeZixflowGeofence.default) {
|
|
20
|
+
fn(_NativeZixflowGeofence.default);
|
|
21
|
+
} else if (__DEV__ && !hasWarnedNotEnabled) {
|
|
22
|
+
hasWarnedNotEnabled = true;
|
|
23
|
+
console.warn('Zixflow: Geofence module is not enabled. ' + 'To use geofence features, set zixflow_geofence_enabled=true in ' + 'gradle.properties (Android) or add the geofence subspec to your Podfile (iOS).');
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Public entry point for the optional Geofence module.
|
|
29
|
+
*
|
|
30
|
+
* Geofence runs automatically once enabled. Apps opt in by passing a `geofence` config to
|
|
31
|
+
* `initialize` and enabling the module at build time: set `zixflow_geofence_enabled=true`
|
|
32
|
+
* in `gradle.properties` (Android) or add the `geofence` subspec to your Podfile (iOS).
|
|
33
|
+
* Enabling geofence also enables the Location module, which geofence depends on.
|
|
34
|
+
*
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
class ZixflowGeofence {
|
|
38
|
+
/**
|
|
39
|
+
* Requests a one-shot location fix and refreshes the nearby geofence set from it,
|
|
40
|
+
* without sending a location analytics event (unlike
|
|
41
|
+
* `Zixflow.location.requestLocationUpdate()`) and without caching the fix.
|
|
42
|
+
*
|
|
43
|
+
* Call this after the host app has been granted location permission — the SDK never
|
|
44
|
+
* requests permission itself. It is the primary way to drive geofencing when the module
|
|
45
|
+
* is configured with `MANUAL` location mode; with the default `AUTOMATIC` the SDK acquires
|
|
46
|
+
* location on its own and this only forces an immediate refresh.
|
|
47
|
+
*
|
|
48
|
+
* No-ops if the geofence module is not enabled or a user has not been identified.
|
|
49
|
+
*/
|
|
50
|
+
refreshFromCurrentLocation() {
|
|
51
|
+
return withNativeModule(native => native.refreshFromCurrentLocation());
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.ZixflowGeofence = ZixflowGeofence;
|
|
55
|
+
//# sourceMappingURL=zixflow-geofence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_NativeZixflowGeofence","_interopRequireDefault","require","e","__esModule","default","hasWarnedNotEnabled","withNativeModule","fn","NativeModule","__DEV__","console","warn","ZixflowGeofence","refreshFromCurrentLocation","native","exports"],"sourceRoot":"../../src","sources":["zixflow-geofence.ts"],"mappings":";;;;;;AACA,IAAAA,sBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAG+C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE/C;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA,IAAIG,mBAAmB,GAAG,KAAK;AAC/B,MAAMC,gBAAgB,GAAIC,EAAiC,IAAW;EACpE,IAAIC,8BAAY,EAAE;IAChBD,EAAE,CAACC,8BAAY,CAAC;EAClB,CAAC,MAAM,IAAIC,OAAO,IAAI,CAACJ,mBAAmB,EAAE;IAC1CA,mBAAmB,GAAG,IAAI;IAC1BK,OAAO,CAACC,IAAI,CACV,2CAA2C,GACzC,iEAAiE,GACjE,gFACJ,CAAC;EACH;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,eAAe,CAA+B;EACzD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,0BAA0BA,CAAA,EAAS;IACjC,OAAOP,gBAAgB,CAAEQ,MAAM,IAAKA,MAAM,CAACD,0BAA0B,CAAC,CAAC,CAAC;EAC1E;AACF;AAACE,OAAA,CAAAH,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -4,6 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.InAppMessageEvent = void 0;
|
|
7
|
+
Object.defineProperty(exports, "InboxEventType", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _index2.InboxEventType;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "InboxMessageEvent", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _index2.InboxMessageEvent;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
7
19
|
Object.defineProperty(exports, "InlineInAppMessageView", {
|
|
8
20
|
enumerable: true,
|
|
9
21
|
get: function () {
|
|
@@ -16,12 +28,26 @@ Object.defineProperty(exports, "NotificationInbox", {
|
|
|
16
28
|
return _notificationInbox.NotificationInbox;
|
|
17
29
|
}
|
|
18
30
|
});
|
|
31
|
+
Object.defineProperty(exports, "NotificationInboxBellView", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () {
|
|
34
|
+
return _index.NotificationInboxBellView;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "NotificationInboxView", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () {
|
|
40
|
+
return _index.NotificationInboxView;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
19
43
|
exports.ZixflowInAppMessaging = void 0;
|
|
20
44
|
var _index = require("./components/index.js");
|
|
21
45
|
var _nativeLoggerListener = require("./native-logger-listener.js");
|
|
22
46
|
var _notificationInbox = require("./notification-inbox.js");
|
|
23
47
|
var _NativeZixflowMessagingInApp = _interopRequireDefault(require("./specs/modules/NativeZixflowMessagingInApp.js"));
|
|
48
|
+
var _index2 = require("./types/index.js");
|
|
24
49
|
var _nativeBridge = require("./utils/native-bridge.js");
|
|
50
|
+
var _paramValidation = require("./utils/param-validation.js");
|
|
25
51
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
26
52
|
/**
|
|
27
53
|
* Ensures all methods defined in codegen spec are implemented by the public module
|
|
@@ -43,6 +69,12 @@ const withNativeModule = fn => {
|
|
|
43
69
|
* @public
|
|
44
70
|
*/
|
|
45
71
|
class ZixflowInAppMessaging {
|
|
72
|
+
/**
|
|
73
|
+
* Live inbox subscriptions. The SDK's inbox forwarder is a SINGLE global listener, so it is
|
|
74
|
+
* registered when the first subscription is created and unregistered when the last one goes away —
|
|
75
|
+
* never per subscription, or one `remove()` would tear it out from under the others.
|
|
76
|
+
*/
|
|
77
|
+
_inboxListenerCount = 0;
|
|
46
78
|
registerEventsListener(listener) {
|
|
47
79
|
const emitter = data => {
|
|
48
80
|
// Convert raw native payload to InAppMessageEvent
|
|
@@ -68,6 +100,77 @@ class ZixflowInAppMessaging {
|
|
|
68
100
|
});
|
|
69
101
|
}
|
|
70
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Registers a listener for Visual Notification Inbox events (action taken,
|
|
105
|
+
* shown, opened, dismissed).
|
|
106
|
+
*
|
|
107
|
+
* While a listener is registered the host owns action navigation: the native
|
|
108
|
+
* SDK suppresses its default action handling and forwards the event here.
|
|
109
|
+
* Call `.remove()` on the returned subscription to unregister and restore the
|
|
110
|
+
* SDK's default behavior.
|
|
111
|
+
*
|
|
112
|
+
* @param listener - callback invoked with an {@link InboxMessageEvent}
|
|
113
|
+
* @returns an EventSubscription; call `.remove()` to stop listening
|
|
114
|
+
*/
|
|
115
|
+
registerInboxEventListener(listener) {
|
|
116
|
+
const emitter = data => {
|
|
117
|
+
// Convert raw native payload to InboxMessageEvent with a parsed message
|
|
118
|
+
const event = new _index2.InboxMessageEvent(data.eventType, (0, _notificationInbox.parseInboxMessage)(data.message), data.actionName, data.actionValue);
|
|
119
|
+
listener(event);
|
|
120
|
+
};
|
|
121
|
+
return withNativeModule(native => {
|
|
122
|
+
let registeredNativeForwarder = false;
|
|
123
|
+
try {
|
|
124
|
+
// Register the native forwarder with the SDK, then subscribe to the
|
|
125
|
+
// codegen-generated event emitter.
|
|
126
|
+
// Wrapped in try-catch due to previous reports of crashes on certain Android architectures.
|
|
127
|
+
if (this._inboxListenerCount === 0) {
|
|
128
|
+
native.registerInboxEventListener();
|
|
129
|
+
registeredNativeForwarder = true;
|
|
130
|
+
}
|
|
131
|
+
const subscription = native.onInboxEventReceived(emitter);
|
|
132
|
+
this._inboxListenerCount += 1;
|
|
133
|
+
|
|
134
|
+
// Wrap remove() so unregistering the LAST JS listener also unregisters the native forwarder
|
|
135
|
+
// (restoring the SDK's default action handling). Guarded so a double remove() cannot
|
|
136
|
+
// unbalance the count and drop the forwarder while other subscriptions are still live.
|
|
137
|
+
const originalRemove = subscription.remove.bind(subscription);
|
|
138
|
+
let removed = false;
|
|
139
|
+
subscription.remove = () => {
|
|
140
|
+
if (removed) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
removed = true;
|
|
144
|
+
originalRemove();
|
|
145
|
+
this._inboxListenerCount -= 1;
|
|
146
|
+
if (this._inboxListenerCount === 0) {
|
|
147
|
+
withNativeModule(n => n.unregisterInboxEventListener());
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
return subscription;
|
|
151
|
+
} catch (error) {
|
|
152
|
+
// If the forwarder was registered and subscribing then failed, roll it back. Otherwise the
|
|
153
|
+
// SDK keeps suppressing its own action handling while nothing in JS is listening, so inbox
|
|
154
|
+
// actions are reported as handled and silently go nowhere.
|
|
155
|
+
if (registeredNativeForwarder) {
|
|
156
|
+
try {
|
|
157
|
+
native.unregisterInboxEventListener();
|
|
158
|
+
} catch (rollbackError) {
|
|
159
|
+
_nativeLoggerListener.NativeLoggerListener.warn('Failed to roll back inbox listener registration:', rollbackError);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
_nativeLoggerListener.NativeLoggerListener.warn('Failed to attach inbox event listener:', error);
|
|
163
|
+
// Return a no-op subscription to maintain backwards compatibility
|
|
164
|
+
return {
|
|
165
|
+
remove: () => {},
|
|
166
|
+
eventType: '',
|
|
167
|
+
key: 0,
|
|
168
|
+
subscriber: null
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
71
174
|
/**
|
|
72
175
|
* Dismisses any currently displayed in-app message
|
|
73
176
|
*/
|
|
@@ -75,6 +178,23 @@ class ZixflowInAppMessaging {
|
|
|
75
178
|
withNativeModule(native => native.dismissMessage());
|
|
76
179
|
}
|
|
77
180
|
|
|
181
|
+
/**
|
|
182
|
+
* Overrides the color scheme used to render in-app messages.
|
|
183
|
+
*
|
|
184
|
+
* Takes effect immediately: messages already on screen — inline views included — are
|
|
185
|
+
* re-themed in place, so this can be called whenever the app's appearance setting
|
|
186
|
+
* changes rather than only before a message is shown.
|
|
187
|
+
*
|
|
188
|
+
* @param colorScheme - scheme to render with; `ZixflowColorScheme.Auto` returns to following
|
|
189
|
+
* the device appearance
|
|
190
|
+
*/
|
|
191
|
+
setColorScheme(colorScheme) {
|
|
192
|
+
// Validated here as well as in `initialize`: this is a public method reachable from
|
|
193
|
+
// untyped JavaScript, and without it a bad value reaches the native fallback silently.
|
|
194
|
+
_paramValidation.assert.colorScheme(colorScheme);
|
|
195
|
+
withNativeModule(native => native.setColorScheme(colorScheme));
|
|
196
|
+
}
|
|
197
|
+
|
|
78
198
|
/**
|
|
79
199
|
* Gets the message inbox instance for managing inbox messages
|
|
80
200
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_index","require","_nativeLoggerListener","_notificationInbox","_NativeZixflowMessagingInApp","_interopRequireDefault","_nativeBridge","e","__esModule","default","nativeModule","ensureNativeModule","NativeZixflowMessagingInApp","withNativeModule","fn","callNativeModule","ZixflowInAppMessaging","registerEventsListener","listener","emitter","data","event","InAppMessageEvent","eventType","messageId","deliveryId","actionValue","actionName","native","onInAppEventReceived","error","NativeLoggerListener","warn","remove","key","subscriber","dismissMessage","inbox","NotificationInbox","exports","constructor"],"sourceRoot":"../../src","sources":["zixflow-inapp.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_index","require","_nativeLoggerListener","_notificationInbox","_NativeZixflowMessagingInApp","_interopRequireDefault","_index2","_nativeBridge","_paramValidation","e","__esModule","default","nativeModule","ensureNativeModule","NativeZixflowMessagingInApp","withNativeModule","fn","callNativeModule","ZixflowInAppMessaging","_inboxListenerCount","registerEventsListener","listener","emitter","data","event","InAppMessageEvent","eventType","messageId","deliveryId","actionValue","actionName","native","onInAppEventReceived","error","NativeLoggerListener","warn","remove","key","subscriber","registerInboxEventListener","InboxMessageEvent","parseInboxMessage","message","registeredNativeForwarder","subscription","onInboxEventReceived","originalRemove","bind","removed","n","unregisterInboxEventListener","rollbackError","dismissMessage","setColorScheme","colorScheme","assert","inbox","NotificationInbox","exports","constructor"],"sourceRoot":"../../src","sources":["zixflow-inapp.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAF,OAAA;AAKA,IAAAG,4BAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAIA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,gBAAA,GAAAP,OAAA;AAAkD,SAAAI,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAElD;AACA;AACA;AACA;AACA;;AAWA;AACA,MAAMG,YAAY,GAAG,IAAAC,gCAAkB,EAACC,oCAA2B,CAAC;;AAEpE;AACA,MAAMC,gBAAgB,GAAOC,EAA8B,IAAQ;EACjE,OAAO,IAAAC,8BAAgB,EAACL,YAAY,EAAEI,EAAE,CAAC;AAC3C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAME,qBAAqB,CAA4B;EAGrD;AACF;AACA;AACA;AACA;EACUC,mBAAmB,GAAG,CAAC;EAE/BC,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,OAAOT,gBAAgB,CAAEgB,MAAM,IAAK;MAClC,IAAI;QACF;QAC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