Skip to content

feat(api): migrate widget intakes to unified form-submissions #195

Closed

Description

@Ardnived

Blocked by sydevs/SahajCloud#695. Do not start integration until that issue's Phase 3 PR is merged to main. Cleared 2026-09-16. Phase 3 merged as sydevs/SahajCloud#801 and is deployed, so pnpm types:cms now pulls the user-submissions shape.

The joint release did not happen: Phase 3 shipped alone, ahead of this repo and of sydevs/WeMeditateWeb's sibling child. main still posts to the deleted endpoints (src/config/api/mutate.ts:138 and :288), so event registration and report-an-issue fail against the live CMS today. This is a repair, not a migration to schedule. The cutover is still hard: no shims.

Summary

The CMS is unifying every public intake on one user-submissions collection (sydevs/SahajCloud#695). Three widget call sites move to it (voting needs no widget change -- see below); the request/response envelopes are Payload's built-in ones, which #171 already prepared this client for (errors[].data.code).

Proposed changes

Migrate each call site to POST /api/user-submissions (Turnstile stays in the x-turnstile-token header, as already sent):

  1. Event registration (today POST /api/events/{id}/register): body becomes { type: 'registration', event, startingAt, senderEmail, submissionData: [name, locale, question answers…], subscribe? }. Still synchronous — eligibility refusals arrive as coded 404/409 at errors[].data.code (not the old top-level code), and the success doc carries uuid (replaces registration.uuid in the old shape). The opt-in flag spawns the subscribe row server-side — no second call.
  2. Report an issue (today POST /api/user-messages, feat(report): migrate the issue-report form to POST /api/user-messages #187): becomes { type: 'contact', senderEmail, submissionData: [subject, message, context…] }. No form reference — recipient falls back to the CMS contact address, as today.
  3. Event proposals (today POST /api/event-submissions): becomes { type: 'proposal', event?, proposed, senderEmail, submissionData: [submitter name/note] }.
  4. Confirm/deny votes -- no widget change. Voting stays on the CMS-hosted feedback page (email link -- signed-token page -- vote -- redirect back to the atlas); the widget keeps only its existing read of the redirect param (usePostEventFeedback). The client-facing registrations update path is deleted CMS-side -- nothing here calls it, and nothing should start to.

Then pnpm types:cms against SahajCloud main: Registration / UserMessage / EventSubmission types disappear, UserSubmission gains the typed columns — fix what the compiler flags (RegistrationForm, ReportIssueForm, submission + feedback flows, store.ts types).

Acceptance criteria

  • Registering from the widget returns the uuid synchronously; a full/ended event shows the correct refusal (code read from errors[].data.code).
  • Registering with the mailing-list opt-in produces the linked subscribe row CMS-side with no extra widget call.
  • Report-an-issue and event proposals land as contact / proposal rows and screen/deliver as before.
  • The post-event feedback flow still works end-to-end (email link -- CMS feedback page -- atlas redirect renders the post-vote card) with no widget code change.
  • No code references the removed endpoints or types; pnpm lint && pnpm typecheck && pnpm test:run pass.

References

Activity

  1. added theissue type on Sep 5, 2026
  2. sydevs-bot commented on Sep 16, 2026

    @sydevs-bot
    Contributor

    @Ardnived unblocked: every blocker is closed. Say @sydevs-bot implement to start.

    🤖 sydevs dispatcher

  3. Ardnived commented on Sep 16, 2026

    @Ardnived
    ContributorAuthor

    Unblocked — and the cutover has already landed without this repo.

    sydevs/SahajCloud#695 Phase 3 merged as #801 and is deployed. Relabelled blocked → awaiting.

    This ticket's header says "Do not start integration until that issue's Phase 3 PR is merged to main" and "this repo releases together with SahajCloud's Phase 3". The first condition is met. The second did not happen: Phase 3 shipped alone.

    What that means right now

    Checked against production:

    GET https://cloud.sydevelopers.com/api/user-messages  →  404
    

    And main still posts to both deleted surfaces:

    • src/config/api/mutate.ts:138 → POST /events/${eventId}/register
    • src/config/api/mutate.ts:288 → POST /user-messages

    So event registration and the report-issue form now fail against the live CMS, wherever the widget is embedded — including the host sites served by auto.js from sahajatlas.com. This is no longer a migration to schedule; it is a repair.

    First step

    pnpm types:cms is now safe to run — it reads SahajCloud's main, which carries the user-submissions shape. That was the thing this ticket was waiting on.

  4. Ardnived commented on Sep 16, 2026

    @Ardnived
    ContributorAuthor

    @sydevs implement

  5. 7 remaining items

  6. Ardnived commented on Sep 17, 2026

    @Ardnived
    ContributorAuthor

    @sydevs-bot implement

  7. moved this from Revising to Approved in SYDevelopers Technical Roadmapon Sep 17, 2026
  8. added
    bot:workingLock: a cloud session is running on this item. Removed when it ends.
    on Sep 17, 2026
  9. removed
    bot:workingLock: a cloud session is running on this item. Removed when it ends.
    on Sep 17, 2026
  10. Ardnived commented on Oct 24, 2026

    @Ardnived
    ContributorAuthor

    Closing. Registration and report-an-issue moved to /user-submissions in #213 (report-an-issue finished via sydevs/SahajCloud#823 and #219). Voting needed no widget change.

    The two remaining items moved to #147, which is their only consumer:

    • the type: 'proposal' sender
    • the registration mailing-list opt-in box

    #213 left out Closes #195 on purpose while those were open, which is why no PR is linked here.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    Priority

    High

    Hold Until

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions