Metadata-Version: 2.4
Name: vault-funeral-tech-embed
Version: 0.1.3
Summary: Embeddable Vault Funeral Tech UI components for Django
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: Django>=4.0
Provides-Extra: dev
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"

# vault-funeral-tech-embed

Django package for embedding Vault Funeral Tech commerce components. Serves the prebuilt IIFE assets and provides template tags for all components — no React build step required.

## Installation

```bash
pip install vault-funeral-tech-embed
```

Add to `INSTALLED_APPS`:

```python
INSTALLED_APPS = [
    ...
    "vault_embed",
]
```

Run collectstatic to copy the embed assets into your static root:

```bash
python manage.py collectstatic
```

## Configuration

Add to `settings.py`:

```python
import os

# Required
VAULT_API_URL    = os.environ.get("VAULT_API_URL", "https://api.yourdomain.com")
VAULT_TOKEN      = os.environ.get("VAULT_TOKEN", "")

# Required for Checkout and PaymentMethodList
VAULT_STRIPE_KEY = os.environ.get("VAULT_STRIPE_KEY", "")

# Optional — override brand theme
VAULT_THEME = {
    "primaryColor": "#2d6a4f",
    "fontFamily": "Inter, sans-serif",
    "borderRadius": "6px",
}
```

| Setting | Description |
|---|---|
| `VAULT_API_URL` | **Required.** Medusa backend base URL. |
| `VAULT_TOKEN` | **Required.** Medusa customer JWT. |
| `VAULT_STRIPE_KEY` | Stripe publishable key. Required for checkout and payment-method components. |
| `VAULT_THEME` | Dict of theme overrides: `primaryColor`, `fontFamily`, `borderRadius`. |

## Quick Start

Load the tags in your base template's `<head>`, then place components wherever you need them:

```django
{% load vault_embed %}
<!DOCTYPE html>
<html>
<head>
  {% vault_head %}
</head>
<body>
  {% vault_product_catalog columns=3 show_filters=True %}
</body>
</html>
```

### Passing a per-user token

When users authenticate through your Django app, pass their JWT from view context instead of the global setting:

```python
# views.py
def catalog_view(request):
    return render(request, "catalog.html", {
        "vault_token": request.session.get("vault_jwt", ""),
    })
```

```django
{% vault_head token=vault_token %}
```

## Template Tags

All tags accept optional theme override keyword arguments: `primary_color`, `accent_color`, `font_family`, `card_border_radius`, `button_border_radius`.

---

### `{% vault_head %}`

Outputs the `<script>` and `<link>` tags plus the global provider config. Place in `<head>`.

```django
{% vault_head %}
{% vault_head token=vault_token stripe_key="pk_live_..." primary_color="#2d6a4f" %}
```

| Param | Description |
|---|---|
| `token` | Customer JWT. Defaults to `settings.VAULT_TOKEN`. |
| `api_url` | API base URL. Defaults to `settings.VAULT_API_URL`. |
| `stripe_key` | Stripe publishable key. Defaults to `settings.VAULT_STRIPE_KEY`. |
| `primary_color` | CTA color override. |

---

### `{% vault_store_home %}`

Full storefront landing page with categories, new arrivals, and curated collections.

```django
{% vault_store_home show_categories=True show_new_arrivals=True max_collections=3 %}
```

| Param | Default | Description |
|---|---|---|
| `show_categories` | `True` | Show the category grid. |
| `show_new_arrivals` | `True` | Show the new arrivals carousel. |
| `show_collections` | `True` | Show curated collections. |
| `max_collections` | `4` | Max collections to display. |

---

### `{% vault_product_catalog %}`

Filterable, paginated product grid.

```django
{% vault_product_catalog columns=3 category_handle="caskets" limit=24 show_filters=True %}
```

| Param | Default | Description |
|---|---|---|
| `limit` | `20` | Products per page. |
| `category_id` | — | Filter by Medusa category ID. |
| `category_handle` | — | Filter by category handle, e.g. `"caskets"`. |
| `vendor_id` | — | Filter to a specific vendor. |
| `brand_id` | — | Filter to a specific brand. |
| `funeral_home_id` | — | Filter to a funeral home's products. |
| `columns` | `"auto"` | `2`, `3`, `4`, or `"auto"`. |
| `show_filters` | `True` | Show the filter panel. |
| `display_search` | `True` | Show the search bar. |
| `show_sort` | `True` | Show the sort dropdown. |
| `show_pagination` | `True` | Show pagination controls. |
| `show_family_badges` | `False` | Badge products already in the family catalog. |

---

### `{% vault_family_product_catalog %}`

Family-scoped catalog with per-product markup applied. `funeral_home_id` is required.

```django
{% vault_family_product_catalog funeral_home_id="fh_01JKHS..." columns=3 %}
```

| Param | Required | Description |
|---|---|---|
| `funeral_home_id` | **Yes** | Funeral home whose family catalog to display. |
| `limit` | No | Products per page. Default `20`. |
| `columns` | No | `2`, `3`, `4`, or `"auto"`. |
| `show_sort` | No | Show sort dropdown. |
| `show_pagination` | No | Show pagination controls. |
| `show_family_badges` | No | Show family catalog badges. |

---

### `{% vault_cart %}`

Cart panel with line items and subtotal.

```django
{% vault_cart %}
```

---

### `{% vault_checkout %}`

Multi-step checkout: address → shipping → Stripe payment → confirmation. Requires `VAULT_STRIPE_KEY`.

```django
{% vault_checkout %}
```

---

### `{% vault_order_list %}`

Paginated list of the customer's past orders.

```django
{% vault_order_list %}
```

---

### `{% vault_order_details %}`

Full detail view for a single order. `order_id` is required.

```django
{% vault_order_details order_id=order_id %}
```

| Param | Required | Description |
|---|---|---|
| `order_id` | **Yes** | Medusa order ID to display. |

## Related

- **React / npm**: [`@vault-funeral-tech/embed`](https://www.npmjs.com/package/@vault-funeral-tech/embed) — use this package when building a React app.

## License

MIT
