Added shop and checkout to the CMS
Checkout is done with stripe Added reservation system
This commit is contained in:
parent
09e54033dd
commit
702d99b9ed
42 changed files with 3332 additions and 21 deletions
4
app/.gitignore → .gitignore
vendored
4
app/.gitignore → .gitignore
vendored
|
|
@ -5,8 +5,8 @@ node_modules
|
||||||
.vercel
|
.vercel
|
||||||
.netlify
|
.netlify
|
||||||
.wrangler
|
.wrangler
|
||||||
/.svelte-kit
|
*/.svelte-kit
|
||||||
/build
|
*/build
|
||||||
|
|
||||||
# OS
|
# OS
|
||||||
.DS_Store
|
.DS_Store
|
||||||
20
Caddyfile
20
Caddyfile
|
|
@ -1,16 +1,34 @@
|
||||||
# Reverse proxy — single port for both the SvelteKit app and PocketBase
|
# Reverse proxy — single port for both the SvelteKit app and PocketBase
|
||||||
# Route: /api/* and /_/* → PocketBase
|
# Route: /api/basket, /api/checkout/*, /api/webhooks/* → SvelteKit app (commerce endpoints)
|
||||||
|
# /api/* and /_/* → PocketBase
|
||||||
# everything else → SvelteKit app
|
# everything else → SvelteKit app
|
||||||
|
|
||||||
:8080 {
|
:8080 {
|
||||||
|
# SvelteKit commerce endpoints must reach the app, not PocketBase.
|
||||||
|
# These matchers are more specific than the generic /api/* handle below.
|
||||||
|
handle /api/basket {
|
||||||
|
reverse_proxy app:3000
|
||||||
|
}
|
||||||
|
|
||||||
|
handle /api/checkout/* {
|
||||||
|
reverse_proxy app:3000
|
||||||
|
}
|
||||||
|
|
||||||
|
handle /api/webhooks/* {
|
||||||
|
reverse_proxy app:3000
|
||||||
|
}
|
||||||
|
|
||||||
|
# PocketBase REST API (collections, records, files, health)
|
||||||
handle /api/* {
|
handle /api/* {
|
||||||
reverse_proxy pocketbase:80
|
reverse_proxy pocketbase:80
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# PocketBase admin UI
|
||||||
handle /_/* {
|
handle /_/* {
|
||||||
reverse_proxy pocketbase:80
|
reverse_proxy pocketbase:80
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Public site + SSR pages
|
||||||
handle {
|
handle {
|
||||||
reverse_proxy app:3000
|
reverse_proxy app:3000
|
||||||
}
|
}
|
||||||
|
|
|
||||||
31
README.md
31
README.md
|
|
@ -86,6 +86,17 @@ If schema import fails because of a PocketBase version mismatch, create these co
|
||||||
- `file`: file, required, max select `1`, image mime types
|
- `file`: file, required, max select `1`, image mime types
|
||||||
- `alt`: text
|
- `alt`: text
|
||||||
|
|
||||||
|
Commerce collections (see the Stripe section above for context):
|
||||||
|
|
||||||
|
- `items` — `name` text, `description` text, `price` number, `image` relation→media, `type` select `item|item_with_time`, `stock` number (nullable), `duration` number (nullable, minutes), `active` bool
|
||||||
|
- `slots` — `item` relation→items, `start` date, `end` date, `status` select `available|held|booked`, `heldUntil` date (nullable), `order` relation→orders (nullable), `notes` text
|
||||||
|
- `baskets` — `status` select `active|completed|abandoned`, `expiresAt` date, `email` text, `customerDetails` json, `stripePaymentIntentId` text
|
||||||
|
- `basket_lines` — `basket` relation→baskets, `item` relation→items, `slot` relation→slots (nullable), `quantity` number, `lineType` select `item|slot`
|
||||||
|
- `orders` — `basket` relation→baskets, `email` text, `customerDetails` json, `total` number, `status` select `pending|paid|refunded`, `stripePaymentIntentId` text
|
||||||
|
- `order_lines` — `order` relation→orders, `item` relation→items, `slot` relation→slots (nullable), `quantity` number, `lineType` select `item|slot`, `name` text (snapshot), `price` number (snapshot), `start` date (nullable, snapshot)
|
||||||
|
|
||||||
|
> **Schema format note:** `pb_schema.json` targets PocketBase 0.23+ using the `fields` array (not the legacy `schema` array). Relation and select fields carry their config (`collectionId`, `cascadeDelete`, `maxSelect`, `values`) at the field top level, not nested under `options`. Importing the whole file via the PocketBase admin UI or `PUT /api/collections/import` creates or updates all collections in one pass.
|
||||||
|
|
||||||
## Authentication
|
## Authentication
|
||||||
|
|
||||||
Admin routes live under `/admin`. Login accepts either:
|
Admin routes live under `/admin`. Login accepts either:
|
||||||
|
|
@ -100,8 +111,28 @@ All `/admin` routes except `/admin/login` are guarded in `src/hooks.server.ts`.
|
||||||
- `/admin/login` — sign in
|
- `/admin/login` — sign in
|
||||||
- `/admin/pages` — list/create pages
|
- `/admin/pages` — list/create pages
|
||||||
- `/admin/pages/[slug]` — block editor with draft preview
|
- `/admin/pages/[slug]` — block editor with draft preview
|
||||||
|
- `/admin/calendar` — events shown by Upcoming Calendar blocks
|
||||||
|
- `/admin/items` — services and products shown in Shop blocks
|
||||||
|
- `/admin/slots` — manually created bookable time slots for services
|
||||||
|
- `/admin/orders` — read-only list of confirmed bookings and purchases
|
||||||
- `/admin/globals` — header/footer editor
|
- `/admin/globals` — header/footer editor
|
||||||
|
|
||||||
|
## Reservations & payments (Stripe)
|
||||||
|
|
||||||
|
The shop/checkout blocks implement a basket-based booking flow: visitors add services (with time slots) or products to a server-side basket, then pay with an embedded Stripe Payment Element. Order creation is confirmed by the Stripe **webhook** (never the client).
|
||||||
|
|
||||||
|
Setup:
|
||||||
|
|
||||||
|
1. Add the Stripe + PocketBase-admin vars from `app/.env.example` to `app/.env` (local dev) or a root-level `.env` next to `docker-compose.yml` (Docker).
|
||||||
|
2. `POCKETBASE_ADMIN_EMAIL` / `POCKETBASE_ADMIN_PASSWORD` are the credentials of the PocketBase superuser you created — the basket/checkout/webhook APIs use a server-side admin client so collection rules can stay admin-only.
|
||||||
|
3. For local webhook testing, forward Stripe events with the CLI:
|
||||||
|
```sh
|
||||||
|
stripe listen --forward-to localhost:8080/api/webhooks/stripe
|
||||||
|
```
|
||||||
|
Copy the printed `whsec_…` signing secret into `STRIPE_WEBHOOK_SECRET`.
|
||||||
|
4. Import the updated `pb_schema.json` (adds `items`, `slots`, `baskets`, `basket_lines`, `orders`, `order_lines`). The `basket_lines.slot` partial unique index guarantees two visitors can't hold the same slot.
|
||||||
|
5. Create a published page (e.g. slug `book`) with a `shop` block and a `checkout` block, and point the header CTA at it.
|
||||||
|
|
||||||
## Public routes
|
## Public routes
|
||||||
|
|
||||||
- `/` renders `pages.slug = "home"`
|
- `/` renders `pages.slug = "home"`
|
||||||
|
|
|
||||||
|
|
@ -1 +1,13 @@
|
||||||
PUBLIC_POCKETBASE_URL=http://localhost:8080
|
PUBLIC_POCKETBASE_URL=http://localhost:8080
|
||||||
|
POCKETBASE_INTERNAL_URL=http://pocketbase:80
|
||||||
|
ORIGIN=http://localhost:8080
|
||||||
|
|
||||||
|
# Stripe
|
||||||
|
STRIPE_SECRET_KEY=sk_test_...
|
||||||
|
PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...
|
||||||
|
STRIPE_WEBHOOK_SECRET=whsec_...
|
||||||
|
STRIPE_CURRENCY=eur
|
||||||
|
|
||||||
|
# PocketBase admin credentials (for server-side basket/checkout/webhook APIs)
|
||||||
|
POCKETBASE_ADMIN_EMAIL=admin@example.com
|
||||||
|
POCKETBASE_ADMIN_PASSWORD=changeme
|
||||||
|
|
|
||||||
467
app/bun.lock
Normal file
467
app/bun.lock
Normal file
|
|
@ -0,0 +1,467 @@
|
||||||
|
{
|
||||||
|
"lockfileVersion": 1,
|
||||||
|
"configVersion": 0,
|
||||||
|
"workspaces": {
|
||||||
|
"": {
|
||||||
|
"name": "app",
|
||||||
|
"dependencies": {
|
||||||
|
"@dnd-kit/core": "^6.3.1",
|
||||||
|
"@dnd-kit/sortable": "^10.0.0",
|
||||||
|
"@dnd-kit/utilities": "^3.2.2",
|
||||||
|
"@stripe/stripe-js": "^9.12.1",
|
||||||
|
"@sveltejs/adapter-node": "^5.5.4",
|
||||||
|
"@tailwindcss/vite": "^4.3.0",
|
||||||
|
"@tiptap/core": "^3.23.4",
|
||||||
|
"@tiptap/extension-link": "^3.23.4",
|
||||||
|
"@tiptap/extension-placeholder": "^3.23.4",
|
||||||
|
"@tiptap/starter-kit": "^3.23.4",
|
||||||
|
"daisyui": "^5.5.19",
|
||||||
|
"pocketbase": "^0.26.9",
|
||||||
|
"stripe": "^22.3.2",
|
||||||
|
"svelte-tiptap": "^3.0.1",
|
||||||
|
"tailwindcss": "^4.3.0",
|
||||||
|
"uuid": "^14.0.0",
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@sveltejs/adapter-auto": "^7.0.1",
|
||||||
|
"@sveltejs/kit": "^2.57.0",
|
||||||
|
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
||||||
|
"@types/node": "^25.8.0",
|
||||||
|
"@types/uuid": "^10.0.0",
|
||||||
|
"svelte": "^5.55.2",
|
||||||
|
"svelte-check": "^4.4.6",
|
||||||
|
"typescript": "^6.0.2",
|
||||||
|
"vite": "^8.0.7",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"packages": {
|
||||||
|
"@dnd-kit/accessibility": ["@dnd-kit/accessibility@3.1.1", "", { "dependencies": { "tslib": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0" } }, "sha512-2P+YgaXF+gRsIihwwY1gCsQSYnu9Zyj2py8kY5fFvUM1qm2WA2u639R6YNVfU4GWr+ZM5mqEsfHZZLoRONbemw=="],
|
||||||
|
|
||||||
|
"@dnd-kit/core": ["@dnd-kit/core@6.3.1", "", { "dependencies": { "@dnd-kit/accessibility": "^3.1.1", "@dnd-kit/utilities": "^3.2.2", "tslib": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0", "react-dom": ">=16.8.0" } }, "sha512-xkGBRQQab4RLwgXxoqETICr6S5JlogafbhNsidmrkVv2YRs5MLwpjoF2qpiGjQt8S9AoxtIV603s0GIUpY5eYQ=="],
|
||||||
|
|
||||||
|
"@dnd-kit/sortable": ["@dnd-kit/sortable@10.0.0", "", { "dependencies": { "@dnd-kit/utilities": "^3.2.2", "tslib": "^2.0.0" }, "peerDependencies": { "@dnd-kit/core": "^6.3.0", "react": ">=16.8.0" } }, "sha512-+xqhmIIzvAYMGfBYYnbKuNicfSsk4RksY2XdmJhT+HAC01nix6fHCztU68jooFiMUB01Ky3F0FyOvhG/BZrWkg=="],
|
||||||
|
|
||||||
|
"@dnd-kit/utilities": ["@dnd-kit/utilities@3.2.2", "", { "dependencies": { "tslib": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0" } }, "sha512-+MKAJEOfaBe5SmV6t34p80MMKhjvUz0vRrvVJbPT0WElzaOJ/1xs+D+KDv+tD/NE5ujfrChEcshd4fLn0wpiqg=="],
|
||||||
|
|
||||||
|
"@emnapi/core": ["@emnapi/core@1.10.0", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.1", "tslib": "^2.4.0" } }, "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw=="],
|
||||||
|
|
||||||
|
"@emnapi/runtime": ["@emnapi/runtime@1.10.0", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA=="],
|
||||||
|
|
||||||
|
"@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.1", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w=="],
|
||||||
|
|
||||||
|
"@floating-ui/core": ["@floating-ui/core@1.7.5", "", { "dependencies": { "@floating-ui/utils": "^0.2.11" } }, "sha512-1Ih4WTWyw0+lKyFMcBHGbb5U5FtuHJuujoyyr5zTaWS5EYMeT6Jb2AuDeftsCsEuchO+mM2ij5+q9crhydzLhQ=="],
|
||||||
|
|
||||||
|
"@floating-ui/dom": ["@floating-ui/dom@1.7.6", "", { "dependencies": { "@floating-ui/core": "^1.7.5", "@floating-ui/utils": "^0.2.11" } }, "sha512-9gZSAI5XM36880PPMm//9dfiEngYoC6Am2izES1FF406YFsjvyBMmeJ2g4SAju3xWwtuynNRFL2s9hgxpLI5SQ=="],
|
||||||
|
|
||||||
|
"@floating-ui/utils": ["@floating-ui/utils@0.2.11", "", {}, "sha512-RiB/yIh78pcIxl6lLMG0CgBXAZ2Y0eVHqMPYugu+9U0AeT6YBeiJpf7lbdJNIugFP5SIjwNRgo4DhR1Qxi26Gg=="],
|
||||||
|
|
||||||
|
"@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.13", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA=="],
|
||||||
|
|
||||||
|
"@jridgewell/remapping": ["@jridgewell/remapping@2.3.5", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ=="],
|
||||||
|
|
||||||
|
"@jridgewell/resolve-uri": ["@jridgewell/resolve-uri@3.1.2", "", {}, "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="],
|
||||||
|
|
||||||
|
"@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.5", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="],
|
||||||
|
|
||||||
|
"@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
|
||||||
|
|
||||||
|
"@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.1.4", "", { "dependencies": { "@tybys/wasm-util": "^0.10.1" }, "peerDependencies": { "@emnapi/core": "^1.7.1", "@emnapi/runtime": "^1.7.1" } }, "sha512-3NQNNgA1YSlJb/kMH1ildASP9HW7/7kYnRI2szWJaofaS1hWmbGI4H+d3+22aGzXXN9IJ+n+GiFVcGipJP18ow=="],
|
||||||
|
|
||||||
|
"@oxc-project/types": ["@oxc-project/types@0.130.0", "", {}, "sha512-ibD2usx9JRu7f5pu2tMKMI4cpA4NgXJQoYRP4pQ7Pxmn1l6k/53qWtQWZayhYy3X4QZkt90Ot+mJEaeXouio6Q=="],
|
||||||
|
|
||||||
|
"@polka/url": ["@polka/url@1.0.0-next.29", "", {}, "sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww=="],
|
||||||
|
|
||||||
|
"@rolldown/binding-android-arm64": ["@rolldown/binding-android-arm64@1.0.1", "", { "os": "android", "cpu": "arm64" }, "sha512-fJI3I0r3C3Oj/zdBCpaCmBRZYf07xpaq4yCfDDoSFm+beWNzbIl26puW8RraUdugoJw/95zerNOn6jasAhzSmg=="],
|
||||||
|
|
||||||
|
"@rolldown/binding-darwin-arm64": ["@rolldown/binding-darwin-arm64@1.0.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-cKnAhWEsV7TPcA/5EAteDp6KcJZBQ2G+BqE7zayMMi7kMvwRsbv7WT9aOnn0WNl4SKEIf43vjS31iUPu80nzXg=="],
|
||||||
|
|
||||||
|
"@rolldown/binding-darwin-x64": ["@rolldown/binding-darwin-x64@1.0.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-YKrVwQjIRBPo+5G/u03wGjbdy4q7pyzCe93DK9VJ7zkVmeg8LJ7GbgsiHWdR4xSoe4CAXRD7Bcjgbtr64bkXNg=="],
|
||||||
|
|
||||||
|
"@rolldown/binding-freebsd-x64": ["@rolldown/binding-freebsd-x64@1.0.1", "", { "os": "freebsd", "cpu": "x64" }, "sha512-z/oBsREo46SsFqBwYtFe0kpJeBijAT48O/WXLI4suiCLBkr03RTtTJMCzSdDd2znlh8VJizL09XVkQgk8IZonw=="],
|
||||||
|
|
||||||
|
"@rolldown/binding-linux-arm-gnueabihf": ["@rolldown/binding-linux-arm-gnueabihf@1.0.1", "", { "os": "linux", "cpu": "arm" }, "sha512-ik8q7GM11zxvYxFc2PeDcT6TBvhCQMaUxfph/M5l9sKuTs/Sjg3L+Byw0F7w0ZVLBZmx30P+gG0ECzzN+MFcmQ=="],
|
||||||
|
|
||||||
|
"@rolldown/binding-linux-arm64-gnu": ["@rolldown/binding-linux-arm64-gnu@1.0.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-QoSx2EkyrrdZ6kcyE8stqZ62t0Yra8Fs5ia9lOxJrh6TMQJK7gQKmscdTHf7pOXKREKrVwOtJcQG3qVSfc866A=="],
|
||||||
|
|
||||||
|
"@rolldown/binding-linux-arm64-musl": ["@rolldown/binding-linux-arm64-musl@1.0.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-uwNwFpwKeNiZawfAWBgg0VIztPTV3ihhh1vV334h9ivnNLorxnQMU6Fz8wG1Zb4Qh9LC1/MkcyT3YlDXG3Rsgg=="],
|
||||||
|
|
||||||
|
"@rolldown/binding-linux-ppc64-gnu": ["@rolldown/binding-linux-ppc64-gnu@1.0.1", "", { "os": "linux", "cpu": "ppc64" }, "sha512-zY1bul7OWr7DFBiJ++wofXvnr8B45ce3QsQUhKrIhXsygAh7bTkwyeM1bi1a2g5C/yC/N8TZyGDEoMfm/l9mpg=="],
|
||||||
|
|
||||||
|
"@rolldown/binding-linux-s390x-gnu": ["@rolldown/binding-linux-s390x-gnu@1.0.1", "", { "os": "linux", "cpu": "s390x" }, "sha512-0frlsT/f4Ft6I7SMESTKnF3cZsdicQn1dCMkF/jT9wDLE+gGoiQfv1nmT9e+s7s/fekvvy6tZM2jHvI2tkbJDQ=="],
|
||||||
|
|
||||||
|
"@rolldown/binding-linux-x64-gnu": ["@rolldown/binding-linux-x64-gnu@1.0.1", "", { "os": "linux", "cpu": "x64" }, "sha512-XABVmGp9Tg0WspTVvwduTc4fpqy6JnAUrSQe6OuyqD/03nI7r0O9OWUkMIwFrjKAIqolvqoA4ZrJppgwE0Gxmw=="],
|
||||||
|
|
||||||
|
"@rolldown/binding-linux-x64-musl": ["@rolldown/binding-linux-x64-musl@1.0.1", "", { "os": "linux", "cpu": "x64" }, "sha512-bV4fzswuzVcKD90o/VM6QqKxnxlDq0g2BISDLNVmxrnhpv1DDbyPhCIjYfvzYLV+MvkKKnQt2Q6AO86SEBULUQ=="],
|
||||||
|
|
||||||
|
"@rolldown/binding-openharmony-arm64": ["@rolldown/binding-openharmony-arm64@1.0.1", "", { "os": "none", "cpu": "arm64" }, "sha512-/Mh0Zhq3OP7fVs0kcQHZP6lZEthMGTaSf8UBQYSFEZDWGXXlEC+nJ6EqenaK2t4LBXMe3A+K/G2BVXXdtOr4PQ=="],
|
||||||
|
|
||||||
|
"@rolldown/binding-wasm32-wasi": ["@rolldown/binding-wasm32-wasi@1.0.1", "", { "dependencies": { "@emnapi/core": "1.10.0", "@emnapi/runtime": "1.10.0", "@napi-rs/wasm-runtime": "^1.1.4" }, "cpu": "none" }, "sha512-+1xc9X45l8ufsBAm6Gjvx2qDRIY9lTVt0cgWNcJ+1gdhXvkbxePA60yRTwSTuXL09CMhyJmjpV7E3NoyxbqFQQ=="],
|
||||||
|
|
||||||
|
"@rolldown/binding-win32-arm64-msvc": ["@rolldown/binding-win32-arm64-msvc@1.0.1", "", { "os": "win32", "cpu": "arm64" }, "sha512-1D+UqZdfnuR+Jy1GgMJwi85bD40H21uNmOPRWQhw4oRSuolZ/B5rixZ45DK2KXOTCvmVCecauWgEhbw8bI7tOw=="],
|
||||||
|
|
||||||
|
"@rolldown/binding-win32-x64-msvc": ["@rolldown/binding-win32-x64-msvc@1.0.1", "", { "os": "win32", "cpu": "x64" }, "sha512-INAycaWuhlOK3wk4mRHGsdgwYWmd9cChdPdE9bwWmy6rn9VqVNYNFGhOdXrofXUxwHIncSiPNb8tNm8knDVIeQ=="],
|
||||||
|
|
||||||
|
"@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.1", "", {}, "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw=="],
|
||||||
|
|
||||||
|
"@rollup/plugin-commonjs": ["@rollup/plugin-commonjs@29.0.2", "", { "dependencies": { "@rollup/pluginutils": "^5.0.1", "commondir": "^1.0.1", "estree-walker": "^2.0.2", "fdir": "^6.2.0", "is-reference": "1.2.1", "magic-string": "^0.30.3", "picomatch": "^4.0.2" }, "peerDependencies": { "rollup": "^2.68.0||^3.0.0||^4.0.0" } }, "sha512-S/ggWH1LU7jTyi9DxZOKyxpVd4hF/OZ0JrEbeLjXk/DFXwRny0tjD2c992zOUYQobLrVkRVMDdmHP16HKP7GRg=="],
|
||||||
|
|
||||||
|
"@rollup/plugin-json": ["@rollup/plugin-json@6.1.0", "", { "dependencies": { "@rollup/pluginutils": "^5.1.0" }, "peerDependencies": { "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" } }, "sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA=="],
|
||||||
|
|
||||||
|
"@rollup/plugin-node-resolve": ["@rollup/plugin-node-resolve@16.0.3", "", { "dependencies": { "@rollup/pluginutils": "^5.0.1", "@types/resolve": "1.20.2", "deepmerge": "^4.2.2", "is-module": "^1.0.0", "resolve": "^1.22.1" }, "peerDependencies": { "rollup": "^2.78.0||^3.0.0||^4.0.0" } }, "sha512-lUYM3UBGuM93CnMPG1YocWu7X802BrNF3jW2zny5gQyLQgRFJhV1Sq0Zi74+dh/6NBx1DxFC4b4GXg9wUCG5Qg=="],
|
||||||
|
|
||||||
|
"@rollup/pluginutils": ["@rollup/pluginutils@5.3.0", "", { "dependencies": { "@types/estree": "^1.0.0", "estree-walker": "^2.0.2", "picomatch": "^4.0.2" }, "peerDependencies": { "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" } }, "sha512-5EdhGZtnu3V88ces7s53hhfK5KSASnJZv8Lulpc04cWO3REESroJXg73DFsOmgbU2BhwV0E20bu2IDZb3VKW4Q=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.60.4", "", { "os": "android", "cpu": "arm" }, "sha512-F5QXMSiFebS9hKZj02XhWLLnRpJ3B3AROP0tWbFBSj+6kCbg5m9j5JoHKd4mmSVy5mS/IMQloYgYxCuJC0fxEQ=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.60.4", "", { "os": "android", "cpu": "arm64" }, "sha512-GxxTKApUpzRhof7poWvCJHRF51C67u1R7D6DiluBE8wKU1u5GWE8t+v81JvJYtbawoBFX1hLv5Ei4eVjkWokaw=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.60.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-tua0TaJxMOB1R0V0RS1jFZ/RpURFDJIOR2A6jWwQeawuFyS4gBW+rntLRaQd0EQ4bd6Vp44Z2rXW+YYDBsj6IA=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.60.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-CSKq7MsP+5PFIcydhAiR1K0UhEI1A2jWXVKHPCBZ151yOutENwvnPocgVHkivu2kviURtCEB6zUQw0vs8RrhMg=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.60.4", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-+O8OkVdyvXMtJEciu2wS/pzm1IxntEEQx3z5TAVy4l32G0etZn+RsA48ARRrFm6Ri8fvqPQfgrvNxSjKAbnd3g=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.60.4", "", { "os": "freebsd", "cpu": "x64" }, "sha512-Iw3oMskH3AfNuhU0MSN7vNbdi4me/NiYo2azqPz/Le16zHSa+3RRmliCMWWQmh4lcndccU40xcJuTYJZxNo/lw=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-linux-arm-gnueabihf": ["@rollup/rollup-linux-arm-gnueabihf@4.60.4", "", { "os": "linux", "cpu": "arm" }, "sha512-EIPRXTVQpHyF8WOo219AD2yEltPehLTcTMz2fn6JsatLYSzQf00hj3rulF+yauOlF9/FtM2WpkT/hJh/KJFGhA=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-linux-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.60.4", "", { "os": "linux", "cpu": "arm" }, "sha512-J3Yh9PzzF1Ovah2At+lHiGQdsYgArxBbXv/zHfSyaiFQEqvNv7DcW98pCrmdjCZBrqBiKrKKe2V+aaSGWuBe/w=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-linux-arm64-gnu": ["@rollup/rollup-linux-arm64-gnu@4.60.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-BFDEZMYfUvLn37ONE1yMBojPxnMlTFsdyNoqncT0qFq1mAfllL+ATMMJd8TeuVMiX84s1KbcxcZbXInmcO2mRg=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-linux-arm64-musl": ["@rollup/rollup-linux-arm64-musl@4.60.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-pc9EYOSlOgdQ2uPl1o9PF6/kLSgaUosia7gOuS8mB69IxJvlclko1MECXysjs5ryez1/5zjYqx3+xYU0TU6R1A=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-linux-loong64-gnu": ["@rollup/rollup-linux-loong64-gnu@4.60.4", "", { "os": "linux", "cpu": "none" }, "sha512-NxnomyxYerDh5n4iLrNa+sH+Z+U4BMEE46V2PgQ/hoB909i8gV1M5wPojWg9fk1jWpO3IQnOs20K4wyZuFLEFQ=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-linux-loong64-musl": ["@rollup/rollup-linux-loong64-musl@4.60.4", "", { "os": "linux", "cpu": "none" }, "sha512-nbJnQ8a3z1mtmrwImCYhc6BGpThAyYVRQxw9uKSKG4wR6aAYno9sVjJ0zaZcW9BPJX1GbrDPf+SvdWjgTuDmnw=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-linux-ppc64-gnu": ["@rollup/rollup-linux-ppc64-gnu@4.60.4", "", { "os": "linux", "cpu": "ppc64" }, "sha512-2EU6acNrQLd8tYvo/LXW535wupT3m6fo7HKo6lr7ktQoItxTyOL1ZCR/GfGCuXl2vR+zmfI6eRXkSemafv+iVg=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-linux-ppc64-musl": ["@rollup/rollup-linux-ppc64-musl@4.60.4", "", { "os": "linux", "cpu": "ppc64" }, "sha512-WeBtoMuaMxiiIrO2IYP3xs6GMWkJP2C0EoT8beTLkUPmzV1i/UcOSVw1d5r9KBODtHKilG5yFxsGRnBbK3wJ4A=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-linux-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.60.4", "", { "os": "linux", "cpu": "none" }, "sha512-FJHFfqpKUI3A10WrWKiFbBZ7yVbGT4q4B5o1qKFFojqpaYoh9LrQgqWCmmcxQzVSXYtyB5bzkXrYzlHTs21MYA=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-linux-riscv64-musl": ["@rollup/rollup-linux-riscv64-musl@4.60.4", "", { "os": "linux", "cpu": "none" }, "sha512-mcEl6CUT5IAUmQf1m9FYSmVqCJlpQ8r8eyftFUHG8i9OhY7BkBXSUdnLH5DOf0wCOjcP9v/QO93zpmF1SptCCw=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-linux-s390x-gnu": ["@rollup/rollup-linux-s390x-gnu@4.60.4", "", { "os": "linux", "cpu": "s390x" }, "sha512-ynt3JxVd2w2buzoKDWIyiV1pJW93xlQic1THVLXilz429oijRpSHivZAgp65KBu+cMcgf1eVVjdnTLvPxgCuoQ=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.60.4", "", { "os": "linux", "cpu": "x64" }, "sha512-Boiz5+MsaROEWDf+GGEwF8VMHGhlUoQMtIPjOgA5fv4osupqTVnJteQNKJwUcnUog2G55jYXH7KZFFiJe0TEzQ=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-linux-x64-musl": ["@rollup/rollup-linux-x64-musl@4.60.4", "", { "os": "linux", "cpu": "x64" }, "sha512-+qfSY27qIrFfI/Hom04KYFw3GKZSGU4lXus51wsb5EuySfFlWRwjkKWoE9emgRw/ukoT4Udsj4W/+xxG8VbPKg=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-openbsd-x64": ["@rollup/rollup-openbsd-x64@4.60.4", "", { "os": "openbsd", "cpu": "x64" }, "sha512-VpTfOPHgVXEBeeR8hZ2O0F3aSso+JDWqTWmTmzcQKted54IAdUVbxE+j/MVxUsKa8L20HJhv3vUezVPoquqWjA=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-openharmony-arm64": ["@rollup/rollup-openharmony-arm64@4.60.4", "", { "os": "none", "cpu": "arm64" }, "sha512-IPOsh5aRYuLv/nkU51X10Bf75Bsf6+gZdx1X+QP5QM6lIJFHHqbHLG0uJn/hWthzo13UAc2umiUorqZy3axoZg=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-win32-arm64-msvc": ["@rollup/rollup-win32-arm64-msvc@4.60.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-4QzE9E81OohJ/HKzHhsqU+zcYYojVOXlFMs1DdyMT6qXl/niOH7AVElmmEdUNHHS/oRkc++d5k6Vy85zFs0DEw=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.60.4", "", { "os": "win32", "cpu": "ia32" }, "sha512-zTPgT1YuHHcd+Tmx7h8aml0FWFVelV5N54oHow9SLj+GfoDy/huQ+UV396N/C7KpMDMiPspRktzM1/0r1usYEA=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-win32-x64-gnu": ["@rollup/rollup-win32-x64-gnu@4.60.4", "", { "os": "win32", "cpu": "x64" }, "sha512-DRS4G7mi9lJxqEDezIkKCaUIKCrLUUDCUaCsTPCi/rtqaC6D/jjwslMQyiDU50Ka0JKpeXeRBFBAXwArY52vBw=="],
|
||||||
|
|
||||||
|
"@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.60.4", "", { "os": "win32", "cpu": "x64" }, "sha512-QVTUovf40zgTqlFVrKA1uXMVvU2QWEFWfAH8Wdc48IxLvrJMQVMBRjuQyUpzZCDkakImib9eVazbWlC6ksWtJw=="],
|
||||||
|
|
||||||
|
"@standard-schema/spec": ["@standard-schema/spec@1.1.0", "", {}, "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w=="],
|
||||||
|
|
||||||
|
"@stripe/stripe-js": ["@stripe/stripe-js@9.12.1", "", {}, "sha512-KLXPvjA0BfS4dQnW+ddHjwtIXMnIfKYxqmeNMmQCfKjvYog0cSG+Z7ZvK4RH1+bV90GC07nUztWDRWmJLi5HZQ=="],
|
||||||
|
|
||||||
|
"@sveltejs/acorn-typescript": ["@sveltejs/acorn-typescript@1.0.9", "", { "peerDependencies": { "acorn": "^8.9.0" } }, "sha512-lVJX6qEgs/4DOcRTpo56tmKzVPtoWAaVbL4hfO7t7NVwl9AAXzQR6cihesW1BmNMPl+bK6dreu2sOKBP2Q9CIA=="],
|
||||||
|
|
||||||
|
"@sveltejs/adapter-auto": ["@sveltejs/adapter-auto@7.0.1", "", { "peerDependencies": { "@sveltejs/kit": "^2.0.0" } }, "sha512-dvuPm1E7M9NI/+canIQ6KKQDU2AkEefEZ2Dp7cY6uKoPq9Z/PhOXABe526UdW2mN986gjVkuSLkOYIBnS/M2LQ=="],
|
||||||
|
|
||||||
|
"@sveltejs/adapter-node": ["@sveltejs/adapter-node@5.5.4", "", { "dependencies": { "@rollup/plugin-commonjs": "^29.0.0", "@rollup/plugin-json": "^6.1.0", "@rollup/plugin-node-resolve": "^16.0.0", "rollup": "^4.59.0" }, "peerDependencies": { "@sveltejs/kit": "^2.4.0" } }, "sha512-45X92CXW+2J8ZUzPv3eLlKWEzINKiiGeFWTjyER4ZN4sGgNoaoeSkCY/QYNxHpPXy71QPsctwccBo9jJs0ySPQ=="],
|
||||||
|
|
||||||
|
"@sveltejs/kit": ["@sveltejs/kit@2.60.1", "", { "dependencies": { "@standard-schema/spec": "^1.0.0", "@sveltejs/acorn-typescript": "^1.0.5", "@types/cookie": "^0.6.0", "acorn": "^8.14.1", "cookie": "^0.6.0", "devalue": "^5.8.1", "esm-env": "^1.2.2", "kleur": "^4.1.5", "magic-string": "^0.30.5", "mrmime": "^2.0.0", "set-cookie-parser": "^3.0.0", "sirv": "^3.0.0" }, "peerDependencies": { "@opentelemetry/api": "^1.0.0", "@sveltejs/vite-plugin-svelte": "^3.0.0 || ^4.0.0-next.1 || ^5.0.0 || ^6.0.0-next.0 || ^7.0.0", "svelte": "^4.0.0 || ^5.0.0-next.0", "typescript": "^5.3.3 || ^6.0.0", "vite": "^5.0.3 || ^6.0.0 || ^7.0.0-beta.0 || ^8.0.0" }, "optionalPeers": ["@opentelemetry/api"], "bin": { "svelte-kit": "svelte-kit.js" } }, "sha512-mQjlkNo+rJvpln7V2IGY2j99BqhcFbS4UN0AQNKNYfhBAFZTuCDAdW3a1sgf330mvtNvsBXn3HpAhcmvdJTcIQ=="],
|
||||||
|
|
||||||
|
"@sveltejs/vite-plugin-svelte": ["@sveltejs/vite-plugin-svelte@7.1.2", "", { "dependencies": { "deepmerge": "^4.3.1", "magic-string": "^0.30.21", "obug": "^2.1.0", "vitefu": "^1.1.2" }, "peerDependencies": { "svelte": "^5.46.4", "vite": "^8.0.0-beta.7 || ^8.0.0" } }, "sha512-DrUBA2UXRfDmUX/ZTiEopd3X40yavsJF1FX2RygcuIScHL7o5YX1fMvoYnDhjeJQC4weCOklirpNWlcb2NiSeA=="],
|
||||||
|
|
||||||
|
"@tailwindcss/node": ["@tailwindcss/node@4.3.0", "", { "dependencies": { "@jridgewell/remapping": "^2.3.5", "enhanced-resolve": "^5.21.0", "jiti": "^2.6.1", "lightningcss": "1.32.0", "magic-string": "^0.30.21", "source-map-js": "^1.2.1", "tailwindcss": "4.3.0" } }, "sha512-aFb4gUhFOgdh9AXo4IzBEOzBkkAxm9VigwDJnMIYv3lcfXCJVesNfbEaBl4BNgVRyid92AmdviqwBUBRKSeY3g=="],
|
||||||
|
|
||||||
|
"@tailwindcss/oxide": ["@tailwindcss/oxide@4.3.0", "", { "optionalDependencies": { "@tailwindcss/oxide-android-arm64": "4.3.0", "@tailwindcss/oxide-darwin-arm64": "4.3.0", "@tailwindcss/oxide-darwin-x64": "4.3.0", "@tailwindcss/oxide-freebsd-x64": "4.3.0", "@tailwindcss/oxide-linux-arm-gnueabihf": "4.3.0", "@tailwindcss/oxide-linux-arm64-gnu": "4.3.0", "@tailwindcss/oxide-linux-arm64-musl": "4.3.0", "@tailwindcss/oxide-linux-x64-gnu": "4.3.0", "@tailwindcss/oxide-linux-x64-musl": "4.3.0", "@tailwindcss/oxide-wasm32-wasi": "4.3.0", "@tailwindcss/oxide-win32-arm64-msvc": "4.3.0", "@tailwindcss/oxide-win32-x64-msvc": "4.3.0" } }, "sha512-F7HZGBeN9I0/AuuJS5PwcD8xayx5ri5GhjYUDBEVYUkexyA/giwbDNjRVrxSezE3T250OU2K/wp/ltWx3UOefg=="],
|
||||||
|
|
||||||
|
"@tailwindcss/oxide-android-arm64": ["@tailwindcss/oxide-android-arm64@4.3.0", "", { "os": "android", "cpu": "arm64" }, "sha512-TJPiq67tKlLuObP6RkwvVGDoxCMBVtDgKkLfa/uyj7/FyxvQwHS+UOnVrXXgbEsfUaMgiVvC4KbJnRr26ho4Ng=="],
|
||||||
|
|
||||||
|
"@tailwindcss/oxide-darwin-arm64": ["@tailwindcss/oxide-darwin-arm64@4.3.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-oMN/WZRb+SO37BmUElEgeEWuU8E/HXRkiODxJxLe1UTHVXLrdVSgfaJV7pSlhRGMSOiXLuxTIjfsF3wYvz8cgQ=="],
|
||||||
|
|
||||||
|
"@tailwindcss/oxide-darwin-x64": ["@tailwindcss/oxide-darwin-x64@4.3.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-N6CUmu4a6bKVADfw77p+iw6Yd9Q3OBhe0veaDX+QazfuVYlQsHfDgxBrsjQ/IW+zywL8mTrNd0SdJT/zgtvMdA=="],
|
||||||
|
|
||||||
|
"@tailwindcss/oxide-freebsd-x64": ["@tailwindcss/oxide-freebsd-x64@4.3.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-zDL5hBkQdH5C6MpqbK3gQAgP80tsMwSI26vjOzjJtNCMUo0lFgOItzHKBIupOZNQxt3ouPH7RPhvNhiTfCe5CQ=="],
|
||||||
|
|
||||||
|
"@tailwindcss/oxide-linux-arm-gnueabihf": ["@tailwindcss/oxide-linux-arm-gnueabihf@4.3.0", "", { "os": "linux", "cpu": "arm" }, "sha512-R06HdNi7A7OEoMsf6d4tjZ71RCWnZQPHj2mnotSFURjNLdBC+cIgXQ7l81CqeoiQftjf6OOblxXMInMgN2VzMA=="],
|
||||||
|
|
||||||
|
"@tailwindcss/oxide-linux-arm64-gnu": ["@tailwindcss/oxide-linux-arm64-gnu@4.3.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-qTJHELX8jetjhRQHCLilkVLmybpzNQAtaI/gaoVoidn/ufbNDbAo8KlK2J+yPoc8wQxvDxCmh/5lr8nC1+lTbg=="],
|
||||||
|
|
||||||
|
"@tailwindcss/oxide-linux-arm64-musl": ["@tailwindcss/oxide-linux-arm64-musl@4.3.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-Z6sukiQsngnWO+l39X4pPbiWT81IC+PLKF+PHxIlyZbGNb9MODfYlXEVlFvej5BOZInWX01kVyzeLvHsXhfczQ=="],
|
||||||
|
|
||||||
|
"@tailwindcss/oxide-linux-x64-gnu": ["@tailwindcss/oxide-linux-x64-gnu@4.3.0", "", { "os": "linux", "cpu": "x64" }, "sha512-DRNdQRpSGzRGfARVuVkxvM8Q12nh19l4BF/G7zGA1oe+9wcC6saFBHTISrpIcKzhiXtSrlSrluCfvMuledoCTQ=="],
|
||||||
|
|
||||||
|
"@tailwindcss/oxide-linux-x64-musl": ["@tailwindcss/oxide-linux-x64-musl@4.3.0", "", { "os": "linux", "cpu": "x64" }, "sha512-Z0IADbDo8bh6I7h2IQMx601AdXBLfFpEdUotft86evd/8ZPflZe9COPO8Q1vw+pfLWIUo9zN/JGZvwuAJqduqg=="],
|
||||||
|
|
||||||
|
"@tailwindcss/oxide-wasm32-wasi": ["@tailwindcss/oxide-wasm32-wasi@4.3.0", "", { "cpu": "none" }, "sha512-HNZGOUxEmElksYR7S6sC5jTeNGpobAsy9u7Gu0AskJ8/20FR9GqebUyB+HBcU/ax6BHuiuJi+Oda4B+YX6H1yA=="],
|
||||||
|
|
||||||
|
"@tailwindcss/oxide-win32-arm64-msvc": ["@tailwindcss/oxide-win32-arm64-msvc@4.3.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-Pe+RPVTi1T+qymuuRpcdvwSVZjnll/f7n8gBxMMh3xLTctMDKqpdfGimbMyioqtLhUYZxdJ9wGNhV7MKHvgZsQ=="],
|
||||||
|
|
||||||
|
"@tailwindcss/oxide-win32-x64-msvc": ["@tailwindcss/oxide-win32-x64-msvc@4.3.0", "", { "os": "win32", "cpu": "x64" }, "sha512-Mvrf2kXW/yeW/OTezZlCGOirXRcUuLIBx/5Y12BaPM7wJoryG6dfS/NJL8aBPqtTEx/Vm4T4vKzFUcKDT+TKUA=="],
|
||||||
|
|
||||||
|
"@tailwindcss/vite": ["@tailwindcss/vite@4.3.0", "", { "dependencies": { "@tailwindcss/node": "4.3.0", "@tailwindcss/oxide": "4.3.0", "tailwindcss": "4.3.0" }, "peerDependencies": { "vite": "^5.2.0 || ^6 || ^7 || ^8" } }, "sha512-t6J3OrB5Fc0ExuhohouH0fWUGMYL6PTLhW+E7zIk/pdbnJARZDCwjBznFnkh5ynRnIRSI4YjtTH0t6USjJISrw=="],
|
||||||
|
|
||||||
|
"@tiptap/core": ["@tiptap/core@3.23.4", "", { "peerDependencies": { "@tiptap/pm": "3.23.4" } }, "sha512-ni2LWE52bVeSt3L2HVBSmbBw+elc32ATej9C68EyKzN/8vR5ILxFn6RCdDTKm4asmwZyq2jys12dKmBdWMr9QA=="],
|
||||||
|
|
||||||
|
"@tiptap/extension-blockquote": ["@tiptap/extension-blockquote@3.23.4", "", { "peerDependencies": { "@tiptap/core": "3.23.4" } }, "sha512-7YjSibNlPcy9eGK+tHt5G/Njr7nPxl+rZ3rCC6TwtLIRLSHPnoGDsfFOgTPkXxaQcE1a/VQwemnYfWc3kdIjDQ=="],
|
||||||
|
|
||||||
|
"@tiptap/extension-bold": ["@tiptap/extension-bold@3.23.4", "", { "peerDependencies": { "@tiptap/core": "3.23.4" } }, "sha512-3L9tnZ12i+98u5df2nV2zGu/sc3rhI87E3ocn1YYAO8PJUAgZnMwdet8JawCrS1uut5sRKlxo3SXEmdNfRVm/w=="],
|
||||||
|
|
||||||
|
"@tiptap/extension-bubble-menu": ["@tiptap/extension-bubble-menu@3.23.4", "", { "dependencies": { "@floating-ui/dom": "^1.0.0" }, "peerDependencies": { "@tiptap/core": "3.23.4", "@tiptap/pm": "3.23.4" } }, "sha512-EPTpL/IFp/aTGZErBq/Mc3dKznj6G/qNEkVYWjueOn1oKApyT0P6WVHGvu/vpMdErhzmoGDuFPPGVS6T8Upx2Q=="],
|
||||||
|
|
||||||
|
"@tiptap/extension-bullet-list": ["@tiptap/extension-bullet-list@3.23.4", "", { "peerDependencies": { "@tiptap/extension-list": "3.23.4" } }, "sha512-mXB2KZOz1R+E6VNTZ3vzdAk7ZDGKjPmsJEZIQg1B5qRycTKg49/rCCkLA2QnqAwX6BzS3mLLH1RWE2W0oXD7vg=="],
|
||||||
|
|
||||||
|
"@tiptap/extension-code": ["@tiptap/extension-code@3.23.4", "", { "peerDependencies": { "@tiptap/core": "3.23.4" } }, "sha512-C0TeRipMycUEBnV+Mzx6eLp/yZb6Vi/waP3Tkb0lO5/ikg7LWLB7AlmMunjIXEUcR/pJHID/aEh5PfJFpysUDg=="],
|
||||||
|
|
||||||
|
"@tiptap/extension-code-block": ["@tiptap/extension-code-block@3.23.4", "", { "peerDependencies": { "@tiptap/core": "3.23.4", "@tiptap/pm": "3.23.4" } }, "sha512-UEU1w/85CSNKktbhESnIRmtjKcH7DeschReZA8err1wAnYLTKzid5ucnJSJ25iRg2V5Fnuws5gnPT5CVgdfXCQ=="],
|
||||||
|
|
||||||
|
"@tiptap/extension-document": ["@tiptap/extension-document@3.23.4", "", { "peerDependencies": { "@tiptap/core": "3.23.4" } }, "sha512-YC4G6VkxT629rlqUTwD6XvOpxjvghn7fxrK4RbyKVJY2C6E1vgmX0won1Ast6v+qTE6iONOMS6f6VyPxSGjg4w=="],
|
||||||
|
|
||||||
|
"@tiptap/extension-dropcursor": ["@tiptap/extension-dropcursor@3.23.4", "", { "peerDependencies": { "@tiptap/extensions": "3.23.4" } }, "sha512-ujJQUIENk0RwVFCh5g/TOSEv1a7Pnam/cjHmSUqHWUNZkYS9aOqjm+JfURJPCinRS2oHvo3AARul5mkKgDJYcA=="],
|
||||||
|
|
||||||
|
"@tiptap/extension-floating-menu": ["@tiptap/extension-floating-menu@3.23.4", "", { "peerDependencies": { "@floating-ui/dom": "^1.0.0", "@tiptap/core": "3.23.4", "@tiptap/pm": "3.23.4" } }, "sha512-eAc72bKM26yIPx0jsU8qdjE71vFNVu5R9jGbdItBMFc0SPLS4qY8g+8RJ+iWoLwbcSEpgooLS9D9sLfdAU+Tvw=="],
|
||||||
|
|
||||||
|
"@tiptap/extension-gapcursor": ["@tiptap/extension-gapcursor@3.23.4", "", { "peerDependencies": { "@tiptap/extensions": "3.23.4" } }, "sha512-RuyvOlIGP6UpVOc0Lw0L63jKLtYM49CNhPV2OMSfwwwbBZ3pJGos2/SqpYg71d3sn+qpsAopS4Pfr8iPZog73A=="],
|
||||||
|
|
||||||
|
"@tiptap/extension-hard-break": ["@tiptap/extension-hard-break@3.23.4", "", { "peerDependencies": { "@tiptap/core": "3.23.4" } }, "sha512-ODlpZCi7n136BH9luM09EFL8Pg+bbRCd0tzCQM5BKMXRkLitYZA8Gl/f5DLmGJ50wzFsDPXK2Br2g9UvZK7COg=="],
|
||||||
|
|
||||||
|
"@tiptap/extension-heading": ["@tiptap/extension-heading@3.23.4", "", { "peerDependencies": { "@tiptap/core": "3.23.4" } }, "sha512-8W9Hqi0J69Xbqg08nPf4xRMJXMccaKFAgUE1tvy5PAWJSQxOMwkKQXgZXxwe+80sOMUnV8qveBqUy/ODMPgAxQ=="],
|
||||||
|
|
||||||
|
"@tiptap/extension-horizontal-rule": ["@tiptap/extension-horizontal-rule@3.23.4", "", { "peerDependencies": { "@tiptap/core": "3.23.4", "@tiptap/pm": "3.23.4" } }, "sha512-EA4kK8ywZ4dQNOdxeZbplmDDs5T5LjMgHpqxRwukj9wwKiILOK5E3fcKm1fCKh9Q02w96jax6YVccHwmgJP3sQ=="],
|
||||||
|
|
||||||
|
"@tiptap/extension-italic": ["@tiptap/extension-italic@3.23.4", "", { "peerDependencies": { "@tiptap/core": "3.23.4" } }, "sha512-jUAHi+HZlg47BzgVIy6y/UH5vev7vPQ95jddhB5K3hC122kvWFMXlken7UOnqzbxNcHs2+4Oi/ZJirYMpT4P5w=="],
|
||||||
|
|
||||||
|
"@tiptap/extension-link": ["@tiptap/extension-link@3.23.4", "", { "dependencies": { "linkifyjs": "^4.3.3" }, "peerDependencies": { "@tiptap/core": "3.23.4", "@tiptap/pm": "3.23.4" } }, "sha512-XjxltY7MomwfTs6jmN6Bw5bb/upb34lpyqv2RiXppFTK25Br7ipksRjUpWpB4/csZeg30qwrLGVKxCol38ffrw=="],
|
||||||
|
|
||||||
|
"@tiptap/extension-list": ["@tiptap/extension-list@3.23.4", "", { "peerDependencies": { "@tiptap/core": "3.23.4", "@tiptap/pm": "3.23.4" } }, "sha512-yuauDm6qW/7q+ZO0YJBKQEGdnUm6DDTJM8AMp9bMZrT4jRf/zyUtNcZ91QEfFvBcyVuI+10PIOXtNPevhQ741Q=="],
|
||||||
|
|
||||||
|
"@tiptap/extension-list-item": ["@tiptap/extension-list-item@3.23.4", "", { "peerDependencies": { "@tiptap/extension-list": "3.23.4" } }, "sha512-Q/JXosShD5oyDwukE6igdrZD2lb0ZgyoQTHYchk0pzU4frClFbn3RI1wKP+XeqKLhdO6KH2WZ9rERGH7PtDi7Q=="],
|
||||||
|
|
||||||
|
"@tiptap/extension-list-keymap": ["@tiptap/extension-list-keymap@3.23.4", "", { "peerDependencies": { "@tiptap/extension-list": "3.23.4" } }, "sha512-9FezifCfuoc0o+5K6l4QNOOfelqxnDGg/f9oL1D/LFZPC54bPxpWWft9QCWOqyqZgyLCLjbCjciAlbgkrFUmmw=="],
|
||||||
|
|
||||||
|
"@tiptap/extension-ordered-list": ["@tiptap/extension-ordered-list@3.23.4", "", { "peerDependencies": { "@tiptap/extension-list": "3.23.4" } }, "sha512-+3ofyssYnOTa1+nFWEmCAY1ngn8nAV1xo25JnNNC87NMU9WkSgr93jB7/uUJP0uui1C2dBLlaup3XXm108yarw=="],
|
||||||
|
|
||||||
|
"@tiptap/extension-paragraph": ["@tiptap/extension-paragraph@3.23.4", "", { "peerDependencies": { "@tiptap/core": "3.23.4" } }, "sha512-KbhXjCFzWphvFn5VU7E4dtmYDm+bssI1i0+CnXPWCXkjdaaX88ck68Xp1fKz8/bbI/CqlgiNDO/3TvqgtZ6woQ=="],
|
||||||
|
|
||||||
|
"@tiptap/extension-placeholder": ["@tiptap/extension-placeholder@3.23.4", "", { "peerDependencies": { "@tiptap/extensions": "3.23.4" } }, "sha512-yHtAZkFR9M2AQmCi555w4ns1BBCqwRyYDYMtd10DBvqPX7T3TmGerPdUfI6sLr74GxnZ5zHOnOYdwAbeG5JzNw=="],
|
||||||
|
|
||||||
|
"@tiptap/extension-strike": ["@tiptap/extension-strike@3.23.4", "", { "peerDependencies": { "@tiptap/core": "3.23.4" } }, "sha512-Vnq5vW801zPbu1LtKeA5k4R241jY+hRjXeijYwIPxy15KzIiipY12518HiCf6/8kkRbMxgOfdYg9X4BRV3HV3g=="],
|
||||||
|
|
||||||
|
"@tiptap/extension-text": ["@tiptap/extension-text@3.23.4", "", { "peerDependencies": { "@tiptap/core": "3.23.4" } }, "sha512-q9kxver/MR18p66aWZHSPycnr9hcBFyVGeGj8gf+BQCzn5hpvtSYTfLvk1nq8GFhygdQ9/e3f7B5ovrm/jnpvw=="],
|
||||||
|
|
||||||
|
"@tiptap/extension-underline": ["@tiptap/extension-underline@3.23.4", "", { "peerDependencies": { "@tiptap/core": "3.23.4" } }, "sha512-F1ocPT10LV+seky25R1TMCRdc/Iof99jLcDSYDGr6mNEDY4ct2RvOeSM8aDdYq6CkH+vXt3i3JDeRwV23KzswQ=="],
|
||||||
|
|
||||||
|
"@tiptap/extensions": ["@tiptap/extensions@3.23.4", "", { "peerDependencies": { "@tiptap/core": "3.23.4", "@tiptap/pm": "3.23.4" } }, "sha512-SlGPXauW8iKWG7wwuwC/0y/smLImp0h6GBIGgNnTBgIP/ThXQnjLMSZH0mW/REO87dQxkku01V3ARRywi+juhg=="],
|
||||||
|
|
||||||
|
"@tiptap/pm": ["@tiptap/pm@3.23.4", "", { "dependencies": { "prosemirror-changeset": "^2.3.0", "prosemirror-commands": "^1.6.2", "prosemirror-dropcursor": "^1.8.1", "prosemirror-gapcursor": "^1.3.2", "prosemirror-history": "^1.4.1", "prosemirror-keymap": "^1.2.2", "prosemirror-model": "^1.24.1", "prosemirror-schema-list": "^1.5.0", "prosemirror-state": "^1.4.3", "prosemirror-tables": "^1.6.4", "prosemirror-transform": "^1.10.2", "prosemirror-view": "^1.38.1" } }, "sha512-+C5ngcoza47n3MjtjVBqBEBICPC0McdbwzJ+X6SSCviCLoqnSYanv5mIX9HWG0Q4fJ4BkdNM3VibZUxQaTbKyQ=="],
|
||||||
|
|
||||||
|
"@tiptap/starter-kit": ["@tiptap/starter-kit@3.23.4", "", { "dependencies": { "@tiptap/core": "^3.23.4", "@tiptap/extension-blockquote": "^3.23.4", "@tiptap/extension-bold": "^3.23.4", "@tiptap/extension-bullet-list": "^3.23.4", "@tiptap/extension-code": "^3.23.4", "@tiptap/extension-code-block": "^3.23.4", "@tiptap/extension-document": "^3.23.4", "@tiptap/extension-dropcursor": "^3.23.4", "@tiptap/extension-gapcursor": "^3.23.4", "@tiptap/extension-hard-break": "^3.23.4", "@tiptap/extension-heading": "^3.23.4", "@tiptap/extension-horizontal-rule": "^3.23.4", "@tiptap/extension-italic": "^3.23.4", "@tiptap/extension-link": "^3.23.4", "@tiptap/extension-list": "^3.23.4", "@tiptap/extension-list-item": "^3.23.4", "@tiptap/extension-list-keymap": "^3.23.4", "@tiptap/extension-ordered-list": "^3.23.4", "@tiptap/extension-paragraph": "^3.23.4", "@tiptap/extension-strike": "^3.23.4", "@tiptap/extension-text": "^3.23.4", "@tiptap/extension-underline": "^3.23.4", "@tiptap/extensions": "^3.23.4", "@tiptap/pm": "^3.23.4" } }, "sha512-3VhU+NO6/ec9DMj/5Ej0nzARSq42cXnqW+QHCmTL3FNXkXQz+tw1KlfruT5GGJ3M0RssjWjRC0a39N/4S3qxeA=="],
|
||||||
|
|
||||||
|
"@tybys/wasm-util": ["@tybys/wasm-util@0.10.2", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-RoBvJ2X0wuKlWFIjrwffGw1IqZHKQqzIchKaadZZfnNpsAYp2mM0h36JtPCjNDAHGgYez/15uMBpfGwchhiMgg=="],
|
||||||
|
|
||||||
|
"@types/cookie": ["@types/cookie@0.6.0", "", {}, "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA=="],
|
||||||
|
|
||||||
|
"@types/estree": ["@types/estree@1.0.9", "", {}, "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg=="],
|
||||||
|
|
||||||
|
"@types/node": ["@types/node@25.8.0", "", { "dependencies": { "undici-types": ">=7.24.0 <7.24.7" } }, "sha512-TCFSk8IZh+iLX1xtksoBVtdmgL+1IX0fC9BeU4QqFSuNdN/K+HUlhqOzEmSYYpZUVsLYcPqc9KX+60iDuninSQ=="],
|
||||||
|
|
||||||
|
"@types/resolve": ["@types/resolve@1.20.2", "", {}, "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q=="],
|
||||||
|
|
||||||
|
"@types/trusted-types": ["@types/trusted-types@2.0.7", "", {}, "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw=="],
|
||||||
|
|
||||||
|
"@types/uuid": ["@types/uuid@10.0.0", "", {}, "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ=="],
|
||||||
|
|
||||||
|
"acorn": ["acorn@8.16.0", "", { "bin": "bin/acorn" }, "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw=="],
|
||||||
|
|
||||||
|
"aria-query": ["aria-query@5.3.1", "", {}, "sha512-Z/ZeOgVl7bcSYZ/u/rh0fOpvEpq//LZmdbkXyc7syVzjPAhfOa9ebsdTSjEBDU4vs5nC98Kfduj1uFo0qyET3g=="],
|
||||||
|
|
||||||
|
"axobject-query": ["axobject-query@4.1.0", "", {}, "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ=="],
|
||||||
|
|
||||||
|
"chokidar": ["chokidar@4.0.3", "", { "dependencies": { "readdirp": "^4.0.1" } }, "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA=="],
|
||||||
|
|
||||||
|
"clsx": ["clsx@2.1.1", "", {}, "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA=="],
|
||||||
|
|
||||||
|
"commondir": ["commondir@1.0.1", "", {}, "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg=="],
|
||||||
|
|
||||||
|
"cookie": ["cookie@0.6.0", "", {}, "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw=="],
|
||||||
|
|
||||||
|
"daisyui": ["daisyui@5.5.19", "", {}, "sha512-pbFAkl1VCEh/MPCeclKL61I/MqRIFFhNU7yiXoDDRapXN4/qNCoMxeCCswyxEEhqL5eiTTfwHvucFtOE71C9sA=="],
|
||||||
|
|
||||||
|
"deepmerge": ["deepmerge@4.3.1", "", {}, "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A=="],
|
||||||
|
|
||||||
|
"detect-libc": ["detect-libc@2.1.2", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="],
|
||||||
|
|
||||||
|
"devalue": ["devalue@5.8.1", "", {}, "sha512-4CXDYRBGqN+57wVJkuXBYmpAVUSg3L6JAQa/DFqm238G73E1wuyc/JhGQJzN7vUf/CMphYau2zXbfWzDR5aTEw=="],
|
||||||
|
|
||||||
|
"enhanced-resolve": ["enhanced-resolve@5.21.3", "", { "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.3.3" } }, "sha512-QyL119InA+XXEkNLNTPCXPugSvOfhwv0JOlGNzvxs0hZaiHLNvXSpudUWsOlsXGWJh8G6ckCScEkVHfX3kw/2Q=="],
|
||||||
|
|
||||||
|
"es-errors": ["es-errors@1.3.0", "", {}, "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw=="],
|
||||||
|
|
||||||
|
"esm-env": ["esm-env@1.2.2", "", {}, "sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA=="],
|
||||||
|
|
||||||
|
"esrap": ["esrap@2.2.9", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.4.15" }, "peerDependencies": { "@typescript-eslint/types": "^8.2.0" }, "optionalPeers": ["@typescript-eslint/types"] }, "sha512-4KijP+NxCWthMCUC3qHbE6n4vCjqgJS1uAYKhuT/GWfFTf1Qyive2TgOjep+gzbSzRfnNyaN/UU9YmdOt8Eg0A=="],
|
||||||
|
|
||||||
|
"estree-walker": ["estree-walker@2.0.2", "", {}, "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="],
|
||||||
|
|
||||||
|
"fdir": ["fdir@6.5.0", "", { "peerDependencies": { "picomatch": "^3 || ^4" } }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="],
|
||||||
|
|
||||||
|
"fsevents": ["fsevents@2.3.3", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
|
||||||
|
|
||||||
|
"function-bind": ["function-bind@1.1.2", "", {}, "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="],
|
||||||
|
|
||||||
|
"graceful-fs": ["graceful-fs@4.2.11", "", {}, "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="],
|
||||||
|
|
||||||
|
"hasown": ["hasown@2.0.3", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-ej4AhfhfL2Q2zpMmLo7U1Uv9+PyhIZpgQLGT1F9miIGmiCJIoCgSmczFdrc97mWT4kVY72KA+WnnhJ5pghSvSg=="],
|
||||||
|
|
||||||
|
"is-core-module": ["is-core-module@2.16.2", "", { "dependencies": { "hasown": "^2.0.3" } }, "sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA=="],
|
||||||
|
|
||||||
|
"is-module": ["is-module@1.0.0", "", {}, "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g=="],
|
||||||
|
|
||||||
|
"is-reference": ["is-reference@3.0.3", "", { "dependencies": { "@types/estree": "^1.0.6" } }, "sha512-ixkJoqQvAP88E6wLydLGGqCJsrFUnqoH6HnaczB8XmDH1oaWU+xxdptvikTgaEhtZ53Ky6YXiBuUI2WXLMCwjw=="],
|
||||||
|
|
||||||
|
"jiti": ["jiti@2.7.0", "", { "bin": "lib/jiti-cli.mjs" }, "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ=="],
|
||||||
|
|
||||||
|
"kleur": ["kleur@4.1.5", "", {}, "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ=="],
|
||||||
|
|
||||||
|
"lightningcss": ["lightningcss@1.32.0", "", { "dependencies": { "detect-libc": "^2.0.3" }, "optionalDependencies": { "lightningcss-android-arm64": "1.32.0", "lightningcss-darwin-arm64": "1.32.0", "lightningcss-darwin-x64": "1.32.0", "lightningcss-freebsd-x64": "1.32.0", "lightningcss-linux-arm-gnueabihf": "1.32.0", "lightningcss-linux-arm64-gnu": "1.32.0", "lightningcss-linux-arm64-musl": "1.32.0", "lightningcss-linux-x64-gnu": "1.32.0", "lightningcss-linux-x64-musl": "1.32.0", "lightningcss-win32-arm64-msvc": "1.32.0", "lightningcss-win32-x64-msvc": "1.32.0" } }, "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ=="],
|
||||||
|
|
||||||
|
"lightningcss-android-arm64": ["lightningcss-android-arm64@1.32.0", "", { "os": "android", "cpu": "arm64" }, "sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg=="],
|
||||||
|
|
||||||
|
"lightningcss-darwin-arm64": ["lightningcss-darwin-arm64@1.32.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ=="],
|
||||||
|
|
||||||
|
"lightningcss-darwin-x64": ["lightningcss-darwin-x64@1.32.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w=="],
|
||||||
|
|
||||||
|
"lightningcss-freebsd-x64": ["lightningcss-freebsd-x64@1.32.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig=="],
|
||||||
|
|
||||||
|
"lightningcss-linux-arm-gnueabihf": ["lightningcss-linux-arm-gnueabihf@1.32.0", "", { "os": "linux", "cpu": "arm" }, "sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw=="],
|
||||||
|
|
||||||
|
"lightningcss-linux-arm64-gnu": ["lightningcss-linux-arm64-gnu@1.32.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ=="],
|
||||||
|
|
||||||
|
"lightningcss-linux-arm64-musl": ["lightningcss-linux-arm64-musl@1.32.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg=="],
|
||||||
|
|
||||||
|
"lightningcss-linux-x64-gnu": ["lightningcss-linux-x64-gnu@1.32.0", "", { "os": "linux", "cpu": "x64" }, "sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA=="],
|
||||||
|
|
||||||
|
"lightningcss-linux-x64-musl": ["lightningcss-linux-x64-musl@1.32.0", "", { "os": "linux", "cpu": "x64" }, "sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg=="],
|
||||||
|
|
||||||
|
"lightningcss-win32-arm64-msvc": ["lightningcss-win32-arm64-msvc@1.32.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw=="],
|
||||||
|
|
||||||
|
"lightningcss-win32-x64-msvc": ["lightningcss-win32-x64-msvc@1.32.0", "", { "os": "win32", "cpu": "x64" }, "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q=="],
|
||||||
|
|
||||||
|
"linkifyjs": ["linkifyjs@4.3.3", "", {}, "sha512-P8aEP5U/D1/IlTY2OeYsErdwh9bGuLE30NcXtKEjgdHcahveQoQwM2yZNsioQHsWFz0P7KKudisbrzCgR0sDHg=="],
|
||||||
|
|
||||||
|
"locate-character": ["locate-character@3.0.0", "", {}, "sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA=="],
|
||||||
|
|
||||||
|
"magic-string": ["magic-string@0.30.21", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="],
|
||||||
|
|
||||||
|
"mri": ["mri@1.2.0", "", {}, "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA=="],
|
||||||
|
|
||||||
|
"mrmime": ["mrmime@2.0.1", "", {}, "sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ=="],
|
||||||
|
|
||||||
|
"nanoid": ["nanoid@3.3.12", "", { "bin": "bin/nanoid.cjs" }, "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ=="],
|
||||||
|
|
||||||
|
"obug": ["obug@2.1.1", "", {}, "sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ=="],
|
||||||
|
|
||||||
|
"orderedmap": ["orderedmap@2.1.1", "", {}, "sha512-TvAWxi0nDe1j/rtMcWcIj94+Ffe6n7zhow33h40SKxmsmozs6dz/e+EajymfoFcHd7sxNn8yHM8839uixMOV6g=="],
|
||||||
|
|
||||||
|
"path-parse": ["path-parse@1.0.7", "", {}, "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="],
|
||||||
|
|
||||||
|
"picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],
|
||||||
|
|
||||||
|
"picomatch": ["picomatch@4.0.4", "", {}, "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A=="],
|
||||||
|
|
||||||
|
"pocketbase": ["pocketbase@0.26.9", "", {}, "sha512-Tiv1/hNuUzRdvT0d8hF03dfzuefQ1WdSRp1A1q3wzFC/WYhQcbU/Qlaubl/3ZDo6xvFXBS8JAgBS/L+ms7nkVQ=="],
|
||||||
|
|
||||||
|
"postcss": ["postcss@8.5.14", "", { "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-SoSL4+OSEtR99LHFZQiJLkT59C5B1amGO1NzTwj7TT1qCUgUO6hxOvzkOYxD+vMrXBM3XJIKzokoERdqQq/Zmg=="],
|
||||||
|
|
||||||
|
"prosemirror-changeset": ["prosemirror-changeset@2.4.1", "", { "dependencies": { "prosemirror-transform": "^1.0.0" } }, "sha512-96WBLhOaYhJ+kPhLg3uW359Tz6I/MfcrQfL4EGv4SrcqKEMC1gmoGrXHecPE8eOwTVCJ4IwgfzM8fFad25wNfw=="],
|
||||||
|
|
||||||
|
"prosemirror-commands": ["prosemirror-commands@1.7.1", "", { "dependencies": { "prosemirror-model": "^1.0.0", "prosemirror-state": "^1.0.0", "prosemirror-transform": "^1.10.2" } }, "sha512-rT7qZnQtx5c0/y/KlYaGvtG411S97UaL6gdp6RIZ23DLHanMYLyfGBV5DtSnZdthQql7W+lEVbpSfwtO8T+L2w=="],
|
||||||
|
|
||||||
|
"prosemirror-dropcursor": ["prosemirror-dropcursor@1.8.2", "", { "dependencies": { "prosemirror-state": "^1.0.0", "prosemirror-transform": "^1.1.0", "prosemirror-view": "^1.1.0" } }, "sha512-CCk6Gyx9+Tt2sbYk5NK0nB1ukHi2ryaRgadV/LvyNuO3ena1payM2z6Cg0vO1ebK8cxbzo41ku2DE5Axj1Zuiw=="],
|
||||||
|
|
||||||
|
"prosemirror-gapcursor": ["prosemirror-gapcursor@1.4.1", "", { "dependencies": { "prosemirror-keymap": "^1.0.0", "prosemirror-model": "^1.0.0", "prosemirror-state": "^1.0.0", "prosemirror-view": "^1.0.0" } }, "sha512-pMdYaEnjNMSwl11yjEGtgTmLkR08m/Vl+Jj443167p9eB3HVQKhYCc4gmHVDsLPODfZfjr/MmirsdyZziXbQKw=="],
|
||||||
|
|
||||||
|
"prosemirror-history": ["prosemirror-history@1.5.0", "", { "dependencies": { "prosemirror-state": "^1.2.2", "prosemirror-transform": "^1.0.0", "prosemirror-view": "^1.31.0", "rope-sequence": "^1.3.0" } }, "sha512-zlzTiH01eKA55UAf1MEjtssJeHnGxO0j4K4Dpx+gnmX9n+SHNlDqI2oO1Kv1iPN5B1dm5fsljCfqKF9nFL6HRg=="],
|
||||||
|
|
||||||
|
"prosemirror-keymap": ["prosemirror-keymap@1.2.3", "", { "dependencies": { "prosemirror-state": "^1.0.0", "w3c-keyname": "^2.2.0" } }, "sha512-4HucRlpiLd1IPQQXNqeo81BGtkY8Ai5smHhKW9jjPKRc2wQIxksg7Hl1tTI2IfT2B/LgX6bfYvXxEpJl7aKYKw=="],
|
||||||
|
|
||||||
|
"prosemirror-model": ["prosemirror-model@1.25.6", "", { "dependencies": { "orderedmap": "^2.0.0" } }, "sha512-RIm+e9BiqAaJ1mRECv3vR3C+VG8ELoTTI+47tVudGi82yLnFOx3G/p/iSPK1HmHQdKhkkrJ68NJqxh7S+FBVmQ=="],
|
||||||
|
|
||||||
|
"prosemirror-schema-list": ["prosemirror-schema-list@1.5.1", "", { "dependencies": { "prosemirror-model": "^1.0.0", "prosemirror-state": "^1.0.0", "prosemirror-transform": "^1.7.3" } }, "sha512-927lFx/uwyQaGwJxLWCZRkjXG0p48KpMj6ueoYiu4JX05GGuGcgzAy62dfiV8eFZftgyBUvLx76RsMe20fJl+Q=="],
|
||||||
|
|
||||||
|
"prosemirror-state": ["prosemirror-state@1.4.4", "", { "dependencies": { "prosemirror-model": "^1.0.0", "prosemirror-transform": "^1.0.0", "prosemirror-view": "^1.27.0" } }, "sha512-6jiYHH2CIGbCfnxdHbXZ12gySFY/fz/ulZE333G6bPqIZ4F+TXo9ifiR86nAHpWnfoNjOb3o5ESi7J8Uz1jXHw=="],
|
||||||
|
|
||||||
|
"prosemirror-tables": ["prosemirror-tables@1.8.5", "", { "dependencies": { "prosemirror-keymap": "^1.2.3", "prosemirror-model": "^1.25.4", "prosemirror-state": "^1.4.4", "prosemirror-transform": "^1.10.5", "prosemirror-view": "^1.41.4" } }, "sha512-V/0cDCsHKHe/tfWkeCmthNUcEp1IVO3p6vwN8XtwE9PZQLAZJigbw3QoraAdfJPir4NKJtNvOB8oYGKRl+t0Dw=="],
|
||||||
|
|
||||||
|
"prosemirror-transform": ["prosemirror-transform@1.12.0", "", { "dependencies": { "prosemirror-model": "^1.21.0" } }, "sha512-GxboyN4AMIsoHNtz5uf2r2Ru551i5hWeCMD6E2Ib4Eogqoub0NflniaBPVQ4MrGE5yZ8JV9tUHg9qcZTTrcN4w=="],
|
||||||
|
|
||||||
|
"prosemirror-view": ["prosemirror-view@1.41.8", "", { "dependencies": { "prosemirror-model": "^1.20.0", "prosemirror-state": "^1.0.0", "prosemirror-transform": "^1.1.0" } }, "sha512-TnKDdohEatgyZNGCDWIdccOHXhYloJwbwU+phw/a23KBvJIR9lWQWW7WHHK3vBdOLDNuF7TaX98GObUZOWkOnA=="],
|
||||||
|
|
||||||
|
"react": ["react@19.2.6", "", {}, "sha512-sfWGGfavi0xr8Pg0sVsyHMAOziVYKgPLNrS7ig+ivMNb3wbCBw3KxtflsGBAwD3gYQlE/AEZsTLgToRrSCjb0Q=="],
|
||||||
|
|
||||||
|
"react-dom": ["react-dom@19.2.6", "", { "dependencies": { "scheduler": "^0.27.0" }, "peerDependencies": { "react": "^19.2.6" } }, "sha512-0prMI+hvBbPjsWnxDLxlCGyM8PN6UuWjEUCYmZhO67xIV9Xasa/r/vDnq+Xyq4Lo27g8QSbO5YzARu0D1Sps3g=="],
|
||||||
|
|
||||||
|
"readdirp": ["readdirp@4.1.2", "", {}, "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg=="],
|
||||||
|
|
||||||
|
"resolve": ["resolve@1.22.12", "", { "dependencies": { "es-errors": "^1.3.0", "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": "bin/resolve" }, "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA=="],
|
||||||
|
|
||||||
|
"rolldown": ["rolldown@1.0.1", "", { "dependencies": { "@oxc-project/types": "=0.130.0", "@rolldown/pluginutils": "^1.0.0" }, "optionalDependencies": { "@rolldown/binding-android-arm64": "1.0.1", "@rolldown/binding-darwin-arm64": "1.0.1", "@rolldown/binding-darwin-x64": "1.0.1", "@rolldown/binding-freebsd-x64": "1.0.1", "@rolldown/binding-linux-arm-gnueabihf": "1.0.1", "@rolldown/binding-linux-arm64-gnu": "1.0.1", "@rolldown/binding-linux-arm64-musl": "1.0.1", "@rolldown/binding-linux-ppc64-gnu": "1.0.1", "@rolldown/binding-linux-s390x-gnu": "1.0.1", "@rolldown/binding-linux-x64-gnu": "1.0.1", "@rolldown/binding-linux-x64-musl": "1.0.1", "@rolldown/binding-openharmony-arm64": "1.0.1", "@rolldown/binding-wasm32-wasi": "1.0.1", "@rolldown/binding-win32-arm64-msvc": "1.0.1", "@rolldown/binding-win32-x64-msvc": "1.0.1" }, "bin": "bin/cli.mjs" }, "sha512-X0KQHljNnEkWNqqiz9zJrGunh1B0HgOxLXvnFpCOcadzcy5qohZ3tqMEUg00vncoRovXuK3ZqCT9KnnKzoInFQ=="],
|
||||||
|
|
||||||
|
"rollup": ["rollup@4.60.4", "", { "dependencies": { "@types/estree": "1.0.8" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.60.4", "@rollup/rollup-android-arm64": "4.60.4", "@rollup/rollup-darwin-arm64": "4.60.4", "@rollup/rollup-darwin-x64": "4.60.4", "@rollup/rollup-freebsd-arm64": "4.60.4", "@rollup/rollup-freebsd-x64": "4.60.4", "@rollup/rollup-linux-arm-gnueabihf": "4.60.4", "@rollup/rollup-linux-arm-musleabihf": "4.60.4", "@rollup/rollup-linux-arm64-gnu": "4.60.4", "@rollup/rollup-linux-arm64-musl": "4.60.4", "@rollup/rollup-linux-loong64-gnu": "4.60.4", "@rollup/rollup-linux-loong64-musl": "4.60.4", "@rollup/rollup-linux-ppc64-gnu": "4.60.4", "@rollup/rollup-linux-ppc64-musl": "4.60.4", "@rollup/rollup-linux-riscv64-gnu": "4.60.4", "@rollup/rollup-linux-riscv64-musl": "4.60.4", "@rollup/rollup-linux-s390x-gnu": "4.60.4", "@rollup/rollup-linux-x64-gnu": "4.60.4", "@rollup/rollup-linux-x64-musl": "4.60.4", "@rollup/rollup-openbsd-x64": "4.60.4", "@rollup/rollup-openharmony-arm64": "4.60.4", "@rollup/rollup-win32-arm64-msvc": "4.60.4", "@rollup/rollup-win32-ia32-msvc": "4.60.4", "@rollup/rollup-win32-x64-gnu": "4.60.4", "@rollup/rollup-win32-x64-msvc": "4.60.4", "fsevents": "~2.3.2" }, "bin": "dist/bin/rollup" }, "sha512-WHeFSbZYsPu3+bLoNRUuAO+wavNlocOPf3wSHTP7hcFKVnJeWsYlCDbr3mTS14FCizf9ccIxXA8sGL8zKeQN3g=="],
|
||||||
|
|
||||||
|
"rope-sequence": ["rope-sequence@1.3.4", "", {}, "sha512-UT5EDe2cu2E/6O4igUr5PSFs23nvvukicWHx6GnOPlHAiiYbzNuCRQCuiUdHJQcqKalLKlrYJnjY0ySGsXNQXQ=="],
|
||||||
|
|
||||||
|
"sade": ["sade@1.8.1", "", { "dependencies": { "mri": "^1.1.0" } }, "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A=="],
|
||||||
|
|
||||||
|
"scheduler": ["scheduler@0.27.0", "", {}, "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q=="],
|
||||||
|
|
||||||
|
"set-cookie-parser": ["set-cookie-parser@3.1.0", "", {}, "sha512-kjnC1DXBHcxaOaOXBHBeRtltsDG2nUiUni+jP92M9gYdW12rsmx92UsfpH7o5tDRs7I1ZZPSQJQGv3UaRfCiuw=="],
|
||||||
|
|
||||||
|
"sirv": ["sirv@3.0.2", "", { "dependencies": { "@polka/url": "^1.0.0-next.24", "mrmime": "^2.0.0", "totalist": "^3.0.0" } }, "sha512-2wcC/oGxHis/BoHkkPwldgiPSYcpZK3JU28WoMVv55yHJgcZ8rlXvuG9iZggz+sU1d4bRgIGASwyWqjxu3FM0g=="],
|
||||||
|
|
||||||
|
"source-map-js": ["source-map-js@1.2.1", "", {}, "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA=="],
|
||||||
|
|
||||||
|
"stripe": ["stripe@22.3.2", "", { "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-O13QOvgEIQvDlTy6Ubb5kB980wpbhmoZNsgCXKILjCMZS67f+bW+6w99k3gnSi/N1lkryoj1WYdpGT5Wc5edjg=="],
|
||||||
|
|
||||||
|
"supports-preserve-symlinks-flag": ["supports-preserve-symlinks-flag@1.0.0", "", {}, "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w=="],
|
||||||
|
|
||||||
|
"svelte": ["svelte@5.55.7", "", { "dependencies": { "@jridgewell/remapping": "^2.3.4", "@jridgewell/sourcemap-codec": "^1.5.0", "@sveltejs/acorn-typescript": "^1.0.5", "@types/estree": "^1.0.5", "@types/trusted-types": "^2.0.7", "acorn": "^8.12.1", "aria-query": "5.3.1", "axobject-query": "^4.1.0", "clsx": "^2.1.1", "devalue": "^5.8.1", "esm-env": "^1.2.1", "esrap": "^2.2.4", "is-reference": "^3.0.3", "locate-character": "^3.0.0", "magic-string": "^0.30.11", "zimmerframe": "^1.1.2" } }, "sha512-ymI5ykLPwIHW839E053FQbI1G+jnRFJEw3Kv5Y4njixVWywQBx+NUFpkkKyk5LIb36Fg9DVXSYpqiGekLD0hyw=="],
|
||||||
|
|
||||||
|
"svelte-check": ["svelte-check@4.4.8", "", { "dependencies": { "@jridgewell/trace-mapping": "^0.3.25", "chokidar": "^4.0.1", "fdir": "^6.2.0", "picocolors": "^1.0.0", "sade": "^1.7.4" }, "peerDependencies": { "svelte": "^4.0.0 || ^5.0.0-next.0", "typescript": ">=5.0.0" }, "bin": "bin/svelte-check" }, "sha512-67adfgBox5eNSNIvIIwgFizKGdcRrGpiMoNO2obHcYuLz7iTa8Xgm/NGU3ntMFnNm8K1grFOIG6HhMLX/vcN8w=="],
|
||||||
|
|
||||||
|
"svelte-tiptap": ["svelte-tiptap@3.0.1", "", { "peerDependencies": { "@floating-ui/dom": "^1.0.0", "@tiptap/core": "^3.0.0", "@tiptap/extension-bubble-menu": "^3.0.0", "@tiptap/extension-floating-menu": "^3.0.0", "@tiptap/pm": "^3.0.0", "svelte": "^5.0.0" } }, "sha512-Vi3kVGOd01f7mslOxGbJB7z2QavdvH+6WffhB+Y5fleTiZaW0YWqIboyO2u/uh4BQeosiINmmuRJ+Qwb7mYP+A=="],
|
||||||
|
|
||||||
|
"tailwindcss": ["tailwindcss@4.3.0", "", {}, "sha512-y6nxMGB1nMW9R6k96e5gdIFzcfL/gTJRNaqGes1YvkLnPVXzWgbqFF2yLC0T8G774n24cx3Pe8XrKoniCOAH+Q=="],
|
||||||
|
|
||||||
|
"tapable": ["tapable@2.3.3", "", {}, "sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A=="],
|
||||||
|
|
||||||
|
"tinyglobby": ["tinyglobby@0.2.16", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.4" } }, "sha512-pn99VhoACYR8nFHhxqix+uvsbXineAasWm5ojXoN8xEwK5Kd3/TrhNn1wByuD52UxWRLy8pu+kRMniEi6Eq9Zg=="],
|
||||||
|
|
||||||
|
"totalist": ["totalist@3.0.1", "", {}, "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ=="],
|
||||||
|
|
||||||
|
"tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
||||||
|
|
||||||
|
"typescript": ["typescript@6.0.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw=="],
|
||||||
|
|
||||||
|
"undici-types": ["undici-types@7.24.6", "", {}, "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg=="],
|
||||||
|
|
||||||
|
"uuid": ["uuid@14.0.0", "", { "bin": "dist-node/bin/uuid" }, "sha512-Qo+uWgilfSmAhXCMav1uYFynlQO7fMFiMVZsQqZRMIXp0O7rR7qjkj+cPvBHLgBqi960QCoo/PH2/6ZtVqKvrg=="],
|
||||||
|
|
||||||
|
"vite": ["vite@8.0.13", "", { "dependencies": { "lightningcss": "^1.32.0", "picomatch": "^4.0.4", "postcss": "^8.5.14", "rolldown": "1.0.1", "tinyglobby": "^0.2.16" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.1.18", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@vitejs/devtools", "esbuild", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": "bin/vite.js" }, "sha512-MFtjBYgzmSxmgA4RAfjIyXWpGe1oALnjgUTzzV7QLx/TKxCzjtMH6Fd9/eVK+5Fg1qNoz5VAwsmMs/NofrmJvw=="],
|
||||||
|
|
||||||
|
"vitefu": ["vitefu@1.1.3", "", { "peerDependencies": { "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" } }, "sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg=="],
|
||||||
|
|
||||||
|
"w3c-keyname": ["w3c-keyname@2.2.8", "", {}, "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ=="],
|
||||||
|
|
||||||
|
"zimmerframe": ["zimmerframe@1.1.4", "", {}, "sha512-B58NGBEoc8Y9MWWCQGl/gq9xBCe4IiKM0a2x7GZdQKOW5Exr8S1W24J6OgM1njK8xCRGvAJIL/MxXHf6SkmQKQ=="],
|
||||||
|
|
||||||
|
"@rollup/plugin-commonjs/is-reference": ["is-reference@1.2.1", "", { "dependencies": { "@types/estree": "*" } }, "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ=="],
|
||||||
|
|
||||||
|
"rollup/@types/estree": ["@types/estree@1.0.8", "", {}, "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w=="],
|
||||||
|
}
|
||||||
|
}
|
||||||
28
app/package-lock.json
generated
28
app/package-lock.json
generated
|
|
@ -11,6 +11,7 @@
|
||||||
"@dnd-kit/core": "^6.3.1",
|
"@dnd-kit/core": "^6.3.1",
|
||||||
"@dnd-kit/sortable": "^10.0.0",
|
"@dnd-kit/sortable": "^10.0.0",
|
||||||
"@dnd-kit/utilities": "^3.2.2",
|
"@dnd-kit/utilities": "^3.2.2",
|
||||||
|
"@stripe/stripe-js": "^9.12.1",
|
||||||
"@sveltejs/adapter-node": "^5.5.4",
|
"@sveltejs/adapter-node": "^5.5.4",
|
||||||
"@tailwindcss/vite": "^4.3.0",
|
"@tailwindcss/vite": "^4.3.0",
|
||||||
"@tiptap/core": "^3.23.4",
|
"@tiptap/core": "^3.23.4",
|
||||||
|
|
@ -19,6 +20,7 @@
|
||||||
"@tiptap/starter-kit": "^3.23.4",
|
"@tiptap/starter-kit": "^3.23.4",
|
||||||
"daisyui": "^5.5.19",
|
"daisyui": "^5.5.19",
|
||||||
"pocketbase": "^0.26.9",
|
"pocketbase": "^0.26.9",
|
||||||
|
"stripe": "^22.3.2",
|
||||||
"svelte-tiptap": "^3.0.1",
|
"svelte-tiptap": "^3.0.1",
|
||||||
"tailwindcss": "^4.3.0",
|
"tailwindcss": "^4.3.0",
|
||||||
"uuid": "^14.0.0"
|
"uuid": "^14.0.0"
|
||||||
|
|
@ -896,6 +898,15 @@
|
||||||
"integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==",
|
"integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/@stripe/stripe-js": {
|
||||||
|
"version": "9.12.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@stripe/stripe-js/-/stripe-js-9.12.1.tgz",
|
||||||
|
"integrity": "sha512-KLXPvjA0BfS4dQnW+ddHjwtIXMnIfKYxqmeNMmQCfKjvYog0cSG+Z7ZvK4RH1+bV90GC07nUztWDRWmJLi5HZQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.16"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@sveltejs/acorn-typescript": {
|
"node_modules/@sveltejs/acorn-typescript": {
|
||||||
"version": "1.0.9",
|
"version": "1.0.9",
|
||||||
"resolved": "https://registry.npmjs.org/@sveltejs/acorn-typescript/-/acorn-typescript-1.0.9.tgz",
|
"resolved": "https://registry.npmjs.org/@sveltejs/acorn-typescript/-/acorn-typescript-1.0.9.tgz",
|
||||||
|
|
@ -2678,6 +2689,23 @@
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/stripe": {
|
||||||
|
"version": "22.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/stripe/-/stripe-22.3.2.tgz",
|
||||||
|
"integrity": "sha512-O13QOvgEIQvDlTy6Ubb5kB980wpbhmoZNsgCXKILjCMZS67f+bW+6w99k3gnSi/N1lkryoj1WYdpGT5Wc5edjg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@types/node": ">=18"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@types/node": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/supports-preserve-symlinks-flag": {
|
"node_modules/supports-preserve-symlinks-flag": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
"@dnd-kit/core": "^6.3.1",
|
"@dnd-kit/core": "^6.3.1",
|
||||||
"@dnd-kit/sortable": "^10.0.0",
|
"@dnd-kit/sortable": "^10.0.0",
|
||||||
"@dnd-kit/utilities": "^3.2.2",
|
"@dnd-kit/utilities": "^3.2.2",
|
||||||
|
"@stripe/stripe-js": "^9.12.1",
|
||||||
"@sveltejs/adapter-node": "^5.5.4",
|
"@sveltejs/adapter-node": "^5.5.4",
|
||||||
"@tailwindcss/vite": "^4.3.0",
|
"@tailwindcss/vite": "^4.3.0",
|
||||||
"@tiptap/core": "^3.23.4",
|
"@tiptap/core": "^3.23.4",
|
||||||
|
|
@ -34,6 +35,7 @@
|
||||||
"@tiptap/starter-kit": "^3.23.4",
|
"@tiptap/starter-kit": "^3.23.4",
|
||||||
"daisyui": "^5.5.19",
|
"daisyui": "^5.5.19",
|
||||||
"pocketbase": "^0.26.9",
|
"pocketbase": "^0.26.9",
|
||||||
|
"stripe": "^22.3.2",
|
||||||
"svelte-tiptap": "^3.0.1",
|
"svelte-tiptap": "^3.0.1",
|
||||||
"tailwindcss": "^4.3.0",
|
"tailwindcss": "^4.3.0",
|
||||||
"uuid": "^14.0.0"
|
"uuid": "^14.0.0"
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,9 @@ export const blockLabels: Record<BlockType, string> = {
|
||||||
button: 'Button',
|
button: 'Button',
|
||||||
spacer: 'Spacer',
|
spacer: 'Spacer',
|
||||||
testimonials: 'Testimonials',
|
testimonials: 'Testimonials',
|
||||||
upcoming_calendar: 'Upcoming Calendar'
|
upcoming_calendar: 'Upcoming Calendar',
|
||||||
|
shop: 'Shop',
|
||||||
|
checkout: 'Checkout'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const blockTypes = Object.keys(blockLabels) as BlockType[];
|
export const blockTypes = Object.keys(blockLabels) as BlockType[];
|
||||||
|
|
@ -63,6 +65,21 @@ export function createBlock(type: BlockType): ContentBlock {
|
||||||
categories: []
|
categories: []
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
|
case 'shop':
|
||||||
|
base.data = {
|
||||||
|
title: 'Our Services',
|
||||||
|
itemTypeFilter: 'all',
|
||||||
|
itemIds: [],
|
||||||
|
layout: 'grid'
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case 'checkout':
|
||||||
|
base.data = {
|
||||||
|
title: 'Checkout',
|
||||||
|
heading: 'Complete your booking',
|
||||||
|
notesLabel: 'Notes or special requests'
|
||||||
|
};
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
base.data._background = { type: 'none', color: '', attachment: 'scroll', overlay: false, overlayOpacity: 40 };
|
base.data._background = { type: 'none', color: '', attachment: 'scroll', overlay: false, overlayOpacity: 40 };
|
||||||
return base;
|
return base;
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,13 @@
|
||||||
import RichTextEditor from './RichTextEditor.svelte';
|
import RichTextEditor from './RichTextEditor.svelte';
|
||||||
import ImageUploader from './ImageUploader.svelte';
|
import ImageUploader from './ImageUploader.svelte';
|
||||||
import SegmentedControl from './SegmentedControl.svelte';
|
import SegmentedControl from './SegmentedControl.svelte';
|
||||||
|
import ShopBlockEditor from './ShopBlockEditor.svelte';
|
||||||
|
import CheckoutBlockEditor from './CheckoutBlockEditor.svelte';
|
||||||
|
|
||||||
let { block, eventCategories = [], onChange = (block: ContentBlock) => {} } = $props<{
|
let { block, eventCategories = [], items = [], onChange = (block: ContentBlock) => {} } = $props<{
|
||||||
block: ContentBlock | null;
|
block: ContentBlock | null;
|
||||||
eventCategories?: string[];
|
eventCategories?: string[];
|
||||||
|
items?: { id: string; name: string; type: string }[];
|
||||||
onChange?: (block: ContentBlock) => void;
|
onChange?: (block: ContentBlock) => void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
|
@ -200,6 +203,10 @@
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{:else if block.type === 'shop'}
|
||||||
|
<ShopBlockEditor {block} {items} {onChange} />
|
||||||
|
{:else if block.type === 'checkout'}
|
||||||
|
<CheckoutBlockEditor {block} {onChange} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class="rounded-box border border-base-300 p-4 mt-4">
|
<div class="rounded-box border border-base-300 p-4 mt-4">
|
||||||
|
|
|
||||||
31
app/src/lib/admin/editors/CheckoutBlockEditor.svelte
Normal file
31
app/src/lib/admin/editors/CheckoutBlockEditor.svelte
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import type { ContentBlock, CheckoutBlockData } from '$lib/types';
|
||||||
|
|
||||||
|
let {
|
||||||
|
block,
|
||||||
|
onChange = (b: ContentBlock) => {}
|
||||||
|
} = $props<{
|
||||||
|
block: ContentBlock;
|
||||||
|
onChange?: (b: ContentBlock) => void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
function updateData(patch: Partial<CheckoutBlockData>) {
|
||||||
|
onChange({ ...block, data: { ...block.data, ...patch } });
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="space-y-4">
|
||||||
|
<label class="form-control w-full">
|
||||||
|
<div class="label"><span class="label-text">Title</span></div>
|
||||||
|
<input class="input input-bordered w-full" value={block.data.title || ''} oninput={(e) => updateData({ title: e.currentTarget.value })} />
|
||||||
|
</label>
|
||||||
|
<label class="form-control w-full">
|
||||||
|
<div class="label"><span class="label-text">Heading</span></div>
|
||||||
|
<input class="input input-bordered w-full" value={block.data.heading || ''} oninput={(e) => updateData({ heading: e.currentTarget.value })} />
|
||||||
|
</label>
|
||||||
|
<label class="form-control w-full">
|
||||||
|
<div class="label"><span class="label-text">Notes label</span></div>
|
||||||
|
<input class="input input-bordered w-full" placeholder="Notes or special requests" value={block.data.notesLabel || ''} oninput={(e) => updateData({ notesLabel: e.currentTarget.value })} />
|
||||||
|
</label>
|
||||||
|
<p class="text-sm text-base-content/60">Customer fields (name, email, phone, notes) and the payment flow are fixed and cannot be changed here.</p>
|
||||||
|
</div>
|
||||||
79
app/src/lib/admin/editors/ShopBlockEditor.svelte
Normal file
79
app/src/lib/admin/editors/ShopBlockEditor.svelte
Normal file
|
|
@ -0,0 +1,79 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import type { ContentBlock, ShopBlockData } from '$lib/types';
|
||||||
|
import SegmentedControl from './SegmentedControl.svelte';
|
||||||
|
|
||||||
|
let {
|
||||||
|
block,
|
||||||
|
items = [],
|
||||||
|
onChange = (b: ContentBlock) => {}
|
||||||
|
} = $props<{
|
||||||
|
block: ContentBlock;
|
||||||
|
items?: { id: string; name: string; type: string }[];
|
||||||
|
onChange?: (b: ContentBlock) => void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
function updateData(patch: Partial<ShopBlockData>) {
|
||||||
|
onChange({ ...block, data: { ...block.data, ...patch } });
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleItem(id: string) {
|
||||||
|
const current: string[] = block.data.itemIds || [];
|
||||||
|
updateData({
|
||||||
|
itemIds: current.includes(id)
|
||||||
|
? current.filter((itemId) => itemId !== id)
|
||||||
|
: [...current, id]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const typeFilterLabels: Record<string, string> = {
|
||||||
|
all: 'All',
|
||||||
|
item: 'Products',
|
||||||
|
item_with_time: 'Services'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="space-y-4">
|
||||||
|
<label class="form-control w-full">
|
||||||
|
<div class="label"><span class="label-text">Title</span></div>
|
||||||
|
<input class="input input-bordered w-full" value={block.data.title || ''} oninput={(e) => updateData({ title: e.currentTarget.value })} />
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<SegmentedControl
|
||||||
|
label="Layout"
|
||||||
|
options={['grid', 'list']}
|
||||||
|
value={block.data.layout || 'grid'}
|
||||||
|
onChange={(v) => updateData({ layout: v as 'grid' | 'list' })}
|
||||||
|
formatLabel={(v) => String(v).charAt(0).toUpperCase() + String(v).slice(1)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<SegmentedControl
|
||||||
|
label="Item type"
|
||||||
|
options={['all', 'item', 'item_with_time']}
|
||||||
|
value={block.data.itemTypeFilter || 'all'}
|
||||||
|
onChange={(v) => updateData({ itemTypeFilter: v as ShopBlockData['itemTypeFilter'] })}
|
||||||
|
formatLabel={(v) => typeFilterLabels[String(v)] || String(v)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{#if items.length}
|
||||||
|
<div class="rounded-box border border-base-300 p-4">
|
||||||
|
<div class="mb-3">
|
||||||
|
<h3 class="font-semibold">Items</h3>
|
||||||
|
<p class="text-sm text-base-content/60">Leave empty to show all items of the selected type.</p>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-wrap gap-2">
|
||||||
|
{#each items as item}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn btn-xs"
|
||||||
|
class:btn-primary={(block.data.itemIds || []).includes(item.id)}
|
||||||
|
onclick={() => toggleItem(item.id)}
|
||||||
|
>
|
||||||
|
{item.name}
|
||||||
|
</button>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<p class="text-sm text-base-content/60">No items yet — create some under Items in the admin.</p>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
94
app/src/lib/basket.svelte.ts
Normal file
94
app/src/lib/basket.svelte.ts
Normal file
|
|
@ -0,0 +1,94 @@
|
||||||
|
import { getContext, setContext } from 'svelte';
|
||||||
|
import type { Basket, BasketLine } from '$lib/types';
|
||||||
|
|
||||||
|
const BASKET_KEY = 'basket';
|
||||||
|
|
||||||
|
export type BasketStore = ReturnType<typeof createBasketStore>;
|
||||||
|
|
||||||
|
export function createBasketStore(initial: Basket | null) {
|
||||||
|
let lines = $state<BasketLine[]>(initial?.lines ?? []);
|
||||||
|
let status = $state<Basket['status']>(initial?.status ?? 'active');
|
||||||
|
|
||||||
|
const total = $derived(
|
||||||
|
lines.reduce((sum, line) => sum + (line.itemPrice ?? 0) * line.quantity, 0)
|
||||||
|
);
|
||||||
|
const count = $derived(lines.reduce((sum, line) => sum + line.quantity, 0));
|
||||||
|
|
||||||
|
async function callApi(body: Record<string, unknown>): Promise<Basket | null> {
|
||||||
|
const res = await fetch('/api/basket', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify(body)
|
||||||
|
});
|
||||||
|
if (!res.ok) {
|
||||||
|
const err = await res.json().catch(() => ({}));
|
||||||
|
throw new Error(err?.message || `Basket request failed (${res.status})`);
|
||||||
|
}
|
||||||
|
const data = await res.json();
|
||||||
|
return data.basket as Basket | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyBasket(basket: Basket | null) {
|
||||||
|
lines = basket?.lines ?? [];
|
||||||
|
status = basket?.status ?? 'active';
|
||||||
|
}
|
||||||
|
|
||||||
|
async function refresh() {
|
||||||
|
const res = await fetch('/api/basket');
|
||||||
|
if (!res.ok) return;
|
||||||
|
const data = await res.json();
|
||||||
|
applyBasket(data.basket);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Overwrite local state from server-provided layout data. */
|
||||||
|
function syncFrom(basket: Basket | null) {
|
||||||
|
applyBasket(basket);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function addItemLine(itemId: string, quantity = 1) {
|
||||||
|
applyBasket(await callApi({ action: 'add_item', itemId, quantity }));
|
||||||
|
}
|
||||||
|
|
||||||
|
async function addSlotLine(slotId: string) {
|
||||||
|
applyBasket(await callApi({ action: 'add_slot', slotId }));
|
||||||
|
}
|
||||||
|
|
||||||
|
async function updateQuantity(lineId: string, quantity: number) {
|
||||||
|
applyBasket(await callApi({ action: 'update_quantity', lineId, quantity }));
|
||||||
|
}
|
||||||
|
|
||||||
|
async function removeLine(lineId: string) {
|
||||||
|
applyBasket(await callApi({ action: 'remove_line', lineId }));
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
get lines() {
|
||||||
|
return lines;
|
||||||
|
},
|
||||||
|
get total() {
|
||||||
|
return total;
|
||||||
|
},
|
||||||
|
get count() {
|
||||||
|
return count;
|
||||||
|
},
|
||||||
|
get status() {
|
||||||
|
return status;
|
||||||
|
},
|
||||||
|
refresh,
|
||||||
|
syncFrom,
|
||||||
|
addItemLine,
|
||||||
|
addSlotLine,
|
||||||
|
updateQuantity,
|
||||||
|
removeLine
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setBasketContext(store: BasketStore) {
|
||||||
|
setContext(BASKET_KEY, store);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getBasketContext(): BasketStore {
|
||||||
|
const store = getContext<BasketStore>(BASKET_KEY);
|
||||||
|
if (!store) throw new Error('Basket store not found in context — is this component inside the public layout?');
|
||||||
|
return store;
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { CalendarEventRecord, ContentBlock, BlockBackground, BlockForeground } from '$lib/types';
|
import type { CalendarEventRecord, ContentBlock, BlockBackground, BlockForeground, ItemRecord, SlotRecord } from '$lib/types';
|
||||||
import BackgroundWrapper from './BackgroundWrapper.svelte';
|
import BackgroundWrapper from './BackgroundWrapper.svelte';
|
||||||
import TextBlock from './TextBlock.svelte';
|
import TextBlock from './TextBlock.svelte';
|
||||||
import ImageTextBlock from './ImageTextBlock.svelte';
|
import ImageTextBlock from './ImageTextBlock.svelte';
|
||||||
|
|
@ -9,8 +9,15 @@
|
||||||
import SpacerBlock from './SpacerBlock.svelte';
|
import SpacerBlock from './SpacerBlock.svelte';
|
||||||
import TestimonialsBlock from './TestimonialsBlock.svelte';
|
import TestimonialsBlock from './TestimonialsBlock.svelte';
|
||||||
import UpcomingCalendarBlock from './UpcomingCalendarBlock.svelte';
|
import UpcomingCalendarBlock from './UpcomingCalendarBlock.svelte';
|
||||||
|
import ShopBlock from './ShopBlock.svelte';
|
||||||
|
import CheckoutBlock from './CheckoutBlock.svelte';
|
||||||
|
|
||||||
let { blocks = [], calendarEvents = [] } = $props<{ blocks: ContentBlock[]; calendarEvents?: CalendarEventRecord[] }>();
|
let { blocks = [], calendarEvents = [], items = [], slots = [] } = $props<{
|
||||||
|
blocks: ContentBlock[];
|
||||||
|
calendarEvents?: CalendarEventRecord[];
|
||||||
|
items?: ItemRecord[];
|
||||||
|
slots?: SlotRecord[];
|
||||||
|
}>();
|
||||||
|
|
||||||
function getBg(block: ContentBlock): BlockBackground {
|
function getBg(block: ContentBlock): BlockBackground {
|
||||||
return (block.data._background as BlockBackground) || { type: 'none', color: '', imageUrl: '', attachment: 'scroll', overlay: false, overlayOpacity: 40 };
|
return (block.data._background as BlockBackground) || { type: 'none', color: '', imageUrl: '', attachment: 'scroll', overlay: false, overlayOpacity: 40 };
|
||||||
|
|
@ -39,6 +46,10 @@
|
||||||
<TestimonialsBlock data={block.data} />
|
<TestimonialsBlock data={block.data} />
|
||||||
{:else if block.type === 'upcoming_calendar'}
|
{:else if block.type === 'upcoming_calendar'}
|
||||||
<UpcomingCalendarBlock data={block.data} events={calendarEvents} />
|
<UpcomingCalendarBlock data={block.data} events={calendarEvents} />
|
||||||
|
{:else if block.type === 'shop'}
|
||||||
|
<ShopBlock data={block.data} {items} {slots} />
|
||||||
|
{:else if block.type === 'checkout'}
|
||||||
|
<CheckoutBlock data={block.data} />
|
||||||
{/if}
|
{/if}
|
||||||
</BackgroundWrapper>
|
</BackgroundWrapper>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
|
||||||
402
app/src/lib/blocks/CheckoutBlock.svelte
Normal file
402
app/src/lib/blocks/CheckoutBlock.svelte
Normal file
|
|
@ -0,0 +1,402 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { browser } from '$app/environment';
|
||||||
|
import { goto } from '$app/navigation';
|
||||||
|
import type { CheckoutBlockData } from '$lib/types';
|
||||||
|
import { getBasketContext } from '$lib/basket.svelte';
|
||||||
|
import { loadStripe } from '$lib/stripe-client';
|
||||||
|
import type { Stripe, StripeElements, StripePaymentElement } from '@stripe/stripe-js';
|
||||||
|
|
||||||
|
let { data = {} } = $props<{ data: CheckoutBlockData }>();
|
||||||
|
|
||||||
|
const basket = getBasketContext();
|
||||||
|
|
||||||
|
const customer = $state({ name: '', email: '', phone: '', notes: '' });
|
||||||
|
let payState = $state<'idle' | 'creating' | 'ready' | 'confirming' | 'error'>('idle');
|
||||||
|
let errorMsg = $state('');
|
||||||
|
|
||||||
|
let paymentDiv = $state<HTMLDivElement | null>(null);
|
||||||
|
let stripe: Stripe | null = null;
|
||||||
|
let elements: StripeElements | null = null;
|
||||||
|
let paymentElement: StripePaymentElement | null = null;
|
||||||
|
let mountedForClientSecret: string | null = null;
|
||||||
|
|
||||||
|
// Tracks lines that have an update/remove request in flight, to disable their controls.
|
||||||
|
let pendingLines = $state<Set<string>>(new Set());
|
||||||
|
|
||||||
|
// Reset the mounted Payment Element back to 'idle' when the basket changes
|
||||||
|
// after the intent was created, so a new intent is made with the new total.
|
||||||
|
let lastSig = '';
|
||||||
|
let basketChanged = $state(false);
|
||||||
|
$effect(() => {
|
||||||
|
const sig = basket.lines.map((l) => `${l.id}:${l.quantity}`).join('|') + `@${basket.total}`;
|
||||||
|
if (lastSig && sig !== lastSig && (payState === 'ready' || payState === 'creating')) {
|
||||||
|
resetPayment();
|
||||||
|
basketChanged = true;
|
||||||
|
} else if (sig === lastSig) {
|
||||||
|
basketChanged = false;
|
||||||
|
}
|
||||||
|
lastSig = sig;
|
||||||
|
});
|
||||||
|
|
||||||
|
const currency = new Intl.NumberFormat(undefined, { style: 'currency', currency: 'EUR' });
|
||||||
|
const payLabel = $derived(
|
||||||
|
payState === 'confirming'
|
||||||
|
? 'Confirming…'
|
||||||
|
: payState === 'creating'
|
||||||
|
? 'Preparing payment…'
|
||||||
|
: `Pay ${currency.format(basket.total)}`
|
||||||
|
);
|
||||||
|
|
||||||
|
function formatSlotTime(iso: string) {
|
||||||
|
return new Date(iso).toLocaleString(undefined, {
|
||||||
|
weekday: 'short',
|
||||||
|
month: 'short',
|
||||||
|
day: 'numeric',
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetPayment() {
|
||||||
|
paymentElement?.unmount();
|
||||||
|
paymentElement = null;
|
||||||
|
elements = null;
|
||||||
|
mountedForClientSecret = null;
|
||||||
|
payState = 'idle';
|
||||||
|
}
|
||||||
|
|
||||||
|
function validateCustomer(): boolean {
|
||||||
|
if (!customer.name.trim() || !customer.email.trim()) {
|
||||||
|
errorMsg = 'Please fill in your name and email address.';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function startPayment() {
|
||||||
|
errorMsg = '';
|
||||||
|
basketChanged = false;
|
||||||
|
if (!validateCustomer()) return;
|
||||||
|
|
||||||
|
payState = 'creating';
|
||||||
|
try {
|
||||||
|
// Refresh from server first — slot holds may have lapsed (10-min TTL)
|
||||||
|
// and the client store would still show stale lines. The server
|
||||||
|
// re-reserves any slot that is still held, so a service won't vanish
|
||||||
|
// just because its hold expired while you were filling in this form.
|
||||||
|
const slotLinesBefore = basket.lines.filter((l) => l.lineType === 'slot');
|
||||||
|
await basket.refresh();
|
||||||
|
|
||||||
|
const lostSlots = slotLinesBefore.filter(
|
||||||
|
(l) => !basket.lines.some((nl) => nl.id === l.id)
|
||||||
|
);
|
||||||
|
if (basket.lines.length === 0) {
|
||||||
|
throw new Error('Your basket is empty — a time slot you selected may have expired. Please pick a slot from the shop and try again.');
|
||||||
|
}
|
||||||
|
if (lostSlots.length) {
|
||||||
|
const names = lostSlots.map((l) => l.itemName).filter(Boolean).join(', ');
|
||||||
|
throw new Error(
|
||||||
|
names
|
||||||
|
? `Your time slot for ${names} is no longer available (it may have expired or been booked by someone else). Please pick another slot from the shop.`
|
||||||
|
: 'A time slot in your basket is no longer available — please pick another slot from the shop.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await fetch('/api/checkout/create-intent', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ ...customer })
|
||||||
|
});
|
||||||
|
if (!res.ok) {
|
||||||
|
const err = await res.json().catch(() => ({}));
|
||||||
|
throw new Error(
|
||||||
|
err?.message ||
|
||||||
|
`Could not start payment (${res.status}). If you booked a time slot, its hold may have expired — please pick it again from the shop section.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const { clientSecret } = await res.json();
|
||||||
|
|
||||||
|
stripe = await loadStripe();
|
||||||
|
if (!stripe) throw new Error('Payment system failed to load. Please refresh and try again.');
|
||||||
|
|
||||||
|
if (mountedForClientSecret !== clientSecret) {
|
||||||
|
resetPayment();
|
||||||
|
elements = stripe.elements({
|
||||||
|
clientSecret,
|
||||||
|
appearance: {
|
||||||
|
theme: 'flat',
|
||||||
|
variables: {
|
||||||
|
colorPrimary: '#8a9a7b',
|
||||||
|
colorBackground: '#ffffff',
|
||||||
|
colorText: '#2c2c2c',
|
||||||
|
colorDanger: '#c9825f',
|
||||||
|
fontFamily: 'DM Sans, sans-serif',
|
||||||
|
borderRadius: '12px'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
paymentElement = elements.create('payment');
|
||||||
|
if (browser && paymentDiv) {
|
||||||
|
paymentElement.mount(paymentDiv);
|
||||||
|
mountedForClientSecret = clientSecret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
payState = 'ready';
|
||||||
|
} catch (e) {
|
||||||
|
errorMsg = e instanceof Error ? e.message : 'Something went wrong. Please try again.';
|
||||||
|
payState = 'idle';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function confirmPayment() {
|
||||||
|
if (!stripe || !elements || !mountedForClientSecret) return;
|
||||||
|
errorMsg = '';
|
||||||
|
payState = 'confirming';
|
||||||
|
|
||||||
|
const { error } = await stripe.confirmPayment({
|
||||||
|
elements,
|
||||||
|
confirmParams: {
|
||||||
|
return_url: window.location.origin + '/checkout/return',
|
||||||
|
receipt_email: customer.email
|
||||||
|
},
|
||||||
|
redirect: 'if_required'
|
||||||
|
});
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
errorMsg = error.message ?? 'Payment failed. Please try again.';
|
||||||
|
payState = 'ready';
|
||||||
|
} else {
|
||||||
|
const intentId = mountedForClientSecret.split('_secret_')[0];
|
||||||
|
goto('/checkout/return?payment_intent=' + encodeURIComponent(intentId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function changeQuantity(lineId: string, current: number, delta: number) {
|
||||||
|
const qty = current + delta;
|
||||||
|
if (qty < 1 || pendingLines.has(lineId)) return;
|
||||||
|
pendingLines = new Set(pendingLines).add(lineId);
|
||||||
|
try {
|
||||||
|
await basket.updateQuantity(lineId, qty);
|
||||||
|
} catch (e) {
|
||||||
|
errorMsg = e instanceof Error ? e.message : 'Failed to update quantity.';
|
||||||
|
} finally {
|
||||||
|
const next = new Set(pendingLines);
|
||||||
|
next.delete(lineId);
|
||||||
|
pendingLines = next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function removeLine(lineId: string) {
|
||||||
|
if (pendingLines.has(lineId)) return;
|
||||||
|
pendingLines = new Set(pendingLines).add(lineId);
|
||||||
|
try {
|
||||||
|
await basket.removeLine(lineId);
|
||||||
|
} catch (e) {
|
||||||
|
errorMsg = e instanceof Error ? e.message : 'Failed to remove item.';
|
||||||
|
} finally {
|
||||||
|
const next = new Set(pendingLines);
|
||||||
|
next.delete(lineId);
|
||||||
|
pendingLines = next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<section class="mx-auto max-w-3xl px-6 py-16">
|
||||||
|
{#if data.title}
|
||||||
|
<h2 class="font-serif text-3xl font-bold md:text-4xl">{data.title}</h2>
|
||||||
|
{/if}
|
||||||
|
{#if data.heading}
|
||||||
|
<p class="mt-2 text-fg-body/70">{data.heading}</p>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if basket.lines.length === 0}
|
||||||
|
<div class="mt-12 rounded-2xl border border-charcoal/10 bg-white/60 px-6 py-16 text-center">
|
||||||
|
<p class="font-serif text-xl">Your basket is empty</p>
|
||||||
|
<p class="mt-2 text-sm text-fg-body/70">Pick a service or product above.</p>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<!-- Basket lines -->
|
||||||
|
<ul class="mt-8 space-y-4">
|
||||||
|
{#each basket.lines as line (line.id)}
|
||||||
|
{@const pending = pendingLines.has(line.id)}
|
||||||
|
<li class="flex items-center gap-4 rounded-2xl border border-charcoal/10 bg-white p-4 shadow-sm">
|
||||||
|
{#if line.itemImageUrl}
|
||||||
|
<img
|
||||||
|
src={line.itemImageUrl}
|
||||||
|
alt={line.itemName ?? 'Item'}
|
||||||
|
class="h-16 w-16 shrink-0 rounded-xl object-cover"
|
||||||
|
/>
|
||||||
|
{:else}
|
||||||
|
<div class="flex h-16 w-16 shrink-0 items-center justify-center rounded-xl bg-sage/15 font-serif text-xl text-sage-dark">
|
||||||
|
{(line.itemName ?? '?').charAt(0).toUpperCase()}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div class="min-w-0 flex-1">
|
||||||
|
<p class="truncate font-medium">{line.itemName ?? 'Item'}</p>
|
||||||
|
{#if line.lineType === 'slot' && line.slotStart}
|
||||||
|
<p class="text-sm text-fg-body/70">{formatSlotTime(line.slotStart)}</p>
|
||||||
|
{/if}
|
||||||
|
<p class="text-sm text-fg-body/70">{currency.format(line.itemPrice ?? 0)}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if line.lineType === 'item'}
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="flex h-8 w-8 items-center justify-center rounded-full border border-charcoal/15 text-lg leading-none disabled:opacity-40"
|
||||||
|
disabled={pending || line.quantity <= 1}
|
||||||
|
aria-label="Decrease quantity"
|
||||||
|
onclick={() => changeQuantity(line.id, line.quantity, -1)}
|
||||||
|
>
|
||||||
|
−
|
||||||
|
</button>
|
||||||
|
<span class="w-6 text-center">{line.quantity}</span>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="flex h-8 w-8 items-center justify-center rounded-full border border-charcoal/15 text-lg leading-none disabled:opacity-40"
|
||||||
|
disabled={pending}
|
||||||
|
aria-label="Increase quantity"
|
||||||
|
onclick={() => changeQuantity(line.id, line.quantity, 1)}
|
||||||
|
>
|
||||||
|
+
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<p class="w-20 shrink-0 text-right font-medium">
|
||||||
|
{currency.format((line.itemPrice ?? 0) * line.quantity)}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-charcoal/50 transition-colors hover:bg-terracotta/10 hover:text-terracotta disabled:opacity-40"
|
||||||
|
disabled={pending}
|
||||||
|
aria-label="Remove {line.itemName ?? 'item'}"
|
||||||
|
onclick={() => removeLine(line.id)}
|
||||||
|
>
|
||||||
|
✕
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<!-- Totals -->
|
||||||
|
<div class="mt-6 rounded-2xl border border-charcoal/10 bg-white p-5">
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<span class="text-fg-body/70">Subtotal</span>
|
||||||
|
<span class="font-serif text-xl font-bold">{currency.format(basket.total)}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-10 grid gap-10 md:grid-cols-2">
|
||||||
|
<!-- Customer details -->
|
||||||
|
<form
|
||||||
|
class="space-y-4"
|
||||||
|
novalidate
|
||||||
|
onsubmit={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
startPayment();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<h3 class="font-serif text-xl font-bold">Your details</h3>
|
||||||
|
<div>
|
||||||
|
<label class="mb-1 block text-sm font-medium" for="checkout-name">Name *</label>
|
||||||
|
<input
|
||||||
|
id="checkout-name"
|
||||||
|
type="text"
|
||||||
|
required
|
||||||
|
class="w-full rounded-xl border border-charcoal/15 bg-white px-4 py-3 focus:ring-2 focus:ring-sage/50 focus:outline-none"
|
||||||
|
bind:value={customer.name}
|
||||||
|
autocomplete="name"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="mb-1 block text-sm font-medium" for="checkout-email">Email *</label>
|
||||||
|
<input
|
||||||
|
id="checkout-email"
|
||||||
|
type="email"
|
||||||
|
required
|
||||||
|
class="w-full rounded-xl border border-charcoal/15 bg-white px-4 py-3 focus:ring-2 focus:ring-sage/50 focus:outline-none"
|
||||||
|
bind:value={customer.email}
|
||||||
|
autocomplete="email"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="mb-1 block text-sm font-medium" for="checkout-phone">Phone</label>
|
||||||
|
<input
|
||||||
|
id="checkout-phone"
|
||||||
|
type="tel"
|
||||||
|
class="w-full rounded-xl border border-charcoal/15 bg-white px-4 py-3 focus:ring-2 focus:ring-sage/50 focus:outline-none"
|
||||||
|
bind:value={customer.phone}
|
||||||
|
autocomplete="tel"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="mb-1 block text-sm font-medium" for="checkout-notes">
|
||||||
|
{data.notesLabel || 'Notes or special requests'}
|
||||||
|
</label>
|
||||||
|
<textarea
|
||||||
|
id="checkout-notes"
|
||||||
|
rows="3"
|
||||||
|
class="w-full rounded-xl border border-charcoal/15 bg-white px-4 py-3 focus:ring-2 focus:ring-sage/50 focus:outline-none"
|
||||||
|
bind:value={customer.notes}
|
||||||
|
></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if payState === 'idle' || payState === 'creating'}
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
class="btn w-full rounded-full border-0 text-white"
|
||||||
|
style="background-color: var(--color-primary, #8a9a7b);"
|
||||||
|
disabled={payState === 'creating'}
|
||||||
|
>
|
||||||
|
{payLabel}
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<!-- Payment -->
|
||||||
|
<div>
|
||||||
|
<h3 class="font-serif text-xl font-bold">Payment</h3>
|
||||||
|
|
||||||
|
{#if errorMsg}
|
||||||
|
<div class="mt-4 flex items-start justify-between gap-3 rounded-xl border border-terracotta/40 bg-terracotta/10 px-4 py-3 text-sm text-charcoal" role="alert">
|
||||||
|
<span>{errorMsg}</span>
|
||||||
|
<button type="button" class="shrink-0 font-bold" aria-label="Dismiss" onclick={() => (errorMsg = '')}>✕</button>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if basketChanged}
|
||||||
|
<p class="mt-4 rounded-xl border border-sage/30 bg-sage/10 px-4 py-3 text-sm">
|
||||||
|
Basket changed — please press Pay again.
|
||||||
|
</p>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div
|
||||||
|
bind:this={paymentDiv}
|
||||||
|
class="mt-4 rounded-xl border border-charcoal/15 bg-white p-4 {payState === 'ready' || payState === 'confirming' ? '' : 'hidden'}"
|
||||||
|
hidden={payState !== 'ready' && payState !== 'confirming'}
|
||||||
|
></div>
|
||||||
|
|
||||||
|
{#if payState === 'ready' || payState === 'confirming'}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn mt-4 w-full rounded-full border-0 text-white"
|
||||||
|
style="background-color: var(--color-primary, #8a9a7b);"
|
||||||
|
disabled={payState === 'confirming'}
|
||||||
|
onclick={confirmPayment}
|
||||||
|
>
|
||||||
|
{payState === 'confirming' ? 'Confirming…' : `Confirm payment — ${currency.format(basket.total)}`}
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if payState === 'idle' && !errorMsg}
|
||||||
|
<p class="mt-4 text-sm text-fg-body/70">
|
||||||
|
Fill in your details and press Pay to continue to secure payment.
|
||||||
|
</p>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</section>
|
||||||
313
app/src/lib/blocks/ShopBlock.svelte
Normal file
313
app/src/lib/blocks/ShopBlock.svelte
Normal file
|
|
@ -0,0 +1,313 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import type { ShopBlockData, ItemRecord, SlotRecord } from '$lib/types';
|
||||||
|
import { getBasketContext } from '$lib/basket.svelte';
|
||||||
|
import { getCurrentAndNextMonths } from '$lib/calendar';
|
||||||
|
|
||||||
|
let { data = {}, items = [], slots = [] } = $props<{
|
||||||
|
data: ShopBlockData;
|
||||||
|
items?: ItemRecord[];
|
||||||
|
slots?: SlotRecord[];
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const basket = getBasketContext();
|
||||||
|
|
||||||
|
// Per-card interaction state. Instances are created per component instance
|
||||||
|
// (never shared at module level); keyed by item id so each card is independent.
|
||||||
|
class CardState {
|
||||||
|
pickerOpen = $state(false);
|
||||||
|
selectedDayKey = $state<string | null>(null);
|
||||||
|
adding = $state(false);
|
||||||
|
errorMsg = $state<string | null>(null);
|
||||||
|
justAdded = $state(false);
|
||||||
|
pendingSlotId = $state<string | null>(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
let cardStates = $state<Record<string, CardState>>({});
|
||||||
|
|
||||||
|
const months = getCurrentAndNextMonths();
|
||||||
|
const priceFormatter = new Intl.NumberFormat(undefined, { style: 'currency', currency: 'EUR' });
|
||||||
|
const timeFormat: Intl.DateTimeFormatOptions = { hour: '2-digit', minute: '2-digit' };
|
||||||
|
const weekdayLetters = ['S', 'M', 'T', 'W', 'T', 'F', 'S'];
|
||||||
|
|
||||||
|
let visibleItems: ItemRecord[] = $derived.by(() => {
|
||||||
|
let result: ItemRecord[] = items;
|
||||||
|
if (data.itemTypeFilter === 'item' || data.itemTypeFilter === 'item_with_time') {
|
||||||
|
result = result.filter((i) => i.type === data.itemTypeFilter);
|
||||||
|
}
|
||||||
|
if (data.itemIds?.length) {
|
||||||
|
const wanted = new Set(data.itemIds);
|
||||||
|
result = result
|
||||||
|
.filter((i) => wanted.has(i.id))
|
||||||
|
.sort((a, b) => data.itemIds!.indexOf(a.id) - data.itemIds!.indexOf(b.id));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
|
||||||
|
// item id -> day key ('YYYY-MM-DD') -> slots on that day, sorted by start time
|
||||||
|
let slotsByDay = $derived.by<Map<string, Map<string, SlotRecord[]>>>(() => {
|
||||||
|
const map = new Map<string, Map<string, SlotRecord[]>>();
|
||||||
|
for (const slot of slots) {
|
||||||
|
const day = new Date(slot.start);
|
||||||
|
if (Number.isNaN(day.getTime())) continue;
|
||||||
|
const key = `${day.getFullYear()}-${`${day.getMonth() + 1}`.padStart(2, '0')}-${`${day.getDate()}`.padStart(2, '0')}`;
|
||||||
|
let itemMap = map.get(slot.item);
|
||||||
|
if (!itemMap) {
|
||||||
|
itemMap = new Map();
|
||||||
|
map.set(slot.item, itemMap);
|
||||||
|
}
|
||||||
|
const list = itemMap.get(key);
|
||||||
|
if (list) list.push(slot);
|
||||||
|
else itemMap.set(key, [slot]);
|
||||||
|
}
|
||||||
|
for (const itemMap of map.values()) {
|
||||||
|
for (const list of itemMap.values()) {
|
||||||
|
list.sort((a, b) => new Date(a.start).getTime() - new Date(b.start).getTime());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
});
|
||||||
|
|
||||||
|
let isList = $derived(data.layout === 'list');
|
||||||
|
|
||||||
|
// Lazily create card state for whatever items are rendered.
|
||||||
|
$effect(() => {
|
||||||
|
for (const item of visibleItems) {
|
||||||
|
if (!cardStates[item.id]) cardStates[item.id] = new CardState();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function togglePicker(itemId: string) {
|
||||||
|
const state = cardStates[itemId];
|
||||||
|
if (!state) return;
|
||||||
|
state.pickerOpen = !state.pickerOpen;
|
||||||
|
state.errorMsg = null;
|
||||||
|
state.justAdded = false;
|
||||||
|
state.selectedDayKey = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function errorMessage(e: unknown, fallback: string) {
|
||||||
|
return e instanceof Error && e.message ? e.message : fallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function addItem(itemId: string) {
|
||||||
|
const state = cardStates[itemId];
|
||||||
|
if (!state || state.adding) return;
|
||||||
|
state.adding = true;
|
||||||
|
state.errorMsg = null;
|
||||||
|
try {
|
||||||
|
await basket.addItemLine(itemId, 1);
|
||||||
|
} catch (e) {
|
||||||
|
state.errorMsg = errorMessage(e, 'Could not add this item to your basket.');
|
||||||
|
} finally {
|
||||||
|
state.adding = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function addSlot(itemId: string, slotId: string) {
|
||||||
|
const state = cardStates[itemId];
|
||||||
|
if (!state || state.adding) return;
|
||||||
|
state.adding = true;
|
||||||
|
state.pendingSlotId = slotId;
|
||||||
|
state.errorMsg = null;
|
||||||
|
try {
|
||||||
|
await basket.addSlotLine(slotId);
|
||||||
|
state.justAdded = true;
|
||||||
|
} catch (e) {
|
||||||
|
state.errorMsg = errorMessage(e, 'Could not book this time slot.');
|
||||||
|
} finally {
|
||||||
|
state.adding = false;
|
||||||
|
state.pendingSlotId = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatTime(iso: string) {
|
||||||
|
return new Date(iso).toLocaleTimeString(undefined, timeFormat);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<section class="mx-auto max-w-6xl px-6 py-16">
|
||||||
|
{#if data.title}
|
||||||
|
<h2 class="mb-12 text-center font-serif text-3xl text-charcoal md:text-4xl">{data.title}</h2>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div class={isList ? 'flex flex-col gap-8' : 'grid gap-8 sm:grid-cols-2 lg:grid-cols-3'}>
|
||||||
|
{#each visibleItems as item (item.id)}
|
||||||
|
{@const ui = cardStates[item.id]}
|
||||||
|
{@const itemSlotsByDay = slotsByDay.get(item.id)}
|
||||||
|
{@const isService = item.type === 'item_with_time'}
|
||||||
|
{@const soldOut = !isService && item.stock === 0}
|
||||||
|
{@const itemInBasket = !isService && basket.lines.some((l) => l.item === item.id)}
|
||||||
|
<article
|
||||||
|
class={isList
|
||||||
|
? 'rounded-2xl border border-charcoal/10 bg-white p-5 shadow-sm sm:flex sm:gap-6'
|
||||||
|
: 'flex flex-col overflow-hidden rounded-2xl border border-charcoal/10 bg-white shadow-sm'}
|
||||||
|
>
|
||||||
|
{#if item.imageUrl}
|
||||||
|
<img
|
||||||
|
src={item.imageUrl}
|
||||||
|
alt={item.name}
|
||||||
|
class={isList ? 'h-44 w-full rounded-xl object-cover sm:h-auto sm:w-56 sm:shrink-0' : 'h-52 w-full object-cover'}
|
||||||
|
/>
|
||||||
|
{:else}
|
||||||
|
<div
|
||||||
|
class={isList
|
||||||
|
? 'flex h-44 w-full items-center justify-center rounded-xl bg-sage/15 font-serif text-5xl text-sage-dark sm:h-auto sm:w-56 sm:shrink-0'
|
||||||
|
: 'flex h-52 w-full items-center justify-center bg-sage/15 font-serif text-5xl text-sage-dark'}
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
{item.name.trim().charAt(0).toUpperCase() || '·'}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div class={isList ? 'mt-4 flex min-w-0 flex-1 flex-col sm:mt-0' : 'flex flex-1 flex-col p-5'}>
|
||||||
|
<h3 class="font-serif text-xl text-charcoal">{item.name}</h3>
|
||||||
|
{#if item.description}
|
||||||
|
<p class="mt-1 line-clamp-3 text-sm text-charcoal/70">{item.description}</p>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div class="mt-auto flex flex-wrap items-center gap-x-3 gap-y-1 pt-3">
|
||||||
|
<span class="text-lg font-semibold text-sage-dark">{priceFormatter.format(item.price)}</span>
|
||||||
|
{#if isService && item.duration != null}
|
||||||
|
<span class="text-xs text-charcoal/60">{item.duration} min</span>
|
||||||
|
{:else if !isService && item.stock != null && item.stock > 0 && item.stock <= 5}
|
||||||
|
<span class="rounded-full bg-terracotta/15 px-2.5 py-0.5 text-xs font-medium text-terracotta">
|
||||||
|
Only {item.stock} left
|
||||||
|
</span>
|
||||||
|
{:else if soldOut}
|
||||||
|
<span class="rounded-full bg-terracotta/15 px-2.5 py-0.5 text-xs font-medium text-terracotta">
|
||||||
|
Sold out
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if ui?.errorMsg}
|
||||||
|
<div
|
||||||
|
class="mt-3 flex items-start justify-between gap-2 rounded-lg border border-terracotta/30 bg-terracotta/10 px-3 py-2 text-sm text-charcoal"
|
||||||
|
role="alert"
|
||||||
|
>
|
||||||
|
<span>{ui.errorMsg}</span>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="shrink-0 leading-none text-charcoal/60 hover:text-charcoal"
|
||||||
|
aria-label="Dismiss error"
|
||||||
|
onclick={() => (ui.errorMsg = null)}
|
||||||
|
>
|
||||||
|
×
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div class="mt-4 flex items-center gap-3">
|
||||||
|
{#if isService}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="inline-flex items-center justify-center gap-2 rounded-full px-6 py-2.5 text-sm font-medium transition {ui?.pickerOpen
|
||||||
|
? 'border border-charcoal/15 text-charcoal hover:bg-charcoal/5'
|
||||||
|
: itemSlotsByDay?.size
|
||||||
|
? 'bg-sage text-white hover:bg-sage-dark'
|
||||||
|
: 'cursor-not-allowed bg-charcoal/10 text-charcoal/50'}"
|
||||||
|
disabled={!itemSlotsByDay?.size && !ui?.pickerOpen}
|
||||||
|
onclick={() => togglePicker(item.id)}
|
||||||
|
>
|
||||||
|
{itemSlotsByDay?.size ? (ui?.pickerOpen ? 'Close' : 'Book') : 'No availability'}
|
||||||
|
</button>
|
||||||
|
{:else}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="inline-flex items-center justify-center gap-2 rounded-full bg-sage px-6 py-2.5 text-sm font-medium text-white transition hover:bg-sage-dark disabled:cursor-not-allowed disabled:bg-charcoal/10 disabled:text-charcoal/50"
|
||||||
|
disabled={soldOut || ui?.adding}
|
||||||
|
onclick={() => addItem(item.id)}
|
||||||
|
>
|
||||||
|
{#if ui?.adding}<span class="loading loading-spinner loading-xs"></span>{/if}
|
||||||
|
{soldOut ? 'Sold out' : itemInBasket ? 'Add another' : 'Add to basket'}
|
||||||
|
</button>
|
||||||
|
{#if itemInBasket}
|
||||||
|
<a
|
||||||
|
href="/book"
|
||||||
|
class="inline-flex items-center gap-1 text-sm font-medium text-sage-dark underline-offset-2 hover:underline"
|
||||||
|
>✓ In basket</a
|
||||||
|
>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if isService && ui?.pickerOpen && itemSlotsByDay}
|
||||||
|
<div class={isList ? 'mt-5 border-t border-charcoal/10 pt-5 sm:basis-full' : 'border-t border-charcoal/10 bg-warm p-4'}>
|
||||||
|
<p class="mb-3 text-sm font-medium text-charcoal/70">Select a date</p>
|
||||||
|
<div class="grid gap-6 sm:grid-cols-2">
|
||||||
|
{#each months as month (month.label)}
|
||||||
|
<div>
|
||||||
|
<p class="mb-2 text-center text-sm font-medium text-charcoal/70">{month.label}</p>
|
||||||
|
<div class="grid grid-cols-7 gap-1 text-center">
|
||||||
|
{#each weekdayLetters as letter, i (i)}
|
||||||
|
<span class="py-1 text-xs text-charcoal/40">{letter}</span>
|
||||||
|
{/each}
|
||||||
|
{#each month.days as day (day.dateKey)}
|
||||||
|
{@const selectable = day.inMonth && itemSlotsByDay.has(day.dateKey)}
|
||||||
|
{@const selected = selectable && ui.selectedDayKey === day.dateKey}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
disabled={!selectable}
|
||||||
|
aria-pressed={selected}
|
||||||
|
onclick={() => (ui.selectedDayKey = day.dateKey)}
|
||||||
|
class="aspect-square rounded-full text-sm transition {selected
|
||||||
|
? 'bg-sage font-semibold text-white'
|
||||||
|
: selectable
|
||||||
|
? 'cursor-pointer bg-sage/15 font-medium text-charcoal hover:bg-sage/35'
|
||||||
|
: 'cursor-default text-charcoal/25'} {!day.inMonth ? 'opacity-40' : ''} {day.isToday &&
|
||||||
|
!selected
|
||||||
|
? 'ring-1 ring-sage/60'
|
||||||
|
: ''}"
|
||||||
|
>
|
||||||
|
{day.dayNumber}
|
||||||
|
</button>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if ui.selectedDayKey}
|
||||||
|
{@const daySlots = itemSlotsByDay.get(ui.selectedDayKey) ?? []}
|
||||||
|
<p class="mt-4 mb-2 text-sm font-medium text-charcoal/70">Available times</p>
|
||||||
|
<div class="flex flex-wrap gap-2">
|
||||||
|
{#each daySlots as slot (slot.id)}
|
||||||
|
{@const slotInBasket = basket.lines.some((l) => l.slot === slot.id)}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
disabled={slotInBasket || ui.adding}
|
||||||
|
onclick={() => addSlot(item.id, slot.id)}
|
||||||
|
class="inline-flex items-center gap-1.5 rounded-full border px-3.5 py-1.5 text-sm transition {slotInBasket
|
||||||
|
? 'cursor-not-allowed border-transparent bg-sage/15 text-sage-dark'
|
||||||
|
: 'border-charcoal/15 bg-white text-charcoal hover:border-sage hover:bg-sage/10'} disabled:opacity-60 {ui.adding &&
|
||||||
|
!slotInBasket
|
||||||
|
? 'cursor-wait'
|
||||||
|
: ''}"
|
||||||
|
>
|
||||||
|
{#if ui.pendingSlotId === slot.id}
|
||||||
|
<span class="loading loading-spinner loading-xs"></span>
|
||||||
|
{/if}
|
||||||
|
{formatTime(slot.start)}{item.duration != null ? ` · ${item.duration} min` : ''}{slotInBasket
|
||||||
|
? ' · In basket'
|
||||||
|
: ''}
|
||||||
|
</button>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<p class="mt-4 text-sm text-charcoal/60">
|
||||||
|
Days with availability are highlighted{item.duration != null ? ` · ${item.duration} min per session` : ''}.
|
||||||
|
</p>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if ui.justAdded}
|
||||||
|
<p class="mt-3 text-sm font-medium text-sage-dark">
|
||||||
|
Added ✓ — <a href="/book" class="underline underline-offset-2 hover:no-underline">view basket</a>
|
||||||
|
</p>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</article>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
@ -1,6 +1,15 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { HeaderGlobal } from '$lib/types';
|
import type { HeaderGlobal } from '$lib/types';
|
||||||
|
import { getBasketContext } from '$lib/basket.svelte';
|
||||||
|
|
||||||
let { header } = $props<{ header: HeaderGlobal }>();
|
let { header } = $props<{ header: HeaderGlobal }>();
|
||||||
|
|
||||||
|
const basket = getBasketContext();
|
||||||
|
let hasItems = $derived(basket.count > 0);
|
||||||
|
|
||||||
|
function formatTotal(amount: number) {
|
||||||
|
return new Intl.NumberFormat(undefined, { style: 'currency', currency: 'EUR' }).format(amount);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<header class="sticky top-0 z-40 border-b border-charcoal/5 bg-warm/90 backdrop-blur">
|
<header class="sticky top-0 z-40 border-b border-charcoal/5 bg-warm/90 backdrop-blur">
|
||||||
|
|
@ -20,8 +29,23 @@
|
||||||
{/each}
|
{/each}
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
{#if header.ctaButton?.label}
|
<div class="flex items-center gap-3">
|
||||||
<a class="btn rounded-full border-0 px-6 text-white hover:opacity-90" style="background-color: var(--color-primary, #8a9a7b);" href={header.ctaButton.href}>{header.ctaButton.label}</a>
|
{#if hasItems}
|
||||||
{/if}
|
<a
|
||||||
|
class="relative flex items-center gap-2 rounded-full border border-charcoal/10 px-4 py-2 text-sm font-semibold text-charcoal/80 transition hover:border-sage hover:text-sage-dark"
|
||||||
|
href="/book"
|
||||||
|
aria-label="View your basket"
|
||||||
|
>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.5">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 10.5V6a3.75 3.75 0 1 0-7.5 0v4.5m11.356-1.993 1.263 12c.07.665-.45 1.243-1.119 1.243H4.25a1.125 1.125 0 0 1-1.12-1.243l1.264-12A1.125 1.125 0 0 1 5.513 7.5h12.974c.576 0 1.059.435 1.119 1.007Z" />
|
||||||
|
</svg>
|
||||||
|
<span class="badge badge-sm rounded-full border-0 bg-sage text-white">{basket.count}</span>
|
||||||
|
<span class="hidden sm:inline">{formatTotal(basket.total)}</span>
|
||||||
|
</a>
|
||||||
|
{/if}
|
||||||
|
{#if header.ctaButton?.label}
|
||||||
|
<a class="btn rounded-full border-0 px-6 text-white hover:opacity-90" style="background-color: var(--color-primary, #8a9a7b);" href={header.ctaButton.href}>{header.ctaButton.label}</a>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
|
||||||
187
app/src/lib/server/basket.ts
Normal file
187
app/src/lib/server/basket.ts
Normal file
|
|
@ -0,0 +1,187 @@
|
||||||
|
import type PocketBase from 'pocketbase';
|
||||||
|
import type { Basket, BasketLine } from '$lib/types';
|
||||||
|
import { getFileUrl } from '$lib/pb';
|
||||||
|
|
||||||
|
export const BASKET_COOKIE = 'basket_id';
|
||||||
|
/** Basket lifetime — refreshed on every basket API call. */
|
||||||
|
export const BASKET_TTL_MS = 24 * 60 * 60 * 1000; // 24h
|
||||||
|
/** How long a slot stays held once added to a basket / after a failed payment. */
|
||||||
|
export const SLOT_HOLD_MS = 10 * 60 * 1000; // 10 min
|
||||||
|
/** Hold extended to this once a payment is in progress, so the slot survives
|
||||||
|
* the customer entering card details / retrying a declined card. */
|
||||||
|
export const SLOT_CHECKOUT_HOLD_MS = 30 * 60 * 1000; // 30 min
|
||||||
|
|
||||||
|
function now() {
|
||||||
|
return new Date();
|
||||||
|
}
|
||||||
|
|
||||||
|
function iso(date: Date) {
|
||||||
|
return date.toISOString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release any slots whose hold has expired, removing their basket lines
|
||||||
|
* and flipping them back to `available`. Also marks expired active
|
||||||
|
* baskets as `abandoned`. Runs lazily on basket reads / checkout.
|
||||||
|
*
|
||||||
|
* The expiry check is done in JS (parsing `heldUntil` as a UTC date) rather
|
||||||
|
* than via a PocketBase date-string filter, so a slot is never released
|
||||||
|
* *before* its hold genuinely lapses — regardless of how PocketBase stores /
|
||||||
|
* compares the date field. A slot is held for the full SLOT_HOLD_MS (or
|
||||||
|
* SLOT_CHECKOUT_HOLD_MS during payment).
|
||||||
|
*/
|
||||||
|
export async function sweepExpiredHolds(pb: PocketBase) {
|
||||||
|
const nowMs = Date.now();
|
||||||
|
|
||||||
|
// 1. Release expired slot holds (and drop the lines holding them)
|
||||||
|
const heldSlots = await pb
|
||||||
|
.collection('slots')
|
||||||
|
.getFullList({ filter: `status = 'held'` })
|
||||||
|
.catch(() => []);
|
||||||
|
for (const slot of heldSlots) {
|
||||||
|
const heldUntilMs = slot.heldUntil ? Date.parse(slot.heldUntil) : NaN;
|
||||||
|
// Still valid, or no parseable hold to judge by — leave it alone.
|
||||||
|
if (Number.isNaN(heldUntilMs) || heldUntilMs > nowMs) continue;
|
||||||
|
|
||||||
|
const lines = await pb
|
||||||
|
.collection('basket_lines')
|
||||||
|
.getFullList({ filter: `slot = "${slot.id}"` })
|
||||||
|
.catch(() => []);
|
||||||
|
for (const line of lines) {
|
||||||
|
await pb.collection('basket_lines').delete(line.id).catch(() => {});
|
||||||
|
}
|
||||||
|
await pb
|
||||||
|
.collection('slots')
|
||||||
|
.update(slot.id, { status: 'available', heldUntil: null })
|
||||||
|
.catch(() => {});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Abandon expired active baskets (their slot holds were already
|
||||||
|
// covered by heldUntil above — same 10-min window < 24h basket TTL)
|
||||||
|
const nowIso = iso(now());
|
||||||
|
await pb
|
||||||
|
.collection('baskets')
|
||||||
|
.getFullList({ filter: `status = 'active' && expiresAt < "${nowIso}"` })
|
||||||
|
.then(async (expired) => {
|
||||||
|
for (const basket of expired) {
|
||||||
|
await pb.collection('baskets').update(basket.id, { status: 'abandoned' }).catch(() => {});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Map raw PB records (with expand) to our Basket type. */
|
||||||
|
function mapBasket(record: Record<string, any>, lines: Record<string, any>[]): Basket {
|
||||||
|
const mappedLines: BasketLine[] = lines.map((line) => {
|
||||||
|
const item = line.expand?.item;
|
||||||
|
const slot = line.expand?.slot;
|
||||||
|
const media = item?.expand?.image;
|
||||||
|
return {
|
||||||
|
id: line.id,
|
||||||
|
basket: line.basket,
|
||||||
|
item: line.item,
|
||||||
|
slot: line.slot || null,
|
||||||
|
quantity: line.quantity,
|
||||||
|
lineType: line.lineType,
|
||||||
|
itemName: item?.name,
|
||||||
|
itemPrice: item?.price,
|
||||||
|
itemImageUrl: media ? getFileUrl('media', media.id, media.file) : undefined,
|
||||||
|
slotStart: slot?.start,
|
||||||
|
slotEnd: slot?.end
|
||||||
|
};
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
id: record.id,
|
||||||
|
status: record.status,
|
||||||
|
expiresAt: record.expiresAt,
|
||||||
|
email: record.email || null,
|
||||||
|
customerDetails: record.customerDetails || null,
|
||||||
|
stripePaymentIntentId: record.stripePaymentIntentId || null,
|
||||||
|
lines: mappedLines
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Load a basket + its lines (with item/slot expand) by basket id. */
|
||||||
|
export async function loadBasket(pb: PocketBase, basketId: string): Promise<Basket | null> {
|
||||||
|
try {
|
||||||
|
const record = await pb.collection('baskets').getOne(basketId);
|
||||||
|
if (record.status !== 'active') return null;
|
||||||
|
const lines = await pb
|
||||||
|
.collection('basket_lines')
|
||||||
|
.getFullList({ filter: `basket = "${basketId}"`, expand: 'item,slot,item.image' });
|
||||||
|
return mapBasket(record, lines);
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Create a fresh active basket. */
|
||||||
|
export async function createBasket(pb: PocketBase): Promise<Basket> {
|
||||||
|
const record = await pb.collection('baskets').create({
|
||||||
|
status: 'active',
|
||||||
|
expiresAt: iso(new Date(Date.now() + BASKET_TTL_MS))
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
id: record.id,
|
||||||
|
status: 'active',
|
||||||
|
expiresAt: record.expiresAt,
|
||||||
|
email: null,
|
||||||
|
customerDetails: null,
|
||||||
|
stripePaymentIntentId: null,
|
||||||
|
lines: []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Touch the basket expiry (rolling TTL). */
|
||||||
|
export async function touchBasket(pb: PocketBase, basketId: string) {
|
||||||
|
await pb
|
||||||
|
.collection('baskets')
|
||||||
|
.update(basketId, { expiresAt: iso(new Date(Date.now() + BASKET_TTL_MS)) })
|
||||||
|
.catch(() => {});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Release a slot hold for a basket line (slot back to available). */
|
||||||
|
export async function releaseLineHold(pb: PocketBase, line: { slot?: string | null }) {
|
||||||
|
if (!line.slot) return;
|
||||||
|
await pb
|
||||||
|
.collection('slots')
|
||||||
|
.update(line.slot, { status: 'available', heldUntil: null })
|
||||||
|
.catch(() => {});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Re-reserve (extend) the hold on every slot line in a basket, as long as
|
||||||
|
* the slot is still in `held` status. Used:
|
||||||
|
* - at checkout start (create-intent) with SLOT_CHECKOUT_HOLD_MS, so a
|
||||||
|
* service survives the customer entering card details / retrying a
|
||||||
|
* declined card;
|
||||||
|
* - after a failed payment (webhook) with SLOT_HOLD_MS, so the customer
|
||||||
|
* can retry within a fresh 10-minute window.
|
||||||
|
* The slot is genuinely still the customer's (nobody else could grab it
|
||||||
|
* while `held`), so renewing is safe. Slots whose status is no longer
|
||||||
|
* `held` (e.g. released and re-booked by someone else) are returned so the
|
||||||
|
* caller can inform the user.
|
||||||
|
*/
|
||||||
|
export async function extendBasketHolds(
|
||||||
|
pb: PocketBase,
|
||||||
|
basketId: string,
|
||||||
|
durationMs = SLOT_HOLD_MS
|
||||||
|
): Promise<string[]> {
|
||||||
|
const unheld: string[] = [];
|
||||||
|
const lines = await pb
|
||||||
|
.collection('basket_lines')
|
||||||
|
.getFullList({ filter: `basket = "${basketId}" && lineType = "slot"` })
|
||||||
|
.catch(() => []);
|
||||||
|
const until = iso(new Date(Date.now() + durationMs));
|
||||||
|
for (const line of lines) {
|
||||||
|
const slotId = line.slot;
|
||||||
|
if (!slotId) continue;
|
||||||
|
const slot = await pb.collection('slots').getOne(slotId).catch(() => null);
|
||||||
|
if (slot && slot.status === 'held') {
|
||||||
|
await pb.collection('slots').update(slotId, { heldUntil: until }).catch(() => {});
|
||||||
|
} else {
|
||||||
|
unheld.push(line.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return unheld;
|
||||||
|
}
|
||||||
53
app/src/lib/server/pb-admin.ts
Normal file
53
app/src/lib/server/pb-admin.ts
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
import PocketBase, { ClientResponseError } from 'pocketbase';
|
||||||
|
import { env } from '$env/dynamic/private';
|
||||||
|
|
||||||
|
let adminPb: PocketBase | null = null;
|
||||||
|
let authPromise: Promise<PocketBase> | null = null;
|
||||||
|
|
||||||
|
async function authenticate(): Promise<PocketBase> {
|
||||||
|
const url = env.POCKETBASE_INTERNAL_URL || env.PUBLIC_POCKETBASE_URL || 'http://localhost:8080';
|
||||||
|
const pb = new PocketBase(url);
|
||||||
|
pb.autoCancellation(false);
|
||||||
|
|
||||||
|
const email = env.POCKETBASE_ADMIN_EMAIL;
|
||||||
|
const password = env.POCKETBASE_ADMIN_PASSWORD;
|
||||||
|
if (!email || !password) throw new Error('POCKETBASE_ADMIN_EMAIL and POCKETBASE_ADMIN_PASSWORD must be set');
|
||||||
|
|
||||||
|
await pb.collection('_superusers').authWithPassword(email, password);
|
||||||
|
adminPb = pb;
|
||||||
|
return pb;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server-only PocketBase client authenticated as admin.
|
||||||
|
* Used by basket/checkout/webhook API routes that need to bypass
|
||||||
|
* collection-level API rules (create baskets, hold slots, create orders).
|
||||||
|
*
|
||||||
|
* Concurrent callers share one in-flight auth attempt; if the cached token
|
||||||
|
* has since been invalidated (401 on first use), we re-authenticate once.
|
||||||
|
*/
|
||||||
|
export async function getAdminPb(): Promise<PocketBase> {
|
||||||
|
if (adminPb?.authStore.isValid) return adminPb;
|
||||||
|
authPromise ??= authenticate().finally(() => {
|
||||||
|
authPromise = null;
|
||||||
|
});
|
||||||
|
return authPromise;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run `fn` with the admin client; on a 401 (stale/invalidated token),
|
||||||
|
* re-authenticate and retry exactly once.
|
||||||
|
*/
|
||||||
|
export async function withAdminPb<T>(fn: (pb: PocketBase) => Promise<T>): Promise<T> {
|
||||||
|
const pb = await getAdminPb();
|
||||||
|
try {
|
||||||
|
return await fn(pb);
|
||||||
|
} catch (e) {
|
||||||
|
if (e instanceof ClientResponseError && e.status === 401) {
|
||||||
|
pb.authStore.clear();
|
||||||
|
adminPb = null;
|
||||||
|
return fn(await getAdminPb());
|
||||||
|
}
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
15
app/src/lib/stripe-client.ts
Normal file
15
app/src/lib/stripe-client.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { loadStripe as _loadStripe } from '@stripe/stripe-js';
|
||||||
|
import { env } from '$env/dynamic/public';
|
||||||
|
import { browser } from '$app/environment';
|
||||||
|
|
||||||
|
let stripePromise: ReturnType<typeof _loadStripe> | null = null;
|
||||||
|
|
||||||
|
export function loadStripe() {
|
||||||
|
if (!browser) return null;
|
||||||
|
if (!stripePromise) {
|
||||||
|
const key = env.PUBLIC_STRIPE_PUBLISHABLE_KEY;
|
||||||
|
if (!key) throw new Error('PUBLIC_STRIPE_PUBLISHABLE_KEY is not set');
|
||||||
|
stripePromise = _loadStripe(key);
|
||||||
|
}
|
||||||
|
return stripePromise;
|
||||||
|
}
|
||||||
17
app/src/lib/stripe.server.ts
Normal file
17
app/src/lib/stripe.server.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
import Stripe from 'stripe';
|
||||||
|
import { env } from '$env/dynamic/private';
|
||||||
|
|
||||||
|
let stripe: Stripe | null = null;
|
||||||
|
|
||||||
|
export function getStripe(): Stripe {
|
||||||
|
if (!stripe) {
|
||||||
|
const key = env.STRIPE_SECRET_KEY;
|
||||||
|
if (!key) throw new Error('STRIPE_SECRET_KEY is not set');
|
||||||
|
stripe = new Stripe(key);
|
||||||
|
}
|
||||||
|
return stripe;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getCurrency(): string {
|
||||||
|
return env.STRIPE_CURRENCY || 'eur';
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,9 @@ export type BlockType =
|
||||||
| 'button'
|
| 'button'
|
||||||
| 'spacer'
|
| 'spacer'
|
||||||
| 'testimonials'
|
| 'testimonials'
|
||||||
| 'upcoming_calendar';
|
| 'upcoming_calendar'
|
||||||
|
| 'shop'
|
||||||
|
| 'checkout';
|
||||||
|
|
||||||
export type BlockBackground = {
|
export type BlockBackground = {
|
||||||
type: 'none' | 'color' | 'image';
|
type: 'none' | 'color' | 'image';
|
||||||
|
|
@ -94,6 +96,109 @@ export const defaultFooter: FooterGlobal = {
|
||||||
copyrightText: `© ${new Date().getFullYear()} Eva Shafik Massage. All rights reserved.`
|
copyrightText: `© ${new Date().getFullYear()} Eva Shafik Massage. All rights reserved.`
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ── Commerce types ─────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
export type ItemType = 'item' | 'item_with_time';
|
||||||
|
|
||||||
|
export type ItemRecord = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
price: number;
|
||||||
|
image: string; // media record id
|
||||||
|
imageUrl: string; // resolved URL (populated by server load)
|
||||||
|
type: ItemType;
|
||||||
|
stock: number | null;
|
||||||
|
duration: number | null; // minutes, for item_with_time
|
||||||
|
active: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type SlotStatus = 'available' | 'held' | 'booked';
|
||||||
|
|
||||||
|
export type SlotRecord = {
|
||||||
|
id: string;
|
||||||
|
item: string; // item id
|
||||||
|
start: string;
|
||||||
|
end: string;
|
||||||
|
status: SlotStatus;
|
||||||
|
heldUntil: string | null;
|
||||||
|
order: string | null;
|
||||||
|
notes: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type BasketStatus = 'active' | 'completed' | 'abandoned';
|
||||||
|
|
||||||
|
export type BasketLine = {
|
||||||
|
id: string;
|
||||||
|
basket: string;
|
||||||
|
item: string;
|
||||||
|
slot: string | null;
|
||||||
|
quantity: number;
|
||||||
|
lineType: 'item' | 'slot';
|
||||||
|
// Expanded fields (populated server-side)
|
||||||
|
itemName?: string;
|
||||||
|
itemPrice?: number;
|
||||||
|
itemImageUrl?: string;
|
||||||
|
slotStart?: string;
|
||||||
|
slotEnd?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Basket = {
|
||||||
|
id: string;
|
||||||
|
status: BasketStatus;
|
||||||
|
expiresAt: string;
|
||||||
|
email: string | null;
|
||||||
|
customerDetails: CustomerDetails | null;
|
||||||
|
stripePaymentIntentId: string | null;
|
||||||
|
lines: BasketLine[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type CustomerDetails = {
|
||||||
|
name: string;
|
||||||
|
email: string;
|
||||||
|
phone: string;
|
||||||
|
notes: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type OrderRecord = {
|
||||||
|
id: string;
|
||||||
|
basket: string;
|
||||||
|
email: string;
|
||||||
|
customerDetails: CustomerDetails;
|
||||||
|
total: number;
|
||||||
|
status: 'pending' | 'paid' | 'refunded';
|
||||||
|
stripePaymentIntentId: string;
|
||||||
|
createdAt: string;
|
||||||
|
lines?: OrderLine[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type OrderLine = {
|
||||||
|
id: string;
|
||||||
|
order: string;
|
||||||
|
item: string;
|
||||||
|
slot: string | null;
|
||||||
|
quantity: number;
|
||||||
|
lineType: 'item' | 'slot';
|
||||||
|
name: string;
|
||||||
|
price: number;
|
||||||
|
start: string | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ── Block data types ──────────────────────────────────────────────────
|
||||||
|
|
||||||
|
export type ShopBlockData = {
|
||||||
|
title?: string;
|
||||||
|
itemTypeFilter?: 'all' | ItemType;
|
||||||
|
itemIds?: string[];
|
||||||
|
layout?: 'grid' | 'list';
|
||||||
|
};
|
||||||
|
|
||||||
|
export type CheckoutBlockData = {
|
||||||
|
title?: string;
|
||||||
|
heading?: string;
|
||||||
|
notesLabel?: string;
|
||||||
|
};
|
||||||
|
|
||||||
export type ColorsGlobal = {
|
export type ColorsGlobal = {
|
||||||
background: string;
|
background: string;
|
||||||
heading: string;
|
heading: string;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
import { defaultColors, defaultFooter, defaultHeader } from '$lib/types';
|
import { defaultColors, defaultFooter, defaultHeader } from '$lib/types';
|
||||||
|
import type { ItemRecord, SlotRecord } from '$lib/types';
|
||||||
|
import { getFileUrl } from '$lib/pb';
|
||||||
|
import { getAdminPb } from '$lib/server/pb-admin';
|
||||||
|
import { BASKET_COOKIE, loadBasket, sweepExpiredHolds } from '$lib/server/basket';
|
||||||
import type { LayoutServerLoad } from './$types';
|
import type { LayoutServerLoad } from './$types';
|
||||||
|
|
||||||
async function getGlobal(pb: App.Locals['pb'], key: string, fallback: unknown) {
|
async function getGlobal(pb: App.Locals['pb'], key: string, fallback: unknown) {
|
||||||
|
|
@ -10,7 +14,9 @@ async function getGlobal(pb: App.Locals['pb'], key: string, fallback: unknown) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const load: LayoutServerLoad = async ({ locals, url }) => {
|
export const load: LayoutServerLoad = async ({ locals, cookies, url }) => {
|
||||||
|
const isAdmin = url.pathname.startsWith('/admin');
|
||||||
|
|
||||||
const [header, footer, colors] = await Promise.all([
|
const [header, footer, colors] = await Promise.all([
|
||||||
getGlobal(locals.pb, 'header', defaultHeader),
|
getGlobal(locals.pb, 'header', defaultHeader),
|
||||||
getGlobal(locals.pb, 'footer', defaultFooter),
|
getGlobal(locals.pb, 'footer', defaultFooter),
|
||||||
|
|
@ -19,5 +25,59 @@ export const load: LayoutServerLoad = async ({ locals, url }) => {
|
||||||
|
|
||||||
if (!header.homePage) header.homePage = defaultHeader.homePage;
|
if (!header.homePage) header.homePage = defaultHeader.homePage;
|
||||||
|
|
||||||
return { header, footer, colors, user: locals.user, url: { pathname: url.pathname } };
|
// Commerce data is only needed on public pages.
|
||||||
|
let basket = null;
|
||||||
|
let items: ItemRecord[] = [];
|
||||||
|
let slots: SlotRecord[] = [];
|
||||||
|
|
||||||
|
if (!isAdmin) {
|
||||||
|
try {
|
||||||
|
const pb = await getAdminPb();
|
||||||
|
await sweepExpiredHolds(pb);
|
||||||
|
|
||||||
|
const basketId = cookies.get(BASKET_COOKIE);
|
||||||
|
if (basketId) basket = await loadBasket(pb, basketId);
|
||||||
|
|
||||||
|
const itemRecords = await pb
|
||||||
|
.collection('items')
|
||||||
|
.getFullList({ filter: 'active = true', sort: 'name', expand: 'image' })
|
||||||
|
.catch(() => []);
|
||||||
|
items = itemRecords.map((record) => {
|
||||||
|
const media = record.expand?.image;
|
||||||
|
return {
|
||||||
|
id: record.id,
|
||||||
|
name: record.name,
|
||||||
|
description: record.description || '',
|
||||||
|
price: record.price,
|
||||||
|
image: record.image || '',
|
||||||
|
imageUrl: media ? getFileUrl('media', media.id, media.file) : '',
|
||||||
|
type: record.type,
|
||||||
|
stock: record.stock ?? null,
|
||||||
|
duration: record.duration ?? null,
|
||||||
|
active: record.active
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const nowIso = new Date().toISOString();
|
||||||
|
const slotRecords = await pb
|
||||||
|
.collection('slots')
|
||||||
|
.getFullList({ filter: `status = 'available' && start >= "${nowIso}"`, sort: 'start' })
|
||||||
|
.catch(() => []);
|
||||||
|
slots = slotRecords.map((record) => ({
|
||||||
|
id: record.id,
|
||||||
|
item: record.item,
|
||||||
|
start: record.start,
|
||||||
|
end: record.end || '',
|
||||||
|
status: record.status,
|
||||||
|
heldUntil: record.heldUntil || null,
|
||||||
|
order: record.order || null,
|
||||||
|
notes: record.notes || ''
|
||||||
|
}));
|
||||||
|
} catch (e) {
|
||||||
|
// Admin PB not configured (e.g. fresh dev env) — commerce features off.
|
||||||
|
console.warn('Commerce data unavailable:', e instanceof Error ? e.message : e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { header, footer, colors, user: locals.user, url: { pathname: url.pathname }, basket, items, slots };
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,21 @@
|
||||||
import favicon from '$lib/assets/favicon.svg';
|
import favicon from '$lib/assets/favicon.svg';
|
||||||
import Header from '$lib/components/Header.svelte';
|
import Header from '$lib/components/Header.svelte';
|
||||||
import Footer from '$lib/components/Footer.svelte';
|
import Footer from '$lib/components/Footer.svelte';
|
||||||
|
import { createBasketStore, setBasketContext } from '$lib/basket.svelte';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
let { children, data } = $props();
|
let { children, data } = $props();
|
||||||
let isAdmin = $derived(data.url?.pathname?.startsWith('/admin'));
|
let isAdmin = $derived(data.url?.pathname?.startsWith('/admin'));
|
||||||
|
|
||||||
|
// One basket store per public layout instance — provided to all children
|
||||||
|
// (Header indicator, ShopBlock, CheckoutBlock). Never module-level state.
|
||||||
|
const basketStore = createBasketStore(data.basket ?? null);
|
||||||
|
setBasketContext(basketStore);
|
||||||
|
|
||||||
|
// Keep the store in sync when layout data refreshes (e.g. after checkout
|
||||||
|
// clears the cookie and data.basket becomes null).
|
||||||
|
$effect(() => basketStore.syncFrom(data.basket ?? null));
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
if (data.colors && !isAdmin) {
|
if (data.colors && !isAdmin) {
|
||||||
const root = document.documentElement;
|
const root = document.documentElement;
|
||||||
|
|
|
||||||
|
|
@ -8,4 +8,4 @@
|
||||||
<title>{data.page.title}</title>
|
<title>{data.page.title}</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<BlockRenderer blocks={data.page.blocks || []} calendarEvents={data.calendarEvents || []} />
|
<BlockRenderer blocks={data.page.blocks || []} calendarEvents={data.calendarEvents || []} items={data.items || []} slots={data.slots || []} />
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,4 @@
|
||||||
<title>{data.page.title}</title>
|
<title>{data.page.title}</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<BlockRenderer blocks={data.page.blocks || []} calendarEvents={data.calendarEvents || []} />
|
<BlockRenderer blocks={data.page.blocks || []} calendarEvents={data.calendarEvents || []} items={data.items || []} slots={data.slots || []} />
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,9 @@
|
||||||
<div class="flex-none gap-2">
|
<div class="flex-none gap-2">
|
||||||
<a class="btn btn-ghost" href="/admin/pages">Pages</a>
|
<a class="btn btn-ghost" href="/admin/pages">Pages</a>
|
||||||
<a class="btn btn-ghost" href="/admin/calendar">Calendar</a>
|
<a class="btn btn-ghost" href="/admin/calendar">Calendar</a>
|
||||||
|
<a class="btn btn-ghost" href="/admin/items">Items</a>
|
||||||
|
<a class="btn btn-ghost" href="/admin/slots">Slots</a>
|
||||||
|
<a class="btn btn-ghost" href="/admin/orders">Orders</a>
|
||||||
<a class="btn btn-ghost" href="/admin/globals">Globals</a>
|
<a class="btn btn-ghost" href="/admin/globals">Globals</a>
|
||||||
<div class="dropdown dropdown-end">
|
<div class="dropdown dropdown-end">
|
||||||
<button class="btn btn-ghost btn-sm" type="button" tabindex="0">
|
<button class="btn btn-ghost btn-sm" type="button" tabindex="0">
|
||||||
|
|
|
||||||
74
app/src/routes/admin/items/+page.server.ts
Normal file
74
app/src/routes/admin/items/+page.server.ts
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
import { fail } from '@sveltejs/kit';
|
||||||
|
import { getFileUrl } from '$lib/pb';
|
||||||
|
import type { ItemRecord, ItemType } from '$lib/types';
|
||||||
|
import type { Actions, PageServerLoad } from './$types';
|
||||||
|
|
||||||
|
function itemPayload(data: FormData) {
|
||||||
|
const type: ItemType = String(data.get('type')) === 'item_with_time' ? 'item_with_time' : 'item';
|
||||||
|
const rawStock = String(data.get('stock') ?? '').trim();
|
||||||
|
const rawDuration = String(data.get('duration') ?? '').trim();
|
||||||
|
const stock = type === 'item' && rawStock !== '' ? parseInt(rawStock, 10) : null;
|
||||||
|
const duration = type === 'item_with_time' && rawDuration !== '' ? parseInt(rawDuration, 10) : null;
|
||||||
|
|
||||||
|
return {
|
||||||
|
name: String(data.get('name') || '').trim(),
|
||||||
|
description: String(data.get('description') || '').trim(),
|
||||||
|
price: parseFloat(String(data.get('price') || '')),
|
||||||
|
image: String(data.get('image') || '').trim(),
|
||||||
|
type,
|
||||||
|
stock: Number.isNaN(stock) ? null : stock,
|
||||||
|
duration: Number.isNaN(duration) ? null : duration,
|
||||||
|
active: String(data.get('active')) === 'true'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeItem(record: Record<string, any>): ItemRecord {
|
||||||
|
const media = record.expand?.image;
|
||||||
|
return {
|
||||||
|
id: record.id,
|
||||||
|
name: String(record.name || ''),
|
||||||
|
description: String(record.description || ''),
|
||||||
|
price: Number(record.price) || 0,
|
||||||
|
image: String(record.image || ''),
|
||||||
|
imageUrl: media ? getFileUrl('media', media.id, media.file) : '',
|
||||||
|
type: record.type === 'item_with_time' ? 'item_with_time' : 'item',
|
||||||
|
stock: record.stock ?? null,
|
||||||
|
duration: record.duration ?? null,
|
||||||
|
active: record.active !== false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export const load: PageServerLoad = async ({ locals }) => {
|
||||||
|
const records = await locals.pb
|
||||||
|
.collection('items')
|
||||||
|
.getFullList({ sort: 'name', expand: 'image' })
|
||||||
|
.catch(() => []);
|
||||||
|
const items = records.map((record) => normalizeItem(record));
|
||||||
|
return { items };
|
||||||
|
};
|
||||||
|
|
||||||
|
export const actions: Actions = {
|
||||||
|
create: async ({ request, locals }) => {
|
||||||
|
const data = await request.formData();
|
||||||
|
const payload = itemPayload(data);
|
||||||
|
if (!payload.name || Number.isNaN(payload.price)) return fail(400, { message: 'Name and price are required.' });
|
||||||
|
await locals.pb.collection('items').create(payload);
|
||||||
|
return { ok: true };
|
||||||
|
},
|
||||||
|
update: async ({ request, locals }) => {
|
||||||
|
const data = await request.formData();
|
||||||
|
const id = String(data.get('id') || '');
|
||||||
|
const payload = itemPayload(data);
|
||||||
|
if (!id) return fail(400, { message: 'Item id is required.' });
|
||||||
|
if (!payload.name || Number.isNaN(payload.price)) return fail(400, { message: 'Name and price are required.' });
|
||||||
|
await locals.pb.collection('items').update(id, payload);
|
||||||
|
return { ok: true };
|
||||||
|
},
|
||||||
|
delete: async ({ request, locals }) => {
|
||||||
|
const data = await request.formData();
|
||||||
|
const id = String(data.get('id') || '');
|
||||||
|
if (!id) return fail(400, { message: 'Item id is required.' });
|
||||||
|
await locals.pb.collection('items').delete(id);
|
||||||
|
return { ok: true };
|
||||||
|
}
|
||||||
|
};
|
||||||
199
app/src/routes/admin/items/+page.svelte
Normal file
199
app/src/routes/admin/items/+page.svelte
Normal file
|
|
@ -0,0 +1,199 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import type { ItemRecord, ItemType } from '$lib/types';
|
||||||
|
|
||||||
|
let { data, form } = $props();
|
||||||
|
let items = $derived(data.items || []);
|
||||||
|
let showEditor = $state(false);
|
||||||
|
let uploading = $state(false);
|
||||||
|
|
||||||
|
type ItemDraft = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
price: number;
|
||||||
|
image: string;
|
||||||
|
imageUrl: string;
|
||||||
|
type: ItemType;
|
||||||
|
stock: string;
|
||||||
|
duration: string;
|
||||||
|
active: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
let draft = $state<ItemDraft>(emptyDraft());
|
||||||
|
let action = $derived(draft.id ? '?/update' : '?/create');
|
||||||
|
|
||||||
|
const eur = new Intl.NumberFormat(undefined, { style: 'currency', currency: 'EUR' });
|
||||||
|
|
||||||
|
function emptyDraft(): ItemDraft {
|
||||||
|
return { id: '', name: '', description: '', price: 0, image: '', imageUrl: '', type: 'item', stock: '', duration: '', active: true };
|
||||||
|
}
|
||||||
|
|
||||||
|
function createItem() {
|
||||||
|
draft = emptyDraft();
|
||||||
|
showEditor = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function editItem(item: ItemRecord) {
|
||||||
|
draft = {
|
||||||
|
id: item.id,
|
||||||
|
name: item.name,
|
||||||
|
description: item.description,
|
||||||
|
price: item.price,
|
||||||
|
image: item.image,
|
||||||
|
imageUrl: item.imageUrl,
|
||||||
|
type: item.type,
|
||||||
|
stock: item.stock == null ? '' : String(item.stock),
|
||||||
|
duration: item.duration == null ? '' : String(item.duration),
|
||||||
|
active: item.active
|
||||||
|
};
|
||||||
|
showEditor = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onImageSelected(event: Event) {
|
||||||
|
const input = event.currentTarget as HTMLInputElement;
|
||||||
|
const file = input.files?.[0];
|
||||||
|
if (!file) return;
|
||||||
|
uploading = true;
|
||||||
|
try {
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append('file', file);
|
||||||
|
formData.append('alt', file.name.replace(/\.[^/.]+$/, '').replace(/[-_]/g, ' '));
|
||||||
|
const res = await fetch('/admin/api/upload', { method: 'POST', body: formData });
|
||||||
|
if (!res.ok) throw new Error(`Upload failed (${res.status})`);
|
||||||
|
const result = await res.json();
|
||||||
|
draft = { ...draft, image: result.record.id, imageUrl: result.url };
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
} finally {
|
||||||
|
uploading = false;
|
||||||
|
input.value = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<svelte:head><title>Items | CMS</title></svelte:head>
|
||||||
|
|
||||||
|
<div class="space-y-6">
|
||||||
|
<div class="flex flex-col justify-between gap-4 md:flex-row md:items-end">
|
||||||
|
<div>
|
||||||
|
<h1 class="text-3xl font-bold">Items</h1>
|
||||||
|
<p class="text-base-content/60">Manage services and products shown in Shop blocks.</p>
|
||||||
|
</div>
|
||||||
|
<button class="btn btn-primary" type="button" onclick={() => createItem()}>Create item</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if form?.message}<div class="alert alert-error">{form.message}</div>{/if}
|
||||||
|
|
||||||
|
<div class="rounded-box bg-base-100 p-5 shadow">
|
||||||
|
<div class="overflow-x-auto">
|
||||||
|
<table class="table">
|
||||||
|
<thead><tr><th>Name</th><th>Type</th><th>Price</th><th>Stock</th><th>Duration</th><th>Status</th><th></th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
{#each items as item}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div class="flex items-center gap-3">
|
||||||
|
{#if item.imageUrl}
|
||||||
|
<img class="h-10 w-10 rounded-box object-cover" src={item.imageUrl} alt="" />
|
||||||
|
{/if}
|
||||||
|
<span class="font-semibold">{item.name}</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td><span class="badge">{item.type === 'item_with_time' ? 'Service' : 'Product'}</span></td>
|
||||||
|
<td>{eur.format(item.price)}</td>
|
||||||
|
<td>{item.type === 'item' ? (item.stock ?? '—') : '—'}</td>
|
||||||
|
<td>{item.type === 'item_with_time' ? `${item.duration ?? 0} min` : '—'}</td>
|
||||||
|
<td><span class="badge" class:badge-success={item.active}>{item.active ? 'Active' : 'Inactive'}</span></td>
|
||||||
|
<td class="text-right"><button class="btn btn-sm" type="button" onclick={() => editItem(item)}>Edit</button></td>
|
||||||
|
</tr>
|
||||||
|
{/each}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if showEditor}
|
||||||
|
<div class="fixed inset-0 z-50 bg-black/50 p-4">
|
||||||
|
<div class="mx-auto max-h-full max-w-2xl overflow-auto rounded-box bg-base-100 p-6 shadow-xl">
|
||||||
|
<div class="mb-4 flex items-center justify-between gap-3">
|
||||||
|
<h2 class="text-2xl font-bold">{draft.id ? 'Edit item' : 'Create item'}</h2>
|
||||||
|
<button class="btn btn-ghost btn-sm" type="button" onclick={() => (showEditor = false)}>Close</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form method="POST" action={action} class="space-y-4">
|
||||||
|
<input type="hidden" name="id" value={draft.id} />
|
||||||
|
<input type="hidden" name="active" value={draft.active ? 'true' : 'false'} />
|
||||||
|
|
||||||
|
<label class="form-control w-full">
|
||||||
|
<div class="label"><span class="label-text">Name</span></div>
|
||||||
|
<input class="input input-bordered w-full" name="name" required bind:value={draft.name} />
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label class="form-control w-full">
|
||||||
|
<div class="label"><span class="label-text">Description</span></div>
|
||||||
|
<textarea class="textarea textarea-bordered min-h-28" name="description" bind:value={draft.description}></textarea>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="grid gap-4 md:grid-cols-2">
|
||||||
|
<label class="form-control w-full">
|
||||||
|
<div class="label"><span class="label-text">Price</span></div>
|
||||||
|
<input class="input input-bordered w-full" type="number" step="0.01" min="0" name="price" required bind:value={draft.price} />
|
||||||
|
</label>
|
||||||
|
<label class="form-control w-full">
|
||||||
|
<div class="label"><span class="label-text">Type</span></div>
|
||||||
|
<select class="select select-bordered w-full" name="type" bind:value={draft.type}>
|
||||||
|
<option value="item">Product</option>
|
||||||
|
<option value="item_with_time">Service</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if draft.type === 'item'}
|
||||||
|
<label class="form-control w-full">
|
||||||
|
<div class="label"><span class="label-text">Stock</span></div>
|
||||||
|
<input class="input input-bordered w-full" type="number" min="0" step="1" name="stock" placeholder="Unlimited when empty" bind:value={draft.stock} />
|
||||||
|
</label>
|
||||||
|
{:else}
|
||||||
|
<label class="form-control w-full">
|
||||||
|
<div class="label"><span class="label-text">Duration minutes</span></div>
|
||||||
|
<input class="input input-bordered w-full" type="number" min="0" step="1" name="duration" placeholder="60" bind:value={draft.duration} />
|
||||||
|
</label>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div class="form-control w-full">
|
||||||
|
<div class="label"><span class="label-text">Image</span></div>
|
||||||
|
<div class="flex items-start gap-3">
|
||||||
|
{#if draft.imageUrl}
|
||||||
|
<img class="h-16 w-16 rounded-box object-cover" src={draft.imageUrl} alt="" />
|
||||||
|
{/if}
|
||||||
|
<div class="flex-1 space-y-2">
|
||||||
|
<input class="input input-bordered w-full" name="image" placeholder="Media record id" bind:value={draft.image} />
|
||||||
|
<input class="file-input file-input-bordered file-input-sm w-full" type="file" accept="image/*" disabled={uploading} onchange={onImageSelected} />
|
||||||
|
<p class="text-xs text-base-content/60">
|
||||||
|
{uploading ? 'Uploading…' : 'Upload a file or paste a media record id. A media picker will replace this in a later iteration.'}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label class="label cursor-pointer justify-start gap-3">
|
||||||
|
<input class="toggle toggle-success" type="checkbox" bind:checked={draft.active} />
|
||||||
|
<span class="label-text">Active</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="flex justify-between gap-2 pt-2">
|
||||||
|
{#if draft.id}
|
||||||
|
<button class="btn btn-error" type="submit" formaction="?/delete">Delete</button>
|
||||||
|
{:else}
|
||||||
|
<span></span>
|
||||||
|
{/if}
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<button class="btn" type="button" onclick={() => (showEditor = false)}>Cancel</button>
|
||||||
|
<button class="btn btn-primary" type="submit">Save item</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
34
app/src/routes/admin/orders/+page.server.ts
Normal file
34
app/src/routes/admin/orders/+page.server.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
import type { PageServerLoad } from './$types';
|
||||||
|
|
||||||
|
export const load: PageServerLoad = async ({ locals }) => {
|
||||||
|
// Sort by id, not 'created' — commerce collections were imported without
|
||||||
|
// autodate fields. PocketBase ids are time-sortable ULIDs.
|
||||||
|
const records = await locals.pb.collection('orders').getFullList({ sort: '-id' }).catch(() => []);
|
||||||
|
|
||||||
|
const orders = [];
|
||||||
|
for (const record of records) {
|
||||||
|
const lineRecords = await locals.pb
|
||||||
|
.collection('order_lines')
|
||||||
|
.getFullList({ filter: `order = "${record.id}"` })
|
||||||
|
.catch(() => []);
|
||||||
|
|
||||||
|
orders.push({
|
||||||
|
id: record.id,
|
||||||
|
email: String(record.email || ''),
|
||||||
|
customerDetails: record.customerDetails || {},
|
||||||
|
total: Number(record.total) || 0,
|
||||||
|
status: String(record.status || 'pending'),
|
||||||
|
created: String(record.created || ''),
|
||||||
|
lines: lineRecords.map((line) => ({
|
||||||
|
id: line.id,
|
||||||
|
name: String(line.name || ''),
|
||||||
|
price: Number(line.price) || 0,
|
||||||
|
quantity: Number(line.quantity) || 1,
|
||||||
|
lineType: String(line.lineType || 'item'),
|
||||||
|
start: line.start ? String(line.start) : ''
|
||||||
|
}))
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return { orders };
|
||||||
|
};
|
||||||
58
app/src/routes/admin/orders/+page.svelte
Normal file
58
app/src/routes/admin/orders/+page.svelte
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
<script lang="ts">
|
||||||
|
let { data } = $props();
|
||||||
|
let orders = $derived(data.orders || []);
|
||||||
|
|
||||||
|
const eur = new Intl.NumberFormat(undefined, { style: 'currency', currency: 'EUR' });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<svelte:head><title>Orders | CMS</title></svelte:head>
|
||||||
|
|
||||||
|
<div class="space-y-6">
|
||||||
|
<div>
|
||||||
|
<h1 class="text-3xl font-bold">Orders</h1>
|
||||||
|
<p class="text-base-content/60">Confirmed bookings and purchases.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if orders.length === 0}
|
||||||
|
<div class="rounded-box bg-base-100 p-8 text-center text-base-content/60 shadow">No orders yet.</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#each orders as order}
|
||||||
|
<div class="rounded-box bg-base-100 p-5 shadow">
|
||||||
|
<div class="flex flex-col justify-between gap-3 md:flex-row md:items-center">
|
||||||
|
<div>
|
||||||
|
<h2 class="text-xl font-bold">{order.customerDetails?.name || order.email || 'Order'}</h2>
|
||||||
|
<p class="text-sm text-base-content/60">
|
||||||
|
{order.email}
|
||||||
|
{#if order.customerDetails?.phone} · {order.customerDetails.phone}{/if}
|
||||||
|
{#if order.created} · {new Date(order.created).toLocaleString()}{/if}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-3">
|
||||||
|
<span
|
||||||
|
class="badge capitalize"
|
||||||
|
class:badge-success={order.status === 'paid'}
|
||||||
|
class:badge-warning={order.status === 'pending'}
|
||||||
|
class:badge-error={order.status === 'refunded'}
|
||||||
|
>{order.status}</span>
|
||||||
|
<span class="text-lg font-bold">{eur.format(order.total)}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="mt-4 space-y-1 border-t border-base-300 pt-4">
|
||||||
|
{#each order.lines as line}
|
||||||
|
<li>
|
||||||
|
{line.quantity}× {line.name} — {eur.format(line.price)}
|
||||||
|
{#if line.lineType === 'slot' && line.start}
|
||||||
|
<span class="block text-sm text-base-content/60">{new Date(line.start).toLocaleString()}</span>
|
||||||
|
{/if}
|
||||||
|
</li>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{#if order.customerDetails?.notes}
|
||||||
|
<p class="mt-3 text-sm italic text-base-content/60">"{order.customerDetails.notes}"</p>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
|
@ -6,7 +6,12 @@ export const load: PageServerLoad = async ({ params, locals }) => {
|
||||||
const page = await locals.pb.collection('pages').getFirstListItem(`slug = "${params.slug}"`);
|
const page = await locals.pb.collection('pages').getFirstListItem(`slug = "${params.slug}"`);
|
||||||
const events = await locals.pb.collection('events').getFullList({ sort: 'start' }).catch(() => []);
|
const events = await locals.pb.collection('events').getFullList({ sort: 'start' }).catch(() => []);
|
||||||
const eventCategories = extractCategories(events.map((event) => normalizeEvent(event)));
|
const eventCategories = extractCategories(events.map((event) => normalizeEvent(event)));
|
||||||
return { page, eventCategories };
|
const items = await locals.pb
|
||||||
|
.collection('items')
|
||||||
|
.getFullList({ sort: 'name' })
|
||||||
|
.then((records) => records.map(({ id, name, type }) => ({ id, name, type })))
|
||||||
|
.catch(() => []);
|
||||||
|
return { page, eventCategories, items };
|
||||||
};
|
};
|
||||||
|
|
||||||
export const actions: Actions = {
|
export const actions: Actions = {
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@
|
||||||
</div>
|
</div>
|
||||||
<BlockList {blocks} {selectedId} onSelect={(id) => (selectedId = id)} onDelete={deleteBlock} onMove={moveBlock} />
|
<BlockList {blocks} {selectedId} onSelect={(id) => (selectedId = id)} onDelete={deleteBlock} onMove={moveBlock} />
|
||||||
</aside>
|
</aside>
|
||||||
<BlockEditor block={selectedBlock} eventCategories={data.eventCategories || []} onChange={updateBlock} />
|
<BlockEditor block={selectedBlock} eventCategories={data.eventCategories || []} items={data.items || []} onChange={updateBlock} />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
|
||||||
96
app/src/routes/admin/slots/+page.server.ts
Normal file
96
app/src/routes/admin/slots/+page.server.ts
Normal file
|
|
@ -0,0 +1,96 @@
|
||||||
|
import { fail } from '@sveltejs/kit';
|
||||||
|
import type { createPocketBase } from '$lib/pb';
|
||||||
|
import type { SlotStatus } from '$lib/types';
|
||||||
|
import type { Actions, PageServerLoad } from './$types';
|
||||||
|
|
||||||
|
type Pb = ReturnType<typeof createPocketBase>;
|
||||||
|
|
||||||
|
type SlotPayload =
|
||||||
|
| { payload: { item: string; start: string; end: string; status: string; notes: string } }
|
||||||
|
| { error: string };
|
||||||
|
|
||||||
|
async function slotPayload(data: FormData, pb: Pb): Promise<SlotPayload> {
|
||||||
|
const itemId = String(data.get('item') || '').trim();
|
||||||
|
const startValue = String(data.get('start') || '').trim();
|
||||||
|
const status = String(data.get('status') || 'available').trim();
|
||||||
|
const notes = String(data.get('notes') || '').trim();
|
||||||
|
|
||||||
|
if (!itemId || !startValue) return { error: 'Service and start are required.' };
|
||||||
|
|
||||||
|
const start = new Date(startValue);
|
||||||
|
if (Number.isNaN(start.getTime())) return { error: 'Invalid start time.' };
|
||||||
|
|
||||||
|
let item: Record<string, any>;
|
||||||
|
try {
|
||||||
|
item = await pb.collection('items').getOne(itemId);
|
||||||
|
} catch {
|
||||||
|
return { error: 'Selected service was not found.' };
|
||||||
|
}
|
||||||
|
if (item.type !== 'item_with_time') return { error: 'Selected service must be a bookable service.' };
|
||||||
|
|
||||||
|
const duration = Number(item.duration) || 0;
|
||||||
|
const end = new Date(start.getTime() + duration * 60_000);
|
||||||
|
|
||||||
|
return {
|
||||||
|
payload: { item: itemId, start: start.toISOString(), end: end.toISOString(), status, notes }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export const load: PageServerLoad = async ({ locals }) => {
|
||||||
|
const itemRecords = await locals.pb
|
||||||
|
.collection('items')
|
||||||
|
.getFullList({ filter: "type = 'item_with_time' && active = true", sort: 'name' })
|
||||||
|
.catch(() => []);
|
||||||
|
const items = itemRecords.map((record) => ({
|
||||||
|
id: record.id,
|
||||||
|
name: String(record.name || ''),
|
||||||
|
duration: record.duration ?? 0
|
||||||
|
}));
|
||||||
|
|
||||||
|
const slotRecords = await locals.pb
|
||||||
|
.collection('slots')
|
||||||
|
.getFullList({ sort: '-start', expand: 'item' })
|
||||||
|
.catch(() => []);
|
||||||
|
const slots = slotRecords.map((record) => ({
|
||||||
|
id: record.id,
|
||||||
|
item: String(record.item || ''),
|
||||||
|
itemName: String(record.expand?.item?.name || 'Unknown service'),
|
||||||
|
itemDuration: record.expand?.item?.duration ?? null,
|
||||||
|
start: String(record.start || ''),
|
||||||
|
end: record.end ? String(record.end) : '',
|
||||||
|
status: String(record.status || 'available') as SlotStatus,
|
||||||
|
heldUntil: record.heldUntil ? String(record.heldUntil) : '',
|
||||||
|
order: record.order ? String(record.order) : '',
|
||||||
|
notes: String(record.notes || '')
|
||||||
|
}));
|
||||||
|
|
||||||
|
return { items, slots };
|
||||||
|
};
|
||||||
|
|
||||||
|
export const actions: Actions = {
|
||||||
|
create: async ({ request, locals }) => {
|
||||||
|
const data = await request.formData();
|
||||||
|
const result = await slotPayload(data, locals.pb);
|
||||||
|
if ('error' in result) return fail(400, { message: result.error });
|
||||||
|
await locals.pb.collection('slots').create(result.payload);
|
||||||
|
return { ok: true };
|
||||||
|
},
|
||||||
|
update: async ({ request, locals }) => {
|
||||||
|
const data = await request.formData();
|
||||||
|
const id = String(data.get('id') || '');
|
||||||
|
if (!id) return fail(400, { message: 'Slot id is required.' });
|
||||||
|
const result = await slotPayload(data, locals.pb);
|
||||||
|
if ('error' in result) return fail(400, { message: result.error });
|
||||||
|
await locals.pb.collection('slots').update(id, result.payload);
|
||||||
|
return { ok: true };
|
||||||
|
},
|
||||||
|
delete: async ({ request, locals }) => {
|
||||||
|
const data = await request.formData();
|
||||||
|
const id = String(data.get('id') || '');
|
||||||
|
if (!id) return fail(400, { message: 'Slot id is required.' });
|
||||||
|
const record = await locals.pb.collection('slots').getOne(id).catch(() => null);
|
||||||
|
if (record && record.status === 'booked') return fail(400, { message: 'Booked slots cannot be deleted' });
|
||||||
|
await locals.pb.collection('slots').delete(id);
|
||||||
|
return { ok: true };
|
||||||
|
}
|
||||||
|
};
|
||||||
161
app/src/routes/admin/slots/+page.svelte
Normal file
161
app/src/routes/admin/slots/+page.svelte
Normal file
|
|
@ -0,0 +1,161 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { toDatetimeInput } from '$lib/calendar';
|
||||||
|
|
||||||
|
let { data, form } = $props();
|
||||||
|
let items = $derived(data.items || []);
|
||||||
|
let slots = $derived(
|
||||||
|
[...(data.slots || [])].sort((a, b) => new Date(a.start).getTime() - new Date(b.start).getTime())
|
||||||
|
);
|
||||||
|
let showEditor = $state(false);
|
||||||
|
|
||||||
|
type SlotDraft = {
|
||||||
|
id: string;
|
||||||
|
item: string;
|
||||||
|
start: string;
|
||||||
|
status: string;
|
||||||
|
heldUntil: string;
|
||||||
|
notes: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
let draft = $state<SlotDraft>(emptyDraft());
|
||||||
|
let action = $derived(draft.id ? '?/update' : '?/create');
|
||||||
|
let isHeld = $derived(draft.status === 'held');
|
||||||
|
let selectedItem = $derived(items.find((item) => item.id === draft.item));
|
||||||
|
let endLabel = $derived.by(() => {
|
||||||
|
if (!selectedItem || !draft.start) return '';
|
||||||
|
const start = new Date(draft.start);
|
||||||
|
if (Number.isNaN(start.getTime())) return '';
|
||||||
|
const end = new Date(start.getTime() + (Number(selectedItem.duration) || 0) * 60_000);
|
||||||
|
return `Ends at ${end.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}`;
|
||||||
|
});
|
||||||
|
|
||||||
|
function emptyDraft(): SlotDraft {
|
||||||
|
return { id: '', item: '', start: toDatetimeInput(new Date().toISOString()), status: 'available', heldUntil: '', notes: '' };
|
||||||
|
}
|
||||||
|
|
||||||
|
function createSlot() {
|
||||||
|
draft = emptyDraft();
|
||||||
|
showEditor = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function editSlot(slot: (typeof slots)[number]) {
|
||||||
|
draft = {
|
||||||
|
id: slot.id,
|
||||||
|
item: slot.item,
|
||||||
|
start: toDatetimeInput(slot.start),
|
||||||
|
status: slot.status,
|
||||||
|
heldUntil: slot.heldUntil,
|
||||||
|
notes: slot.notes
|
||||||
|
};
|
||||||
|
showEditor = true;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<svelte:head><title>Slots | CMS</title></svelte:head>
|
||||||
|
|
||||||
|
<div class="space-y-6">
|
||||||
|
<div class="flex flex-col justify-between gap-4 md:flex-row md:items-end">
|
||||||
|
<div>
|
||||||
|
<h1 class="text-3xl font-bold">Slots</h1>
|
||||||
|
<p class="text-base-content/60">Create bookable time slots for your services.</p>
|
||||||
|
</div>
|
||||||
|
<button class="btn btn-primary" type="button" onclick={() => createSlot()}>Create slot</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if form?.message}<div class="alert alert-error">{form.message}</div>{/if}
|
||||||
|
|
||||||
|
<div class="rounded-box bg-base-100 p-5 shadow">
|
||||||
|
<div class="overflow-x-auto">
|
||||||
|
<table class="table">
|
||||||
|
<thead><tr><th>Service</th><th>Date</th><th>Duration</th><th>Status</th><th></th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
{#each slots as slot}
|
||||||
|
<tr>
|
||||||
|
<td><span class="font-semibold">{slot.itemName}</span></td>
|
||||||
|
<td>{new Date(slot.start).toLocaleString()}</td>
|
||||||
|
<td>{slot.itemDuration ? `${slot.itemDuration} min` : '—'}</td>
|
||||||
|
<td>
|
||||||
|
<span
|
||||||
|
class="badge capitalize"
|
||||||
|
class:badge-success={slot.status === 'available'}
|
||||||
|
class:badge-warning={slot.status === 'held'}
|
||||||
|
class:badge-info={slot.status === 'booked'}
|
||||||
|
>{slot.status}</span>
|
||||||
|
</td>
|
||||||
|
<td class="text-right">
|
||||||
|
<button class="btn btn-sm" type="button" disabled={slot.status === 'booked'} onclick={() => editSlot(slot)}>Edit</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/each}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if showEditor}
|
||||||
|
<div class="fixed inset-0 z-50 bg-black/50 p-4">
|
||||||
|
<div class="mx-auto max-h-full max-w-2xl overflow-auto rounded-box bg-base-100 p-6 shadow-xl">
|
||||||
|
<div class="mb-4 flex items-center justify-between gap-3">
|
||||||
|
<h2 class="text-2xl font-bold">{draft.id ? 'Edit slot' : 'Create slot'}</h2>
|
||||||
|
<button class="btn btn-ghost btn-sm" type="button" onclick={() => (showEditor = false)}>Close</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form method="POST" action={action} class="space-y-4">
|
||||||
|
<input type="hidden" name="id" value={draft.id} />
|
||||||
|
<input type="hidden" name="status" value={draft.status} />
|
||||||
|
{#if isHeld}
|
||||||
|
<input type="hidden" name="item" value={draft.item} />
|
||||||
|
<input type="hidden" name="start" value={draft.start} />
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if isHeld}
|
||||||
|
<div class="alert alert-warning">
|
||||||
|
This slot is currently held by a basket{draft.heldUntil ? ` (until ${new Date(draft.heldUntil).toLocaleString()})` : ''} — editing start/end is disabled.
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<label class="form-control w-full">
|
||||||
|
<div class="label"><span class="label-text">Service</span></div>
|
||||||
|
<select class="select select-bordered w-full" name="item" required disabled={isHeld} bind:value={draft.item}>
|
||||||
|
<option value="" disabled>Select a service…</option>
|
||||||
|
{#each items as item}
|
||||||
|
<option value={item.id}>{item.name}{item.duration ? ` (${item.duration} min)` : ''}</option>
|
||||||
|
{/each}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label class="form-control w-full">
|
||||||
|
<div class="label"><span class="label-text">Start</span></div>
|
||||||
|
<input
|
||||||
|
class="input input-bordered w-full"
|
||||||
|
type="datetime-local"
|
||||||
|
name="start"
|
||||||
|
required
|
||||||
|
disabled={isHeld}
|
||||||
|
value={draft.start}
|
||||||
|
oninput={(e) => (draft = { ...draft, start: e.currentTarget.value })}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
{#if endLabel}<p class="text-sm text-base-content/60">{endLabel}</p>{/if}
|
||||||
|
|
||||||
|
<label class="form-control w-full">
|
||||||
|
<div class="label"><span class="label-text">Notes</span></div>
|
||||||
|
<textarea class="textarea textarea-bordered" name="notes" bind:value={draft.notes}></textarea>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="flex justify-between gap-2 pt-2">
|
||||||
|
{#if draft.id}
|
||||||
|
<button class="btn btn-error" type="submit" formaction="?/delete">Delete</button>
|
||||||
|
{:else}
|
||||||
|
<span></span>
|
||||||
|
{/if}
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<button class="btn" type="button" onclick={() => (showEditor = false)}>Cancel</button>
|
||||||
|
<button class="btn btn-primary" type="submit">Save slot</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
167
app/src/routes/api/basket/+server.ts
Normal file
167
app/src/routes/api/basket/+server.ts
Normal file
|
|
@ -0,0 +1,167 @@
|
||||||
|
import { json, error, type Cookies } from '@sveltejs/kit';
|
||||||
|
import type { RequestHandler } from './$types';
|
||||||
|
import { getAdminPb } from '$lib/server/pb-admin';
|
||||||
|
import {
|
||||||
|
BASKET_COOKIE,
|
||||||
|
BASKET_TTL_MS,
|
||||||
|
SLOT_HOLD_MS,
|
||||||
|
sweepExpiredHolds,
|
||||||
|
loadBasket,
|
||||||
|
createBasket,
|
||||||
|
touchBasket,
|
||||||
|
releaseLineHold
|
||||||
|
} from '$lib/server/basket';
|
||||||
|
import type PocketBase from 'pocketbase';
|
||||||
|
|
||||||
|
function setBasketCookie(cookies: Cookies, basketId: string) {
|
||||||
|
cookies.set(BASKET_COOKIE, basketId, {
|
||||||
|
path: '/',
|
||||||
|
httpOnly: true,
|
||||||
|
sameSite: 'lax',
|
||||||
|
maxAge: BASKET_TTL_MS / 1000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolve the current basket from the cookie. When `create` is true and no
|
||||||
|
* valid basket exists, a new one is created (and the cookie is set).
|
||||||
|
*/
|
||||||
|
async function resolveBasket(pb: PocketBase, cookies: Cookies, create: boolean) {
|
||||||
|
const id = cookies.get(BASKET_COOKIE);
|
||||||
|
if (id) {
|
||||||
|
const basket = await loadBasket(pb, id);
|
||||||
|
if (basket) return { basket, isNew: false };
|
||||||
|
}
|
||||||
|
if (!create) return { basket: null, isNew: false };
|
||||||
|
const basket = await createBasket(pb);
|
||||||
|
setBasketCookie(cookies, basket.id);
|
||||||
|
return { basket, isNew: true };
|
||||||
|
}
|
||||||
|
|
||||||
|
export const GET: RequestHandler = async ({ cookies }) => {
|
||||||
|
const pb = await getAdminPb();
|
||||||
|
await sweepExpiredHolds(pb);
|
||||||
|
const { basket } = await resolveBasket(pb, cookies, false);
|
||||||
|
return json({ basket });
|
||||||
|
};
|
||||||
|
|
||||||
|
export const POST: RequestHandler = async ({ request, cookies }) => {
|
||||||
|
const pb = await getAdminPb();
|
||||||
|
await sweepExpiredHolds(pb);
|
||||||
|
|
||||||
|
let body: Record<string, unknown>;
|
||||||
|
try {
|
||||||
|
body = await request.json();
|
||||||
|
} catch {
|
||||||
|
throw error(400, 'Invalid JSON body');
|
||||||
|
}
|
||||||
|
|
||||||
|
const action = String(body.action || '');
|
||||||
|
|
||||||
|
// All mutations need a basket — lazily created on first add.
|
||||||
|
const { basket } = await resolveBasket(pb, cookies, action === 'add_item' || action === 'add_slot');
|
||||||
|
if (!basket) throw error(400, 'No active basket — add an item first');
|
||||||
|
|
||||||
|
switch (action) {
|
||||||
|
case 'add_item': {
|
||||||
|
const itemId = String(body.itemId || '');
|
||||||
|
const quantity = Math.max(1, Number(body.quantity) || 1);
|
||||||
|
if (!itemId) throw error(400, 'itemId is required');
|
||||||
|
|
||||||
|
const item = await pb.collection('items').getOne(itemId).catch(() => null);
|
||||||
|
if (!item || !item.active) throw error(404, 'Item not found');
|
||||||
|
if (item.type !== 'item') throw error(400, 'Use add_slot for bookable services');
|
||||||
|
|
||||||
|
const existing = basket.lines.find((l) => l.lineType === 'item' && l.item === itemId);
|
||||||
|
const newQty = (existing?.quantity ?? 0) + quantity;
|
||||||
|
if (item.stock != null && newQty > item.stock) {
|
||||||
|
throw error(409, `Only ${item.stock} in stock`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (existing) {
|
||||||
|
await pb.collection('basket_lines').update(existing.id, { quantity: newQty });
|
||||||
|
} else {
|
||||||
|
await pb.collection('basket_lines').create({
|
||||||
|
basket: basket.id,
|
||||||
|
item: itemId,
|
||||||
|
quantity,
|
||||||
|
lineType: 'item'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'add_slot': {
|
||||||
|
const slotId = String(body.slotId || '');
|
||||||
|
if (!slotId) throw error(400, 'slotId is required');
|
||||||
|
|
||||||
|
if (basket.lines.some((l) => l.slot === slotId)) {
|
||||||
|
throw error(409, 'Slot already in your basket');
|
||||||
|
}
|
||||||
|
|
||||||
|
const slot = await pb.collection('slots').getOne(slotId).catch(() => null);
|
||||||
|
if (!slot) throw error(404, 'Slot not found');
|
||||||
|
if (slot.status !== 'available') throw error(409, 'Slot is no longer available');
|
||||||
|
|
||||||
|
// Atomic guard: basket_lines.slot has a partial UNIQUE index, so two
|
||||||
|
// concurrent requests cannot both create a line for the same slot.
|
||||||
|
// The line is created first; whoever loses the race gets a 409.
|
||||||
|
let line;
|
||||||
|
try {
|
||||||
|
line = await pb.collection('basket_lines').create({
|
||||||
|
basket: basket.id,
|
||||||
|
item: slot.item,
|
||||||
|
slot: slotId,
|
||||||
|
quantity: 1,
|
||||||
|
lineType: 'slot'
|
||||||
|
});
|
||||||
|
} catch {
|
||||||
|
throw error(409, 'Slot was just reserved by someone else');
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await pb.collection('slots').update(slotId, {
|
||||||
|
status: 'held',
|
||||||
|
heldUntil: new Date(Date.now() + SLOT_HOLD_MS).toISOString()
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
// Roll back the line if the hold update failed
|
||||||
|
await pb.collection('basket_lines').delete(line.id).catch(() => {});
|
||||||
|
throw error(500, 'Could not reserve the slot — please try again');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'update_quantity': {
|
||||||
|
const lineId = String(body.lineId || '');
|
||||||
|
const quantity = Number(body.quantity);
|
||||||
|
const line = basket.lines.find((l) => l.id === lineId);
|
||||||
|
if (!line) throw error(404, 'Line not found in your basket');
|
||||||
|
if (line.lineType === 'slot') throw error(400, 'Slot lines have fixed quantity 1');
|
||||||
|
if (!Number.isInteger(quantity) || quantity < 1) throw error(400, 'Quantity must be a positive integer');
|
||||||
|
|
||||||
|
const item = await pb.collection('items').getOne(line.item).catch(() => null);
|
||||||
|
if (item?.stock != null && quantity > item.stock) {
|
||||||
|
throw error(409, `Only ${item.stock} in stock`);
|
||||||
|
}
|
||||||
|
await pb.collection('basket_lines').update(lineId, { quantity });
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'remove_line': {
|
||||||
|
const lineId = String(body.lineId || '');
|
||||||
|
const line = basket.lines.find((l) => l.id === lineId);
|
||||||
|
if (!line) throw error(404, 'Line not found in your basket');
|
||||||
|
await pb.collection('basket_lines').delete(lineId);
|
||||||
|
await releaseLineHold(pb, line);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw error(400, `Unknown action: ${action}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
await touchBasket(pb, basket.id);
|
||||||
|
const updated = await loadBasket(pb, basket.id);
|
||||||
|
return json({ basket: updated });
|
||||||
|
};
|
||||||
102
app/src/routes/api/checkout/create-intent/+server.ts
Normal file
102
app/src/routes/api/checkout/create-intent/+server.ts
Normal file
|
|
@ -0,0 +1,102 @@
|
||||||
|
import { json, error } from '@sveltejs/kit';
|
||||||
|
import type { RequestHandler } from './$types';
|
||||||
|
import { getAdminPb } from '$lib/server/pb-admin';
|
||||||
|
import { BASKET_COOKIE, SLOT_CHECKOUT_HOLD_MS, sweepExpiredHolds, loadBasket, extendBasketHolds } from '$lib/server/basket';
|
||||||
|
import { getStripe, getCurrency } from '$lib/stripe.server';
|
||||||
|
import type { CustomerDetails } from '$lib/types';
|
||||||
|
|
||||||
|
export const POST: RequestHandler = async ({ request, cookies }) => {
|
||||||
|
const pb = await getAdminPb();
|
||||||
|
|
||||||
|
const basketId = cookies.get(BASKET_COOKIE);
|
||||||
|
// Payment is starting — extend any held slots to the checkout hold (30 min)
|
||||||
|
// so a booked service survives the customer entering card details or
|
||||||
|
// retrying a declined card. Extend BEFORE sweeping so a slot whose hold
|
||||||
|
// just lapsed is rescued rather than released at the moment they try to pay.
|
||||||
|
if (basketId) await extendBasketHolds(pb, basketId, SLOT_CHECKOUT_HOLD_MS);
|
||||||
|
await sweepExpiredHolds(pb);
|
||||||
|
|
||||||
|
if (!basketId) throw error(400, 'No active basket');
|
||||||
|
const basket = await loadBasket(pb, basketId);
|
||||||
|
if (!basket) throw error(400, 'Your session has expired — please re-select your items');
|
||||||
|
if (!basket.lines.length) throw error(400, 'Your basket is empty — a time slot you selected may have expired. Please pick a slot from the shop and try again.');
|
||||||
|
|
||||||
|
let body: Record<string, unknown>;
|
||||||
|
try {
|
||||||
|
body = await request.json();
|
||||||
|
} catch {
|
||||||
|
throw error(400, 'Invalid JSON body');
|
||||||
|
}
|
||||||
|
|
||||||
|
const customer: CustomerDetails = {
|
||||||
|
name: String(body.name || '').trim(),
|
||||||
|
email: String(body.email || '').trim(),
|
||||||
|
phone: String(body.phone || '').trim(),
|
||||||
|
notes: String(body.notes || '').trim()
|
||||||
|
};
|
||||||
|
if (!customer.name) throw error(400, 'Name is required');
|
||||||
|
if (!customer.email || !/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(customer.email)) {
|
||||||
|
throw error(400, 'A valid email is required');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-validate every line server-side (source of truth for the total).
|
||||||
|
let totalCents = 0;
|
||||||
|
for (const line of basket.lines) {
|
||||||
|
const item = await pb.collection('items').getOne(line.item).catch(() => null);
|
||||||
|
if (!item || !item.active) throw error(409, `"${line.itemName ?? 'An item'}" is no longer available`);
|
||||||
|
|
||||||
|
if (line.lineType === 'slot') {
|
||||||
|
const slot = await pb.collection('slots').getOne(line.slot!).catch(() => null);
|
||||||
|
if (!slot || slot.status !== 'held') {
|
||||||
|
throw error(409, `Your time slot for "${item.name}" has expired — please pick it again`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (item.stock != null && item.stock < line.quantity) {
|
||||||
|
throw error(409, `Only ${item.stock} of "${item.name}" left in stock`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
totalCents += Math.round(item.price * 100) * line.quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (totalCents <= 0) throw error(400, 'Basket total must be positive');
|
||||||
|
|
||||||
|
let paymentIntent;
|
||||||
|
if (basket.stripePaymentIntentId) {
|
||||||
|
// Reuse an existing intent when possible (page reload / retry).
|
||||||
|
try {
|
||||||
|
const existing = await getStripe().paymentIntents.retrieve(basket.stripePaymentIntentId);
|
||||||
|
if (existing.status === 'requires_payment_method' || existing.status === 'requires_confirmation') {
|
||||||
|
paymentIntent = await getStripe().paymentIntents.update(existing.id, {
|
||||||
|
amount: totalCents,
|
||||||
|
metadata: { basket_id: basket.id }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// Intent missing/invalid — fall through and create a new one
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!paymentIntent) {
|
||||||
|
paymentIntent = await getStripe().paymentIntents.create({
|
||||||
|
amount: totalCents,
|
||||||
|
currency: getCurrency(),
|
||||||
|
automatic_payment_methods: { enabled: true },
|
||||||
|
receipt_email: customer.email,
|
||||||
|
metadata: {
|
||||||
|
basket_id: basket.id,
|
||||||
|
line_summary: basket.lines
|
||||||
|
.map((l) => `${l.quantity}× ${l.itemName ?? l.item}`)
|
||||||
|
.join('; ')
|
||||||
|
.slice(0, 450)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
await pb.collection('baskets').update(basket.id, {
|
||||||
|
stripePaymentIntentId: paymentIntent.id,
|
||||||
|
email: customer.email,
|
||||||
|
customerDetails: customer
|
||||||
|
});
|
||||||
|
|
||||||
|
return json({ clientSecret: paymentIntent.client_secret });
|
||||||
|
};
|
||||||
122
app/src/routes/api/webhooks/stripe/+server.ts
Normal file
122
app/src/routes/api/webhooks/stripe/+server.ts
Normal file
|
|
@ -0,0 +1,122 @@
|
||||||
|
import { json, error } from '@sveltejs/kit';
|
||||||
|
import type { RequestHandler } from './$types';
|
||||||
|
import { env } from '$env/dynamic/private';
|
||||||
|
import { getStripe } from '$lib/stripe.server';
|
||||||
|
import { getAdminPb } from '$lib/server/pb-admin';
|
||||||
|
import { getFileUrl } from '$lib/pb';
|
||||||
|
import { SLOT_HOLD_MS, extendBasketHolds } from '$lib/server/basket';
|
||||||
|
import type PocketBase from 'pocketbase';
|
||||||
|
|
||||||
|
async function handlePaymentSucceeded(pb: PocketBase, paymentIntent: any) {
|
||||||
|
const basketId = paymentIntent.metadata?.basket_id;
|
||||||
|
if (!basketId) return; // Not one of ours
|
||||||
|
|
||||||
|
// Idempotency: if an order already exists for this intent, we're done.
|
||||||
|
const existing = await pb
|
||||||
|
.collection('orders')
|
||||||
|
.getFirstListItem(`stripePaymentIntentId = "${paymentIntent.id}"`)
|
||||||
|
.catch(() => null);
|
||||||
|
if (existing) return;
|
||||||
|
|
||||||
|
const basket = await pb.collection('baskets').getOne(basketId).catch(() => null);
|
||||||
|
if (!basket) return;
|
||||||
|
|
||||||
|
const lines = await pb
|
||||||
|
.collection('basket_lines')
|
||||||
|
.getFullList({ filter: `basket = "${basketId}"`, expand: 'item,slot' });
|
||||||
|
|
||||||
|
// Create the order
|
||||||
|
const order = await pb.collection('orders').create({
|
||||||
|
basket: basketId,
|
||||||
|
email: basket.email || paymentIntent.receipt_email || '',
|
||||||
|
customerDetails: basket.customerDetails || {},
|
||||||
|
total: paymentIntent.amount / 100,
|
||||||
|
status: 'paid',
|
||||||
|
stripePaymentIntentId: paymentIntent.id
|
||||||
|
});
|
||||||
|
|
||||||
|
// Snapshot order lines, flip slots to booked, decrement item stock
|
||||||
|
for (const line of lines) {
|
||||||
|
const item = line.expand?.item;
|
||||||
|
const slot = line.expand?.slot;
|
||||||
|
await pb.collection('order_lines').create({
|
||||||
|
order: order.id,
|
||||||
|
item: line.item,
|
||||||
|
slot: line.slot || null,
|
||||||
|
quantity: line.quantity,
|
||||||
|
lineType: line.lineType,
|
||||||
|
name: item?.name ?? 'Unknown item',
|
||||||
|
price: item?.price ?? 0,
|
||||||
|
start: slot?.start || null
|
||||||
|
});
|
||||||
|
|
||||||
|
if (line.lineType === 'slot' && line.slot) {
|
||||||
|
await pb
|
||||||
|
.collection('slots')
|
||||||
|
.update(line.slot, { status: 'booked', heldUntil: null, order: order.id })
|
||||||
|
.catch(() => {});
|
||||||
|
} else if (line.lineType === 'item' && item?.stock != null) {
|
||||||
|
await pb
|
||||||
|
.collection('items')
|
||||||
|
.update(item.id, { stock: Math.max(0, item.stock - line.quantity) })
|
||||||
|
.catch(() => {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Basket completed — lines can go (order_lines hold the snapshot).
|
||||||
|
for (const line of lines) {
|
||||||
|
await pb.collection('basket_lines').delete(line.id).catch(() => {});
|
||||||
|
}
|
||||||
|
await pb.collection('baskets').update(basketId, { status: 'completed' }).catch(() => {});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handlePaymentFailed(pb: PocketBase, paymentIntent: any) {
|
||||||
|
const basketId = paymentIntent.metadata?.basket_id;
|
||||||
|
if (!basketId) return;
|
||||||
|
|
||||||
|
// The card was refused (or the payment otherwise failed). Keep the slots
|
||||||
|
// held for the customer so they can retry without re-picking them — just
|
||||||
|
// reset the hold to the standard 10-minute window. Starting payment again
|
||||||
|
// (create-intent) will extend it back to 30 min.
|
||||||
|
await extendBasketHolds(pb, basketId, SLOT_HOLD_MS).catch(() => {});
|
||||||
|
|
||||||
|
if (paymentIntent.id) {
|
||||||
|
await pb
|
||||||
|
.collection('baskets')
|
||||||
|
.update(basketId, { stripePaymentIntentId: null })
|
||||||
|
.catch(() => {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const POST: RequestHandler = async ({ request }) => {
|
||||||
|
const secret = env.STRIPE_WEBHOOK_SECRET;
|
||||||
|
if (!secret) throw error(500, 'STRIPE_WEBHOOK_SECRET is not configured');
|
||||||
|
|
||||||
|
// Signature verification MUST use the raw request body.
|
||||||
|
const body = await request.text();
|
||||||
|
const signature = request.headers.get('stripe-signature');
|
||||||
|
if (!signature) throw error(400, 'Missing Stripe-Signature header');
|
||||||
|
|
||||||
|
let event;
|
||||||
|
try {
|
||||||
|
event = getStripe().webhooks.constructEvent(body, signature, secret);
|
||||||
|
} catch (e) {
|
||||||
|
throw error(400, `Webhook signature verification failed: ${e instanceof Error ? e.message : 'unknown'}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const pb = await getAdminPb();
|
||||||
|
|
||||||
|
switch (event.type) {
|
||||||
|
case 'payment_intent.succeeded':
|
||||||
|
await handlePaymentSucceeded(pb, event.data.object);
|
||||||
|
break;
|
||||||
|
case 'payment_intent.payment_failed':
|
||||||
|
await handlePaymentFailed(pb, event.data.object);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// Unhandled event types are fine — acknowledge receipt.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return json({ received: true });
|
||||||
|
};
|
||||||
64
app/src/routes/checkout/return/+page.server.ts
Normal file
64
app/src/routes/checkout/return/+page.server.ts
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
import type { PageServerLoad } from './$types';
|
||||||
|
import { getStripe } from '$lib/stripe.server';
|
||||||
|
import { getAdminPb } from '$lib/server/pb-admin';
|
||||||
|
import { BASKET_COOKIE } from '$lib/server/basket';
|
||||||
|
import type { OrderRecord } from '$lib/types';
|
||||||
|
|
||||||
|
export const load: PageServerLoad = async ({ url, cookies }) => {
|
||||||
|
const intentId = url.searchParams.get('payment_intent');
|
||||||
|
if (!intentId) return { state: 'missing' as const };
|
||||||
|
|
||||||
|
let intent;
|
||||||
|
try {
|
||||||
|
intent = await getStripe().paymentIntents.retrieve(intentId);
|
||||||
|
} catch {
|
||||||
|
return { state: 'invalid' as const };
|
||||||
|
}
|
||||||
|
|
||||||
|
const pb = await getAdminPb();
|
||||||
|
|
||||||
|
// Webhook may not have landed yet — the webhook is the source of truth.
|
||||||
|
const order = await pb
|
||||||
|
.collection('orders')
|
||||||
|
.getFirstListItem(`stripePaymentIntentId = "${intentId}"`)
|
||||||
|
.catch(() => null);
|
||||||
|
|
||||||
|
if (!order) {
|
||||||
|
// Payment succeeded but webhook is still in flight.
|
||||||
|
if (intent.status === 'succeeded') return { state: 'processing' as const };
|
||||||
|
return { state: intent.status === 'canceled' ? ('canceled' as const) : ('failed' as const) };
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort by id, not 'created' — the order_lines collection was imported without
|
||||||
|
// autodate fields. PocketBase ids are time-sortable ULIDs, so this preserves
|
||||||
|
// chronological order without requiring a schema migration.
|
||||||
|
const orderLines = await pb
|
||||||
|
.collection('order_lines')
|
||||||
|
.getFullList({ filter: `order = "${order.id}"`, sort: 'id' });
|
||||||
|
|
||||||
|
cookies.delete(BASKET_COOKIE, { path: '/' });
|
||||||
|
|
||||||
|
const result: OrderRecord = {
|
||||||
|
id: order.id,
|
||||||
|
basket: order.basket,
|
||||||
|
email: order.email,
|
||||||
|
customerDetails: order.customerDetails,
|
||||||
|
total: order.total,
|
||||||
|
status: order.status,
|
||||||
|
stripePaymentIntentId: order.stripePaymentIntentId,
|
||||||
|
createdAt: order.created,
|
||||||
|
lines: orderLines.map((l) => ({
|
||||||
|
id: l.id,
|
||||||
|
order: l.order,
|
||||||
|
item: l.item,
|
||||||
|
slot: l.slot || null,
|
||||||
|
quantity: l.quantity,
|
||||||
|
lineType: l.lineType,
|
||||||
|
name: l.name,
|
||||||
|
price: l.price,
|
||||||
|
start: l.start || null
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
|
return { state: 'paid' as const, order: result };
|
||||||
|
};
|
||||||
72
app/src/routes/checkout/return/+page.svelte
Normal file
72
app/src/routes/checkout/return/+page.svelte
Normal file
|
|
@ -0,0 +1,72 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
|
let { data } = $props();
|
||||||
|
|
||||||
|
function formatSlotDate(iso?: string | null) {
|
||||||
|
if (!iso) return '';
|
||||||
|
return new Date(iso).toLocaleString(undefined, {
|
||||||
|
weekday: 'long',
|
||||||
|
month: 'long',
|
||||||
|
day: 'numeric',
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatPrice(amount: number) {
|
||||||
|
return new Intl.NumberFormat(undefined, { style: 'currency', currency: 'EUR' }).format(amount);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<svelte:head>
|
||||||
|
<title>Booking confirmation</title>
|
||||||
|
</svelte:head>
|
||||||
|
|
||||||
|
<section class="mx-auto max-w-2xl px-6 py-16 text-center">
|
||||||
|
{#if data.state === 'paid' && data.order}
|
||||||
|
<div class="mb-6 inline-grid h-16 w-16 place-items-center rounded-full bg-sage text-3xl text-white">✓</div>
|
||||||
|
<h1 class="font-serif text-4xl">Thank you, {data.order.customerDetails?.name || 'friend'}!</h1>
|
||||||
|
<p class="mt-3 text-charcoal/70">
|
||||||
|
Your booking is confirmed. A receipt was sent to <strong>{data.order.email}</strong>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="mt-8 rounded-box border border-charcoal/10 bg-white/60 p-6 text-left">
|
||||||
|
<h2 class="font-serif text-xl">Your order</h2>
|
||||||
|
<ul class="mt-4 space-y-3">
|
||||||
|
{#each data.order.lines ?? [] as line}
|
||||||
|
<li class="flex items-baseline justify-between gap-4">
|
||||||
|
<div>
|
||||||
|
<span class="font-semibold">{line.quantity}× {line.name}</span>
|
||||||
|
{#if line.start}
|
||||||
|
<div class="text-sm text-charcoal/60">{formatSlotDate(line.start)}</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
<span>{formatPrice(line.price * line.quantity)}</span>
|
||||||
|
</li>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
|
<div class="mt-4 flex justify-between border-t border-charcoal/10 pt-4 font-bold">
|
||||||
|
<span>Total</span><span>{formatPrice(data.order.total)}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a class="btn mt-8 rounded-full border-0 px-8 text-white" style="background-color: var(--color-primary, #8a9a7b);" href="/">Book another</a>
|
||||||
|
{:else if data.state === 'processing'}
|
||||||
|
<h1 class="font-serif text-4xl">Processing your payment…</h1>
|
||||||
|
<p class="mt-3 text-charcoal/70">
|
||||||
|
Your payment went through — we're just finalizing your booking. This page refreshes automatically.
|
||||||
|
</p>
|
||||||
|
<span class="loading loading-spinner loading-lg mt-6 text-sage"></span>
|
||||||
|
<!-- Auto-reload until the webhook has created the order -->
|
||||||
|
<meta http-equiv="refresh" content="4" />
|
||||||
|
{:else if data.state === 'canceled' || data.state === 'failed'}
|
||||||
|
<h1 class="font-serif text-4xl">Payment not completed</h1>
|
||||||
|
<p class="mt-3 text-charcoal/70">Your payment didn't go through — no money was captured. Please try again.</p>
|
||||||
|
<a class="btn mt-8 rounded-full border-0 px-8 text-white" style="background-color: var(--color-primary, #8a9a7b);" href="/">Back to the shop</a>
|
||||||
|
{:else}
|
||||||
|
<h1 class="font-serif text-4xl">Nothing to see here</h1>
|
||||||
|
<p class="mt-3 text-charcoal/70">This link is missing a payment reference.</p>
|
||||||
|
<a class="btn mt-8 rounded-full border-0 px-8 text-white" style="background-color: var(--color-primary, #8a9a7b);" href="/">Back to the shop</a>
|
||||||
|
{/if}
|
||||||
|
</section>
|
||||||
17
bun.lock
Normal file
17
bun.lock
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"lockfileVersion": 1,
|
||||||
|
"configVersion": 1,
|
||||||
|
"workspaces": {
|
||||||
|
"": {
|
||||||
|
"dependencies": {
|
||||||
|
"@stripe/stripe-js": "^9.12.1",
|
||||||
|
"stripe": "^22.3.2",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"packages": {
|
||||||
|
"@stripe/stripe-js": ["@stripe/stripe-js@9.12.1", "", {}, "sha512-KLXPvjA0BfS4dQnW+ddHjwtIXMnIfKYxqmeNMmQCfKjvYog0cSG+Z7ZvK4RH1+bV90GC07nUztWDRWmJLi5HZQ=="],
|
||||||
|
|
||||||
|
"stripe": ["stripe@22.3.2", "", { "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-O13QOvgEIQvDlTy6Ubb5kB980wpbhmoZNsgCXKILjCMZS67f+bW+6w99k3gnSi/N1lkryoj1WYdpGT5Wc5edjg=="],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -21,7 +21,14 @@ services:
|
||||||
POCKETBASE_INTERNAL_URL: http://pocketbase:80
|
POCKETBASE_INTERNAL_URL: http://pocketbase:80
|
||||||
PUBLIC_POCKETBASE_URL: http://localhost:8080
|
PUBLIC_POCKETBASE_URL: http://localhost:8080
|
||||||
ORIGIN: http://localhost:8080
|
ORIGIN: http://localhost:8080
|
||||||
BODY_SIZE_LIMIT: 5242880 # 5MB
|
BODY_SIZE_LIMIT: 52428800 # 50MB — import payload embeds all images as base64
|
||||||
|
# Commerce (reservation & payment system) — set these in a root-level .env
|
||||||
|
POCKETBASE_ADMIN_EMAIL: ${POCKETBASE_ADMIN_EMAIL:-}
|
||||||
|
POCKETBASE_ADMIN_PASSWORD: ${POCKETBASE_ADMIN_PASSWORD:-}
|
||||||
|
STRIPE_SECRET_KEY: ${STRIPE_SECRET_KEY:-}
|
||||||
|
STRIPE_WEBHOOK_SECRET: ${STRIPE_WEBHOOK_SECRET:-}
|
||||||
|
PUBLIC_STRIPE_PUBLISHABLE_KEY: ${PUBLIC_STRIPE_PUBLISHABLE_KEY:-}
|
||||||
|
STRIPE_CURRENCY: ${STRIPE_CURRENCY:-eur}
|
||||||
# Internal only — served via the caddy reverse proxy
|
# Internal only — served via the caddy reverse proxy
|
||||||
expose:
|
expose:
|
||||||
- "3000"
|
- "3000"
|
||||||
|
|
@ -33,7 +40,7 @@ services:
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "8080:8080"
|
||||||
volumes:
|
volumes:
|
||||||
- ./Caddyfile:/etc/caddy/Caddyfile:ro
|
- ./Caddyfile:/etc/caddy/Caddyfile:ro,Z
|
||||||
depends_on:
|
depends_on:
|
||||||
- app
|
- app
|
||||||
- pocketbase
|
- pocketbase
|
||||||
|
|
|
||||||
147
pb_schema.json
147
pb_schema.json
|
|
@ -290,5 +290,152 @@
|
||||||
"CREATE INDEX `idx_events_published` ON `events` (`published`)"
|
"CREATE INDEX `idx_events_published` ON `events` (`published`)"
|
||||||
],
|
],
|
||||||
"options": {}
|
"options": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "pbc_items00001",
|
||||||
|
"name": "items",
|
||||||
|
"type": "base",
|
||||||
|
"system": false,
|
||||||
|
"listRule": "active = true || @request.auth.id != ''",
|
||||||
|
"viewRule": "active = true || @request.auth.id != ''",
|
||||||
|
"createRule": "@request.auth.id != ''",
|
||||||
|
"updateRule": "@request.auth.id != ''",
|
||||||
|
"deleteRule": "@request.auth.id != ''",
|
||||||
|
"fields": [
|
||||||
|
{ "id": "text_itemname01", "name": "name", "type": "text", "system": false, "required": true, "presentable": true, "unique": false, "options": { "min": null, "max": 180, "pattern": "" } },
|
||||||
|
{ "id": "text_itemdesc01", "name": "description", "type": "text", "system": false, "required": false, "presentable": false, "unique": false, "options": { "min": null, "max": 2000, "pattern": "" } },
|
||||||
|
{ "id": "num_itemprice01", "name": "price", "type": "number", "system": false, "required": true, "presentable": false, "unique": false, "options": { "min": 0, "max": null } },
|
||||||
|
{ "id": "rel_itemimage01", "name": "image", "type": "relation", "system": false, "required": false, "presentable": false, "unique": false, "collectionId": "pbc_media00001", "cascadeDelete": false, "minSelect": 0, "maxSelect": 1, "displayFields": null },
|
||||||
|
{ "id": "sel_itemtype001", "name": "type", "type": "select", "system": false, "required": true, "presentable": false, "unique": false, "maxSelect": 1, "values": ["item", "item_with_time"] },
|
||||||
|
{ "id": "num_itemstock01", "name": "stock", "type": "number", "system": false, "required": false, "presentable": false, "unique": false, "options": { "min": 0, "max": null } },
|
||||||
|
{ "id": "num_itemdur0001", "name": "duration", "type": "number", "system": false, "required": false, "presentable": false, "unique": false, "options": { "min": 1, "max": null } },
|
||||||
|
{ "id": "bool_itemactive", "name": "active", "type": "bool", "system": false, "required": false, "presentable": false, "unique": false, "options": {} }
|
||||||
|
],
|
||||||
|
"indexes": [],
|
||||||
|
"autodate": true,
|
||||||
|
"options": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "pbc_slots00001",
|
||||||
|
"name": "slots",
|
||||||
|
"type": "base",
|
||||||
|
"system": false,
|
||||||
|
"listRule": "status = 'available' || @request.auth.id != ''",
|
||||||
|
"viewRule": "status = 'available' || @request.auth.id != ''",
|
||||||
|
"createRule": "@request.auth.id != ''",
|
||||||
|
"updateRule": "@request.auth.id != ''",
|
||||||
|
"deleteRule": "@request.auth.id != ''",
|
||||||
|
"fields": [
|
||||||
|
{ "id": "rel_slotitem001", "name": "item", "type": "relation", "system": false, "required": true, "presentable": false, "unique": false, "collectionId": "pbc_items00001", "cascadeDelete": true, "minSelect": 0, "maxSelect": 1, "displayFields": null },
|
||||||
|
{ "id": "date_slotstart0", "name": "start", "type": "date", "system": false, "required": true, "presentable": false, "unique": false, "options": { "min": "", "max": "" } },
|
||||||
|
{ "id": "date_slotend000", "name": "end", "type": "date", "system": false, "required": false, "presentable": false, "unique": false, "options": { "min": "", "max": "" } },
|
||||||
|
{ "id": "sel_slotstatus0", "name": "status", "type": "select", "system": false, "required": true, "presentable": false, "unique": false, "maxSelect": 1, "values": ["available", "held", "booked"] },
|
||||||
|
{ "id": "date_slotheldun0", "name": "heldUntil", "type": "date", "system": false, "required": false, "presentable": false, "unique": false, "options": { "min": "", "max": "" } },
|
||||||
|
{ "id": "rel_slotorder01", "name": "order", "type": "relation", "system": false, "required": false, "presentable": false, "unique": false, "collectionId": "pbc_orders00001", "cascadeDelete": false, "minSelect": 0, "maxSelect": 1, "displayFields": null },
|
||||||
|
{ "id": "text_slotnotes0", "name": "notes", "type": "text", "system": false, "required": false, "presentable": false, "unique": false, "options": { "min": null, "max": 500, "pattern": "" } }
|
||||||
|
],
|
||||||
|
"indexes": [
|
||||||
|
"CREATE INDEX `idx_slots_item_start` ON `slots` (`item`, `start`)",
|
||||||
|
"CREATE INDEX `idx_slots_status` ON `slots` (`status`)"
|
||||||
|
],
|
||||||
|
"autodate": true,
|
||||||
|
"options": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "pbc_baskets0001",
|
||||||
|
"name": "baskets",
|
||||||
|
"type": "base",
|
||||||
|
"system": false,
|
||||||
|
"listRule": "@request.auth.id != ''",
|
||||||
|
"viewRule": "@request.auth.id != ''",
|
||||||
|
"createRule": "",
|
||||||
|
"updateRule": "",
|
||||||
|
"deleteRule": "@request.auth.id != ''",
|
||||||
|
"fields": [
|
||||||
|
{ "id": "sel_basketstat0", "name": "status", "type": "select", "system": false, "required": true, "presentable": false, "unique": false, "maxSelect": 1, "values": ["active", "completed", "abandoned"] },
|
||||||
|
{ "id": "date_basketexp0", "name": "expiresAt", "type": "date", "system": false, "required": true, "presentable": false, "unique": false, "options": { "min": "", "max": "" } },
|
||||||
|
{ "id": "text_basketemai", "name": "email", "type": "text", "system": false, "required": false, "presentable": false, "unique": false, "options": { "min": null, "max": 254, "pattern": "" } },
|
||||||
|
{ "id": "json_basketcust", "name": "customerDetails", "type": "json", "system": false, "required": false, "presentable": false, "unique": false, "options": { "maxSize": 100000 } },
|
||||||
|
{ "id": "text_basketstrip", "name": "stripePaymentIntentId", "type": "text", "system": false, "required": false, "presentable": false, "unique": false, "options": { "min": null, "max": 200, "pattern": "" } }
|
||||||
|
],
|
||||||
|
"indexes": [
|
||||||
|
"CREATE INDEX `idx_baskets_status` ON `baskets` (`status`)"
|
||||||
|
],
|
||||||
|
"autodate": true,
|
||||||
|
"options": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "pbc_basketlines1",
|
||||||
|
"name": "basket_lines",
|
||||||
|
"type": "base",
|
||||||
|
"system": false,
|
||||||
|
"listRule": "@request.auth.id != ''",
|
||||||
|
"viewRule": "@request.auth.id != ''",
|
||||||
|
"createRule": "",
|
||||||
|
"updateRule": "",
|
||||||
|
"deleteRule": "",
|
||||||
|
"fields": [
|
||||||
|
{ "id": "rel_blbasket0001", "name": "basket", "type": "relation", "system": false, "required": true, "presentable": false, "unique": false, "collectionId": "pbc_baskets0001", "cascadeDelete": true, "minSelect": 0, "maxSelect": 1, "displayFields": null },
|
||||||
|
{ "id": "rel_blitem000001", "name": "item", "type": "relation", "system": false, "required": true, "presentable": false, "unique": false, "collectionId": "pbc_items00001", "cascadeDelete": false, "minSelect": 0, "maxSelect": 1, "displayFields": null },
|
||||||
|
{ "id": "rel_blslot000001", "name": "slot", "type": "relation", "system": false, "required": false, "presentable": false, "unique": false, "collectionId": "pbc_slots00001", "cascadeDelete": false, "minSelect": 0, "maxSelect": 1, "displayFields": null },
|
||||||
|
{ "id": "num_blquantity01", "name": "quantity", "type": "number", "system": false, "required": true, "presentable": false, "unique": false, "options": { "min": 1, "max": null } },
|
||||||
|
{ "id": "sel_bllinetype01", "name": "lineType", "type": "select", "system": false, "required": true, "presentable": false, "unique": false, "maxSelect": 1, "values": ["item", "slot"] }
|
||||||
|
],
|
||||||
|
"indexes": [
|
||||||
|
"CREATE INDEX `idx_basket_lines_basket` ON `basket_lines` (`basket`)",
|
||||||
|
"CREATE UNIQUE INDEX `idx_basket_lines_slot_unique` ON `basket_lines` (`slot`) WHERE `slot` != ''"
|
||||||
|
],
|
||||||
|
"autodate": true,
|
||||||
|
"options": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "pbc_orders00001",
|
||||||
|
"name": "orders",
|
||||||
|
"type": "base",
|
||||||
|
"system": false,
|
||||||
|
"listRule": "@request.auth.id != ''",
|
||||||
|
"viewRule": "@request.auth.id != ''",
|
||||||
|
"createRule": "",
|
||||||
|
"updateRule": "@request.auth.id != ''",
|
||||||
|
"deleteRule": "@request.auth.id != ''",
|
||||||
|
"fields": [
|
||||||
|
{ "id": "rel_orderbasket0", "name": "basket", "type": "relation", "system": false, "required": true, "presentable": false, "unique": false, "collectionId": "pbc_baskets0001", "cascadeDelete": false, "minSelect": 0, "maxSelect": 1, "displayFields": null },
|
||||||
|
{ "id": "text_orderemail0", "name": "email", "type": "text", "system": false, "required": true, "presentable": false, "unique": false, "options": { "min": null, "max": 254, "pattern": "" } },
|
||||||
|
{ "id": "json_ordercustde", "name": "customerDetails", "type": "json", "system": false, "required": false, "presentable": false, "unique": false, "options": { "maxSize": 100000 } },
|
||||||
|
{ "id": "num_ordertotal01", "name": "total", "type": "number", "system": false, "required": true, "presentable": false, "unique": false, "options": { "min": 0, "max": null } },
|
||||||
|
{ "id": "sel_orderstatus0", "name": "status", "type": "select", "system": false, "required": true, "presentable": false, "unique": false, "maxSelect": 1, "values": ["pending", "paid", "refunded"] },
|
||||||
|
{ "id": "text_orderstripe0", "name": "stripePaymentIntentId", "type": "text", "system": false, "required": true, "presentable": false, "unique": false, "options": { "min": null, "max": 200, "pattern": "" } }
|
||||||
|
],
|
||||||
|
"indexes": [
|
||||||
|
"CREATE INDEX `idx_orders_basket` ON `orders` (`basket`)"
|
||||||
|
],
|
||||||
|
"autodate": true,
|
||||||
|
"options": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "pbc_orderlines01",
|
||||||
|
"name": "order_lines",
|
||||||
|
"type": "base",
|
||||||
|
"system": false,
|
||||||
|
"listRule": "@request.auth.id != ''",
|
||||||
|
"viewRule": "@request.auth.id != ''",
|
||||||
|
"createRule": "",
|
||||||
|
"updateRule": "",
|
||||||
|
"deleteRule": "",
|
||||||
|
"fields": [
|
||||||
|
{ "id": "rel_olorder00001", "name": "order", "type": "relation", "system": false, "required": true, "presentable": false, "unique": false, "collectionId": "pbc_orders00001", "cascadeDelete": true, "minSelect": 0, "maxSelect": 1, "displayFields": null },
|
||||||
|
{ "id": "rel_olitem000001", "name": "item", "type": "relation", "system": false, "required": true, "presentable": false, "unique": false, "collectionId": "pbc_items00001", "cascadeDelete": false, "minSelect": 0, "maxSelect": 1, "displayFields": null },
|
||||||
|
{ "id": "rel_olslot000001", "name": "slot", "type": "relation", "system": false, "required": false, "presentable": false, "unique": false, "collectionId": "pbc_slots00001", "cascadeDelete": false, "minSelect": 0, "maxSelect": 1, "displayFields": null },
|
||||||
|
{ "id": "num_olquantity01", "name": "quantity", "type": "number", "system": false, "required": true, "presentable": false, "unique": false, "options": { "min": 1, "max": null } },
|
||||||
|
{ "id": "sel_ollinetype01", "name": "lineType", "type": "select", "system": false, "required": true, "presentable": false, "unique": false, "maxSelect": 1, "values": ["item", "slot"] },
|
||||||
|
{ "id": "text_olname00001", "name": "name", "type": "text", "system": false, "required": true, "presentable": false, "unique": false, "options": { "min": null, "max": 180, "pattern": "" } },
|
||||||
|
{ "id": "num_olprice00001", "name": "price", "type": "number", "system": false, "required": true, "presentable": false, "unique": false, "options": { "min": 0, "max": null } },
|
||||||
|
{ "id": "date_olstart0001", "name": "start", "type": "date", "system": false, "required": false, "presentable": false, "unique": false, "options": { "min": "", "max": "" } }
|
||||||
|
],
|
||||||
|
"indexes": [
|
||||||
|
"CREATE INDEX `idx_order_lines_order` ON `order_lines` (`order`)"
|
||||||
|
],
|
||||||
|
"autodate": true,
|
||||||
|
"options": {}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue