diff --git a/.drone.yml b/.drone.yml index ca674dd..b3b6010 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3,6 +3,13 @@ type: docker name: Build Image steps: + - name: Quality gates + image: node:24-alpine + commands: + - npm ci + - npm audit --audit-level=high + - npm run check + - name: Build Docker Image image: plugins/docker settings: diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..9482c3d --- /dev/null +++ b/AGENTS.md @@ -0,0 +1 @@ +Read CONSTRAINTS.md before writing code. Do not weaken it to make a change pass. diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..201ffe0 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ +# Changelog + +## Phase 2 — 13 October 2026 + +- Add private addresses, versioned carts, reviewed/idempotent checkout, own and staff order history/details/cancellation. +- Add permission-gated user/role/audit, product/group/variant, finished-stock/warehouse/ledger/reservation, coupon and pricing tools. +- Add account recovery/reset with fragment-token removal. +- Fix decimal output compatibility, immediate private session cleanup, permission downgrade privacy and stale request/intent races. +- Add lazy routes, build-size gate, lint/component/workflow/accessibility tests, dependency audit in CI and Nginx security headers. +- Production acceptance still requires provisioned UAT accounts, approved pricing/SMTP and verified deployment/rollback. diff --git a/CONSTRAINTS.md b/CONSTRAINTS.md new file mode 100644 index 0000000..819ffc4 --- /dev/null +++ b/CONSTRAINTS.md @@ -0,0 +1,17 @@ +# Production quality constraints + +Reviewed 12 October 2026. User accepted strict types, workflow tests, security, keyboard/responsive and deployment/rollback checks; no UAT account is provisioned yet. + +| Gate | Required result | Evidence | +| ------------------- | ----------------------------------------------------------------------------------------------- | --------------------------------------------------- | +| Types | Zero errors, strict mode retained | npm run typecheck | +| Lint | Zero errors on source/tests | npm run lint | +| Tests | All contract/workflow/component tests pass; no skipped tests | npm test | +| Dependency security | Zero high/critical findings | npm audit --audit-level=high | +| Build | Successful; no oversized chunk warnings; each JS chunk below 500 kB | npm run build | +| Accessibility | Keyboard flows, labels/errors, contrast; zero serious/critical axe findings on tested routes | component accessibility tests and browser checklist | +| Responsive | No horizontal overflow at 320, 768, 1024, 1440 px | Browser UAT evidence | +| Deployment | Nginx validates; container/deep links/API verified; HTTPS ingress | container smoke checks + deployed UAT | +| Release | No unresolved critical/high defects; permissions/privacy/conflicts exercised; rollback verified | docs/RELEASE-CHECKLIST.md | + +No new type/lint suppressions, unimplemented stubs, disabled tests or secrets. Do not weaken these gates to make changes pass. Pending environment checks stay pending and block a production-ready claim. Backend business rules, tax/shipping policy approval, SMTP, account provisioning and deployment access remain explicit external gates. diff --git a/Dockerfile b/Dockerfile index 742193b..6fd1317 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ RUN npm ci COPY . . -RUN npm run typecheck && npm test && npm run build +RUN npm run check FROM nginx:alpine @@ -16,6 +16,7 @@ RUN apk add --no-cache ca-certificates COPY --from=build /app/dist /usr/share/nginx/html COPY nginx.conf /etc/nginx/conf.d/default.conf +RUN nginx -t EXPOSE 80 diff --git a/README.md b/README.md index 9ee1980..16d5d87 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Mani Candles frontend -The existing ManiCandles site upgraded against the deployed Nest API. Its purple/gold design, branding, and marketing pages are retained. Phase 1 connects catalog discovery, variants, staff sessions, organization setup and health checks. +The existing ManiCandles site upgraded against the deployed Nest API. Its purple/gold design, branding, and marketing pages are retained. Phase 2 adds customer commerce, permission-gated administration, account recovery and enforced release checks. ## Development @@ -29,6 +29,10 @@ The existing main-branch Drone pipeline deploys automatically on push. Work is o Storefront list returns only id/name/slug; details return prices/attributes/groups. The API has no product-media fields, so catalog cards use a generic branded placeholder rather than assigning local photos to unknown records. Existing marketing imagery remains intact. -Cart/checkout, registration and admin/operations tools are subsequent phases. There is no contact-message endpoint; simulated success was replaced with an availability notice. Newsletter signup awaits consent/messaging flows. +Addresses, cart/checkout, orders, catalog, access, stock, coupons and pricing tools are available after sign-in. Public registration and procurement/production/B2B tools remain subsequent phases. There is no contact-message endpoint; simulated success was replaced with an availability notice. Newsletter signup awaits consent/messaging flows. See [delivery phases](docs/PHASES.md) and [UAT evidence](docs/UAT-RESULTS.md). + +Phase 2 commands: `npm run check` runs lint, strict types, contract/component/workflow tests and the measured production build. Dependency security is checked with `npm audit --audit-level=high` in CI. See [Phase 2 evidence](docs/UAT-PHASE2.md) and [release checklist](docs/RELEASE-CHECKLIST.md). + +Set the backend RECOVERY_URL to your HTTPS frontend /reset-password route. Pending checkout and stock commands survive navigation within an active session; reload discards local credentials and intents. If interrupted, check orders/ledger before starting a new command. diff --git a/docs/PHASES.md b/docs/PHASES.md index 2bf134e..02b25d6 100644 --- a/docs/PHASES.md +++ b/docs/PHASES.md @@ -2,14 +2,14 @@ Canonical implementation: this checkout from ssh://git@git.midastix.com:2212/internal/ManiCandles.git. The standalone frontend created earlier is superseded for ongoing development. -| Phase | Scope | Acceptance gate | -| --- | --- | --- | -| 1 — Existing-site foundation | Preserve branding, connect home/catalog/search/pagination/variants, staff login/me/logout/expiry, organization setup, health checks, API proxy and SPA routing | Real published records and approved account; loading/empty/failure states; keyboard and responsive verification | -| 2 — Commerce and administration | Users/roles/audit, products/groups/variants/stock, addresses/cart/coupons/checkout/orders, recovery | Permission failures, conflicts, exact totals and expiry; no simulated live payment | -| 3 — Procurement and production | Suppliers/materials, POs/receipts/QC, invoices/payments/documents, BOMs/batches/usage/packaging/costing, warehouse stock | Supplier-to-finished-goods journey; independent review; partials/idempotency; stock invariants | -| 4 — B2B | Verification, price lists/MOQ, quotes/credit/samples/artwork, partner orders/payments, custom requests/reports | Independent approvals, expiry, reversals and currency/account boundaries | -| 5 — Growth and reporting | Wishlist/reviews, campaigns/discounts, recovery/consent, blog/segments/forum, analytics/forecast/accounting | Publication/moderation, consent, private data and report verification | -| 6 — Complete UAT and release | Dedicated deployment, disposable fixtures, role matrix, end-to-end scripts, accessibility/security review, defect retests and release/rollback runbook | Critical journeys pass; no critical/high defects; owner acceptance | +| Phase | Scope | Acceptance gate | +| ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | +| 1 — Existing-site foundation | Preserve branding, connect home/catalog/search/pagination/variants, staff login/me/logout/expiry, organization setup, health checks, API proxy and SPA routing | Real published records and approved account; loading/empty/failure states; keyboard and responsive verification | +| 2 — Commerce and administration | Users/roles/audit, products/groups/variants/stock, addresses/cart/coupons/checkout/orders, recovery | Permission failures, conflicts, exact totals and expiry; no simulated live payment | +| 3 — Procurement and production | Suppliers/materials, POs/receipts/QC, invoices/payments/documents, BOMs/batches/usage/packaging/costing, warehouse stock | Supplier-to-finished-goods journey; independent review; partials/idempotency; stock invariants | +| 4 — B2B | Verification, price lists/MOQ, quotes/credit/samples/artwork, partner orders/payments, custom requests/reports | Independent approvals, expiry, reversals and currency/account boundaries | +| 5 — Growth and reporting | Wishlist/reviews, campaigns/discounts, recovery/consent, blog/segments/forum, analytics/forecast/accounting | Publication/moderation, consent, private data and report verification | +| 6 — Complete UAT and release | Dedicated deployment, disposable fixtures, role matrix, end-to-end scripts, accessibility/security review, defect retests and release/rollback runbook | Critical journeys pass; no critical/high defects; owner acceptance | ## Phase 1 setup @@ -22,3 +22,7 @@ Enter the UUID at `/connection`, then credentials at `/workspace`. Published pro Reference: deployed `/api/docs-json` and backend source API guides. Storefront lists are arrays; detail includes decimal price strings, currency, attributes and nested groups. Zod validates returned shapes. Errors preserve code/requestId. React escapes API content; request timeout is 15 seconds. Session tokens/passwords are not persisted. UUID is configuration, not an authorization boundary; backend permissions remain authoritative. Use existing MUI theme and React Query. Query keys include organization. Search is bounded to 100 characters; catalog pages contain 12 records and respect the API offset cap. No product-image mapping is invented. Nginx forwards `/api/` to the known HTTPS upstream, verifies TLS and handles SPA deep links. No public owner/account creation is exposed. + +## Phase 2 implementation status — 12 October 2026 + +Customer and administration screens are implemented, with recovery, pricing, stock lifecycle and quality gates. See UAT-PHASE2.md and RELEASE-CHECKLIST.md. Authenticated UAT, container/ingress verification and production sign-off remain pending; Phase 3 has not started. diff --git a/docs/RELEASE-CHECKLIST.md b/docs/RELEASE-CHECKLIST.md new file mode 100644 index 0000000..9238d7c --- /dev/null +++ b/docs/RELEASE-CHECKLIST.md @@ -0,0 +1,41 @@ +# Phase 2 release checklist + +Production release is blocked until the environment checks below pass. Local implementation verification does not replace authenticated UAT or deployment acceptance. + +## Code gates + +- [x] Purpose-built customer and administration routes, with session/permission guards. +- [x] Exact decimal display, strict write inputs, validated response shapes. +- [x] Private caches and requests cleared on logout, expiry, organization change and permission downgrade. +- [x] Stale responses cannot invalidate a newer session or remove its pending command. +- [x] Cart writes serialize locally; stale versions require review. +- [x] Checkout confirmation uses the reviewed version; unknown results retain the same payload/key across navigation. +- [x] Adjustment/reservation intents stay in session memory for exact retries; session termination discards them. +- [x] Order charges use authoritative server totals; null means unfinalized, not zero; payment collection stays unavailable. +- [x] Recovery tokens captured once in memory and removed from browser history; never persisted or logged. +- [x] Destructive lifecycle actions have confirmation; system/owner/self restrictions remain enforced by the backend. +- [x] Strict TypeScript, lint without warnings, all tests passing, build below the 500 kB per-chunk budget. +- [x] Dependency audit has no reported vulnerabilities. +- [x] CI runs dependency audit and npm run check on pushes/PRs; Docker validates Nginx syntax during build. +- [x] No new type/lint suppressions, skipped tests, debug logging or source credentials. + +## Environment and acceptance gates — pending + +- [ ] Provision the installation owner on the intended UAT backend host/database; record organizationId. Never run local bootstrap against an unknown database. +- [ ] Provision least-privilege UAT staff and customer accounts, including denied/suspended accounts and independent reviewer roles. +- [ ] Exercise actual catalog/group/variant creation and publication, warehouse opening stock, private address/cart, coupon and checkout/order journeys against the deployed backend. +- [ ] Verify cross-account privacy, revoked sessions, changed permissions, concurrent carts, stock contention, duplicate retries and order expiry in live UAT. +- [ ] Configure approved pricing policies and SMTP; verify recovery delivery and one-time token expiry/reset. +- [ ] Build/run the container and test /workspace, /cart, /admin/catalog deep links; inspect CSP, certificate verification and /api health responses. +- [ ] Verify HTTPS ingress, HSTS, trusted proxy/rate-limit policy and deployment secrets. Nginx forwards /api over verified HTTPS; frontend does not change backend trust-proxy policy. +- [ ] Test complete populated screens in browsers at 320/768/1024/1440 widths; full keyboard/dialog/screen-reader/contrast checks and deployed axe/Lighthouse runs. +- [ ] Verify production Core Web Vitals, expected traffic, infrastructure logs/alerts and privacy-safe client error collection. APPLICATION_RENDER_FAILED is the safe local render diagnostic; API requestId correlates service errors. +- [ ] Confirm remote CI passes, observe deployment health/error/latency metrics, rehearse rollback, and obtain owner sign-off. + +## Rollback + +Record the immutable deployed image digest and previous known-good digest before rollout. On the deployment host, use the existing deployment mechanism to restore the previous frontend image, then verify health, SPA deep links and /api connectivity. No backend schema changes are included; retain orders, stock ledgers and accounts. Do not reset or delete database records. Confirm the actual host procedure and measured rollback time in UAT before production. A feature-branch push does not deploy the main-branch pipeline. + +## Operational limits + +Pending intents exist only within the active browser session; reloading signs out and discards them. After interruption, inspect orders or the stock ledger before beginning a new intent. The backend currently has no live gateway/carrier, public registration or contact delivery. Staff catalog/role writes follow the backend's existing concurrency policy; coordinate overlapping administration edits. Never reinterpret finalized merchandise as proof of payment or fulfillment. diff --git a/docs/SPEC-phase2.md b/docs/SPEC-phase2.md new file mode 100644 index 0000000..b033060 --- /dev/null +++ b/docs/SPEC-phase2.md @@ -0,0 +1,7 @@ +# Phase 2 — commerce and administration + +Preserve the existing brand/theme; add purpose-built MUI customer and administration screens. Modules: session boundary → addresses/cart/orders; session/permissions → users/roles/audit, catalog, stock, coupons/pricing; recovery is public and clears fragment secrets from history. Backend remains authoritative. Production payment collection and public registration are unavailable. + +Build in slices: (1) schemas/exact decimal and session privacy; (2) addresses/cart/idempotent checkout/order lifecycle; (3) user/role/audit and catalog/variant/group management; (4) inventory, coupons/pricing and recovery; (5) lint/tests/accessibility/security, chunk budgets, CI/container/release runbook. + +Acceptance: valid decimal output including integers; two-decimal write inputs; cache cancellation/removal and request generation isolation on logout/expiry/revocation; serialized cart writes with conflict refetch; checkout timeout retries retain identical intent/key; nullable charges remain unfinalized; permission-gated UI plus backend checks; independent account/role safeguards; no fake successes; all CONSTRAINTS.md gates have recorded outcomes. Existing accounts are provisioned by backend CLI/staff APIs; live UAT cannot pass until account setup. diff --git a/docs/UAT-PHASE2.md b/docs/UAT-PHASE2.md new file mode 100644 index 0000000..33fe7de --- /dev/null +++ b/docs/UAT-PHASE2.md @@ -0,0 +1,19 @@ +# Phase 2 implementation verification — 13 October 2026 + +Final local gate: 29 tests passed, strict TypeScript and lint passed, production build passed with all 27 JavaScript chunks below 500 kB (largest approximately 494 kB). The dependency audit reported zero vulnerabilities. + +| Area | Evidence / outcome | +| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Contract | Deployed Swagger exposes cart, checkout, addresses, users, roles, admin orders, pricing and coupon routes; backend stores/schemas determine response and mutation contracts. | +| Automated tests | Contract tests cover exact decimal strings, persisted metadata, strict inputs, coupon limits/windows, recovery fragment cleanup and error diagnostics. Component/workflow tests cover session privacy, expiry, permission downgrade, stale responses, navigation-safe checkout retry, changed-cart review and nullable order charges. | +| Accessibility | Axe on the permission-denied workspace reports no serious/critical findings. JSDOM color-contrast execution is unavailable; color contrast and populated-route browser axe remain a deployed acceptance gate. | +| Browser routes | Addresses/orders/access/roles/catalog/inventory/coupons/pricing/audit all show the sign-in gate with no private input forms when unauthenticated. No captured errors on those route checks. | +| Responsive | Cart shell checked at 320, 768, 1024, 1440; document width did not exceed viewport. Populated authenticated screens still require live UAT. | +| Recovery | Invalid organization input showed a field-associated local validation error; no recovery email was sent. | +| Build/performance | Routes load lazily; JavaScript chunks are measured by scripts/check-build.mjs and must remain below 500,000 bytes. No oversized-chunk warnings are accepted. | +| Dependency audit | No reported vulnerabilities with the finalized npm lockfile. | +| Independent review | Three bounded adversarial cycles. Decimal handling, session cleanup/revocation, intent persistence, reviewed-version concurrency, permissions cache erasure and cancellation/session races were reconciled and guarded by tests. User chose independent review plus tests without external cross-model execution. | +| Deployment | Nginx CSP/frame/referrer/type headers and verified HTTPS API proxy added; CI quality gates and image-build nginx -t added. No local Docker runtime was available; container/ingress execution and remote CI remain unverified. | +| Live authenticated UAT | Pending: user confirmed no organization/account setup. No account was created, data seeded, mail sent, payment collected or deployment performed. | + +See RELEASE-CHECKLIST.md for production acceptance gates. Previous Phase 1 results remain historical in UAT-RESULTS.md. diff --git a/docs/phase2-preview.png b/docs/phase2-preview.png new file mode 100644 index 0000000..950ff42 Binary files /dev/null and b/docs/phase2-preview.png differ diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..392b8c4 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,23 @@ +import tseslint from "typescript-eslint"; +import reactHooks from "eslint-plugin-react-hooks"; + +export default tseslint.config( + { ignores: ["dist/**", "node_modules/**", ".yarn/**"] }, + ...tseslint.configs.recommended, + { + files: ["**/*.ts", "**/*.tsx"], + plugins: { "react-hooks": reactHooks }, + rules: { + "react-hooks/rules-of-hooks": "error", + "react-hooks/exhaustive-deps": "error", + "@typescript-eslint/no-unused-vars": [ + "error", + { + argsIgnorePattern: "^_", + varsIgnorePattern: "^_", + ignoreRestSiblings: true, + }, + ], + }, + }, +); diff --git a/nginx.conf b/nginx.conf index 237e253..d8ce166 100644 --- a/nginx.conf +++ b/nginx.conf @@ -5,6 +5,8 @@ server { index index.html; add_header X-Content-Type-Options nosniff always; add_header Referrer-Policy strict-origin-when-cross-origin always; + add_header X-Frame-Options DENY always; + add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: https://www.transparenttextures.com; connect-src 'self'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'" always; location /api/ { proxy_pass https://manicandles-backend.midastix.com; diff --git a/package-lock.json b/package-lock.json index 8fd1d46..ef6f324 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "devDependencies": { "@emotion/react": "^11.11.4", "@emotion/styled": "^11.11.5", + "@eslint/js": "^10.0.1", "@hookform/resolvers": "^3.10.0", "@mui/icons-material": "^5.15.15", "@mui/material": "^5.15.15", @@ -42,17 +43,23 @@ "@radix-ui/react-tooltip": "^1.2.0", "@tailwindcss/vite": "^4.1.6", "@tanstack/react-query": "^5.56.2", + "@testing-library/react": "^16.3.3", + "@testing-library/user-event": "^14.6.7", "@types/node": "^22.5.5", "@types/react": "^18.3.5", "@types/react-dom": "^18.3.0", "@vitejs/plugin-react": "^4.7.0", + "axe-core": "^4.14.0", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "cmdk": "^1.1.1", "date-fns": "^3.6.0", "embla-carousel-react": "^8.6.0", + "eslint": "^10.12.0", + "eslint-plugin-react-hooks": "^7.1.1", "framer-motion": "^11.9.0", "input-otp": "^1.4.2", + "jsdom": "^30.1.2", "lucide-react": "^0.469.0", "next-themes": "^0.4.6", "react": "^18.3.1", @@ -67,8 +74,10 @@ "tailwindcss": "^4.1.6", "tw-animate-css": "^1.4.0", "typescript": "^6.0.3", + "typescript-eslint": "^8.71.1", "vaul": "^1.1.2", "vite": "^6.4.4", + "vitest": "^5.0.3", "wouter": "^3.3.5", "zod": "^3.23.8" }, @@ -76,6 +85,59 @@ "node": ">=24 <25" } }, + "node_modules/@asamuzakjp/css-color": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-7.1.5.tgz", + "integrity": "sha512-jCpAvj8apa7SKHZYogk0rbXB3Kb0hLFrpkWF+Ap+vBA5rirItnpv9NKyAyEuDuFizvl0qwnj6JWR70RGJ0rOlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@csstools/css-calc": "^3.4.3", + "@csstools/css-color-parser": "^4.2.6", + "@csstools/css-parser-algorithms": "^4.0.2", + "@csstools/css-tokenizer": "^4.0.2", + "lru-cache": "^11.5.3" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + } + }, + "node_modules/@asamuzakjp/css-color/node_modules/lru-cache": { + "version": "11.5.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", + "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@asamuzakjp/dom-selector": { + "version": "9.2.4", + "resolved": "https://registry.npmjs.org/@asamuzakjp/dom-selector/-/dom-selector-9.2.4.tgz", + "integrity": "sha512-YnVzxDxLaqL0t7Q4wfcgHZjg55Wm6y5EaO7Bhu3q9J7wq/8iw3PhsnWiOQhYekx4VexnbkgWpTT6n+QIV7kczw==", + "dev": true, + "license": "MIT", + "dependencies": { + "bidi-js": "^1.1.0", + "css-tree": "^3.2.1", + "is-potential-custom-element-name": "^1.0.1", + "lru-cache": "^11.5.3" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + } + }, + "node_modules/@asamuzakjp/dom-selector/node_modules/lru-cache": { + "version": "11.5.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", + "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, "node_modules/@babel/code-frame": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", @@ -375,6 +437,183 @@ "node": ">=6.9.0" } }, + "node_modules/@bramus/specificity": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/@bramus/specificity/-/specificity-2.4.3.tgz", + "integrity": "sha512-0GEz8qJWokkUVYQYRukmkSHIFNoBH8QTreeHrAFbvz1XFYc3Y+puhMs8PQ5x8GNugiC2l5jvDBXKLbBIByeSBw==", + "dev": true, + "license": "MIT", + "dependencies": { + "css-tree": "^3.2.1" + }, + "bin": { + "specificity": "bin/cli.js" + } + }, + "node_modules/@cacheable/memory": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@cacheable/memory/-/memory-2.2.0.tgz", + "integrity": "sha512-CTLKqLItRCEixEAewD3/j9DB3/o96gpTPD4eJ1v+DGOlxZRZncRQkGYqqnAGCscYd6RNeXfGeiuCphsPtqyIfQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cacheable/utils": "^2.5.0", + "@keyv/bigmap": "^1.3.1", + "hookified": "^1.15.1", + "keyv": "^5.6.0" + } + }, + "node_modules/@cacheable/utils": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@cacheable/utils/-/utils-2.5.0.tgz", + "integrity": "sha512-buipgOVDkkPXNR5+xBpDw7Zk2n1EvU7qBJCNUcL7rhQ//kfpOXPAvQ511Os0vpLYJ1pZnvudNytkQt2hst3wqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hashery": "^1.5.1", + "keyv": "^5.6.0" + } + }, + "node_modules/@csstools/color-helpers": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-6.1.2.tgz", + "integrity": "sha512-grhRy3OKmniaAEKXMjua5z/EODX0MSqBGjunw8+j/3HQjOnahs2AGhvEOIYVUWcU6ScApbhLhVrQTX8XqrMrow==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/@csstools/css-calc": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-3.4.3.tgz", + "integrity": "sha512-iex20d8CHVkyvg6B7UKV7uHnI2Bqo9g+EFfT9E0y+GvTvhZ/DwONJ+9aKb1dlqm0ZiGsL5RXjp0fCoJYnkeDjA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^4.0.2", + "@csstools/css-tokenizer": "^4.0.2" + } + }, + "node_modules/@csstools/css-color-parser": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-4.2.6.tgz", + "integrity": "sha512-iiPQ3iRWwnJkeEn6RIu6SJPr7hYrLz6XZ9s/QZl+2/LI5KQVjpl2fdmDSZKuD4xP6GMmMPgHFFXg6k1Wkz0Trg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "dependencies": { + "@csstools/color-helpers": "^6.1.2", + "@csstools/css-calc": "^3.4.3" + }, + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^4.0.2", + "@csstools/css-tokenizer": "^4.0.2" + } + }, + "node_modules/@csstools/css-parser-algorithms": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-4.0.2.tgz", + "integrity": "sha512-40cSKyMvK+tq4qz6Awrlye2WGuOKt3FwPgtGg6KTfbHOWNw+Rk1rzbAtZnZ6IBhsY491HLRnDXwoyBAijmmILA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-tokenizer": "^4.0.2" + } + }, + "node_modules/@csstools/css-syntax-patches-for-csstree": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/@csstools/css-syntax-patches-for-csstree/-/css-syntax-patches-for-csstree-1.1.15.tgz", + "integrity": "sha512-J0u7HkVl2nzSlhsiTOp4AmwcUQ3D+mGEEKfBy/7To5/y7F2OHwyLrXfrhR0SMgr4p5Lo+eaMVSeai24zUcBIxA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "peerDependencies": { + "css-tree": "^3.2.1" + }, + "peerDependenciesMeta": { + "css-tree": { + "optional": true + } + } + }, + "node_modules/@csstools/css-tokenizer": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-4.0.2.tgz", + "integrity": "sha512-OoKoR0f76dCY666JlcbhmVTs2drYj1GUXZTYTcbUgJjh9Nv41aFfZ21bPQTERm5+L5cBDo466NltB2lplS5GBw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + } + }, "node_modules/@date-fns/tz": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/@date-fns/tz/-/tz-1.5.0.tgz", @@ -983,6 +1222,152 @@ "node": ">=18" } }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.10.1.tgz", + "integrity": "sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.23.5", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.5.tgz", + "integrity": "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^3.0.5", + "debug": "^4.3.1", + "minimatch": "^10.2.4" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.7.0.tgz", + "integrity": "sha512-DObd/KKUsU+FaFv4PLxSRenpXfQWmPXXP3pPZ6/K1PCrMu2vQpMDMuQe/BqYeoLcz8ro0bVDF1RxOJgfVEdhUw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/core": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz", + "integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/js": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-10.0.1.tgz", + "integrity": "sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "eslint": "^10.0.0" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/@eslint/object-schema": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.5.tgz", + "integrity": "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.3.tgz", + "integrity": "sha512-IkO+/KEUvwbVpiURZg+P7zF74z5Jxe0UgJxVni+RtoHQ6IZieXaO02kmadomap/q+l6bc/jdPGGqTjhuZnuz1Q==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1", + "levn": "^0.4.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@exodus/bytes": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/@exodus/bytes/-/bytes-1.16.0.tgz", + "integrity": "sha512-IcpW84uEn3N7ETtNZMlxKhfl6Pec8rUNGOTBtWbK1FKhJxIFAptZyVrvVRVBimAJxJCgc3PxepxkdWWG4DVzfA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + }, + "peerDependencies": { + "@noble/hashes": "^1.8.0 || ^2.0.0" + }, + "peerDependenciesMeta": { + "@noble/hashes": { + "optional": true + } + } + }, "node_modules/@floating-ui/core": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.8.0.tgz", @@ -1035,6 +1420,72 @@ "react-hook-form": "^7.0.0" } }, + "node_modules/@humanfs/core": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz", + "integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/types": "^0.15.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.8", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz", + "integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.2", + "@humanfs/types": "^0.15.0", + "@humanwhocodes/retry": "^0.4.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/types": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz", + "integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.13", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", @@ -1085,6 +1536,30 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@keyv/bigmap": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@keyv/bigmap/-/bigmap-1.3.1.tgz", + "integrity": "sha512-WbzE9sdmQtKy8vrNPa9BRnwZh5UF4s1KTmSK0KUVLo3eff5BlQNNWDnFOouNpKfPKDnms9xynJjsMYjMaT/aFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "hashery": "^1.4.0", + "hookified": "^1.15.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "keyv": "^5.6.0" + } + }, + "node_modules/@keyv/serialize": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@keyv/serialize/-/serialize-1.1.1.tgz", + "integrity": "sha512-dXn3FZhPv0US+7dtJsIi2R+c7qWYiReoEh5zUntWCf4oSpMNib8FDhSoed6m3QyZdx5hK7iLFkYk3rNxwt8vTA==", + "dev": true, + "license": "MIT" + }, "node_modules/@mui/core-downloads-tracker": { "version": "5.18.0", "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.18.0.tgz", @@ -3525,6 +4000,77 @@ "react": "^18 || ^19" } }, + "node_modules/@testing-library/dom": { + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.2.tgz", + "integrity": "sha512-yzr2S9HyAIdhz2/6qHgbs665Q7PKVcDF05vsOlHPxG1mo36gKVesdYVeDLnXgfjJ03CrKRk08knc6+E/9m8v2Q==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@babel/code-frame": "^7.10.4", + "@babel/runtime": "^7.12.5", + "@types/aria-query": "^5.0.1", + "aria-query": "5.3.0", + "dom-accessibility-api": "^0.5.9", + "lz-string": "^1.5.0", + "picocolors": "1.1.1", + "pretty-format": "^27.0.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@testing-library/react": { + "version": "16.3.3", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-16.3.3.tgz", + "integrity": "sha512-Uo193NgQbPMz6lrrhtRQQFcMC6Re/ELLFbbuVL30WDlZxlpZf9/lMHTAVxPRLw1q1iu9OJmR1c2BLiENRstdBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.12.5" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@testing-library/dom": "^10.0.0", + "@types/react": "^18.0.0 || ^19.0.0", + "@types/react-dom": "^18.0.0 || ^19.0.0", + "react": "^18.0.0 || ^19.0.0", + "react-dom": "^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@testing-library/user-event": { + "version": "14.6.7", + "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-14.6.7.tgz", + "integrity": "sha512-MPCpX8bxe8zS+JmmTwLp8jd0dy1rAm60Te/SL8JrQM3qvQJcBOs1d7IefJMyZzqM3EWBrDn/LWDt1BCGu4ASfg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12", + "npm": ">=6" + }, + "peerDependencies": { + "@testing-library/dom": ">=7.21.4" + } + }, + "node_modules/@types/aria-query": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", + "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==", + "dev": true, + "license": "MIT", + "peer": true + }, "node_modules/@types/babel__core": { "version": "7.20.5", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", @@ -3570,6 +4116,17 @@ "@babel/types": "^7.28.2" } }, + "node_modules/@types/chai": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", + "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" + } + }, "node_modules/@types/d3-array": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.2.2.tgz", @@ -3642,6 +4199,20 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/esrecurse": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", + "integrity": "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/estree": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", @@ -3649,6 +4220,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/node": { "version": "22.20.5", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.20.5.tgz", @@ -3704,6 +4282,249 @@ "@types/react": "*" } }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.71.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.71.1.tgz", + "integrity": "sha512-nNlBf6HuotqMgZvSkWD5hNdemiBIxQ2NmrlgfcUIeZRs+BbakjscCQRq/Hb74EFVnFiSWWdL12JruqwBy3ERDw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.12.2", + "@typescript-eslint/scope-manager": "8.71.1", + "@typescript-eslint/type-utils": "8.71.1", + "@typescript-eslint/utils": "8.71.1", + "@typescript-eslint/visitor-keys": "8.71.1", + "ignore": "^7.0.5", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.71.1", + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.12", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.12.tgz", + "integrity": "sha512-/8UvqAPU9DGTI9k4mxtf49U37Isfwr8Uts96+SBHIkFxPJnHS0Ew4f00sM4Scd8V8EjM0jUNtVDdv1kPdt35lg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.71.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.71.1.tgz", + "integrity": "sha512-oM/5sAqz/l1v/zYK1qTOPrn2+JIrBGC1V6uNYucRO5gh6eT9vWJ/RhPbGE59byvZEUQ4VP6XkLBaS5Jti5jpvw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/scope-manager": "8.71.1", + "@typescript-eslint/types": "8.71.1", + "@typescript-eslint/typescript-estree": "8.71.1", + "@typescript-eslint/visitor-keys": "8.71.1", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.71.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.71.1.tgz", + "integrity": "sha512-Oijc9RUsohHjncg6iGi7gCtjnEjYt9FWv9u6ygK8uKcHK5eLjLAkqERQ9BaytbpceOFdk6kifPCS/zAZE+A99g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.71.1", + "@typescript-eslint/types": "^8.71.1", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.71.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.71.1.tgz", + "integrity": "sha512-1YUDZXdTnXLlob03SFHBipdyMBsDVm7zoSz0ytTJ39dk5J1TgsTK03VlR/dLXG/RLLUrPcYbD4rp23BmHxHP0w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.71.1", + "@typescript-eslint/visitor-keys": "8.71.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.71.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.71.1.tgz", + "integrity": "sha512-oTvkml5SxXhgg+WWKhod5qWQICDXtOB+/Hi9VdPKFAANJ2b7YOgMffgvzXuqog7R6A/JtrzRf128dsxummyWhg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.71.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.71.1.tgz", + "integrity": "sha512-kH3t3jZCYv2PZSBEWPKTariLrCaoF1CLoPitYFBJOhAGEwWnSRAtGEifrfrpBa4K9JlwWNZotgA5w3/wLSk/FQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.71.1", + "@typescript-eslint/typescript-estree": "8.71.1", + "@typescript-eslint/utils": "8.71.1", + "debug": "^4.4.3", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.71.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.71.1.tgz", + "integrity": "sha512-ybYnPTUwg3VQQOFEiBPLs8Jxl1ry2vXdn1kVKguomBbvxpetdu3MKTNDqFNUrlG8ylP9MpZosmXMFYlGQHk1oQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.71.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.71.1.tgz", + "integrity": "sha512-pSKSEK1JJpHs6KiKVtABCE4iJK5d7FLFzDXQNBQ2oRY7LEd3UwOt3TZemTgu9syTIf56dJWlTn/pdmrO9oKUXQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/project-service": "8.71.1", + "@typescript-eslint/tsconfig-utils": "8.71.1", + "@typescript-eslint/types": "8.71.1", + "@typescript-eslint/visitor-keys": "8.71.1", + "debug": "^4.4.3", + "minimatch": "^10.2.2", + "semver": "^7.7.3", + "tinyglobby": "^0.2.15", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.71.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.71.1.tgz", + "integrity": "sha512-CBjT6gfAz3DW2j9Q4moFnqt208Aq+506sVGXfpRcyAeqn0EpayL0mjdWoCO2t3RC7GewNrFxdeehuEaPg6DMzQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.9.1", + "@typescript-eslint/scope-manager": "8.71.1", + "@typescript-eslint/types": "8.71.1", + "@typescript-eslint/typescript-estree": "8.71.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.71.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.71.1.tgz", + "integrity": "sha512-0GxiUGqMU0qXJt58cBsiG3DP8lUmBaFo2vChtUX+CT7PnR3v/VGLLrzVP4K9r1lNiZXjHYefMBbPunplr09v6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.71.1", + "eslint-visitor-keys": "^5.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/@vitejs/plugin-react": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.7.0.tgz", @@ -3725,6 +4546,119 @@ "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" } }, + "node_modules/@vitest/mocker": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.0.3.tgz", + "integrity": "sha512-T8sWAIbkSyAjkwTcaEc3Iu0o9A27X1/kdXrizhZkGuSKScRQtRzclfAMpOTcGdXCsqxeWlpGy3XjqaW8CpLORg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.31", + "@vitest/spy": "5.0.3", + "estree-walker": "^3.0.3", + "magic-string": "^1.2.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@vitest/mocker/node_modules/magic-string": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.3.tgz", + "integrity": "sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.6.0" + } + }, + "node_modules/@vitest/spy": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.0.3.tgz", + "integrity": "sha512-XhFysQTB8AZ+P4gMi+Lpo99vg2AZi0qKpaB9yXQl37+CaMEAPO3iH/wGVnSyL5MPERiLezpqTVtrR6UZH5GCXg==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/acorn": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.19.0.tgz", + "integrity": "sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", + "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, "node_modules/aria-hidden": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/aria-hidden/-/aria-hidden-1.2.6.tgz", @@ -3738,6 +4672,37 @@ "node": ">=10" } }, + "node_modules/aria-query": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", + "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "dequal": "^2.0.3" + } + }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/axe-core": { + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.14.0.tgz", + "integrity": "sha512-9WTZxEjsZ7b13TH8JPmbV2z8CHbl80/2hm3XPEG4JgNdQLK81IBRXmSxHfMAOkSqQeRxT/0dwNDz2GOm3zzpcQ==", + "dev": true, + "license": "MPL-2.0", + "engines": { + "node": ">=4" + } + }, "node_modules/babel-plugin-macros": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz", @@ -3754,6 +4719,16 @@ "npm": ">=6" } }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, "node_modules/baseline-browser-mapping": { "version": "2.11.28", "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.28.tgz", @@ -3767,6 +4742,29 @@ "node": ">=6.0.0" } }, + "node_modules/bidi-js": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/bidi-js/-/bidi-js-1.1.0.tgz", + "integrity": "sha512-fX1Onk0tdVPC7obPWB5EbJ1z7NVhLq4m2xZLq2YXBkxzMXIGRpNMU88n0EPgWseKl12J7zXs7qrDxPK4sRs2fg==", + "dev": true, + "license": "MIT", + "dependencies": { + "require-from-string": "^2.0.2" + } + }, + "node_modules/brace-expansion": { + "version": "5.0.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz", + "integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "20 || >=22" + } + }, "node_modules/browserslist": { "version": "4.29.3", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.3.tgz", @@ -3801,6 +4799,20 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, + "node_modules/cacheable": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/cacheable/-/cacheable-2.5.0.tgz", + "integrity": "sha512-60cyAOytib/OzBw1JNSoSV/boK1AtHryDIjvVBk7XbN4ugfkM3+Sry7fEjNgPMGgOjuaZPAp8ruZ0Cxafwyq9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cacheable/memory": "^2.2.0", + "@cacheable/utils": "^2.5.0", + "hookified": "^1.15.0", + "keyv": "^5.6.0", + "qified": "^0.10.1" + } + }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -3832,6 +4844,16 @@ ], "license": "CC-BY-4.0" }, + "node_modules/chai": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-6.3.0.tgz", + "integrity": "sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/class-variance-authority": { "version": "0.7.1", "resolved": "https://registry.npmjs.org/class-variance-authority/-/class-variance-authority-0.7.1.tgz", @@ -3906,6 +4928,35 @@ "node": ">= 6" } }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/css-tree": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.2.1.tgz", + "integrity": "sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "mdn-data": "2.27.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" + } + }, "node_modules/csstype": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", @@ -4045,6 +5096,20 @@ "node": ">=12" } }, + "node_modules/data-urls": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-8.0.0.tgz", + "integrity": "sha512-JQUCCK+/CAGbGGx618PlFZMXH81Jtj7t73CHv9dd/zVWvxgGT2zLFRjnKb+Ng46GIwcy+f7f88qd4duqllK+WQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "whatwg-mimetype": "^5.0.0", + "whatwg-url": "^17.1.2" + }, + "engines": { + "node": "^22.14.0 || >=24.0.0" + } + }, "node_modules/date-fns": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-3.6.0.tgz", @@ -4081,6 +5146,13 @@ } } }, + "node_modules/decimal.js": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", + "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", + "dev": true, + "license": "MIT" + }, "node_modules/decimal.js-light": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/decimal.js-light/-/decimal.js-light-2.5.1.tgz", @@ -4088,6 +5160,24 @@ "dev": true, "license": "MIT" }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6" + } + }, "node_modules/detect-libc": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", @@ -4105,6 +5195,14 @@ "dev": true, "license": "MIT" }, + "node_modules/dom-accessibility-api": { + "version": "0.5.16", + "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz", + "integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==", + "dev": true, + "license": "MIT", + "peer": true + }, "node_modules/dom-helpers": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz", @@ -4168,6 +5266,19 @@ "node": ">=10.13.0" } }, + "node_modules/entities": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-8.1.0.tgz", + "integrity": "sha512-kxL7msIffSuh9aaFAMD7rxAIuTRMAHMeBtgHW2yUdWw732ZNh4MehkF2gdjvtdmikkaIP9bFDDJOPlsvm7avrA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20.19.0" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/error-ex": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.4.tgz", @@ -4188,6 +5299,13 @@ "node": ">= 0.4" } }, + "node_modules/es-module-lexer": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.2.tgz", + "integrity": "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==", + "dev": true, + "license": "MIT" + }, "node_modules/esbuild": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", @@ -4253,6 +5371,191 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/eslint": { + "version": "10.12.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.12.0.tgz", + "integrity": "sha512-npHjrHb2o4ehH3mE+YuxABR+0gyb0aVWCIolgJDArwCiHEIsonBm3ZKjel5b0U5+a+MbEvIyRCGCzD3eKKK2NA==", + "dev": true, + "license": "MIT", + "workspaces": [ + "packages/*" + ], + "dependencies": { + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.2", + "@eslint/config-array": "^0.23.5", + "@eslint/config-helpers": "^0.7.0", + "@eslint/core": "^1.2.1", + "@eslint/plugin-kit": "^0.7.3", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.14.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^9.1.2", + "eslint-visitor-keys": "^5.0.1", + "espree": "^11.2.0", + "esquery": "^1.7.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "11.1.5 || >11.1.6 <12", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "minimatch": "^10.2.5", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-plugin-react-hooks": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-7.1.1.tgz", + "integrity": "sha512-f2I7Gw6JbvCexzIInuSbZpfdQ44D7iqdWX01FKLvrPgqxoE7oMj8clOfto8U6vYiz4yd5oKu39rRSVOe1zRu0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.24.4", + "@babel/parser": "^7.24.4", + "hermes-parser": "^0.25.1", + "zod": "^3.25.0 || ^4.0.0", + "zod-validation-error": "^3.5.0 || ^4.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 || ^10.0.0" + } + }, + "node_modules/eslint-scope": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-9.1.2.tgz", + "integrity": "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@types/esrecurse": "^4.3.1", + "@types/estree": "^1.0.8", + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-11.2.0.tgz", + "integrity": "sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.16.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^5.0.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz", + "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", @@ -4260,6 +5563,23 @@ "dev": true, "license": "MIT" }, + "node_modules/expect-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz", + "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, "node_modules/fast-equals": { "version": "5.4.4", "resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-5.4.4.tgz", @@ -4270,6 +5590,20 @@ "node": ">=6.0.0" } }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, "node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", @@ -4288,6 +5622,16 @@ } } }, + "node_modules/file-entry-cache": { + "version": "11.1.5", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-11.1.5.tgz", + "integrity": "sha512-+PFTHITI08JIGhnNpGNI8T8inUpgZfk3GNEqfT9R2zZV2iFXg3CvqzSl/uEhs7TSGujYRELEANyDvS8Fj7+S7Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^6.1.23" + } + }, "node_modules/find-root": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz", @@ -4295,6 +5639,42 @@ "dev": true, "license": "MIT" }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "6.1.23", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-6.1.23.tgz", + "integrity": "sha512-f++BY9pTk+983xK1FLzlLpmM0i0z+jHmx3QESGkURMXujQZz1k5wzwX6hjnQ8goaD0B+sYnDK1yZ6MTyZfUaqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "cacheable": "^2.5.0", + "flatted": "^3.4.2", + "hookified": "^1.15.0" + } + }, + "node_modules/flatted": { + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.4.tgz", + "integrity": "sha512-5+ybhBZANEJxaH3X5evAFatUxLfEHSr7n6kYJ+1Qd0mUqr4eu9gIf6GDbWHf8RJijHrjjO8G+la14SlL2SeS1Q==", + "dev": true, + "license": "ISC" + }, "node_modules/framer-motion": { "version": "11.18.2", "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-11.18.2.tgz", @@ -4368,6 +5748,19 @@ "node": ">=6" } }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", @@ -4375,6 +5768,19 @@ "dev": true, "license": "ISC" }, + "node_modules/hashery": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/hashery/-/hashery-1.5.1.tgz", + "integrity": "sha512-iZyKG96/JwPz1N55vj2Ie2vXbhu440zfUfJvSwEqEbeLluk7NnapfGqa7LH0mOsnDxTF85Mx8/dyR6HfqcbmbQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "hookified": "^1.15.0" + }, + "engines": { + "node": ">=20" + } + }, "node_modules/hasown": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", @@ -4388,6 +5794,23 @@ "node": ">= 0.4" } }, + "node_modules/hermes-estree": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/hermes-estree/-/hermes-estree-0.25.1.tgz", + "integrity": "sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw==", + "dev": true, + "license": "MIT" + }, + "node_modules/hermes-parser": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/hermes-parser/-/hermes-parser-0.25.1.tgz", + "integrity": "sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hermes-estree": "0.25.1" + } + }, "node_modules/hoist-non-react-statics": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", @@ -4405,6 +5828,36 @@ "dev": true, "license": "MIT" }, + "node_modules/hookified": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/hookified/-/hookified-1.15.1.tgz", + "integrity": "sha512-MvG/clsADq1GPM2KGo2nyfaWVyn9naPiXrqIe4jYjXNZQt238kWyOGrsyc/DmRAQ+Re6yeo6yX/yoNCG5KAEVg==", + "dev": true, + "license": "MIT" + }, + "node_modules/html-encoding-sniffer": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-7.0.0.tgz", + "integrity": "sha512-UikN5yr7xsCDAq87Or5or0PAlD3HJJOKVzM05az588WnpDJ4Ux7a2A53Qi6gofGg2/EtvF/H4hCi/TXfCW4Y6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.15.1" + }, + "engines": { + "node": "^22.13.0 || >=24.0.0" + } + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "node_modules/import-fresh": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", @@ -4422,6 +5875,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, "node_modules/input-otp": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/input-otp/-/input-otp-1.5.0.tgz", @@ -4466,6 +5929,43 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, "node_modules/jiti": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.7.0.tgz", @@ -4483,6 +5983,56 @@ "dev": true, "license": "MIT" }, + "node_modules/jsdom": { + "version": "30.1.2", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-30.1.2.tgz", + "integrity": "sha512-0FFE/jE1rppmVfUrJUgxqXjcwolZYIGtAgj1pTussMhNZxIxi7W/PvfWaMNroGi2B36X1IKHbexpZ9DhkoOPiQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@asamuzakjp/css-color": "^7.1.3", + "@asamuzakjp/dom-selector": "^9.2.4", + "@bramus/specificity": "^2.4.2", + "@csstools/css-syntax-patches-for-csstree": "^1.1.15", + "@exodus/bytes": "^1.16.0", + "css-tree": "^3.2.1", + "data-urls": "^8.0.0", + "decimal.js": "^10.6.0", + "html-encoding-sniffer": "^7.0.0", + "is-potential-custom-element-name": "^1.0.1", + "lru-cache": "^11.5.3", + "parse5": "^8.0.1", + "saxes": "^6.0.0", + "tough-cookie": "^6.0.2", + "undici": "^8.11.2", + "w3c-xmlserializer": "^6.0.0", + "webidl-conversions": "^8.0.1", + "whatwg-mimetype": "^5.0.0", + "whatwg-url": "^17.2.0", + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + }, + "peerDependencies": { + "canvas": "^3.2.3" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jsdom/node_modules/lru-cache": { + "version": "11.5.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", + "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, "node_modules/jsesc": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", @@ -4503,6 +6053,20 @@ "dev": true, "license": "MIT" }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", @@ -4516,6 +6080,30 @@ "node": ">=6" } }, + "node_modules/keyv": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-5.6.0.tgz", + "integrity": "sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@keyv/serialize": "^1.1.1" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/lightningcss": { "version": "1.32.0", "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz", @@ -4796,6 +6384,22 @@ "dev": true, "license": "MIT" }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/lodash": { "version": "4.18.1", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz", @@ -4836,6 +6440,17 @@ "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, + "node_modules/lz-string": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", + "integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==", + "dev": true, + "license": "MIT", + "peer": true, + "bin": { + "lz-string": "bin/bin.js" + } + }, "node_modules/magic-string": { "version": "0.30.21", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", @@ -4846,6 +6461,29 @@ "@jridgewell/sourcemap-codec": "^1.5.5" } }, + "node_modules/mdn-data": { + "version": "2.27.1", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.27.1.tgz", + "integrity": "sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==", + "dev": true, + "license": "CC0-1.0" + }, + "node_modules/minimatch": { + "version": "10.2.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.8" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/motion-dom": { "version": "11.18.1", "resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-11.18.1.tgz", @@ -4889,6 +6527,13 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, "node_modules/next-themes": { "version": "0.4.6", "resolved": "https://registry.npmjs.org/next-themes/-/next-themes-0.4.6.tgz", @@ -4920,6 +6565,70 @@ "node": ">=0.10.0" } }, + "node_modules/obug": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.2.1.tgz", + "integrity": "sha512-XrsrhT5sybtKI6wakr2SPOlGZWWYbUXZ7a0jT8/QOeAPau+1X/bSegNe5YR75oJmEZQbKningirmGOEJCIk61Q==", + "dev": true, + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -4952,6 +6661,39 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/parse5": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-8.0.1.tgz", + "integrity": "sha512-z1e/HMG90obSGeidlli3hj7cbocou0/wa5HacvI3ASx34PecNjNQeaHNo5WIZpWofN9kgkqV1q5YvXe3F0FoPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "entities": "^8.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/path-parse": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", @@ -5018,6 +6760,40 @@ "node": "^10 || ^12 || >=14" } }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/pretty-format": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", + "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^17.0.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/pretty-format/node_modules/react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", + "dev": true, + "license": "MIT", + "peer": true + }, "node_modules/prop-types": { "version": "15.8.1", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", @@ -5037,6 +6813,36 @@ "dev": true, "license": "MIT" }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/qified": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/qified/-/qified-0.10.1.tgz", + "integrity": "sha512-+Owyggi9IxT1ePKGafcI87ubSmxol6smwJ+RAHDQlx9+9cPwFWDiKFFCPuWhr9ignlGpZ9vDQLw67N4dcTVFEA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hookified": "^2.1.1" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/qified/node_modules/hookified": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/hookified/-/hookified-2.2.0.tgz", + "integrity": "sha512-p/LgFzRN5FeoD3DLS6bkUapeye6E4SI6yJs6KetENd18S+FBthqYq2amJUWpt5z0EQwwHemidjY5OqJGEKm5uA==", + "dev": true, + "license": "MIT" + }, "node_modules/react": { "version": "18.3.1", "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", @@ -5316,6 +7122,16 @@ "node": ">=8" } }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/resolve": { "version": "1.22.13", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.13.tgz", @@ -5394,6 +7210,19 @@ "fsevents": "~2.3.2" } }, + "node_modules/saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "dev": true, + "license": "ISC", + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=v12.22.7" + } + }, "node_modules/scheduler": { "version": "0.23.2", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", @@ -5414,6 +7243,29 @@ "semver": "bin/semver.js" } }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/sonner": { "version": "2.0.8", "resolved": "https://registry.npmjs.org/sonner/-/sonner-2.0.8.tgz", @@ -5451,6 +7303,13 @@ "node": ">=0.10.0" } }, + "node_modules/std-env": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.3.0.tgz", + "integrity": "sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==", + "dev": true, + "license": "MIT" + }, "node_modules/stylis": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.2.0.tgz", @@ -5510,6 +7369,26 @@ "dev": true, "license": "MIT" }, + "node_modules/tinybench": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.2.tgz", + "integrity": "sha512-nIZ2N2dFpjBsg2hgitKu7mA+FvsIJuGJOwysRngmVRRmWgR/UyPjwJj8c/fT/dhm8EkHnF5EOogRf+0Z2qrimA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/tinyexec": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.3.1.tgz", + "integrity": "sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/tinyglobby": { "version": "0.2.17", "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", @@ -5527,6 +7406,65 @@ "url": "https://github.com/sponsors/SuperchupuDev" } }, + "node_modules/tldts": { + "version": "7.4.18", + "resolved": "https://registry.npmjs.org/tldts/-/tldts-7.4.18.tgz", + "integrity": "sha512-somxA8xKAUzlAxl0TX/jMSYIbRNFIVGnI96pVGJPeMc5BsHmfVXn6mOJT6U++ELnl04eGfzpfcEuZe8WiASkXg==", + "dev": true, + "license": "MIT", + "dependencies": { + "tldts-core": "^7.4.18" + }, + "bin": { + "tldts": "bin/cli.js" + } + }, + "node_modules/tldts-core": { + "version": "7.4.18", + "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.4.18.tgz", + "integrity": "sha512-KI2PKvCmvQI/xD6ypPqkU0i7oxNXR/O58RLRaHR4svsgVUQ2JE/XC8BtMbG6PSehD27I8sZJRcC1ASnCy6lp3g==", + "dev": true, + "license": "MIT" + }, + "node_modules/tough-cookie": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-6.0.2.tgz", + "integrity": "sha512-exgYmnmL/sJpR3upZfXG5PoatXQii55xAiXGXzY+sROLZ/Y+SLcp9PgJNI9Vz37HpQ74WvDcLT8eqm+kV3FzrA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "tldts": "^7.0.5" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/tr46": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-7.0.0.tgz", + "integrity": "sha512-BcDSDW+SIGWVOns1Zm6Yg91q9AEj7eaID0QDY9oIqJD1A8dscNwMcl9Sms2DeuWCNov1X0/oXanHGYQBSLwZsg==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": "^22.14.0 || >=24.0.0" + } + }, + "node_modules/ts-api-utils": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz", + "integrity": "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", @@ -5544,6 +7482,19 @@ "url": "https://github.com/sponsors/Wombosvideo" } }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/typescript": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", @@ -5558,6 +7509,40 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "8.71.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.71.1.tgz", + "integrity": "sha512-oiNVPC3/NbV1FpaHU07l8O6ynqG9v4PAiW2WvTrAmZdR0f2HI/gE668ElMLCK7Xbsu5k2fK5C4fXNiq05j7/nQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.71.1", + "@typescript-eslint/parser": "8.71.1", + "@typescript-eslint/typescript-estree": "8.71.1", + "@typescript-eslint/utils": "8.71.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/undici": { + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/undici/-/undici-8.11.2.tgz", + "integrity": "sha512-u4UB2/IrKdU6lFxumHmmo1a3fCQO5tzQllRorfoRS63txhrB7xTpSn1PftwC4qEHkOaqP95fCWW4lJzwErwzhQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=22.19.0" + } + }, "node_modules/undici-types": { "version": "6.21.0", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", @@ -5596,6 +7581,16 @@ "browserslist": ">= 4.21.0" } }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, "node_modules/use-callback-ref": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/use-callback-ref/-/use-callback-ref-1.3.3.tgz", @@ -5763,6 +7758,186 @@ } } }, + "node_modules/vitest": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-5.0.3.tgz", + "integrity": "sha512-xMw97S3rjdtj5dkVat7jCsqWBpvchs3RlpQctUqwJD0KkERk40vz2fJ77lDwW/Vzh/pk18eItYAzkodhSes3jQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/chai": "^5.2.2", + "@vitest/mocker": "5.0.3", + "chai": "^6.2.2", + "es-module-lexer": "^2.3.2", + "expect-type": "^1.4.0", + "magic-string": "^1.2.3", + "obug": "^2.1.4", + "picomatch": "^4.0.7", + "std-env": "^4.2.0", + "tinybench": "^6.1.4", + "tinyexec": "^1.3.0", + "tinyglobby": "^0.2.17", + "why-is-node-running": "3.2.1" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^22.12.0 || ^24.0.0 || >=26.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@opentelemetry/api": "^1.9.0", + "@types/node": "^22.0.0 || >=24.0.0", + "@vitest/browser-playwright": "5.0.3", + "@vitest/browser-preview": "5.0.3", + "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0", + "@vitest/coverage-istanbul": "5.0.3", + "@vitest/coverage-v8": "5.0.3", + "@vitest/ui": "5.0.3", + "happy-dom": "*", + "jsdom": "*", + "vite": "^6.4.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@opentelemetry/api": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser-playwright": { + "optional": true + }, + "@vitest/browser-preview": { + "optional": true + }, + "@vitest/browser-webdriverio": { + "optional": true + }, + "@vitest/coverage-istanbul": { + "optional": true + }, + "@vitest/coverage-v8": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + }, + "vite": { + "optional": false + } + } + }, + "node_modules/vitest/node_modules/magic-string": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.3.tgz", + "integrity": "sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.6.0" + } + }, + "node_modules/w3c-xmlserializer": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-6.0.0.tgz", + "integrity": "sha512-4Nsy8K5Tr6SPDH9jhKJOHf7ChDrc1zufZTVSF7x72hwuEXBqxqk9G6cK+K2NRUtB3iELRJqjXb4JPDMBjMTl2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + } + }, + "node_modules/webidl-conversions": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz", + "integrity": "sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20" + } + }, + "node_modules/whatwg-mimetype": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-5.0.0.tgz", + "integrity": "sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20" + } + }, + "node_modules/whatwg-url": { + "version": "17.2.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-17.2.0.tgz", + "integrity": "sha512-IhLIHNcBrzIixC5XXsbr4DxdjajyA5vQ5RwGZMtrUp+GbtE5Nrsge9QKau7jXrC0aTXLYGV0xiW7Tb4YS2aomw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.16.0", + "tr46": "^7.0.0", + "webidl-conversions": "^8.0.1" + }, + "engines": { + "node": "^22.14.0 || >=24.0.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/why-is-node-running": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-3.2.1.tgz", + "integrity": "sha512-Tb2FUhB4vUsGQlfSquQLYkApkuPAFQXGFzxWKHHumVz2dK+X1RUm/HnID4+TfIGYJ1kTcwOaCk/buYCEJr6YjQ==", + "dev": true, + "license": "MIT", + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=20.11" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/wouter": { "version": "3.13.0", "resolved": "https://registry.npmjs.org/wouter/-/wouter-3.13.0.tgz", @@ -5777,6 +7952,23 @@ "react": ">=16.8.0" } }, + "node_modules/xml-name-validator": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", + "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "dev": true, + "license": "MIT" + }, "node_modules/yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", @@ -5784,6 +7976,19 @@ "dev": true, "license": "ISC" }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/zod": { "version": "3.25.76", "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", @@ -5793,6 +7998,19 @@ "funding": { "url": "https://github.com/sponsors/colinhacks" } + }, + "node_modules/zod-validation-error": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-4.0.2.tgz", + "integrity": "sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.0.0" + }, + "peerDependencies": { + "zod": "^3.25.0 || ^4.0.0" + } } } } diff --git a/package.json b/package.json index 3e0812b..2c0e51b 100644 --- a/package.json +++ b/package.json @@ -5,10 +5,12 @@ "type": "module", "scripts": { "dev": "vite --config vite.config.ts", - "build": "vite build --config vite.config.ts", + "build": "vite build --config vite.config.ts && node scripts/check-build.mjs", "serve": "vite preview --config vite.config.ts", "typecheck": "tsc -p tsconfig.json --noEmit", - "test": "node --test test/*.test.ts" + "test": "node --test test/*.test.ts && vitest run --config vitest.config.ts", + "lint": "eslint src test --max-warnings=0", + "check": "npm run lint && npm run typecheck && npm test && npm run build" }, "engines": { "node": ">=24 <25" @@ -17,6 +19,7 @@ "devDependencies": { "@emotion/react": "^11.11.4", "@emotion/styled": "^11.11.5", + "@eslint/js": "^10.0.1", "@hookform/resolvers": "^3.10.0", "@mui/icons-material": "^5.15.15", "@mui/material": "^5.15.15", @@ -49,17 +52,23 @@ "@radix-ui/react-tooltip": "^1.2.0", "@tailwindcss/vite": "^4.1.6", "@tanstack/react-query": "^5.56.2", + "@testing-library/react": "^16.3.3", + "@testing-library/user-event": "^14.6.7", "@types/node": "^22.5.5", "@types/react": "^18.3.5", "@types/react-dom": "^18.3.0", "@vitejs/plugin-react": "^4.7.0", + "axe-core": "^4.14.0", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "cmdk": "^1.1.1", "date-fns": "^3.6.0", "embla-carousel-react": "^8.6.0", + "eslint": "^10.12.0", + "eslint-plugin-react-hooks": "^7.1.1", "framer-motion": "^11.9.0", "input-otp": "^1.4.2", + "jsdom": "^30.1.2", "lucide-react": "^0.469.0", "next-themes": "^0.4.6", "react": "^18.3.1", @@ -74,8 +83,10 @@ "tailwindcss": "^4.1.6", "tw-animate-css": "^1.4.0", "typescript": "^6.0.3", + "typescript-eslint": "^8.71.1", "vaul": "^1.1.2", "vite": "^6.4.4", + "vitest": "^5.0.3", "wouter": "^3.3.5", "zod": "^3.23.8" } diff --git a/scripts/check-build.mjs b/scripts/check-build.mjs new file mode 100644 index 0000000..80bb479 --- /dev/null +++ b/scripts/check-build.mjs @@ -0,0 +1,17 @@ +import { readdir, stat } from "node:fs/promises"; +import { join } from "node:path"; +import { fileURLToPath } from "node:url"; +import assert from "node:assert/strict"; +const assets = new URL("../dist/assets/", import.meta.url); +const files = (await readdir(assets)).filter((file) => file.endsWith(".js")); +assert(files.length > 0, "No built JavaScript assets were found."); +for (const file of files) { + const size = (await stat(join(fileURLToPath(assets), file))).size; + assert( + size < 500000, + `${file} exceeds the 500 kB chunk budget (${size} bytes).`, + ); +} +console.log( + `Build budget passed: ${files.length} JavaScript chunks below 500 kB.`, +); diff --git a/src/App.tsx b/src/App.tsx index b671b46..1e8eb63 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,50 +1,94 @@ +import { lazy, Suspense } from "react"; import { Switch, Route, Router as WouterRouter } from "wouter"; -import NotFound from "@/pages/not-found"; - import { Layout } from "@/components/Layout"; -import Home from "@/pages/home"; -import ProductsPage from "@/pages/ProductsPage"; -import AboutPage from "@/pages/AboutPage"; -import ContactPage from "@/pages/ContactPage"; -import ProductPage from "@/pages/ProductPage"; -import WorkspacePage from "@/pages/WorkspacePage"; -import ConnectionPage from "@/pages/ConnectionPage"; import { PlatformProvider } from "@/lib/platform"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; - +import LinearProgress from "@mui/material/LinearProgress"; +import { ErrorBoundary } from "@/components/ErrorBoundary"; +const Home = lazy(() => import("@/pages/home")); +const ProductsPage = lazy(() => import("@/pages/ProductsPage")); +const ProductPage = lazy(() => import("@/pages/ProductPage")); +const AboutPage = lazy(() => import("@/pages/AboutPage")); +const ContactPage = lazy(() => import("@/pages/ContactPage")); +const WorkspacePage = lazy(() => import("@/pages/WorkspacePage")); +const ConnectionPage = lazy(() => import("@/pages/ConnectionPage")); +const AddressesPage = lazy(() => import("@/pages/AddressesPage")); +const CartPage = lazy(() => import("@/pages/CartPage")); +const OrdersPage = lazy(() => import("@/pages/OrdersPage")); +const AccessPage = lazy(() => import("@/pages/AccessPage")); +const RolesPage = lazy(() => + import("@/pages/AccessPage").then((module) => ({ + default: module.RolesPage, + })), +); +const AuditPage = lazy(() => + import("@/pages/AccessPage").then((module) => ({ + default: module.AuditPage, + })), +); +const CatalogAdminPage = lazy(() => import("@/pages/CatalogAdminPage")); +const InventoryPage = lazy(() => import("@/pages/InventoryPage")); +const OffersPage = lazy(() => import("@/pages/OffersPage")); +const RecoveryPage = lazy(() => import("@/pages/RecoveryPage")); +const NotFound = lazy(() => import("@/pages/not-found")); const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } }, }); - function Router() { return ( - - - - - {(params) => } - - - - - - - + }> + + + + + {(params) => } + + + + + + {() => } + + {(params) => } + + {() => } + + {(params) => } + + + + + {() => } + + {(params) => } + + {() => } + + {(params) => } + + {() => } + {() => } + {() => } + {() => } + + + + + ); } - -function App() { +export default function App() { return ( - - - - - - - - - + + + + + + + + + + + ); } - -export default App; diff --git a/src/components/AddToCart.tsx b/src/components/AddToCart.tsx new file mode 100644 index 0000000..4acaf7c --- /dev/null +++ b/src/components/AddToCart.tsx @@ -0,0 +1,84 @@ +import { useState } from "react"; +import { useQueryClient } from "@tanstack/react-query"; +import { z } from "zod"; +import Button from "@mui/material/Button"; +import TextField from "@mui/material/TextField"; +import Alert from "@mui/material/Alert"; +import { Link } from "wouter"; +import { cart } from "@/lib/commerce"; +import { usePlatform } from "@/lib/platform"; +import { ApiNotice } from "./ApiNotice"; +export function AddToCart({ variantId }: { variantId: string }) { + const { principal, request, scope } = usePlatform(), + client = useQueryClient(); + const [busy, setBusy] = useState(false), + [error, setError] = useState(null), + [saved, setSaved] = useState(false), + [quantity, setQuantity] = useState(1); + if (!principal) + return ( + + Sign in to add to cart + + ); + return ( +
+
{ + event.preventDefault(); + if (busy) return; + setBusy(true); + setError(null); + setSaved(false); + try { + z.number().int().min(1).max(100).parse(quantity); + const current = await request("/cart", cart); + const total = + (current.lines.find((l) => l.variantId === variantId)?.quantity || + 0) + quantity; + z.number().int().max(100).parse(total); + await request( + `/cart/lines/${variantId}`, + z.object({ version: z.number() }), + { + method: "PUT", + body: { quantity: total, version: current.version }, + }, + ); + await client.invalidateQueries({ + queryKey: ["private", scope, "/cart"], + }); + setSaved(true); + } catch (error) { + setError(error); + } finally { + setBusy(false); + } + }} + > + setQuantity(Number(e.target.value))} + inputProps={{ min: 1, max: 100, step: 1 }} + disabled={busy} + /> + + + + {saved && ( + + Added.{" "} + + Review cart + + + )} +
+ ); +} diff --git a/src/components/ConfirmAction.tsx b/src/components/ConfirmAction.tsx new file mode 100644 index 0000000..139cbbb --- /dev/null +++ b/src/components/ConfirmAction.tsx @@ -0,0 +1,70 @@ +import { useState } from "react"; +import Button from "@mui/material/Button"; +import Dialog from "@mui/material/Dialog"; +import DialogTitle from "@mui/material/DialogTitle"; +import DialogContent from "@mui/material/DialogContent"; +import DialogActions from "@mui/material/DialogActions"; +import { ApiNotice } from "./ApiNotice"; +export function ConfirmAction({ + label, + message, + onConfirm, + disabled = false, +}: { + label: string; + message: string; + onConfirm: () => Promise; + disabled?: boolean; +}) { + const [open, setOpen] = useState(false), + [busy, setBusy] = useState(false), + [error, setError] = useState(null); + return ( + <> + + { + if (!busy) setOpen(false); + }} + aria-labelledby="confirm-title" + > + {label} + +

{message}

+ +
+ + + + +
+ + ); +} diff --git a/src/components/ErrorBoundary.tsx b/src/components/ErrorBoundary.tsx new file mode 100644 index 0000000..f9089ca --- /dev/null +++ b/src/components/ErrorBoundary.tsx @@ -0,0 +1,27 @@ +import { Component, type ReactNode } from "react"; +import Alert from "@mui/material/Alert"; +import Button from "@mui/material/Button"; +export class ErrorBoundary extends Component< + { children: ReactNode }, + { failed: boolean } +> { + state = { failed: false }; + static getDerivedStateFromError() { + return { failed: true }; + } + componentDidCatch() { + console.error("APPLICATION_RENDER_FAILED"); + } + render() { + return this.state.failed ? ( +
+ + This page could not be displayed. Reload to start a fresh session. + + +
+ ) : ( + this.props.children + ); + } +} diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index 2906e95..2729528 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -14,12 +14,12 @@ const logoPath = "/opengraph.jpg"; // ── Ticker messages ────────────────────────────────────── const TICKER_ITEMS = [ - { icon: , text: "UAT — catalog and staff access" }, + { icon: , text: "UAT — commerce and administration" }, { icon: , text: "Explore the published collection" }, { icon: , text: "Handpoured in small batches" }, { icon: , text: "100% Natural Soy Wax" }, { icon: , text: "Phthalate-free fragrance oils" }, - { icon: , text: "Ordering arrives in the commerce phase" }, + { icon: , text: "Payment collection is not enabled" }, ]; // ── Nav structure with dropdowns ───────────────────────── @@ -50,6 +50,7 @@ const NAV_LINKS = [ ], }, { name: "Workspace", path: "/workspace", dropdown: null }, + { name: "Cart", path: "/cart", dropdown: null }, { name: "Connection", path: "/connection", dropdown: null }, ]; diff --git a/src/components/RecordSelection.tsx b/src/components/RecordSelection.tsx new file mode 100644 index 0000000..b7c141e --- /dev/null +++ b/src/components/RecordSelection.tsx @@ -0,0 +1,73 @@ +import { useState } from "react"; +import { z } from "zod"; +import Checkbox from "@mui/material/Checkbox"; +import { usePlatform } from "@/lib/platform"; +import { Pager, QueryView, Table, usePrivateQuery } from "./WorkspaceTools"; +const record = z.object({ + id: z.string().uuid(), + name: z.string(), + isSystem: z.boolean().optional(), + permissions: z.array(z.string()).optional(), +}); +export function RecordSelection({ + name, + label, + path, + initial = [], + roles = false, +}: { + name: string; + label: string; + path: string; + initial?: string[]; + roles?: boolean; +}) { + const { principal } = usePlatform(); + const [selected, setSelected] = useState(initial), + [offset, setOffset] = useState(0); + const query = usePrivateQuery( + `${path}?limit=25&offset=${offset}`, + z.array(record), + ); + return ( +
+ {label} +

