Skip to content

fix(landing): streamline lead capture and crawler routes#269

Merged
lentil32 merged 14 commits into
mainfrom
fix-bing
Jun 4, 2026
Merged

fix(landing): streamline lead capture and crawler routes#269
lentil32 merged 14 commits into
mainfrom
fix-bing

Conversation

@lentil32
Copy link
Copy Markdown
Contributor

@lentil32 lentil32 commented Jun 2, 2026

One-Line Summary

Updates landing lead capture to use Astro actions with local Slack emulation, keeps footer contact native, and preserves crawler-facing sitemap and Markdown routing behavior.

User-Facing Changes

  • Product update and footer contact submissions now use Astro actions and send Slack lead notifications through the same server-side path.
  • Local landing dev starts a Slack emulator automatically when LANDING_SLACK_WEBHOOK_URL is not set; no separate LANDING_SLACK_EMULATOR flag is required.
  • The footer Contact entry now links to a native footer contact form instead of opening the old modal.
  • The footer form submits without a page reload and shows a single status message: We use this only to follow up on your request. before submit, then success or error feedback.
  • Sitemap output includes explicit crawler metadata, and docs Markdown sidecar requests continue to route through the Cloudflare Worker before static assets.

Why This Changed

The previous landing lead flow mixed custom API routes, modal-specific browser code, and local-vs-production Slack branching. That made local Slack testing harder to understand and let the footer contact interaction drift from the product updates form. Astro actions give the forms a native HTML action fallback while still allowing progressive enhancement for no-reload submissions.

How It Changed

  • Replaced the legacy landing lead API routes with src/actions/index.ts actions that accept form submissions.
  • Added scripts/dev-with-slack.ts so bun run dev wires LANDING_SLACK_WEBHOOK_URL to a local Slack emulator unless a real webhook URL is already configured.
  • Replaced the footer contact modal/custom element with FooterContactSection.astro, a plain <form action={actions.contact} method="POST"> plus a small submit handler for no-reload feedback.
  • Removed the old footer contact button script and modal/error-shake styling.
  • Kept the production Slack path environment-driven with LANDING_SLACK_WEBHOOK_URL; local emulation is selected by absence of that webhook, not by another flag.
  • Updated landing sitemap, Worker-first routing, and worker type generation so generated Markdown routes remain crawler-friendly.
  • After merging origin/main, normalized three Result.err(...) branches in data-source query code so type-aware lint passes on the merged branch.

Bug Fixes

  • Under footer contact clicks, the old modal/button path could stop responding; the Contact link now anchors to a rendered form.
  • Under footer contact submission, the browser no longer performs a page navigation when client JavaScript is available.
  • Under local landing dev without a Slack webhook, lead submissions now reach the local Slack emulator consistently.
  • Under type-aware lint after merging origin/main, returning narrowed Err objects directly failed assignability checks; those error branches now rewrap the existing error with the target result type.

Performance Notes (Optional)

  • Removed modal-specific client code from the footer contact flow and kept the new interaction as a small Astro component script.

Extra Context / Decisions (Optional)

  • Backward compatibility for old landing API endpoints and the modal implementation was intentionally not preserved.
  • worker-configuration.d.ts is generated by Wrangler and is included from the current Cloudflare config.

Verification

  • rtk bun install
  • rtk bun lint --format json
  • rtk bun lint --type-aware --type-check
  • rtk bun format
  • rtk bun run typecheck from apps/landing
  • rtk bun run build from apps/landing
  • rtk bunx turbo typecheck --json
  • rtk bunx turbo test --filter=@onequery/server --json
  • In-app Browser DOM check on http://127.0.0.1:4546/#footer-contact: #footer-contact, form controls, submit button, and the follow-up copy each resolved once after restarting the Astro dev server.
  • rtk git push origin fix-bing passed pre-push lint-full with oxlint . --type-aware --type-check reporting 0 warnings and 0 errors.

Video / Screenshot (Optional)

  • N/A

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Jun 2, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
onequery-landing 9100e1f Commit Preview URL

Branch Preview URL
Jun 04 2026, 04:21 AM

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 02188e362c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread package.json Outdated
@lentil32 lentil32 changed the title fix(landing): configure sitemap and Worker-first routing fix(landing): streamline lead capture and crawler routes Jun 4, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9c91ff6bd4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/landing/src/actions/index.ts
Comment thread apps/landing/wrangler.toml Outdated
@lentil32 lentil32 merged commit 1018116 into main Jun 4, 2026
10 checks passed
@lentil32 lentil32 deleted the fix-bing branch June 4, 2026 04:25
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9100e1fd72

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

};
const EmailSchema = z.preprocess(
(value) => (typeof value === "string" ? value.trim() : value),
z.email({ pattern: z.regexes.html5Email })
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore the email length cap before sending Slack fields

When an action is called directly with an HTML5-regex-valid but very long email address, this schema now accepts it because the previous max(320) cap from server/schemas.ts was dropped. That value is then embedded in a Slack section.fields entry by createProductUpdatesNotification()/createContactNotification(), so addresses above roughly 3 KB can exceed Slack's field text limit and turn an otherwise handled submission into a webhook rejection; keep the prior 320-character cap on the action schema before building the Slack payload.

Useful? React with 👍 / 👎.

class="marketing-updates-form"
method="POST"
action="/api/product-updates/"
action={actions.productUpdates}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid action-form posts from prerendered pages

On the homepage this component is rendered by src/pages/index.astro, which still exports prerender = true; the previous /api/product-updates/ endpoint worked from a prerendered page, but action={actions.productUpdates} switches the no-JavaScript/browser fallback path to Astro's form-action API. Astro documents that pages must be on-demand rendered for form-action submissions (https://docs.astro.build/en/guides/actions/#call-actions-from-an-html-form-action), so if the client bundle fails to load or JavaScript is disabled the POST cannot be handled as intended; either keep an API endpoint/JS-only action URL or stop prerendering pages containing these forms.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant