From f73fd76148f1b072ee45470bae40ef1d3e3a65a2 Mon Sep 17 00:00:00 2001
From: shafi54 <108669266+shafi-aviz@users.noreply.github.com>
Date: Sun, 11 Oct 2026 09:40:16 +0530
Subject: [PATCH] enh
---
apps/fallback-ui/vite.config.ts | 4 +-
.../web-ui/src/components/FloatingCartBar.tsx | 7 +--
.../components/PaymentAndOrderComponent.tsx | 13 +++--
apps/web-ui/src/hooks/prominent-api-hooks.ts | 8 +--
change-log.txt | 54 +++++++++++++++++++
5 files changed, 73 insertions(+), 13 deletions(-)
diff --git a/apps/fallback-ui/vite.config.ts b/apps/fallback-ui/vite.config.ts
index 3ca293f..9efbb1a 100644
--- a/apps/fallback-ui/vite.config.ts
+++ b/apps/fallback-ui/vite.config.ts
@@ -5,7 +5,9 @@ import path from 'path'
export default defineConfig({
base: '/',
- plugins: [react()],
+ // @vitejs/plugin-react-swc ships its own vite copy, so its Plugin type is
+ // nominally different from the root vite's PluginOption (same 6.4.1 version).
+ plugins: [react() as any],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
diff --git a/apps/web-ui/src/components/FloatingCartBar.tsx b/apps/web-ui/src/components/FloatingCartBar.tsx
index 169d9fc..37ff24d 100644
--- a/apps/web-ui/src/components/FloatingCartBar.tsx
+++ b/apps/web-ui/src/components/FloatingCartBar.tsx
@@ -65,9 +65,10 @@ export function FloatingCartBar({ isFlashDelivery = false }: FlashDeliveryProps)
0
)
- const freeDeliveryThreshold = isFlashDelivery
- ? constsData?.flashFreeDeliveryThreshold
- : constsData?.freeDeliveryThreshold
+ const freeDeliveryThreshold =
+ (isFlashDelivery
+ ? constsData?.flashFreeDeliveryThreshold
+ : constsData?.freeDeliveryThreshold) ?? 0
const remainingForFreeDelivery = Math.max(0, freeDeliveryThreshold - totalCartValue)
const cartBarColor = isFlashDelivery ? '#f81260' : 'var(--brand-600, #2563eb)'
diff --git a/apps/web-ui/src/components/PaymentAndOrderComponent.tsx b/apps/web-ui/src/components/PaymentAndOrderComponent.tsx
index 09486f8..5661763 100644
--- a/apps/web-ui/src/components/PaymentAndOrderComponent.tsx
+++ b/apps/web-ui/src/components/PaymentAndOrderComponent.tsx
@@ -45,8 +45,10 @@ export function PaymentAndOrderComponent({
}, 0)
const deliveryCharge = useMemo(() => {
- const threshold = isFlashDelivery ? constsData?.flashFreeDeliveryThreshold : constsData?.freeDeliveryThreshold
- const charge = isFlashDelivery ? constsData?.flashDeliveryCharge : constsData?.deliveryCharge
+ const threshold =
+ (isFlashDelivery ? constsData?.flashFreeDeliveryThreshold : constsData?.freeDeliveryThreshold) ?? 0
+ const charge =
+ (isFlashDelivery ? constsData?.flashDeliveryCharge : constsData?.deliveryCharge) ?? 0
return totalPrice < threshold ? charge : 0
}, [totalPrice, constsData, isFlashDelivery])
@@ -231,9 +233,10 @@ export function PaymentAndOrderComponent({
{/* Free Delivery Nudge */}
{deliveryCharge > 0 && (() => {
- const threshold = isFlashDelivery
- ? constsData?.flashFreeDeliveryThreshold
- : constsData?.freeDeliveryThreshold
+ const threshold =
+ (isFlashDelivery
+ ? constsData?.flashFreeDeliveryThreshold
+ : constsData?.freeDeliveryThreshold) ?? 0
return threshold > 0 && totalPrice < threshold ? (
diff --git a/apps/web-ui/src/hooks/prominent-api-hooks.ts b/apps/web-ui/src/hooks/prominent-api-hooks.ts
index 139a97a..4e714e9 100644
--- a/apps/web-ui/src/hooks/prominent-api-hooks.ts
+++ b/apps/web-ui/src/hooks/prominent-api-hooks.ts
@@ -157,7 +157,7 @@ function useCacheUrl(filename: string): string | null {
const assetsDomain = essentialConsts?.assetsDomain
const apiCacheKey = essentialConsts?.apiCacheKey
- const cacheVersion = essentialConsts?.cacheVersion
+ const cacheVersion = essentialConsts?.products_version_num
if (
!assetsDomain ||
@@ -177,7 +177,7 @@ function useAvailabilityCacheUrl(): string | null {
const regionId = useDiscoveryRegionId(essentialConsts)
const assetsDomain = essentialConsts?.assetsDomain
- const availabilityVersionNum = essentialConsts?.availabilityVersionNum
+ const availabilityVersionNum = essentialConsts?.availability_version_num
if (!assetsDomain || availabilityVersionNum === undefined || availabilityVersionNum === null || regionId == null) {
return null
@@ -191,7 +191,7 @@ function useSlotsCacheUrl(): string | null {
const regionId = useDiscoveryRegionId(essentialConsts)
const assetsDomain = essentialConsts?.assetsDomain
- const slotsVersionNum = essentialConsts?.slotsVersionNum
+ const slotsVersionNum = essentialConsts?.slots_version_num
if (!assetsDomain || slotsVersionNum === undefined || slotsVersionNum === null || regionId == null) {
return null
@@ -350,7 +350,7 @@ export function useStoreWithProducts(storeId: number) {
const assetsDomain = essentialConsts?.assetsDomain
const apiCacheKey = essentialConsts?.apiCacheKey
- const cacheVersion = essentialConsts?.cacheVersion
+ const cacheVersion = essentialConsts?.products_version_num
const cacheUrl =
assetsDomain && apiCacheKey && regionId != null
diff --git a/change-log.txt b/change-log.txt
index 9047b52..bc8de5c 100644
--- a/change-log.txt
+++ b/change-log.txt
@@ -4325,3 +4325,57 @@ user-ui
- tests: user-ui + backend coupon payloads -> couponIds.
Deferred: superadmin-ui screen for global coupons (router is live; no UI route yet).
Not run: any test suite. No drizzle migration executed.
+
+[2026-10-11 09:38:30 +0530] Fix pre-existing type errors in web-ui + fallback-ui (db_helper_postgres left untouched).
+
+ --- a/apps/web-ui/src/hooks/prominent-api-hooks.ts
+ +++ b/apps/web-ui/src/hooks/prominent-api-hooks.ts
+ @@ useCacheUrl / useStoreWithProducts
+ - const cacheVersion = essentialConsts?.cacheVersion
+ + const cacheVersion = essentialConsts?.products_version_num
+ @@ useAvailabilityCacheUrl
+ - const availabilityVersionNum = essentialConsts?.availabilityVersionNum
+ + const availabilityVersionNum = essentialConsts?.availability_version_num
+ @@ useSlotsCacheUrl
+ - const slotsVersionNum = essentialConsts?.slotsVersionNum
+ + const slotsVersionNum = essentialConsts?.slots_version_num
+
+ --- a/apps/web-ui/src/components/FloatingCartBar.tsx
+ +++ b/apps/web-ui/src/components/FloatingCartBar.tsx
+ @@
+ - const freeDeliveryThreshold = isFlashDelivery
+ - ? constsData?.flashFreeDeliveryThreshold
+ - : constsData?.freeDeliveryThreshold
+ + const freeDeliveryThreshold =
+ + (isFlashDelivery
+ + ? constsData?.flashFreeDeliveryThreshold
+ + : constsData?.freeDeliveryThreshold) ?? 0
+
+ --- a/apps/web-ui/src/components/PaymentAndOrderComponent.tsx
+ +++ b/apps/web-ui/src/components/PaymentAndOrderComponent.tsx
+ @@
+ - const threshold = isFlashDelivery ? constsData?.flashFreeDeliveryThreshold : constsData?.freeDeliveryThreshold
+ - const charge = isFlashDelivery ? constsData?.flashDeliveryCharge : constsData?.deliveryCharge
+ + const threshold =
+ + (isFlashDelivery ? constsData?.flashFreeDeliveryThreshold : constsData?.freeDeliveryThreshold) ?? 0
+ + const charge =
+ + (isFlashDelivery ? constsData?.flashDeliveryCharge : constsData?.deliveryCharge) ?? 0
+ @@
+ - const threshold = isFlashDelivery
+ - ? constsData?.flashFreeDeliveryThreshold
+ - : constsData?.freeDeliveryThreshold
+ + const threshold =
+ + (isFlashDelivery
+ + ? constsData?.flashFreeDeliveryThreshold
+ + : constsData?.freeDeliveryThreshold) ?? 0
+
+ --- a/apps/fallback-ui/vite.config.ts
+ +++ b/apps/fallback-ui/vite.config.ts
+ @@
+ - plugins: [react()],
+ + // @vitejs/plugin-react-swc ships its own vite copy, so its Plugin type is
+ + // nominally different from the root vite's PluginOption (same 6.4.1 version).
+ + plugins: [react() as any],
+
+[2026-10-11 09:41:10 +0530] DONE — all workspaces typecheck clean except db_helper_postgres (left untouched, 47 pre-existing errors).
+ web-ui (12) + fallback-ui (1) fixed. No tests run. No migration run.