Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions app/(shell)/home/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,16 @@ export default function HomePage() {
/>
</section>

{/* Action tiles. Sales/Export work from day one; Reports (X/Z
tooling) unlocks with the merchant profile. The Become a Merchant
entry is parked behind FEATURES.becomeMerchant for R1. */}
{/* Action tiles. Sales works from day one; Reports (X/Z tooling)
unlocks with the merchant profile. Export CSV and the Become a
Merchant entry are parked behind FEATURES.becomeMerchant for R1 —
the export screen itself is untouched and still routable by URL,
so flipping the flag brings the tile straight back. */}
<section className="px-6 grid grid-cols-2 gap-4">
<HomeTile icon={TrendingUp} label="Sales" href="/home/sales" />
<HomeTile icon={ReceiptText} label="Export CSV" href="/home/export" />
{FEATURES.becomeMerchant && (
<HomeTile icon={ReceiptText} label="Export CSV" href="/home/export" />
)}
{merchant.completed && (
<HomeTile icon={ClipboardList} label="Reports" href="/home/reports" />
)}
Expand Down
17 changes: 12 additions & 5 deletions e2e/daily-reports.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,25 @@ test.describe('Daily reports page', () => {
await expect(empty.or(firstReport)).toBeVisible();
});

test('CSV export is reachable from home', async ({ testHost }) => {
test('CSV export keeps working while its Home tile is parked', async ({ testHost }) => {
const frame = await waitForAppReady(testHost);
await selectMerchantMode(frame);

// The app lands on Check out, so open the Home tab first.
await frame.getByRole('link', { name: 'Home', exact: true }).click();
await frame.locator('[data-testid="todays-income"]').waitFor();

// CSV export lives on the Home dashboard now — the Export CSV tile opens
// the report-generation screen. (The legacy Settings entry was removed in
// the Settings redesign; /settings/export is still routable by URL.)
await frame.getByRole('link', { name: 'Export CSV' }).click();
// R1 hides the Export CSV tile behind FEATURES.becomeMerchant (off by
// default), so nothing on Home leads to the export screen.
await expect(frame.getByRole('link', { name: 'Export CSV' })).toHaveCount(0);

// The screen itself is untouched and still routable by URL — flipping the
// flag back puts the tile on Home and lands here. (The legacy Settings
// entry was removed in the Settings redesign; /settings/export is still
// routable by URL too.)
await frame.locator('body').evaluate(() => {
window.location.href = '/home/export';
});
await expect(
frame.getByText('New report'),
).toBeVisible({ timeout: 30_000 });
Expand Down
10 changes: 6 additions & 4 deletions lib/config/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ function flag(env: string | undefined, fallback: boolean): boolean {
export const FEATURES = {
/**
* "Become a Merchant" onboarding entry points — the Home tile and the
* Settings card that lead into /merchant. Off for R1: the flow (and what it
* unlocks — Reports, Merchant Profile, Receipt, Show Items in Checkout) is
* built but parked until there is more to put behind it. The routes stay
* reachable by URL; only the buttons are gated.
* Settings card that lead into /merchant — plus the Home "Export CSV" tile.
* Off for R1: the flow (and what it unlocks — Reports, Merchant Profile,
* Receipt, Show Items in Checkout) is built but parked until there is more
* to put behind it. The routes stay reachable by URL; only the buttons are
* gated, so /home/export still generates, stores and saves CSV reports and
* comes back to Home the moment this flag flips.
*/
becomeMerchant: flag(process.env.NEXT_PUBLIC_FEATURE_BECOME_MERCHANT, false),

Expand Down
Loading