The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.
/* Copyright 2026 BoxLite AI. SPDX-License-Identifier: AGPL-3.0 */
import { RoutePath } from './console-routes'
import { ONBOARDING_USE_CASES } from './onboarding-use-cases'
export const consolePages = Object.values(RoutePath).filter((page) => page.startsWith('/dashboard/'))
export const consoleActions = [
'confirm_plan_change',
'connect_github',
'connect_github_account',
'connect_registry',
'create_api_key',
'create_box',
'create_checkpoint',
'create_custom_domain',
'create_volume',
'new_api_key',
'new_box',
'new_checkpoint',
'new_custom_domain',
'new_image_tag',
'new_managed_domain',
'new_registry',
'new_volume',
'pin_image_tag',
'redeem_coupon',
'request_managed_domain',
'save_auto_top_up',
'save_ci_limit',
'select_plan',
'top_up_wallet',
'update_ci_connection',
'update_registry',
'verify_custom_domain',
'view_billing_overview',
'view_billing_plans',
'view_billing_usage',
'view_billing_wallet',
'view_custom_domains',
'view_managed_domains',
]
export const consoleEventNames = ['$pageview', 'console_control_click', 'console_onboarding_step'] as const
type OnboardingInteraction = { page: RoutePath; control?: string; selections?: readonly string[] }
const welcomeStep = { page: RoutePath.WELCOME }
const welcomeClick = { ...welcomeStep, control: 'button' }
const subscriptionClick = { page: RoutePath.BILLING_PLAN_CHANGE, control: 'button' }
const quickstartClick = { page: RoutePath.QUICKSTART, control: 'button' }
const onboardingInteractions: Readonly<Record<string, OnboardingInteraction>> = {
org_create_started: welcomeStep,
org_name_submit_click: welcomeClick,
use_case_submit_click: welcomeClick,
welcome_back_to_org_click: welcomeClick,
welcome_back_to_use_case_click: welcomeClick,
check_card_status_click: welcomeClick,
explore_boxlite_click: welcomeClick,
start_quickstart_click: welcomeClick,
use_case_selected: { ...welcomeStep, selections: ONBOARDING_USE_CASES },
choose_starter_click: welcomeClick,
choose_team_click: welcomeClick,
starter_sub_click: subscriptionClick,
team_sub_click: subscriptionClick,
verify_card_click: welcomeClick,
redeem_click: welcomeClick,
quickstart_code_copied: quickstartClick,
quickstart_template_create_click: quickstartClick,
quickstart_prompt_prepared: quickstartClick,
quickstart_prompt_copied: quickstartClick,
quickstart_deploy_mode_selected: { ...quickstartClick, selections: ['sdk_cli', 'console', 'prompt'] },
quickstart_sdk_tab_selected: {
...quickstartClick,
control: 'tab',
selections: ['python', 'typescript', 'go', 'rust', 'c', 'cli', 'rest'],
},
quickstart_template_selected: {
...quickstartClick,
selections: [
'python',
'node',
'go',
'rust',
'linux',
'uv',
'bun',
'maven',
'gcc',
'browserless',
'crawl4ai',
'lightpanda',
'jupyter',
'scipy',
'r',
'gotenberg',
'tika',
'ocr',
'pandoc',
'ffmpeg',
'qdrant',
'pgvector',
'valkey',
'wiremock',
'k6',
],
},
}
export const onboardingActions = Object.keys(onboardingInteractions)
export function validOnboardingInteraction({
page,
action,
control,
selection,
}: Pick<ConsoleInteraction, 'page' | 'action' | 'control' | 'selection'>): boolean {
if (!action || !Object.hasOwn(onboardingInteractions, action)) return false
const expected = onboardingInteractions[action]
if (expected.page !== page || expected.control !== control) return false
return expected.selections
? selection !== undefined && expected.selections.includes(selection)
: selection === undefined
}
export const billingTabs = ['overview', 'plans', 'usage', 'wallet']
export const consoleControls = ['a', 'button', 'menuitem', 'tab']
export const analyticsNoticeVersion = 1
export type AnalyticsPreference = { allowed: boolean | null; version: number; decidedAt: string | null }
export type ConsoleInteraction = {
event: (typeof consoleEventNames)[number]
page: RoutePath
occurredAt: string
control?: string
destination?: RoutePath
action?: string
selection?: string
billingTab?: string
}