Skip to content

The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.

792 B
Raw Blame
/* Copyright 2026 BoxLite AI. SPDX-License-Identifier: AGPL-3.0 */

export const signupSourceLifetimeMs = 24 * 60 * 60 * 1000
export const campaignLabel = /^[a-z0-9][a-z0-9_-]{0,63}$/i
export const sourceHostname = /^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/

export function validSource(source: string, kind: SignupSource['kind']): boolean {
  if (typeof source !== 'string') return false
  if (kind === 'referrer') {
    return sourceHostname.test(source) && source !== 'boxlite.ai' && !source.endsWith('.boxlite.ai')
  }
  return (kind === 'utm' || kind === 'ref') && campaignLabel.test(source)
}

export interface SignupSource {
  source: string
  kind: 'utm' | 'ref' | 'referrer'
  enteredAt: string
  medium?: string
  campaign?: string
  content?: string
}