-
Notifications
You must be signed in to change notification settings - Fork 11.7k
fix: Custom Event Redirect in Routing Form with Dropdown Based fields #17870
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
6c72ddf
Fix custom event redirect
hariombalhara 1ce46ba
feat: remove unused report.handler.ts and jsonLogicToPrisma functiona…
devin-ai-integration[bot] ddbfe83
feat: clean up remaining references to removed report functionality
devin-ai-integration[bot] 03d756a
Update packages/app-store/routing-forms/lib/getQueryBuilderConfig.ts
hariombalhara a557978
Merge remote-tracking branch 'origin/main' into fix-custom-event-redi…
hariombalhara 391d4c7
fix: routing forms variable substitution uses option labels instead o…
hariombalhara 86544ae
Merge remote-tracking branch 'origin/main' into fix-custom-event-redi…
hariombalhara f7bbb69
fix type error and unit tests
hariombalhara 71fac4a
fix type error and unit tests
hariombalhara 672f5ca
Merge remote-tracking branch 'origin/main' into fix-custom-event-redi…
hariombalhara 54e1239
Merge branch 'fix-custom-event-redirect-routing-forms' of https://git…
hariombalhara 1b5c0de
Merge remote-tracking branch 'origin/devin/remove-unused-report-handl…
hariombalhara File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,8 +16,8 @@ import { showToast } from "@calcom/ui/components/toast"; | |
|
|
||
| import { TRPCClientError } from "@trpc/react-query"; | ||
|
|
||
| import { getAbsoluteEventTypeRedirectUrl } from "../../getEventTypeRedirectUrl"; | ||
| import { findMatchingRoute } from "../../lib/processRoute"; | ||
| import { substituteVariables } from "../../lib/substituteVariables"; | ||
| import type { SingleFormComponentProps } from "../../types/shared"; | ||
| import type { RoutingForm, FormResponse, NonRouterRoute } from "../../types/types"; | ||
| import FormInputFields from "../FormInputFields"; | ||
|
|
@@ -92,7 +92,6 @@ export const TestForm = ({ | |
| const { t } = useLocale(); | ||
| const [response, setResponse] = useState<FormResponse>({}); | ||
| const [chosenRoute, setChosenRoute] = useState<NonRouterRoute | null>(null); | ||
| const [eventTypeUrlWithoutParams, setEventTypeUrlWithoutParams] = useState(""); | ||
| const searchParams = useCompatSearchParams(); | ||
| const [membersMatchResult, setMembersMatchResult] = useState<MembersMatchResultType | null>(null); | ||
| const [showResults, setShowResults] = useState(false); | ||
|
|
@@ -128,25 +127,27 @@ export const TestForm = ({ | |
|
|
||
| function testRouting() { | ||
| const route = findMatchingRoute({ form, response }); | ||
| let eventTypeRedirectUrl: string | null = null; | ||
|
|
||
| if (route?.action?.type === "eventTypeRedirectUrl") { | ||
| if ("team" in form) { | ||
| eventTypeRedirectUrl = getAbsoluteEventTypeRedirectUrl({ | ||
| eventTypeRedirectUrl: route.action.value, | ||
| form, | ||
| allURLSearchParams: new URLSearchParams(), | ||
| }); | ||
| setEventTypeUrlWithoutParams(eventTypeRedirectUrl); | ||
| } | ||
|
Comment on lines
-135
to
-141
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was unused as eventTypeUrlWithoutParams is also unused |
||
| // Create a copy of the route with substituted variables for display | ||
| let displayRoute = route; | ||
| if (route && form.fields && route.action.type === "eventTypeRedirectUrl") { | ||
| const substitutedUrl = substituteVariables(route.action.value, response, form.fields); | ||
| displayRoute = { | ||
| ...route, | ||
| action: { | ||
| ...route.action, | ||
| value: substitutedUrl, | ||
| }, | ||
| }; | ||
| } | ||
|
|
||
| setChosenRoute(route || null); | ||
| setChosenRoute(displayRoute || null); | ||
| setShowResults(true); | ||
|
|
||
| if (!route) return; | ||
|
|
||
| if (supportsTeamMembersMatchingLogic) { | ||
| // Custom Event Type Redirect URL has eventTypeId=0. Also, findTeamMembersMatchingAttributeLogicMutation can't work without eventTypeId | ||
| if (supportsTeamMembersMatchingLogic && route.action.eventTypeId) { | ||
| findTeamMembersMatchingAttributeLogicMutation.mutate({ | ||
| formId: form.id, | ||
| response, | ||
|
|
||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It now returns array only if the input value was an array, which is a better way and keeps the type unchanged