Skip to content

Commit

Permalink
refactor: Add Type interfaces for native sdk helpers (#946)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexs-mparticle authored Nov 8, 2024
1 parent 6b15343 commit 957749b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/nativeSdkHelpers.interfaces.ts
Original file line number Diff line number Diff line change
@@ -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;
}
3 changes: 2 additions & 1 deletion src/sdkRuntimeModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<MParticleWebSDK>;
Expand Down

0 comments on commit 957749b

Please sign in to comment.