UNPKG

react-native-acoustic-connect-beta

Version:

BETA: React native plugin for Acoustic Connect

96 lines 5.04 kB
import { type HybridObject } from 'react-native-nitro-modules'; export type KeyValueObject = { placeholder: string; [key: string]: unknown; }; export type ConnectMonitoringLevelType = 'Ignore' | 'CellularAndWiFi' | 'WiFi'; export interface AcousticConnectRN extends HybridObject<{ ios: 'swift'; android: 'kotlin'; }> { /** * Re-enables the Connect SDK after a prior {@link disable} call. * * The SDK auto-initialises at module load time using the values from * `ConnectConfig.json` at the consumer's project root — so for most apps * there is no need to call `enable()` at all. The method exists as the * pair of {@link disable}: if a consent flow, A/B-test gate, or opt-out * toggle previously called `disable()`, calling `enable()` brings the * SDK back up using the same bundled configuration. * * @returns `true` when the call was accepted and dispatched to the native * SDK. `false` only when the platform cannot satisfy a precondition * (e.g. Android without an `Application` context yet). * * @remarks * **Single source of truth.** All configuration (AppKey, PostMessageUrl, * push, platform extras) lives in `ConnectConfig.json` at the consumer's * project root. The podspec (iOS) and `config.gradle` (Android) bake * those values into the bundled config that the native bridge reads at * init time. There is no runtime override path — by design, to eliminate * the inconsistency surface that runtime arguments would create against * the bundled config. * * **Idempotency.** Owned by the native SDK. iOS * `ConnectSDK.shared.enable(with:)` short-circuits via * `guard !isEnabled else { return }` in its internal `enableCore`; the * Android `Connect.init` / `Connect.enable` pair behaves the same way * once the SDK is running. * * **Threading.** Returns synchronously; the native SDK call is * fire-and-forget on the main thread / actor. * * @example User opt-in after a prior opt-out * ```ts * import AcousticConnectRN from 'react-native-acoustic-connect-beta' * * function onUserOptIn() { * AcousticConnectRN.enable() * } * ``` */ enable(): boolean; /** * Disables the Connect SDK and stops all data capture. * * After this call the SDK flushes pending data to the backend, stops * listening for events, and releases push state. Call {@link enable} * to bring the SDK back up using the same bundled configuration. * * @returns `true` when the call was accepted and dispatched. Idempotent — * calling `disable()` on an already-disabled SDK is safe. * * @example User opt-out flow * ```ts * import AcousticConnectRN from 'react-native-acoustic-connect-beta' * * function onUserOptOut() { * AcousticConnectRN.disable() * } * ``` */ disable(): boolean; setBooleanConfigItemForKey(key: string, value: boolean, moduleName: string): boolean; setStringItemForKey(key: string, value: string, moduleName: string): boolean; setNumberItemForKey(key: string, value: number, moduleName: string): boolean; setConfigItemForKey(key: string, value: string | number | boolean, moduleName: string): boolean; getBooleanConfigItemForKey(theDefault: boolean, key: string, moduleName: string): boolean; getStringItemForKey(theDefault: string, key: string, moduleName: string): string | null | undefined; getNumberItemForKey(theDefault: number, key: string, moduleName: string): number; logCustomEvent(eventName: string, values: Record<string, string | number | boolean>, level: number): boolean; logSignal(values: Record<string, string | number | boolean>, level: number): boolean; logExceptionEvent(message: string, stackInfo: string, unhandled: boolean): boolean; logLocation(): boolean; logLocationWithLatitudeLongitude(latitude: number, longitude: number, level: number): boolean; logClickEvent(target: number, controlId: string): boolean; logTextChangeEvent(target: number, controlId: string, text: string | null | undefined): boolean; setCurrentScreenName(logicalPageName: string): boolean; logScreenViewContextLoad(logicalPageName: string | null | undefined, referrer: string | null | undefined): boolean; logScreenViewContextUnload(logicalPageName: string | null | undefined, referrer: string | null | undefined): boolean; logScreenLayout(name: string, delay: number): boolean; logDialogShowEvent(dialogId: string, dialogTitle: string, dialogType: string): boolean; logDialogDismissEvent(dialogId: string, dismissReason: string): boolean; logDialogButtonClickEvent(dialogId: string, buttonText: string, buttonIndex: number): boolean; logDialogCustomEvent(dialogId: string, eventName: string, values: Record<string, string | number | boolean>): boolean; } //# sourceMappingURL=react-native-acoustic-connect.nitro.d.ts.map