Skip to content

Phase 16 — WhatsApp-first commerce: cart Buy-via-WhatsApp + persistent supplier contact dock - #42

Merged
ManoharPaturi merged 2 commits into
mainfrom
feat/phase16-whatsapp-first
Oct 18, 2026
Merged

ManoharPaturi merged 2 commits into
mainfrom
feat/phase16-whatsapp-first

Conversation

@Pushpak731

Copy link
Copy Markdown
Contributor

Summary

Owner-directed pivot (2026-10-10): the supplier WhatsApp chat becomes a first-class buying path alongside — not instead of — the tracked §2 checkout flow. App code + one idempotent ops seed; no migration, no new dependencies. Branch cut from main @ e4c3c43.

1. Cart "Buy via WhatsApp" (§18 v3.1 note)

  • The cart aside's primary CTA is now a green Buy via WhatsApp button; "Proceed to checkout" stays as the secondary outlined path (unchanged §2 order-creating flow).
  • The prefilled wa.me message carries every line (name, Product ID, variant, qty, price) + totals (subtotal, discount, shipping, estimated total) — built server-side from the live quote (lib/cart/whatsapp.ts, pure, unit-tested). Browser-supplied prices never ride along (rule 7/14).

2. Persistent supplier contact dock

  • components/storefront/contact-dock.tsx: fixed two-button bottom bar on mobile (WhatsApp + Call us, safe-area aware) and floating round buttons bottom-right on desktop, on every storefront page; plain <a> links so it works without JS.
  • Footer brand block gains "Chat on WhatsApp" + phone pills.
  • Number resolution (lib/store/contact.ts): store_settings.whatsapp_store_number → NEXT_PUBLIC_WHATSAPP_STORE_NUMBER fallback → hidden when neither is set. Never throws; degrades like the shell's other soft reads.

3. Sample catalog seed + brand placeholders

  • supabase/ops/20261010_seed_sample_catalog.sql (idempotent, ops-file convention): 1 category, 2 published sarees w/ variants + inventory + media, folded into Festive Edit — so a fresh project's storefront, cart and WhatsApp handoff are exercisable end to end.
  • public/brand/saree-wine.svg / saree-teal.svg placeholder art.

4. Housekeeping

  • README Phase 16 note (incl. Vercel deploy made + removed at owner request; fresh Supabase project sri-vartali-commerce provisioning via temporary Edge Function because outbound 5432 is blocked on this network — function deleted after use).
  • .gitignore: .env* (Vercel CLI hardening).

Verification

  • 278 unit tests pass (5 new in tests/unit/cart-whatsapp.test.ts: lines/variant/qty/price, no-variant omission, totals + discount + free shipping, charged shipping, money surfaces).
  • tsc clean, eslint 0 new warnings, production build green.
  • Browser e2e against the live DB: home/cart/mobile verified (wa.me URL decodes to the full §27-style cart message); visual gate pass on home desktop, cart desktop, shop mobile.
  • Full checkout → order SVS-ORD-20261010-00001 placed and trackable (unchanged flow).

Notes for reviewers

  • Rule 9 ("create the order before opening WhatsApp") is untouched: the order-creating flow is exactly as before; the new deep link is an inquiry that creates no order row (spec §2 v3.1 addition documents this).
  • Follow-up PRs: hydration tolerance (root <html>/<body>), Phase 17 UX pass (stacked on this branch), build-spec v3.1 docs.

- Cart: primary 'Buy via WhatsApp' CTA prefills the server-quoted cart
  (items, IDs, variants, qty, totals) into a wa.me chat with the supplier;
  checkout stays as the secondary tracked-order path (lib/cart/whatsapp.ts).
- Persistent supplier contact: floating WhatsApp + phone dock on every
  storefront page (mobile bottom bar / desktop floating buttons) plus footer
  contact pills (components/storefront/contact-dock.tsx, lib/store/contact.ts;
  resolves store_settings.whatsapp_store_number -> env fallback, hides
  cleanly when unset).
- Sample catalog seed for fresh projects (supabase/ops/20261010_...) with
  two placeholder-brand SVG product images (public/brand/).
- Tests: tests/unit/cart-whatsapp.test.ts (5 cases) — suite 278 passing.
- Local-only infra notes in README. No push, no PR.
@vercel

vercel Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sri-vartali-commerce Ready Ready Preview Oct 18, 2026 10:13am UTC

Copilot AI balanced review requested due to automatic review settings October 18, 2026 10:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@Pushpak731

Copy link
Copy Markdown
Contributor Author

