From 7807f31ea28a033d1fd1dd028aacb0e5daceec94 Mon Sep 17 00:00:00 2001 From: Alexander Sapountzis Date: Tue, 5 Nov 2024 15:29:40 -0500 Subject: [PATCH] refactor: Add Type interfaces for native sdk helpers --- 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 000000000..1d5a2ec0e --- /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 8bf74bfbd..7672f7419 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'; // TODO: Resolve this with version in @mparticle/web-sdk export type SDKEventCustomFlags = Dictionary; @@ -167,7 +168,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;