Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix: expose plan Contact links and founder X account (#903)

Gustavo Yed9040a841f2a
diff --git a/scripts/ci/e2e-shards.mjs b/scripts/ci/e2e-shards.mjs
index ebfdc3b7b..39b467e66 100644
--- a/scripts/ci/e2e-shards.mjs
+++ b/scripts/ci/e2e-shards.mjs
@@ -84,6 +84,7 @@ export const SPEC_SECONDS = {
"59-message-pagination-anchor.spec.ts": 45.600,
"60-desktop-default-user-bar-width.spec.ts": 83.700,
"63-mobile-notification-chat-route.spec.ts": DEFAULT_SPEC_SECONDS,
+ "64-billing-contact.spec.ts": 6,
}
function walk(directory) {
diff --git a/scripts/ci/e2e-shards.test.ts b/scripts/ci/e2e-shards.test.ts
index a740a1c80..e7c14b5dd 100644
--- a/scripts/ci/e2e-shards.test.ts
+++ b/scripts/ci/e2e-shards.test.ts
@@ -80,12 +80,12 @@ describe("planE2eShards", () => {
expect(new Set(assigned).size).toBe(specs.length)
expect(SPEC_SECONDS["55-message-scroll-characterization.spec.ts"]).toBe(109.548)
expect(specSeconds).toEqual([
- 165, 165, 151.34, 151.656, 152.753, 152.602, 151.8,
- 154.215, 154.336, 153.422, 151.817, 154.381, 151.885,
+ 165, 165, 153.418, 151.903, 152.845, 153.917, 151.8,
+ 154.75, 154.673, 154.38, 151.82, 154.551, 152.15,
])
expect(predictedSeconds).toEqual([
- 240, 240, 226.34, 226.656, 227.753, 227.602, 226.8,
- 229.215, 229.336, 228.422, 226.817, 229.381, 226.885,
+ 240, 240, 228.418, 226.903, 227.845, 228.917, 226.8,
+ 229.75, 229.673, 229.38, 226.82, 229.551, 227.15,
])
expect(first.every((shard) => (
shard.fixed_setup_seconds === E2E_FIXED_SETUP_SECONDS
diff --git a/src/web/src/app/contact/page.tsx b/src/web/src/app/contact/page.tsx
index 6f72b40d8..710585a9c 100644
--- a/src/web/src/app/contact/page.tsx
+++ b/src/web/src/app/contact/page.tsx
@@ -2,7 +2,7 @@ import type { Metadata } from "next"
import Image from "next/image"
import Link from "next/link"
import { ArrowUpRight, CalendarDays, Mail } from "lucide-react"
-import { SiDiscord } from "@icons-pack/react-simple-icons"
+import { SiDiscord, SiX } from "@icons-pack/react-simple-icons"
import { LandingFooter } from "@/components/home/landing-footer"
import landing from "@/components/home/landing-page.module.css"
import styles from "./contact.module.css"
@@ -16,6 +16,7 @@ export const metadata: Metadata = {
const contacts = [
{ icon: Mail, label: "Email", text: "[email protected]", href: "mailto:[email protected]" },
{ icon: CalendarDays, label: "Meet", text: "Book 15 minutes", href: "https://cal.com/gustavoye/15min" },
+ { icon: SiX, label: "X", text: "@im_gusye", href: "https://x.com/im_gusye" },
]
export default function ContactPage() {
diff --git a/src/web/src/app/pricing/pricing-client.dom.test.tsx b/src/web/src/app/pricing/pricing-client.dom.test.tsx
index 44e867057..985b4cc96 100644
--- a/src/web/src/app/pricing/pricing-client.dom.test.tsx
+++ b/src/web/src/app/pricing/pricing-client.dom.test.tsx
@@ -102,6 +102,7 @@ it("fails closed on a catalog error and supports retry", async () => {
state.api.mockRejectedValueOnce(new Error("offline"))
const view = render(<PricingClient />)
expect(await view.findByRole("alert")).toHaveTextContent("Couldn't load plans")
+ expect(view.getByRole("link", { name: "Contact us" })).toHaveAttribute("href", "/contact")
expect(view.getByTestId("pricing-choose-studio")).toBeDisabled()
await setupUser().click(view.getByRole("button", { name: "Try again" }))
await waitFor(() => expect(view.getByRole("button", { name: "Choose Studio" })).toBeEnabled())
diff --git a/src/web/src/app/pricing/pricing-view.tsx b/src/web/src/app/pricing/pricing-view.tsx
index f580884d8..f6b4c267b 100644
--- a/src/web/src/app/pricing/pricing-view.tsx
+++ b/src/web/src/app/pricing/pricing-view.tsx
@@ -34,6 +34,7 @@ export function PricingView({ controller: c }: { controller: PricingController }
<main className={styles.main}>
<p className={styles.eyebrow}>Pricing</p>
<h1>Choose the right space for your bots.</h1>
+ <p className={styles.contactLine}>Questions about a plan? <Link href="/contact">Contact us</Link></p>
<div className={styles.status} aria-live="polite">{c.message}</div>
{c.error && <div className={styles.status} role="alert">{c.error} <button type="button" onClick={c.retry}>Try again</button></div>}
diff --git a/src/web/src/app/pricing/pricing.module.css b/src/web/src/app/pricing/pricing.module.css
index aadc90137..0b16fc2e9 100644
--- a/src/web/src/app/pricing/pricing.module.css
+++ b/src/web/src/app/pricing/pricing.module.css
@@ -1091,6 +1091,9 @@
}
}
+.contactLine { margin: 16px auto 0; text-align: center; font-size: 14px; color: var(--muted-foreground); }
+.contactLine a { display: inline-flex; align-items: center; min-height: 44px; color: var(--foreground); text-decoration: underline; text-underline-offset: 4px; }
+.contactLine a:focus-visible { outline: 2px solid var(--ring); outline-offset: 4px; border-radius: 2px; }
.status { max-width: 70rem; margin: 16px auto; text-align: center; color: var(--muted-foreground); }
.status:empty { display: none; }
.status button { text-decoration: underline; min-height: 44px; padding: 0 8px; }
diff --git a/src/web/src/components/community/billing/billing-sheet.dom.test.tsx b/src/web/src/components/community/billing/billing-sheet.dom.test.tsx
index b5ff898bd..187e99cea 100644
--- a/src/web/src/components/community/billing/billing-sheet.dom.test.tsx
+++ b/src/web/src/components/community/billing/billing-sheet.dom.test.tsx
@@ -133,9 +133,20 @@ describe("billing sheet", () => {
expect(billing.cancelChange).toHaveBeenCalledOnce()
})
it("exposes unavailable offers without a dead purchase button", () => {
- const ui = view(state({ data: { ...free, offers: [] } }))
+ const billing = state({ data: { ...free, offers: [] } })
+ const ui = view(billing)
expect(ui.getByText(/Paid plans are unavailable/)).toBeInTheDocument()
expect(ui.queryByRole("button", { name: /Choose/ })).toBeNull()
+ const contact = ui.getByRole("link", { name: "Contact us (opens in a new tab)" })
+ expect(contact).toHaveAttribute("href", "/contact")
+ expect(contact).toHaveAttribute("target", "_blank")
+ expect(contact).toHaveAttribute("rel", "noopener noreferrer")
+ fireEvent.click(contact)
+ expect(billing.checkout).not.toHaveBeenCalled()
+ expect(billing.portal).not.toHaveBeenCalled()
+ expect(billing.refresh).not.toHaveBeenCalled()
+ ui.rerender(<BillingContent billing={state({ data: undefined, isPending: true })} />)
+ expect(ui.getByRole("link", { name: "Contact us (opens in a new tab)" })).toHaveAttribute("href", "/contact")
})
})
diff --git a/src/web/src/components/community/billing/billing-sheet.tsx b/src/web/src/components/community/billing/billing-sheet.tsx
index b58b45b93..18684b973 100644
--- a/src/web/src/components/community/billing/billing-sheet.tsx
+++ b/src/web/src/components/community/billing/billing-sheet.tsx
@@ -79,6 +79,7 @@ export function BillingContent({ billing }: { billing: BillingController }) {
{subscription?.status === "past_due" && <p>Your renewal payment needs attention. Update your payment method in billing management.</p>}
</div>}
</>}
+ <p className="mt-4 text-sm text-muted-foreground">Questions about your plan? <a href="/contact" target="_blank" rel="noopener noreferrer" aria-label="Contact us (opens in a new tab)" className="inline-flex min-h-11 items-center gap-1 rounded-sm text-foreground underline underline-offset-4 focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-ring">Contact us<ExternalLink className="size-3.5" aria-hidden="true" /></a></p>
</section>
{billing.isError && <p role="alert" className="text-sm text-destructive">Couldn&apos;t refresh your plan. Check your connection and refresh status.</p>}
{billing.returnFrom && <p role="status" className="text-sm text-muted-foreground">
diff --git a/src/web/src/test/e2e-ui/19-marketing-seo.spec.ts b/src/web/src/test/e2e-ui/19-marketing-seo.spec.ts
index 4902e156f..49fdb4769 100644
--- a/src/web/src/test/e2e-ui/19-marketing-seo.spec.ts
+++ b/src/web/src/test/e2e-ui/19-marketing-seo.spec.ts
@@ -192,13 +192,22 @@ test("desktop landing keeps the embedded phone Back control on true mobile geome
})
for (const width of [1440, 390]) {
- test(`contact preserves its layout after client navigation at ${width}px`, async ({ page, context, baseURL }) => {
+ test(`contact preserves its layout after client navigation at ${width}px`, async ({ page, context, baseURL }, testInfo) => {
await context.addCookies([{ name: "alook_analytics_consent", value: "v1.denied", url: baseURL! }])
await page.setViewportSize({ width, height: 900 })
await page.emulateMedia({ reducedMotion: "reduce" })
await page.goto("/contact")
await page.evaluate(() => document.fonts.ready)
+ const gusX = page.getByRole("link", { name: "X @im_gusye", exact: true })
+ await expect(gusX).toBeVisible()
+ await expect(gusX).toHaveAttribute("href", "https://x.com/im_gusye")
+ await gusX.focus()
+ await expect(gusX).toBeFocused()
+ expect((await gusX.boundingBox())!.height).toBeGreaterThanOrEqual(44)
+ expect(await page.evaluate(() => document.documentElement.scrollWidth)).toBeLessThanOrEqual(width)
+ await page.screenshot({ path: testInfo.outputPath("contact-gus-x.png"), fullPage: true })
+
const contactLayout = () => page.locator("main").evaluate((main) => {
const sheet = main.querySelector("section")!
const style = (element: Element, properties: string[]) => {
@@ -234,5 +243,33 @@ for (const width of [1440, 390]) {
await page.getByTestId(tid.landingFooterNavigation).getByRole("link", { name: "Contact", exact: true }).click()
await expect(page).toHaveURL(/\/contact$/)
await expect.poll(contactLayout).toEqual(direct)
+ await page.goto("/pricing")
+ const contact = page.getByRole("link", { name: "Contact us", exact: true })
+ await expect(contact).toBeInViewport()
+ const box = await contact.boundingBox()
+ const plans = await page.getByRole("region", { name: "Alook plans" }).boundingBox()
+ expect(box!.height).toBeGreaterThanOrEqual(44)
+ expect(box!.y + box!.height).toBeLessThan(plans!.y)
+ expect(await page.evaluate(() => document.documentElement.scrollWidth)).toBeLessThanOrEqual(width)
+ await expect(page.getByRole("heading", { name: "Free", exact: true }).locator("..").getByRole("button")).not.toHaveText("Loading…")
+ await page.screenshot({ path: testInfo.outputPath("pricing-contact.png") })
+ await contact.focus()
+ await page.keyboard.press("Enter")
+ await expect(page).toHaveURL(/\/contact$/)
+ await expect(page.getByRole("heading", { name: "Let’s talk." })).toBeVisible()
+ await expect.poll(contactLayout).toEqual(direct)
+
+ await page.route("**/api/pricing", (route) => route.fulfill({
+ status: 503, contentType: "application/json", body: JSON.stringify({ error: "Unavailable" }),
+ }))
+ await page.goto("/pricing")
+ await expect(page.getByRole("main").getByRole("alert")).toContainText("Couldn't load plans")
+ await expect(page.getByRole("heading", { name: "Free", exact: true }).locator("..").getByRole("button")).toBeDisabled()
+ await expect(contact).toBeInViewport()
+ await contact.focus()
+ await page.keyboard.press("Enter")
+ await expect(page).toHaveURL(/\/contact$/)
+ await expect(page.getByRole("heading", { name: "Let’s talk." })).toBeVisible()
+ await expect.poll(contactLayout).toEqual(direct)
})
}
diff --git a/src/web/src/test/e2e-ui/64-billing-contact.spec.ts b/src/web/src/test/e2e-ui/64-billing-contact.spec.ts
new file mode 100644
index 000000000..e11b45c0a
--- /dev/null
+++ b/src/web/src/test/e2e-ui/64-billing-contact.spec.ts
@@ -0,0 +1,43 @@
+import { expect, test } from "./_fixtures/community-fixture"
+import { tid } from "./_fixtures/testids"
+
+test("plan Contact stays usable without billing data and preserves the plan tab", async ({ asUser }, testInfo) => {
+ for (const width of [1280, 390]) {
+ const { page, context } = await asUser("alice", { viewport: { width, height: 844 } })
+ const billingWrites: string[] = []
+ context.on("request", (request) => {
+ if (request.method() !== "GET" && new URL(request.url()).pathname.startsWith("/api/community/billing")) billingWrites.push(request.url())
+ })
+ let releaseBilling!: () => void
+ const billingGate = new Promise<void>((resolve) => { releaseBilling = resolve })
+ await page.route("**/api/community/billing", async (route) => {
+ await billingGate
+ await route.fulfill({ status: 503, contentType: "application/json", body: JSON.stringify({ error: "Unavailable" }) })
+ })
+ await page.goto("/c/me/friends?settings=billing")
+ const panel = page.getByTestId(tid.billingSheet)
+ const contact = panel.getByRole("link", { name: "Contact us (opens in a new tab)" })
+ await expect(contact).toBeInViewport()
+ await expect(panel.getByLabel("Loading billing")).toBeVisible()
+ expect((await contact.boundingBox())!.height).toBeGreaterThanOrEqual(44)
+ for (const phase of ["loading", "error"]) {
+ if (phase === "error") {
+ releaseBilling()
+ await expect(panel.getByRole("alert")).toContainText("Couldn't refresh your plan")
+ }
+ await testInfo.attach(`billing-contact-${phase}-${width}`, { body: await page.screenshot(), contentType: "image/png" })
+ const opened = context.waitForEvent("page")
+ await contact.focus()
+ await page.keyboard.press("Enter")
+ const contactPage = await opened
+ await expect(contactPage).toHaveURL(/\/contact$/)
+ await expect(contactPage.getByRole("heading", { name: "Let’s talk." })).toBeVisible()
+ expect(await contactPage.evaluate(() => window.opener)).toBeNull()
+ await expect(page).toHaveURL(/\/c\/me\/friends\?settings=billing$/)
+ await expect(contact).toBeVisible()
+ expect(billingWrites).toEqual([])
+ await contactPage.close()
+ }
+ await context.close()
+ }
+})