google-labs-jules[bot] 01847c7e7b Here's the commit message I've drafted:
Feat: Implement dummy data mode controlled by environment variable

This commit introduces a dummy data mode for the storefront, controlled
by the `NEXT_PUBLIC_USE_DUMMY_DATA` environment variable. When this
variable is set to `true`, the application will use hardcoded dummy
data instead of making live calls to the Shopify API.

Key changes:
- Added `NEXT_PUBLIC_USE_DUMMY_DATA=true` to `.env.example`.
- Restored `lib/shopify/index.ts#shopifyFetch` to its original
  implementation that can make live API calls.
- Modified all data fetching functions in `lib/shopify/index.ts`
  (e.g., `getMenu`, `getCart`, `getProduct`, `getProducts`,
  `getCollection`, `getCollectionProducts`, `getPage`, `getPages`)
  to check `process.env.NEXT_PUBLIC_USE_DUMMY_DATA`. If true, they
  now return appropriate hardcoded dummy data. Otherwise, they
  proceed with the original Shopify API call logic.
- Modified all cart mutation functions in `lib/shopify/index.ts`
  (`createCart`, `addToCart`, `removeFromCart`, `updateCart`) to
  also respect this environment variable. In dummy mode, they log the
  action and return a dummy cart state, bypassing actual API calls
  and cookie manipulations. A shared dummy cart constant was
  introduced for consistency.

This allows the application to be run and tested in a standalone
configuration without requiring a live Shopify backend, resolving
previous build errors related to API call failures in such environments.
2025-05-23 06:05:12 +00:00
..
2025-02-09 22:08:56 -06:00