Skip to content

feat: routing forms integration for booker atom#18726

Merged
ThyMinimalDev merged 29 commits intomainfrom
remove-redirect-on-success-for-platform
Jan 29, 2025
Merged

feat: routing forms integration for booker atom#18726
ThyMinimalDev merged 29 commits intomainfrom
remove-redirect-on-success-for-platform

Conversation

@Ryukemeister
Copy link
Copy Markdown
Contributor

@Ryukemeister Ryukemeister commented Jan 17, 2025

What does this PR do?

  • Adds URL query parameters and inputs needed for routing forms in the booker atom

router

image
image
image

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • (N/A) I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • (N/A) I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

This can be tested in the examples app

  • connect to localhost:3000 using seeded credentials for org (owner1-acme@example.com / owner1-acme)
  • create routing forms for the seeded team
  • go to the example app
  • feed Router atoms with formId (id of the created form) and searchParams representing the answers to the questions created in the form fields, for example in the screenshot the only required field is "Territory"
  • if form is set to CustomMessage, displays a custom message
  • if form is set to eventTypeRedirect, display the booker atom embed
  • if form is set to externalRedirectUri, redirect to new page

@keithwillcode keithwillcode added core area: core, team members only platform Anything related to our platform plan labels Jan 17, 2025
@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Jan 29, 2025 9:24am
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Jan 29, 2025 9:24am

@Ryukemeister Ryukemeister changed the title feat: routing forms integration in booker atom feat: routing forms integration for booker atom Jan 17, 2025
@graphite-app graphite-app Bot requested a review from a team January 17, 2025 12:55
@graphite-app
Copy link
Copy Markdown

graphite-app Bot commented Jan 17, 2025

Graphite Automations

"Add platform team as reviewer" took an action on this PR • (01/17/25)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add foundation team as reviewer" took an action on this PR • (01/24/25)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add ready-for-e2e label" took an action on this PR • (01/29/25)

1 label was added to this PR based on Keith Williams's automation.

rest.teamId ?? false,
rest.usernameList,
rest.routedTeamMemberIds,
rest.skipContactOwner,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we are missing shouldServeCache here, no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ah yes, will fix this one

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

salesforce related query param is also missing.

Copy link
Copy Markdown
Contributor

@ThyMinimalDev ThyMinimalDev Jan 17, 2025

Choose a reason for hiding this comment

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

I don't see the salesforce parameter in the schema of the trpc endpoint for slots here packages/trpc/server/routers/viewer/slots/types.ts is it used at all ?

Copy link
Copy Markdown
Contributor Author

@Ryukemeister Ryukemeister Jan 20, 2025

Choose a reason for hiding this comment

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

Added some comments to explain why some parameters are left out here

…success-for-platform' into remove-redirect-on-success-for-platform
@dosubot dosubot Bot added routing-forms area: routing forms, routing, forms ✨ feature New feature or request labels Jan 17, 2025
@socket-security
Copy link
Copy Markdown

socket-security Bot commented Jan 28, 2025

No dependency changes detected. Learn more about Socket for GitHub ↗︎

👍 No dependency changes detected in pull request

Comment thread apps/api/v2/package.json Outdated
Comment thread apps/api/v2/src/modules/router/controllers/router.controller.ts Outdated
"text-default flex min-h-full w-full flex-col items-center",
layout === BookerLayouts.MONTH_VIEW ? "overflow-visible" : "overflow-clip"
layout === BookerLayouts.MONTH_VIEW ? "overflow-visible" : "overflow-clip",
`${customClassNames?.bookerWrapper}`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

new custom class for booker, can be used to enable dark mode by given dark as a class

fields: serializableForm.fields,
searchParams: new URLSearchParams(stringify(paramsToBeForwardedAsIs)),
searchParams: new URLSearchParams(
stringify({ ...paramsToBeForwardedAsIs, "cal.action": "eventTypeRedirectUrl" })
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

new action param in order for Router atom to know what to do easily

);
// Use Routing Form Url To Display Correct Booker
const routingFormUrlProps = useGetRoutingFormUrlProps(props);
if (props?.routingFormUrl && routingFormUrlProps) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if routing form prop is defined, ignore all other props and extract everything from the url

Comment thread packages/platform/atoms/booker/BookerPlatformWrapper.tsx Outdated
Comment thread packages/platform/atoms/router/Router.tsx Outdated
Comment on lines +130 to +134
new URLSearchParams({
isBookingDryRun: "true",
Territory: "Europe",
action: "externalRedirectUrl",
})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

responses to the routing form

@ThyMinimalDev ThyMinimalDev marked this pull request as ready for review January 29, 2025 08:15
@dosubot dosubot Bot added the bookings area: bookings, availability, timezones, double booking label Jan 29, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 29, 2025

E2E results are ready!

@ThyMinimalDev ThyMinimalDev merged commit 8615ccb into main Jan 29, 2025
@ThyMinimalDev ThyMinimalDev deleted the remove-redirect-on-success-for-platform branch January 29, 2025 11:52
MuhammadAimanSulaiman pushed a commit to hit-pay/cal.com that referenced this pull request Feb 25, 2025
* update booker atom for routing form

* remove logs

* hide routing form properties from docs

* fixup

* add comments to explain why certain fields are not defined for routing forms in v2

* chore: routing for handler return team and org id

* bump libraries platform

* fixup! bump libraries platform

* chore: get routing form params to embed

* logs to remove

* fix import path

* chore: handle routing form params in booker embed

* wip need router api v2 endpoint

* resolve merge conflicts

* fixup

* fixup! Merge branch 'main' into remove-redirect-on-success-for-platform

* fixup! fixup! Merge branch 'main' into remove-redirect-on-success-for-platform

* router atom

* fix libraries version

* cleanup

* remove console logs

* bump libraries

---------

Co-authored-by: Morgan Vernay <morgan@cal.com>
Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bookings area: bookings, availability, timezones, double booking core area: core, team members only ✨ feature New feature or request platform Anything related to our platform plan ready-for-e2e routing-forms area: routing forms, routing, forms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants