# Seller portal

Brands get their own experience in the `(brand)` route group, which has its own
layout and is gated to users whose `role` is `brand`. It is where a clothing brand
turns its catalog into a try-on-enabled storefront.

```mermaid
graph TB
    Onboard["brand-onboarding.tsx<br/>application form"] --> Agree["agreement.tsx<br/>partner agreement"]
    Agree --> Dash["dashboard.tsx"]
    Dash --> Products["products / add-product"]
    Dash --> Analytics["analytics"]
    Dash --> Orders["orders"]
    Dash --> Billing["billing + Stripe Connect"]
    Dash --> Widget["widget<br/>Shop on Drape HTML snippet"]
```

## Screens

| Screen | What it does |
|---|---|
| `brand-onboarding.tsx` (top-level) | Brand application form — name, categories, contact |
| `agreement.tsx` | The DRAPE Partner Agreement, with scroll-to-accept persistence |
| `dashboard.tsx` | Brand home — plan/subscription status, quick stats, links, and Stripe/portal deep links |
| `add-product.tsx` | Create a product: image picker, name/price/description, and sport category + subcategory from the taxonomy |
| `products.tsx` | Manage the brand's catalog — list, edit, delete |
| `analytics.tsx` | Per-product performance (try-on and preview counts), fed by the events log |
| `orders.tsx` | Brand-side order management with status updates and a notes modal |
| `billing.tsx` | Subscription plans, payment method entry, and Stripe management links |
| `widget.tsx` | Generates a **Shop on Drape** HTML button snippet (not a CDN JS try-on embed). See [Website widget & deep links](./deep-links.md). |

## Billing & payouts

The portal is backed by Stripe Connect **Express**. A brand onboards a Connect
account, and its plan determines the platform fee (Freemium **10%** down to
Premium **6%** on the public ladder; Grandfathered **5%** is admin-only). When a
store is Connect-enabled, checkout routes funds to the brand via
`application_fee_amount` + `transfer_data`; otherwise the platform takes the charge
for manual payout. The full flow is on the
[backend payments](../architecture/backend.md#payments) page.

## Website button vs iOS home-screen widget

These are different products:

| Surface | What it is |
|---|---|
| **Website widget** (`widget.tsx` / brand portal `/widget`) | HTML **Shop on Drape** button linking to `{slug}.drape.to`. Install steps: [Website widget & deep links](./deep-links.md). |
| **iOS WidgetKit** (`modules/drape-widget`) | Native home-screen widget for the **consumer app**, wired by `withDrapeWidget` in `app.json` — not a web embed. |

:::note[Brand vs store terminology]
In the data model a brand is a `stores` document with a `plan_type` and Stripe
Connect fields. "Seller portal," "brand portal," and "store admin" all operate on
the same underlying store record.
:::
