Skip to content

Sweep: migrate remaining user-share URL builders to shareableUrl #2011

Description

@Hugo0

Context

PR #2010 introduced `shareableUrl(path)` in `src/utils/url.utils.ts` and migrated the receipt + history + invite + payment-request link builders so a share copied from staging stays on staging (was: silently rewritten to peanut.me whenever `NEXT_PUBLIC_BASE_URL` wasn't set).

The simplify-pass reviewer turned up ~8 other call sites with the same bug class. They were scoped out of #2010 to keep the PR focused but should follow as a sweep.

What to migrate

All construct user-shareable URLs from `BASE_URL` (or `process.env.NEXT_PUBLIC_BASE_URL`) and should use `shareableUrl(path)` instead:

  • `src/components/Create/useCreateLink.tsx:107` — `/claim` link
  • `src/components/Badges/BadgeStatusDrawer.tsx:31` — profile share link
  • `src/components/Global/DirectSendQR/index.tsx:191` — `/pay/` QR target
  • `src/components/Profile/components/ProfileHeader.tsx:35` — profile URL
  • `src/components/Request/link/views/Create.request.link.view.tsx:118` — request link
  • `src/app/(mobile-ui)/qr/[code]/success/page.tsx:26` — QR success URL
  • `src/features/payments/flows/semantic-request/views/SemanticRequestReceiptView.tsx:47` — receipt share URL
  • `src/features/payments/shared/components/PaymentSuccessView.tsx:151` — receipt share URL

What NOT to touch (legitimately server/build-baked)

  • `src/app/manifest.ts`, `src/app/sitemap.ts`, `src/app/robots.ts`, `src/app/metadata.ts` — SEO/PWA, build-time canonical required
  • `src/app/api/health/route.ts` + `SELF_URL` — server-side fetch
  • `src/components/Global/ImageGeneration/LinkPreview.tsx` — OG image SSR
  • `src/components/Marketing/ContentPage.tsx:32` — JSON-LD breadcrumbs (SEO canonical)
  • `src/components/Setup/Views/InstallPWA.tsx:243` — install QR (intentionally canonical)
  • `src/components/Global/GeneralRecipientInput/index.tsx:50,93` — parsing pasted URLs, not building
  • `src/utils/capacitor.ts:78` — native deep-link base
  • `src/components/Global/ConsoleGreeting/index.tsx` — marketing console log

Acceptance

  • Each migration uses `shareableUrl(`/...`)` from `@/utils/url.utils`.
  • Any test asserting a hard-coded `peanut.example.org` / `peanut.me` host gets a small `beforeAll`/`afterAll` to set `window.location.origin` (see `general.utils.test.ts` after fix(receipt): trim CTA stack, host-aware share URLs, gate public page #2010 for the pattern).
  • After the sweep, `grep -rn '\${BASE_URL}' src` should only return SSR/SEO/build call sites.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions