Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

884 B
Raw Blame
// All deployments report to a single PostHog project; tag events with
// their origin so they can be segmented. Non-prod envs are expected to
// disable PostHog via VITE_ENABLE_POSTHOG instead of being mapped here.
const DEPLOYMENT_BY_HOST = {
  "us-central.unstract.com": "us-prod",
  "eu-west.unstract.com": "eu-prod",
};

const getDeployment = () =>
  DEPLOYMENT_BY_HOST[window?.location?.hostname] || "self-hosted";

// PII (email, name) may only leave Unstract-managed SaaS deployments
const isSaasProdDeployment = () => getDeployment() !== "self-hosted";

// Error text can contain customer endpoints, so it is sent only from SaaS.
const saasOnlyErrorProps = (errorMessage) =>
  typeof errorMessage === "string" && errorMessage && isSaasProdDeployment()
    ? { error: errorMessage.slice(0, 200) }
    : {};

export { getDeployment, isSaasProdDeployment, saasOnlyErrorProps };