arrenge the home page order

This commit is contained in:
2026-07-24 15:28:46 +05:30
parent a4328a791a
commit 4a0adea793
37 changed files with 2532 additions and 1564 deletions

View File

@@ -1,59 +0,0 @@
// The ONLY module the store-journey UI imports for data.
//
// Everything here is powered by local dummy JSON today. To go live, swap each
// function body for a real API call and keep these exported signatures
// unchanged — the UI never needs to change.
import storesData from "@/data/experience/stores.json";
import categoriesData from "@/data/experience/categories.json";
import productsData from "@/data/experience/products.json";
import intentsData from "@/data/experience/intents.json";
import type { Category, Intent, Product, Recommendation, Store } from "@/types/experience";
const stores = storesData as Store[];
const categories = categoriesData as Category[];
const products = productsData as Product[];
const intents = intentsData as Intent[];
/** The stores a customer has already added — their "My Stores" list. */
export function getMyStores(): Store[] {
return stores;
}
export function getStore(id: string): Store | undefined {
return stores.find((s) => s.id === id);
}
/** The in-store shelves shown after entering a store. */
export function getCategories(): Category[] {
return categories;
}
/** The natural-language shopping intents offered as search chips. */
export function getIntents(): Intent[] {
return intents;
}
/**
* Resolve a shopping intent into a store-scoped bundle — the products Nearle AI
* recommends, joined with their store, plus the cart totals.
*/
export function getRecommendation(intentId: string): Recommendation | null {
const intent = intents.find((i) => i.id === intentId);
if (!intent) return null;
const store = getStore(intent.storeId);
if (!store) return null;
const items = intent.productIds
.map((pid) => products.find((p) => p.id === pid))
.filter((p): p is Product => Boolean(p));
return {
intent,
store,
products: items,
itemCount: items.length,
total: items.reduce((sum, p) => sum + p.price, 0),
};
}