/** * Copyright © 2022 Anagog Ltd. All rights reserved. */ import { NativeModules } from 'react-native'; import { Campaign } from './models/Campaign'; import { AnagogSDK } from './AnagogSDK'; const { JedAIModule } = NativeModules; export class AnagogTools { /** * Sync campaigns. * Download all your campaigns to your app. * @returns `Promise` with no parameters. */ static syncCampaigns(): Promise { return JedAIModule.syncCampaigns(); } /** * Simulate a campaign, use this API to test your campaigns as defined. * @param campaignIdentifier A campaign identifier to simulate. Pass null to simulates all your campaigns. * @returns `Promise` with no parameters. */ static simulateCampaign(campaignIdentifier: string | null): Promise { return JedAIModule.simulateCampaign(campaignIdentifier) } /** * Get available campaigns. * @returns `Promise` with list of `Campaign` objects. */ static getCampaigns(): Promise { return JedAIModule.getCampaigns() .then((json: any[]) => { return json.map(campaign => new Campaign(campaign['title'], campaign['identifier'])); }) } /** * Generate and send SDK reports. * @returns `Promise` with no parameters. */ static forceScheduleReports(): Promise { return JedAIModule.forceScheduleReports(); } /** * Show JedAI SDK debugging screen. * Use this API to open the JedAI SDK builtin debugging screen for easy integration. * @returns `Promise` with no parameters. */ static openDebuggingScreen(): Promise { return JedAIModule.openDebuggingScreen({ version: AnagogSDK.packageVersion, }); } }