diff --git a/apps/frontend/e2e/product-discovery.spec.ts b/apps/frontend/e2e/product-discovery.spec.ts new file mode 100644 index 0000000000..ad0949f1d2 --- /dev/null +++ b/apps/frontend/e2e/product-discovery.spec.ts @@ -0,0 +1,44 @@ +import { expect, test } from "@playwright/test"; + +test.use({ viewport: { height: 844, width: 320 } }); + +for (const locale of ["en", "pt-BR"]) { + for (const audience of ["individuals", "business"]) { + test(`${locale} ${audience}: Brazilian product entries fit a narrow screen`, async ({ page }) => { + await page.route("**/maintenance/status", route => + route.fulfill({ + json: { is_maintenance_active: false, maintenance_details: null } + }) + ); + const path = audience === "business" ? `/${locale}/business` : `/${locale}/`; + await page.goto(`${path}#discover-${audience}`); + const section = page.locator(`section[aria-labelledby="discover-${audience}"]`); + await expect(section).toBeVisible(); + await expect(section.locator('a[href="/pt-br/gold/"]')).toHaveCount(1); + await expect(section.locator('a[href="/pt-br/stocks/"]')).toHaveCount(1); + await expect(section.getByRole("heading", { level: 2 })).toContainText( + locale === "pt-BR" + ? audience === "business" + ? "Veja o que" + : "Ouro e tokens" + : audience === "business" + ? "See what" + : "Gold and US" + ); + // The old fixed-width footer columns pushed both pages to 368px at this viewport. + await expect.poll(() => page.evaluate(() => document.documentElement.scrollWidth)).toBeLessThanOrEqual(320); + if (audience === "business") { + await expect + .poll(() => + section.evaluate(element => + [...element.querySelectorAll(".product-discovery__preview")].every(image => { + const frame = image.parentElement?.getBoundingClientRect(); + return frame && image.getBoundingClientRect().bottom <= frame.bottom - 20; + }) + ) + ) + .toBe(true); + } + }); + } +} diff --git a/apps/frontend/netlify.toml b/apps/frontend/netlify.toml index 2ce82c4aa4..eeeae50313 100644 --- a/apps/frontend/netlify.toml +++ b/apps/frontend/netlify.toml @@ -69,7 +69,6 @@ X-Content-Type-Options = "nosniff" Referrer-Policy = "strict-origin-when-cross-origin" Permissions-Policy = "camera=(self), microphone=(), geolocation=()" - X-Robots-Tag = "noindex" [[headers]] for = "/en/stocks/*" diff --git a/apps/frontend/src/assets/products/fatia-wordmark-reversed.svg b/apps/frontend/src/assets/products/fatia-wordmark-reversed.svg new file mode 100644 index 0000000000..e5dc978d82 --- /dev/null +++ b/apps/frontend/src/assets/products/fatia-wordmark-reversed.svg @@ -0,0 +1 @@ +fatia. diff --git a/apps/frontend/src/assets/products/gold-bar.webp b/apps/frontend/src/assets/products/gold-bar.webp new file mode 100644 index 0000000000..01ac87d033 Binary files /dev/null and b/apps/frontend/src/assets/products/gold-bar.webp differ diff --git a/apps/frontend/src/assets/products/gold-preview.jpg b/apps/frontend/src/assets/products/gold-preview.jpg new file mode 100644 index 0000000000..925be80c35 Binary files /dev/null and b/apps/frontend/src/assets/products/gold-preview.jpg differ diff --git a/apps/frontend/src/assets/products/ouro-wordmark.png b/apps/frontend/src/assets/products/ouro-wordmark.png new file mode 100644 index 0000000000..0024a35f7f Binary files /dev/null and b/apps/frontend/src/assets/products/ouro-wordmark.png differ diff --git a/apps/frontend/src/assets/products/stocks-man-1440.jpg b/apps/frontend/src/assets/products/stocks-man-1440.jpg new file mode 100644 index 0000000000..3849624b8c Binary files /dev/null and b/apps/frontend/src/assets/products/stocks-man-1440.jpg differ diff --git a/apps/frontend/src/assets/products/stocks-man-800.jpg b/apps/frontend/src/assets/products/stocks-man-800.jpg new file mode 100644 index 0000000000..45f64f075d Binary files /dev/null and b/apps/frontend/src/assets/products/stocks-man-800.jpg differ diff --git a/apps/frontend/src/assets/products/stocks-preview.jpg b/apps/frontend/src/assets/products/stocks-preview.jpg new file mode 100644 index 0000000000..4e0dc2b8ba Binary files /dev/null and b/apps/frontend/src/assets/products/stocks-preview.jpg differ diff --git a/apps/frontend/src/components/Footer/index.tsx b/apps/frontend/src/components/Footer/index.tsx index 93c7decd45..28ee9c0fb2 100644 --- a/apps/frontend/src/components/Footer/index.tsx +++ b/apps/frontend/src/components/Footer/index.tsx @@ -57,7 +57,7 @@ const PoweredBySatoshipay = () => { }; const FooterSection = ({ title, children }: { title: string; children: ReactNode }) => ( -
+

{title}

{children}
diff --git a/apps/frontend/src/i18n.test.ts b/apps/frontend/src/i18n.test.ts new file mode 100644 index 0000000000..7c357b9f70 --- /dev/null +++ b/apps/frontend/src/i18n.test.ts @@ -0,0 +1,15 @@ +import { expect, it, vi } from "vitest"; + +it.each([ + ["/pt-BR/business", "en-US", "pt-BR"], + ["/pt-br/", "en-US", "pt-BR"], + ["/en/business", "pt-BR", "en"], + ["/", "pt-BR", "pt-BR"] +])("initializes %s in %s's correct route language", async (pathname, browserLanguage, expected) => { + vi.resetModules(); + vi.stubGlobal("window", { location: { pathname }, navigator: { language: browserLanguage, languages: [browserLanguage] } }); + try { + const { default: i18n } = await import("./i18n"); + expect(i18n.resolvedLanguage).toBe(expected); + } finally { vi.unstubAllGlobals(); } +}); diff --git a/apps/frontend/src/i18n.ts b/apps/frontend/src/i18n.ts index 5685648df5..b65e94e953 100644 --- a/apps/frontend/src/i18n.ts +++ b/apps/frontend/src/i18n.ts @@ -1,10 +1,10 @@ import i18n from "i18next"; import { initReactI18next } from "react-i18next"; import enTranslations from "./translations/en.json"; -import { getBrowserLanguage, Language } from "./translations/helpers"; +import { getLanguageFromPath, Language } from "./translations/helpers"; import ptTranslations from "./translations/pt.json"; -// Initialize i18n with browser language as default (falls back to English during SSR, +// Initialize i18n from the URL before browser preferences (falls back to English during SSR, // where there is no navigator). The actual language is set by the locale route's beforeLoad. // // This is a module singleton whose language the `{-$locale}` route switches on every @@ -12,7 +12,7 @@ import ptTranslations from "./translations/pt.json"; // pages cannot race over the active language — do not make either side concurrent alone. i18n.use(initReactI18next).init({ fallbackLng: "en", - lng: getBrowserLanguage(), + lng: getLanguageFromPath(), resources: { [Language.English]: { translation: enTranslations diff --git a/apps/frontend/src/pages/main/index.tsx b/apps/frontend/src/pages/main/index.tsx index aed3932535..2b3626b484 100644 --- a/apps/frontend/src/pages/main/index.tsx +++ b/apps/frontend/src/pages/main/index.tsx @@ -2,11 +2,13 @@ import { BaseLayout } from "../../layouts"; import { FAQAccordion, FeeComparison, HowToSell, PopularTokens, TrustedBy, WhyVortex } from "../../sections"; import { GotQuestions } from "../../sections/individuals/GotQuestions"; import { Hero } from "../../sections/individuals/Hero"; +import { ProductDiscovery } from "../../sections/ProductDiscovery"; export const Main = () => { const main = (
+ diff --git a/apps/frontend/src/routes/{-$locale}/business.tsx b/apps/frontend/src/routes/{-$locale}/business.tsx index 0d4cff14f8..e56e3f91a8 100644 --- a/apps/frontend/src/routes/{-$locale}/business.tsx +++ b/apps/frontend/src/routes/{-$locale}/business.tsx @@ -3,6 +3,7 @@ import { BaseLayout } from "../../layouts"; import { WhyVortexApi, WhyVortexBusiness, WhyVortexWidget } from "../../sections"; import { GotQuestions } from "../../sections/business/GotQuestions"; import { Hero } from "../../sections/business/Hero"; +import { ProductDiscovery } from "../../sections/ProductDiscovery"; export const Route = createFileRoute("/{-$locale}/business")({ component: BusinessRouteComponent @@ -12,6 +13,7 @@ function BusinessRouteComponent() { const main = ( <> + diff --git a/apps/frontend/src/sections/ProductDiscovery/index.ssr.test.tsx b/apps/frontend/src/sections/ProductDiscovery/index.ssr.test.tsx new file mode 100644 index 0000000000..70c5322b35 --- /dev/null +++ b/apps/frontend/src/sections/ProductDiscovery/index.ssr.test.tsx @@ -0,0 +1,13 @@ +import { renderToString } from "react-dom/server"; +import { expect, it, vi } from "vitest"; +import { ProductDiscovery } from "."; + +vi.mock("react-i18next", () => ({ useTranslation: () => ({ t: (key: string) => key, i18n: { resolvedLanguage: "en" } }) })); + +it.each(["individuals", "business"] as const)("prerenders the %s discovery section without browser globals", audience => { + expect(typeof window).toBe("undefined"); + const html = renderToString(); + expect(html).toContain('href="/pt-br/gold/"'); + expect(html).toContain('href="/pt-br/stocks/"'); + expect(html).not.toMatch(/style="[^\"]*(width|height):\s*\d/); +}); diff --git a/apps/frontend/src/sections/ProductDiscovery/index.test.tsx b/apps/frontend/src/sections/ProductDiscovery/index.test.tsx new file mode 100644 index 0000000000..e4d2512d5d --- /dev/null +++ b/apps/frontend/src/sections/ProductDiscovery/index.test.tsx @@ -0,0 +1,51 @@ +// @vitest-environment jsdom +import { createInstance } from "i18next"; +import { renderToString } from "react-dom/server"; +import { I18nextProvider, initReactI18next } from "react-i18next"; +import { describe, expect, it } from "vitest"; +import en from "../../translations/en.json"; +import pt from "../../translations/pt.json"; +import { ProductDiscovery } from "."; + +describe.each(["en", "pt-BR"])("Product discovery in %s", language => { + async function render(audience: "individuals" | "business") { + const i18n = createInstance(); + await i18n.use(initReactI18next).init({ + fallbackLng: "en", + lng: language, + resources: { en: { translation: en }, "pt-BR": { translation: pt } } + }); + const container = document.createElement("div"); + container.innerHTML = renderToString(); + return container; + } + + it.each(["individuals", "business"] as const)("%s links directly to the separate Brazilian apps", async audience => { + const dom = await render(audience); + try { + const document = dom; + expect(document.querySelectorAll('a[href="/pt-br/gold/"]').length).toBe(1); + expect(document.querySelectorAll('a[href="/pt-br/stocks/"]').length).toBe(1); + expect(document.querySelectorAll("h2").length).toBe(1); + expect(document.querySelectorAll("h3").length).toBe(2); + expect(document.textContent).not.toContain("sections.productDiscovery"); + expect(document.textContent).not.toMatch(/50\s*bps|0[.,]25\s*%|guaranteed|garantido/i); + expect([...document.querySelectorAll("img")].every(img => img.hasAttribute("alt") && img.hasAttribute("width") && img.hasAttribute("height"))).toBe(true); + for (const link of document.querySelectorAll("a[aria-labelledby]")) { + expect(link.getAttribute("aria-labelledby")?.split(" ").every(id => document.querySelector(`[id="${id}"]`)?.textContent)).toBe(true); + } + } finally { dom.replaceChildren(); } + }); + + it("gives consumers cost clarity and businesses a localized sales/docs path", async () => { + const consumer = await render("individuals"), business = await render("business"); + try { + expect(consumer.textContent).toContain(language === "en" ? "Fair fees. Clear costs." : "Taxas justas. Custos claros."); + expect(consumer.querySelector(".product-discovery__qualification")?.textContent).toContain(language === "en" ? "You buy tokens" : "Você compra tokens"); + expect(consumer.querySelector(".product-discovery__business-actions")).toBeNull(); + expect(business.querySelector('a[href="' + (language === "en" ? "/en/contact" : "/pt-BR/contact") + '"]')?.textContent).toBe(language === "en" ? "Build with Vortex" : "Crie com a Vortex"); + expect(business.querySelector('a[href="https://api-docs.vortexfinance.co/"]')?.getAttribute("rel")).toContain("noopener"); + expect(business.querySelectorAll(".product-discovery__preview").length).toBe(2); + } finally { consumer.replaceChildren(); business.replaceChildren(); } + }); +}); diff --git a/apps/frontend/src/sections/ProductDiscovery/index.tsx b/apps/frontend/src/sections/ProductDiscovery/index.tsx new file mode 100644 index 0000000000..d611ce196d --- /dev/null +++ b/apps/frontend/src/sections/ProductDiscovery/index.tsx @@ -0,0 +1,141 @@ +import { ArrowRightIcon, ArrowTopRightOnSquareIcon } from "@heroicons/react/24/outline"; +import { useTranslation } from "react-i18next"; +import brazil from "../../assets/countries/brazil.png"; +import fatiaLight from "../../assets/products/fatia-wordmark-reversed.svg"; +import goldBar from "../../assets/products/gold-bar.webp"; +import goldPreview from "../../assets/products/gold-preview.jpg"; +import ouro from "../../assets/products/ouro-wordmark.png"; +import stocksMan800 from "../../assets/products/stocks-man-800.jpg"; +import stocksMan1440 from "../../assets/products/stocks-man-1440.jpg"; +import stocksPreview from "../../assets/products/stocks-preview.jpg"; +import "./styles.css"; + +const PRODUCTS = [ + { href: "/pt-br/gold/", key: "gold", preview: goldPreview }, + { href: "/pt-br/stocks/", key: "stocks", preview: stocksPreview } +] as const; + +export function ProductDiscovery({ audience }: { audience: "individuals" | "business" }) { + const { t, i18n } = useTranslation(); + const business = audience === "business"; + const key = `sections.productDiscovery.${audience}`; + const headingId = `discover-${audience}`; + return ( +
+
+

{t(`${key}.eyebrow`)}

+
+

+ {t(`${key}.title`)} + {!business && {t(`${key}.accent`)}} +

+

+ + {t(`${key}.market`)} +

+
+

{t(`${key}.description`)}

+ + {!business &&

{t(`${key}.qualification`)}

} + {business && ( + + )} +
+
+ ); +} diff --git a/apps/frontend/src/sections/ProductDiscovery/styles.css b/apps/frontend/src/sections/ProductDiscovery/styles.css new file mode 100644 index 0000000000..0d923999ff --- /dev/null +++ b/apps/frontend/src/sections/ProductDiscovery/styles.css @@ -0,0 +1,344 @@ +.product-discovery { + padding: 64px 24px; + color: #101b3c; + background: white; +} +.product-discovery__inner { + max-width: 1360px; + margin-inline: auto; +} +.product-discovery__eyebrow { + margin-bottom: 20px; + color: var(--color-primary); + font-size: 14px; + font-weight: 800; + letter-spacing: 0.16em; +} +.product-discovery__heading-row { + display: flex; + align-items: center; + justify-content: space-between; + gap: 24px; +} +.product-discovery h2 { + margin: 0; + font-size: clamp(30px, 4.6vw, 64px); + font-weight: 800; + line-height: 1.12; + letter-spacing: -0.035em; + scroll-margin-top: 120px; +} +.product-discovery h2 span { + display: block; + color: var(--color-primary); +} +.product-discovery__market { + display: inline-flex; + flex-shrink: 0; + align-items: center; + gap: 8px; + padding: 10px 16px; + border-radius: 24px; + background: #e4edff; + font-size: 14px; + font-weight: 600; +} +.product-discovery__market img { + width: 20px; + height: 20px; + object-fit: cover; + border-radius: 50%; +} +.product-discovery__description { + margin-top: 20px; + max-width: 1000px; + color: #43516c; + font-size: 20px; + line-height: 1.55; +} +.product-discovery__grid { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 24px; + margin-top: 48px; +} +.product-discovery__card { + position: relative; + display: block; + overflow: hidden; + min-width: 0; + border-radius: 20px; + color: inherit; + text-decoration: none; + isolation: isolate; +} +.product-discovery__card:focus-visible { + outline: 3px solid var(--color-primary); + outline-offset: 5px; +} +.product-discovery--individuals .product-discovery__card { + min-height: clamp(480px, 42vw, 600px); +} +.product-discovery__card--gold { + background: #f8f1e6; +} +.product-discovery__card--stocks { + background: #171f3c; + color: white; +} +.product-discovery__gold { + position: absolute; + right: 0; + top: 7%; + width: 53%; + height: 88%; + object-fit: contain; + pointer-events: none; + z-index: -1; +} +.product-discovery__photo { + position: absolute; + inset: 0; + width: 100%; + height: 100%; + object-fit: cover; + object-position: 60% center; + filter: brightness(0.78); + z-index: -1; +} +.product-discovery__card-copy { + display: flex; + flex-direction: column; + align-items: flex-start; + justify-content: space-between; + min-height: clamp(480px, 42vw, 600px); + padding: 48px; +} +.product-discovery__brand { + display: flex; + flex-direction: column; + align-items: flex-start; + gap: 3px; +} +.product-discovery__brand img { + width: 160px; + height: 60px; + object-fit: contain; + object-position: left center; +} +.product-discovery__brand span { + color: #737a86; + font-size: 16px; +} +.product-discovery__card--stocks .product-discovery__brand span { + color: white; +} +.product-discovery h3 { + font-size: 56px; + font-weight: 800; + line-height: 1.1; + letter-spacing: -0.035em; +} +.product-discovery__card-copy p { + max-width: 250px; + margin-top: 16px; + font-size: 20px; + line-height: 1.4; + white-space: pre-line; +} +.product-discovery__card--stocks .product-discovery__card-copy { + text-shadow: 0 1px 6px rgb(0 0 0 / 0.6); +} +.product-discovery__action { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 16px; + min-height: 60px; + min-width: 240px; + padding: 12px 24px; + border-radius: 10px; + background: #d8a638; + color: #171717; + font-weight: 700; + font-size: 18px; + text-shadow: none; +} +.product-discovery__card--stocks .product-discovery__action { + color: white; + background: #4035de; +} +.product-discovery__action svg, +.product-discovery__example-link svg, +.product-discovery__docs svg { + width: 20px; + height: 20px; + flex-shrink: 0; +} +.product-discovery__qualification { + margin-top: 28px; + color: #526078; + text-align: center; + font-size: 14px; + line-height: 1.5; +} +.product-discovery--business { + background: #f8faff; +} +.product-discovery--business .product-discovery__card { + display: flex; + align-items: center; + justify-content: space-between; + gap: 12px; + padding: 24px 16px 24px 24px; + min-height: 260px; + color: #101b3c; +} +.product-discovery--business .product-discovery__card--gold { + background: #faf5ed; +} +.product-discovery--business .product-discovery__card--stocks { + background: #f0eefb; +} +.product-discovery__example-copy { + flex: 0 0 34%; +} +.product-discovery__example-copy h3 { + font-size: clamp(20px, 2vw, 28px); +} +.product-discovery__example-link { + display: inline-flex; + align-items: center; + gap: 6px; + margin-top: 16px; + color: var(--color-primary); + font-size: 14px; + font-weight: 600; + text-decoration: underline; + text-underline-offset: 3px; +} +.product-discovery__preview { + width: 64%; + height: auto; + border-radius: 12px; + box-shadow: 0 4px 16px rgb(16 27 60 / 0.1); +} +.product-discovery__business-actions { + display: flex; + align-items: center; + justify-content: center; + gap: 40px; + margin-top: 32px; +} +.product-discovery__business-actions .btn { + min-width: 260px; + min-height: 52px; +} +.product-discovery__docs { + display: inline-flex; + align-items: center; + gap: 8px; + min-height: 48px; + color: var(--color-primary); + text-decoration: underline; + text-underline-offset: 3px; +} +@media (hover: hover) { + .product-discovery__card:hover .product-discovery__action { + filter: brightness(0.94); + } + .product-discovery__card:hover .product-discovery__example-link { + text-decoration-thickness: 2px; + } +} +@media (min-width: 1440px) { + .product-discovery { + padding-inline: 40px; + } +} +@media (max-width: 1023px) { + .product-discovery__heading-row { + align-items: flex-start; + flex-direction: column; + gap: 18px; + } + .product-discovery__card-copy { + padding-inline: 24px; + } + .product-discovery__card-copy p { + max-width: 180px; + font-size: 16px; + } + .product-discovery--business .product-discovery__card { + flex-direction: column; + align-items: stretch; + padding: 24px; + } + .product-discovery__example-copy { + display: flex; + align-items: center; + justify-content: space-between; + gap: 12px; + flex: 0 0 auto; + } + .product-discovery__example-link { + margin-top: 0; + } + .product-discovery__preview { + width: 100%; + margin-top: 12px; + flex: 0 0 auto; + } +} +@media (max-width: 767px) { + .product-discovery { + padding: 48px 20px; + } + .product-discovery__grid { + grid-template-columns: minmax(0, 1fr); + gap: 20px; + margin-top: 28px; + } + .product-discovery__eyebrow { + font-size: 12px; + margin-bottom: 16px; + } + .product-discovery__description { + margin-top: 16px; + font-size: 16px; + } + .product-discovery__card-copy, + .product-discovery--individuals .product-discovery__card { + min-height: 420px; + } + .product-discovery__card-copy { + padding: 28px 24px; + } + .product-discovery__brand img { + width: 120px; + height: 46px; + } + .product-discovery h3 { + font-size: 36px; + } + .product-discovery__business-actions { + flex-direction: column; + gap: 12px; + } + .product-discovery__business-actions .btn { + width: 100%; + } + .product-discovery__action { + min-width: 0; + min-height: 52px; + font-size: 16px; + padding-inline: 20px; + } + .product-discovery__example-copy h3 { + font-size: 22px; + } + .product-discovery__example-link { + font-size: 13px; + gap: 4px; + } +} diff --git a/apps/frontend/src/tests/netlify-headers.test.ts b/apps/frontend/src/tests/netlify-headers.test.ts index 0ad6d8c815..cc20f502c0 100644 --- a/apps/frontend/src/tests/netlify-headers.test.ts +++ b/apps/frontend/src/tests/netlify-headers.test.ts @@ -23,12 +23,13 @@ describe("Netlify headers", () => { }); }); - it("keeps the stocks pilot out of frames and search results", () => { - expect(headerRules.find(rule => rule.path === "/pt-br/stocks/*")?.values).toMatchObject({ + it("keeps the Brazil stocks app out of frames but open to search engines", () => { + const values = headerRules.find(rule => rule.path === "/pt-br/stocks/*")?.values; + expect(values).toMatchObject({ "Content-Security-Policy": "frame-ancestors 'none'", - "X-Frame-Options": "DENY", - "X-Robots-Tag": "noindex" + "X-Frame-Options": "DENY" }); + expect(values).not.toHaveProperty("X-Robots-Tag"); }); it("does not apply the anti-framing headers beyond the consumer apps", () => { diff --git a/apps/frontend/src/translations/en.json b/apps/frontend/src/translations/en.json index 158e8e5d1b..6186e90bb4 100644 --- a/apps/frontend/src/translations/en.json +++ b/apps/frontend/src/translations/en.json @@ -1748,6 +1748,44 @@ "title": "Supported Networks" } }, + "productDiscovery": { + "business": { + "build": "Build with Vortex", + "description": "Two products. Your own experience. Vortex handles onboarding, payments and settlement.", + "docs": "Read the docs", + "eyebrow": "BUILT WITH VORTEX", + "gold": { + "action": "View Gold example", + "previewAlt": "Illustrative preview of ouro., the Vortex gold app in Portuguese.", + "title": "Gold app" + }, + "market": "Brazil · Pix examples", + "stocks": { + "action": "View Stocks example", + "previewAlt": "Illustrative preview of fatia., the Vortex Stock Tokens app in Portuguese.", + "title": "Stocks app" + }, + "title": "See what you can build with Vortex." + }, + "individuals": { + "accent": "Fair fees. Clear costs.", + "description": "Start with Pix in Brazil. See your total cost before you pay.", + "eyebrow": "INVEST WITH VORTEX", + "gold": { + "action": "Explore Gold", + "description": "Gold-backed tokens.\nBought with Pix.", + "title": "Gold" + }, + "market": "Brazil · Pix", + "qualification": "You buy tokens, not physical gold or company shares.", + "stocks": { + "action": "Explore Stocks", + "description": "US Stock Tokens.\nBought with Pix.", + "title": "Stocks" + }, + "title": "Gold and US stock tokens." + } + }, "trustedBy": { "comingSoon": "Coming soon", "title": "Trusted by" diff --git a/apps/frontend/src/translations/pt.json b/apps/frontend/src/translations/pt.json index cb7ee1e617..f8a8c8e4b6 100644 --- a/apps/frontend/src/translations/pt.json +++ b/apps/frontend/src/translations/pt.json @@ -1752,6 +1752,44 @@ "title": "Redes Suportadas" } }, + "productDiscovery": { + "business": { + "build": "Crie com a Vortex", + "description": "Dois produtos. Uma experiência própria. A Vortex cuida do cadastro, dos pagamentos e da liquidação.", + "docs": "Leia a documentação", + "eyebrow": "CRIADO COM A VORTEX", + "gold": { + "action": "Ver exemplo de ouro", + "previewAlt": "Prévia ilustrativa do ouro., o app de ouro da Vortex em português.", + "title": "App de ouro" + }, + "market": "Exemplos com Pix · Brasil", + "stocks": { + "action": "Ver exemplo de ações", + "previewAlt": "Prévia ilustrativa do fatia., o app de tokens de ações da Vortex em português.", + "title": "App de ações" + }, + "title": "Veja o que você pode criar com a Vortex." + }, + "individuals": { + "accent": "Taxas justas. Custos claros.", + "description": "Comece com Pix no Brasil. Veja o custo total antes de pagar.", + "eyebrow": "INVISTA COM A VORTEX", + "gold": { + "action": "Conhecer o ouro", + "description": "Tokens com lastro em ouro.\nCompre com Pix.", + "title": "Ouro" + }, + "market": "Brasil · Pix", + "qualification": "Você compra tokens, não ouro físico nem ações de empresas.", + "stocks": { + "action": "Conhecer ações", + "description": "Tokens de ações dos EUA.\nCompre com Pix.", + "title": "Ações" + }, + "title": "Ouro e tokens de ações dos EUA." + } + }, "trustedBy": { "comingSoon": "Em breve", "title": "Confiado por" diff --git a/apps/stocks/CLAUDE.md b/apps/stocks/CLAUDE.md index 22e1f2c731..4fb49e73d2 100644 --- a/apps/stocks/CLAUDE.md +++ b/apps/stocks/CLAUDE.md @@ -11,8 +11,9 @@ the sibling of `apps/gold`. (`apps/frontend/_redirects`). It uses hash routes, so no SPA rewrite is needed. In code, reference public assets through `import.meta.env.BASE_URL`, never as root-relative `/brand/...` paths (Vite rewrites the ones in `index.html`). -- **Not indexed until launch:** `` in `index.html` and - `X-Robots-Tag: noindex` for `/pt-br/stocks/*` in `netlify.toml`. Remove both only at launch. +- **Indexing:** the Brazil edition (`index.html`, `/pt-br/stocks/*`) is launched and indexed. The + English edition keeps `` in `international.html` and + `X-Robots-Tag: noindex` for `/en/stocks/*` in `netlify.toml`; remove both only at its launch. - **Modes:** `VITE_STOCKS_MODE` = `demo` (default when unset: fake login, simulated ramp) | `preview` (real Privy login, simulated ramp, no Vortex calls) | `live` (production; the Netlify build defaults to it). The Vortex ramp additionally stays off ("em breve") until diff --git a/apps/stocks/README.md b/apps/stocks/README.md index 9fa9e02fb9..3d4e7a3211 100644 --- a/apps/stocks/README.md +++ b/apps/stocks/README.md @@ -4,9 +4,9 @@ Brazil-first consumer showcase of the Vortex API: buy and sell US Stock Tokens o Chain with Pix, while the user keeps control of an embedded wallet. Same sign-in ("Entrar com Vortex") and the same wallet as ouro. (`apps/gold`). -Status: in development, and not indexed until launch. Production builds run in `live` mode with -the Vortex ramp off ("em breve") until `VITE_STOCKS_RAMP_ENABLED=true`, and the API's stock corridor -stays off until its `STOCKS_ENABLED_DIRECTIONS` lists a direction. +Status: launched in Brazil at `/pt-br/stocks/`; the English edition is not indexed yet. Production +builds run in `live` mode with the Vortex ramp off ("em breve") until `VITE_STOCKS_RAMP_ENABLED=true`, +and the API's stock corridor stays off until its `STOCKS_ENABLED_DIRECTIONS` lists a direction. The frontend Netlify deployment includes this app at `/pt-br/stocks/`. Deploy previews explicitly use the labelled demo; they do not need a separate wallet or ramp integration. diff --git a/apps/stocks/index.html b/apps/stocks/index.html index 1e6e09af2c..09e0162522 100644 --- a/apps/stocks/index.html +++ b/apps/stocks/index.html @@ -3,8 +3,6 @@ - - fatia. by Vortex — Tokens de ações dos EUA com Pix diff --git a/apps/stocks/src/components/FairFeesHero.jsx b/apps/stocks/src/components/FairFeesHero.jsx index a5f357c3e8..9eb20e0fef 100644 --- a/apps/stocks/src/components/FairFeesHero.jsx +++ b/apps/stocks/src/components/FairFeesHero.jsx @@ -15,7 +15,7 @@ const COPY = { ], lede: "Comece com R$ 100 e pague com Pix. Veja todos os custos antes de pagar.", monthly: "Sem mensalidade", - extra: "Sem taxa extra da fatia.", + extra: "Sem taxa extra além da taxa Vortex", action: "Comprar com Pix", preview: "Ver custos da compra", soon: "Compra com Pix em breve", @@ -36,7 +36,7 @@ const COPY = { ], lede: "Start with 10 USDC on Base. See every cost before you pay.", monthly: "No monthly fee", - extra: "No extra fatia. fee", + extra: "No extra fee beyond the Vortex fee", action: "Buy with USDC", preview: "See purchase costs", soon: "USDC purchases are coming soon", diff --git a/apps/stocks/tests/pilot-safety.test.mjs b/apps/stocks/tests/pilot-safety.test.mjs index a2eda9194d..72b4e99046 100644 --- a/apps/stocks/tests/pilot-safety.test.mjs +++ b/apps/stocks/tests/pilot-safety.test.mjs @@ -47,12 +47,13 @@ test("only src/lib/config.js reads VITE_* variables", () => { } }); -test("served at /pt-br/stocks/ and kept out of search results until launch", () => { +test("served and indexed at /pt-br/stocks/, with the English edition kept out of search results", () => { assert.match(read("vite.config.mjs"), /base:\s*"\/pt-br\/stocks\/"/); assert.match(read("vite.config.mjs"), /outDir:\s*"dist\/client"/); const html = read("index.html"); assert.match(html, //); - assert.match(html, //); + assert.doesNotMatch(html, /noindex/); + assert.match(read("international.html"), //); assert.match(html, //); for (const [, href] of html.matchAll(/href="(\/brand\/[^"]+)"/g)) assert.ok(existsSync(join(APP, "public", href)), `${href} is missing from public/`); }); diff --git a/docs/security-spec/01-auth/consumer-apps.md b/docs/security-spec/01-auth/consumer-apps.md index 8cd95d9fbd..faf89051c1 100644 --- a/docs/security-spec/01-auth/consumer-apps.md +++ b/docs/security-spec/01-auth/consumer-apps.md @@ -100,9 +100,9 @@ specified in `03-ramp-engine/ramp-phase-flows.md` and `05-integrations/relay.md` ## Hosting and verification -- Stocks inherits a scoped anti-framing policy and remains `noindex` until launch. That policy does - not restrict scripts (RISK-033). Existing widget proxy routes, Gold paths and real 404 behavior - remain covered by routing tests. +- Stocks inherits a scoped anti-framing policy. The Brazil edition is launched and indexed; the + English edition stays `noindex`. That policy does not restrict scripts (RISK-033). Existing + widget proxy routes, Gold paths and real 404 behavior remain covered by routing tests. - A build fails on an invalid mode or a missing Privy app ID, and a Netlify production build fails unless the mode is `live`. CI builds the live bundle and fails if it has simulated USDC payment controls or demo links; the real USDC flow and English page must remain present. - `apps/stocks/tests` covers mode isolation, quote validation, recovery, gas and amount maths, and diff --git a/docs/security-spec/RISK-REGISTER.md b/docs/security-spec/RISK-REGISTER.md index d955af7f2b..5580dd1fdb 100644 --- a/docs/security-spec/RISK-REGISTER.md +++ b/docs/security-spec/RISK-REGISTER.md @@ -54,7 +54,7 @@ register and the owning module specification. | RISK-030 | Accepted | Medium | Payments Platform | `relayBridge` can complete without a Relay status when the status API is unavailable and the ephemeral's destination balance already meets the requirement. No baseline is read, so the check accepts a balance whatever its source, and a later Relay fill then overfunds the ephemeral. Provider indexing and availability make this path necessary, as with RISK-008. | The balance is real and spendable by the ramp, and must reach the exact bridge output on a buy or the order's guaranteed minimum on a sell. Every use logs `RELAY_ARRIVAL_BALANCE_FALLBACK`. A visible refund status still pauses. USDC surplus on Base is swept after completion; when BRLA is also left on the ephemeral, neither sweep completes and both need an operator. USDG surplus on Robinhood Chain has no sweep and needs an operator. | Revisit if the log is seen outside a Relay status outage, or when Relay offers fill evidence that does not depend on its status API. | | RISK-031 | Accepted | Low | Payments Platform + Treasury | A stock SELL, and a Base-USDC BUY, is funded before the user's tokens move: `fundEphemeral` sends 0.00015 ETH on Base plus the prefund budget on Robinhood Chain to the one-time ephemeral once it has checked the user (the token or USDC balance and permit deadline on the permit path, the reported transfer on the fallback). The sale can still fail after that check, before anything is pulled, and that funding is then not recovered; failed ramps are not swept (RISK-016). | A Pix registration needs a resolved Avenia account and a validated wallet; a Base-USDC registration needs no fiat account but binds funding and delivery to one validated wallet. Registration allows one open permit-funded stock trade (any Pix sale or Base-USDC trade) per account, and refuses an account's permit-funded trades once three of those it registered in the last 24 hours failed after being started, counting one that fails in `fundEphemeral` after its funding was sent. So the funding wallet spends at most three trades' funding per account per 24 hours of registrations on trades that pull nothing. A short balance waits unfunded, and a permit that expired before funding was sent ends the ramp without funding. The global API rate limit applies, and `STOCKS_ENABLED_DIRECTIONS` and `STOCKS_USDC_ENABLED_DIRECTIONS` switch their directions off. | Revisit if funding-wallet spend on sells that never pull becomes visible, or before raising per-ramp funding. | | RISK-036 | Accepted | Medium | Payments Platform + Treasury | The opt-in Pix stocks DEX-fee rebate (`STOCKS_NABLA_USER_FEE_BPS`, unset by default) pays, on every rebated Pix stock ramp, the Base Nabla fee above the retained target from the Base funding wallet (USDC on a BUY, BRLA on a SELL). The rebate rests on the deployed router's `getAmountOut` answer: its net output and its fee in output-token units. | Only the Pix stock route can carry it; Base-USDC flows have no Nabla swap. The quote rebates only the fee, never price, curve or FX effects, and fails closed (503) when the rebate would exceed `STOCKS_NABLA_MAX_SUBSIDY_BPS` of the gross output. It replaces the generic `subsidizePostSwap` discount on that phase, so the two never stack, and execution pays it through the same journalled `subsidizePostSwap` top-up and caps, recorded as `Subsidy` rows. The nightly `nabla-base.contract.test.ts` checks the router answer against the quoter and the configured cap against the live fee. The cap is per ramp, with no aggregate budget (RISK-001). | Before enabling, confirm the nightly router contract check passes in both directions. Review realized rebate `Subsidy` rows before raising the target, the cap or volume, and revisit if the pool fee changes. | -| RISK-033 | Accepted | Medium | Client Platform + Security | `/pt-br/stocks/*` sends a Content-Security-Policy of `frame-ancestors 'none'` only, as Gold does, while the page holds a Privy wallet session, a Vortex OTP session and encrypted ramp keys. Script running on that page, or on any other page of the same origin, can read its storage and ask the wallet to sign. A policy scoped to this path would not close the other pages. | Anti-framing and `nosniff` headers. The app renders no raw HTML. The wallet shows its own window for every signature. Ramp keys sit encrypted in IndexedDB under a non-extractable key and go when a ramp succeeds, and the OTP session is per tab. | Before launch, walk the flows under a `Content-Security-Policy-Report-Only` that lists the hosts they reach, then enforce it. Revisit when a policy can cover the whole origin. | +| RISK-033 | Accepted | Medium | Client Platform + Security | `/pt-br/stocks/*` sends a Content-Security-Policy of `frame-ancestors 'none'` only, as Gold does, while the page holds a Privy wallet session, a Vortex OTP session and encrypted ramp keys. Script running on that page, or on any other page of the same origin, can read its storage and ask the wallet to sign. A policy scoped to this path would not close the other pages. | Anti-framing and `nosniff` headers. The app renders no raw HTML. The wallet shows its own window for every signature. Ramp keys sit encrypted in IndexedDB under a non-extractable key and go when a ramp succeeds, and the OTP session is per tab. | Stocks launched with the anti-framing policy only, as Gold did. Walk the flows under a `Content-Security-Policy-Report-Only` that lists the hosts they reach, then enforce it. Revisit when a policy can cover the whole origin. | | RISK-034 | Deferred | Medium | Client Platform + Payments Platform | The Stocks app signs only the permit, so a sell whose token has no permit is refused before registration, with no funds moved. The backend keeps the one-transfer fallback for API clients. Signing that transfer in the app has known gaps. The hash reaches the API only after the receipt wait, while the start window keeps a 60 s margin, so a slow wallet or closed tab can leave tokens on the ephemeral with no hash for sell recovery. Any wallet error other than a rejection leaves an uncertain-send marker with no release, and so does a mined revert. Privy's send screen can offer a retry that broadcasts a second transfer inside one call (read in its code, not executed). | `SELL_PHASES` lists only `stockPermitTransfer`, and `validateStockQuote` refuses a sell quote that is not `gasless`. All 12 launch tokens return a permit domain. A probe that cannot read the permit answers 503 at registration for a `gasless` quote. | Before adding `squidRouterNoPermitTransfer` to `SELL_PHASES`: post the hash at broadcast and again on resume, and widen the start margin to cover the receipt wait; let a hash reported late pass the start deadline on the server; pin the nonce so a marker can be released without a double send; release the record on a mined revert; and fix or accept the second broadcast. | ## Review cadence