From fa0ed9e2b6c2bb7c6722c36b6cf230b5a2accd1c Mon Sep 17 00:00:00 2001 From: Clarence Date: Tue, 1 Dec 2026 23:44:33 +0800 Subject: [PATCH 1/3] refactor: adopt shared useMediaQuery and stored-value helpers from @merqo/ui Co-Authored-By: Claude Sonnet 5.5 --- CHANGELOG.md | 6 ++++++ package.json | 2 +- src/app/dashboard/README.md | 4 ++-- src/app/dashboard/counter/README.md | 2 +- .../counter/remember-program.dom.test.tsx | 6 +++--- src/app/dashboard/counter/remember-program.tsx | 7 ++----- src/app/dashboard/overview/README.md | 2 +- src/app/dashboard/overview/visits-trend.tsx | 12 ++---------- src/app/dashboard/serve-cta.dom.test.tsx | 12 ++++++++++-- src/app/dashboard/serve-cta.tsx | 7 ++----- .../card-check/components/program-card-status.tsx | 15 +++------------ 11 files changed, 33 insertions(+), 42 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ea284b3..6b37d633 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to loopkit are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). +## [0.6.4] - 2026-12-01 + +### Changed + +- The visits trend, the Counter's last-program memory, the "Serve a customer" button and the retired-card notice now use the shared `useMediaQuery` and `readStored`/`writeStored` helpers from `@merqo/ui`. The last-program value is now stored as JSON, so a device with the old raw value uses the default program until the vendor next opens the Counter. + ## [0.6.3] - 2026-12-01 ### Changed diff --git a/package.json b/package.json index c0085f4b..0ab39737 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "loopkit", - "version": "0.6.3", + "version": "0.6.4", "private": true, "packageManager": "pnpm@11.10.0", "engines": { diff --git a/src/app/dashboard/README.md b/src/app/dashboard/README.md index 13da88f1..53f52443 100644 --- a/src/app/dashboard/README.md +++ b/src/app/dashboard/README.md @@ -32,8 +32,8 @@ Shared controls and `cn` used by this folder's modules are imported from `@merqo - `loading.tsx` — `DashboardLoading` skeleton fallback (pulse placeholders for header and cards) shown while the dashboard route segment streams - `page.tsx` — `DashboardPage` server component: `requireVendor` + `applyDueCutovers`, loads programs (redirects to `/setup` on zero), fetches `getVendorStats` / `countExpiredVouchers` / `listActivity(limit 6)` / `getVendorOverviewInputs` / `getVendorProfile` in parallel, wires them through `buildOverviewModel`, and renders the Overview: a head row (greeting + stall name + date + ``) carrying `data-tour="shop-qr"` (the onboarding tour's step-1 anchor), then `` / `` / `` / `` / `` in the main column and `` / `` in a right rail (a `lg:` two-zone grid when the vendor has 2+ programs, one centred `max-w-[46rem]` column otherwise). A zero-enrolled vendor sees just the head row and a "no customers yet" card (`@merqo/ui`'s `ElevatedCard`). No `isPro()` gating (Phase 1 ships ungated) - `overview/` — the Overview's presentational components (`briefing`, `base-strip`, `visits-trend`, `worth-a-look`, `recent-activity`, `reward-cost-panel`, `your-programs`), each with a `*.dom.test.tsx` -- `serve-cta.tsx` — client `ServeCta`: the "Serve a customer" button, links to `/dashboard/counter?p=` for the last program served on this device (reads `localStorage` key `loopkit:last-counter-program` via `useSyncExternalStore`, the Counter writes it), falling back to the server-provided default -- `serve-cta.dom.test.tsx` — jsdom tests: stored program wins when owned, falls back to the default when the stored id is not owned or `localStorage` throws +- `serve-cta.tsx` — client `ServeCta`: the "Serve a customer" button, links to `/dashboard/counter?p=` for the last program served on this device (reads `localStorage` key `loopkit:last-counter-program` via `readStored` inside `useSyncExternalStore`, the Counter writes it as JSON; a legacy raw-string value reads as null and falls back until the Counter rewrites it), falling back to the server-provided default +- `serve-cta.dom.test.tsx` — jsdom tests: stored program wins when owned, falls back to the default when the stored id is not owned, is a legacy raw string, or `localStorage` throws - `plan/` - `profile/` - `program-display.test.ts` — unit tests for `PROGRAM_TYPE_BADGE` and `describeProgram` across every program type diff --git a/src/app/dashboard/counter/README.md b/src/app/dashboard/counter/README.md index ba26c043..75a3b624 100644 --- a/src/app/dashboard/counter/README.md +++ b/src/app/dashboard/counter/README.md @@ -12,7 +12,7 @@ Shared controls and `cn` used by this folder's modules are imported from `@merqo - `page.tsx` — `CounterPage` server component. Requires a vendor; loads programs and redirects to `/dashboard` when there are none. With no `?p=`, it fetches `activeCardCountsByProgram` and redirects to `pickDefaultCounterProgram`'s pick (the busiest active program), or `/dashboard` when nothing is active. Otherwise it resolves the program from `?p=` (redirect to `/dashboard` if it is not one of the vendor's), builds the vendor-wide shop-join link (`/c?v=`) plus its QR, reads the stall name, computes `getEntitlement(await isPro())` and passes its `showBranding` down as `ServeCustomer`'s `showBranding` prop, mounts `RememberProgram`, renders the head row (program name + badge + `describeProgram` + a `ProgramSwitcher` chip when the vendor runs more than one program), and renders `ServeCustomer` keyed on the program id. Wrapper is `mx-auto max-w-4xl` (wider than the old `max-w-2xl` to fit the two-column serve layout), nested inside `../layout.tsx`'s shared `
`. Derives `redemption_mode` off the program's own `config` and passes it as `ServeCustomer`'s `pointsRedemptionMode`. - `counter-view.ts` — `pickDefaultCounterProgram(programs, activeCountById)`: pure helper picking the program id with the most active cards (ties to the earlier entry, first program when all counts are zero or missing, `null` when empty). - `counter-view.test.ts` — unit tests for `pickDefaultCounterProgram`. -- `remember-program.tsx` — client `RememberProgram`: renders nothing; on mount and whenever `id` changes, writes `localStorage["loopkit:last-counter-program"]` (swallows a throwing `setItem`). Sub-plan 3's "Serve a customer" CTA reads this key. +- `remember-program.tsx` — client `RememberProgram`: renders nothing; on mount and whenever `id` changes, writes `localStorage["loopkit:last-counter-program"]` as JSON via `@merqo/ui`'s `writeStored` (swallows a throwing `setItem`). Sub-plan 3's "Serve a customer" CTA reads this key. - `remember-program.dom.test.tsx` — jsdom tests: writes on mount, updates on `id` change, does not crash when storage throws. - `scan-hero.tsx` — client `ScanHero`: the Counter's primary action, a thin wrapper around `ScanButton` `variant="hero"` with the label "Serve a customer" and the sub "Camera opens when you tap". All decode/token-resolve logic stays in `ScanButton`. - `scan-hero.dom.test.tsx` — jsdom tests: renders the label and sub copy as a button, carries the cornered dashed frame chrome. diff --git a/src/app/dashboard/counter/remember-program.dom.test.tsx b/src/app/dashboard/counter/remember-program.dom.test.tsx index 6f685b3d..68e6656d 100644 --- a/src/app/dashboard/counter/remember-program.dom.test.tsx +++ b/src/app/dashboard/counter/remember-program.dom.test.tsx @@ -14,14 +14,14 @@ describe("RememberProgram", () => { it("writes the program id on mount and renders nothing", () => { const { container } = render(); expect(container).toBeEmptyDOMElement(); - expect(localStorage.getItem(KEY)).toBe("p7"); + expect(localStorage.getItem(KEY)).toBe('"p7"'); }); it("updates the stored value when the id changes", () => { const { rerender } = render(); - expect(localStorage.getItem(KEY)).toBe("p7"); + expect(localStorage.getItem(KEY)).toBe('"p7"'); rerender(); - expect(localStorage.getItem(KEY)).toBe("p9"); + expect(localStorage.getItem(KEY)).toBe('"p9"'); }); it("does not crash when setItem throws", () => { diff --git a/src/app/dashboard/counter/remember-program.tsx b/src/app/dashboard/counter/remember-program.tsx index a4c3255b..eae53495 100644 --- a/src/app/dashboard/counter/remember-program.tsx +++ b/src/app/dashboard/counter/remember-program.tsx @@ -1,16 +1,13 @@ "use client"; import { useEffect } from "react"; +import { writeStored } from "@merqo/ui"; // Records the program the vendor last worked the Counter in, per device. // Sub-plan 3's "Serve a customer" CTA reads this key to route back here. export function RememberProgram({ id }: { id: string }) { useEffect(() => { - try { - localStorage.setItem("loopkit:last-counter-program", id); - } catch { - // Private mode or blocked storage: routing just falls back to the default. - } + writeStored("loopkit:last-counter-program", id); }, [id]); return null; } diff --git a/src/app/dashboard/overview/README.md b/src/app/dashboard/overview/README.md index 1772ad0b..0e946fbb 100644 --- a/src/app/dashboard/overview/README.md +++ b/src/app/dashboard/overview/README.md @@ -13,7 +13,7 @@ composes them. - `briefing.dom.test.tsx` — renders the full sentence, pulls out a numeric lead, treats a non-numeric lead as plain text, asserts no em dash - `base-strip.tsx` — `BaseStrip({ stats, redemptionRatePct, returnRatePct })`, client: the 4 base stats as `@merqo/ui` `StatTile`s wrapped in `@merqo/ui`'s `ElevatedCard`, each with an `InfoTooltip trigger="tap"` whose content is the stat's title/body/hint; below them the redemption-rate and return-rate figures, each with their own tap tooltip. `--` (two hyphens) for a null return rate - `base-strip.dom.test.tsx` — jsdom: the 4 displays/labels render, tapping a stat's info trigger reveals its body copy, the two rate figures render, `--%` for a null return rate and no em dash anywhere -- `visits-trend.tsx` — `VisitsTrend({ bars7, bars14, deltaVsLastWeek })`, client: a div-bar strip (the `stats/visits-chart.tsx` idiom) showing 7 bars by default and 14 on `matchMedia("(min-width: 56rem)")`, the prior week's 7 bars muted; a "Visits, last N days" caption and an "up/down N vs last week" delta (hidden at 0) +- `visits-trend.tsx` — `VisitsTrend({ bars7, bars14, deltaVsLastWeek })`, client: a div-bar strip (the `stats/visits-chart.tsx` idiom) showing 7 bars by default and 14 on `useMediaQuery("(min-width: 56rem)")` from `@merqo/ui`, the prior week's 7 bars muted; a "Visits, last N days" caption and an "up/down N vs last week" delta (hidden at 0) - `visits-trend.dom.test.tsx` — jsdom with a stubbed `matchMedia`: 7 bars + 7-day caption + a positive delta on a narrow screen, 14 bars + 14-day caption + a negative delta on a wide screen, the delta hidden at 0 - `worth-a-look.tsx` — `WorthALook({ items })`: one `next/link` per `WorthALookItem` to `/dashboard/customers?cohort=gone-quiet`, `?cohort=one-away` or `?cohort=two-away`, matching the exact overview cohort, with strong + sub copy; renders nothing when `items` is empty - `worth-a-look.dom.test.tsx` — jsdom: two items render two links with the right hrefs, empty renders nothing, singular wording for a count of one diff --git a/src/app/dashboard/overview/visits-trend.tsx b/src/app/dashboard/overview/visits-trend.tsx index 2d98f15f..75376fc9 100644 --- a/src/app/dashboard/overview/visits-trend.tsx +++ b/src/app/dashboard/overview/visits-trend.tsx @@ -1,6 +1,6 @@ "use client"; -import { useEffect, useState } from "react"; +import { useMediaQuery } from "@merqo/ui"; import { VisitsBars } from "../visits-bars"; import type { TrendBar } from "@/app/dashboard/dashboard-view"; @@ -15,15 +15,7 @@ export function VisitsTrend({ bars14: TrendBar[]; deltaVsLastWeek: number; }) { - const [wide, setWide] = useState(false); - - useEffect(() => { - const mq = window.matchMedia(WIDE); - const sync = () => setWide(mq.matches); - sync(); - mq.addEventListener("change", sync); - return () => mq.removeEventListener("change", sync); - }, []); + const wide = useMediaQuery(WIDE); const bars = wide ? bars14 : bars7; const priorCount = wide ? bars14.length - 7 : 0; diff --git a/src/app/dashboard/serve-cta.dom.test.tsx b/src/app/dashboard/serve-cta.dom.test.tsx index b229d281..a83dce7b 100644 --- a/src/app/dashboard/serve-cta.dom.test.tsx +++ b/src/app/dashboard/serve-cta.dom.test.tsx @@ -12,7 +12,7 @@ afterEach(() => { describe("ServeCta", () => { it("targets the stored program when it is one the vendor owns", () => { - window.localStorage.setItem(KEY, "p2"); + window.localStorage.setItem(KEY, JSON.stringify("p2")); render(); expect( screen.getByRole("link", { name: /serve a customer/i }), @@ -20,7 +20,15 @@ describe("ServeCta", () => { }); it("falls back to the default when the stored id is not owned", () => { - window.localStorage.setItem(KEY, "gone"); + window.localStorage.setItem(KEY, JSON.stringify("gone")); + render(); + expect( + screen.getByRole("link", { name: /serve a customer/i }), + ).toHaveAttribute("href", "/dashboard/counter?p=p1"); + }); + + it("falls back to the default for a legacy raw-string value until the Counter rewrites it", () => { + window.localStorage.setItem(KEY, "p2"); render(); expect( screen.getByRole("link", { name: /serve a customer/i }), diff --git a/src/app/dashboard/serve-cta.tsx b/src/app/dashboard/serve-cta.tsx index ef9c417b..b20c1332 100644 --- a/src/app/dashboard/serve-cta.tsx +++ b/src/app/dashboard/serve-cta.tsx @@ -2,6 +2,7 @@ import { useSyncExternalStore } from "react"; import Link from "next/link"; +import { readStored } from "@merqo/ui"; import { PlusCircle } from "lucide-react"; const LAST_USED_KEY = "loopkit:last-counter-program"; @@ -12,11 +13,7 @@ const subscribe = (onChange: () => void) => { }; function readLastUsed(): string | null { - try { - return window.localStorage.getItem(LAST_USED_KEY); - } catch { - return null; - } + return readStored(LAST_USED_KEY, (v) => (typeof v === "string" ? v : null)); } // The "Serve a customer" button. Routes to the Counter for the last program diff --git a/src/features/card-check/components/program-card-status.tsx b/src/features/card-check/components/program-card-status.tsx index e745b534..22757422 100644 --- a/src/features/card-check/components/program-card-status.tsx +++ b/src/features/card-check/components/program-card-status.tsx @@ -19,7 +19,7 @@ import { AlertDialogTitle, Button, } from "@merqo/ui/primitives"; -import { ConfirmDialog } from "@merqo/ui"; +import { ConfirmDialog, readStored, writeStored } from "@merqo/ui"; // One customer's progress card for a single program, at the vendor-level // /c page. Each instance owns its own regenerate-dialog state — necessary @@ -47,12 +47,7 @@ export function ProgramCardStatus({ useEffect(() => { if (card.active || !card.replacedByName) return; const key = `loopkit:seen-replaced:${card.programId}`; - let dismissed = false; - try { - dismissed = localStorage.getItem(key) !== null; - } catch { - // Storage is optional for the notice. - } + const dismissed = readStored(key) !== null; if (!dismissed) { // eslint-disable-next-line react-hooks/set-state-in-effect -- localStorage is only readable on the client after mount setNoticeOpen(true); @@ -61,11 +56,7 @@ export function ProgramCardStatus({ }, [card.programId]); function dismissNotice() { - try { - localStorage.setItem(`loopkit:seen-replaced:${card.programId}`, "1"); - } catch { - // Dismissing the notice also works when storage is unavailable. - } + writeStored(`loopkit:seen-replaced:${card.programId}`, 1); setNoticeOpen(false); } From 21884ca96df00cdb9f34d3fe89494a559aab7056 Mon Sep 17 00:00:00 2001 From: Clarence Lee <35331421+cljiahao@users.noreply.github.com> Date: Wed, 2 Dec 2026 00:55:20 +0800 Subject: [PATCH 2/3] feat(qkit-earn): qkit-order stamps are Free (v0.6.4) (#290) * feat(qkit-earn): make qkit-order stamps Free for every vendor Remove the Pro gate from the qkit-earn settings UI, the save action and qkit_earn_resolve_program (migration 0072). Bump to 0.6.4. Co-Authored-By: Claude Opus 5.5 * test(qkit-earn): cover ungated save action Co-Authored-By: Claude Opus 5.5 * chore(qkit-earn): describe 0072 behaviour in its header Co-Authored-By: Claude Opus 5.5 * docs(profile): note qkit stamp setting is free for every vendor Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- CHANGELOG.md | 6 +++++ README.md | 4 +-- package.json | 2 +- src/app/dashboard/README.md | 8 +++--- src/app/dashboard/profile/README.md | 2 ++ src/app/dashboard/profile/page.tsx | 12 ++++----- .../profile/profile-page.dom.test.tsx | 14 ---------- .../dashboard/qkit-earn-settings.dom.test.tsx | 21 +++------------ src/app/dashboard/qkit-earn-settings.tsx | 14 ---------- src/app/dashboard/settings-actions.ts | 11 +------- .../dashboard/settings-lifecycle.dom.test.tsx | 1 - supabase/migrations/0072_qkit_earn_free.sql | 26 +++++++++++++++++++ supabase/migrations/README.md | 3 ++- supabase/tests/README.md | 2 +- supabase/tests/qkit-earn-offer.test.sql | 19 +++++++------- test/app/README.md | 2 +- test/app/save-qkit-earn-config-action.test.ts | 23 +++++++++------- 17 files changed, 76 insertions(+), 94 deletions(-) create mode 100644 supabase/migrations/0072_qkit_earn_free.sql diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b37d633..56995ef1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to loopkit are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). +## [0.6.5] - 2026-12-02 + +### Changed + +- Stamps earned from qkit orders are now Free. The dashboard qkit setting no longer asks for Pro, `saveQkitEarnConfigAction` no longer checks the plan, and migration `0072` drops the `is_pro` check from `qkit_earn_resolve_program`, so a free vendor's stamp program shows on every qkit order by default too. The program-count limit and other Pro features are unchanged. Migration `0072` must be applied to hosted staging and prod by hand. + ## [0.6.4] - 2026-12-01 ### Changed diff --git a/README.md b/README.md index 0f815d06..5be92d67 100644 --- a/README.md +++ b/README.md @@ -390,8 +390,8 @@ flips it from a switch there (`src/app/dashboard/customer-notify-settings.tsx`, under RLS (`for all` own-row policy, not service-role-only). See `docs/superpowers/specs/2026-08-16-customer-notify-vendor-toggle-design.md`. -Separately, every Pro vendor with a stamp program shows it on qkit orders by default and can switch it off -(migration `0071`; a vendor with no `qkit_earn_config` row offers its oldest active stamp program) +Separately, every vendor with a stamp program (Free or Pro) shows it on qkit orders by default and can switch it off +(migrations `0071`, `0072`; a vendor with no `qkit_earn_config` row offers its oldest active stamp program) so customers can earn a stamp from a completed qkit order (`src/app/dashboard/qkit-earn-settings.tsx`) — this is a pull-model claim link, not push automation: qkit shows a stamp card on the diff --git a/package.json b/package.json index 0ab39737..2a3d0acf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "loopkit", - "version": "0.6.4", + "version": "0.6.5", "private": true, "packageManager": "pnpm@11.10.0", "engines": { diff --git a/src/app/dashboard/README.md b/src/app/dashboard/README.md index 53f52443..19b381a5 100644 --- a/src/app/dashboard/README.md +++ b/src/app/dashboard/README.md @@ -13,7 +13,7 @@ Shared controls and `cn` used by this folder's modules are imported from `@merqo - `stamp-actions.ts` — server actions that change a card: `stampAction` (`add_stamp`, `rewardReady` via `getProgress` so every type's engine decides), `adjustStampAction` (manual `±` correction with a required reason via `loopkit.adjust_stamp`, free-tier), `recordVisitAction` (engine play path for Lucky Tap/Sprout with a server-side roll and `record_visit_checked`), `redeemPlantAction` and `regenerateCardAction` (credential rotation that keeps progress) - `lookup-actions.ts` — read-only server actions: `resolveTokenAction` (scanned token to a `kind: "card" | "voucher"` result, falling back to `voucher_by_token` on a card miss) and `lookupAction` (a card's per-type progress by phone, no visit recorded) - `redeem-actions.ts` — server actions that redeem: `redeemAction` (resets a full card, then alerts the vendor on Telegram and the customer when `vendor_notify_settings` allows it; a missing row means on and notify failures never change the result), `redeemVoucherAction` (catalog-mode Points Club voucher via `redeem_voucher_by_token`, mapping `already_redeemed`/`expired` to friendly copy) and `applyPointsOffsetAction` (offset-mode points deduction returning the dollar figure) -- `settings-actions.ts` — vendor settings actions: `saveQkitEarnConfigAction` (Pro-gated qkit-order earn program) and `saveCustomerNotifySettingsAction` (customer redemption-notify toggle, not Pro-gated), both upserting on `vendor_id` +- `settings-actions.ts` — vendor settings actions: `saveQkitEarnConfigAction` (qkit-order earn program, Free for every vendor) and `saveCustomerNotifySettingsAction` (customer redemption-notify toggle, not Pro-gated), both upserting on `vendor_id` - `activity/` - `card-link.tsx` — client `CardLinkActions`: copy-link (`@merqo/ui`'s `CopyButton`, keeping the sonner toasts) and print-QR buttons for the shop QR block - `card.ts` — exports the shared `StampCard` type `{ id, phone, stamp_count }` used across actions and form components @@ -44,8 +44,8 @@ Shared controls and `cn` used by this folder's modules are imported from `@merqo - `referrals/` - `points-offset-form.dom.test.tsx` — jsdom tests for `PointsOffsetForm`: input defaults to the card's full balance and Apply calls through, Apply disables once the entered amount exceeds the card's balance - `points-offset-form.tsx` — client `PointsOffsetForm`: a small inline apply-points form (not an AlertDialog like `redeem-button.tsx`/`redeem-voucher/`'s confirm screen, since there's a number to pick here) — calls `applyPointsOffsetAction` and reports the updated card plus the dollar figure back to the caller for the vendor to apply manually at their own register -- `qkit-earn-settings.dom.test.tsx` — jsdom tests for `QkitEarnSettings`: the not-Pro note, the on-by-default switch and its every-qkit-order copy (never claiming the stamp is awarded automatically), the no-stamp-program note, and picking a program and toggling the switch -- `qkit-earn-settings.tsx` — client `QkitEarnSettings` form: switch + program picker that calls `saveQkitEarnConfigAction`, with a not-available note for non-Pro vendors. The stamp card shows on every qkit order by default (migration `0071`), and turning the switch off saves `enabled = false`. With no stamp program it shows a note to create one. Wrapped in `@merqo/ui`'s `ElevatedCard` +- `qkit-earn-settings.dom.test.tsx` — jsdom tests for `QkitEarnSettings`: the on-by-default switch and its every-qkit-order copy (never claiming the stamp is awarded automatically), the no-stamp-program note, and any vendor picking a program and toggling the switch +- `qkit-earn-settings.tsx` — client `QkitEarnSettings` form: switch + program picker that calls `saveQkitEarnConfigAction`. Free for every vendor. The stamp card shows on every qkit order by default (migration `0071`), and turning the switch off saves `enabled = false`. With no stamp program it shows a note to create one. Wrapped in `@merqo/ui`'s `ElevatedCard` - `redeem-button.dom.test.tsx` — jsdom test asserting `RedeemButton`'s confirm dialog shows the exact stamp count and carryover wording - `redeem-button.tsx` — client `RedeemButton`: ConfirmDialog-confirmed redeem control that calls `redeemAction` and reports the reset card back to the caller - `redeem-voucher/` @@ -86,7 +86,7 @@ Each page exports its own `metadata.title`, shown through the root `loopkit | %s card-link test pins the clipboard-failure copy. -`qkit-earn-settings.tsx` stays Pro-gated: the qkit stamp card is on for every Pro vendor with a stamp program until they switch it off. +`qkit-earn-settings.tsx` is Free: the qkit stamp card is on for every vendor with a stamp program until they switch it off. Dates and times on these pages render through `@merqo/ui`'s `formatDate`/`formatDateTime` (Singapore time). diff --git a/src/app/dashboard/profile/README.md b/src/app/dashboard/profile/README.md index 4f8b38ae..7ed99855 100644 --- a/src/app/dashboard/profile/README.md +++ b/src/app/dashboard/profile/README.md @@ -47,3 +47,5 @@ profile-form.errors test pins the "Could not save" and "do not match" copy. This folder now imports its shared page and dialog components from `@merqo/ui` (v0.42.1) instead of local copies. - `loading.tsx` uses `ListSkeleton` from `@merqo/ui`. + +The qkit stamp setting is free for every vendor and defaults to the oldest active stamp program; the page no longer reads the plan. diff --git a/src/app/dashboard/profile/page.tsx b/src/app/dashboard/profile/page.tsx index cca522c8..b4433371 100644 --- a/src/app/dashboard/profile/page.tsx +++ b/src/app/dashboard/profile/page.tsx @@ -4,7 +4,7 @@ import { getVendorProfile } from "@/lib/vendor"; import { createServerClient } from "@/lib/supabase/server"; import { getOrCreateVendorProfile } from "@/lib/merqo-vendor-profile"; import { ProfileForm } from "@/app/dashboard/profile/profile-form"; -import { listPrograms, isPro } from "@/lib/program"; +import { listPrograms } from "@/lib/program"; import { QkitEarnSettings } from "@/app/dashboard/qkit-earn-settings"; import { CustomerNotifySettings } from "@/app/dashboard/customer-notify-settings"; import type { SocialLinks } from "@/lib/types"; @@ -18,10 +18,9 @@ export default async function ProfilePage() { const profile = await getVendorProfile(); const supabase = await createServerClient(); - const [programs, pro, qkitEarnConfigResult, notifySettingsResult] = + const [programs, qkitEarnConfigResult, notifySettingsResult] = await Promise.all([ listPrograms(), - isPro(), supabase .from("qkit_earn_config") .select("program_id, enabled") @@ -37,9 +36,9 @@ export default async function ProfilePage() { const qkitPrograms = programs.filter( (prog) => prog.type === "stamp" && prog.active, ); - // Mirrors qkit_earn_resolve_program: with no saved row a Pro vendor's oldest - // active stamp program is already on. - const defaultProgram = pro ? qkitPrograms[0] : undefined; + // Mirrors qkit_earn_resolve_program: with no saved row the oldest active + // stamp program is already on. + const defaultProgram = qkitPrograms[0]; let qkitCurrent: { programId: string; enabled: boolean } | null = null; if (qkitEarnConfig) { qkitCurrent = { @@ -99,7 +98,6 @@ export default async function ProfilePage() { name: prog.name, }))} current={qkitCurrent} - isPro={pro} />
diff --git a/src/app/dashboard/profile/profile-page.dom.test.tsx b/src/app/dashboard/profile/profile-page.dom.test.tsx index f90d9f83..911a46e7 100644 --- a/src/app/dashboard/profile/profile-page.dom.test.tsx +++ b/src/app/dashboard/profile/profile-page.dom.test.tsx @@ -19,7 +19,6 @@ vi.mock("@/lib/program", () => ({ { id: "p1", name: "Coffee Stamps", type: "stamp", active: true }, { id: "p2", name: "Lucky Wheel", type: "wheel" }, ]), - isPro: vi.fn(async () => true), })); const qkitMaybeSingle = vi.fn( async (): Promise<{ @@ -49,14 +48,12 @@ vi.mock("@/app/dashboard/qkit-earn-settings", () => ({ QkitEarnSettings: (props: { programs: { id: string; name: string }[]; current: { programId: string; enabled: boolean } | null; - isPro: boolean; }) => (
{props.programs.map((p) => p.name).join(",")} / current: {props.current ? `${props.current.programId}:${String(props.current.enabled)}` : "none"}{" "} - / pro:{String(props.isPro)}
), })); @@ -132,17 +129,6 @@ describe("ProfilePage", () => { ); }); - it("does not default the qkit stamp on for a non-Pro vendor", async () => { - const { isPro } = await import("@/lib/program"); - vi.mocked(isPro).mockResolvedValueOnce(false); - - render(await ProfilePage()); - - expect(screen.getByTestId("qkit-earn-settings")).toHaveTextContent( - "current:none / pro:false", - ); - }); - it("keeps the qkit stamp card off when the saved row says so", async () => { qkitMaybeSingle.mockResolvedValueOnce({ data: { program_id: "p1", enabled: false }, diff --git a/src/app/dashboard/qkit-earn-settings.dom.test.tsx b/src/app/dashboard/qkit-earn-settings.dom.test.tsx index 531599d5..56453e60 100644 --- a/src/app/dashboard/qkit-earn-settings.dom.test.tsx +++ b/src/app/dashboard/qkit-earn-settings.dom.test.tsx @@ -8,25 +8,11 @@ vi.mock("./settings-actions", () => ({ })); describe("QkitEarnSettings", () => { - it("shows a not-available note instead of the form when not Pro", () => { - render( - , - ); - expect(screen.getByText(/not available yet/i)).toBeInTheDocument(); - expect(screen.queryByRole("link")).not.toBeInTheDocument(); - expect(screen.queryByRole("combobox")).not.toBeInTheDocument(); - }); - it("says a stamp card shows on every qkit order and is not automatic", () => { render( , ); expect(screen.getByText(/shows on every qkit order/i)).toBeInTheDocument(); @@ -34,18 +20,17 @@ describe("QkitEarnSettings", () => { expect(screen.queryByText(/automatically/i)).not.toBeInTheDocument(); }); - it("asks a Pro vendor for a stamp program when there is none", () => { - render(); + it("asks a vendor for a stamp program when there is none", () => { + render(); expect(screen.getByText(/create a stamp program/i)).toBeInTheDocument(); expect(screen.queryByRole("switch")).not.toBeInTheDocument(); }); - it("lets a Pro vendor pick a program and enable it", () => { + it("lets any vendor pick a program and enable it", () => { render( , ); expect(screen.getByRole("combobox")).toBeInTheDocument(); diff --git a/src/app/dashboard/qkit-earn-settings.tsx b/src/app/dashboard/qkit-earn-settings.tsx index 5ce238b3..67e310f3 100644 --- a/src/app/dashboard/qkit-earn-settings.tsx +++ b/src/app/dashboard/qkit-earn-settings.tsx @@ -20,26 +20,12 @@ type Program = { id: string; name: string }; export function QkitEarnSettings({ programs, current, - isPro, }: { programs: Program[]; current: { programId: string; enabled: boolean } | null; - isPro: boolean; }) { const { pending, save } = useSaveSettings(saveQkitEarnConfigAction); - if (!isPro) { - return ( - -

- Let customers claim a stamp after completing a qkit order, they get a - link on their order page and enter their phone number to collect it. -

-

Qkit stamp earning is not available yet.

-
- ); - } - if (programs.length === 0) { return ( diff --git a/src/app/dashboard/settings-actions.ts b/src/app/dashboard/settings-actions.ts index ea4f9601..9537fcfc 100644 --- a/src/app/dashboard/settings-actions.ts +++ b/src/app/dashboard/settings-actions.ts @@ -2,7 +2,6 @@ import { revalidatePath } from "next/cache"; import { requireVendor } from "@/features/auth"; -import { isPro } from "@/lib/program"; import { createServerClient } from "@/lib/supabase/server"; import type { ActionResult } from "@merqo/ui/kit-api"; @@ -12,19 +11,11 @@ export type QkitEarnConfigResult = ActionResult<{ }>; // Vendor-owned setting: which stamp program (if any) earns a stamp when a -// customer completes a qkit order. Pro-gated, same tier check as the -// program-count limit (isPro from @/lib/program). +// customer completes a qkit order. Free for every vendor. export async function saveQkitEarnConfigAction( formData: FormData, ): Promise { const { user } = await requireVendor(); - const pro = await isPro(); - if (!pro) { - return { - success: false, - error: "Qkit stamp earning is not available yet.", - }; - } const enabled = formData.get("enabled") === "on"; const programId = String(formData.get("program_id") ?? ""); diff --git a/src/app/dashboard/settings-lifecycle.dom.test.tsx b/src/app/dashboard/settings-lifecycle.dom.test.tsx index 6adae8b2..f4f666b6 100644 --- a/src/app/dashboard/settings-lifecycle.dom.test.tsx +++ b/src/app/dashboard/settings-lifecycle.dom.test.tsx @@ -35,7 +35,6 @@ describe.each(["notify", "earn"] as const)( , ); } diff --git a/supabase/migrations/0072_qkit_earn_free.sql b/supabase/migrations/0072_qkit_earn_free.sql new file mode 100644 index 00000000..ac80d8b7 --- /dev/null +++ b/supabase/migrations/0072_qkit_earn_free.sql @@ -0,0 +1,26 @@ +-- With no config row, the oldest active stamp program is offered on any plan. +create or replace function loopkit.qkit_earn_resolve_program(p_vendor uuid) +returns uuid +language sql +stable +security definer +set search_path = '' +as $$ + select case + when exists (select 1 from loopkit.qkit_earn_config c where c.vendor_id = p_vendor) then ( + select p.id + from loopkit.qkit_earn_config c + join loopkit.programs p on p.id = c.program_id and p.vendor_id = c.vendor_id + where c.vendor_id = p_vendor and c.enabled and p.active and p.type = 'stamp' + ) + else ( + select p.id + from loopkit.programs p + where p.vendor_id = p_vendor and p.active and p.type = 'stamp' + order by p.created_at, p.id + limit 1 + ) + end; +$$; + +revoke all on function loopkit.qkit_earn_resolve_program(uuid) from public, anon, authenticated, service_role; diff --git a/supabase/migrations/README.md b/supabase/migrations/README.md index 8b9f2b80..a73409c7 100644 --- a/supabase/migrations/README.md +++ b/supabase/migrations/README.md @@ -81,6 +81,7 @@ exception. - `0068_drop_vendor_pro.sql`: drops `loopkit.vendor_pro`. Apply `0066` to `0068` together. - `0069_drop_pricing.sql`: drops `loopkit.pricing`; merqo owns plans and pricing. - `0070_drop_upgrade_requests.sql`: drops `loopkit.upgrade_requests`; the upgrade inbox is gone. -- `0071_qkit_earn_default_stamp.sql`: `loopkit.qkit_earn_resolve_program(uuid)` picks the program a qkit order stamps: the `qkit_earn_config` program while enabled, active and a stamp program, or with no row, for a Pro vendor (`loopkit.is_pro`), the vendor's oldest active stamp program. `qkit_earn_offer`, `qkit_earn_lookup` and `qkit_earn_commit` use it, so the stamp shows on every qkit order by default and `enabled = false` still turns it off. The offer adds `reward_label`, `stamps_goal` and `stamps_per_order` (always 1) and returns only `{enabled: false}` for vendors with no stamp program. +- `0071_qkit_earn_default_stamp.sql`: `loopkit.qkit_earn_resolve_program(uuid)` picks the program a qkit order stamps: the `qkit_earn_config` program while enabled, active and a stamp program, or with no row, the vendor's oldest active stamp program. `qkit_earn_offer`, `qkit_earn_lookup` and `qkit_earn_commit` use it, so the stamp shows on every qkit order by default and `enabled = false` still turns it off. The offer adds `reward_label`, `stamps_goal` and `stamps_per_order` (always 1) and returns only `{enabled: false}` for vendors with no stamp program. +- `0072_qkit_earn_free.sql`: qkit-order stamps are Free. `qkit_earn_resolve_program` drops the `loopkit.is_pro` check from 0071, so a vendor with no `qkit_earn_config` row defaults to its oldest active stamp program on any plan. Prepared audit migrations require database validation and rollout review before deployment. diff --git a/supabase/tests/README.md b/supabase/tests/README.md index 1cacd2bd..64f951aa 100644 --- a/supabase/tests/README.md +++ b/supabase/tests/README.md @@ -16,7 +16,7 @@ fixtures have not yet been executed in this checkout. - `customer-capability.test.sql` and `earn-customer-capability.test.sql` exercise customer and earn proofs; `retired-rpc-permissions.test.sql` checks retired RPC grants. -- `qkit-earn-offer.test.sql` checks that only the service role can call `qkit_earn_offer`, that it answers enabled, disabled and unknown vendors with the reward, goal and stamps-per-order keys, that a Pro vendor with no config row defaults to its oldest active stamp program while a non-Pro vendor offers nothing and cannot claim, that an explicit off stays off, that a claim with no config row works once per order, and that it exposes no customer data. +- `qkit-earn-offer.test.sql` checks that only the service role can call `qkit_earn_offer`, that it answers enabled, disabled and unknown vendors with the reward, goal and stamps-per-order keys, that a vendor with no config row, Pro or free, defaults to its oldest active stamp program and can claim, that an explicit off stays off, that a claim with no config row works once per order, and that it exposes no customer data. - `reward-rpc.test.sql`, `plant-redemption.test.sql` and `plant-redemption-parity.test.sql` exercise reward state and redemption contracts. - `anon-abuse-limits.test.sql` covers the `0064` limiter (grants, RLS, window counting) and the 5-per-day referral credit cap, including retry of a reserved guest, the cap resetting, a past window not carrying its count and out-of-range parameters being rejected. diff --git a/supabase/tests/qkit-earn-offer.test.sql b/supabase/tests/qkit-earn-offer.test.sql index 9eee3734..9fa512b9 100644 --- a/supabase/tests/qkit-earn-offer.test.sql +++ b/supabase/tests/qkit-earn-offer.test.sql @@ -70,12 +70,12 @@ select is( select is( loopkit.qkit_earn_offer('00620000-0000-0000-0000-000000000003'), '{"enabled": true, "program_name": "Oldest Club", "reward_label": "Free kopi", "stamps_goal": 6, "stamps_per_order": 1}'::jsonb, - 'a Pro vendor with no config row defaults on with the oldest active stamp program' + 'a vendor with no config row defaults on with the oldest active stamp program' ); select is( loopkit.qkit_earn_offer('00620000-0000-0000-0000-000000000005'), - '{"enabled": false}'::jsonb, - 'a non-Pro vendor with no config row offers nothing' + '{"enabled": true, "program_name": "Free Club", "reward_label": "Snack", "stamps_goal": 10, "stamps_per_order": 1}'::jsonb, + 'a free vendor with no config row defaults on with its stamp program' ); select is( loopkit.qkit_earn_offer('00620000-0000-0000-0000-000000000004'), @@ -104,11 +104,10 @@ select throws_ok( 'not configured', 'a vendor who turned earning off cannot be claimed against' ); -select throws_ok( - $$select loopkit.customer_qkit_earn_claim('00620000-0000-0000-0000-000000000103', '+6591110064', 'Guest', null)$$, - 'P0001', - 'not configured', - 'a non-Pro vendor with no config row cannot be claimed against' +select is( + (loopkit.customer_qkit_earn_claim('00620000-0000-0000-0000-000000000103', '+6591110064', 'Guest', null)->>'stamp_count')::int, + 1, + 'a free vendor with no config row can be claimed against' ); reset role; select is( @@ -118,8 +117,8 @@ select is( ); select is( (select count(*) from loopkit.qkit_earn_events), - 1::bigint, - 'reading offers writes nothing and the order is claimed once' + 2::bigint, + 'reading offers writes nothing and each order is claimed once' ); select * from finish(); diff --git a/test/app/README.md b/test/app/README.md index 237fc481..0bd9db1a 100644 --- a/test/app/README.md +++ b/test/app/README.md @@ -15,7 +15,7 @@ Supabase clients and `@/lib` collaborators mocked via `vi.mock`/`vi.hoisted`. - `profile-actions.test.ts` — vendor `/profile` action: `saveStallName` call after `requireVendor` - Token resolution cases live in `dashboard-actions.test.ts` (importing from the split `stamp-actions`, `lookup-actions` and `redeem-actions` modules), including empty-input rejection without an RPC and card-to-voucher fallback - `save-customer-notify-settings-action.test.ts` — `saveCustomerNotifySettingsAction`: upserts `vendor_notify_settings.customer_telegram_notify_enabled` true/false depending on the submitted checkbox state (an unchecked checkbox submits no field at all, resolving to `false`), returns a generic error without throwing when the upsert fails -- `save-qkit-earn-config-action.test.ts` — `saveQkitEarnConfigAction`: a vendor whose plan lacks qkit stamp earning gets "Qkit stamp earning is not available yet." and nothing is written. +- `save-qkit-earn-config-action.test.ts` — `saveQkitEarnConfigAction`: any vendor can save the setting (no plan check) and a missing program is rejected without a write. - `save-program-action.test.ts` — `saveProgramAction`: create/update dispatch, free/Pro entitlement gate, RPC call shape; a free vendor is blocked (create or edit) from a non-stamp mechanic, a premium stamp style, or a custom stamp color, while a Pro vendor can save any of them - `serve-customer.test.tsx` — jsdom: the vendor Counter serve flow (stamp/record-visit/lookup/redeem-plant end to end; the cup-variant plant lookup asserts via `Cup`'s `data-cup-coffee` hook, not an implementation detail of its old stroked-outline shape; its fixture uses the current "Half Full" cup stage name, not the old "Quarter Full"). Since the scan-first recompose it mocks `@/app/dashboard/counter/scan-hero` (exposing the same two scan buttons the old `scan-button` mock did) and passes `ServeCustomer`'s `shopName`/`shopJoinQrSvg`/`shopJoinLink` props via a shared `shop` fixture at every render site diff --git a/test/app/save-qkit-earn-config-action.test.ts b/test/app/save-qkit-earn-config-action.test.ts index c0ad501b..37af620f 100644 --- a/test/app/save-qkit-earn-config-action.test.ts +++ b/test/app/save-qkit-earn-config-action.test.ts @@ -1,13 +1,11 @@ import { describe, it, expect, vi, beforeEach } from "vitest"; -const { requireVendorMock, isProMock, upsertMock } = vi.hoisted(() => ({ +const { requireVendorMock, upsertMock } = vi.hoisted(() => ({ requireVendorMock: vi.fn(), - isProMock: vi.fn(), upsertMock: vi.fn(), })); vi.mock("@/features/auth", () => ({ requireVendor: requireVendorMock })); -vi.mock("@/lib/program", () => ({ isPro: isProMock })); vi.mock("next/cache", () => ({ revalidatePath: vi.fn() })); vi.mock("@/lib/supabase/server", () => ({ createServerClient: vi.fn(async () => ({ @@ -30,17 +28,22 @@ describe("saveQkitEarnConfigAction", () => { upsertMock.mockResolvedValue({ error: null }); }); - it("states the plan limit without asking the vendor to upgrade", async () => { - isProMock.mockResolvedValue(false); - + it("saves the setting for any vendor without a plan check", async () => { const res = await saveQkitEarnConfigAction( form({ enabled: "on", program_id: "p1" }), ); - expect(res).toEqual({ - success: false, - error: "Qkit stamp earning is not available yet.", - }); + expect(res.success).toBe(true); + expect(upsertMock).toHaveBeenCalledWith( + { vendor_id: "v1", program_id: "p1", enabled: true }, + { onConflict: "vendor_id" }, + ); + }); + + it("asks for a program before saving", async () => { + const res = await saveQkitEarnConfigAction(form({ enabled: "on" })); + + expect(res).toEqual({ success: false, error: "Pick a program first." }); expect(upsertMock).not.toHaveBeenCalled(); }); }); From 2027835ed1b8db4c0e9436739779ce653808fede Mon Sep 17 00:00:00 2001 From: Clarence Lee <35331421+cljiahao@users.noreply.github.com> Date: Wed, 2 Dec 2026 01:43:32 +0800 Subject: [PATCH 3/3] chore: re-pin @merqo/ui to v0.68.0 and refresh READMEs (#294) Co-authored-by: Claude Sonnet 5.5 --- CHANGELOG.md | 7 +++++++ README.md | 4 +++- package.json | 4 ++-- pnpm-lock.yaml | 12 ++++++------ pnpm-workspace.yaml | 2 +- src/app/dashboard/README.md | 2 +- src/app/dashboard/dashboard-nav.dom.test.tsx | 6 ++---- src/features/card-check/components/README.md | 2 ++ 8 files changed, 24 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56995ef1..a94151d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to loopkit are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). +## [0.7.0] - 2026-12-02 + +### Changed + +- Updated `@merqo/ui` to v0.68.0. In the account menu, Text size is now a "Text size · 100%" submenu with a preset list (75% to 200%) under a new Preferences heading, replacing the inline A-/A+ buttons. +- Documented the shared storage and media-query helper move in the root and card-check component READMEs. + ## [0.6.5] - 2026-12-02 ### Changed diff --git a/README.md b/README.md index 5be92d67..11c7089a 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ Day keys, short dates and dollars-to-cents conversion come from `@merqo/ui` (`sgDayKey`, `formatShortDate`, `dollarsToCents`), not local helpers. +The visits trend, Counter last-program memory, "Serve a customer" button and retired-card notice read and write browser storage and media queries through `@merqo/ui`'s `readStored`/`writeStored`/`useMediaQuery` (see `src/features/card-check/components/README.md`). The account menu's Text size is a Preferences submenu from `@merqo/ui` v0.68.0. + Shared UI is pinned to audited commit `989d934c1cc8d957ff383934debf8ef083b6b6a4`. The lockfile and exact build allowlist select this same source, including image lifecycle cleanup, malformed storage-URL handling and bounded money inputs. `DESIGN.md` records loopkit's own public-page design values and links the shared rules, including the stamp card's current edge. @@ -53,7 +55,7 @@ output instead of a hand-copied string, so it can't drift from what the engine actually computes — see `../docs/superpowers/specs/2026-08-25-tour-example-badge-drift-fix-design.md` in the workspace root. Migrated onto -the shared `@merqo/ui` component package (pinned at v0.63.0, commit `13c3d3f9`, in `package.json`; email links land on `/auth/confirm`, see `src/app/auth/README.md`): the +the shared `@merqo/ui` component package (pinned at v0.68.0, commit `5a08fd87`, in `package.json`; email links land on `/auth/confirm`, see `src/app/auth/README.md`): the dashboard nav/account dropdown, `useAsyncAction`, `InfoTooltip`, `ImageUploader`, `DashboardTour`, the landing page's sticky header (`LandingNav`, via `src/components/landing/nav.tsx`), and diff --git a/package.json b/package.json index 2a3d0acf..d88acb0b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "loopkit", - "version": "0.6.5", + "version": "0.7.0", "private": true, "packageManager": "pnpm@11.10.0", "engines": { @@ -23,7 +23,7 @@ }, "dependencies": { "@hookform/resolvers": "5.2.2", - "@merqo/ui": "github:merqo-io/merqo-ui#8d2da3abcb4e5c3bab2b3a3482c740797e2d5c03", + "@merqo/ui": "github:merqo-io/merqo-ui#5a08fd875ad6c96f096fbcb4d56ed50eb238f33e", "@supabase/ssr": "^0.10.3", "@supabase/supabase-js": "2.110.0", "@zxing/browser": "^0.2.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7272aba5..7bdb3d73 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -32,8 +32,8 @@ importers: specifier: 5.2.2 version: 5.2.2(react-hook-form@7.81.0(react@19.2.7)) '@merqo/ui': - specifier: github:merqo-io/merqo-ui#8d2da3abcb4e5c3bab2b3a3482c740797e2d5c03 - version: https://codeload.github.com/merqo-io/merqo-ui/tar.gz/8d2da3abcb4e5c3bab2b3a3482c740797e2d5c03(@eslint-community/eslint-plugin-eslint-comments@4.8.1(eslint@9.39.4(jiti@2.7.0)))(@playwright/test@1.61.1)(@supabase/ssr@0.10.3(@supabase/supabase-js@2.110.0))(@supabase/supabase-js@2.110.0)(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(eslint-plugin-sonarjs@4.2.2(eslint@9.39.4(jiti@2.7.0)))(eslint@9.39.4(jiti@2.7.0))(next-themes@0.4.6(react-dom@19.2.7(react@19.2.7))(react@19.2.7))(next@16.4.6(@babel/core@7.29.7)(@playwright/test@1.61.1)(@types/node@24.13.2)(react-dom@19.2.7(react@19.2.7))(react@19.2.7))(radix-ui@1.6.1(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.2.7(react@19.2.7))(react@19.2.7))(react-dom@19.2.7(react@19.2.7))(react@19.2.7)(sonner@1.7.4(react-dom@19.2.7(react@19.2.7))(react@19.2.7))(tailwindcss@4.3.2)(zod@4.6.6) + specifier: github:merqo-io/merqo-ui#5a08fd875ad6c96f096fbcb4d56ed50eb238f33e + version: https://codeload.github.com/merqo-io/merqo-ui/tar.gz/5a08fd875ad6c96f096fbcb4d56ed50eb238f33e(@eslint-community/eslint-plugin-eslint-comments@4.8.1(eslint@9.39.4(jiti@2.7.0)))(@playwright/test@1.61.1)(@supabase/ssr@0.10.3(@supabase/supabase-js@2.110.0))(@supabase/supabase-js@2.110.0)(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(eslint-plugin-sonarjs@4.2.2(eslint@9.39.4(jiti@2.7.0)))(eslint@9.39.4(jiti@2.7.0))(next-themes@0.4.6(react-dom@19.2.7(react@19.2.7))(react@19.2.7))(next@16.4.6(@babel/core@7.29.7)(@playwright/test@1.61.1)(@types/node@24.13.2)(react-dom@19.2.7(react@19.2.7))(react@19.2.7))(radix-ui@1.6.1(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.2.7(react@19.2.7))(react@19.2.7))(react-dom@19.2.7(react@19.2.7))(react@19.2.7)(sonner@1.7.4(react-dom@19.2.7(react@19.2.7))(react@19.2.7))(tailwindcss@4.3.2)(zod@4.6.6) '@supabase/ssr': specifier: ^0.10.3 version: 0.10.3(@supabase/supabase-js@2.110.0) @@ -972,9 +972,9 @@ packages: '@jridgewell/trace-mapping@0.3.31': resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==} - '@merqo/ui@https://codeload.github.com/merqo-io/merqo-ui/tar.gz/8d2da3abcb4e5c3bab2b3a3482c740797e2d5c03': - resolution: {gitHosted: true, tarball: https://codeload.github.com/merqo-io/merqo-ui/tar.gz/8d2da3abcb4e5c3bab2b3a3482c740797e2d5c03} - version: 0.67.0 + '@merqo/ui@https://codeload.github.com/merqo-io/merqo-ui/tar.gz/5a08fd875ad6c96f096fbcb4d56ed50eb238f33e': + resolution: {gitHosted: true, integrity: sha512-VQhYGj8jL65lLuWUAgLjZpy4PlzzLW1+uCs9kUJ1tphR910N9aZlsEPpnVlyQwg1H1XHyYG8w0UqZXGiQXiMLQ==, tarball: https://codeload.github.com/merqo-io/merqo-ui/tar.gz/5a08fd875ad6c96f096fbcb4d56ed50eb238f33e} + version: 0.68.0 engines: {node: '>=24'} peerDependencies: '@eslint-community/eslint-plugin-eslint-comments': '>=4.8.1' @@ -5536,7 +5536,7 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.5 - '@merqo/ui@https://codeload.github.com/merqo-io/merqo-ui/tar.gz/8d2da3abcb4e5c3bab2b3a3482c740797e2d5c03(@eslint-community/eslint-plugin-eslint-comments@4.8.1(eslint@9.39.4(jiti@2.7.0)))(@playwright/test@1.61.1)(@supabase/ssr@0.10.3(@supabase/supabase-js@2.110.0))(@supabase/supabase-js@2.110.0)(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(eslint-plugin-sonarjs@4.2.2(eslint@9.39.4(jiti@2.7.0)))(eslint@9.39.4(jiti@2.7.0))(next-themes@0.4.6(react-dom@19.2.7(react@19.2.7))(react@19.2.7))(next@16.4.6(@babel/core@7.29.7)(@playwright/test@1.61.1)(@types/node@24.13.2)(react-dom@19.2.7(react@19.2.7))(react@19.2.7))(radix-ui@1.6.1(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.2.7(react@19.2.7))(react@19.2.7))(react-dom@19.2.7(react@19.2.7))(react@19.2.7)(sonner@1.7.4(react-dom@19.2.7(react@19.2.7))(react@19.2.7))(tailwindcss@4.3.2)(zod@4.6.6)': + '@merqo/ui@https://codeload.github.com/merqo-io/merqo-ui/tar.gz/5a08fd875ad6c96f096fbcb4d56ed50eb238f33e(@eslint-community/eslint-plugin-eslint-comments@4.8.1(eslint@9.39.4(jiti@2.7.0)))(@playwright/test@1.61.1)(@supabase/ssr@0.10.3(@supabase/supabase-js@2.110.0))(@supabase/supabase-js@2.110.0)(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(eslint-plugin-sonarjs@4.2.2(eslint@9.39.4(jiti@2.7.0)))(eslint@9.39.4(jiti@2.7.0))(next-themes@0.4.6(react-dom@19.2.7(react@19.2.7))(react@19.2.7))(next@16.4.6(@babel/core@7.29.7)(@playwright/test@1.61.1)(@types/node@24.13.2)(react-dom@19.2.7(react@19.2.7))(react@19.2.7))(radix-ui@1.6.1(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.2.7(react@19.2.7))(react@19.2.7))(react-dom@19.2.7(react@19.2.7))(react@19.2.7)(sonner@1.7.4(react-dom@19.2.7(react@19.2.7))(react@19.2.7))(tailwindcss@4.3.2)(zod@4.6.6)': dependencies: '@icons-pack/react-simple-icons': 13.13.0(react@19.2.7) class-variance-authority: 0.7.1 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 02e33a7f..026bbf75 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,5 +1,5 @@ allowBuilds: - "@merqo/ui@https://codeload.github.com/merqo-io/merqo-ui/tar.gz/8d2da3abcb4e5c3bab2b3a3482c740797e2d5c03": true + "@merqo/ui@https://codeload.github.com/merqo-io/merqo-ui/tar.gz/5a08fd875ad6c96f096fbcb4d56ed50eb238f33e": true supabase: true esbuild: true sharp: true diff --git a/src/app/dashboard/README.md b/src/app/dashboard/README.md index 19b381a5..25a48238 100644 --- a/src/app/dashboard/README.md +++ b/src/app/dashboard/README.md @@ -92,6 +92,6 @@ Dates and times on these pages render through `@merqo/ui`'s `formatDate`/`format - Route `loading.tsx` files use `@merqo/ui`'s `ListSkeleton` and `StatTileSkeleton` (each a `role="status"` region with its own sr-only label) under `components/loading-header.tsx`. `visits-bars.tsx` imports `formatShortDate` from `@merqo/ui` (the local `lib/format.ts` re-export is gone). It is a client component (its server caller `stats/visits-chart.tsx` and the client `overview/visits-trend.tsx` import it unchanged): bars are 44px tap targets on coarse pointers in a horizontally scrollable row, and a status line shows the tapped day's date and count, because a `title` never shows on touch. `plan/page.tsx` uses `PageHeader`; `serve-customer.tsx` no longer passes `pending` to `ActiveCard`. `counter/use-serve-customer.ts`'s `confirmRedeemPlant` and `confirmRegenerate` return promises that reject on failure so `ConfirmDialog` stays open with the message inline. -The account menu shows the shared "Text size" row (A-, 100%, A+): `dashboard-nav.tsx` passes `textSizeKey="loopkit:scale:dashboard"` to `SharedDashboardNav` (`@merqo/ui` v0.67.0), so the scale applies to the dashboard only and persists per browser. +The account menu shows the shared "Text size · 100%" submenu (a preset list under the Preferences label): `dashboard-nav.tsx` passes `textSizeKey="loopkit:scale:dashboard"` to `SharedDashboardNav` (`@merqo/ui` v0.68.0), so the scale applies to the dashboard only and persists per browser. `scan-button.tsx` renders its link and hero variants with the shared `Button` (44px minimum height) instead of native buttons. diff --git a/src/app/dashboard/dashboard-nav.dom.test.tsx b/src/app/dashboard/dashboard-nav.dom.test.tsx index d4a82ccb..72d1d18d 100644 --- a/src/app/dashboard/dashboard-nav.dom.test.tsx +++ b/src/app/dashboard/dashboard-nav.dom.test.tsx @@ -115,12 +115,10 @@ describe("DashboardNav", () => { "Feedback", "Programs", "Theme · System", - "A-", - "100%", - "A+", + "Text size · 100%", "Sign out", ]); - expect(screen.getByText("Text size")).toBeInTheDocument(); + expect(screen.getByText("Preferences")).toBeInTheDocument(); }); it("shows the tier badge behind the opened account menu", async () => { diff --git a/src/features/card-check/components/README.md b/src/features/card-check/components/README.md index 535af4d7..d00aeacf 100644 --- a/src/features/card-check/components/README.md +++ b/src/features/card-check/components/README.md @@ -24,3 +24,5 @@ Every `dangerouslySetInnerHTML` here is `qrSvg()` output over a server-minted to Customer-facing copy has no emoji or contractions. `birthday-field.tsx` uses the shared Select for month and day (44px triggers) and `check-form.tsx` renders "Change number" with the shared `Button`. + +`program-card-status.tsx` (retired-card notice) uses the shared `readStored`/`writeStored`/`useMediaQuery` helpers from `@merqo/ui` instead of local storage and media-query code, as do the visits trend, remember-program and serve-cta modules elsewhere in this slice.