diff --git a/src/client.ts b/src/client.ts index e7651c9..5de0ae2 100644 --- a/src/client.ts +++ b/src/client.ts @@ -247,6 +247,33 @@ export class SDKSignerClient { return response; } + + async getPhoneNumberForEmail(email: string): Promise { + const processesData = await this.getOwnedProcesses(); + console.log(processesData); + + // Type guard to ensure data exists and is an object + if (!processesData.data || typeof processesData.data !== 'object' || processesData.data === null) { + return null; + } + + for (const [processId, processData] of Object.entries(processesData.data)) { + // Type guard to ensure processData is an object with expected properties + if ( + processData && + typeof processData === 'object' && + 'email' in processData && + 'phoneNumber' in processData && + typeof processData.email === 'string' && + typeof processData.phoneNumber === 'string' && + processData.email === email + ) { + return processData.phoneNumber; + } + } + return null; + } + async createProcess(processData: { [label: string]: any }, privateFields: string[], roles: any): Promise { const message: ClientMessage = { type: MessageType.CREATE_PROCESS,