@ManoharPaturi — requesting your review, approval and merge for Phase 16 (WhatsApp-first commerce).

What to look at first: lib/store/contact.ts (number resolution + graceful degradation), lib/cart/whatsapp.ts + its tests (server-quoted message, rule 7/14 compliance), and the cart page CTA swap.

Merge order: this PR is the base for #44 — please merge #42 → #44 → #45 (#43 independent, any time).

CI (typecheck · lint · unit · build) is running on this PR; happy to address any feedback. 🙏

@Pushpak731

Copy link
Copy Markdown
Contributor Author

@copilot review this pr for merging

Copilot AI commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

@copilot review this pr for merging

Reviewed for merge: no blocking issues found in lib/store/contact.ts, lib/cart/whatsapp.ts, cart CTA wiring, and the associated unit tests. Local focused validation passed (tests/unit/cart-whatsapp.test.ts, typecheck; lint has one pre-existing warning unrelated to this PR), and PR CI Typecheck · Lint · Build is green. You can merge once the currently running Copilot check completes.

@ManoharPaturi
ManoharPaturi merged commit b48b845 into main Oct 18, 2026
5 checks passed
@ManoharPaturi
ManoharPaturi deleted the feat/phase16-whatsapp-first branch October 18, 2026 10:19
ManoharPaturi added a commit that referenced this pull request Oct 18, 2026
…ration warning) (#43)

## Summary

Fixes the React hydration console error the owner hit while browsing the
local site:

```
A tree hydrated but some attributes of the server rendered HTML didn't match…
<body className="min-h-full flex flex-col font-sans"
-  wotdisconnected="true"
```

**Root cause — not app code.** The mismatched attribute is injected into
`<body>` by a browser extension (Web of Trust / WOT) *before* React
hydrates. Reproduced on a clean browser session by injecting exactly
that attribute pre-hydration: the identical error fires on the
unmodified app; nothing in the codebase writes it.

## Change

`app/layout.tsx`: `suppressHydrationWarning` on `<html>` and `<body>` —
the documented React/Next remedy for extension mutation of those two
elements (Grammarly, WOT, dark-mode extensions, …). Scope is
deliberately narrow:

- attribute-mismatch tolerance on those two tags only;
- the app tree's hydration checks remain fully active;
- no behaviour change (warning is cosmetic; the site worked).

## Verification
- Injected-attribute replay: **before** → identical console error;
**after** → **zero console errors**, page renders normally with the
attribute still present.
- Any *customer* with such an extension benefits too — this was not just
the owner's browser.
- `tsc` / eslint / 278 tests / production build all green (no other file
touched).

## Notes for reviewers
- One-file, 9-line diff. Independent of #42/#44/#45 — safe to merge in
any order.

Co-authored-by: Manohar Paturi <[email protected]>
Pushpak731 added a commit that referenced this pull request Oct 18, 2026
…Buy-via-WhatsApp on product pages, 1440px layout, logo

Rebased onto main @ 98b3d1c (after #42/#43 squash-merges) to clear the
stacked-branch conflicts — content identical to the original Phase 17
commit; see PR description for the five functions and verification.
ManoharPaturi pushed a commit that referenced this pull request Oct 18, 2026
…Buy-via-WhatsApp on product pages, 1440px layout, logo (#44)

## Summary

Owner-directed UX pass (2026-10-11), five functions, one per owner
request. **Stacked on #42** (this PR's base is
`feat/phase16-whatsapp-first`; it will auto-retarget to `main` once #42
merges — merge #42 first). App code only; **no migration, no new
dependencies**.

### 1. Navbar functionality
- New `components/storefront/header-nav.tsx` (client, `usePathname`):
the category rail **highlights the active route** (bold + underline +
`aria-current="page"`); exact-match for `/shop` and categories,
prefix-match for `/account/*`.
- All remaining rail links audited against live routes — every item
resolves.

### 2. Track Order removed everywhere (§7/§37 v3.1)
- `app/(storefront)/track-order/` deleted (404), header link removed,
sitemap entry dropped, `getTrackOrderView` +
`TrackOrderView`/`TrackOrderResult` deleted from
`lib/orders/queries.ts`, `robots.ts` comment updated.
- Account-order cross-link now points at the shared `/order/<n>` page
(no dead links anywhere — swept the tree).
- Status visibility is unchanged for real users: public order page +
client dashboard + §36 WhatsApp tracking message.

### 3. Buy Now removed everywhere; product pages get Buy via WhatsApp
(§19 v3.1)
- Removed: product-page buttons (inline + sticky bar),
`buyNow`/`abandonBuyNow` actions, the `svs_buy_now` cookie layer,
checkout buy-now mode + banner + `mode` plumbing
(`lib/checkout/types.ts`, `reviewCheckout`, `placeOrderAction`).
- Added: green **Buy via WhatsApp** beside Add to Cart (inline + sticky
mobile bar) built from `buildProductWhatsAppMessage`
(`lib/cart/whatsapp.ts`): prefills product name, Product ID, variant,
**live quantity**, unit price, estimated total. URL rebuilds as the
customer changes qty/variant (verified in-browser: Qty 2 → total
₹5,998).
- Mobile contact dock yields its bottom bar on `/product/*` so the two
never stack.

### 4. Wider layout
- `max-w-6xl` (1152px) → `max-w-[1440px]` across **all shells**
(storefront pages, client dashboard, admin) — 26 files, mechanical sed;
visual gate re-passed at 1680px (no stretching, cards scale cleanly).

### 5. Brand logo
- `public/brand/logo.svg` — SV monogram medallion (wine + zari gold,
placeholder until owner artwork drops in as a file swap). Header
(h-9/h-10, responsive) + footer brand block.

## Verification
- `tsc` clean; eslint — only the 1 pre-existing `params` warning that
`main` already has; **278 tests pass**; production build green.
- Browser e2e: active states verified on `/shop` +
`/category/silk-sarees`; product wa.me deep link (live qty rebuild);
**full checkout re-run post-removal → order `SVS-ORD-20261011-00002`
placed** (order pipeline intact); mobile product page shows exactly one
bottom bar; visual gate pass on home-wide, product-wide, shop-mobile.
- `/track-order` → 404 confirmed.

## Notes for reviewers
- Owner sign-off already given for both removals (Track Order, Buy Now)
— recorded in the spec v3.1 PR (#45) alongside the rewritten §19/§37.
- Sequencing: **#42 → this PR → #45** (#43 is independent).
ManoharPaturi added a commit that referenced this pull request Oct 18, 2026
…viations (#45)

## Summary

`Sri_Vartali_AI_Agent_Build_Spec.md` **v3.0 → v3.1** (192 insertions /
42 deletions): the spec was frozen at Phase 15 while the platform moved
on. This PR brings the plan document in line with what actually ships,
preserving **all 63 section numbers** so every existing `§`
cross-reference (README, `docs/ops` runbooks, code comments) still
resolves.

### What changed
- **Revision History** block (new, after the header): v3.0 vs v3.1
provenance, owner-directed deviations called out explicitly.
- **§2**: the two WhatsApp-first entry points (cart + product deep
links) documented, and why they don't violate rule 9 — they deliberately
create **no** order row.
- **§5**: implementation note — no Radix (custom components cover it),
actual `lib/` layout, WhatsApp runs on wa.me deep links today (Cloud API
built, unconfigured).
- **§7**: routes split live / removed (`/track-order`) / future info
pages.
- **§13/§18/§48**: product-page section list, cart primary CTA, mobile
requirements — updated for Buy via WhatsApp + the contact dock.
- **§19**: rewritten as a REMOVED record — the v3.0 Buy Now plan, and
the replacement's properties (no server state, qty/variant-aware, single
supplier number, hides when unconfigured).
- **§37**: rewritten as a REMOVED record — plus where each old
capability lives now (public order page / client dashboard / §36
tracking message) and the preserved credential discipline.
- **§51**: env-var names aligned with `.env.example` exactly
(`NEXT_PUBLIC_` prefixes + `NEXT_PUBLIC_WHATSAPP_STORE_NUMBER`).
- **§54**: phase log extended **Phase 12 → Phase 17** (super
admin/realtime, facets, acceptance audit, smoke runbook, WhatsApp-first
commerce, owner UX pass).
- **§60**: MVP list annotated (WhatsApp-first handoffs added; Track
Order struck).

## Verification
- Markdown fences balanced (232 — even), section count unchanged,
rendered spot-check of the new header/revision block.
- Docs-only diff — one file, no code, no CI impact beyond the standard
pipeline.

## Notes for reviewers
- Removed features are **documented, not erased** — the spec keeps the
audit trail of what was planned, what shipped, and what the owner
changed, matching this repo's docs discipline.
- Companion code PRs: #42 (Phase 16), #44 (Phase 17), #43 (hydration fix
— unrelated).

Co-authored-by: Manohar Paturi <[email protected]>

This branch was successfully deployed

1 active deployment
Preview — 4ff4033c Deployed Oct 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants