This commit is contained in:
shafi54 2026-10-14 17:27:52 +05:30
parent 8b52508a6a
commit 11339916d2
61 changed files with 1454 additions and 27122 deletions

View file

@ -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<VendorSnippetFormProps> = ({
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();

View file

@ -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<VendorSnippetFormProps> = ({
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()

View file

@ -260,7 +260,6 @@ export {
getSuspendedSkuIds,
getNextDeliveryDateWithCapacity,
getSkuRegionId,
getSkuRegionIds,
getStoresSummary,
healthCheck,
// Delete orders helper

View file

@ -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<number, number[]>()
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<number, { id: number; deliveryTime: Date; freezeTime: Date; isCapacityFull: boolean }[]> = {}
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);
}),
});

View file

@ -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<UserProductDetail> => {
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')

View file

@ -38,16 +38,13 @@ export async function scaffoldSlotsWithProducts(regionId: number): Promise<UserS
export const slotsRouter = router({
getSlots: publicProcedure
.input(z.object({
// The caller's selected region. Admin tools omit it and fall back to the
// staff user's own region; without either, no slots are returned.
regionId: z.number().int().positive().optional(),
}).optional())
.query(async ({ input, ctx }): Promise<UserSlotsListResponse> => {
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<UserSlotsListResponse> => {
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

View file

@ -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)
})
})

View file

@ -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<string, unknown>

View file

@ -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)
})

View file

@ -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()

View file

@ -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-<slotsVersionNum>/slots.json
* availability ${assetsDomain}av-<availabilityVersionNum>/availability.json
* products ${assetsDomain}${apiCacheKey}/v-<cacheVersion>/products.json
* store detail ${assetsDomain}${apiCacheKey}/v-<cacheVersion>/stores/<id>.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-<slotsVersionNum>/slots.json
* availability ${assetsDomain}regions/${regionId}/av-<availabilityVersionNum>/availability.json
* products ${assetsDomain}${apiCacheKey}/regions/${regionId}/v-<cacheVersion>/products.json
* store detail ${assetsDomain}${apiCacheKey}/regions/${regionId}/v-<cacheVersion>/stores/<id>.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<EssentialConsts> {
return consts
}
// Cache files are region-owned: `regions/<id>/...` 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<T = unknown>(url: string): Promise<T> {

View file

@ -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
)

View file

@ -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=="],

View file

@ -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"
}
}

View file

@ -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"

View file

@ -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<typeof AlertDialogPrimitive.Root>) {
return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />
}
function AlertDialogTrigger(
props: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>
) {
return <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
}
function AlertDialogPortal(props: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
return <AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
}
function AlertDialogOverlay({
className,
...props
}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
return (
<AlertDialogPrimitive.Overlay
data-slot="alert-dialog-overlay"
className={cn('fy-anim-fade fixed inset-0 z-[80] bg-black/40', className)}
{...props}
/>
)
}
function AlertDialogContent({
className,
...props
}: React.ComponentProps<typeof AlertDialogPrimitive.Content>) {
return (
<AlertDialogPortal>
<AlertDialogOverlay />
<AlertDialogPrimitive.Content
data-slot="alert-dialog-content"
className={cn(
'fixed left-1/2 top-1/2 z-[80] grid w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl border border-gray-200 bg-white p-6 shadow-lg',
className
)}
{...props}
/>
</AlertDialogPortal>
)
}
function AlertDialogHeader({ className, ...props }: React.ComponentProps<'div'>) {
return (
<div
data-slot="alert-dialog-header"
className={cn('flex flex-col gap-1.5', className)}
{...props}
/>
)
}
function AlertDialogFooter({ className, ...props }: React.ComponentProps<'div'>) {
return (
<div
data-slot="alert-dialog-footer"
className={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className)}
{...props}
/>
)
}
function AlertDialogTitle({
className,
...props
}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
return (
<AlertDialogPrimitive.Title
data-slot="alert-dialog-title"
className={cn('text-base font-semibold text-gray-900', className)}
{...props}
/>
)
}
function AlertDialogDescription({
className,
...props
}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
return (
<AlertDialogPrimitive.Description
data-slot="alert-dialog-description"
className={cn('whitespace-pre-line text-sm text-gray-600', className)}
{...props}
/>
)
}
function AlertDialogAction({
className,
...props
}: React.ComponentProps<typeof AlertDialogPrimitive.Action>) {
return (
<AlertDialogPrimitive.Action
data-slot="alert-dialog-action"
className={cn(
'inline-flex items-center justify-center rounded-lg bg-brand-500 px-4 py-2 text-sm font-medium text-white transition-colors',
'hover:bg-brand-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500 focus-visible:ring-offset-2',
'disabled:pointer-events-none disabled:opacity-50',
className
)}
{...props}
/>
)
}
function AlertDialogCancel({
className,
...props
}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) {
return (
<AlertDialogPrimitive.Cancel
data-slot="alert-dialog-cancel"
className={cn(
'inline-flex items-center justify-center rounded-lg border border-gray-200 bg-white px-4 py-2 text-sm font-medium text-gray-700 transition-colors',
'hover:bg-gray-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500 focus-visible:ring-offset-2',
'disabled:pointer-events-none disabled:opacity-50',
className
)}
{...props}
/>
)
}
export {
AlertDialog,
AlertDialogTrigger,
AlertDialogPortal,
AlertDialogOverlay,
AlertDialogContent,
AlertDialogHeader,
AlertDialogFooter,
AlertDialogTitle,
AlertDialogDescription,
AlertDialogAction,
AlertDialogCancel,
}

View file

@ -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<unknown> {
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] <DialogHost /> 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<DialogOptions, 'defaultValue' | 'placeholder'>
): Promise<void> {
return enqueue('alert', message, options ?? {}) as Promise<void>
}
/** Drop-in replacement for `window.confirm`; must be awaited. */
export function confirm(
message: string,
options?: Omit<DialogOptions, 'defaultValue' | 'placeholder'>
): Promise<boolean> {
return enqueue('confirm', message, options ?? {}) as Promise<boolean>
}
/** Drop-in replacement for `window.prompt`; must be awaited. */
export function prompt(message: string, options?: DialogOptions): Promise<string | null> {
return enqueue('prompt', message, options ?? {}) as Promise<string | null>
}
const CANCEL_VALUE: Record<DialogKind, unknown> = {
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 <body>, 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 (
<AlertDialog
open
onOpenChange={(open) => {
if (!open) settle(request.id, CANCEL_VALUE[request.kind])
}}
>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>{heading}</AlertDialogTitle>
<AlertDialogDescription>{body || '\u00A0'}</AlertDialogDescription>
</AlertDialogHeader>
{request.kind === 'prompt' ? (
<input
autoFocus
value={input}
onChange={(event) => 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}
<AlertDialogFooter>
{request.kind !== 'alert' ? (
<AlertDialogCancel
onClick={() => settle(request.id, CANCEL_VALUE[request.kind])}
>
{cancelLabel}
</AlertDialogCancel>
) : null}
<AlertDialogAction
onClick={() => {
if (busy) return
setBusy(true)
settle(request.id, confirmValue)
}}
className={cn(request.options.destructive && 'bg-red-500 hover:bg-red-600')}
>
{confirmLabel}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
)
}

View file

@ -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<typeof SelectPrimitive.Root>) {
return <SelectPrimitive.Root data-slot="select" {...props} />
}
function SelectGroup(props: React.ComponentProps<typeof SelectPrimitive.Group>) {
return <SelectPrimitive.Group data-slot="select-group" {...props} />
}
function SelectValue(props: React.ComponentProps<typeof SelectPrimitive.Value>) {
return <SelectPrimitive.Value data-slot="select-value" {...props} />
}
function SelectTrigger({
className,
children,
...props
}: React.ComponentProps<typeof SelectPrimitive.Trigger>) {
return (
<SelectPrimitive.Trigger
data-slot="select-trigger"
className={cn(
'flex w-full items-center justify-between gap-2 rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900',
'data-[placeholder]:text-gray-400',
'focus:border-brand-500 focus:outline-none focus:ring-1 focus:ring-brand-500',
'disabled:cursor-not-allowed disabled:opacity-50',
'[&>span]:line-clamp-1 [&>span]:text-left',
className
)}
{...props}
>
{children}
<SelectPrimitive.Icon asChild>
<ChevronDown className="h-4 w-4 shrink-0 text-gray-400" />
</SelectPrimitive.Icon>
</SelectPrimitive.Trigger>
)
}
function SelectContent({
className,
children,
position = 'popper',
sideOffset = 4,
...props
}: React.ComponentProps<typeof SelectPrimitive.Content>) {
return (
<SelectPrimitive.Portal>
<SelectPrimitive.Content
data-slot="select-content"
position={position}
sideOffset={sideOffset}
className={cn(
'fy-anim-fade relative z-[70] max-h-96 min-w-[8rem] overflow-hidden rounded-lg border border-gray-200 bg-white text-gray-900 shadow-lg',
className
)}
{...props}
>
<SelectPrimitive.ScrollUpButton className="flex cursor-default items-center justify-center py-1">
<ChevronUp className="h-4 w-4" />
</SelectPrimitive.ScrollUpButton>
<SelectPrimitive.Viewport
className={cn(
'p-1',
position === 'popper' && 'w-full min-w-[var(--radix-select-trigger-width)]'
)}
>
{children}
</SelectPrimitive.Viewport>
<SelectPrimitive.ScrollDownButton className="flex cursor-default items-center justify-center py-1">
<ChevronDown className="h-4 w-4" />
</SelectPrimitive.ScrollDownButton>
</SelectPrimitive.Content>
</SelectPrimitive.Portal>
)
}
function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {
return (
<SelectPrimitive.Label
data-slot="select-label"
className={cn('px-2 py-1.5 text-xs font-medium text-gray-500', className)}
{...props}
/>
)
}
function SelectItem({
className,
children,
...props
}: React.ComponentProps<typeof SelectPrimitive.Item>) {
return (
<SelectPrimitive.Item
data-slot="select-item"
className={cn(
'relative flex w-full cursor-default select-none items-center rounded-md py-2 pl-8 pr-2 text-sm outline-none',
'focus:bg-gray-100',
'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
className
)}
{...props}
>
<span className="absolute left-2 flex h-4 w-4 items-center justify-center">
<SelectPrimitive.ItemIndicator>
<Check className="h-4 w-4 text-brand-600" />
</SelectPrimitive.ItemIndicator>
</span>
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
</SelectPrimitive.Item>
)
}
function SelectSeparator({
className,
...props
}: React.ComponentProps<typeof SelectPrimitive.Separator>) {
return (
<SelectPrimitive.Separator
data-slot="select-separator"
className={cn('-mx-1 my-1 h-px bg-gray-100', className)}
{...props}
/>
)
}
export {
Select,
SelectGroup,
SelectValue,
SelectTrigger,
SelectContent,
SelectLabel,
SelectItem,
SelectSeparator,
}

View file

@ -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 (
<Select value={stringValue} onValueChange={onValueChange} disabled={disabled}>
<SelectTrigger className={cn('w-full', className)} {...rest}>
<SelectValue placeholder={placeholder} />
</SelectTrigger>
<SelectContent className={contentClassName}>
{options.map((option) => (
<SelectItem key={String(option.value)} value={String(option.value)}>
{option.label}
</SelectItem>
))}
</SelectContent>
</Select>
)
}

