import type { ExecutorContext } from '@nx/devkit'; import { BotonicAPIService } from '../api-service'; export declare function resolveProjectPath(context: ExecutorContext): string; export declare function askEmailPassword(): Promise<{ email: string; password: string; }>; export declare function askLogin(botonicApiService: BotonicAPIService): Promise; export declare function askSignup(botonicApiService: BotonicAPIService): Promise; export declare function handleAuthentication(botonicApiService: BotonicAPIService): Promise; /** * Logs "Working as {user} in environment '{env}' [url]" as the first line for executors that need auth. * Call after ensuring login (so service.oauth is set). No-op if not logged in. */ export declare function logWorkingAsAndEnvironment(botonicApiService: BotonicAPIService): Promise; export declare function getAvailableBots(botonicApiService: BotonicAPIService): Promise; export declare function createNewBotWithName(botonicApiService: BotonicAPIService, botName: string, isTest?: boolean): Promise; export declare function getAppIdFromEnvFile(projectRoot: string, appIdKey: string): string | null; /** * Reads VITE_HUBTYPE_APP_ID from .env.[configuration] (e.g. .env.dev) or .env.local when configuration is 'local'. * Use this after deploy: deploy writes to .env.[configuration], so read from there instead of .env.local to avoid overwriting with a stale value. */ export declare function getAppIdFromEnvFileForConfig(projectRoot: string, configuration: (typeof TARGET_ENV_NAMES)[number], appIdKey?: string): string | null; export declare function writeAppIdToLocalEnv(projectRoot: string, appId: string, appIdKey?: string): Promise; declare const TARGET_ENV_NAMES: readonly ["local", "dev", "dev2", "qa", "prod"]; /** * Writes or updates VITE_HUBTYPE_APP_ID in .env.[targetEnv] so that when * serving with that configuration (e.g. MODE=dev), Vite loads the correct APP_ID. * For targetEnv === 'local' delegates to writeAppIdToLocalEnv. */ export declare function writeAppIdToEnvFile(projectRoot: string, appId: string, targetEnv: (typeof TARGET_ENV_NAMES)[number], appIdKey?: string): Promise; /** * Writes or updates a single env var (key=value) in .env.[targetEnv]. */ export declare function writeEnvVarToEnvFile(projectRoot: string, key: string, value: string, targetEnv: (typeof TARGET_ENV_NAMES)[number]): void; export declare function handleExecutorError(error: any, operation: string, showHelp?: boolean): { success: false; reason: string; }; /** * Finds the configuration key that matches the given environment object * @param configurations - The configurations object with env properties * @param targetEnv - The environment object to match against * @returns The configuration key if found, null otherwise */ export declare function findMatchingConfigurationKey(configurations: Record; }>, targetEnv: Record): string; export declare function resolveHubtypeEnvironment(context: ExecutorContext, options: any): { targetEnvironment: string; environmentVariables: Record; }; /** * Ensures the user is logged in to Hubtype before starting the tunnel flow. */ export declare function ensureHubtypeLoginBeforeTunnel(context: ExecutorContext, projectRoot: string, options?: DeployDevSessionOptions): Promise; /** * Ensures a bot is set: reuses one from bots.json registry, or prompts to select an existing * deployed bot or create a new one. The selected bot must be deployed with botonic_v2 strategy before * dev session registration will succeed — the user is informed of this requirement. */ export declare function ensureBot(botonicApiService: BotonicAPIService): Promise; export type ProviderAccountListItem = { id: string; provider?: string; is_test?: boolean; is_active?: boolean; }; /** * Returns the imp_id of the first active real (non-test) webchat PA on the bot. * Used by serve to auto-write VITE_HUBTYPE_APP_ID so the local widget connects. */ export declare function getActiveWebchatProviderAppId(results: ProviderAccountListItem[] | undefined): string | undefined; /** * APP_ID for the dev session must be the webchat test provider — not WhatsApp * or other channels, which may also be test+active on the same bot. */ export declare function getActiveTestWebchatProviderAppId(results: ProviderAccountListItem[] | undefined): string | undefined; export interface DeployDevSessionOptions { email?: string; password?: string; env?: Record; /** Explicit configuration name (e.g. 'dev') so deploy uses the right environment when Nx does not merge config. */ configuration?: string; /** E.164 phone number to register for WhatsApp local routing (e.g. +34612345678). */ whatsappPhone?: string; /** Bot id pre-selected by selectBotForServe — skips ensureBot lookup so the correct bot is used. */ selectedBotId?: string; } export interface DeployDevSessionResult { botId: string; apiUrl: string; accessToken: string; refreshToken: string; clientId: string; targetEnvironment: string; environmentVariables: Record; lambdaFunctionName: string | undefined; teardownWebchat: () => Promise; } /** * Registers a dev session with the given tunnel endpoint. * Handles auth, bot creation/selection, and registration. Returns the bot id and env. * Used by serve-bot (tunnel is always on). */ export declare function performDeployLocalRuntimeWithEndpoint(context: ExecutorContext, projectRoot: string, endpoint: string, options?: DeployDevSessionOptions): Promise; /** * Always prompts the user to select or create a bot for local development. * Pre-selects the previously used bot (from registry). When botName is provided, * skips the prompt entirely. For newly created bots, auto-deploys before returning * so the serve flow can proceed without manual intervention. * * Must be called before tunnel startup so that auto-deploys don't waste tunnel * resources and the selected bot is saved to the registry for * performDeployLocalRuntimeWithEndpoint to load. */ export declare function selectBotForServe(context: ExecutorContext, projectRoot: string, options?: DeployDevSessionOptions & { botName?: string; }): Promise; export declare function isBotDeployedRestartRequired(error: unknown): boolean; /** * Returns true if the currently selected bot (last entry in bots.json for the * given env) has an active WhatsApp provider. Used by the serve executor to * decide whether to enable the WhatsApp dev panel. */ export declare function selectedBotHasActiveWhatsapp(botId: string): boolean; /** * Builds the bot and deploys it to Hubtype Cloud. Shared by the deploy executor * and the serve executor's auto-deploy path for newly created bots. */ export declare function deployBotToHubtype(botonicApiService: BotonicAPIService, projectRoot: string, projectName: string): Promise; export {};