# TWWIM AI Dashboard — Source Code

This directory contains the TypeScript/React source used to produce the
compiled JavaScript assets bundled in `../dist/assets/` of this plugin. It
is shipped here to satisfy the WordPress Plugin Directory requirement for
public, maintained access to source code (Guidelines 1 and 4).

All code in this directory is licensed under **GPLv2 or later**.
Copyright © 2026 TWWIM UG. All rights reserved. (www.twwim.com)

## Build tooling

* **Vite 7.x** — `vite.config.wp.ts` is the WP-embed build config.
* **TypeScript 5.9.x**
* **Tailwind CSS 4.x** — `tailwind.config.wp.ts`, `postcss.config.mjs`.
* **TanStack Router plugin** (code-split routes).

No custom minification, transpilation, or obfuscation is applied. The
compiled assets are the default Vite production build output.

## Filename convention

WordPress.org forbids `$` in packaged filenames. TanStack Router uses the
`$paramName.tsx` convention for dynamic-route files in its file-based
routing. In this bundle, every occurrence of `$` in a filename under
`src/routes/` has been renamed to `_` (e.g. `$tenantId.tsx` →
`_tenantId.tsx`) purely to satisfy the packaging rule. The original files
in the TWWIM monorepo keep the `$` prefix required by TanStack Router — if
you rebuild, restore the `$` prefix in route filenames first.

## Workspace dependencies

`package.json` references three private workspace packages used internally:

* `@archer/api-interface` — shared TypeScript types and Zod schemas
* `@archer/domain`        — domain entities, enums, value objects
* `@archer/ui`            — shared React UI components

These are **not** bundled here because they are reused across multiple TWWIM
products and maintained in our internal monorepo. The sources of these
packages are available on request — contact **support@twwim.com**.

Only code actually reachable from the dashboard entry point is included in
the compiled output — Vite tree-shakes everything else at build time.

## Environment variables (build-time)

The WP build accepts these Vite env variables (read at build time, baked
into the output):

* `VITE_API_URL` — TWWIM AI API base URL
* `VITE_WP_CDN_DEFAULT` — default CDN URL for the frontend widget
* `VITE_LANDING_URL` — marketing/landing site URL
* `VITE_WP_EMBED=true` — must be set to enable WP-embed mode

The production build shipped with this plugin uses:

* `VITE_API_URL=https://customer-api.twwim.ai`
* `VITE_WP_CDN_DEFAULT=https://cdn.twwim.ai`
* `VITE_LANDING_URL=https://twwim.ai`
