From 11339916d2bc653bb69e9d47901d4135cf31530c Mon Sep 17 00:00:00 2001 From: shafi54 <108669266+shafi-aviz@users.noreply.github.com> Date: Wed, 14 Oct 2026 17:27:52 +0530 Subject: [PATCH] enh --- .../admin-ui/components/VendorSnippetForm.tsx | 9 +- .../src/components/VendorSnippetForm.tsx | 9 +- apps/backend/src/sqliteImporter.ts | 1 - .../src/trpc/apis/user-apis/apis/cart.ts | 30 +- .../src/trpc/apis/user-apis/apis/product.ts | 24 +- .../src/trpc/apis/user-apis/apis/slots.ts | 17 +- apps/backend/tests/api/admin.test.ts | 2 +- .../backend/tests/api/misc-procedures.test.ts | 3 +- apps/backend/tests/api/order-flow.test.ts | 2 +- apps/backend/tests/api/user-surface.test.ts | 1 + apps/backend/tests/helpers/cache.ts | 29 +- apps/backend/tests/helpers/fixtures.ts | 2 +- apps/superadmin-ui/bun.lock | 108 +- apps/superadmin-ui/components.json | 21 + apps/superadmin-ui/package.json | 18 +- .../src/components/ui/alert-dialog.tsx | 150 + .../src/components/ui/dialog-host.tsx | 189 + .../src/components/ui/select.tsx | 145 + .../src/components/ui/simple-select.tsx | 61 + apps/superadmin-ui/src/lib/utils.ts | 7 + apps/superadmin-ui/src/routes/__root.tsx | 3 + apps/superadmin-ui/src/routes/constants.tsx | 13 +- .../src/routes/global-products.tsx | 57 +- .../src/routes/global-stores.tsx | 26 +- apps/superadmin-ui/src/routes/regions.tsx | 7 +- .../src/routes/send-notifications.tsx | 7 +- apps/superadmin-ui/src/routes/staff.tsx | 55 +- apps/superadmin-ui/src/styles.css | 15 + apps/user-ui/components/ProductDetail.tsx | 9 +- apps/user-ui/components/cart-page.tsx | 8 +- apps/user-ui/components/checkout-page.tsx | 2 +- .../src/components/AddToCartDialog.tsx | 61 +- .../tests/components/product-detail.test.tsx | 1 + apps/user-ui/tests/mocks/api.ts | 13 +- .../tests/screens/cart-screen.test.tsx | 1 + .../web-ui/src/components/AddToCartDialog.tsx | 47 +- apps/web-ui/src/routes/home.product.$id.tsx | 8 +- change-log.txt | 108 + docs/e2e-sanity-test-plan.md | 61 +- docs/handy-test-plan.txt | 1 + docs/maestro-mcp-agent-guidelines.md | 150 +- .../test reports/e2e-handy-plan-2026-10-14.md | 195 + packages/db_helper_sqlite/index.ts | 1 - .../db_helper_sqlite/src/user-apis/product.ts | 25 +- slots.json | 26844 ---------------- tests/e2e/assets/food/SOURCES.md | 30 + tests/e2e/assets/food/apples.jpg | Bin 0 -> 143038 bytes tests/e2e/assets/food/bananas.jpg | Bin 0 -> 129053 bytes tests/e2e/assets/food/biryani.jpg | Bin 0 -> 179752 bytes tests/e2e/assets/food/dry-fruits-nuts.jpg | Bin 0 -> 272562 bytes tests/e2e/assets/food/eggs.jpg | Bin 0 -> 36157 bytes tests/e2e/assets/food/fish-market.jpg | Bin 0 -> 216752 bytes tests/e2e/assets/food/fruit-juice.jpg | Bin 0 -> 182998 bytes tests/e2e/assets/food/green-vegetables.jpg | Bin 0 -> 257187 bytes tests/e2e/assets/food/milk.jpg | Bin 0 -> 137980 bytes tests/e2e/assets/food/mutton-curry.jpg | Bin 0 -> 437617 bytes tests/e2e/assets/food/oranges.jpg | Bin 0 -> 112975 bytes tests/e2e/assets/food/paneer.jpg | Bin 0 -> 286089 bytes tests/e2e/assets/food/prawns-seafood.jpg | Bin 0 -> 268000 bytes tests/e2e/assets/food/raw-chicken-meat.jpg | Bin 0 -> 103588 bytes tests/e2e/assets/food/tomatoes.jpg | Bin 0 -> 262918 bytes 61 files changed, 1454 insertions(+), 27122 deletions(-) create mode 100644 apps/superadmin-ui/components.json create mode 100644 apps/superadmin-ui/src/components/ui/alert-dialog.tsx create mode 100644 apps/superadmin-ui/src/components/ui/dialog-host.tsx create mode 100644 apps/superadmin-ui/src/components/ui/select.tsx create mode 100644 apps/superadmin-ui/src/components/ui/simple-select.tsx create mode 100644 apps/superadmin-ui/src/lib/utils.ts create mode 100644 docs/test reports/e2e-handy-plan-2026-10-14.md delete mode 100644 slots.json create mode 100644 tests/e2e/assets/food/SOURCES.md create mode 100644 tests/e2e/assets/food/apples.jpg create mode 100644 tests/e2e/assets/food/bananas.jpg create mode 100644 tests/e2e/assets/food/biryani.jpg create mode 100644 tests/e2e/assets/food/dry-fruits-nuts.jpg create mode 100644 tests/e2e/assets/food/eggs.jpg create mode 100644 tests/e2e/assets/food/fish-market.jpg create mode 100644 tests/e2e/assets/food/fruit-juice.jpg create mode 100644 tests/e2e/assets/food/green-vegetables.jpg create mode 100644 tests/e2e/assets/food/milk.jpg create mode 100644 tests/e2e/assets/food/mutton-curry.jpg create mode 100644 tests/e2e/assets/food/oranges.jpg create mode 100644 tests/e2e/assets/food/paneer.jpg create mode 100644 tests/e2e/assets/food/prawns-seafood.jpg create mode 100644 tests/e2e/assets/food/raw-chicken-meat.jpg create mode 100644 tests/e2e/assets/food/tomatoes.jpg diff --git a/apps/admin-ui/components/VendorSnippetForm.tsx b/apps/admin-ui/components/VendorSnippetForm.tsx index 87bd2c2..94006e6 100644 --- a/apps/admin-ui/components/VendorSnippetForm.tsx +++ b/apps/admin-ui/components/VendorSnippetForm.tsx @@ -5,6 +5,7 @@ import { MyText, tw, DatePicker, MyTextInput } from 'common-ui'; import BottomDropdown from 'common-ui/src/components/bottom-dropdown'; import ProductsSelector from '../components/ProductsSelector'; import { trpc } from '../src/trpc-client'; +import { useStaffAuth } from '@/components/context/staff-auth-context'; import { VendorSnippetForm as VendorSnippetFormType, VendorSnippet } from '../types/vendor-snippets'; interface VendorSnippetFormProps { @@ -21,8 +22,12 @@ const VendorSnippetForm: React.FC = ({ showIsPermanentCheckbox = false, }) => { - // Fetch slots - const { data: slotsData } = trpc.user.slots.getSlots.useQuery(); + // Fetch the staff user's region's slots (getSlots now requires a region). + const { regionId } = useStaffAuth(); + const { data: slotsData } = trpc.user.slots.getSlots.useQuery( + { regionId: regionId ?? 0 }, + { enabled: regionId != null } + ); const createSnippet = trpc.admin.vendorSnippets.create.useMutation(); const updateSnippet = trpc.admin.vendorSnippets.update.useMutation(); diff --git a/apps/admin-web/src/components/VendorSnippetForm.tsx b/apps/admin-web/src/components/VendorSnippetForm.tsx index fc0d73a..2dba50c 100644 --- a/apps/admin-web/src/components/VendorSnippetForm.tsx +++ b/apps/admin-web/src/components/VendorSnippetForm.tsx @@ -4,6 +4,7 @@ import { p as P, Dropdown, pInput as PInput, Checkbox } from 'web-components' import ProductsSelector from './ProductsSelector' import DateInput from './DateInput' import { trpc } from '@/lib/trpc-client' +import { useStaffAuth } from './context/staff-auth-context' import type { VendorSnippetForm as VendorSnippetFormType } from '@/types/vendor-snippets' interface VendorSnippetFormProps { @@ -20,8 +21,12 @@ const VendorSnippetForm: FC = ({ showIsPermanentCheckbox = false, }) => { - // Fetch slots - const { data: slotsData } = trpc.user.slots.getSlots.useQuery() + // Fetch the staff user's region's slots (getSlots now requires a region). + const { regionId } = useStaffAuth() + const { data: slotsData } = trpc.user.slots.getSlots.useQuery( + { regionId: regionId ?? 0 }, + { enabled: regionId != null } + ) const createSnippet = trpc.admin.vendorSnippets.create.useMutation() const updateSnippet = trpc.admin.vendorSnippets.update.useMutation() diff --git a/apps/backend/src/sqliteImporter.ts b/apps/backend/src/sqliteImporter.ts index 2f00d8d..3d0ee17 100644 --- a/apps/backend/src/sqliteImporter.ts +++ b/apps/backend/src/sqliteImporter.ts @@ -260,7 +260,6 @@ export { getSuspendedSkuIds, getNextDeliveryDateWithCapacity, getSkuRegionId, - getSkuRegionIds, getStoresSummary, healthCheck, // Delete orders helper diff --git a/apps/backend/src/trpc/apis/user-apis/apis/cart.ts b/apps/backend/src/trpc/apis/user-apis/apis/cart.ts index f203b91..b14cec8 100644 --- a/apps/backend/src/trpc/apis/user-apis/apis/cart.ts +++ b/apps/backend/src/trpc/apis/user-apis/apis/cart.ts @@ -1,39 +1,27 @@ import { router, publicProcedure } from '@/src/trpc/trpc-index' import { z } from 'zod' import { getMultipleProductsSlots } from '@/src/stores/slot-store' -import { getSkuRegionIds as getSkuRegionIdsInDb } from '@/src/dbService' export const cartRouter = router({ // Cache-based getCartSlots getCartSlots: publicProcedure .input(z.object({ + // The caller's browsing region. Mandatory: slots are read from this region + // only, so global SKUs (no region of their own) are servable in whatever + // region is being browsed, and the server never guesses a region per SKU. + regionId: z.number().int().positive(), productIds: z.array(z.number().int().positive()) })) .query(async ({ input }) => { - const { productIds } = input; + const { regionId, productIds } = input; if (productIds.length === 0) { return {}; } - // Regions resolved server-side from the SKUs' own product rows (never - // client-supplied); slot reads run per region and are merged. - const regionBySku = await getSkuRegionIdsInDb(productIds) - const idsByRegion = new Map() - for (const skuId of productIds) { - const regionId = regionBySku[skuId] - if (regionId == null) continue - if (!idsByRegion.has(regionId)) idsByRegion.set(regionId, []) - idsByRegion.get(regionId)!.push(skuId) - } - - const merged: Record = {} - await Promise.all( - [...idsByRegion.entries()].map(async ([regionId, ids]) => { - const perRegion = await getMultipleProductsSlots(regionId, ids) - Object.assign(merged, perRegion) - }) - ) - return merged; + // One region's slots for the whole request. getMultipleProductsSlots + // pre-seeds every requested id with [], so a SKU that belongs to another + // region resolves to [] instead of that other region's slots. + return await getMultipleProductsSlots(regionId, productIds); }), }); diff --git a/apps/backend/src/trpc/apis/user-apis/apis/product.ts b/apps/backend/src/trpc/apis/user-apis/apis/product.ts index b1b64db..eb7483c 100644 --- a/apps/backend/src/trpc/apis/user-apis/apis/product.ts +++ b/apps/backend/src/trpc/apis/user-apis/apis/product.ts @@ -28,13 +28,14 @@ export const productRouter = router({ getProductDetails: publicProcedure .input(z.object({ id: z.string().regex(/^\d+$/, 'Invalid product ID'), - // Optional caller region. Global SKUs have no product region, so the - // client supplies its region to resolve price/availability. - regionId: z.number().optional(), + // The caller's region. Mandatory: global SKUs have no product region, so + // price/availability always resolve against the caller's region. + regionId: z.number().int().positive(), })) .query(async ({ input }): Promise => { const { id } = input; const productId = parseInt(id); + const regionId = input.regionId; if (isNaN(productId)) { throw new Error('Invalid product ID'); @@ -42,12 +43,15 @@ export const productRouter = router({ console.log('from the api to get product details') - // A regional SKU resolves its region from its own product row; a global SKU - // (no region) falls back to the region supplied by the client. - const skuRegionId = (await getSkuRegionIdInDb(productId)) ?? input.regionId ?? null; - const cachedProduct = skuRegionId != null - ? await getProductByIdFromCache(skuRegionId, productId) - : null; + // A SKU owned by a different region is not served here — the caller states + // the region it is browsing. Global SKUs (no region of their own) and + // in-region SKUs both resolve against that region. + const ownRegionId = await getSkuRegionIdInDb(productId); + if (ownRegionId != null && ownRegionId !== regionId) { + throw new Error('Product not found'); + } + + const cachedProduct = await getProductByIdFromCache(regionId, productId); if (cachedProduct) { // Filter delivery slots to only include those with future freeze times and not at full capacity @@ -64,7 +68,7 @@ export const productRouter = router({ } // If not in cache, fetch from database (fallback) - const productData = await getUserProductDetailByIdInDb(productId, skuRegionId) + const productData = await getUserProductDetailByIdInDb(productId, regionId) if (!productData) { throw new Error('Product not found') diff --git a/apps/backend/src/trpc/apis/user-apis/apis/slots.ts b/apps/backend/src/trpc/apis/user-apis/apis/slots.ts index be16b19..9d1f5b0 100644 --- a/apps/backend/src/trpc/apis/user-apis/apis/slots.ts +++ b/apps/backend/src/trpc/apis/user-apis/apis/slots.ts @@ -38,16 +38,13 @@ export async function scaffoldSlotsWithProducts(regionId: number): Promise => { - const regionId = input?.regionId ?? ctx.staffUser?.regionId ?? null - - if (regionId == null) { - return { slots: [], count: 0 } - } + // The caller's region. Mandatory: slots belong to a region, so the caller + // states which one (customer apps pass the browsing region, admin tools + // pass the staff user's region). There is no server-side fallback. + regionId: z.number().int().positive(), + })) + .query(async ({ input }): Promise => { + const regionId = input.regionId // Only this region's active slots that can still be ordered: a slot whose // freeze time has passed is closed, and a different region's slots are not diff --git a/apps/backend/tests/api/admin.test.ts b/apps/backend/tests/api/admin.test.ts index 664c949..355472b 100644 --- a/apps/backend/tests/api/admin.test.ts +++ b/apps/backend/tests/api/admin.test.ts @@ -42,7 +42,7 @@ describe('admin API surface', () => { // so membership is asserted against the unbounded public list instead. expect(list.length).toBeLessThanOrEqual(20) - const publicSlots = await apiClient().user.slots.getSlots.query() + const publicSlots = await apiClient().user.slots.getSlots.query({ regionId: 1 }) expect(publicSlots.slots.some((s) => s.id === slot.slotId)).toBe(true) }) }) diff --git a/apps/backend/tests/api/misc-procedures.test.ts b/apps/backend/tests/api/misc-procedures.test.ts index fe21404..b16c55b 100644 --- a/apps/backend/tests/api/misc-procedures.test.ts +++ b/apps/backend/tests/api/misc-procedures.test.ts @@ -276,7 +276,7 @@ describe('misc procedures', () => { describe('cart slots', () => { it('returns an empty object for no products', async () => { - const res = await apiClient().user.cart.getCartSlots.query({ productIds: [] }) + const res = await apiClient().user.cart.getCartSlots.query({ regionId: 1, productIds: [] }) expect(res).toEqual({}) }) @@ -285,6 +285,7 @@ describe('misc procedures', () => { await createFutureSlot([store.skuId]) const res = (await apiClient().user.cart.getCartSlots.query({ + regionId: 1, productIds: [store.skuId], })) as Record diff --git a/apps/backend/tests/api/order-flow.test.ts b/apps/backend/tests/api/order-flow.test.ts index efd00da..8f134bd 100644 --- a/apps/backend/tests/api/order-flow.test.ts +++ b/apps/backend/tests/api/order-flow.test.ts @@ -29,7 +29,7 @@ describe('order flow: create an order, then read it back', () => { }) it('lists the created slot via user.slots.getSlots', async () => { - const slots = await apiClient().user.slots.getSlots.query() + const slots = await apiClient().user.slots.getSlots.query({ regionId: 1 }) expect(slots.slots.some((s) => s.id === slotId)).toBe(true) }) diff --git a/apps/backend/tests/api/user-surface.test.ts b/apps/backend/tests/api/user-surface.test.ts index 2dc838d..8e1063b 100644 --- a/apps/backend/tests/api/user-surface.test.ts +++ b/apps/backend/tests/api/user-surface.test.ts @@ -24,6 +24,7 @@ describe('user surface', () => { it('returns the product detail for a product id', async () => { const detail = await apiClient().user.product.getProductDetails.query({ id: String(productId), + regionId: 1, }) expect((detail as { name?: string })?.name).toBeTruthy() diff --git a/apps/backend/tests/helpers/cache.ts b/apps/backend/tests/helpers/cache.ts index ef087c1..1945804 100644 --- a/apps/backend/tests/helpers/cache.ts +++ b/apps/backend/tests/helpers/cache.ts @@ -2,11 +2,12 @@ * Static JSON cache helpers. * * The cache is written through the R2 S3 API and served from the assets domain - * (there is no backend route for it), so tests read the versioned public URL: - * slots ${assetsDomain}slots/v-/slots.json - * availability ${assetsDomain}av-/availability.json - * products ${assetsDomain}${apiCacheKey}/v-/products.json - * store detail ${assetsDomain}${apiCacheKey}/v-/stores/.json + * (there is no backend route for it), so tests read the versioned public URL. + * Every file lives under the region that owns it: + * slots ${assetsDomain}regions/${regionId}/slots/v-/slots.json + * availability ${assetsDomain}regions/${regionId}/av-/availability.json + * products ${assetsDomain}${apiCacheKey}/regions/${regionId}/v-/products.json + * store detail ${assetsDomain}${apiCacheKey}/regions/${regionId}/v-/stores/.json * * Versions come from common.essentialConsts. */ @@ -19,6 +20,7 @@ export interface EssentialConsts { cacheVersion: number slotsVersionNum: number availabilityVersionNum: number + regionId?: number [key: string]: unknown } @@ -32,23 +34,28 @@ export async function essentialConsts(): Promise { return consts } +// Cache files are region-owned: `regions//...` sits between the assets +// domain and the versioned filename. +const regionPath = (c: EssentialConsts) => + c.regionId != null ? `regions/${c.regionId}/` : '' + export const slotsCacheUrl = (c: EssentialConsts, version: number) => - `${c.assetsDomain}slots/v-${version}/slots.json` + `${c.assetsDomain}${regionPath(c)}slots/v-${version}/slots.json` export const availabilityCacheUrl = (c: EssentialConsts, version: number) => - `${c.assetsDomain}av-${version}/availability.json` + `${c.assetsDomain}${regionPath(c)}av-${version}/availability.json` export const productsCacheUrl = (c: EssentialConsts, version: number) => - `${c.assetsDomain}${c.apiCacheKey}/v-${version}/products.json` + `${c.assetsDomain}${c.apiCacheKey}/${regionPath(c)}v-${version}/products.json` export const storesCacheUrl = (c: EssentialConsts, version: number) => - `${c.assetsDomain}${c.apiCacheKey}/v-${version}/stores.json` + `${c.assetsDomain}${c.apiCacheKey}/${regionPath(c)}v-${version}/stores.json` export const essentialConstsCacheUrl = (c: EssentialConsts, version: number) => - `${c.assetsDomain}${c.apiCacheKey}/v-${version}/essential-consts.json` + `${c.assetsDomain}${c.apiCacheKey}/${regionPath(c)}v-${version}/essential-consts.json` export const storeDetailCacheUrl = (c: EssentialConsts, version: number, storeId: number) => - `${c.assetsDomain}${c.apiCacheKey}/v-${version}/stores/${storeId}.json` + `${c.assetsDomain}${c.apiCacheKey}/${regionPath(c)}v-${version}/stores/${storeId}.json` /** GET a cache file and parse it; throws with the status on a non-2xx. */ export async function fetchCacheJson(url: string): Promise { diff --git a/apps/backend/tests/helpers/fixtures.ts b/apps/backend/tests/helpers/fixtures.ts index 72f85dd..db8eca5 100644 --- a/apps/backend/tests/helpers/fixtures.ts +++ b/apps/backend/tests/helpers/fixtures.ts @@ -127,7 +127,7 @@ export async function createFutureSlot( skuIds, }) - const listed = await apiClient().user.slots.getSlots.query() + const listed = await apiClient().user.slots.getSlots.query({ regionId: 1 }) const slot = listed.slots.find( (s) => new Date(s.deliveryTime).toISOString() === deliveryTime ) diff --git a/apps/superadmin-ui/bun.lock b/apps/superadmin-ui/bun.lock index 6a00335..63a83dc 100644 --- a/apps/superadmin-ui/bun.lock +++ b/apps/superadmin-ui/bun.lock @@ -5,6 +5,8 @@ "": { "name": "superadmin-ui", "dependencies": { + "@radix-ui/react-alert-dialog": "^1.2.1", + "@radix-ui/react-select": "^2.4.1", "@tailwindcss/vite": "^4.1.18", "@tanstack/react-devtools": "^0.10.2", "@tanstack/react-query": "^5.100.0", @@ -22,25 +24,25 @@ "clsx": "^2.1.1", "dayjs": "^1.11.20", "formik": "^2.4.9", - "fuse.js": "^7.3.0", + "fuse.js": "7.1.0", "jwt-decode": "^4.0.0", "lucide-react": "^0.400.0", "nitro": "npm:nitro-nightly@latest", - "react": "^19.0.0", - "react-dom": "^19.0.0", + "react": "19.0.0", + "react-dom": "19.0.0", "tailwind-merge": "^3.5.0", "tailwindcss": "^4.1.18", "yup": "^1.7.1", - "zustand": "^5.0.13", + "zustand": "5.0.12", }, "devDependencies": { "@cloudflare/vite-plugin": "^1.36.3", "@tanstack/devtools-vite": "^0.6.0", - "@types/node": "^22.10.2", - "@types/react": "^19.0.0", - "@types/react-dom": "^19.0.0", + "@types/node": "22.19.18", + "@types/react": "~19.0.10", + "@types/react-dom": "~19.0.6", "@vitejs/plugin-react": "^6.0.1", - "typescript": "^5.8.3", + "typescript": "~5.8.3", "vite": "^8.0.0", "vitest": "^4.1.5", "wrangler": "^4.90.0", @@ -158,6 +160,8 @@ "@floating-ui/dom": ["@floating-ui/dom@1.8.0", "", { "dependencies": { "@floating-ui/core": "^1.8.0", "@floating-ui/utils": "^0.2.12" } }, "sha512-yXSrzeHZBTZadLOlfyhCkJHNeLJnHRnRInwdZ40L7ZiaAtrBwoYlsDrX3v5zB1Utk7CLfzcOVnVVWoXEky7Ceg=="], + "@floating-ui/react-dom": ["@floating-ui/react-dom@2.1.9", "", { "dependencies": { "@floating-ui/dom": "^1.8.0" }, "peerDependencies": { "react": ">=16.8.0", "react-dom": ">=16.8.0" } }, "sha512-JDjEFGCpImxDCA7JJKviA0M9+RtmJdj0m/NVU5IMgBK+AmZouAQQ7/+2GLH0GXXY0YMw9oXPB8hKdbPYg5QLYg=="], + "@floating-ui/utils": ["@floating-ui/utils@0.2.12", "", {}, "sha512-HpCo8tmWzLVad5s2d19EhAz5zqrrQ6s69qd6moPMQvkOuSwDT1YgRfWSVuc4ennqrgv3OHppiOGMQ7oC13yIww=="], "@img/colour": ["@img/colour@1.1.0", "", {}, "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ=="], @@ -250,6 +254,60 @@ "@poppinss/exception": ["@poppinss/exception@1.2.3", "", {}, "sha512-dCED+QRChTVatE9ibtoaxc+WkdzOSjYTKi/+uacHWIsfodVfpsueo3+DKpgU5Px8qXjgmXkSvhXvSCz3fnP9lw=="], + "@radix-ui/number": ["@radix-ui/number@1.1.3", "", {}, "sha512-Road2bidD0uu/1BGDOWNdPI06g0lIRy6IF9GZcIrDK2KGItfor8IQwQa+yM2ERgHM1MmHxaxpTzk0/Jp42lNfA=="], + + "@radix-ui/primitive": ["@radix-ui/primitive@1.2.0", "", {}, "sha512-KABY+VMIRPJL+Vyzv/335FEhXXD/xDv8BMb1kl48/aXJZMH0LtHCTx5ga5RnxaEP3nZHtmTLf1P9vanmFX46bw=="], + + "@radix-ui/react-alert-dialog": ["@radix-ui/react-alert-dialog@1.2.1", "", { "dependencies": { "@radix-ui/primitive": "1.2.0", "@radix-ui/react-compose-refs": "1.1.5", "@radix-ui/react-context": "1.3.0", "@radix-ui/react-dialog": "1.3.1", "@radix-ui/react-primitive": "2.2.0" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-MWC4N7RY+qsbNrFNo7yQ9ZbdoZEW+B5DtpWxJfUnVCqcQxxqqg3qis3RMPTDbCNaTIdHJSn5XDkl9ZdVWXknLg=="], + + "@radix-ui/react-arrow": ["@radix-ui/react-arrow@1.1.17", "", { "dependencies": { "@radix-ui/react-primitive": "2.2.0" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-67jjcVvxjXCCStnTW3Z+M7jmaFMuMR7M2JgpDzH4w7JSRrikmzhjfYgP/09ECb8n7whnsgh1ifJ+Ie96qEj+pQ=="], + + "@radix-ui/react-collection": ["@radix-ui/react-collection@1.2.0", "", { "dependencies": { "@radix-ui/react-compose-refs": "1.1.5", "@radix-ui/react-context": "1.3.0", "@radix-ui/react-primitive": "2.2.0", "@radix-ui/react-slot": "1.5.0", "@radix-ui/react-use-layout-effect": "1.1.4" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-+yiQzqcc7Sy7/5s0jrMCjpPRFB3538VNrXPWdTLZhE/SCfgEws4aI6lHWN/vvcnyhHndROWBzqmqB4QBrITZ9Q=="], + + "@radix-ui/react-compose-refs": ["@radix-ui/react-compose-refs@1.1.5", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-+48PbAAbq3didjJxa+OaWY2ZwgAKsNiRGyeHKszblZMQ+kcpd9pAaT11cMkGEie0vsOi3QdeTE6d5Fe3Gn61kA=="], + + "@radix-ui/react-context": ["@radix-ui/react-context@1.3.0", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-v5AYEocMISkbJ+1fTXzZpiFv7NRr3D2WiYbLIKf+FkmJ8VkP6d503eV2n34MFussHXY1pcoq3yfJiQH77dc4Mg=="], + + "@radix-ui/react-dialog": ["@radix-ui/react-dialog@1.3.1", "", { "dependencies": { "@radix-ui/primitive": "1.2.0", "@radix-ui/react-compose-refs": "1.1.5", "@radix-ui/react-context": "1.3.0", "@radix-ui/react-dismissable-layer": "1.2.1", "@radix-ui/react-focus-guards": "1.2.0", "@radix-ui/react-focus-scope": "1.3.1", "@radix-ui/react-id": "1.1.4", "@radix-ui/react-portal": "1.2.0", "@radix-ui/react-presence": "1.1.11", "@radix-ui/react-primitive": "2.2.0", "@radix-ui/react-slot": "1.5.0", "@radix-ui/react-use-controllable-state": "1.3.0", "@radix-ui/react-use-layout-effect": "1.1.4", "aria-hidden": "^1.2.4", "react-remove-scroll": "^2.7.2" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-+0E4qvVTwjAWra9sEhJ+9BTsvHE00zkUuNw1VGh7S+Gc13dfYk+S1PVQdchWDj+XYHhAai7Z7IpzXVDCGsDplg=="], + + "@radix-ui/react-direction": ["@radix-ui/react-direction@1.2.0", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-FtRA52a/r+LKStFT+neLUm+8vSe7wbzkbQGGeU8ixFiwC8NU14Evoq9ATECqL3eGbcUzJR4fyfA4KkK/q6dfqg=="], + + "@radix-ui/react-dismissable-layer": ["@radix-ui/react-dismissable-layer@1.2.1", "", { "dependencies": { "@radix-ui/primitive": "1.2.0", "@radix-ui/react-compose-refs": "1.1.5", "@radix-ui/react-primitive": "2.2.0", "@radix-ui/react-use-callback-ref": "1.1.5", "@radix-ui/react-use-effect-event": "0.0.5" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-KIfDcAsx+oVylFZ4xryVKusJUrLLhTQmfnJW4kwk4Km5myvhHCrj04hnWWUC166+xD4DHdH8tQGylwYX1h6+Pg=="], + + "@radix-ui/react-focus-guards": ["@radix-ui/react-focus-guards@1.2.0", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-MPm5R0iRGUDrDnPNxmLBkv+X7pN4XKzt+MbWJEuJQsH3NFH4omrbpXpucyYCCKTSt+na/ZxGhEWQrWTZ0285cA=="], + + "@radix-ui/react-focus-scope": ["@radix-ui/react-focus-scope@1.3.1", "", { "dependencies": { "@radix-ui/react-compose-refs": "1.1.5", "@radix-ui/react-primitive": "2.2.0", "@radix-ui/react-use-callback-ref": "1.1.5" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-ugeMhbXt4y5S2T1GnIqbWDKEN962PDwnX1fN0eKOOgf5f63Dh2mn8F1FUySlgW0iF6GiVsRF32DzuDIWTUyQJg=="], + + "@radix-ui/react-id": ["@radix-ui/react-id@1.1.4", "", { "dependencies": { "@radix-ui/react-use-layout-effect": "1.1.4" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-TMQp2llA+RYn7JcjnrMnz7wN4pcVttPZnRZo52PLQsoLVKzNlVwUeHmfePgTgRluXFvlD3GD5g5MOVVTJCO0qA=="], + + "@radix-ui/react-popper": ["@radix-ui/react-popper@1.4.0", "", { "dependencies": { "@floating-ui/react-dom": "^2.0.0", "@radix-ui/react-arrow": "1.1.17", "@radix-ui/react-compose-refs": "1.1.5", "@radix-ui/react-context": "1.3.0", "@radix-ui/react-primitive": "2.2.0", "@radix-ui/react-use-callback-ref": "1.1.5", "@radix-ui/react-use-layout-effect": "1.1.4", "@radix-ui/react-use-rect": "1.1.4", "@radix-ui/react-use-size": "1.1.5", "@radix-ui/rect": "1.1.3" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-yCWRvLeGv9Pz3+efwHqGPp70mZ56r3kfIgQVF56Oj2aAa4uP/Tb+IE59wNcc+758rctqbCKx4LbK8II/r7Bn0Q=="], + + "@radix-ui/react-portal": ["@radix-ui/react-portal@1.2.0", "", { "dependencies": { "@radix-ui/react-primitive": "2.2.0", "@radix-ui/react-use-layout-effect": "1.1.4" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-StX7xXnaRU41VvFtMm9zlhVGz8XF6GmWWTXftkQaY+tqVkbs/R9UmAp5mLzHHapk5hM9RMZQvO/3usyIP/g42g=="], + + "@radix-ui/react-presence": ["@radix-ui/react-presence@1.1.11", "", { "dependencies": { "@radix-ui/react-use-layout-effect": "1.1.4" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-Z7/atlkab36Z8hm+V8zYc79r0W+tiOB1o0tun1By94JyadkekLQmtEAnBSP9XKXBNQsStoStS4+gX10JpS5akA=="], + + "@radix-ui/react-primitive": ["@radix-ui/react-primitive@2.2.0", "", { "dependencies": { "@radix-ui/react-slot": "1.5.0" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-HCTSPMNqv55Qk0IX4geJbpyXazmqulcimwuyjxTkKi29v+QZbG2Zho9BnbBq4YS2PF+KlNb2CXoLz66uUmblkg=="], + + "@radix-ui/react-select": ["@radix-ui/react-select@2.4.1", "", { "dependencies": { "@radix-ui/number": "1.1.3", "@radix-ui/primitive": "1.2.0", "@radix-ui/react-collection": "1.2.0", "@radix-ui/react-compose-refs": "1.1.5", "@radix-ui/react-context": "1.3.0", "@radix-ui/react-direction": "1.2.0", "@radix-ui/react-dismissable-layer": "1.2.1", "@radix-ui/react-focus-guards": "1.2.0", "@radix-ui/react-focus-scope": "1.3.1", "@radix-ui/react-id": "1.1.4", "@radix-ui/react-popper": "1.4.0", "@radix-ui/react-portal": "1.2.0", "@radix-ui/react-presence": "1.1.11", "@radix-ui/react-primitive": "2.2.0", "@radix-ui/react-slot": "1.5.0", "@radix-ui/react-use-callback-ref": "1.1.5", "@radix-ui/react-use-controllable-state": "1.3.0", "@radix-ui/react-use-layout-effect": "1.1.4", "@radix-ui/react-visually-hidden": "1.2.13", "aria-hidden": "^1.2.4", "react-remove-scroll": "^2.7.2" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-888ZwW0Md6GyptuqYABRX9nLKgoYfcooCyBBvVaX5Jp3e+8Jp2i4Zo/Uy50Hm+Ysn2JfloQXstW4U36w8teVtg=="], + + "@radix-ui/react-slot": ["@radix-ui/react-slot@1.5.0", "", { "dependencies": { "@radix-ui/react-compose-refs": "1.1.5" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-tyYd9ddPXAysAbdbD9eYxgwpCSv6f3PncqVSNKQFSR5lcJVLz3cb/pANDoYrLiHBpXv7skortyUgGUWsYuPPFQ=="], + + "@radix-ui/react-use-callback-ref": ["@radix-ui/react-use-callback-ref@1.1.5", "", { "dependencies": { "@radix-ui/react-use-layout-effect": "1.1.4" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-Y5GBf4NKeADoXI1geiMlMuMoURT3k9MizzzKhGb/m55H94aGigZ01PIpkvsO6lML13BA6XYAXSJ6gza7vTn5nw=="], + + "@radix-ui/react-use-controllable-state": ["@radix-ui/react-use-controllable-state@1.3.0", "", { "dependencies": { "@radix-ui/primitive": "1.2.0", "@radix-ui/react-use-effect-event": "0.0.5", "@radix-ui/react-use-layout-effect": "1.1.4" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-TAcBI7bw2ljYCbv4+zuTSd6zICu8pRt6SDN2vJ/Z06K2MXh6I9WYFe/A9ovlFDtR5HVHGm5iDxDoABm/++dbKg=="], + + "@radix-ui/react-use-effect-event": ["@radix-ui/react-use-effect-event@0.0.5", "", { "dependencies": { "@radix-ui/react-use-layout-effect": "1.1.4" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-7cshFL8HGS/7HEiHH+9kL9HBwp2sa9yX18Knwek6KYWmXwM7pegMgta2AXMQKI+rq3JnfSj9x8wYqFMTdG1Jgg=="], + + "@radix-ui/react-use-layout-effect": ["@radix-ui/react-use-layout-effect@1.1.4", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-K20DkRkUwDnxEYMBPcg3Y6voLkEy5p5QQmszZgLngKKiC7dzBR/aEuK3w1qlx2JWDUNH6FluahYdgR3BP+QbYw=="], + + "@radix-ui/react-use-rect": ["@radix-ui/react-use-rect@1.1.4", "", { "dependencies": { "@radix-ui/rect": "1.1.3" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-cSOCh6JlkmfjLyNcLiu2nB4v+nm+dkZ+Q5KHWk/soo4U7ZLiEQFKHK9/YmtBHjfCEaU43IBKQOc4/uJmCaiCTQ=="], + + "@radix-ui/react-use-size": ["@radix-ui/react-use-size@1.1.5", "", { "dependencies": { "@radix-ui/react-use-layout-effect": "1.1.4" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-V1McDQkMGzgivwqdu7u96APs7oi0Jvj9LTzgq3WWrDZqxWdAqU9yZnZQqk5OizGFR8badUQwZsrlao7MOlWYOA=="], + + "@radix-ui/react-visually-hidden": ["@radix-ui/react-visually-hidden@1.2.13", "", { "dependencies": { "@radix-ui/react-primitive": "2.2.0" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-feijiN1oPk4rck4u9Dm9tsU4mT6Wp9oeEEhaz1WUEs1VuqLf8xzsFG+Qk+uWq6TnMH9O+WRECRg0NftyP9E4Fw=="], + + "@radix-ui/rect": ["@radix-ui/rect@1.1.3", "", {}, "sha512-JtyZR+mqgBibTo8xea3B6ZRmzZiM/YeVBtUkas6zMuXjAlfIFIW2FgqeM9eLyvEaYX66vr6DJMK+4U6LV0KhNw=="], + "@rolldown/binding-android-arm-eabi": ["@rolldown/binding-android-arm-eabi@1.2.12", "", { "os": "android", "cpu": "arm" }, "sha512-dB/a1214qKfHMXCpgqR4OZT+jS4kTyEXbQGJPqzobt5EwH5rX080pxE37alt3RzvR1bf1Yz/yGqRfrYAxuPw0A=="], "@rolldown/binding-android-arm64": ["@rolldown/binding-android-arm64@1.2.12", "", { "os": "android", "cpu": "arm64" }, "sha512-7KHFgQ5VJxIHcLlrwrc3Xbds7oTNQT7Pgi9gQCJKrd2VGab/UksIOYp6VD8MzCstGxOKMgNamPwUCfxPdP1OHg=="], @@ -430,11 +488,11 @@ "@types/hoist-non-react-statics": ["@types/hoist-non-react-statics@3.3.7", "", { "dependencies": { "hoist-non-react-statics": "^3.3.0" }, "peerDependencies": { "@types/react": "*" } }, "sha512-PQTyIulDkIDro8P+IHbKCsw7U2xxBYflVzW/FgWdCAePD9xGSidgA76/GeJ6lBKoblyhf9pBY763gbrN+1dI8g=="], - "@types/node": ["@types/node@22.20.4", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-zJRE40jpHtKqE/C4fgHrAKQLJuSpzEnP9ff9Y7YtoR3Wd2pwqzlekDeEuUQXjRd+QCYnVnNwuJYmhdk9XV8gvA=="], + "@types/node": ["@types/node@22.19.18", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-9v00a+dn2yWVsYDEunWC4g/TcRKVq3r8N5FuZp7u0SGrPvdN9c2yXI9bBuf5Fl0hNCb+QTIePTn5pJs2pwBOQQ=="], - "@types/react": ["@types/react@19.3.0", "", { "dependencies": { "csstype": "^3.2.2" } }, "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg=="], + "@types/react": ["@types/react@19.0.14", "", { "dependencies": { "csstype": "^3.0.2" } }, "sha512-ixLZ7zG7j1fM0DijL9hDArwhwcCb4vqmePgwtV0GfnkHRSCUEv4LvzarcTdhoqgyMznUx/EhoTUv31CKZzkQlw=="], - "@types/react-dom": ["@types/react-dom@19.3.0", "", { "peerDependencies": { "@types/react": "^19.3.0" } }, "sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q=="], + "@types/react-dom": ["@types/react-dom@19.0.6", "", { "peerDependencies": { "@types/react": "^19.0.0" } }, "sha512-lo6MuY+rFr8kIiFnr+7TzO+Av0wUPcEcepiPV4epGP0eTQpkDfp9czudg73isV8UxKauCUNlL1N8fXhcnx4iBw=="], "@vitejs/plugin-react": ["@vitejs/plugin-react@6.1.1", "", { "dependencies": { "@rolldown/pluginutils": "^1.0.1" }, "peerDependencies": { "@rolldown/plugin-babel": "^0.1.7 || ^0.2.0", "babel-plugin-react-compiler": "^1.0.0", "oxc-transform-react": "^0.145.0", "vite": "^8.0.0" }, "optionalPeers": ["@rolldown/plugin-babel", "babel-plugin-react-compiler", "oxc-transform-react"] }, "sha512-yxLaQV9gkhS8ezJqCM6+ndU7mDY6gqAg75NQ+0IjwEI8IYOmQCgkRwHKVSfWXW076DsqMo0Dk+0FK1U+M5RgFw=="], @@ -458,6 +516,8 @@ "argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="], + "aria-hidden": ["aria-hidden@1.2.6", "", { "dependencies": { "tslib": "^2.0.0" } }, "sha512-ik3ZgC9dY/lYVVM++OISsaYDeg1tb0VtP5uL3ouh1koGOaUMDPpbFIei4JkFimWUFPn90sbMNMXQAIVOlnYKJA=="], + "assertion-error": ["assertion-error@2.0.1", "", {}, "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA=="], "asynckit": ["asynckit@0.4.0", "", {}, "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="], @@ -514,6 +574,8 @@ "detect-libc": ["detect-libc@2.1.2", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="], + "detect-node-es": ["detect-node-es@1.1.0", "", {}, "sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ=="], + "diff": ["diff@8.0.4", "", {}, "sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw=="], "dunder-proto": ["dunder-proto@1.0.1", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="], @@ -560,12 +622,14 @@ "function-bind": ["function-bind@1.1.2", "", {}, "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="], - "fuse.js": ["fuse.js@7.5.0", "", {}, "sha512-sQtrEfA+ez/3G0cCZecF70oqpCRttCexYUG4mUrtWL49ULUzUyxokt5kyqwtKzj1270RaKih+hcP3qLcumccow=="], + "fuse.js": ["fuse.js@7.1.0", "", {}, "sha512-trLf4SzuuUxfusZADLINj+dE8clK1frKdmqiJNb1Es75fmI5oY6X2mxLVUciLLjxqw/xr72Dhy+lER6dGd02FQ=="], "gensync": ["gensync@1.0.0-beta.2", "", {}, "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg=="], "get-intrinsic": ["get-intrinsic@1.3.0", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", "math-intrinsics": "^1.1.0" } }, "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ=="], + "get-nonce": ["get-nonce@1.0.1", "", {}, "sha512-FJhYRoDaiatfEkUK8HKlicmu/3SGFD51q3itKDGoSTysQJBnfOcxU5GxnhE1E6soB76MbT0MBtnKJuXyAx+96Q=="], + "get-proto": ["get-proto@1.0.1", "", { "dependencies": { "dunder-proto": "^1.0.1", "es-object-atoms": "^1.0.0" } }, "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g=="], "goober": ["goober@2.1.19", "", { "peerDependencies": { "csstype": "^3.0.10" } }, "sha512-U7veizMqxyKlM58+Z5j2ngJBH/r9siDmxpvNxSw0PylF6WQvrASJEZrxh1hidRBJc2jqoBVSyOban5u8m+6Rxg=="], @@ -682,14 +746,20 @@ "proxy-from-env": ["proxy-from-env@2.1.0", "", {}, "sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA=="], - "react": ["react@19.3.0", "", {}, "sha512-E8LUcbtBWt20bbl2YoHfx4ZDBdxVTfOKtCZn9cDSJ4l6/nuoApcpIBcj47t2wZoVX8g2ZHuMHbiShgCR1T5Sog=="], + "react": ["react@19.0.0", "", {}, "sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ=="], - "react-dom": ["react-dom@19.3.0", "", { "dependencies": { "scheduler": "^0.28.0" }, "peerDependencies": { "react": "^19.3.0" } }, "sha512-JDk8dgif51OjFoDE70+OT9ICyYr+69HlmihNwp1+Nsfbna3t5sIiCa9ZJktDmQ4/1b/rn26hIAR2uYXDMr5r0Q=="], + "react-dom": ["react-dom@19.0.0", "", { "dependencies": { "scheduler": "^0.25.0" }, "peerDependencies": { "react": "^19.0.0" } }, "sha512-4GV5sHFG0e/0AD4X+ySy6UJd3jVl1iNsNHdpad0qhABJ11twS3TTBnseqsKurKcsNqCEFeGL3uLpVChpIO3QfQ=="], "react-fast-compare": ["react-fast-compare@2.0.4", "", {}, "sha512-suNP+J1VU1MWFKcyt7RtjiSWUjvidmQSlqu+eHslq+342xCbGTYmC0mEhPCOHxlW0CywylOC1u2DFAT+bv4dBw=="], "react-is": ["react-is@16.13.1", "", {}, "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="], + "react-remove-scroll": ["react-remove-scroll@2.7.2", "", { "dependencies": { "react-remove-scroll-bar": "^2.3.7", "react-style-singleton": "^2.2.3", "tslib": "^2.1.0", "use-callback-ref": "^1.3.3", "use-sidecar": "^1.1.3" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-Iqb9NjCCTt6Hf+vOdNIZGdTiH1QSqr27H/Ek9sv/a97gfueI/5h1s3yRi1nngzMUaOOToin5dI1dXKdXiF+u0Q=="], + + "react-remove-scroll-bar": ["react-remove-scroll-bar@2.3.8", "", { "dependencies": { "react-style-singleton": "^2.2.2", "tslib": "^2.0.0" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-9r+yi9+mgU33AKcj6IbT9oRCO78WriSj6t/cF8DWBZJ9aOGPOTEDvdUDz1FwKim7QXWwmHqtdHnRJfhAxEG46Q=="], + + "react-style-singleton": ["react-style-singleton@2.2.3", "", { "dependencies": { "get-nonce": "^1.0.0", "tslib": "^2.0.0" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-b6jSvxvVnyptAiLjbkWLE/lOnR4lfTtDAl+eUC7RZy+QQWc6wRzIV2CE6xBuMmDxc2qIihtDCZD5NPOFl7fRBQ=="], + "readdirp": ["readdirp@5.1.1", "", {}, "sha512-Kko+Y5XQ6fM+Ce3dq3m9YGxnacYZYl9cA1wZjaF3Vbry2L3i1qVg8+CAgNPsXRArPMUMCaOR7oa9Nqntc43JKA=="], "remove-accents": ["remove-accents@0.5.0", "", {}, "sha512-8g3/Otx1eJaVD12e31UbJj1YzdtVvzH85HV7t+9MJYk/u3XmkOUJ5Ys9wQrf9PCPK8+xn4ymzqYCiZl6QWKn+A=="], @@ -698,7 +768,7 @@ "rou3": ["rou3@0.9.2", "", {}, "sha512-3SOzvaAg8rkHrXtRjpCvCvbyO5to9oOO27Z/XqHEYXfMRVSw/qMIVdmaOk9W2lcRLtR6dlqTjo9hDeJk70QBYQ=="], - "scheduler": ["scheduler@0.28.0", "", {}, "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw=="], + "scheduler": ["scheduler@0.25.0", "", {}, "sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA=="], "semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], @@ -758,7 +828,7 @@ "type-fest": ["type-fest@2.19.0", "", {}, "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA=="], - "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], + "typescript": ["typescript@5.8.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ=="], "ufo": ["ufo@1.6.4", "", {}, "sha512-JFNbkD1Svwe0KvGi8GOeLcP4kAWQ609twvCdcHxq1oSL8svv39ZuSvajcD8B+5D0eL4+s1Is2D/O6KN3qcTeRA=="], @@ -774,6 +844,10 @@ "update-browserslist-db": ["update-browserslist-db@1.3.3", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-pJ2sYawQS0R/WI928Gj5GlPhTGzbMelq0+4INtSYNDV9ErKJcX6xjGWkoG/VnB3dpUm00zALaqkrUD77pO5TDQ=="], + "use-callback-ref": ["use-callback-ref@1.3.3", "", { "dependencies": { "tslib": "^2.0.0" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-jQL3lRnocaFtu3V00JToYz/4QkNWswxijDaCVNZRiRTO3HQDLsdu1ZtmIUvV4yPp+rvWm5j0y0TG/S61cuijTg=="], + + "use-sidecar": ["use-sidecar@1.1.3", "", { "dependencies": { "detect-node-es": "^1.1.0", "tslib": "^2.0.0" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-Fedw0aZvkhynoPYlA5WXrMCAMm+nSWdZt6lzJQ7Ok8S6Q+VsHmHpRWndVRJ8Be0ZbkfPc5LRYH+5XrzXcEeLRQ=="], + "use-sync-external-store": ["use-sync-external-store@1.7.0", "", { "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-6L+EeigHMQhdaIPNIFUKwfWJSwWFQ8gJbJ2DLOs5sDIegTwR9fRxvnM3uciHKjIZhFz+KAv2emhWMRvDmMcY8A=="], "vite": ["vite@8.3.1", "", { "dependencies": { "lightningcss": "^1.33.0", "picomatch": "^4.0.7", "postcss": "^8.5.28", "rolldown": "~1.2.9", "tinyglobby": "^0.2.17" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.7.1", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-/bvH9E9tmCXRGp2uXY3WbOldqpTwFkbha/8ANaEQ6VkxhH60KyqLwgZq6lG2y+4uT55x9+9eUHMpQ7uGnOCKjA=="], @@ -804,7 +878,7 @@ "zod": ["zod@4.6.5", "", {}, "sha512-v5l/aFXZQeai4awLbOpSoHecE9UiMrnfx75tEXLjNonXVARxQ5mOeipTjROUchszUNCqnE+hqAMujRsRHsut2Q=="], - "zustand": ["zustand@5.0.15", "", { "peerDependencies": { "@types/react": ">=18.0.0", "immer": ">=9.0.6", "react": ">=18.0.0", "use-sync-external-store": ">=1.2.0" }, "optionalPeers": ["@types/react", "immer", "react", "use-sync-external-store"] }, "sha512-MpSEjRiBkA9crSYeOUH32rJC7SVqAbm0Fqcqge/bUi2PPoLcBWKOsG+C8mevmpr8TwXHBVkChbbJiyvkE+i/3A=="], + "zustand": ["zustand@5.0.12", "", { "peerDependencies": { "@types/react": ">=18.0.0", "immer": ">=9.0.6", "react": ">=18.0.0", "use-sync-external-store": ">=1.2.0" }, "optionalPeers": ["@types/react", "immer", "react", "use-sync-external-store"] }, "sha512-i77ae3aZq4dhMlRhJVCYgMLKuSiZAaUPAct2AksxQ+gOtimhGMdXljRT21P5BNpeT4kXlLIckvkPM029OljD7g=="], "@cspotcode/source-map-support/@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.9", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" } }, "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ=="], diff --git a/apps/superadmin-ui/components.json b/apps/superadmin-ui/components.json new file mode 100644 index 0000000..5714c06 --- /dev/null +++ b/apps/superadmin-ui/components.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://ui.shadcn.com/schema.json", + "style": "new-york", + "rsc": false, + "tsx": true, + "tailwind": { + "config": "", + "css": "src/styles.css", + "baseColor": "neutral", + "cssVariables": false, + "prefix": "" + }, + "iconLibrary": "lucide", + "aliases": { + "components": "@/components", + "ui": "@/components/ui", + "utils": "@/lib/utils", + "lib": "@/lib", + "hooks": "@/hooks" + } +} diff --git a/apps/superadmin-ui/package.json b/apps/superadmin-ui/package.json index 079fa55..4ac26ba 100644 --- a/apps/superadmin-ui/package.json +++ b/apps/superadmin-ui/package.json @@ -12,6 +12,8 @@ "test": "vitest run" }, "dependencies": { + "@radix-ui/react-alert-dialog": "^1.2.1", + "@radix-ui/react-select": "^2.4.1", "@tailwindcss/vite": "^4.1.18", "@tanstack/react-devtools": "^0.10.2", "@tanstack/react-query": "^5.100.0", @@ -29,25 +31,25 @@ "clsx": "^2.1.1", "dayjs": "^1.11.20", "formik": "^2.4.9", - "fuse.js": "^7.3.0", + "fuse.js": "7.1.0", "jwt-decode": "^4.0.0", "lucide-react": "^0.400.0", "nitro": "npm:nitro-nightly@latest", - "react": "^19.0.0", - "react-dom": "^19.0.0", + "react": "19.0.0", + "react-dom": "19.0.0", "tailwind-merge": "^3.5.0", "tailwindcss": "^4.1.18", "yup": "^1.7.1", - "zustand": "^5.0.13" + "zustand": "5.0.12" }, "devDependencies": { "@cloudflare/vite-plugin": "^1.36.3", "@tanstack/devtools-vite": "^0.6.0", - "@types/node": "^22.10.2", - "@types/react": "^19.0.0", - "@types/react-dom": "^19.0.0", + "@types/node": "22.19.18", + "@types/react": "~19.0.10", + "@types/react-dom": "~19.0.6", "@vitejs/plugin-react": "^6.0.1", - "typescript": "^5.8.3", + "typescript": "~5.8.3", "vite": "^8.0.0", "vitest": "^4.1.5", "wrangler": "^4.90.0" diff --git a/apps/superadmin-ui/src/components/ui/alert-dialog.tsx b/apps/superadmin-ui/src/components/ui/alert-dialog.tsx new file mode 100644 index 0000000..bc4d914 --- /dev/null +++ b/apps/superadmin-ui/src/components/ui/alert-dialog.tsx @@ -0,0 +1,150 @@ +import * as React from 'react' +import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog' + +import { cn } from '@/lib/utils' + +/** + * shadcn AlertDialog (Radix) — adapted to Freshyo's gray/brand palette. + * Component list mirrors https://ui.shadcn.com/docs/components/alert-dialog. + */ +function AlertDialog(props: React.ComponentProps) { + return +} + +function AlertDialogTrigger( + props: React.ComponentProps +) { + return +} + +function AlertDialogPortal(props: React.ComponentProps) { + return +} + +function AlertDialogOverlay({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function AlertDialogContent({ + className, + ...props +}: React.ComponentProps) { + return ( + + + + + ) +} + +function AlertDialogHeader({ className, ...props }: React.ComponentProps<'div'>) { + return ( +
+ ) +} + +function AlertDialogFooter({ className, ...props }: React.ComponentProps<'div'>) { + return ( +
+ ) +} + +function AlertDialogTitle({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function AlertDialogDescription({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function AlertDialogAction({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function AlertDialogCancel({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +export { + AlertDialog, + AlertDialogTrigger, + AlertDialogPortal, + AlertDialogOverlay, + AlertDialogContent, + AlertDialogHeader, + AlertDialogFooter, + AlertDialogTitle, + AlertDialogDescription, + AlertDialogAction, + AlertDialogCancel, +} diff --git a/apps/superadmin-ui/src/components/ui/dialog-host.tsx b/apps/superadmin-ui/src/components/ui/dialog-host.tsx new file mode 100644 index 0000000..d0d2ab7 --- /dev/null +++ b/apps/superadmin-ui/src/components/ui/dialog-host.tsx @@ -0,0 +1,189 @@ +import * as React from 'react' + +import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, +} from '@/components/ui/alert-dialog' +import { cn } from '@/lib/utils' + +export interface DialogOptions { + /** Optional title. When omitted it is derived from the message. */ + title?: string + confirmText?: string + cancelText?: string + /** Style the confirm button as destructive (delete/remove actions). */ + destructive?: boolean + /** Prompt only. */ + defaultValue?: string + placeholder?: string +} + +type DialogKind = 'alert' | 'confirm' | 'prompt' + +interface DialogRequest { + id: number + kind: DialogKind + message: string + options: DialogOptions + resolve: (value: unknown) => void +} + +/** Requests waiting to be shown. Head of the list is the visible dialog. */ +const pending: DialogRequest[] = [] +let notifyHost: (() => void) | null = null +let nextId = 1 + +function enqueue(kind: DialogKind, message: string, options: DialogOptions): Promise { + return new Promise((resolve) => { + const request: DialogRequest = { id: nextId++, kind, message, options, resolve } + pending.push(request) + if (notifyHost) { + notifyHost() + } else if (typeof console !== 'undefined') { + // The host is mounted by the root route; this only happens if code calls + // a dialog before hydration. + console.warn('[dialog] is not mounted yet:', message) + request.resolve(kind === 'confirm' ? false : kind === 'prompt' ? null : undefined) + } + }) +} + +/** Drop-in replacement for `window.alert` backed by a shadcn AlertDialog. */ +export function alert( + message: string, + options?: Omit +): Promise { + return enqueue('alert', message, options ?? {}) as Promise +} + +/** Drop-in replacement for `window.confirm`; must be awaited. */ +export function confirm( + message: string, + options?: Omit +): Promise { + return enqueue('confirm', message, options ?? {}) as Promise +} + +/** Drop-in replacement for `window.prompt`; must be awaited. */ +export function prompt(message: string, options?: DialogOptions): Promise { + return enqueue('prompt', message, options ?? {}) as Promise +} + +const CANCEL_VALUE: Record = { + alert: undefined, + confirm: false, + prompt: null, +} + +function splitMessage(message: string): { title: string; description: string } { + const index = message.indexOf('\n\n') + if (index === -1) return { title: message, description: '' } + return { title: message.slice(0, index), description: message.slice(index + 2) } +} + +/** + * Single mount point for the imperative `alert` / `confirm` / `prompt` + * helpers. Portals to , so it adds nothing to the layout. + */ +export function DialogHost() { + const [, forceRender] = React.useState(0) + const [input, setInput] = React.useState('') + const [busy, setBusy] = React.useState(false) + + const request = pending[0] ?? null + + React.useEffect(() => { + const update = () => forceRender((n) => n + 1) + notifyHost = update + update() + return () => { + if (notifyHost === update) notifyHost = null + } + }, []) + + React.useEffect(() => { + setInput(request?.options.defaultValue ?? '') + setBusy(false) + }, [request?.id]) + + const settle = React.useCallback((id: number, value: unknown) => { + const index = pending.findIndex((item) => item.id === id) + if (index === -1) return + const [done] = pending.splice(index, 1) + done.resolve(value) + forceRender((n) => n + 1) + }, []) + + if (!request) return null + + const { title, description } = splitMessage(request.message) + const heading = request.options.title ?? title + const body = + request.options.title && !description ? request.message : description + + const confirmLabel = + request.options.confirmText ?? (request.kind === 'alert' ? 'OK' : 'Confirm') + const cancelLabel = request.options.cancelText ?? 'Cancel' + + const confirmValue = request.kind === 'prompt' ? input : true + + return ( + { + if (!open) settle(request.id, CANCEL_VALUE[request.kind]) + }} + > + + + {heading} + {body || '\u00A0'} + + + {request.kind === 'prompt' ? ( + setInput(event.target.value)} + placeholder={request.options.placeholder} + onKeyDown={(event) => { + if (event.key === 'Enter') { + event.preventDefault() + if (busy) return + setBusy(true) + settle(request.id, input) + } + }} + className="w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 focus:border-brand-500 focus:outline-none focus:ring-1 focus:ring-brand-500" + /> + ) : null} + + + {request.kind !== 'alert' ? ( + settle(request.id, CANCEL_VALUE[request.kind])} + > + {cancelLabel} + + ) : null} + { + if (busy) return + setBusy(true) + settle(request.id, confirmValue) + }} + className={cn(request.options.destructive && 'bg-red-500 hover:bg-red-600')} + > + {confirmLabel} + + + + + ) +} diff --git a/apps/superadmin-ui/src/components/ui/select.tsx b/apps/superadmin-ui/src/components/ui/select.tsx new file mode 100644 index 0000000..28e2a87 --- /dev/null +++ b/apps/superadmin-ui/src/components/ui/select.tsx @@ -0,0 +1,145 @@ +import * as React from 'react' +import * as SelectPrimitive from '@radix-ui/react-select' +import { Check, ChevronDown, ChevronUp } from 'lucide-react' + +import { cn } from '@/lib/utils' + +/** + * shadcn Select (Radix) — adapted to Freshyo's gray/brand palette. + * Component list mirrors https://ui.shadcn.com/docs/components/select. + */ +function Select(props: React.ComponentProps) { + return +} + +function SelectGroup(props: React.ComponentProps) { + return +} + +function SelectValue(props: React.ComponentProps) { + return +} + +function SelectTrigger({ + className, + children, + ...props +}: React.ComponentProps) { + return ( + span]:line-clamp-1 [&>span]:text-left', + className + )} + {...props} + > + {children} + + + + + ) +} + +function SelectContent({ + className, + children, + position = 'popper', + sideOffset = 4, + ...props +}: React.ComponentProps) { + return ( + + + + + + + {children} + + + + + + + ) +} + +function SelectLabel({ className, ...props }: React.ComponentProps) { + return ( + + ) +} + +function SelectItem({ + className, + children, + ...props +}: React.ComponentProps) { + return ( + + + + + + + {children} + + ) +} + +function SelectSeparator({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +export { + Select, + SelectGroup, + SelectValue, + SelectTrigger, + SelectContent, + SelectLabel, + SelectItem, + SelectSeparator, +} diff --git a/apps/superadmin-ui/src/components/ui/simple-select.tsx b/apps/superadmin-ui/src/components/ui/simple-select.tsx new file mode 100644 index 0000000..a0002db --- /dev/null +++ b/apps/superadmin-ui/src/components/ui/simple-select.tsx @@ -0,0 +1,61 @@ +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from '@/components/ui/select' +import { cn } from '@/lib/utils' + +export interface SimpleSelectOption { + value: string | number + label: string +} + +interface SimpleSelectProps { + /** Current value. `null`/`undefined`/`''` renders the placeholder. */ + value: string | number | null | undefined + onValueChange: (value: string) => void + options: SimpleSelectOption[] + placeholder?: string + disabled?: boolean + className?: string + contentClassName?: string + id?: string + 'aria-label'?: string +} + +/** + * Small wrapper over the shadcn Select primitives for the common + * `value` / `options` / `onValueChange` shape used across the app. + * Radix reserves the empty string for "no value", so it always emits strings + * and callers convert with `Number(...)` where needed. + */ +export function SimpleSelect({ + value, + onValueChange, + options, + placeholder, + disabled, + className, + contentClassName, + ...rest +}: SimpleSelectProps) { + const stringValue = + value === null || value === undefined || value === '' ? '' : String(value) + + return ( + + ) +} diff --git a/apps/superadmin-ui/src/lib/utils.ts b/apps/superadmin-ui/src/lib/utils.ts new file mode 100644 index 0000000..c0c238e --- /dev/null +++ b/apps/superadmin-ui/src/lib/utils.ts @@ -0,0 +1,7 @@ +import { clsx, type ClassValue } from 'clsx' +import { twMerge } from 'tailwind-merge' + +/** shadcn's `@/lib/utils` helper: unconditional class merge. */ +export function cn(...inputs: ClassValue[]) { + return twMerge(clsx(inputs)) +} diff --git a/apps/superadmin-ui/src/routes/__root.tsx b/apps/superadmin-ui/src/routes/__root.tsx index a54d36e..317b7d7 100644 --- a/apps/superadmin-ui/src/routes/__root.tsx +++ b/apps/superadmin-ui/src/routes/__root.tsx @@ -6,6 +6,7 @@ import { ReactQueryDevtools } from '@tanstack/react-query-devtools' import { trpc, getTrpcClient } from '../lib/trpc-client' import { getQueryClient } from '../lib/query-client' import { AuthProvider } from '../lib/auth-context' +import { DialogHost } from '../components/ui/dialog-host' import appCss from '../styles.css?url' const queryClient = getQueryClient() @@ -40,6 +41,8 @@ function RootDocument({ children }: { children: React.ReactNode }) {
{children}
+ {/* Imperative alert()/confirm()/prompt() dialogs (shadcn AlertDialog). */} +
diff --git a/apps/superadmin-ui/src/routes/constants.tsx b/apps/superadmin-ui/src/routes/constants.tsx index 8c71274..e6a779c 100644 --- a/apps/superadmin-ui/src/routes/constants.tsx +++ b/apps/superadmin-ui/src/routes/constants.tsx @@ -2,6 +2,7 @@ import { createFileRoute } from '@tanstack/react-router' import React, { useMemo } from 'react' import { Formik } from 'formik' import { AppContainer, Checkbox, MyButton, p as MyText, pInput as PInput } from 'web-components' +import { alert } from '@/components/ui/dialog-host' import { trpc } from '../lib/trpc-client' import { ProtectedRoute } from '../components/ProtectedRoute' import { AppShell } from '../components/AppShell' @@ -168,7 +169,7 @@ function CustomizeApp() { .map((key) => ({ key, value: values[key] })) if (changed.length === 0) { - window.alert('No Changes\n\nNo constants were modified.') + void alert('No Changes\n\nNo constants were modified.') return } @@ -176,11 +177,11 @@ function CustomizeApp() { { constants: changed }, { onSuccess: (response) => { - window.alert(`Success\n\nUpdated ${response.updatedCount} constants successfully.`) + void alert(`Success\n\nUpdated ${response.updatedCount} constants successfully.`) refetchGlobals() }, onError: (error) => { - window.alert('Error\n\nFailed to update constants. Please try again.') + void alert('Error\n\nFailed to update constants. Please try again.') console.error('Update global constants error:', error) }, } @@ -193,7 +194,7 @@ function CustomizeApp() { .map((key) => ({ key, value: values[key] })) if (changed.length === 0) { - window.alert('No Changes\n\nNo constants were modified.') + void alert('No Changes\n\nNo constants were modified.') return } @@ -201,11 +202,11 @@ function CustomizeApp() { { constants: changed }, { onSuccess: (response) => { - window.alert(`Success\n\nUpdated ${response.updatedCount} constants successfully.`) + void alert(`Success\n\nUpdated ${response.updatedCount} constants successfully.`) refetchLegacy() }, onError: (error) => { - window.alert('Error\n\nFailed to update constants. Please try again.') + void alert('Error\n\nFailed to update constants. Please try again.') console.error('Update legacy constants error:', error) }, } diff --git a/apps/superadmin-ui/src/routes/global-products.tsx b/apps/superadmin-ui/src/routes/global-products.tsx index 31418f9..d0b6c33 100644 --- a/apps/superadmin-ui/src/routes/global-products.tsx +++ b/apps/superadmin-ui/src/routes/global-products.tsx @@ -5,6 +5,8 @@ import { Plus, Trash2, X } from 'lucide-react' import { ProtectedRoute } from '../components/ProtectedRoute' import { AppShell } from '../components/AppShell' import { RegionTabs, type RegionTabKey } from '../components/RegionTabs' +import { SimpleSelect } from '@/components/ui/simple-select' +import { alert, confirm } from '@/components/ui/dialog-host' import { trpc } from '../lib/trpc-client' import { useUploadToObjectStorage } from '../hooks/useUploadToObjectStorage' @@ -140,7 +142,7 @@ function RegionProductsTab({ regionId }: { regionId: number }) { const doElevate = async (productId: number) => { if (storeChoice === '') { - window.alert('Choose a global store') + void alert('Choose a global store') return } try { @@ -150,7 +152,7 @@ function RegionProductsTab({ regionId }: { regionId: number }) { await utils.superadmin.products.list.invalidate() await utils.superadmin.globalProducts.list.invalidate() } catch (e: any) { - window.alert(e.message || 'Failed to elevate product') + void alert(e.message || 'Failed to elevate product') } } @@ -208,16 +210,13 @@ function RegionProductsTab({ regionId }: { regionId: number }) { {elevatingId === product.id && !isGlobal ? (
Attach to global store: - + onValueChange={(value) => setStoreChoice(value === '' ? '' : Number(value))} + placeholder="Select…" + className="w-auto" + options={stores.map((s: any) => ({ value: s.id, label: s.name }))} + /> doElevate(product.id)} disabled={elevate.isPending}> {elevate.isPending ? 'Elevating…' : 'Confirm'} @@ -258,7 +257,7 @@ function GlobalProductsTab() { const remove = trpc.superadmin.globalProducts.delete.useMutation({ onSuccess: async () => { await utils.superadmin.globalProducts.list.invalidate() }, - onError: (e) => window.alert(e.message), + onError: (e) => void alert(e.message), }) const refresh = () => utils.superadmin.globalProducts.list.invalidate() @@ -302,8 +301,8 @@ function GlobalProductsTab() { setEditingId(product.id)}>Edit
diff --git a/apps/superadmin-ui/src/routes/global-stores.tsx b/apps/superadmin-ui/src/routes/global-stores.tsx index f16c2f4..a4e9a7f 100644 --- a/apps/superadmin-ui/src/routes/global-stores.tsx +++ b/apps/superadmin-ui/src/routes/global-stores.tsx @@ -4,6 +4,7 @@ import { AppContainer, MyButton, p as MyText, pInput as PInput } from 'web-compo import { ProtectedRoute } from '../components/ProtectedRoute' import { AppShell } from '../components/AppShell' import { RegionTabs, type RegionTabKey } from '../components/RegionTabs' +import { alert, confirm } from '@/components/ui/dialog-host' import { trpc } from '../lib/trpc-client' export const Route = createFileRoute('/global-stores')({ @@ -45,7 +46,7 @@ function GlobalStoresTab() { const remove = trpc.superadmin.globalStores.delete.useMutation({ onSuccess: async () => { await utils.superadmin.globalStores.list.invalidate() }, - onError: (e) => window.alert(e.message), + onError: (e) => void alert(e.message), }) const refresh = () => utils.superadmin.globalStores.list.invalidate() @@ -81,8 +82,8 @@ function GlobalStoresTab() {
- + placeholder="Unassigned" + className="w-auto px-2 py-1.5" + options={regions.map((r) => ({ value: r.id, label: r.name }))} + /> void onRemove()} disabled={updatePending || removePending} diff --git a/apps/superadmin-ui/src/styles.css b/apps/superadmin-ui/src/styles.css index 193dafc..642a4ab 100644 --- a/apps/superadmin-ui/src/styles.css +++ b/apps/superadmin-ui/src/styles.css @@ -141,6 +141,21 @@ body { padding-bottom: 1rem; } +/* shadcn overlays (Select popover, AlertDialog) — opacity only, so Radix's + positioning transforms are never clobbered. */ +@keyframes fy-fade-in { + from { + opacity: 0; + } + to { + opacity: 1; + } +} + +.fy-anim-fade { + animation: fy-fade-in 140ms ease-out; +} + /* Respect reduced motion */ @media (prefers-reduced-motion: reduce) { *, *::before, *::after { diff --git a/apps/user-ui/components/ProductDetail.tsx b/apps/user-ui/components/ProductDetail.tsx index fc591bb..d28116f 100644 --- a/apps/user-ui/components/ProductDetail.tsx +++ b/apps/user-ui/components/ProductDetail.tsx @@ -52,7 +52,12 @@ const ProductDetail: React.FC = ({ productId, isFlashDeliver const [reviewsOffset, setReviewsOffset] = useState(0); const [refreshing, setRefreshing] = useState(false); const { regionId: activeRegionId } = useRegion(); - const { data: productDetail, isLoading, error, refetch } = trpc.user.product.getProductDetails.useQuery({ id: productId, regionId: activeRegionId ?? undefined }); + // The region is required (a global SKU has none of its own), so the query + // waits for it and the screen stays in its loading state until then. + const { data: productDetail, isLoading, error, refetch } = trpc.user.product.getProductDetails.useQuery( + { id: productId, regionId: activeRegionId ?? 0 }, + { enabled: activeRegionId != null } + ); const cartType: "regular" | "flash" = isFlashDelivery ? "flash" : "regular"; const { addToCart = () => {} } = useAddToCart({ showSuccessAlert: false, showErrorAlert: false, refetchCart: true }, cartType) || {}; const { addToCart:addTOFlashCart = () => {} } = useAddToCart({ showSuccessAlert: false, showErrorAlert: false, refetchCart: true }, 'flash') || {}; @@ -212,7 +217,7 @@ const ProductDetail: React.FC = ({ productId, isFlashDeliver } }, [productDetail?.name, setStoreHeaderTitle]); - if (isLoading) { + if (activeRegionId == null || isLoading) { return ( Loading product details... diff --git a/apps/user-ui/components/cart-page.tsx b/apps/user-ui/components/cart-page.tsx index ac415de..23e8e6d 100644 --- a/apps/user-ui/components/cart-page.tsx +++ b/apps/user-ui/components/cart-page.tsx @@ -209,11 +209,13 @@ export default function CartPage({ isFlashDelivery = false }: FlashDeliveryProps // Extract product IDs from cart items const productIds = cartData?.items.map(item => item.skuId) || []; -// Get cart slots for the products in cart +// Get cart slots for the products in cart. Slots are the browsing region's own +// (global SKUs ride along); the region is required and resolved per request, so +// a SKU from another region can never bring back that region's slots. const { data: slotsData, refetch: refetchSlots, isLoading: isSlotsLoading } = trpc.user.cart.getCartSlots.useQuery( - { productIds }, + { regionId: regionId ?? 0, productIds }, { - enabled: productIds.length > 0, + enabled: regionId != null && productIds.length > 0, refetchOnWindowFocus: false } ); diff --git a/apps/user-ui/components/checkout-page.tsx b/apps/user-ui/components/checkout-page.tsx index 6da5700..b7ffe69 100644 --- a/apps/user-ui/components/checkout-page.tsx +++ b/apps/user-ui/components/checkout-page.tsx @@ -42,7 +42,7 @@ const CheckoutPage: React.FC = ({ isFlashDelivery = false }) { enabled: isAuthenticated } ); const { data: slotsData, refetch: refetchSlots } = trpc.user.slots.getSlots.useQuery( - { regionId: regionId ?? undefined }, + { regionId: regionId ?? 0 }, { enabled: regionId != null } ); const constsData = useRegionalConsts(); diff --git a/apps/user-ui/src/components/AddToCartDialog.tsx b/apps/user-ui/src/components/AddToCartDialog.tsx index 7f5e2be..eaa8a5e 100644 --- a/apps/user-ui/src/components/AddToCartDialog.tsx +++ b/apps/user-ui/src/components/AddToCartDialog.tsx @@ -64,23 +64,6 @@ export default function AddToCartDialog() { const product = addedToCartProduct?.product; - // Pre-select cart's slotId and quantity if item is already in cart - useEffect(() => { - if (isOpen && product) { - const cartItem = cartData?.items?.find((item: any) => item.skuId === product.id); - const cartQuantity = cartItem?.quantity || 0; - - // Set quantity: 0 → 1, >1 → keep as is - setQuantity(cartQuantity === 0 ? 1 : cartQuantity); - - if (cartItem?.slotId) { - setSelectedSlotId(cartItem.slotId); - } else { - setSelectedSlotId(null); - } - } - }, [isOpen, cartData, product]); - const { slotMap, productSlotIdsMap } = useMemo(() => { const slotMap: Record = {}; const productSlotIdsMap: Record = {}; @@ -103,11 +86,34 @@ export default function AddToCartDialog() { const availableSlotIds = productSlotIdsMap[product?.id] || []; + // This region's slots for the product that are still open. const availableSlots = availableSlotIds .map((slotId) => slotMap[slotId]) .filter(Boolean) .filter((slot) => dayjs(slot.freezeTime).isAfter(dayjs())); + const hasRegionSlots = availableSlots.length > 0; + + // Pre-select cart's slotId and quantity if item is already in cart. The slot is + // kept only when it is one of THIS region's slots for the product, so a stale + // slot from another region can never carry over. + useEffect(() => { + if (isOpen && product) { + const cartItem = cartData?.items?.find((item: any) => item.skuId === product.id); + const cartQuantity = cartItem?.quantity || 0; + + // Set quantity: 0 → 1, >1 → keep as is + setQuantity(cartQuantity === 0 ? 1 : cartQuantity); + + const regionSlotIds = productSlotIdsMap[product.id] || []; + if (cartItem?.slotId && regionSlotIds.includes(cartItem.slotId)) { + setSelectedSlotId(cartItem.slotId); + } else { + setSelectedSlotId(null); + } + } + }, [isOpen, cartData, product, productSlotIdsMap]); + // Find cart item for this product const cartItem = cartData?.items?.find((item: any) => item.skuId === product?.id); @@ -130,7 +136,9 @@ export default function AddToCartDialog() { { onSuccess: () => clearAddedToCartProduct() } ); } else { - const slotId = selectedSlotId ?? availableSlotIds[0] ?? 0; + // Never add without a real slot from this region. + const slotId = selectedSlotId ?? availableSlots[0]?.id; + if (slotId == null) return; addToCart.mutate( { skuId: product.id, quantity, slotId }, { onSuccess: () => clearAddedToCartProduct() } @@ -138,6 +146,11 @@ export default function AddToCartDialog() { } }; + // Flash is the only option that needs no scheduled slot; otherwise a slot from + // this region must be selected. + const canConfirm = + selectedFlashDelivery || (hasRegionSlots && selectedSlotId != null); + if (!isOpen || !addedToCartProduct) return null; return ( @@ -186,6 +199,14 @@ export default function AddToCartDialog() { ))} + {!hasRegionSlots && !showFlashOption && ( + + + Not available in your region right now. + + + )} + {showFlashOption && ( {addToCart.isLoading || updateCartItem.isLoading ? (isUpdate ? 'Updating...' : 'Adding...') : (isUpdate ? 'Update Item' : 'Add to Cart')} diff --git a/apps/user-ui/tests/components/product-detail.test.tsx b/apps/user-ui/tests/components/product-detail.test.tsx index 4bef874..4fb02ac 100644 --- a/apps/user-ui/tests/components/product-detail.test.tsx +++ b/apps/user-ui/tests/components/product-detail.test.tsx @@ -70,6 +70,7 @@ describe('ProductDetail', () => { ) expect(lastProcedureInput(api.fetchMock, 'user.product.getProductDetails')).toEqual({ id: '2', + regionId: 1, }) }) diff --git a/apps/user-ui/tests/mocks/api.ts b/apps/user-ui/tests/mocks/api.ts index d166977..cf45c59 100644 --- a/apps/user-ui/tests/mocks/api.ts +++ b/apps/user-ui/tests/mocks/api.ts @@ -189,17 +189,18 @@ export const ESSENTIAL_CONSTS_URL = // Derived by useCacheUrl / useAvailabilityCacheUrl / useSlotsCacheUrl from the // essentialConsts payload above (assetsDomain, apiCacheKey, cacheVersion, -// availabilityVersionNum, slotsVersionNum). +// availabilityVersionNum, slotsVersionNum). Cache files are region-owned, so +// each URL carries the browsing region (1 = Mahabubnagar in these fixtures). export const PRODUCTS_URL = - 'https://assets.freshyo.in/api-cache/v-755/products.json' + 'https://assets.freshyo.in/api-cache/regions/1/v-755/products.json' export const AVAILABILITY_URL = - 'https://assets.freshyo.in/av-72/availability.json' -export const STORES_URL = 'https://assets.freshyo.in/api-cache/v-755/stores.json' -export const SLOTS_URL = 'https://assets.freshyo.in/slots/v-401/slots.json?v=123' + 'https://assets.freshyo.in/regions/1/av-72/availability.json' +export const STORES_URL = 'https://assets.freshyo.in/api-cache/regions/1/v-755/stores.json' +export const SLOTS_URL = 'https://assets.freshyo.in/regions/1/slots/v-401/slots.json?v=123' /** useStoreWithProducts URL for a given store id. */ export const storeDetailUrl = (storeId: number | string) => - `https://assets.freshyo.in/api-cache/v-755/stores/${storeId}.json` + `https://assets.freshyo.in/api-cache/regions/1/v-755/stores/${storeId}.json` const jsonResponse = (body: unknown) => ({ ok: true, diff --git a/apps/user-ui/tests/screens/cart-screen.test.tsx b/apps/user-ui/tests/screens/cart-screen.test.tsx index 11a7836..9670244 100644 --- a/apps/user-ui/tests/screens/cart-screen.test.tsx +++ b/apps/user-ui/tests/screens/cart-screen.test.tsx @@ -88,6 +88,7 @@ describe('Cart screen', () => { await waitFor(() => { const calls = expectProcedureCalled(api.fetchMock, 'user.cart.getCartSlots') expect(lastProcedureInput(api.fetchMock, 'user.cart.getCartSlots')).toEqual({ + regionId: 1, productIds: [PRODUCT_ID], }) expect(calls.length).toBeGreaterThan(0) diff --git a/apps/web-ui/src/components/AddToCartDialog.tsx b/apps/web-ui/src/components/AddToCartDialog.tsx index 6e2c223..83c08a3 100644 --- a/apps/web-ui/src/components/AddToCartDialog.tsx +++ b/apps/web-ui/src/components/AddToCartDialog.tsx @@ -40,15 +40,6 @@ export default function AddToCartDialog() { const isOpen = !!addedToCartProduct const product = addedToCartProduct?.product - useEffect(() => { - if (isOpen && product) { - const cartItem = cartData?.items?.find((item: any) => item.skuId === product.id) - const cartQuantity = cartItem?.quantity || 0 - setQuantity(cartQuantity === 0 ? 1 : cartQuantity) - setSelectedSlotId(cartItem?.slotId || null) - } - }, [isOpen, cartData, product]) - const { slotMap, productSlotIdsMap } = useMemo(() => { const slotMap: Record = {} const productSlotIdsMap: Record = {} @@ -70,17 +61,39 @@ export default function AddToCartDialog() { const availableSlotIds = productSlotIdsMap[product?.id] || [] + // This region's slots for the product that are still open. const availableSlots = availableSlotIds .map((slotId) => slotMap[slotId]) .filter(Boolean) .filter((slot) => dayjs(slot.deliveryTime).isAfter(dayjs())) + const hasRegionSlots = availableSlots.length > 0 + + // Pre-select the cart's slot/quantity. The slot is kept only when it is one of + // THIS region's slots for the product (a foreign-region slot is dropped). + useEffect(() => { + if (isOpen && product) { + const cartItem = cartData?.items?.find((item: any) => item.skuId === product.id) + const cartQuantity = cartItem?.quantity || 0 + setQuantity(cartQuantity === 0 ? 1 : cartQuantity) + + const regionSlotIds = productSlotIdsMap[product.id] || [] + setSelectedSlotId( + cartItem?.slotId && regionSlotIds.includes(cartItem.slotId) ? cartItem.slotId : null + ) + } + }, [isOpen, cartData, product, productSlotIdsMap]) + const cartItem = cartData?.items?.find((item: any) => item.skuId === product?.id) const isUpdate = (cartItem?.quantity || 0) >= 1 const productAvailability = productSlotsMap[product?.id] const showFlashOption = productAvailability?.isFlashAvailable === true && isFlashDeliveryEnabled + // Flash needs no scheduled slot; otherwise a slot from this region is required. + const canConfirm = + selectedFlashDelivery || (hasRegionSlots && selectedSlotId != null) + const handleAddToCart = () => { if (selectedFlashDelivery) { navigate({ to: '/flash' }) @@ -93,7 +106,9 @@ export default function AddToCartDialog() { { onSuccess: () => clearAddedToCartProduct() } ) } else { - const slotId = selectedSlotId ?? availableSlotIds[0] ?? 0 + // Never add without a real slot from this region. + const slotId = selectedSlotId ?? availableSlots[0]?.id + if (slotId == null) return addToCart.mutate( { skuId: product.id, @@ -168,6 +183,14 @@ export default function AddToCartDialog() { ))}
+ {!hasRegionSlots && !showFlashOption && ( +
+

+ Not available in your region right now. +

+
+ )} + {showFlashOption && (
{ @@ -216,9 +239,9 @@ export default function AddToCartDialog() {