diff --git a/src/definitions.ts b/src/definitions.ts index 2ed6cbe..00d9244 100644 --- a/src/definitions.ts +++ b/src/definitions.ts @@ -1,9 +1,12 @@ +import { type PluginListenerHandle } from "@capacitor/core"; + export interface MetaMapParams { clientId: string flowId: string metadata?: object } export interface MetaMapCapacitorPlugin { + addListener(eventName: 'verificationCreated', listenerFunc: (data: { identityId: string, verificationID: string }) => any): Promise; showMetaMapFlow(options: MetaMapParams): Promise<{ identityId: string, verificationID: string }>; } diff --git a/src/index.ts b/src/index.ts index 4cc5a13..8a94955 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,6 +7,7 @@ import type { MetaMapParams } from './definitions'; const MetaMapCapacitorUnwrapped = registerPlugin('MetaMapCapacitor', {}); const MetaMapCapacitor = { + addEventListener: MetaMapCapacitorUnwrapped.addListener, showMetaMapFlow: function(options: MetaMapParams):Promise<{ identityId: string, verificationID: string }> { const { metadata } = options return MetaMapCapacitorUnwrapped.showMetaMapFlow({...options, metadata: {...metadata, sdkType: "capacitor" }}) @@ -15,4 +16,4 @@ const MetaMapCapacitor = { export * from './definitions'; export { MetaMapCapacitor }; - +