Skip to content

feat(contact): add contact page, migrate help/demo forms to useMutation#4242

Merged
waleedlatif1 merged 3 commits intostagingfrom
waleedlatif1/contact-page
Apr 21, 2026
Merged

feat(contact): add contact page, migrate help/demo forms to useMutation#4242
waleedlatif1 merged 3 commits intostagingfrom
waleedlatif1/contact-page

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Add /contact page with rate-limited form that mirrors the in-product help ticket flow (forwards to help@, sends confirmation email via renderHelpConfirmationEmail)
  • Link /contact from the landing footer; typed landing_contact_submitted PostHog event
  • Migrate help modal and demo-request modal from raw fetch + useState to useMutation
  • Remove stale z-index MutationObserver + setInterval(100ms) hack from help modal — emcn --z-popover (300) already renders above --z-modal (200)
  • Fix help modal's image preview URL lifecycle (no longer revokes still-visible URLs on every upload)
  • Guard all three forms against double-submit while a request is in flight
  • Strip ~14 unnecessary useCallback wrappers from the two modals

Type of Change

  • New feature

Testing

Tested manually. Typecheck and biome clean.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Apr 21, 2026 6:57pm

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 21, 2026

PR Summary

Medium Risk
Adds a new public POST /api/contact endpoint that sends emails and applies IP-based rate limiting; misconfiguration or validation mistakes could impact deliverability or spam exposure. Remaining changes are mostly client-side refactors to submission state management.

Overview
Adds a new landing /contact page with a validated contact form and direct-contact mailto links, and exposes a new POST /api/contact route that rate-limits by IP, forwards submissions to help@…, and attempts to send a confirmation email.

Refactors the landing demo-request modal and the in-product help modal to use useMutation (including double-submit guards and consistent error handling), extracts a shared LandingField component with improved accessibility wiring, and updates help image preview lifecycle/z-index handling. Also adds a footer link to /contact and introduces a typed PostHog event landing_contact_submitted.

Reviewed by Cursor Bugbot for commit 2e8ff3c. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 21, 2026

Greptile Summary

This PR adds a /contact landing page with a rate-limited form (mirroring the help-ticket flow), links it from the footer, migrates the help and demo-request modals from raw fetch + useState to useMutation, removes a large MutationObserver/setInterval z-index hack, fixes image-preview URL lifecycle in the help modal, and extracts LandingField into a shared component with proper accessibility (aria-describedby injection via cloneElement). The implementation is clean; previous reviewer concerns about schema exposure, confirmation-email type mapping, and ARIA wiring are all addressed in this iteration.

Confidence Score: 5/5

Safe to merge — all previously raised concerns are resolved and no new P0/P1 issues found.

All three P1/P2 findings from the previous review round (schema exposure on 400, confirmation email type mapping, aria-describedby wiring) are addressed. The useMutation migration is correct across all three forms, helpMutation.reset() is now called on modal open, image URL cleanup is correctly ordered via imagesRef, and the rate limiter is appropriately configured for a public endpoint. No remaining blocking issues.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/app/api/contact/route.ts New public POST endpoint with token-bucket rate limiting, Zod validation, topic-mapped confirmation email, and structured error handling; previously raised issues (schema leakage, wrong email type) are resolved.
apps/sim/app/(landing)/components/contact/contact-form.tsx New contact form using useMutation with client-side Zod validation, double-submit guard, and accessible LandingField wrappers; logic is sound.
apps/sim/app/(landing)/components/forms/landing-field.tsx New shared form-field wrapper that injects aria-describedby and aria-invalid via cloneElement when an error is present; cleanly addresses the previous ARIA concern.
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/help-modal/help-modal.tsx Migrated to useMutation, removed the MutationObserver/setInterval z-index hack, fixed image-URL revoke lifecycle (imagesRef pattern), helpMutation.reset() correctly called on modal open.
apps/sim/app/(landing)/components/demo-request/demo-request-modal.tsx Migrated from raw fetch/useState to useMutation, unnecessary useCallback wrappers removed, shared LandingField imported, demoMutation.reset() called in resetForm.
apps/sim/app/(landing)/components/contact/consts.ts New config file with Zod schema, topic enum, topic-to-help-type mapper, and label helper; properly separated from rendering code per project conventions.
apps/sim/app/(landing)/contact/page.tsx New contact page with metadata, direct-contact cards, and ContactForm; footer conditionally rendered for hosted env.
apps/sim/app/(landing)/components/footer/footer.tsx Adds Contact link to RESOURCES_LINKS; trivial change.
apps/sim/lib/posthog/events.ts Adds landing_contact_submitted event type with topic property; consistent with existing event map pattern.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User fills /contact form] --> B{Client-side Zod validation}
    B -- invalid --> C[Show field errors]
    B -- valid --> D[contactMutation.mutate]
    D --> E[POST /api/contact]
    E --> F{Rate limit check\n10 tokens, 5/min refill}
    F -- exceeded --> G[429 Too Many Requests]
    F -- allowed --> H{Server Zod validation}
    H -- invalid --> I[400 Invalid request data]
    H -- valid --> J[sendEmail to help@domain\nsubject: CONTACT:TOPIC subject]
    J -- failure --> K[500 Failed to send]
    J -- success --> L[sendEmail confirmation\nto submitter]
    L --> M[201 success response]
    M --> N[onSuccess: PostHog event\nlanding_contact_submitted]
    N --> O[Show success screen]
    L -. fire & forget\nerrors are logged .-> M
Loading

Reviews (2): Last reviewed commit: "improvement(landing): extract shared Lan..." | Re-trigger Greptile

