From 957749be286f5508572421369d4d48e4406ff6b9 Mon Sep 17 00:00:00 2001 From: Alex S <49695018+alexs-mparticle@users.noreply.github.com> Date: Fri, 8 Nov 2024 09:47:29 -0500 Subject: [PATCH] refactor: Add Type interfaces for native sdk helpers (#946) --- src/nativeSdkHelpers.interfaces.ts | 13 +++++++++++++ src/sdkRuntimeModels.ts | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/nativeSdkHelpers.interfaces.ts diff --git a/src/nativeSdkHelpers.interfaces.ts b/src/nativeSdkHelpers.interfaces.ts new file mode 100644 index 00000000..1d5a2ec0 --- /dev/null +++ b/src/nativeSdkHelpers.interfaces.ts @@ -0,0 +1,13 @@ +export interface INativeSdkHelpers { + initializeSessionAttributes: (apiKey: string) => void; + isBridgeV2Available: (bridgeName: string) => boolean; + isWebviewEnabled: ( + requiredWebviewBridgeName: string, + minWebviewBridgeVersion: number + ) => boolean; + isBridgeV1Available: () => boolean; + sendToNative: (path: string, value: string) => void; + sendViaBridgeV1: (path: string, value: string) => void; + sendViaIframeToIOS: (path: string, value: string) => void; + sendViaBridgeV2: (path: string, value: string, requiredWebviewBridgeName: boolean) => void; +} diff --git a/src/sdkRuntimeModels.ts b/src/sdkRuntimeModels.ts index 9f6c5a9c..16110538 100644 --- a/src/sdkRuntimeModels.ts +++ b/src/sdkRuntimeModels.ts @@ -31,6 +31,7 @@ import { } from './identity-user-interfaces'; import { IIdentityType } from './types.interfaces'; import IntegrationCapture from './integrationCapture'; +import { INativeSdkHelpers } from './nativeSdkHelpers.interfaces'; import { ICookieSyncManager } from './cookieSyncManager.interfaces'; // TODO: Resolve this with version in @mparticle/web-sdk @@ -169,7 +170,7 @@ export interface MParticleWebSDK { _SessionManager: ISessionManager; _Consent: SDKConsentApi; Consent: SDKConsentApi; - _NativeSdkHelpers: any; // TODO: Set up API + _NativeSdkHelpers: INativeSdkHelpers; _Persistence: IPersistence; _preInit: any; // TODO: Set up API _instances?: Dictionary;