{selected.length} selected. Selections are retained across pages.

+ {selected.map((id) => ( + + ))} + + {(items) => ( + <> + item.id)} + rows={items.map((item) => [ + !principal?.permissions.includes(p), + )) + } + onChange={(_, checked) => + setSelected((ids) => + checked + ? [...ids, item.id] + : ids.filter((id) => id !== item.id), + ) + } + />, + item.name, + ])} + /> + + + )} + + + ); +} diff --git a/src/components/WorkspaceShell.tsx b/src/components/WorkspaceShell.tsx new file mode 100644 index 0000000..87a6653 --- /dev/null +++ b/src/components/WorkspaceShell.tsx @@ -0,0 +1,76 @@ +import type { ReactNode } from "react"; +import { Link } from "wouter"; +import Container from "@mui/material/Container"; +import Alert from "@mui/material/Alert"; +import Button from "@mui/material/Button"; +import { usePlatform } from "@/lib/platform"; +import "@/pages/workspace.css"; +export function WorkspaceShell({ + title, + permission, + children, +}: { + title: string; + permission?: string; + children: ReactNode; +}) { + const { principal, can, scope } = usePlatform(); + return ( +
+ +

{title}

+ {!principal ? ( + + Sign in to continue.{" "} + + Account sign-in + + + ) : ( + <> + + {permission && !can(permission) ? ( + + Your account does not have permission to view this page. + + ) : ( +
{children}
+ )} + + )} +
+
+ ); +} + +export function WorkspaceNavigation() { + const { can } = usePlatform(); + const links = [ + { label: "My cart", path: "/cart" }, + { label: "Addresses", path: "/addresses" }, + { label: "My orders", path: "/orders" }, + { label: "Access", path: "/admin/access", permission: "users.read" }, + { label: "Roles", path: "/admin/roles", permission: "roles.read" }, + { label: "Catalog", path: "/admin/catalog", permission: "catalog.read" }, + { + label: "Inventory", + path: "/admin/inventory", + permission: "inventory.read", + }, + { label: "Coupons", path: "/admin/coupons", permission: "coupons.manage" }, + { label: "Pricing", path: "/admin/pricing", permission: "pricing.manage" }, + { label: "All orders", path: "/admin/orders", permission: "orders.read" }, + { label: "Audit", path: "/admin/audit", permission: "audit.read" }, + ]; + return ( + + ); +} diff --git a/src/components/WorkspaceTools.tsx b/src/components/WorkspaceTools.tsx new file mode 100644 index 0000000..e5b6b75 --- /dev/null +++ b/src/components/WorkspaceTools.tsx @@ -0,0 +1,286 @@ +import { + createContext, + useContext, + useId, + useRef, + useState, + type ReactNode, +} from "react"; +import { Link } from "wouter"; +import { useQuery, type UseQueryResult } from "@tanstack/react-query"; +import { z } from "zod"; +import Alert from "@mui/material/Alert"; +import Button from "@mui/material/Button"; +import TextField from "@mui/material/TextField"; +import Checkbox from "@mui/material/Checkbox"; +import FormControlLabel from "@mui/material/FormControlLabel"; +import LinearProgress from "@mui/material/LinearProgress"; +import Paper from "@mui/material/Paper"; +import { usePlatform } from "@/lib/platform"; +import { ApiNotice } from "./ApiNotice"; +export function usePrivateQuery(path: string, schema: z.ZodType) { + const { scope, request } = usePlatform(); + return useQuery({ + queryKey: ["private", scope, path], + queryFn: ({ signal }) => request(path, schema, { signal }), + enabled: Boolean(scope), + retry: false, + }); +} +export function QueryView({ + query, + children, +}: { + query: UseQueryResult; + children: (data: T) => ReactNode; +}) { + if (query.isPending) return ; + if (query.isError) + return ( + <> + + + + ); + return <>{children(query.data)}; +} +export function Panel({ + title, + children, +}: { + title: string; + children: ReactNode; +}) { + return ( + +

{title}

+ {children} +
+ ); +} +const Errors = createContext>({}); +export function ActionForm({ + label, + read, + submit, + children, + reset = true, + lockFields = false, +}: { + label: string; + read: (data: FormData) => unknown; + submit: (input: unknown) => Promise; + children: ReactNode; + reset?: boolean; + lockFields?: boolean; +}) { + const [busy, setBusy] = useState(false), + [error, setError] = useState(null), + [success, setSuccess] = useState(false), + [fields, setFields] = useState>({}); + const submitting = useRef(false); + return ( +
{ + event.preventDefault(); + if (submitting.current) return; + submitting.current = true; + const form = event.currentTarget; + setBusy(true); + setError(null); + setSuccess(false); + setFields({}); + try { + await submit(read(new FormData(form))); + if (reset) form.reset(); + setSuccess(true); + } catch (error) { + if (error instanceof z.ZodError) { + setFields( + Object.fromEntries( + error.issues.map((i) => [String(i.path[0]), i.message]), + ), + ); + setError( + new Error( + error.issues + .map((issue) => `${issue.path.join(".")}: ${issue.message}`) + .join("; "), + ), + ); + } else setError(error); + } finally { + submitting.current = false; + setBusy(false); + } + }} + > +
+ {children} +
+ + {success && Saved successfully.} + + + ); +} +export function Field({ + name, + label, + type = "text", + value, + required = true, + maxLength, + options, + multiple = false, + helper, + onChange, +}: { + name: string; + label: string; + type?: string; + value?: string | number | string[]; + required?: boolean; + maxLength?: number; + options?: { value: string; label: string }[]; + multiple?: boolean; + helper?: string; + onChange?: (value: string) => void; +}) { + const errors = useContext(Errors), + id = useId(); + return ( + onChange(event.target.value) : undefined} + autoComplete={type === "password" ? "new-password" : undefined} + required={required} + fullWidth + error={Boolean(errors[name])} + helperText={errors[name] || helper} + inputProps={{ maxLength }} + select={Boolean(options)} + InputLabelProps={multiple ? { shrink: true } : undefined} + SelectProps={options ? { native: true, multiple } : undefined} + > + {options && ( + <> + {!required && !multiple && } + {options.map((o) => ( + + ))} + + )} + + ); +} +export function Check({ + name, + label, + value = false, +}: { + name: string; + label: string; + value?: boolean; +}) { + return ( + } + label={label} + /> + ); +} +export const readText = (data: FormData, name: string) => + String(data.get(name) ?? ""); +export const readNumber = (data: FormData, name: string) => + Number(data.get(name)); +export function Pager({ + offset, + count, + onPage, +}: { + offset: number; + count: number; + onPage: (offset: number) => void; +}) { + return ( +
+ + Page {offset / 25 + 1} + +
+ ); +} +export function Empty({ label = "No records yet." }: { label?: string }) { + return {label}; +} +export function Table({ + head, + rows, + rowKeys, +}: { + head: string[]; + rows: ReactNode[][]; + rowKeys: string[]; +}) { + return rows.length ? ( +
+
+ + + {head.map((h) => ( + + ))} + + + + {rows.map((row, index) => ( + + {row.map((cell, i) => ( + + ))} + + ))} + +
+ {h} +
{cell}
+ + ) : ( + + ); +} +export function WorkspaceLink({ + href, + children, +}: { + href: string; + children: ReactNode; +}) { + return ( + + {children} + + ); +} diff --git a/src/hooks/use-toast.ts b/src/hooks/use-toast.ts index 2c14125..e154e54 100644 --- a/src/hooks/use-toast.ts +++ b/src/hooks/use-toast.ts @@ -15,12 +15,12 @@ type ToasterToast = ToastProps & { action?: ToastActionElement } -const actionTypes = { +type ActionType = { ADD_TOAST: "ADD_TOAST", UPDATE_TOAST: "UPDATE_TOAST", DISMISS_TOAST: "DISMISS_TOAST", REMOVE_TOAST: "REMOVE_TOAST", -} as const +} let count = 0 @@ -29,7 +29,7 @@ function genId() { return count.toString() } -type ActionType = typeof actionTypes + type Action = | { diff --git a/src/lib/api.ts b/src/lib/api.ts index 63d3279..7c62b83 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -1,6 +1,6 @@ import { z } from "zod"; -export const organizationSchema = z.string().uuid(); +export const organizationSchema = z.string().uuid().toLowerCase(); const productSummarySchema = z.object({ id: z.string().uuid(), name: z.string(), @@ -13,7 +13,7 @@ export const productSchema = productSummarySchema.extend({ id: z.string().uuid(), sku: z.string(), name: z.string(), - price: z.string().regex(/^\d+\.\d{2}$/), + price: z.string().regex(/^\d+(?:\.\d{1,2})?$/), currency: z.string(), attributes: z.record(z.string()), }), @@ -62,6 +62,16 @@ export class ApiError extends Error { this.requestId = requestId; } } +export function isUnknownOutcome(error: unknown) { + return ( + (error instanceof Error && error.name === "AbortError") || + (error instanceof ApiError && + (error.status === 0 || + error.status >= 500 || + error.code === "INVALID_RESPONSE" || + error.code === "SESSION_CHANGED")) + ); +} export async function apiRequest( path: string, @@ -118,7 +128,7 @@ export async function apiRequest( ); return data; } -function parse(schema: z.ZodType, data: unknown): T { +export function parse(schema: z.ZodType, data: unknown): T { const result = schema.safeParse(data); if (!result.success) throw new ApiError( @@ -165,12 +175,12 @@ export async function login( email: string, password: string, ) { - organizationSchema.parse(organizationId); + const organization = organizationSchema.parse(organizationId); return parse( sessionSchema, await apiRequest("/auth/login", { method: "POST", - body: { organizationId, email, password }, + body: { organizationId: organization, email, password }, }), ); } diff --git a/src/lib/commerce.ts b/src/lib/commerce.ts new file mode 100644 index 0000000..b2e3937 --- /dev/null +++ b/src/lib/commerce.ts @@ -0,0 +1,311 @@ +import { z } from "zod"; +export const uuid = z.string().uuid(); +export const currency = z.enum(["INR", "USD", "EUR", "GBP"]); +export const decimal = z.string().regex(/^\d+(?:\.\d{1,2})?$/); +export const amount = z.string().regex(/^(0|[1-9]\d{0,9})\.\d{2}$/); +const text = (max: number, min = 1) => + z + .string() + .trim() + .min(min) + .max(max) + .regex(/^[^<>\u0000-\u001F\u007F]*$/, "Plain text only"); +export const addressInput = z + .object({ + recipient: text(160), + line1: text(200), + line2: text(200, 0), + city: text(100), + region: text(100), + postalCode: text(20).regex(/^[A-Za-z0-9 -]+$/), + countryCode: z + .string() + .toUpperCase() + .regex(/^[A-Z]{2}$/), + phone: z.string().regex(/^\+[1-9]\d{6,14}$/), + isDefault: z.boolean(), + }) + .strict(); +export const address = addressInput.extend({ id: uuid }).strip(); +export type Address = z.infer; +export const cart = z.object({ + version: z.number().int().nonnegative(), + lines: z.array( + z.object({ + variantId: uuid, + quantity: z.number().int().positive(), + variant: z.object({ + name: z.string(), + sku: z.string(), + price: decimal, + currency, + active: z.boolean(), + product: z.object({ name: z.string(), status: z.string() }), + }), + }), + ), +}); +export type Cart = z.infer; +export const couponCode = text(40) + .toUpperCase() + .regex(/^[A-Z0-9][A-Z0-9_-]{0,39}$/); +export const checkoutInput = z + .object({ + cartVersion: z.number().int().min(0).max(2147483646), + addressId: uuid, + idempotencyKey: uuid, + couponCode: couponCode.optional(), + }) + .strict(); +export type CheckoutIntent = z.infer; +export function checkoutIntent( + input: Omit, + key: string, +) { + return Object.freeze(checkoutInput.parse({ ...input, idempotencyKey: key })); +} +export function money(value: string) { + decimal.parse(value); + const [whole, fraction = ""] = value.split("."); + return `${BigInt(whole)}.${fraction.padEnd(2, "0")}`; +} +export function moneyTotal(lines: { price: string; quantity: number }[]) { + const total = lines.reduce((sum, line) => { + z.number().int().nonnegative().parse(line.quantity); + return ( + sum + BigInt(money(line.price).replace(".", "")) * BigInt(line.quantity) + ); + }, 0n); + return `${total / 100n}.${(total % 100n).toString().padStart(2, "0")}`; +} +export const orderSummary = z.object({ + id: uuid, + status: z.enum(["PENDING_PAYMENT", "CANCELLED", "EXPIRED"]), + currency, + merchandiseTotal: decimal, + createdAt: z.string(), + expiresAt: z.string(), +}); +export const order = orderSummary.extend({ + subtotal: decimal, + discount: decimal, + pricingStatus: z.enum(["FINALIZED", "UNFINALIZED"]), + taxTotal: decimal.nullable(), + shippingTotal: decimal.nullable(), + payableTotal: decimal.nullable(), + paymentAvailable: z.literal(false), + address: addressInput.omit({ isDefault: true }).strip(), + lines: z.array( + z.object({ + variantId: uuid, + sku: z.string(), + productName: z.string(), + variantName: z.string(), + quantity: z.number().int(), + unitPrice: decimal, + lineTotal: decimal, + }), + ), +}); +export type Order = z.infer; +export const productInput = z + .object({ + name: text(160), + slug: text(160).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/), + description: text(5000, 0), + groupIds: z + .array(uuid) + .max(20) + .refine((v) => new Set(v).size === v.length), + }) + .strict(); +export const groupInput = z + .object({ + name: text(100), + slug: text(100).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/), + kind: z.enum(["CATEGORY", "COLLECTION"]), + }) + .strict(); +export const group = groupInput.extend({ id: uuid }).strip(); +export const variantInput = z + .object({ + sku: text(64) + .toUpperCase() + .regex(/^[A-Z0-9][A-Z0-9_-]*$/), + name: text(160), + price: amount.refine((v) => v !== "0.00"), + currency, + active: z.boolean(), + attributes: z + .record( + z + .string() + .regex(/^[a-z][a-z0-9_]{0,31}$/) + .refine((v) => !["constructor", "prototype"].includes(v)), + text(100), + ) + .refine((v) => Object.keys(v).length <= 20), + }) + .strict(); +export const variant = variantInput + .extend({ id: uuid, price: decimal }) + .strip(); +export const adminProductSummary = productInput + .pick({ name: true, slug: true }) + .extend({ id: uuid, status: z.enum(["DRAFT", "PUBLISHED", "ARCHIVED"]) }) + .strip(); +export const adminProduct = adminProductSummary.extend({ + description: z.string(), + variants: z.array(variant), + groups: z.array(z.object({ group })), +}); +export type AdminProduct = z.infer; +export const userInput = z + .object({ + name: text(160), + email: z.string().email().max(254).toLowerCase(), + password: z.string().min(15).max(128), + }) + .strict(); +export const user = userInput.omit({ password: true }).extend({ + id: uuid, + status: z.enum(["PENDING", "ACTIVE", "SUSPENDED"]), + isOwner: z.boolean(), + createdAt: z.string(), +}); +export const roleInput = z + .object({ + name: text(80), + permissions: z + .array(z.string()) + .refine((v) => new Set(v).size === v.length), + }) + .strict(); +export const role = roleInput + .extend({ id: uuid, isSystem: z.boolean() }) + .strip(); +export const audit = z.object({ + id: uuid, + actorId: uuid.nullable(), + action: z.string(), + targetId: z.string().nullable(), + createdAt: z.string(), +}); +export const warehouseInput = z.object({ name: text(100) }).strict(); +export const warehouse = warehouseInput.extend({ id: uuid }).strip(); +export const stockInput = z + .object({ variantId: uuid, warehouseId: uuid }) + .strict(); +export const stock = stockInput + .extend({ id: uuid, onHand: z.number().int() }) + .strip(); +export const stockDetail = stock.extend({ + reserved: z.number().int(), + available: z.number().int(), +}); +export const adjustmentInput = z + .object({ + stockItemId: uuid, + delta: z + .number() + .int() + .min(-1000000) + .max(1000000) + .refine((v) => v !== 0), + reason: text(200), + idempotencyKey: uuid, + }) + .strict(); +export const ledger = z.object({ + id: uuid, + delta: z.number().int(), + reason: z.string(), + createdAt: z.string(), +}); +export const reservationInput = z + .object({ + stockItemId: uuid, + quantity: z.number().int().min(1).max(1000000), + ttlMinutes: z.number().int().min(1).max(60), + idempotencyKey: uuid, + }) + .strict(); +export const reservation = z.object({ + id: uuid, + orderId: uuid.nullable().optional(), + stockItemId: uuid, + quantity: z.number().int(), + status: z.enum(["ACTIVE", "RELEASED", "COMMITTED", "EXPIRED"]), + expiresAt: z.string(), +}); +const couponCommon = z.object({ + code: couponCode, + currency, + minimumSubtotal: amount, + maxUses: z.number().int().min(1).max(1000000), + perUserLimit: z.number().int().min(1).max(100), + startsAt: z.string().datetime({ offset: true }), + endsAt: z.string().datetime({ offset: true }), +}); +export const couponInput = z + .discriminatedUnion("kind", [ + couponCommon + .extend({ + kind: z.literal("FIXED"), + amount: amount.refine((v) => v !== "0.00"), + }) + .strict(), + couponCommon + .extend({ + kind: z.literal("PERCENT"), + percentBps: z.number().int().min(1).max(10000), + }) + .strict(), + ]) + .refine((v) => Date.parse(v.endsAt) > Date.parse(v.startsAt), { + path: ["endsAt"], + message: "End must follow start", + }) + .refine((v) => v.perUserLimit <= v.maxUses, { + path: ["perUserLimit"], + message: "Per-user limit exceeds total limit", + }); +export const coupon = z.object({ + id: uuid, + code: z.string(), + currency, + kind: z.enum(["FIXED", "PERCENT"]), + amount: decimal.nullable(), + percentBps: z.number().nullable(), + minimumSubtotal: decimal, + maxUses: z.number(), + perUserLimit: z.number(), + active: z.boolean(), + startsAt: z.string(), + endsAt: z.string(), +}); +export const pricingInput = z + .object({ + name: text(100), + currency, + countryCode: z + .string() + .trim() + .toUpperCase() + .regex(/^[A-Z]{2}$/), + region: text(100, 0).toUpperCase(), + taxMode: z.enum(["INCLUSIVE", "EXCLUSIVE"]), + merchandiseTaxBps: z.number().int().min(0).max(10000), + shippingFee: amount, + shippingTaxBps: z.number().int().min(0).max(10000), + freeShippingMinimum: amount.nullable(), + }) + .strict(); +export const pricing = pricingInput + .extend({ + id: uuid, + active: z.boolean(), + shippingFee: decimal, + freeShippingMinimum: decimal.nullable(), + }) + .strip(); diff --git a/src/lib/platform.tsx b/src/lib/platform.tsx index e936042..425313d 100644 --- a/src/lib/platform.tsx +++ b/src/lib/platform.tsx @@ -1,28 +1,44 @@ import { createContext, useContext, + useCallback, useEffect, useRef, useState, type ReactNode, } from "react"; +import { useQueryClient } from "@tanstack/react-query"; +import { z } from "zod"; import { apiRequest, ApiError, getPrincipal, login, organizationSchema, + parse, type Principal, type Session, } from "./api"; +type Options = { method?: string; body?: unknown; signal?: AbortSignal }; const PlatformContext = createContext<{ organization: string; setOrganization: (value: string) => void; principal: Principal | null; + scope: string; signIn: (email: string, password: string) => Promise; signOut: () => Promise; notice: string; + clearSession: (notice?: string) => void; + getIntent: (key: string) => unknown; + saveIntent: (key: string, value: unknown) => void; + clearIntent: (key: string, idempotencyKey: string) => void; + can: (permission: string) => boolean; + request: ( + path: string, + schema: z.ZodType, + options?: Options, + ) => Promise; } | null>(null); function initialOrganization() { let value = import.meta.env.VITE_ORGANIZATION_ID || ""; @@ -31,54 +47,80 @@ function initialOrganization() { } catch { /* Storage can be disabled. */ } - return organizationSchema.safeParse(value).success ? value : ""; + const parsed = organizationSchema.safeParse(value); + return parsed.success ? parsed.data : ""; } export function PlatformProvider({ children }: { children: ReactNode }) { + const client = useQueryClient(); const [organization, updateOrganization] = useState(initialOrganization); const [session, setSession] = useState(null); const [principal, setPrincipal] = useState(null); const [notice, setNotice] = useState(""); - const loginVersion = useRef(0); + const [accessRevision, setAccessRevision] = useState(0); + const revision = useRef(0), + intents = useRef(new Map()); + const current = useRef(null), + generation = useRef(0), + scopeAbort = useRef(new AbortController()); + const clearSession = useCallback( + (message = "") => { + generation.current += 1; + current.current = null; + revision.current += 1; + setAccessRevision(revision.current); + intents.current.clear(); + scopeAbort.current.abort(); + scopeAbort.current = new AbortController(); + void client.cancelQueries({ queryKey: ["private"] }); + client.removeQueries({ queryKey: ["private"] }); + client.getMutationCache().clear(); + setSession(null); + setPrincipal(null); + setNotice(message); + }, + [client], + ); useEffect(() => { if (!session) return; const timer = setTimeout( - () => { - setSession(null); - setPrincipal(null); - setNotice("Your session expired. Sign in again."); - }, + () => clearSession("Your session expired. Sign in again."), Math.max(0, Date.parse(session.expiresAt) - Date.now()), ); return () => clearTimeout(timer); - }, [session]); + }, [session, clearSession]); + useEffect(() => { + scopeAbort.current = new AbortController(); + return () => { + generation.current += 1; + scopeAbort.current.abort(); + }; + }, []); function setOrganization(value: string) { - organizationSchema.parse(value); - if (value !== organization) { - loginVersion.current += 1; - setSession(null); - setPrincipal(null); - } - updateOrganization(value); + const normalized = organizationSchema.parse(value); + if (normalized !== organization) clearSession(); + updateOrganization(normalized); setNotice(""); try { - localStorage.setItem("mani.organization", value); + localStorage.setItem("mani.organization", normalized); } catch { /* The in-memory setting still works. */ } } async function signIn(email: string, password: string) { - const version = ++loginVersion.current; + const version = ++generation.current; const next = await login(organization, email, password); try { const me = await getPrincipal(next.accessToken); - if (version !== loginVersion.current) + if ( + version !== generation.current || + me.organizationId !== organization || + Date.parse(next.expiresAt) <= Date.now() + ) throw new Error( - "The connection changed during sign-in. Please try again.", - ); - if (me.organizationId !== organization) - throw new Error( - "The session organization does not match the configured organization.", + "The session changed during sign-in. Please try again.", ); + clearSession(); + current.current = next; setSession(next); setPrincipal(me); setNotice(""); @@ -86,24 +128,103 @@ export function PlatformProvider({ children }: { children: ReactNode }) { await apiRequest("/auth/logout", { method: "POST", token: next.accessToken, - }).catch(() => {}); + }).catch(() => { + /* Best-effort revoke; this token is never retained locally. */ + }); throw error; } } async function signOut() { - loginVersion.current += 1; - if (!session) return; + const previous = current.current; + clearSession(); + if (!previous) return; try { await apiRequest("/auth/logout", { method: "POST", - token: session.accessToken, + token: previous.accessToken, }); } catch (error) { - if (!(error instanceof ApiError && error.status === 401)) throw error; + if (error instanceof ApiError && error.status === 401) return; + throw new Error( + "You are signed out locally, but server revocation could not be confirmed. The server session will expire automatically.", + ); + } + } + async function request( + path: string, + schema: z.ZodType, + options: Options = {}, + ) { + const active = session; + if ( + !active || + current.current !== active || + revision.current !== accessRevision + ) + throw new ApiError("Sign in to continue.", 401, "SESSION_CHANGED"); + if (Date.parse(active.expiresAt) <= Date.now()) { + clearSession("Your session expired. Sign in again."); + throw new ApiError("Your session expired.", 401, "SESSION_EXPIRED"); + } + const signal = options.signal + ? AbortSignal.any([scopeAbort.current.signal, options.signal]) + : scopeAbort.current.signal; + try { + const data = await apiRequest(path, { + ...options, + token: active.accessToken, + signal, + }); + if (current.current !== active || revision.current !== accessRevision) + throw new ApiError( + "Your session changed. Sign in again.", + 401, + "SESSION_CHANGED", + ); + return parse(schema, data); + } catch (error) { + if ( + current.current === active && + revision.current === accessRevision && + error instanceof ApiError + ) { + if (error.status === 401) + clearSession("Your session is no longer valid. Sign in again."); + else if (error.status === 403) { + try { + const me = await getPrincipal(active.accessToken); + if ( + current.current === active && + revision.current === accessRevision + ) { + if ( + me.permissions.length !== principal?.permissions.length || + me.permissions.some( + (permission) => !principal?.permissions.includes(permission), + ) + ) { + scopeAbort.current.abort(); + scopeAbort.current = new AbortController(); + revision.current += 1; + setAccessRevision(revision.current); + void client.cancelQueries({ queryKey: ["private"] }); + client.removeQueries({ queryKey: ["private"] }); + client.getMutationCache().clear(); + } + setPrincipal(me); + } + } catch (refresh) { + if ( + current.current === active && + refresh instanceof ApiError && + refresh.status === 401 + ) + clearSession("Your session is no longer valid. Sign in again."); + } + } + } + throw error; } - setSession(null); - setPrincipal(null); - setNotice(""); } return ( + session && current.current === session + ? intents.current.get(key) + : undefined, + saveIntent: (key, value) => { + if (session && current.current === session) + intents.current.set(key, value); + }, + clearIntent: (key, idempotencyKey) => { + const stored = intents.current.get(key); + if ( + session && + current.current === session && + typeof stored === "object" && + stored !== null && + "idempotencyKey" in stored && + stored.idempotencyKey === idempotencyKey + ) + intents.current.delete(key); + }, + can: (permission) => + Boolean(principal?.permissions.includes(permission)), + request, }} > {children} diff --git a/src/lib/recovery-token.ts b/src/lib/recovery-token.ts new file mode 100644 index 0000000..5b5787c --- /dev/null +++ b/src/lib/recovery-token.ts @@ -0,0 +1,20 @@ +let token: string | null = null; +export function captureRecoveryToken( + location: { hash: string; pathname: string; search: string }, + history: { + replaceState: (data: unknown, unused: string, url: string) => void; + }, +) { + const params = new URLSearchParams(location.hash.slice(1)); + if (!params.has("token")) return null; + const value = params.get("token") || ""; + history.replaceState(null, "", location.pathname + location.search); + token = /^[A-Za-z0-9_-]{43}$/.test(value) ? value : null; + return token; +} +export function getRecoveryToken() { + return token; +} +export function clearRecoveryToken() { + token = null; +} diff --git a/src/lib/use-idempotent-command.ts b/src/lib/use-idempotent-command.ts new file mode 100644 index 0000000..283b52a --- /dev/null +++ b/src/lib/use-idempotent-command.ts @@ -0,0 +1,44 @@ +import { useRef, useState } from "react"; +import { z } from "zod"; +import { isUnknownOutcome } from "./api"; +import { usePlatform } from "./platform"; +export function useIdempotentCommand( + path: string, + input: z.ZodType, + output: z.ZodType, + commandId: string, +) { + const { request, getIntent, saveIntent, clearIntent } = usePlatform(); + const key = `${path}:${commandId}`; + const saved = getIntent(key); + const intent = useRef(saved ? input.parse(saved) : null); + const [uncertain, setUncertain] = useState(Boolean(saved)); + async function run(value: unknown) { + if (!intent.current) { + const object = z.record(z.unknown()).parse(value); + intent.current = Object.freeze( + input.parse({ ...object, idempotencyKey: crypto.randomUUID() }), + ); + saveIntent(key, intent.current); + } + try { + const result = await request(path, output, { + method: "POST", + body: intent.current, + }); + clearIntent(key, intent.current.idempotencyKey); + intent.current = null; + setUncertain(false); + return result; + } catch (error) { + if (isUnknownOutcome(error)) setUncertain(true); + else { + if (intent.current) clearIntent(key, intent.current.idempotencyKey); + intent.current = null; + setUncertain(false); + } + throw error; + } + } + return { run, uncertain }; +} diff --git a/src/main.tsx b/src/main.tsx index d025d59..86be0d4 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -3,7 +3,10 @@ import { ThemeProvider } from "@mui/material/styles"; import CssBaseline from "@mui/material/CssBaseline"; import App from "./App"; import theme from "./theme"; -import "./index.css"; +import "./index.css"; +import { captureRecoveryToken } from "./lib/recovery-token"; + +captureRecoveryToken(window.location, window.history); createRoot(document.getElementById("root")!).render( diff --git a/src/pages/AccessPage.tsx b/src/pages/AccessPage.tsx new file mode 100644 index 0000000..38dfec0 --- /dev/null +++ b/src/pages/AccessPage.tsx @@ -0,0 +1,297 @@ +import { RecordSelection } from "@/components/RecordSelection"; +import { useState } from "react"; +import { z } from "zod"; +import Button from "@mui/material/Button"; +import Alert from "@mui/material/Alert"; +import { user, userInput, role, roleInput, uuid, audit } from "@/lib/commerce"; +import { usePlatform } from "@/lib/platform"; +import { WorkspaceShell } from "@/components/WorkspaceShell"; +import { + ActionForm, + Field, + Pager, + Panel, + QueryView, + Table, + usePrivateQuery, + readText, +} from "@/components/WorkspaceTools"; +import { ConfirmAction } from "@/components/ConfirmAction"; +function Roles() { + const { request, can, principal } = usePlatform(); + const [offset, setOffset] = useState(0), + [editing, setEditing] = useState | null>(null); + const roles = usePrivateQuery( + `/roles?limit=25&offset=${offset}`, + z.array(role), + ); + return ( + + + {(items) => ( + <> + item.id)} + rows={items.map((r) => [ + r.name, + r.permissions.join(", "), + can("roles.manage") && + !r.isSystem && + r.permissions.every((p) => + principal?.permissions.includes(p), + ) ? ( + + ) : r.isSystem ? ( + "System role" + ) : ( + "Read only" + ), + ])} + /> + + + )} + + {can("roles.manage") && ( + <> +

{editing ? `Edit ${editing.name}` : "Create a role"}

+ ({ + name: readText(data, "name"), + permissions: data.getAll("permissions").map(String), + })} + submit={async (value) => { + const body = roleInput.parse(value); + if ( + body.permissions.some( + (p) => !principal?.permissions.includes(p), + ) + ) + throw new Error( + "You cannot grant a permission you do not hold.", + ); + await request(editing ? `/roles/${editing.id}` : "/roles", role, { + method: editing ? "PATCH" : "POST", + body, + }); + setEditing(null); + await roles.refetch(); + }} + > + + ({ value: p, label: p })) || + [] + } + multiple + required={false} + value={editing?.permissions || []} + helper="Select only permissions this role should receive." + /> + + {editing && ( + + )} + + )} + + ); +} +function UserRoles({ userId }: { userId: string }) { + const { request } = usePlatform(); + return ( + <> + + This replaces all role assignments. The API does not expose current + assignments; select the full intended set. System roles cannot be + assigned. + + ({ roleIds: data.getAll("roleIds").map(String) })} + submit={async (value) => { + const body = z + .object({ + roleIds: z + .array(uuid) + .max(20) + .refine((v) => new Set(v).size === v.length), + }) + .parse(value); + await request(`/users/${userId}/roles`, z.object({ id: uuid }), { + method: "PATCH", + body, + }); + }} + reset={false} + > + + + + ); +} +function Users() { + const { request, can, principal } = usePlatform(); + const [offset, setOffset] = useState(0), + [selected, setSelected] = useState(null); + const query = usePrivateQuery( + `/users?limit=25&offset=${offset}`, + z.array(user), + ); + return ( + <> + + + {(items) => ( + <> +
item.id)} + rows={items.map((u) => [ + u.name, + u.email, + u.status, + <> + {!u.isOwner && u.id !== principal?.userId && ( + <> + {can("users.approve") && ( + { + await request(`/users/${u.id}/status`, user, { + method: "PATCH", + body: { + status: + u.status === "ACTIVE" + ? "SUSPENDED" + : "ACTIVE", + }, + }); + await query.refetch(); + }} + /> + )} + {can("users.roles.assign") && can("roles.read") && ( + + )} + + )} + , + ])} + /> + + {selected && } + + )} + + + {can("users.create") && ( + + ({ + name: readText(data, "name"), + email: readText(data, "email"), + password: readText(data, "password"), + })} + submit={async (value) => { + await request("/users", user, { + method: "POST", + body: userInput.parse(value), + }); + await query.refetch(); + }} + > + + + + + + )} + + ); +} +export default function AccessPage() { + return ( + + + + ); +} +export function RolesPage() { + return ( + + + + ); +} +function Audit() { + const [offset, setOffset] = useState(0); + const query = usePrivateQuery( + `/audit-events?limit=25&offset=${offset}`, + z.array(audit), + ); + return ( + + + {(items) => ( + <> +
item.id)} + rows={items.map((a) => [ + new Date(a.createdAt).toLocaleString(), + a.action, + a.actorId || "System", + a.targetId || "—", + ])} + /> + + + )} + + + ); +} +export function AuditPage() { + return ( + + + + ); +} diff --git a/src/pages/AddressesPage.tsx b/src/pages/AddressesPage.tsx new file mode 100644 index 0000000..6866cb0 --- /dev/null +++ b/src/pages/AddressesPage.tsx @@ -0,0 +1,130 @@ +import { useState } from "react"; +import { z } from "zod"; +import Button from "@mui/material/Button"; +import { address, addressInput, type Address } from "@/lib/commerce"; +import { usePlatform } from "@/lib/platform"; +import { WorkspaceShell } from "@/components/WorkspaceShell"; +import { + ActionForm, + Check, + Field, + Panel, + QueryView, + readText, + usePrivateQuery, + Empty, +} from "@/components/WorkspaceTools"; +import { ConfirmAction } from "@/components/ConfirmAction"; +function Addresses() { + const { request } = usePlatform(), + query = usePrivateQuery("/addresses", z.array(address)); + const [editing, setEditing] = useState
(null); + return ( + <> + + + {(items) => ( + <> + {!items.length && } + {items.map((item) => ( +
+

+ {item.recipient} + {item.isDefault ? " · Default" : ""} +

+

+ {item.line1} {item.line2} +
+ {item.city}, {item.region} {item.postalCode} +
+ {item.countryCode} · {item.phone} +

+ + { + await request(`/addresses/${item.id}`, z.null(), { + method: "DELETE", + }); + await query.refetch(); + if (editing?.id === item.id) setEditing(null); + }} + /> +
+ ))} + + )} +
+
+ + ({ + ...Object.fromEntries( + [ + "recipient", + "line1", + "line2", + "city", + "region", + "postalCode", + "countryCode", + "phone", + ].map((name) => [name, readText(data, name)]), + ), + isDefault: data.has("isDefault"), + })} + submit={async (value) => { + const body = addressInput.parse(value); + await request( + editing ? `/addresses/${editing.id}` : "/addresses", + address, + { method: editing ? "PUT" : "POST", body }, + ); + setEditing(null); + await query.refetch(); + }} + > + {( + [ + ["recipient", "Recipient", 160], + ["line1", "Address line 1", 200], + ["line2", "Address line 2", 200], + ["city", "City", 100], + ["region", "State or region", 100], + ["postalCode", "Postal code", 20], + ["countryCode", "Country code (IN, US, etc.)", 2], + ["phone", "Phone (+country code)", 16], + ] as const + ).map(([name, label, maxLength]) => ( + + ))} + + + {editing && ( + + )} + + + ); +} +export default function AddressesPage() { + return ( + + + + ); +} diff --git a/src/pages/CartPage.tsx b/src/pages/CartPage.tsx new file mode 100644 index 0000000..2f8d00f --- /dev/null +++ b/src/pages/CartPage.tsx @@ -0,0 +1,327 @@ +import { useEffect, useRef, useState } from "react"; +import { Link, useLocation } from "wouter"; +import { z } from "zod"; +import Button from "@mui/material/Button"; +import TextField from "@mui/material/TextField"; +import MenuItem from "@mui/material/MenuItem"; +import Alert from "@mui/material/Alert"; +import { + cart, + address, + checkoutIntent, + checkoutInput, + order, + money, + moneyTotal, + type CheckoutIntent, +} from "@/lib/commerce"; +import { usePlatform } from "@/lib/platform"; +import { ApiError, isUnknownOutcome } from "@/lib/api"; +import { WorkspaceShell } from "@/components/WorkspaceShell"; +import { Panel, QueryView, usePrivateQuery } from "@/components/WorkspaceTools"; +import { ApiNotice } from "@/components/ApiNotice"; +function Cart() { + const { request, getIntent, saveIntent, clearIntent } = usePlatform(), + query = usePrivateQuery("/cart", cart), + addresses = usePrivateQuery("/addresses", z.array(address)); + const [, navigate] = useLocation(); + const locked = useRef(false), + attempt = useRef( + getIntent("checkout") ? checkoutInput.parse(getIntent("checkout")) : null, + ); + const [busy, setBusy] = useState(false), + [error, setError] = useState(null), + [addressId, setAddressId] = useState(""), + [coupon, setCoupon] = useState(""), + [uncertain, setUncertain] = useState(Boolean(attempt.current)), + [review, setReview] = useState(false); + const [reviewedVersion, setReviewedVersion] = useState(null); + useEffect(() => { + if (review && query.data && query.data.version !== reviewedVersion) { + setReview(false); + setError( + new Error( + "The cart changed. Review the updated quantities before checkout.", + ), + ); + } + }, [review, query.data, reviewedVersion]); + async function edit(id: string, quantity: number, version: number) { + if (locked.current) return; + locked.current = true; + setBusy(true); + setError(null); + try { + z.number().int().min(0).max(100).parse(quantity); + await request(`/cart/lines/${id}`, z.object({ version: z.number() }), { + method: quantity ? "PUT" : "DELETE", + body: quantity ? { quantity, version } : { version }, + }); + await query.refetch(); + } catch (error) { + setError(error); + if (error instanceof ApiError && error.code === "CART_CHANGED") + await query.refetch(); + } finally { + locked.current = false; + setBusy(false); + setReview(false); + } + } + async function checkout() { + if (locked.current || (!attempt.current && !query.data)) return; + locked.current = true; + setBusy(true); + setError(null); + try { + if (!attempt.current) { + if ( + !query.data || + query.isFetching || + query.data.version !== reviewedVersion + ) + throw new Error("The cart changed. Review it again before checkout."); + attempt.current = checkoutIntent( + { + cartVersion: reviewedVersion, + addressId, + couponCode: coupon.trim() ? coupon : undefined, + }, + crypto.randomUUID(), + ); + saveIntent("checkout", attempt.current); + } + const result = await request("/checkout", order, { + method: "POST", + body: attempt.current, + }); + clearIntent("checkout", attempt.current.idempotencyKey); + attempt.current = null; + setUncertain(false); + await query.refetch(); + navigate(`/orders/${result.id}`); + } catch (error) { + setError(error); + if (isUnknownOutcome(error)) { + setUncertain(true); + } else { + if (attempt.current) + clearIntent("checkout", attempt.current.idempotencyKey); + attempt.current = null; + setReview(false); + await query.refetch(); + } + } finally { + locked.current = false; + setBusy(false); + } + } + return ( + <> + + + + {(data) => ( + <> + {!data.lines.length ? ( + + Your cart is empty.{" "} + + Explore candles + + + ) : ( + <> +
+ {data.lines.map((line) => ( +
+
+

+ {line.variant.product.name} · {line.variant.name} +

+

+ {line.variant.currency} {money(line.variant.price)}{" "} + each +

+ {(!line.variant.active || + line.variant.product.status !== "PUBLISHED") && ( + + This variant is no longer available. + + )} +
+
{ + e.preventDefault(); + const quantity = Number( + new FormData(e.currentTarget).get("quantity"), + ); + void edit(line.variantId, quantity, data.version); + }} + > + + + + +
+ ))} +
+

+ Estimated merchandise: {data.lines[0].variant.currency}{" "} + {moneyTotal( + data.lines.map((l) => ({ + price: l.variant.price, + quantity: l.quantity, + })), + )} +

+ + The cart does not reserve stock. Checkout rechecks current + prices and creates a 15-minute hold. This estimate excludes + coupon, tax and shipping. + + + )} + + )} +
+
+ + + {(items) => ( + <> + {!items.length ? ( + + Save an{" "} + + address + {" "} + before checkout. + + ) : ( + <> + { + setAddressId(e.target.value); + setReview(false); + }} + disabled={busy || uncertain || review} + > + {items.map((a) => ( + + {a.recipient} · {a.line1}, {a.city} {a.postalCode} + + ))} + + { + setCoupon(e.target.value); + setReview(false); + }} + inputProps={{ maxLength: 40 }} + disabled={busy || uncertain || review} + /> + + )} + + )} + + + Payment collection is unavailable. Creating an order reserves stock; + it does not charge you or confirm fulfillment. + + {uncertain ? ( + <> + + The result is unknown. Retry the exact original request to recover + it. Do not create another order until you have checked your order + history. + + + + Check orders + + + ) : review ? ( + <> +

+ Review the selected address, coupon and cart quantities above. + Confirm to create a pending order using the current server prices. +

+ + + + ) : ( + + )} +
+ + ); +} +export default function CartPage() { + return ( + + + + ); +} diff --git a/src/pages/CatalogAdminPage.tsx b/src/pages/CatalogAdminPage.tsx new file mode 100644 index 0000000..ee6a2ea --- /dev/null +++ b/src/pages/CatalogAdminPage.tsx @@ -0,0 +1,434 @@ +import { useState } from "react"; +import { useLocation } from "wouter"; +import { z } from "zod"; +import Button from "@mui/material/Button"; +import Alert from "@mui/material/Alert"; +import { + adminProduct, + adminProductSummary, + productInput, + variant, + variantInput, + group, + groupInput, + money, + type AdminProduct, + uuid, +} from "@/lib/commerce"; +import { usePlatform } from "@/lib/platform"; +import { WorkspaceShell } from "@/components/WorkspaceShell"; +import { + ActionForm, + Check, + Field, + Pager, + Panel, + QueryView, + Table, + usePrivateQuery, + readText, + WorkspaceLink, +} from "@/components/WorkspaceTools"; +import { RecordSelection } from "@/components/RecordSelection"; +import { ConfirmAction } from "@/components/ConfirmAction"; +function ProductForm({ + item, + onSave, +}: { + item?: AdminProduct; + onSave: () => Promise; +}) { + const { request } = usePlatform(), + [, navigate] = useLocation(); + return ( + ({ + name: readText(data, "name"), + slug: readText(data, "slug"), + description: readText(data, "description"), + groupIds: data.getAll("groupIds").map(String), + })} + submit={async (value) => { + const saved = await request( + item ? `/products/${item.id}` : "/products", + adminProductSummary, + { method: item ? "PUT" : "POST", body: productInput.parse(value) }, + ); + await onSave(); + if (!item) navigate(`/admin/catalog/${saved.id}`); + }} + > + + + + g.group.id)} + /> + + ); +} +function VariantForm({ + productId, + item, + onSave, +}: { + productId: string; + item?: z.infer; + onSave: () => Promise; +}) { + const { request } = usePlatform(); + const [attributes, setAttributes] = useState( + Object.entries(item?.attributes || {}), + ); + return ( + { + const entries = attributes.map((_, i) => [ + readText(data, `key${i}`).trim(), + readText(data, `value${i}`), + ]); + if (new Set(entries.map((e) => e[0])).size !== entries.length) + throw new Error("Attribute names must be unique."); + return { + name: readText(data, "name"), + sku: readText(data, "sku"), + price: readText(data, "price"), + currency: readText(data, "currency"), + active: data.has("active"), + attributes: Object.fromEntries(entries), + }; + }} + submit={async (value) => { + await request( + `/products/${productId}/variants${item ? `/${item.id}` : ""}`, + variant, + { method: item ? "PUT" : "POST", body: variantInput.parse(value) }, + ); + await onSave(); + }} + > + + + + ({ + value, + label: value, + }))} + /> + + {attributes.map(([key, value], i) => ( +
+ + setAttributes((rows) => + rows.map((row, index) => (index === i ? [next, row[1]] : row)), + ) + } + maxLength={32} + /> + + setAttributes((rows) => + rows.map((row, index) => (index === i ? [row[0], next] : row)), + ) + } + maxLength={100} + /> + +
+ ))} + +
+ ); +} +function Groups() { + const { request, can } = usePlatform(); + const [offset, setOffset] = useState(0), + [editing, setEditing] = useState | null>(null); + const query = usePrivateQuery( + `/catalog-groups?limit=25&offset=${offset}`, + z.array(group), + ); + return ( + + + {(items) => ( + <> +
item.id)} + rows={items.map((g) => [ + g.name, + g.kind, + g.slug, + can("catalog.manage") ? ( + + ) : ( + "Read only" + ), + ])} + /> + + + )} + + {can("catalog.manage") && ( + <> + ({ + name: readText(data, "name"), + slug: readText(data, "slug"), + kind: readText(data, "kind"), + })} + submit={async (value) => { + await request( + editing ? `/catalog-groups/${editing.id}` : "/catalog-groups", + group, + { + method: editing ? "PUT" : "POST", + body: groupInput.parse(value), + }, + ); + setEditing(null); + await query.refetch(); + }} + > + + + ({ + value, + label: value, + }))} + /> + + {editing && ( + + )} + + )} + + ); +} +function Products() { + const { can } = usePlatform(); + const [offset, setOffset] = useState(0); + const query = usePrivateQuery( + `/products?limit=25&offset=${offset}`, + z.array(adminProductSummary), + ); + return ( + <> + + + {(items) => ( + <> +
item.id)} + rows={items.map((p) => [ + + {p.name} + , + p.status, + p.slug, + ])} + /> + + + )} + + + {can("catalog.manage") && ( + + query.refetch()} /> + + )} + + + ); +} +function ProductEditor({ id }: { id: string }) { + const { request, can } = usePlatform(); + const query = usePrivateQuery(`/products/${id}`, adminProduct); + const [editingVariant, setEditingVariant] = useState< + z.infer | undefined + >(); + return ( + + {(item) => ( + <> + +

Status: {item.status}

+

Product ID: {item.id}

+ {item.status === "ARCHIVED" ? ( + Archived products cannot be edited. + ) : ( + <> + {can("catalog.manage") && ( + query.refetch()} /> + )}{" "} + {can("catalog.publish") && + ["DRAFT", "PUBLISHED", "ARCHIVED"] + .filter((status) => status !== item.status) + .map((status) => ( + { + await request( + `/products/${id}/status`, + adminProductSummary, + { method: "PATCH", body: { status } }, + ); + await query.refetch(); + }} + /> + ))} + + )} +
+ +
item.id)} + rows={item.variants.map((v) => [ + v.name, + v.sku, + `${v.currency} ${money(v.price)}`, + v.active ? "Yes" : "No", + v.id, + can("catalog.manage") && item.status !== "ARCHIVED" ? ( + + ) : ( + "Read only" + ), + ])} + /> + {can("catalog.manage") && item.status !== "ARCHIVED" && ( + <> +

+ {editingVariant + ? `Edit ${editingVariant.name}` + : "New variant"} +

+ { + setEditingVariant(undefined); + await query.refetch(); + }} + /> + {editingVariant && ( + + )} + + )} + + + )} + + ); +} +export default function CatalogAdminPage({ id }: { id?: string }) { + return ( + + {id && !uuid.safeParse(id).success ? ( + Invalid product identifier. + ) : id ? ( + + ) : ( + + )} + + ); +} diff --git a/src/pages/InventoryPage.tsx b/src/pages/InventoryPage.tsx new file mode 100644 index 0000000..77d1f8f --- /dev/null +++ b/src/pages/InventoryPage.tsx @@ -0,0 +1,370 @@ +import { useEffect, useState } from "react"; +import { useQueryClient } from "@tanstack/react-query"; +import { z } from "zod"; +import Alert from "@mui/material/Alert"; +import { + warehouse, + warehouseInput, + stock, + stockInput, + stockDetail, + adjustmentInput, + ledger, + reservation, + reservationInput, + uuid, +} from "@/lib/commerce"; +import { usePlatform } from "@/lib/platform"; +import { useIdempotentCommand } from "@/lib/use-idempotent-command"; +import { WorkspaceShell } from "@/components/WorkspaceShell"; +import { + ActionForm, + Field, + Pager, + Panel, + QueryView, + Table, + usePrivateQuery, + readText, + readNumber, + WorkspaceLink, +} from "@/components/WorkspaceTools"; +import { ConfirmAction } from "@/components/ConfirmAction"; +function StockList() { + const { request, can } = usePlatform(); + const [offset, setOffset] = useState(0), + [warehouseOffset, setWarehouseOffset] = useState(0); + const query = usePrivateQuery( + `/inventory/stock-items?limit=25&offset=${offset}`, + z.array(stock), + ), + warehouses = usePrivateQuery( + `/inventory/warehouses?limit=25&offset=${warehouseOffset}`, + z.array(warehouse), + ); + return ( + <> + + + {(items) => ( + <> +
item.id)} + rows={items.map((s) => [ + + {s.id} + , + s.variantId, + s.warehouseId, + s.onHand, + ])} + /> + + + )} + + {can("inventory.manage") && ( + ({ + variantId: readText(data, "variantId"), + warehouseId: readText(data, "warehouseId"), + })} + submit={async (value) => { + await request("/inventory/stock-items", stock, { + method: "POST", + body: stockInput.parse(value), + }); + await query.refetch(); + }} + > + + + + )} + + + + {(items) => ( + <> +
item.id)} + rows={items.map((w) => [w.name, w.id])} + /> + + + )} + + {can("inventory.manage") && ( + ({ name: readText(data, "name") })} + submit={async (value) => { + await request("/inventory/warehouses", warehouse, { + method: "POST", + body: warehouseInput.parse(value), + }); + await warehouses.refetch(); + }} + > + + + )} + + + ); +} +function ReservationCard({ id }: { id: string }) { + const { request, can, scope } = usePlatform(), + query = usePrivateQuery(`/inventory/reservations/${id}`, reservation); + const client = useQueryClient(), + { data, refetch } = query; + useEffect(() => { + if (data?.status !== "ACTIVE") return; + const timer = setTimeout( + () => { + void client.invalidateQueries({ + predicate: (query) => + query.queryKey[0] === "private" && + query.queryKey[1] === scope && + String(query.queryKey[2]).startsWith("/inventory/"), + }); + }, + Math.max(1000, Date.parse(data.expiresAt) - Date.now() + 250), + ); + return () => clearTimeout(timer); + }, [data, client, scope]); + async function refreshStock() { + await refetch(); + await client.invalidateQueries({ + predicate: (query) => + query.queryKey[0] === "private" && + query.queryKey[1] === scope && + String(query.queryKey[2]).startsWith("/inventory/"), + }); + } + return ( + + {(record) => ( + <> +

+ Reservation {record.id}: {record.status}, {record.quantity} units. + Expires {new Date(record.expiresAt).toLocaleString()}. +

+ {record.orderId && ( + + This hold is managed by its order and cannot be committed or + released here. + + )} + {record.status === "ACTIVE" && !record.orderId && ( + <> + { + await request( + `/inventory/reservations/${id}/release`, + reservation, + { method: "POST" }, + ); + await refreshStock(); + }} + /> + {can("inventory.commit") && ( + { + await request( + `/inventory/reservations/${id}/commit`, + reservation, + { method: "POST" }, + ); + await refreshStock(); + }} + /> + )} + + )} + + )} +
+ ); +} +function StockEditor({ id }: { id: string }) { + const { can } = usePlatform(); + const [offset, setOffset] = useState(0), + [reservationId, setReservationId] = useState(""); + const query = usePrivateQuery(`/inventory/stock-items/${id}`, stockDetail), + history = usePrivateQuery( + `/inventory/stock-items/${id}/ledger?limit=25&offset=${offset}`, + z.array(ledger), + ); + const adjust = useIdempotentCommand( + "/inventory/adjustments", + adjustmentInput, + ledger, + id, + ), + reserve = useIdempotentCommand( + "/inventory/reservations", + reservationInput, + reservation, + id, + ); + return ( + <> + + + {(s) => ( + <> +

+ Stock item: {s.id} +
+ Variant: {s.variantId} +
+ Warehouse: {s.warehouseId} +

+
+
On hand
+
{s.onHand}
+
Reserved
+
{s.reserved}
+
Available
+
{s.available}
+
+ + )} +
+
+ {can("inventory.adjust") && ( + + {adjust.uncertain && ( + + The result is unknown. Retry the original adjustment; the same key + and input will be reused. Check the ledger before starting another + adjustment. + + )} + ({ + stockItemId: id, + delta: readNumber(data, "delta"), + reason: readText(data, "reason"), + })} + submit={async (value) => { + await adjust.run(value); + await query.refetch(); + await history.refetch(); + }} + > + + + + + )} + {can("inventory.reserve") && ( + + {reserve.uncertain && ( + + Retry the original reservation to recover the same result. + + )} + ({ + stockItemId: id, + quantity: readNumber(data, "quantity"), + ttlMinutes: readNumber(data, "ttlMinutes"), + })} + submit={async (value) => { + const result = await reserve.run(value); + setReservationId(result.id); + await query.refetch(); + }} + > + + + + readText(data, "id")} + submit={async (value) => { + setReservationId(z.string().uuid().parse(value)); + }} + > + + + {reservationId && ( + + )} + + )} + + + {(items) => ( + <> +
item.id)} + rows={items.map((e) => [ + new Date(e.createdAt).toLocaleString(), + e.delta, + e.reason, + ])} + /> + + + )} + + + + ); +} +export default function InventoryPage({ id }: { id?: string }) { + return ( + + {id && !uuid.safeParse(id).success ? ( + Invalid stock identifier. + ) : id ? ( + + ) : ( + + )} + + ); +} diff --git a/src/pages/OffersPage.tsx b/src/pages/OffersPage.tsx new file mode 100644 index 0000000..21d80cd --- /dev/null +++ b/src/pages/OffersPage.tsx @@ -0,0 +1,287 @@ +import { useState } from "react"; +import { z } from "zod"; +import Alert from "@mui/material/Alert"; +import { coupon, couponInput, pricing, pricingInput } from "@/lib/commerce"; +import { usePlatform } from "@/lib/platform"; +import { WorkspaceShell } from "@/components/WorkspaceShell"; +import { + ActionForm, + Field, + Pager, + Panel, + QueryView, + Table, + usePrivateQuery, + readText, + readNumber, +} from "@/components/WorkspaceTools"; +import { ConfirmAction } from "@/components/ConfirmAction"; +const currencies = ["INR", "USD", "EUR", "GBP"].map((value) => ({ + value, + label: value, +})); +function Coupons() { + const { request } = usePlatform(); + const [offset, setOffset] = useState(0), + [kind, setKind] = useState("PERCENT"); + const query = usePrivateQuery( + `/coupons?limit=25&offset=${offset}`, + z.array(coupon), + ); + return ( + <> + + + {(items) => ( + <> +
item.id)} + rows={items.map((c) => [ + c.code, + c.kind === "FIXED" + ? `${c.currency} ${c.amount}` + : `${(c.percentBps || 0) / 100}%`, + `${new Date(c.startsAt).toLocaleString()} – ${new Date(c.endsAt).toLocaleString()}`, + c.active ? "Active" : "Inactive", + { + await request(`/coupons/${c.id}/status`, coupon, { + method: "PATCH", + body: { active: !c.active }, + }); + await query.refetch(); + }} + />, + ])} + /> + + + )} + + + + + Rules cannot be edited after creation. Dates must include an explicit + timezone. Campaign-linked coupons belong to the growth phase. + +
+ + +
+ ({ + code: readText(data, "code"), + currency: readText(data, "currency"), + minimumSubtotal: readText(data, "minimumSubtotal"), + maxUses: readNumber(data, "maxUses"), + perUserLimit: readNumber(data, "perUserLimit"), + startsAt: readText(data, "startsAt"), + endsAt: readText(data, "endsAt"), + kind, + ...(kind === "FIXED" + ? { amount: readText(data, "amount") } + : { percentBps: readNumber(data, "percentBps") }), + })} + submit={async (value) => { + await request("/coupons", coupon, { + method: "POST", + body: couponInput.parse(value), + }); + await query.refetch(); + }} + > + + + + {kind === "FIXED" ? ( + + ) : ( + + )} + + + + + +
+ + ); +} +function Pricing() { + const { request } = usePlatform(); + const [offset, setOffset] = useState(0); + const query = usePrivateQuery( + `/admin/pricing-policies?limit=25&offset=${offset}`, + z.array(pricing), + ); + return ( + <> + + + Use approved tax and shipping rules. New versions do not reprice + existing orders and do not enable payment. + + + {(items) => ( + <> +
item.id)} + rows={items.map((p) => [ + p.name, + `${p.currency} · ${p.countryCode} · ${p.region || "Country fallback"}`, + p.taxMode, + p.active ? "Active" : "Inactive", + { + await request( + `/admin/pricing-policies/${p.id}/status`, + pricing, + { method: "PATCH", body: { active: !p.active } }, + ); + await query.refetch(); + }} + />, + ])} + /> + + + )} + + + + ({ + name: readText(data, "name"), + currency: readText(data, "currency"), + countryCode: readText(data, "countryCode"), + region: readText(data, "region"), + taxMode: readText(data, "taxMode"), + merchandiseTaxBps: readNumber(data, "merchandiseTaxBps"), + shippingTaxBps: readNumber(data, "shippingTaxBps"), + shippingFee: readText(data, "shippingFee"), + freeShippingMinimum: readText(data, "freeShippingMinimum") || null, + })} + submit={async (value) => { + await request("/admin/pricing-policies", pricing, { + method: "POST", + body: pricingInput.parse(value), + }); + await query.refetch(); + }} + > + + + + + ({ + value, + label: value, + }))} + /> + + + + + + + + ); +} +export default function OffersPage({ + pricing: showPricing = false, +}: { + pricing?: boolean; +}) { + return ( + + {showPricing ? : } + + ); +} diff --git a/src/pages/OrdersPage.tsx b/src/pages/OrdersPage.tsx new file mode 100644 index 0000000..786e889 --- /dev/null +++ b/src/pages/OrdersPage.tsx @@ -0,0 +1,176 @@ +import { useEffect, useState } from "react"; +import { z } from "zod"; +import Alert from "@mui/material/Alert"; +import { order, orderSummary, money, uuid } from "@/lib/commerce"; +import { usePlatform } from "@/lib/platform"; +import { WorkspaceShell } from "@/components/WorkspaceShell"; +import { + Pager, + Panel, + QueryView, + Table, + usePrivateQuery, + WorkspaceLink, +} from "@/components/WorkspaceTools"; +import { ConfirmAction } from "@/components/ConfirmAction"; +function OrderList({ admin }: { admin: boolean }) { + const [offset, setOffset] = useState(0); + const path = admin ? "/admin/orders" : "/orders"; + const query = usePrivateQuery( + `${path}?limit=25&offset=${offset}`, + z.array(orderSummary), + ); + const { refetch } = query; + useEffect(() => { + const timer = setInterval(() => { + void refetch(); + }, 30000); + return () => clearInterval(timer); + }, [refetch]); + return ( + + + {(items) => ( + <> +
item.id)} + rows={items.map((item) => [ + + {item.id} + , + item.status, + `${item.currency} ${money(item.merchandiseTotal)}`, + new Date(item.createdAt).toLocaleString(), + ])} + /> + + + )} + + + ); +} +function OrderDetail({ admin, id }: { admin: boolean; id: string }) { + const { request, can } = usePlatform(), + path = `${admin ? "/admin/orders" : "/orders"}/${id}`, + query = usePrivateQuery(path, order); + const { refetch } = query; + useEffect(() => { + if (!query.data || query.data.status !== "PENDING_PAYMENT") return; + const timeout = setTimeout( + () => { + void refetch(); + }, + Math.max(1000, Date.parse(query.data.expiresAt) - Date.now() + 250), + ); + return () => clearTimeout(timeout); + }, [query.data, refetch]); + return ( + + + {(item) => ( + <> +

+ Order {item.id} · {item.status} +

+

Hold expires: {new Date(item.expiresAt).toLocaleString()}

+
line.variantId)} + rows={item.lines.map((l) => [ + `${l.productName} · ${l.variantName}`, + l.sku, + l.quantity, + `${item.currency} ${money(l.unitPrice)}`, + `${item.currency} ${money(l.lineTotal)}`, + ])} + /> +
+
Subtotal
+
+ {item.currency} {money(item.subtotal)} +
+
Discount
+
+ {item.currency} {money(item.discount)} +
+
Merchandise total
+
+ {item.currency} {money(item.merchandiseTotal)} +
+
Tax
+
+ {item.taxTotal === null + ? "Unfinalized" + : `${item.currency} ${money(item.taxTotal)}`} +
+
Shipping
+
+ {item.shippingTotal === null + ? "Unfinalized" + : `${item.currency} ${money(item.shippingTotal)}`} +
+
Server payable total
+
+ {item.payableTotal === null + ? "Unfinalized" + : `${item.currency} ${money(item.payableTotal)}`} +
+
+ + {item.pricingStatus === "UNFINALIZED" + ? "Tax and shipping have not been finalized. " + : "Tax may already be included in merchandise prices. "} + Payment collection is unavailable. + +

Delivery snapshot

+

+ {item.address.recipient} +
+ {item.address.line1} {item.address.line2} +
+ {item.address.city}, {item.address.region}{" "} + {item.address.postalCode} +
+ {item.address.countryCode} · {item.address.phone} +

+ {item.status === "PENDING_PAYMENT" && + (!admin || can("orders.manage")) && ( + { + await request(`${path}/cancel`, order, { method: "POST" }); + await query.refetch(); + }} + /> + )} + + )} + + + ); +} +export default function OrdersPage({ + admin = false, + id, +}: { + admin?: boolean; + id?: string; +}) { + return ( + + {id && !uuid.safeParse(id).success ? ( + Invalid order identifier. + ) : id ? ( + + ) : ( + + )} + + ); +} diff --git a/src/pages/ProductPage.tsx b/src/pages/ProductPage.tsx index 2180234..1d3a5f1 100644 --- a/src/pages/ProductPage.tsx +++ b/src/pages/ProductPage.tsx @@ -9,6 +9,8 @@ import { getProduct } from "@/lib/api"; import { usePlatform } from "@/lib/platform"; import { ApiNotice } from "@/components/ApiNotice"; import "./products.css"; +import { AddToCart } from "@/components/AddToCart"; +import { money } from "@/lib/commerce"; export default function ProductPage({ id }: { id: string }) { const { organization } = usePlatform(); @@ -73,15 +75,19 @@ export default function ProductPage({ id }: { id: string }) { - {variant.currency} {variant.price} + {variant.currency} {money(variant.price)} + ))} )} - Ordering will be available in the commerce phase. Payment and - shipping integrations are not enabled yet. + Orders reserve stock while pending. Payment and shipping + integrations are not enabled yet. )} diff --git a/src/pages/RecoveryPage.tsx b/src/pages/RecoveryPage.tsx new file mode 100644 index 0000000..c98e153 --- /dev/null +++ b/src/pages/RecoveryPage.tsx @@ -0,0 +1,138 @@ +import { useState } from "react"; +import { Link } from "wouter"; +import { z } from "zod"; +import Container from "@mui/material/Container"; +import Alert from "@mui/material/Alert"; +import { apiRequest, parse, organizationSchema } from "@/lib/api"; +import { clearRecoveryToken, getRecoveryToken } from "@/lib/recovery-token"; +import { usePlatform } from "@/lib/platform"; +import { + ActionForm, + Field, + Panel, + readText, +} from "@/components/WorkspaceTools"; +import "./workspace.css"; +export default function RecoveryPage({ reset = false }: { reset?: boolean }) { + const { organization, clearSession } = usePlatform(); + const [complete, setComplete] = useState(false); + const token = getRecoveryToken(); + return ( +
+ +

{reset ? "Reset Password" : "Account Recovery"}

+ + {complete ? ( + + {reset + ? "Your password was reset and previous sessions were invalidated." + : "If the account is eligible, recovery instructions will be sent."}{" "} + + Return to sign-in + + + ) : reset ? ( + !token ? ( + + This reset link is missing or invalid. Request a new recovery + link. + + ) : ( + { + const password = readText(data, "password"); + if (password !== readText(data, "confirm")) + throw new Error("Passwords do not match."); + return { token, password }; + }} + submit={async (value) => { + const body = z + .object({ + token: z.string().regex(/^[A-Za-z0-9_-]{43}$/), + password: z.string().min(15).max(128), + }) + .strict() + .parse(value); + parse( + z.null(), + await apiRequest("/auth/recovery/reset", { + method: "POST", + body, + }), + ); + clearRecoveryToken(); + clearSession( + "Password reset. Sign in with your new password.", + ); + setComplete(true); + }} + > + + + + ) + ) : ( + <> + + Recovery delivery requires the backend SMTP configuration. + Acceptance does not confirm account existence or email delivery. + + ({ + organizationId: readText(data, "organizationId"), + email: readText(data, "email"), + })} + submit={async (value) => { + const body = z + .object({ + organizationId: organizationSchema, + email: z.string().email().max(254).toLowerCase(), + }) + .strict() + .parse(value); + parse( + z.object({ message: z.string() }), + await apiRequest("/auth/recovery/request", { + method: "POST", + body, + }), + ); + setComplete(true); + }} + > + + + + + )} + +
+
+ ); +} diff --git a/src/pages/WorkspacePage.tsx b/src/pages/WorkspacePage.tsx index 03600d2..aee97db 100644 --- a/src/pages/WorkspacePage.tsx +++ b/src/pages/WorkspacePage.tsx @@ -8,6 +8,7 @@ import Alert from "@mui/material/Alert"; import { usePlatform } from "@/lib/platform"; import { ApiNotice } from "@/components/ApiNotice"; import "./workspace.css"; +import { WorkspaceNavigation } from "@/components/WorkspaceShell"; export default function WorkspacePage() { const { organization, principal, signIn, signOut, notice } = usePlatform(); @@ -44,7 +45,7 @@ export default function WorkspacePage() { return (
-

Staff Workspace

+

Account Workspace

Sign in with your approved Mani Candles account.

@@ -53,6 +54,7 @@ export default function WorkspacePage() { {notice && {notice}} {principal ? ( <> +

Your session

Organization: {principal.organizationId} @@ -69,8 +71,7 @@ export default function WorkspacePage() {

No permissions assigned. Contact your administrator.

)}

- Operational tools will be connected in the following frontend - phases. + Open a customer or administration tool below.

[ + id, + approve(id)} + />, + ])} + /> + ); + const view = render(table(["A", "B"])), + user = userEvent.setup(); + await user.click(screen.getAllByRole("button", { name: "Approve" })[0]); + view.rerender(table(["B", "A"])); + await user.click(screen.getByRole("button", { name: "Confirm" })); + expect(approve).toHaveBeenCalledWith("A"); +}); +test("role-read accounts can view roles without user-read access", async () => { + const fetch = vi.fn(async (url: string) => + url.endsWith("/auth/login") + ? json(session) + : url.endsWith("/auth/me") + ? json({ ...me, permissions: ["roles.read"] }) + : url.includes("/roles?") + ? json([ + { + id, + name: "Observer", + permissions: [], + isSystem: false, + organizationId: id, + }, + ]) + : Promise.reject(new Error("Unexpected private request")), + ); + vi.stubGlobal("fetch", fetch); + harness(); + const user = userEvent.setup(); + await user.click(screen.getByText("Test login")); + await screen.findByText("Observer"); + expect(fetch.mock.calls.some(([url]) => url.includes("/users"))).toBe(false); + expect(screen.queryByRole("link", { name: "Access" })).toBeNull(); +}); +const me = { userId: id, organizationId: id, sessionId: id, permissions: [] }; +const session = { + accessToken: "test-opaque", + tokenType: "Bearer", + expiresAt: new Date(Date.now() + 3600000).toISOString(), +}; +const address = { + id, + recipient: "Test Recipient", + line1: "Test Street", + line2: "", + city: "Test City", + region: "Test State", + postalCode: "123456", + countryCode: "IN", + phone: "+919999999999", + isDefault: true, +}; +const line = { + variantId: id, + quantity: 1, + variant: { + name: "Small", + sku: "TEST", + price: "10", + currency: "INR", + active: true, + product: { name: "Test candle", status: "PUBLISHED" }, + }, +}; +const { id: _addressId, isDefault: _isDefault, ...snapshotAddress } = address; +const order = { + id, + status: "PENDING_PAYMENT", + currency: "INR", + merchandiseTotal: "10", + subtotal: "10", + discount: "0", + createdAt: new Date().toISOString(), + expiresAt: new Date(Date.now() + 900000).toISOString(), + pricingStatus: "UNFINALIZED", + taxTotal: null, + shippingTotal: null, + payableTotal: null, + paymentAvailable: false, + address: snapshotAddress, + lines: [ + { + variantId: id, + sku: "TEST", + productName: "Test candle", + variantName: "Small", + quantity: 1, + unitPrice: "10", + lineTotal: "10", + }, + ], +}; +const json = (body: unknown, status = 200) => + new Response(JSON.stringify(body), { status }); +afterEach(() => { + vi.unstubAllGlobals(); + history.replaceState(null, "", "/"); +}); +function Login() { + const platform = usePlatform(); + return ( + + ); +} +function harness(children: ReactNode) { + localStorage.setItem("mani.organization", id); + const client = new QueryClient({ + defaultOptions: { queries: { retry: false } }, + }); + const result = render( + + + + + {children} + + + , + ); + return { client, ...result }; +} +test("uncertain checkout replays identical input after the cart version changes", async () => { + const attempts: unknown[] = []; + let cartChanged = false; + vi.stubGlobal( + "fetch", + vi.fn(async (url: string, options?: RequestInit) => { + if (url.endsWith("/auth/login")) return json(session); + if (url.endsWith("/auth/me")) return json(me); + if (url.endsWith("/addresses")) return json([address]); + if (url.endsWith("/cart")) + return json({ + version: cartChanged ? 1 : 0, + lines: cartChanged ? [] : [line], + }); + if (url.endsWith("/checkout")) { + attempts.push(JSON.parse(String(options?.body))); + cartChanged = true; + if (attempts.length === 1) throw new Error("Response lost"); + return json(order); + } + if (url.includes("/orders?")) return json([]); + if (url.includes(`/orders/${id}`)) return json(order); + throw new Error(`Unexpected ${url}`); + }), + ); + history.replaceState(null, "", "/cart"); + const h = harness( + + + {() => } + + {(params) => } + + , + ), + user = userEvent.setup(); + await user.click(screen.getByText("Test login")); + await screen.findByText("Test candle · Small"); + await user.click(screen.getByRole("combobox", { name: "Delivery address" })); + await user.click(await screen.findByRole("option")); + await user.click(screen.getByRole("button", { name: "Review checkout" })); + await user.click(screen.getByRole("button", { name: "Confirm order" })); + await screen.findByRole("button", { name: "Retry original checkout" }); + await act(() => h.client.invalidateQueries({ queryKey: ["private"] })); + await screen.findByText(/Your cart is empty/); + await user.click(screen.getByRole("link", { name: "Check orders" })); + await screen.findByText("Order history"); + await user.click(screen.getByRole("link", { name: "My cart" })); + await user.click( + screen.getByRole("button", { name: "Retry original checkout" }), + ); + await waitFor(() => expect(attempts).toHaveLength(2)); + expect(attempts[1]).toEqual(attempts[0]); + expect(attempts[0]).toMatchObject({ cartVersion: 0, addressId: id }); + await waitFor(() => expect(location.pathname).toBe(`/orders/${id}`)); +}); + +test("a changed cart invalidates checkout review instead of adopting a new version", async () => { + let changed = false; + const attempts: unknown[] = []; + vi.stubGlobal( + "fetch", + vi.fn(async (url: string, options?: RequestInit) => { + if (url.endsWith("/auth/login")) return json(session); + if (url.endsWith("/auth/me")) return json(me); + if (url.endsWith("/addresses")) return json([address]); + if (url.endsWith("/cart")) + return json({ + version: changed ? 2 : 0, + lines: [{ ...line, quantity: changed ? 3 : 1 }], + }); + attempts.push(options?.body); + return json(order); + }), + ); + const h = harness(), + user = userEvent.setup(); + await user.click(screen.getByText("Test login")); + await screen.findByText("Test candle · Small"); + await user.click(screen.getByRole("combobox", { name: "Delivery address" })); + await user.click(await screen.findByRole("option")); + await user.click(screen.getByRole("button", { name: "Review checkout" })); + changed = true; + await act(() => h.client.invalidateQueries({ queryKey: ["private"] })); + await screen.findByText(/Review the updated quantities/); + expect(screen.queryByRole("button", { name: "Confirm order" })).toBeNull(); + expect(attempts).toEqual([]); +}); +test("permission-denied administration never fetches private staff records", async () => { + const fetch = vi.fn(async (url: string) => + url.endsWith("/auth/login") + ? json(session) + : url.endsWith("/auth/me") + ? json(me) + : Promise.reject(new Error("Private records must not be fetched")), + ); + vi.stubGlobal("fetch", fetch); + const h = harness(), + user = userEvent.setup(); + await user.click(screen.getByText("Test login")); + await screen.findByText(/does not have permission/); + expect(fetch.mock.calls.some(([url]) => url.includes("/users"))).toBe(false); + const result = await axe.run(h.container, { + rules: { "color-contrast": { enabled: false } }, + }); + expect( + result.violations.filter( + (v) => v.impact === "serious" || v.impact === "critical", + ), + ).toEqual([]); +}); +test("unfinalized order charges are never shown as zero or payable", async () => { + vi.stubGlobal( + "fetch", + vi.fn(async (url: string) => + url.endsWith("/auth/login") + ? json(session) + : url.endsWith("/auth/me") + ? json(me) + : json(order), + ), + ); + harness(); + const user = userEvent.setup(); + await user.click(screen.getByText("Test login")); + await screen.findByText(/Order .*PENDING_PAYMENT/); + expect(screen.getAllByText("Unfinalized")).toHaveLength(3); + expect(screen.queryByRole("button", { name: /pay now/i })).toBeNull(); + expect(screen.getByText(/Payment collection is unavailable/)).toBeTruthy(); +}); diff --git a/tsconfig.json b/tsconfig.json index 341123b..f18db3c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { - "include": ["src/**/*"], - "exclude": ["node_modules", "build", "dist", "**/*.test.ts"], + "include": ["src/**/*", "test/**/*", "vite.config.ts", "vitest.config.ts"], + "exclude": ["node_modules", "build", "dist"], "compilerOptions": { "target": "ES2020", "useDefineForClassFields": true, diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 0000000..58c7678 --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,11 @@ +import { defineConfig } from "vitest/config"; +import { fileURLToPath } from "node:url"; +export default defineConfig({ + resolve: { alias: { "@": fileURLToPath(new URL("./src", import.meta.url)) } }, + test: { + environment: "jsdom", + include: ["test/*.ui.test.tsx"], + setupFiles: ["test/setup.ts"], + restoreMocks: true, + }, +});