Comment thread apps/sim/app/api/contact/route.ts Outdated
Comment thread apps/sim/app/api/contact/route.ts Outdated
Comment thread apps/sim/app/(landing)/components/contact/contact-form.tsx
Comment thread apps/sim/app/(landing)/components/contact/contact-form.tsx Outdated
- Map contact topic to help email type for accurate confirmation emails
- Drop Zod schema details from 400 response on public /api/contact
- Wire aria-describedby + aria-invalid in LandingField for both forms
- Reset helpMutation on modal reopen to match demo-request pattern
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 2e8ff3c. Configure here.

@waleedlatif1 waleedlatif1 merged commit 2456128 into staging Apr 21, 2026
14 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/contact-page branch April 21, 2026 19:20
waleedlatif1 added a commit that referenced this pull request Apr 21, 2026
…on (#4242)

* feat(contact): add contact page, migrate help/demo forms to useMutation

* improvement(contact): address greptile review feedback

- Map contact topic to help email type for accurate confirmation emails
- Drop Zod schema details from 400 response on public /api/contact
- Wire aria-describedby + aria-invalid in LandingField for both forms
- Reset helpMutation on modal reopen to match demo-request pattern

* improvement(landing): extract shared LandingField component
waleedlatif1 added a commit that referenced this pull request Apr 21, 2026
…S/CloudWatch/DynamoDB (#4245)

* feat(integrations): add AWS SES, IAM Identity Center, and enhanced IAM/STS/CloudWatch/DynamoDB integrations

- Add AWS SES v2 integration with 9 operations (send email, templated, bulk, templates, account)
- Add AWS IAM Identity Center integration with 12 operations (account assignments, permission sets, users, groups)
- Add 3 new IAM tools: list-attached-role-policies, list-attached-user-policies, simulate-principal-policy
- Fix DynamoDB duplicate subBlock IDs, add operation-scoped field names, add subblock migrations
- Add authMode: AuthMode.ApiKey to DynamoDB block
- Fix CloudWatch routes: toError, client.destroy(), withRouteHandler, auth outside try
- Fix STS/DynamoDB/IAM routes: nullable Zod schemas, withRouteHandler adoption
- Fix Identity Center: list_instances pagination, list_groups instanceArn condition
- Add subblock migrations for renamed DynamoDB fields (key, filterExpression, etc.)
- Apply withRouteHandler to all new and existing AWS tool routes

* docs(ses): add manual intro section to SES docs

* fix(dynamodb): add legacy fallbacks in params for subblock migration compatibility

Workflows saved with the old shared IDs (key, filterExpression, etc.) that migrate
to get-scoped slots via subblock-migrations still work correctly on update/delete/scan/put
operations via fallback lookups in tools.config.params.

* feat(contact): add contact page, migrate help/demo forms to useMutation (#4242)

* feat(contact): add contact page, migrate help/demo forms to useMutation

* improvement(contact): address greptile review feedback

- Map contact topic to help email type for accurate confirmation emails
- Drop Zod schema details from 400 response on public /api/contact
- Wire aria-describedby + aria-invalid in LandingField for both forms
- Reset helpMutation on modal reopen to match demo-request pattern

* improvement(landing): extract shared LandingField component

* fix(landing): resolve error-page crash on invalid /models and /integrations routes (#4243)

* fix(layout): use plain inline script for PublicEnvScript to set env before chunks eval on error pages

* fix(landing): handle runtime env race on error-page renders

React skips SSR on unhandled server errors and re-renders on the client
(see vercel/next.js#63980, #82456). Root-layout scripts — including the
runtime env script that populates window.__ENV — are inserted but not
executed on that client re-render, so any client module that reads env
at module evaluation crashes the render into a blank "Application error"
overlay instead of rendering the styled 404.

This replaces the earlier PublicEnvScript tweak with the architectural
fix:

- auth-client.ts: fall back to window.location.origin when getBaseUrl()
  throws on the client. Auth endpoints are same-origin, so this is the
  correct baseURL on the client. Server-side we still throw on genuine
  misconfig.
- loading.tsx under /models/[provider], /models/[provider]/[model], and
  /integrations/[slug]: establishes a Suspense boundary below the root
  layout so a page-level notFound() no longer invalidates the layout's
  SSR output (the fix endorsed by Next.js maintainers in #63980).
- layout.tsx: revert disableNextScript — the research showed this
  doesn't actually fix error-page renders. The real fix is above.

* improvement(landing): use emcn Loader in scoped loading.tsx, trim auth-client comment

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>

* fix(iam): correct MissingContextValues mapping in simulatePrincipalPolicy

* fix(aws): add conditionExpression migration fallback for DynamoDB delete, fix SES pageSize min

* fix(aws): deep validation fixes across SES, IAM, Identity Center, DynamoDB integrations

- IAM: replace non-existent StatementId with SourcePolicyType in simulatePrincipalPolicy
- IAM: add .int() constraint to list-users/roles/policies/groups Zod schemas
- IAM: remove redundant manual requestId from all 21 IAM route handlers
- SES: add .refine() body validation to create-template route
- SES: make bulk email destination templateData optional, only include ReplacementEmailContent when present
- SES: fix pageSize guard to if (pageSize != null) to correctly forward 0
- SES: add max(100) to list-templates pageSize, revert list-identities to min(0) per SDK
- STS: fix logger.error calls to use structured metadata pattern
- Identity Center: remove deprecated account.Status fallback, use account.State only
- DynamoDB: convert empty interface extends to type aliases, remove redundant error field, fix barrel to absolute imports

* regen docs

* fix(iam): add .int() constraint to maxSessionDuration in create-role route

* fix(ses): forward pageSize=0 correctly in listIdentities util

* fix(aws): add gradient background to IdentityCenterIcon, fix listTemplates pageSize guard

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
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