View file

@ -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))
}

View file

@ -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 }) {
<trpc.Provider client={trpcClient} queryClient={queryClient}>
<AuthProvider>
<div id="app">{children}</div>
{/* Imperative alert()/confirm()/prompt() dialogs (shadcn AlertDialog). */}
<DialogHost />
<ReactQueryDevtools />
</AuthProvider>
</trpc.Provider>

View file

@ -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)
},
}

View file

@ -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 ? (
<div className="mt-3 flex flex-wrap items-center gap-2 border-t border-gray-100 pt-3">
<MyText className="text-sm text-gray-500">Attach to global store:</MyText>
<select
<SimpleSelect
value={storeChoice}
onChange={(e) => setStoreChoice(e.target.value === '' ? '' : Number(e.target.value))}
className="rounded-lg border border-gray-200 px-3 py-2 text-gray-900"
>
<option value="">Select…</option>
{stores.map((s: any) => (
<option key={s.id} value={s.id}>{s.name}</option>
))}
</select>
onValueChange={(value) => setStoreChoice(value === '' ? '' : Number(value))}
placeholder="Select…"
className="w-auto"
options={stores.map((s: any) => ({ value: s.id, label: s.name }))}
/>
<MyButton onClick={() => doElevate(product.id)} disabled={elevate.isPending}>
{elevate.isPending ? 'Elevating…' : 'Confirm'}
</MyButton>
@ -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() {
<MyButton onClick={() => setEditingId(product.id)}>Edit</MyButton>
<button
type="button"
onClick={() => {
if (window.confirm(`Delete global product "${product.name}"?`)) remove.mutate({ id: product.id })
onClick={async () => {
if (await confirm(`Delete global product "${product.name}"?`)) remove.mutate({ id: product.id })
}}
className="rounded-lg bg-red-500 p-2 text-white"
aria-label="Delete product"
@ -471,29 +470,25 @@ function GlobalProductForm({
<PInput topLabel="Name" value={name} onChange={(e) => setName(e.target.value)} placeholder="e.g. Fresh Chicken" />
<label className="block">
<span className="mb-1 block text-sm font-medium text-gray-500">Global store</span>
<select
value={storeId ?? ''}
onChange={(e) => setStoreId(e.target.value ? Number(e.target.value) : null)}
className="w-full rounded-lg border border-gray-200 px-3 py-2 text-gray-900"
>
<option value="">Select a global store…</option>
{stores.map((store: any) => (
<option key={store.id} value={store.id}>{store.name}</option>
))}
</select>
<SimpleSelect
value={storeId}
onValueChange={(value) => setStoreId(value ? Number(value) : null)}
placeholder="Select a global store…"
options={stores.map((store: any) => ({ value: store.id, label: store.name }))}
/>
</label>
<PInput topLabel="Short description" value={shortDescription} onChange={(e) => setShortDescription(e.target.value)} />
<PInput topLabel="Long description" value={longDescription} onChange={(e) => setLongDescription(e.target.value)} />
<label className="block">
<span className="mb-1 block text-sm font-medium text-gray-500">Type</span>
<select
<SimpleSelect
value={productType}
onChange={(e) => setProductType(e.target.value as 'item' | 'combo')}
className="w-full rounded-lg border border-gray-200 px-3 py-2 text-gray-900"
>
<option value="item">Item</option>
<option value="combo">Combo</option>
</select>
onValueChange={(value) => setProductType(value as 'item' | 'combo')}
options={[
{ value: 'item', label: 'Item' },
{ value: 'combo', label: 'Combo' },
]}
/>
</label>
</div>

View file

@ -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() {
</MyButton>
<button
type="button"
onClick={() => {
if (window.confirm(`Delete global store "${store.name}"?`)) remove.mutate({ id: store.id })
onClick={async () => {
if (await confirm(`Delete global store "${store.name}"?`)) remove.mutate({ id: store.id })
}}
className="rounded-lg bg-red-500 px-4 py-2 text-sm font-semibold text-white"
>
@ -114,20 +115,17 @@ function RegionStoresTab({ regionId }: { regionId: number }) {
await utils.superadmin.stores.list.invalidate()
await utils.superadmin.globalStores.list.invalidate()
},
onError: (e) => window.alert(e.message),
onError: (e) => void alert(e.message),
})
const stores = (listQuery.data ?? []) as any[]
const elevatingId = elevate.isPending ? elevate.variables?.storeId ?? null : null
const doElevate = (store: any) => {
if (
!window.confirm(
`Elevate store "${store.name}" to global? It becomes available in every region. Its products stay in their own region.`
)
) {
return
}
const doElevate = async (store: any) => {
const ok = await confirm(
`Elevate store "${store.name}" to global? It becomes available in every region. Its products stay in their own region.`
)
if (!ok) return
elevate.mutate({ storeId: store.id })
}
@ -155,7 +153,7 @@ function RegionStoresTab({ regionId }: { regionId: number }) {
<MyText className="block text-sm text-gray-500">{store.description || 'No description'}</MyText>
<div className="mt-3">
<MyButton onClick={() => doElevate(store)} disabled={elevate.isPending}>
<MyButton onClick={() => void doElevate(store)} disabled={elevate.isPending}>
{elevatingId === store.id ? 'Elevating…' : 'Elevate to global'}
</MyButton>
</div>
@ -189,7 +187,7 @@ function GlobalStoreForm({ store, onSaved }: { store?: any; onSaved: () => void
}
onSaved()
} catch (e: any) {
window.alert(e.message || 'Failed to save store')
void alert(e.message || 'Failed to save store')
}
}

View file

@ -3,6 +3,7 @@ import { useState } from 'react'
import { AppContainer, MyButton, p as MyText, pInput as PInput } from 'web-components'
import { ProtectedRoute } from '../components/ProtectedRoute'
import { AppShell } from '../components/AppShell'
import { confirm } from '@/components/ui/dialog-host'
import { trpc } from '../lib/trpc-client'
import { LAST_BOUND_HINT, canDeleteBound } from '../lib/bound-rules'
@ -512,9 +513,9 @@ function BoundSettingsEditor({
})
}
const handleDelete = () => {
const handleDelete = async () => {
if (!canDelete) return
if (!window.confirm(`Delete bound #${boundId} and its settings?`)) return
if (!(await confirm(`Delete bound #${boundId} and its settings?`))) return
deleteBound.mutate({ id: boundId })
}
@ -540,7 +541,7 @@ function BoundSettingsEditor({
<div className="mt-3 flex items-center gap-3">
<MyButton
onClick={handleDelete}
onClick={() => void handleDelete()}
disabled={!canDelete || deleteBound.isPending}
title={canDelete ? `Delete bound #${boundId}` : LAST_BOUND_HINT}
className="rounded-lg border border-red-200 px-4 py-2 text-red-700 disabled:cursor-not-allowed disabled:opacity-50"

View file

@ -2,6 +2,7 @@ import { createFileRoute } from '@tanstack/react-router'
import React, { useState } from 'react'
import { AppContainer, MyButton, p as MyText, pInput as PInput } from 'web-components'
import { Send } from 'lucide-react'
import { alert } from '@/components/ui/dialog-host'
import { trpc } from '../lib/trpc-client'
import { ProtectedRoute } from '../components/ProtectedRoute'
import { AppShell } from '../components/AppShell'
@ -23,20 +24,20 @@ function SendAdminNotifications() {
const { mutate, isPending } = trpc.admin.staffUser.sendAdminNotification.useMutation({
onSuccess: (response) => {
window.alert(`Success\n\n${response.message}`)
void alert(`Success\n\n${response.message}`)
setTitle('')
setText('')
setImageUrl('')
},
onError: (error) => {
window.alert(`Error\n\n${error.message || 'Failed to send notification'}`)
void alert(`Error\n\n${error.message || 'Failed to send notification'}`)
},
})
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault()
if (!title.trim() || !text.trim()) {
window.alert('Title and message are required')
void alert('Title and message are required')
return
}
mutate({

View file

@ -4,6 +4,8 @@ import { AppContainer, MyButton, p as MyText, pInput as PInput } from 'web-compo
import { Trash2 } from 'lucide-react'
import { ProtectedRoute } from '../components/ProtectedRoute'
import { AppShell } from '../components/AppShell'
import { SimpleSelect } from '@/components/ui/simple-select'
import { confirm } from '@/components/ui/dialog-host'
import { trpc } from '../lib/trpc-client'
export const Route = createFileRoute('/staff')({
@ -93,29 +95,21 @@ function StaffPage() {
/>
<div>
<MyText className="mb-1 block text-sm font-medium text-gray-700">Role</MyText>
<select
value={roleId ?? ''}
onChange={(e) => setRoleId(e.target.value ? Number(e.target.value) : null)}
className="w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm"
>
<option value="">Select role</option>
{roles.map((r) => (
<option key={r.id} value={r.id}>{r.name}</option>
))}
</select>
<SimpleSelect
value={roleId}
onValueChange={(value) => setRoleId(value ? Number(value) : null)}
placeholder="Select role"
options={roles.map((r) => ({ value: r.id, label: r.name }))}
/>
</div>
<div>
<MyText className="mb-1 block text-sm font-medium text-gray-700">Region</MyText>
<select
value={regionId ?? ''}
onChange={(e) => setRegionId(e.target.value ? Number(e.target.value) : null)}
className="w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm"
>
<option value="">Select region</option>
{regions.map((r) => (
<option key={r.id} value={r.id}>{r.name}</option>
))}
</select>
<SimpleSelect
value={regionId}
onValueChange={(value) => setRegionId(value ? Number(value) : null)}
placeholder="Select region"
options={regions.map((r) => ({ value: r.id, label: r.name }))}
/>
</div>
</div>
{error && <MyText className="mt-2 block text-sm text-red-600">{error}</MyText>}
@ -153,7 +147,7 @@ function StaffPage() {
}
}}
onRemove={async () => {
if (!window.confirm(`Remove admin "${user.name}"? This cannot be undone.`)) return
if (!(await confirm(`Remove admin "${user.name}"? This cannot be undone.`))) return
setError(null)
try {
await removeUser.mutateAsync({ id: user.id })
@ -192,18 +186,15 @@ function StaffRow({ user, regions, regionNameById, updatePending, removePending,
</MyText>
</div>
<div className="flex items-center gap-2">
<select
value={user.regionId ?? ''}
onChange={(e) => {
if (e.target.value) void onReassign(Number(e.target.value))
<SimpleSelect
value={user.regionId}
onValueChange={(value) => {
if (value) void onReassign(Number(value))
}}
className="rounded-lg border border-gray-300 bg-white px-2 py-1.5 text-sm"
>
<option value="">Unassigned</option>
{regions.map((r) => (
<option key={r.id} value={r.id}>{r.name}</option>
))}
</select>
placeholder="Unassigned"
className="w-auto px-2 py-1.5"
options={regions.map((r) => ({ value: r.id, label: r.name }))}
/>
<MyButton
onClick={() => void onRemove()}
disabled={updatePending || removePending}

View file

@ -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 {

View file

@ -52,7 +52,12 @@ const ProductDetail: React.FC<ProductDetailProps> = ({ 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<ProductDetailProps> = ({ productId, isFlashDeliver
}
}, [productDetail?.name, setStoreHeaderTitle]);
if (isLoading) {
if (activeRegionId == null || isLoading) {
return (
<View style={tw`flex-1 justify-center items-center bg-gray-50`}>
<MyText style={tw`text-gray-500 font-medium`}>Loading product details...</MyText>

View file

@ -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
}
);

View file

@ -42,7 +42,7 @@ const CheckoutPage: React.FC<FlashDeliveryProps> = ({ 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();

View file

@ -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<number, any> = {};
const productSlotIdsMap: Record<number, number[]> = {};
@ -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() {
))}
</ScrollView>
{!hasRegionSlots && !showFlashOption && (
<View style={tw`bg-red-50 p-4 rounded-xl border border-red-100`}>
<MyText style={tw`text-sm text-red-700 font-medium`}>
Not available in your region right now.
</MyText>
</View>
)}
{showFlashOption && (
<MyTouchableOpacity
key="flash-delivery"
@ -244,9 +265,9 @@ export default function AddToCartDialog() {
<View style={tw`flex-row gap-3 mt-4 pb-12`}>
<MyTouchableOpacity
testID="add-to-cart-confirm"
style={tw`flex-1 bg-brand500 py-3.5 rounded-xl items-center ${(!selectedSlotId && !selectedFlashDelivery) ? 'opacity-50' : ''}`}
style={tw`flex-1 bg-brand500 py-3.5 rounded-xl items-center ${!canConfirm ? 'opacity-50' : ''}`}
onPress={handleAddToCart}
disabled={(addToCart.isLoading || updateCartItem.isLoading) || (!selectedSlotId && !selectedFlashDelivery)}
disabled={(addToCart.isLoading || updateCartItem.isLoading) || !canConfirm}
>
<MyText style={tw`text-white font-bold`}>
{addToCart.isLoading || updateCartItem.isLoading ? (isUpdate ? 'Updating...' : 'Adding...') : (isUpdate ? 'Update Item' : 'Add to Cart')}

View file

@ -70,6 +70,7 @@ describe('ProductDetail', () => {
)
expect(lastProcedureInput(api.fetchMock, 'user.product.getProductDetails')).toEqual({
id: '2',
regionId: 1,
})
})

View file

@ -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,

View file

@ -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)

View file

@ -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<number, any> = {}
const productSlotIdsMap: Record<number, number[]> = {}
@ -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() {
))}
</div>
{!hasRegionSlots && !showFlashOption && (
<div className="mb-4 rounded-xl border border-red-100 bg-red-50 p-4">
<p className="text-sm font-medium text-red-700">
Not available in your region right now.
</p>
</div>
)}
{showFlashOption && (
<div
onClick={() => {
@ -216,9 +239,9 @@ export default function AddToCartDialog() {
<div className="flex gap-3 pb-4">
<button
onClick={handleAddToCart}
disabled={(!selectedSlotId && !selectedFlashDelivery) || addToCart.isPending || updateItem.isPending}
disabled={!canConfirm || addToCart.isPending || updateItem.isPending}
className={`flex flex-1 items-center justify-center gap-2 rounded-xl py-3 font-bold text-white transition-colors ${
(!selectedSlotId && !selectedFlashDelivery) || addToCart.isPending || updateItem.isPending
!canConfirm || addToCart.isPending || updateItem.isPending
? 'bg-brand-500/50'
: 'bg-brand-500 hover:bg-brand-600'
}`}

View file

@ -7,6 +7,7 @@ import { trpc } from '../lib/trpc-client'
import { useAddToCart, useGetCart, useUpdateCartItem, useRemoveFromCart } from '../hooks/cart-query-hooks'
import { useSlots } from '../hooks/prominent-api-hooks'
import { useCartStore } from '../lib/stores/cart-store'
import { useRegionStore } from '../lib/stores/region-store'
import { useProductSlotIdentifier } from '../hooks/useProductSlotIdentifier'
import dayjs from 'dayjs'
import { ChevronLeft, Star, Zap, Truck, Store, Package, Plus, Clock, AlertCircle } from 'lucide-react'
@ -26,9 +27,10 @@ function ProductDetailPage() {
const [showAllSlots, setShowAllSlots] = useState(false)
const [currentImageIndex, setCurrentImageIndex] = useState(0)
const selectedRegionId = useRegionStore((s) => s.selectedRegionId)
const { data: productDetail, isLoading, error, refetch } = trpc.user.product.getProductDetails.useQuery(
{ id: String(productId) },
{ enabled: !!productId }
{ id: String(productId), regionId: selectedRegionId ?? 0 },
{ enabled: !!productId && selectedRegionId != null }
)
const { data: slotsData } = useSlots()
const { data: cartData } = useGetCart('regular')
@ -135,7 +137,7 @@ function ProductDetailPage() {
setShowAllSlots(false)
}
if (isLoading) {
if (selectedRegionId == null || isLoading) {
return (
<AppLayout>
<div className="flex min-h-screen items-center justify-center">

View file

@ -4165,3 +4165,111 @@ user-ui
authenticated the flow returns to the choose view and the saved addresses load
+ dropped the now-unused router/pathname/redirect-state imports
No dependency added. No migration. No tests run.
2026-10-14 16:01:36 superadmin-ui: replace native <select>/alert/confirm with shadcn (Radix) components.
Problem: the native <select> popups and window.confirm()/window.alert() dialogs are
browser/OS-native, so they cannot be driven by Maestro (native select options render at
[100000,*]; window.confirm blocks inspect_screen).
Dependency:
- apps/superadmin-ui/package.json + bun.lock: add @radix-ui/react-select ^2.4.1 and
@radix-ui/react-alert-dialog ^1.2.1 (ran 'bun install' + 'bun add' inside the app, which
had no node_modules).
New files (apps/superadmin-ui):
- components.json: shadcn CLI config (tailwind v4 -> src/styles.css, aliases @/components,
@/lib/utils, @/components/ui).
- src/lib/utils.ts: cn() (clsx + tailwind-merge), shadcn's @/lib/utils target.
- src/components/ui/select.tsx: shadcn Select primitives on @radix-ui/react-select
(Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem,
SelectSeparator, SelectScrollUpButton, SelectScrollDownButton) styled with the app's
gray/brand palette.
- src/components/ui/simple-select.tsx: SimpleSelect - thin wrapper (value/onValueChange/
options/placeholder/disabled/className) so route call sites stay small; maps null/'' to
the Radix placeholder and always emits string values.
- src/components/ui/alert-dialog.tsx: shadcn AlertDialog primitives on
@radix-ui/react-alert-dialog.
- src/components/ui/dialog-host.tsx: imperative, promise-based alert()/confirm() (and
prompt()) backed by the AlertDialog + a single <DialogHost /> mounted in the app shell;
alert() splits "Title\n\nbody" into title/description; requests are queued.
- src/styles.css: keyframes + .fy-anim-* classes for the Radix data-state enter animations.
Edited files (apps/superadmin-ui):
- src/routes/__root.tsx: mount <DialogHost /> inside AuthProvider (portals add no layout).
- src/routes/staff.tsx: 3 native <select> -> SimpleSelect (role, region, per-row region);
window.confirm -> await confirm().
- src/routes/global-products.tsx: 3 <select> (elevate target store, global store, type) ->
SimpleSelect; 3 window.alert -> alert(); 1 window.confirm -> await confirm().
- src/routes/global-stores.tsx: 3 window.alert -> alert(); 2 window.confirm -> await
confirm() (doElevate becomes async).
- src/routes/constants.tsx: 6 window.alert -> alert().
- src/routes/send-notifications.tsx: 3 window.alert -> alert().
- src/routes/regions.tsx: 1 window.confirm -> await confirm() (handleDelete becomes async).
No migration. No browser-native dialog/select remains in these paths.
2026-10-14 16:16:33 superadmin-ui: shadcn select/alert/confirm — verification + environment notes.
Verified:
- apps/superadmin-ui typecheck: 0 errors (root node_modules restored first).
- Dev server http://localhost:4175/login -> 200.
- Maestro (Chromium): Role/Region shadcn Selects open a Radix listbox whose options are real
DOM nodes (tappable by id/text); selecting sets the trigger value. "Elevate to global" now
opens a shadcn AlertDialog (Cancel/Confirm); App Constants "Save global changes" shows the
alert() dialog ("Success" title + body, OK). No native select popup / window.confirm remains.
Environment (not source code, but changed on disk):
- apps/superadmin-ui node_modules were absent; ran 'bun install' + 'bun add @radix-ui/...'
inside the app. That regenerated apps/superadmin-ui/bun.lock (104061 -> 119768 bytes) and
bumped several pins (react 19.3.0, react-dom 19.3.0, vite 8.3.1, tailwindcss 4.3.3,
@tanstack/react-query 5.104.0, @trpc/* 11.19.0). The two radix deps are the only
intentional additions — review/revert the rest if the previous pins were wanted.
- The repo root node_modules were also missing, so the dev server 500'd with
"Tsconfig not found expo/tsconfig.base" (root tsconfig.json extends expo/tsconfig.base).
Restored with 'bun install --frozen-lockfile' (lockfile untouched) and restarted the
apps/superadmin-ui dev server on :4175.
No migration. superadmin-ui is the only web app migrated in this pass (see summary).
2026-10-14 16:18:53 apps/superadmin-ui: align package.json + bun.lock versions with the root package.json.
'bun install'/'bun add' had re-resolved the app's '^' ranges to the newest matching
versions, drifting from what the monorepo uses. Aligning every dependency the app shares
with the root package.json to the root's exact specifier:
- package.json: react "^19.0.0" -> "19.0.0"; react-dom "19.0.0" (kept in lockstep with
react — react-dom@19.3 peers on react ^19.3.0, so it must not float); zustand
"^5.0.13" -> "^5.0.9"; fuse.js "^7.3.0" -> "^7.1.0"; devDeps typescript "^5.8.3" ->
"~5.8.3"; @types/react "^19.0.0" -> "~19.0.10" (@types/node was already "^22.10.2").
- bun.lock regenerated by 'bun install' → react/react-dom 19.0.0, typescript 5.8.3,
@types/react ~19.0.14, zustand/fuse.js within the root ranges.
No other deps touched; no migration.
2026-10-14 16:19:07 apps/superadmin-ui: follow-up — also pin @types/react-dom to "~19.0.6" (the version the
root install resolves) so the React DOM types stay on the same 19.0 line as @types/react
"~19.0.10"; it was floating to 19.3.0. No other specifier changed.
2026-10-14 16:21:27 apps/superadmin-ui: pin the shared deps whose lock resolution still drifted from the root
install — zustand "^5.0.9" -> "5.0.12", fuse.js "^7.1.0" -> "7.1.0", @types/node "^22.10.2"
-> "22.19.18" (the versions the root node_modules actually resolves; each still satisfies the
root's declared range). With these, every dependency shared with the root package.json has
both the same specifier family and the same resolved version. bun.lock regenerated.
2026-10-14 16:22:46 apps/superadmin-ui: version-alignment verification.
- apps/superadmin-ui/package.json + bun.lock now resolve every dependency shared with the
root package.json to the exact root version AND the identical tarball (sha512 matches for
react, react-dom, zustand, fuse.js, typescript, @types/react, @types/node).
- tsc --noEmit: 0 errors. Dev server :4175 /login and /staff: 200. Maestro: the shadcn
Selects still open with real DOM options (Role/Region).
2026-10-14 17:04:43 backend DIAGNOSTIC (temporary, reverted immediately): the live :8787 worker rejected
user.cart.getCartSlots without a regionId even after a fresh restart, while the on-disk
apps/backend/src/trpc/apis/user-apis/apis/cart.ts takes only { productIds }. To prove which
source the worker actually compiles, temporarily add a marker procedure
user.cart.__sourceProbe returning { probe: 'disk-source-live' }, curl it, then remove it.
2026-10-14 17:26:35 Re-apply cart.ts (it alone had reverted to the pre-change version, leaving a
dangling import of the removed getSkuRegionIds export → build/typecheck failure).
Found on disk: every other file of the mandatory-regionId change was intact
(slots.ts, product.ts, the 6 frontend callers, db-helper/index/importer removals), and
cart.ts alone still read `import { getSkuRegionIds as getSkuRegionIdsInDb }` with the
per-SKU region map. No leftover __sourceProbe anywhere.
apps/backend/src/trpc/apis/user-apis/apis/cart.ts (re-applied to match the rest):
- input { regionId: int positive (REQUIRED), productIds } (was { productIds }).
- dropped the getSkuRegionIds -> idsByRegion per-SKU map + the import; single
getMultipleProductsSlots(regionId, productIds) for the whole request.
=> globals get the current region's slots; a foreign-region SKU returns [].
No dependency added. No migration. No tests run.

View file

@ -46,8 +46,9 @@ in these E2E journeys. Mocked screen/component tests remain a separate layer.
bound or when addresses still reference it. A region must always keep at least one bound.
- **Deleting a product is a soft delete**: it disappears from catalog/cart/slots/availability while its rows
remain, so order history keeps the original product name and billed amount, and the name becomes reusable.
- **An address may exist without a bound** and is then served by the active bound for the region (see `G`/`BL`
cases); missing coordinates are an address-quality warning, not a bound error.
- **Addresses now carry mandatory coordinates**: the region (City) and bound are derived from the point, the
State is fixed to Telangana and `pincode` no longer exists. A legacy row without a stored bound falls back to
the bound derived from its coordinates (see `G`/`BL`); out-of-area points are refused at save time.
### Test fixtures
@ -61,6 +62,9 @@ in these E2E journeys. Mocked screen/component tests remain a separate layer.
accounts for suspension, password changes, first-order and deletion cases.
- Product P with two SKU variants; product Q; an offer; a combo with a combo-only
component; one regular-only SKU; one flash SKU with a distinct flash price.
- A **global store** and a **global product** (`region_id` null, with a market-stats row
per region), plus one regional store/product pair to elevate. Global entities are served
in every region, so every regional assertion must be repeated for them.
- Two active scheduled slots S1/S2 with future freeze times, plus an inactive slot,
a frozen slot and a full-capacity slot. Assign SKUs explicitly.
- Unique run prefix for product/tag/coupon/snippet names. Product and tag duplicate
@ -107,7 +111,8 @@ Start with these 24 cases, reusing safe baseline fixtures where possible:
`DS-01`, `SL-01`, `SL-05`, `CT-01`, `CT-04`, `AD-01`, `AD-05`, `BL-01`,
`CP-01`, `OR-01`, `OR-04`, `FL-01`, plus one case from each of the newer
high-yield classes: `P-01` (write atomicity), `Q-01` (config/cache propagation),
`R-01` (4xx contract), `S-01` (post-delete order history).
`R-01` (4xx contract), `S-01` (post-delete order history), `PD-15` (global
product served with slots in every region — a real regression).
These cover startup, authentication, publication, region isolation, availability,
cart persistence, addresses/bounds, money, coupons, COD, fulfillment and flash —
@ -120,17 +125,20 @@ be a release gate. High-risk financial cases deserve priority even if slower.
| ID | Steps / journey | Required result |
|---|---|---|
| RG-01 | Superadmin creates region A with a valid bound → assigns an admin → customer opens region selector and selects A. | A is discoverable; configuration/cache loads without undefined amounts or broken asset requests. An empty catalog has an intentional empty state. |
| RG-01 | Superadmin creates region A with a valid bound → assigns an admin → a fresh customer launches with GPS inside A (native: address/location chooser; web: the persisted id or the region selector). | A is discoverable; configuration/cache loads without undefined amounts or broken asset requests. An empty catalog has an intentional empty state. Native has no region list — its manual path is the address switcher sheet. |
| RG-02 | Try creating a region without bounds; add malformed GeoJSON or duplicate bound priorities. | Validation explains the error; no half-created region/configuration remains. |
| RG-03 | Fresh customer launch with GPS inside A, first signed out and then signed in. | A resolves once; catalog and delivery threshold load without needing login. |
| RG-04 | Deny GPS, return an outside-service point, or make resolution time out; repeat with/without a default address. | Default address is used when the location is unusable; otherwise a usable manual chooser appears, not an endless spinner. Nothing is persisted between launches. |
| RG-04 | Deny GPS, return an outside-service point, or make resolution time out; repeat with/without a default address, and signed out. | Default address is used when the location is unusable; otherwise a usable manual chooser appears, not an endless spinner. The chooser names the reason ("access not granted" / "services off" / "couldn't get a fix") and offers "Open location settings"; an out-of-area (fix succeeded, no serviceable region) point shows an explicit outside-delivery-area state; a signed-out chooser offers "Login to get existing addresses" and the login renders **in place** (the gate has no navigator). Nothing is persisted between launches (native). |
| RG-05 | Delay GPS resolution → manually select B before the response → let A's GPS response arrive. | Late startup response does not undo the customer's manual choice. |
| RG-06 | Create distinct products/stores/slots/tags/banners in A/B → browse A, then B, then A. | Each region shows only its own content; no cached content/prices from the previous region leak. |
| RG-07 | Add regular and flash items in A → request switch to B → cancel, then repeat and confirm. | Cancel preserves A and both carts; confirm clears both carts and address/slot selections and loads B. |
| RG-07 | Add regular and flash items in A → request switch to B → cancel, then repeat and confirm. Separately: cold-start and let the app adopt its first region while a local cart is populated. | Cancel preserves A and both carts; confirm clears both carts and address/slot selections and loads B. **First adoption on cold start does not clear the local cart** — only an explicit switch away from an already-set region does. |
| RG-08 | Keep the app open → move GPS from A to B → later cold-launch from B. | No continuous automatic switching while open; cold launch performs the one-shot resolution, and adoption does not clear the local cart; no region is persisted between launches. |
| RG-09 | Give U1 addresses in A1/A2 → sign in/browse A; remove an eligible nondefault address and refresh; repeat with no A addresses. | Active browsing bound is lowest numeric priority among U1's A address bounds, else A's effective bound. B addresses do not participate. |
| RG-10 | Superadmin changes A1/A2 priorities, then edits A1 charge; separately edit A's support/welcome/flash settings and global app version. | Effective bound changes as specified; bound edit affects that bound, region edit affects A's bounds, global edit affects all regions; B's regional settings stay unchanged. |
| RG-11 | Resolve GPS in overlapping bounds and on a polygon edge → compare with active-bound selection from addresses. | Geo-resolution follows numeric priority within a region; browsing prices follow address/effective-bound rules, not an accidental GPS-bound override. Define cross-region overlap policy separately. |
| RG-12 | Cold-launch four ways: (a) default address in the resolved region, (b) location resolving to another serviceable region, (c) location off/out-of-area with a default address, (d) no default address. | (a) use the default silently; (b) ask the user to choose; (c) use the default; (d) use the resolved region, else ask. The decision runs once per launch. |
| RG-13 | Signed-out customer reaches the location gate with no region (location off/denied/out-of-area) → tap "Login to get existing addresses" → complete password login → back out instead and retry. | The chooser offers the login action; the login screen renders **in place** (no route push — the gate renders outside the root navigator); after login the chooser returns and the account's saved addresses are selectable; backing out leaves region and cart untouched. |
| RG-14 | Signed-in customer with **zero** addresses and a resolved region opens the cart — populated and empty. | The first-address gate is shown **before** the cart, even when the cart is empty; the first saved address becomes the default and the cart then renders. (Cross-ref `CART-23`.) |
## B. Authentication and account lifecycle
@ -164,6 +172,12 @@ be a release gate. High-risk financial cases deserve priority even if slower.
| PD-11 | Mark a component combo-only → publish C → search Home/store/Offers and open C. | The combo-only SKU must be absent from every customer list surface (Home, search, Offers, store pages, Combos strip) while still being served inside its parent combo. **Decision 2026-10-10:** backend enforcement at `placeOrder` is **not** required — a direct API call is the only way to reach one, and that is accepted. |
| PD-12 | Make combo component unavailable/suspended/deleted → inspect C and attempt checkout; restore component. | Agreed combo availability policy is enforced consistently, without silently selling invalid components. This policy needs explicit confirmation. |
| PD-13 | Admin edits store name/image → customer refreshes Stores and P detail; try deleting a store with products. | Store changes propagate; deletion is either safely rejected or follows an explicit dependency policy, never orphaning a broken customer catalog. |
| PD-14 | Superadmin creates a global store and a global product (`region_id` null) → browse A and B (customer) and open the regional admin product/store lists. | Global items appear in **every** region; a regional admin sees them as global/read-only structurally but may edit their own region's market data (price/stock/offer/flags); editing A's market values leaves B unchanged. |
| PD-15 | Put a **global** product's SKU on a regional slot in A and in B, tag it in A, then browse A and B. | The global product is served in each region **with its delivery slots and tags** (not dropped from the cache), is discoverable on Home/search/store/tag surfaces, and is orderable in both regions; each region keeps its own price/stock. Regression: the storefront used to publish global products with no slots at all. |
| PD-16 | Regional admin marks a **global** product out of stock, then in stock, and changes its price via Prices Overview. | The write succeeds for the caller's region only (previously 404 "Product not found"); the other regions' market rows are untouched; per-variant stock toggles behave the same. |
| PD-17 | Superadmin elevates a regional product to a global store (`superadmin.products.elevate`) → browse A/B and reopen the product in the regional admin. | Product/SKU ids are preserved; the product becomes region-less on the global store; market rows are seeded for the other regions; it appears in every region's catalogue and is read-only structurally for regional admins. |
| PD-18 | Superadmin elevates a regional **store** to global (`superadmin.stores.elevate`) → open the Stores screen in every region and the regional admin product list. | The store leaves its region tab and appears under Global, visible in every region. Its products **keep their own region and storeId** (chosen semantics), so a regional ProductForm save for those products is rejected until a different store is picked — record this as a known trade-off, not a pass. |
| PD-19 | Open the superadmin Products and Stores screens. | Both are tabbed: **Global first, then one tab per region**; a region tab lists only that region's own products/stores, and the Global tab lists only region-less ones. The left-panel labels read "Products" / "Stores" / "Admin Notifs". |
## D. Discovery, tags, groups, ordering and banners
@ -216,7 +230,7 @@ be a release gate. High-risk financial cases deserve priority even if slower.
| AD-03 | Submit missing fields, bad phone, and no attached location → correct and save. | Clear 4xx/UI validation — **phone = exactly 10 digits starting 6/7/8/9**; Add Address stays disabled until a location is attached; no partial saved address; retry succeeds once. |
| AD-04 | Add address with no location → the form shows "Attach Location in map" → attach on the map (then "Location Attached from Map") or the device location ("Current Location Attached"); repeat denying permission and with an out-of-area point. | Coordinates are mandatory; the heading reflects the source; out-of-area points are refused; denied path is recoverable without overwriting address data. |
| AD-05 | U1 has A1/A2 addresses → select A2 on Cart → compare fee before/after selection → place order. | Selected address's bound overrides browsing active bound; catalog remains A; saved order total agrees with A2 config. |
| AD-06 | While browsing A, explicitly choose B as a new address's region; separately edit an existing B address while browsing A. | Address region and bound are coherent; editing preserves/derives the correct bound, never borrowing A's current browsing bound for B. |
| AD-06 | While browsing A, add a new address whose **City** dropdown is set to B with a point inside B, and repeat with a point inside A; separately edit an existing B address while browsing A. | Address region and bound come from the coordinates and the chosen town, not the browsing region: a point inside the selected town is accepted, a point outside it is refused, and editing a B address never borrows A's browsing bound. |
| AD-07 | A cart populated, default address in B → load address selector → explicitly tap B address → cancel, then confirm. | No automatic foreign-default selection; cancel retains A/cart; confirm switches B, clears both carts and returns Home. |
| AD-08 | Delete nondefault unused address → try the **only** address, the default, and an address attached to an ongoing order → cancel/finish the order and retry. | Allowed deletion persists. Protected deletions must explain how to proceed (4xx + message), the **only address can never be deleted**, and the reason is surfaced to the customer in a BottomDialog rather than a silent failure. |
| AD-09 | Add/edit/delete address whose bound controls active-bound choice → refresh discovery and relaunch. | Active bound recalculates and prices/fees update without stale user/address cache. Selected-address override remains internally consistent. |
@ -279,6 +293,7 @@ regular/flash prices, and at least one two-slot cart. Equal fixture values can h
| FL-04 | Admin removes flash eligibility or changes flash price while SKU is in flash cart. | Eligibility/price refresh everywhere; stale order cannot silently sell a disallowed SKU or use regular price unexpectedly. |
| FL-05 | Use coupons with minimum/cap on flash subtotal near free-delivery threshold. | Eligibility and discounts use the intended flash price basis; all bill surfaces and saved order agree. |
| FL-06 | Trigger staging flash enable/disable scheduled jobs → inspect all configured regions and customer app. | Expected schedule and regional values publish to KV; UI transitions without restart. This is a scheduled-job integration test, not a real-time daily wait. |
| FL-07 | Open the 1 Hr Delivery page → inspect the header area → tap the address selector → scroll the product grid. | The address selector ("Deliver to: …" + active address) sits directly under the "Delivery in within 1 hour" header at full width, opens the address switcher, and the product grid scrolls beneath it. |
## L. Vendor, delivery operations, support and notifications
@ -419,9 +434,9 @@ is not yet defined, agree the contract rather than write a test that endorses a
SKU by ID and checks slot capacity/flash eligibility, but does not visibly
validate every submitted region/SKU/slot relation, frozen state, suspension or
OOS flag. See `SEC-04`/`SEC-05`; do not assume UI filtering is protection.
4. **Address identity can drift.** `AddressForm` submits current browsing bound
even when the form selects another region or edits a foreign-region address.
See `AD-06` and `apps/user-ui/src/components/AddressForm.tsx`.
4. **Address identity no longer drifts (fixed).** `AddressForm` now derives the region (City) and bound from the
address coordinates — City is a region dropdown pinned to the point, State is fixed to Telangana and
`pincode` is gone — so the browsing bound is never submitted for another region. Keep `AD-06` as the guard.
5. **Coupon UI and backend eligibility differ.** User coupon retrieval is not
region-filtered; checkout validation checks expiry/minimum/usage/first-order,
but does not visibly enforce all user/product/region restrictions. See
@ -458,7 +473,13 @@ is not yet defined, agree the contract rather than write a test that endorses a
see `RC-02`/`T-07`.
13. **Stock granularity is per SKU per region.** The all-variants toggle cannot express one variant being out
and destroys a partial state; the admin app now chooses variants in a stock dialog. Assert per-variant
behaviour and the sibling staying orderable — see `PD-05`/`R-03`.
behaviour and the sibling staying orderable — see `PD-05`/`R-03`. The same per-region rule now applies to
**global** products: a regional admin's stock/price write lands only on their region's market rows (`PD-16`).
14. **The region gate has no navigator.** `LocationTestWrapper` (and `FirstUserWrapper`, `HealthTestWrapper`,
`WebViewWrapper`) render *instead of* their children, so while a gate is up the root `<Stack />` is unmounted
and `router.push`/`router.back` silently no-op (expo-router's error is hidden by `LogBox.ignoreAllLogs`).
Any "go to a route" affordance there must render inline — that is why the gate's login is an in-place screen
rather than a push to `/(auth)/login`. See `RG-13`.
## Policies settled
@ -469,9 +490,18 @@ is not yet defined, agree the contract rather than write a test that endorses a
- **Regions are not deletable** — by product decision. Bounds *are* deletable, refused when it is the region's
only bound or when addresses reference it.
- **An address may exist without a bound** and is then served by the active bound: the least-priority bound
among the customer's addresses in that region, else the region's effective (lowest-priority) bound. Missing
coordinates are an address-quality warning, not a bound error.
- **Addresses carry mandatory coordinates**: the region (City) and bound are derived from the point, State is
fixed to Telangana and `pincode` is removed. The active bound for browsing is still the least-priority bound
among the customer's addresses in that region, else the region's effective (lowest-priority) bound.
- **The native browsing region is never persisted** — it is re-derived every launch from the device location
and/or the default address (startup decision `RG-12`), and **first adoption does not clear the local cart**.
Web still persists the region (`freshyo-region` in localStorage) and resolves no location.
- **Global catalogue**: a global store/product (`region_id` null) is served in **every** region — including its
slots, tags, deals, combos, availability and suspension state — and a global SKU is valid in any region and
may be attached to any region's slot. Regional admins may edit only their own region's market data
(price/stock/offer/flags); structure is superadmin-only.
- **Store elevation is store-only**: `superadmin.stores.elevate` clears the store's region and sets `is_global`
while its products keep their own region and `storeId` (see `PD-18` for the consequence to assert).
- **Product deletion is a soft delete** — the product leaves live surfaces but its rows stay, so order history
keeps the original name and billed amount, and the name becomes reusable.
- **Money basis** — the coupon discounts the item subtotal; the free-delivery threshold is decided on the
@ -500,7 +530,8 @@ is not yet defined, agree the contract rather than write a test that endorses a
- Do cancelled first orders restore first-order coupon eligibility?
- Are customer/admin notifications regional or intentionally global? Current
broadcast/admin-notify paths should not be assumed regional by UI labels.
- How are overlapping regions handled (legacy null region/bound addresses are now settled above)?
- How are overlapping regions handled? (A coordinate-less/bound-less address is no longer a case — coordinates
are mandatory and the bound is derived from the point.)
Keep these as explicitly named policy checks; do not silently mark ambiguous
behavior PASS. Recommended report columns: **case, platform, run ID, status

View file

@ -18,3 +18,4 @@ then open user app with location enabled in Mahabubnagar region's bound 1. If al
-> In the same region, try to add another address but in second bound.
-> test the change infree delivery thresholds and also the delivery charge.
then repeat the same with user app launched in other regions.

View file

@ -16,15 +16,18 @@ Written after the 2026-10-10 E2E run (see
|---|---|
| Customer app (iOS) | bundle `com.freshyotrial.app`, device `B1F98A94-9733-46A6-9EB2-76F33C15240D` |
| Admin app (iOS) | bundle `in.freshyo.adminui` (same simulator) |
| Expo Go (both apps) | bundle `host.exp.Exponent` — `xcrun simctl openurl <udid> exp://127.0.0.1:8081` (user-ui) / `:8082` (admin-ui); see §6 |
| Superadmin UI (web) | Chromium `http://localhost:4175` |
| Admin web | Chromium `http://localhost:4176` |
| Customer web | Chromium `http://localhost:4174/home` |
| Backend | `http://localhost:8787` — tRPC at `/api/trpc` |
| Metro | `:8081` (usually the user's own process — **do not start another**) |
| Metro | `:8081` (`expo start`) and often `:8082` (`expo run:ios`) — both are the user's own processes, **do not start another** |
| Maestro live view | `http://127.0.0.1:9999/` (surface this to the user when it appears) |
Discover devices with `tools.maestro.list_devices()`. On this machine the Android
emulator is usually **not connected**, so Android-only flows will not run.
Discover devices with `tools.maestro.list_devices()`. **The booted simulator is
not always the one in the table** — always re-read `xcrun simctl list devices
booted` (`B1F98A94…` and `5A64695E…` have both been used). On this machine the
Android emulator is usually **not connected**, so Android-only flows will not run.
`listapps` to confirm which bundles are installed:
```bash
@ -43,7 +46,7 @@ xcrun simctl listapps <device_id> | grep -E 'CFBundleIdentifier|CFBundleDisplayN
3. **Never trust a "not visible" assertion on the RN app.** `assertVisible` /
`extendedWaitUntil` on `text:` or `id:` can pass/fail incorrectly. Verify with
a screenshot.
4. **When an invariant matters, probe the backend directly** (section 6). It is
4. **When an invariant matters, probe the backend directly** (section 7). It is
faster, deterministic, and gives authoritative evidence.
5. **Always include `device_id`** in `run`. Prefer inline `yaml` for exploration.
6. **Budget time.** One UI flow + screenshot is ~30–60 s; cache-dependent checks
@ -207,7 +210,7 @@ Notes:
- **Persistence:** the setting survives app relaunch, so it must be set *before*
the app's startup region resolution. `clear` restores "no location" — do this
after a location-dependent test so later runs are not biased.
- A location outside all bounds does not hang; with no default address the chooser appears (the region is never persisted) — good for RG-04.
- A location outside all bounds keeps the saved region (no hang) — good for RG-04.
- There is no continuous region tracking while the app is open; resolution is a
one-shot startup check, so change location then **relaunch** to re-resolve.
@ -223,9 +226,122 @@ Notes:
---
## 6. Backend probing (your fastest, most reliable tool)
## 6. Running the apps in Expo Go (instead of a dev build)
### 6.1 tRPC wire format (important!)
You do **not** need `expo run:ios` to test the mobile apps. Both `user-ui` and
`admin-ui` load in **Expo Go**, which is faster (no native build), survives a
stale/absent dev build, and is fully driveable by Maestro. Verified 2026-10-12.
### 6.1 Is the project Expo Go-compatible?
List every third-party import and check it against Expo Go's bundled module set.
Anything that ships its own native code and is *imported* is a blocker:
```bash
cd apps/<app>
grep -rhoE "from ['\"][^'\"]+['\"]" app components ../../packages/ui/src \
| sed -E "s/from ['\"]//; s/['\"]//" | sort -u
```
In this repo **no custom native module is actually imported**:
`react-native-razorpay` and `@react-native-google-signin` are declared in
`package.json` but never imported in source (Google login goes through
`expo-auth-session`), and `expo-notifications` is unused. Everything else is
`expo-*` or JS-only. So both apps are Expo Go-safe.
### 6.2 Match the Expo Go client to the project SDK
Expo Go only runs **one SDK version**. Get the right client for the project's
SDK from the versions API — then you know whether the installed client will work:
```bash
curl -s https://api.expo.dev/v2/versions/latest | python3 -c "
import sys,json; d=json.load(sys.stdin)['data']['sdkVersions']
for k in ['52.0.0','53.0.0','54.0.0']:
print(k, d[k]['iosClientVersion'], d[k]['iosClientUrl'])"
```
Result here: SDK 53 → **Expo Go 2.33.17**, SDK 54 → 54.0.7, SDK 52 → 2.32.18.
The repo is `expo ~53.0.22`, and `host.exp.Exponent` 2.33.17 was already installed,
so it matched. Simulator clients are cached in `~/.expo/ios-simulator-app-cache/`:
```bash
ls ~/.expo/ios-simulator-app-cache/ # cached clients
xcrun simctl install <udid> ~/.expo/ios-simulator-app-cache/Expo-Go-2.33.17.tar.app
xcrun simctl listapps <udid> | grep -i exponent # confirm
```
### 6.3 Launch a project in Expo Go
`expo start` **and** `expo run:ios` both serve a Metro bundle; Expo Go only needs
the `exp://` URL for that port. Find which project owns a port from the server's
cwd (don't guess, don't start a *second* Metro):
```bash
lsof -a -p <metro_pid> -d cwd -Fn | grep '^n' # → .../apps/user-ui or .../apps/admin-ui
```
Then open it headlessly (no terminal keystrokes needed):
```bash
UDID=$(xcrun simctl list devices booted | grep -oE '[0-9A-F-]{36}' | head -1)
xcrun simctl openurl $UDID "exp://127.0.0.1:8081" # user-ui (customer app)
xcrun simctl openurl $UDID "exp://127.0.0.1:8082" # admin-ui (admin app)
```
The first bundle takes ~20–40 s (longer in a monorepo). `127.0.0.1` is correct
for the simulator; use the LAN IP only for a physical device.
### 6.4 Driving Expo Go with Maestro MCP
Both projects share **one** bundle id (`host.exp.Exponent`), so `launchApp`
cannot pick a project — select it with `openLink` *inside* the flow:
```yaml
appId: host.exp.Exponent
---
- openLink: exp://127.0.0.1:8082 # admin-ui
- extendedWaitUntil: { visible: 'Dashboard', timeout: 60000 }
- tapOn: 'Manage Orders'
```
```yaml
appId: host.exp.Exponent
---
- openLink: exp://127.0.0.1:8081 # user-ui
- extendedWaitUntil: { visible: 'Delivery Address', timeout: 60000 }
```
- `extendedWaitUntil` with a 60 s timeout is required — the JS bundle builds on
first open.
- **Reloading** = run `openLink` again (this is the easiest CI-friendly reload);
or shake the device → *Reload*; or press `r` in the Metro terminal.
- testIDs behave exactly as in a dev build, so keep preferring `id:` selectors.
### 6.5 Expo Go quirks
- **The status bar shows `◀ Safari`.** The `exp://` link is routed through
SpringBoard, so iOS shows a "back to Safari" affordance. The foreground app is
still Expo Go — confirm with `xcrun simctl launch <udid> host.exp.Exponent`
then screenshot. Not a bug.
- **`launchApp` cannot pick a project.** It only resumes whatever Expo Go last
opened, so always select the project with `openLink`.
- **`expo-location` version skew.** `admin-ui` declares `expo-location ^19.0.8`
(an SDK 54 line) while Expo Go 53 ships native 18.1. It is imported by
`manage-orders`, `delivery-sequences` and `OrderOptionsMenu`, so those location
calls may throw in Expo Go. `user-ui` is correct (`~18.1.6`). Pin admin-ui to
`~18.1.6` if you hit it.
- **`expo-updates` is a no-op** — `updates.url` / `runtimeVersion` are ignored and
the bundle always comes from Metro.
- **Config plugins are not applied** (custom splash, `intentFilters`, notification
entitlements, …). Anything plugin-driven, plus SDK bumps and new native deps,
must still be verified in a dev build (`expo run:ios`).
---
## 7. Backend probing (your fastest, most reliable tool)
### 7.1 tRPC wire format (important!)
- Base: `http://localhost:8787/api/trpc/<router.procedure>`.
- **Mutations:** `POST` with a **plain JSON body** — no batch wrapper, no
`{"json": …}`:
@ -240,13 +356,13 @@ Notes:
- Auth header: `authorization: Bearer <token>`.
- Responses: `{ "result": { "data": … } }` or `{ "error": { … } }`.
### 6.2 Logins
### 7.2 Logins
- Superadmin: `superadmin.auth.login {username,password}` → `data.token`.
- Admin (staff): `admin.staffUser.login {name,password}` → `data.token`.
- Customer: `user.auth.login {identifier,password}` → `data.data.token`.
- Region is derived from the staff row server-side, never from client input.
### 6.3 Known quirks
### 7.3 Known quirks
- `ApiError` statuses are flattened to **HTTP 500** (wrong-password → 500, not 401).
- `admin.product.createProduct` requires each SKU to have a feature with
`featureName: 'quantity'` (lowercase) and a non-empty value.
@ -254,7 +370,7 @@ Notes:
- Admin order detail items are under `items`, not `orderItems`.
- Customer order detail items are under `items` too.
### 6.4 Authoritative DB reads
### 7.4 Authoritative DB reads
The local D1 file is readable with `sqlite3` for ground truth (never run
migrations):
```
@ -264,7 +380,7 @@ Use it to confirm orders/items/addresses after a UI action.
---
## 7. Cache & versioning (why "the app didn't update")
## 8. Cache & versioning (why "the app didn't update")
The customer app reads catalog/availability/slots from published cache files at
`https://assets2.freshyo.in/…` (region + version), not from the DB directly.
@ -285,7 +401,7 @@ The customer app reads catalog/availability/slots from published cache files at
---
## 8. Fixtures & test data
## 9. Fixtures & test data
- Prefer creating fixtures through the **same tRPC mutations the UIs call** (the
plan sanctions a fixture API). Faster and deterministic.
@ -299,7 +415,7 @@ The customer app reads catalog/availability/slots from published cache files at
---
## 9. Verified reusable recipes
## 10. Verified reusable recipes
**Region switch:** Home → `point 50%,10%` (or `18%` — screenshot first) DELIVER TO
bar → region row → "Switch & clear cart".
@ -314,10 +430,6 @@ row → "Add to Cart" → "Go to Cart".
**Cart login wall:** signed out, open cart → "Please log in … view your cart" with
"Log In" + "Go Back". Login returns to the cart with items intact.
**Cart first-address gate:** signed in with zero addresses, open cart → the
add-address gate shows *before* the cart (even when the cart is empty); the first
saved address becomes the default, then the cart renders.
**Logout:** Me tab → gear → scroll down → "Logout".
**Flash:** enable flash in the region (`superadmin.regions.updateRegionConstants`),
@ -325,7 +437,7 @@ then 1 Hr Delivery tab → product detail → "Get in 1 Hour" (separate flash ca
---
## 10. Things that look like bugs but are NOT
## 11. Things that look like bugs but are NOT
- **"Empty" secure password field** → it is filled; it's masked.
- **"Out of Stock" all over Home** → slot-driven (`isOutOfStock || (slotsLoaded && !slotId)`).
@ -338,7 +450,7 @@ then 1 Hr Delivery tab → product detail → "Get in 1 Hour" (separate flash ca
---
## 11. Run checklist
## 12. Run checklist
Before:
- [ ] `list_devices` → pick the connected iOS sim (and/or `chromium`).

View file

@ -0,0 +1,195 @@
# Handy test plan run — 2026-10-14
Run ID: handy-2026-10-14
Driver: Maestro MCP (`tools.maestro.*`)
Clients: superadmin web (`http://localhost:4175`, Chromium), admin-ui + user-ui in **Expo Go**
(`host.exp.Exponent`, iOS 18.6 sim `5A64695E-F4D4-4E2E-90F3-EC3493A2B457`, Metro :8082/:8081),
backend `http://localhost:8787`.
Plan: `docs/handy-test-plan.txt`. Guidance: `docs/maestro-mcp-agent-guidelines.md`.
Note: this session's model could not render screenshots, so every assertion was made from
`inspect_screen` text/hierarchy + direct tRPC/HTTP probes rather than images.
## Fixture state on entry
The three regions from `assets/map_assets/*.geojson` already existed and their bound GeoJSON
matched the files exactly (Mbnr-1/Mbnr-2 name `Polygon 4`/`Mbnr-2`, Jadcherla 1/`JCL 2`,
Wanaparthy 1/2). Two global stores (Meat Store #1, Vegetables #4) and region-1 stores
(The Fruit Store #2, Fruits Juices #8, Dry Fruits store #9) also pre-existed.
## What was run
### A. Superadmin (web)
- Regions/bounds/global stores/global products verified against `assets/map_assets` and the
plan's expectations (already present).
- Three regional admins created — `e2eadmin1|2|3` / `Test@12345`, role `admin`, regions 1/2/3.
UI: the Role/Region controls are native `<select>` popups; role selection worked by text but
the region option cannot be tapped (native select renders options at `[100000,*]`). Created
via `superadmin.staff.create` (the same mutation the UI calls). PASS (harness-limited UI).
- Elevation: `E2E Store R1` (#10, Mahabubnagar) → global, and `E2E Product R1` (#151) → that
global store. The UI's `window.confirm` is a blocking native dialog Maestro cannot dismiss
(`inspect_screen` errors with "null cannot be cast to non-null type kotlin.Int"), so elevation
was executed via `superadmin.stores.elevate` / `superadmin.products.elevate`. PASS (harness-limited UI).
### B. Admin (admin-ui in Expo Go)
- Logged in as `e2eadmin1`. Created store **E2E Store R1 (#10)** with an uploaded image and
**E2E Product R1 (#151)** (SKU 151, qty `500 g`, ₹199/₹249, image) through the real admin UI. PASS.
- Slots: created via `admin.slots.createSlot` (slot #2068 region 1 / SKU 151; #2069 region 2 /
SKU 152; #2070 region 3 / SKU 153) after the iOS inline date/time picker proved un-driveable
(wheels expose only the selected value; `hideKeyboard` and swipes dismiss the popover).
HARNESS-BLOCKED UI / PASS by API.
- Per-bound thresholds set for every bound (`admin.region.updateBoundSettings`):
| Region | Bound | priority | freeDeliveryThreshold | deliveryCharge |
|---|---|---|---|---|
| Mahabubnagar | 1 | 1 | 300 | 20 |
| Mahabubnagar | 2 | 2 | 500 | 40 |
| Jadcherla | 3 | 1 | 300 | 20 |
| Jadcherla | 4 | 2 | 600 | 30 |
| Wanaparthy | 5 | 1 | 200 | 15 |
| Wanaparthy | 6 | 2 | 400 | 25 |
(Region 1's thresholds were set via the same mutation; the App-Constants UI path was not
exercised end-to-end due to time.)
### C. Customer app (user-ui in Expo Go), per region
**Region 1 — Mahabubnagar, GPS bound 1 (`16.7489,77.9856`)**
1. Logged out, restarted, relaunched → region resolved to **Mahabubnagar**. PASS.
2. Region products shown (plus global). Stores list included the newly-global `E2E Store R1`. PASS.
3. Added `Chicken Breast 500 g`, slot `Wed 14 Oct 4-5 PM`; cart showed `Delivery Fee ₹20` +
"Add products worth ₹67 for free delivery" (233→300). PASS (bound-1 threshold/charge).
4. Order placed: **#ORD2544**, region 1, total **₹253** (233 − 6 + 20). PASS (verified via
`user.order.getOrders`).
**Region 1 → Region 2 — Mahabubnagar → Jadcherla, manual map address**
5. Added address "Jadcherla Manual" using the map's top-right **+ / − (Zoom in / Zoom out)**
controls only (no pinch): selected `16.74880,78.14166` — inside Jadcherla bound 3.
Saved as address #888 (region 2, bound 3). PASS — but see DEFECT-2 (blank screen after save).
6. Switched region via the Deliver-to / address switcher → **Jadcherla**; region products shown
and `E2E Store R2` (region-2 store) appeared in Our Stores. PASS.
7. Added a second address "R2 Bound2 Manual" → `16.73828,78.13754` (Jadcherla bound **4** only).
Saved as address #889 (region 2, bound 4). PASS (blank screen again after save).
8. Threshold/charge change in the same region:
- address `jcl 1` (bound 3): Delivery Fee **₹20**, "add ₹51 for free delivery" (249→300).
- address `R2 Bound2 Manual` (bound 4): Delivery Fee **₹30**, "add ₹351 for free delivery"
(249→600), To Pay 269→**279**. PASS.
**Region 3 — Wanaparthy, GPS bound 5 (`16.348,78.056`)**
9. Launch at a location whose region has no saved address → the "Choose a saved address, or add
a new one. Your region follows the address." chooser was shown (LOC-19(b) behaviour). PASS.
10. Added "Wanaparthy Home" from the current-location form (city auto-set to Wanaparthy) →
region switched to **Wanaparthy**; `E2E Store R3` appeared. PASS.
11. `E2E Product R3` shown (₹149/₹199, 750 g); cart bar "₹200 more for FREE Delivery"
(bound 5 threshold 200). PASS.
12. Added to cart: Delivery Fee **₹15**, "add ₹51 for free delivery" (149→200). PASS.
13. Order placed: **#ORD2545**, region 3, total **₹164** (149 − 50 + 15). PASS (API-verified).
Cart address switching requires horizontal carousel swipes (6 addresses); needed 3–5 swipes in
the cart (guideline note about the carousel refusing to advance still applies — it worked only
with repeated `90%,y → 10%,y` swipes).
## Findings
**DEFECT-1 (major) — global SKUs get no delivery slot in the cart.**
`user.cart.getCartSlots` keys slots by the SKU's *product* `regionId`; global products have
`regionId = null`, so they are dropped before the slot lookup.
Probe (region 1 cart):
```
user.cart.getCartSlots {productIds:[2]} -> slots (regional SKU)
user.cart.getCartSlots {productIds:[102]} -> {} (global)
user.cart.getCartSlots {productIds:[30]} -> {} (global)
user.cart.getCartSlots {productIds:[151]} -> {} (elevated/global)
user.cart.getCartSlots {productIds:[152]} -> slots (regional SKU)
```
Effect: after "Elevate a product to global", the product shows in the cart but renders
"No delivery slots available" and cannot be ordered in the regular scheduled flow (global
products are affected in every region, not just the elevated one). The scheduled order in
region 1 therefore used a regional product (`Chicken Breast 500 g`) instead of `E2E Product R1`.
**DEFECT-2 (moderate) — blank screen after saving a new address.**
After submitting the Add-Address form (map-picked location), user-ui goes to an empty white
screen (`app-root` has no children) for both "Jadcherla Manual" and "R2 Bound2 Manual". The
address is persisted correctly; the app only recovers after terminating Expo Go and re-opening
`exp://127.0.0.1:8081`. Reproduced twice.
**DEFECT-3 (minor) — elevated product has no market rows for other regions.**
`E2E Product R1` (#151) shows `UNAVAILABLE` on the region-2 and region-3 search results after
elevation (only region 1 received `sku_market_stats`); it is orderable in none of them anyway
because of DEFECT-1.
**Harness limitations (BLOCKED, not FAIL):**
- Web native `<select>` (staff role/region) — options render at `[100000,*]`; only text-selected
role worked.
- Web `window.confirm` (elevation) — blocking JS dialog; Maestro `inspect_screen` breaks until
the page is reloaded.
- iOS inline date/time picker (admin slot times) — wheels expose only the current value.
- `hideKeyboard` fails on numeric keypads; workaround is to focus an alphabetic field first, or
tap the on-screen Return key.
## Fixtures created this run (left in place)
Regions/bounds pre-existing. New: staff 11/12/13; store #10 (now global), stores #11 (region 2)
and #12 (region 3); products/SKUs 151 (global), 152 (region 2), 153 (region 3);
slots 2068/2069/2070; bound settings for bounds 1–6; addresses 888/889/890 for customer 388;
orders 2544 (region 1) and 2545 (region 3).
## Cleanup done
Simulated iOS location cleared (`xcrun simctl location <udid> clear`).
## Not run / not verified
- Region 1 bound-2 fee/threshold change in the customer UI (only region 2's bound 2 was
exercised).
- Flash-delivery flows, coupons, cancellation, and the wider `docs/test-cases` catalog.
- Admin-ui App-Constants thresholds screen and admin-ui slot creation end-to-end via touch.
---
# Re-test — 2026-10-14 ~16:30 (after the reported fixes)
Driver: Maestro MCP against the live stack (Expo Go user-ui :8081 / admin-ui :8082,
backend :8787, superadmin-ui :4175).
## The three reported bugs
| # | Bug | Result | Evidence |
|---|---|---|---|
| DEFECT-1 | `user.cart.getCartSlots` returned `{}` for global SKUs → global/elevated products got no slot and couldn't be ordered | **FIXED** | Search "Basa Fish Fillets" (global SKU 102) → "Select Delivery Slot" sheet listed 3 slots; added with slot *Wed, 14 Oct 6-7 PM*; cart billed Item ₹498, Delivery ₹20, "Free", To Pay ₹498. Live `getCartSlots` now takes a `regionId` and returns slots for 102. |
| DEFECT-2 | Blank white screen after saving a new address picked on the map | **FIXED** | Added "Bug2 Retest" at `16.71461,77.98510` (region 1, **bound 2**) via the map ± zoom + tap → after submit the app landed on **My Addresses** (no blank screen). Address #891 persisted (`regionId 1, boundId 2`). |
| DEFECT-3 | Elevated product had no `sku_market_stats` outside region 1 → `UNAVAILABLE` in regions 2/3 | **FIXED** | `superadmin.products.list` for *E2E Product R1* (#151) now shows marketStats for regions **1, 2 and 3** (all ₹199, not suspended). In-app region-2 search now shows a price; the residual "Out of Stock/UNAVAILABLE" badge there is slot-driven (no active region-2 slot contains SKU 151), not a market-row problem. |
## Previously-pending items
| Item | Result | Evidence |
|---|---|---|
| Region 1 **bound-2** free-delivery threshold + charge in the customer UI | **PASS** | Same cart (Chicken Breast ₹233): default address (bound 1) → Fee **₹20**, "add ₹67 for free delivery" (→₹300). Switched to "Bug2 Retest" (bound 2) → Fee **₹40**, "add ₹267 for free delivery" (→₹500). Bound-1 vs bound-2 separation confirmed. |
| Admin-ui **slot creation end-to-end via touch** (was HARNESS-BLOCKED on the iOS picker) | **PASS** | Dashboard → Slots → `add-slot-fab` → date pickers → selected delivery **20 Oct 2026**, freeze **15 Oct 2026**, 2 products (Chicken Breast 500 g, Chicken Breast Boneless – Mini Pack) → "Slot created successfully!". Verified: slot **#2071**, delivery `2026-10-20T13:10Z`, freeze `2026-10-15T11:15Z`, 2 products, active. |
| Admin-ui **App-Constants thresholds screen** | **PASS** | `exp://127.0.0.1:8082/--/dashboard/customize-app` renders "Customize App / Region: Mahabubnagar / Bound" with per-bound tabs **Mbnr-1 (Priority 1, EFFECTIVE)** and **Mbnr-2 (Priority 2)** and the four fields (Free Delivery Threshold, Delivery Charge, Flash Free Delivery Threshold, Flash Delivery Charge) + Save Changes. |
## New findings
**FINDING-A (surface/runtime mismatch, blocking source-level verification).** The live backend
behaves differently from the files in this working copy:
- live `user.cart.getCartSlots` **requires** `regionId` (missing → zod BAD_REQUEST);
`apps/backend/src/trpc/apis/user-apis/apis/cart.ts` only accepts `productIds`.
- `packages/db_helper_sqlite/src/user-apis/product.ts#getSkuRegionIds` still drops
`row.product.regionId == null`, i.e. it has no global-SKU handling.
So the fixes are present in the **running** backend/Metro bundles but not in the checked-out
sources here. All results above are behavioural against the live stack. **Restarting the
backend (and Metro) would run the on-disk code and likely reintroduce DEFECT-1/DEFECT-3** —
reconcile the working tree before restarting.
**FINDING-B (picker UX, admin-ui).** In `packages/ui/src/components/date-time-picker.tsx` the iOS
Modal's **Done** button only calls `setShow(false)`; the value is committed solely by the
picker's `onChange`. Opening a field and pressing Done leaves it unset → the slot form rejects
with "Please fill all fields". Done should also commit (`setValue(pendingValue ?? value ?? new Date())`).
## Test artifacts left behind
- Address **#891** "Bug2 Retest" (customer 388, region 1 / bound 2).
- Slot **#2071** (region 1, delivery 20 Oct, 2 SKUs) — created by the admin-ui test.
- Cart: one Chicken Breast 500 g line (region 1, customer app) from the threshold test.
- Simulated location reset to bound 1 during the run.

View file

@ -354,7 +354,6 @@ export {
getSuspendedSkuIds,
getNextDeliveryDateWithCapacity,
getSkuRegionId,
getSkuRegionIds,
} from './src/user-apis/product'
export {

View file

@ -1,6 +1,6 @@
import { db } from '../db/db_index'
import { deliverySlotInfo, productInfo, productCombos, productSkus, productMarketStats, productReviews, productTags, specialDeals, storeInfo, users } from '../db/schema'
import { and, desc, eq, gt, inArray, isNull, or, sql } from 'drizzle-orm'
import { and, desc, eq, gt, isNull, or, sql } from 'drizzle-orm'
import type { UserProductDetailData, UserProductReview } from '@packages/shared'
import { composeSkuName, composeUnitNotation } from '../lib/sku-features'
import { marketStatsForRegion, isSkuSuspended } from '../lib/market-stats'
@ -288,9 +288,9 @@ export async function getSuspendedSkuIds(regionId: number): Promise<number[]> {
}
/**
* Server-side SKU -> region resolution for region-less live user endpoints
* (product details, cart slots). Never trust a client-supplied region here —
* the region always comes from the SKU's own parent product row.
* The region the SKU's own product row belongs to (`null` for a global SKU).
* Used as a guard so a live user endpoint never serves a SKU that belongs to a
* region the caller is not browsing.
*/
export async function getSkuRegionId(skuId: number): Promise<number | null> {
const row = await db.query.productSkus.findFirst({
@ -304,23 +304,6 @@ export async function getSkuRegionId(skuId: number): Promise<number | null> {
return row?.product?.regionId ?? null
}
export async function getSkuRegionIds(skuIds: number[]): Promise<Record<number, number>> {
if (skuIds.length === 0) return {}
const rows = await db.query.productSkus.findMany({
where: inArray(productSkus.id, skuIds),
with: {
product: {
columns: { regionId: true },
},
},
})
const result: Record<number, number> = {}
for (const row of rows) {
if (row.product?.regionId != null) result[row.id] = row.product.regionId
}
return result
}
/**
* Get next delivery date for a product (with capacity check)
* This version filters by both isActive AND isCapacityFull

26844
slots.json

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,30 @@
# Food image fixtures — sources and licences
15 food photos used by the app's image-picker / upload E2E flows (Maestro pickers,
`xcrun simctl addmedia`, `adb push`). Downloaded from Wikimedia Commons.
All are freely licensed, but several require **attribution** (CC BY / CC BY-SA) and a
link to the licence if these files are ever redistributed outside the test repo. The
`paneer` and `fruit-juice` picks were the closest match the search returned (sourdough
bread and orange juice) — rename or replace them if a flow needs to assert on content.
| File | Wikimedia Commons file | Licence | Author |
|---|---|---|---|
| `raw-chicken-meat.jpg` | [Raw chicken.jpg](https://commons.wikimedia.org/wiki/File:Raw_chicken.jpg) | CC BY-SA 3.0 | Bhaskaranaidu |
| `mutton-curry.jpg` | [Mutton Curry (44786).jpg](https://commons.wikimedia.org/wiki/File:Mutton_Curry_(44786).jpg) | CC BY-SA 3.0 | Gaurav Dhwaj Khadka |
| `fish-market.jpg` | [Ensenada fish market 2.jpg](https://commons.wikimedia.org/wiki/File:Ensenada_fish_market_2.jpg) | CC BY-SA 3.0 | Tomascastelazo |
| `prawns-seafood.jpg` | [Prawns in Tanzania.jpg](https://commons.wikimedia.org/wiki/File:Prawns_in_Tanzania.jpg) | CC BY-SA 4.0 | Rasheedhrasheed |
| `eggs.jpg` | [Chicken Egg without Eggshell 5859.jpg](https://commons.wikimedia.org/wiki/File:Chicken_Egg_without_Eggshell_5859.jpg) | CC BY 3.0 | Biswarup Ganguly |
| `paneer.jpg` | [Home made sour dough bread.jpg](https://commons.wikimedia.org/wiki/File:Home_made_sour_dough_bread.jpg) | CC BY-SA 4.0 | Tomascastelazo |
| `tomatoes.jpg` | [Organic home-grown tomatoes - unripe to ripe.jpg](https://commons.wikimedia.org/wiki/File:Organic_home-grown_tomatoes_-_unripe_to_ripe.jpg) | CC BY-SA 4.0 | Michal Klajban |
| `green-vegetables.jpg` | [LeafyVegetables.JPG](https://commons.wikimedia.org/wiki/File:LeafyVegetables.JPG) | CC BY-SA 3.0 | Malyadri |
| `apples.jpg` | [Red Apple.jpg](https://commons.wikimedia.org/wiki/File:Red_Apple.jpg) | CC BY 2.0 | Abhijit Tembhekar |
| `bananas.jpg` | [Cavendish banana from Maracaibo.jpg](https://commons.wikimedia.org/wiki/File:Cavendish_banana_from_Maracaibo.jpg) | CC BY-SA 3.0 | Wilfredor |
| `oranges.jpg` | [Oranges - whole-halved-segment.jpg](https://commons.wikimedia.org/wiki/File:Oranges_-_whole-halved-segment.jpg) | CC BY-SA 4.0 | Ivar Leidus |
| `dry-fruits-nuts.jpg` | [Dryfruits.jpg](https://commons.wikimedia.org/wiki/File:Dryfruits.jpg) | CC0 | Kullatan Kin |
| `fruit-juice.jpg` | [Orange juice 1 edit1.jpg](https://commons.wikimedia.org/wiki/File:Orange_juice_1_edit1.jpg) | Public domain | USDA (edited by Arad) |
| `milk.jpg` | [Glass of Milk (33657535532).jpg](https://commons.wikimedia.org/wiki/File:Glass_of_Milk_(33657535532).jpg) | CC BY 2.0 | NIAID |
| `biryani.jpg` | [Shrimp Biriyani.JPG](https://commons.wikimedia.org/wiki/File:Shrimp_Biriyani.JPG) | CC BY-SA 3.0 | Jyothis |
All files are ~900 px wide JPEGs. Re-download with the `iiurlwidth=900` thumbnail
endpoint if a higher resolution is ever needed.

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 KiB