feat(crm): working Web-to-Lead public form example#1996
Merged
Conversation
The app-crm example showed Web-to-Lead only via `customer.portal` `anonymousEntry` — a spec property with NO runtime consumer, so it never worked (404). Add the mechanism that actually does, and make the example coherent: - lead.view.ts: `web_to_lead` form view with `sharing.allowAnonymous` → live `GET/POST /api/v1/forms/contact-us` (+ /submit). - sales-roles.ts: `GuestPortalProfile` (isProfile, INSERT-only on crm_lead, keyed by FULL object name — the anonymous permission path requires it). - lead.object.ts: `status` gets `defaultValue: 'new'` so a minimal public create satisfies `required` (the option-level `default` is only a UI preselect). - customer.portal.ts: drop the dead `anonymousEntry` routes; point to the working form view instead (re-add when the runtime mounts anonymousEntry). - security/index.ts + objectstack.config.ts: export + register the guest profile. Doubles as a CI regression test for the public-form path (builds against the workspace) — the #1989 flattened-metadata resolution bug would have been caught here. Verified end-to-end (app-crm, no auth): GET /forms/contact-us → 200 form spec; POST /forms/contact-us/submit → creates a crm_lead (status=new); GET /data/crm_lead → 401 (guests can't read). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add a working Web-to-Lead public-form example to
app-crm.The example previously demonstrated Web-to-Lead only via
customer.portalanonymousEntry— a spec property with no runtime consumer (404, verified). So the canonical CRM example shipped a non-functional public form. This adds the mechanism that actually works and makes the example coherent.web_to_leadform view withsharing.allowAnonymous→ liveGET/POST /api/v1/forms/contact-us(+/submit).GuestPortalProfile(isProfile, INSERT-only oncrm_lead, keyed by the full object name — the anonymous permission path requires it).statusgetsdefaultValue: 'new'so a minimal public create satisfiesrequired(option-leveldefaultis only a UI preselect).anonymousEntryroutes; point to the working form view (re-add when the runtime mountsanonymousEntry).Why it matters
Builds against the workspace, so it's also a CI regression test for the public-form path — the #1989 flattened-metadata resolution bug would have been caught here.
Verified end-to-end (app-crm, no auth)
GET /api/v1/forms/contact-us→ 200 (form spec)POST /api/v1/forms/contact-us/submit→ creates acrm_lead(status=new)GET /api/v1/data/crm_lead→ 401 (guests can't read — INSERT-only enforced)validate ✓, app-crm tests 29/29. (Pre-existing example typecheck drift in unrelated files —
UI/Cube/ApiEndpointspec exports — is untouched.)🤖 Generated with Claude Code