diff --git a/apps/web/app/(app)/(survey-editor)/environments/[environmentId]/surveys/[surveyId]/edit/components/CalQuestionForm.tsx b/apps/web/app/(app)/(survey-editor)/environments/[environmentId]/surveys/[surveyId]/edit/components/CalQuestionForm.tsx index e35573d789..d4d3a9a221 100644 --- a/apps/web/app/(app)/(survey-editor)/environments/[environmentId]/surveys/[surveyId]/edit/components/CalQuestionForm.tsx +++ b/apps/web/app/(app)/(survey-editor)/environments/[environmentId]/surveys/[surveyId]/edit/components/CalQuestionForm.tsx @@ -90,6 +90,15 @@ export const CalQuestionForm = ({ onChange={(e) => updateQuestion(questionIdx, { calUserName: e.target.value })} /> + +
+ updateQuestion(questionIdx, { calHost: e.target.value })} + /> +
diff --git a/apps/web/app/lib/questions.tsx b/apps/web/app/lib/questions.tsx index f6858e7ec0..30de860812 100644 --- a/apps/web/app/lib/questions.tsx +++ b/apps/web/app/lib/questions.tsx @@ -185,6 +185,7 @@ export const questionTypes: TQuestion[] = [ preset: { headline: { default: "Schedule a call with me" }, calUserName: "rick/get-rick-rolled", + calHost: "cal.com", } as Partial, }, { diff --git a/packages/lib/i18n/i18n.mock.ts b/packages/lib/i18n/i18n.mock.ts index a586749947..218bdb0906 100644 --- a/packages/lib/i18n/i18n.mock.ts +++ b/packages/lib/i18n/i18n.mock.ts @@ -228,6 +228,7 @@ export const mockCalQuestion: TSurveyCalQuestion = { default: "Skip", }, calUserName: "rick/get-rick-rolled", + calHost: "cal.com", id: "o3bnux6p42u9ew9d02l14r26", type: TSurveyQuestionTypeEnum.Cal, isDraft: true, diff --git a/packages/surveys/src/components/general/CalEmbed.tsx b/packages/surveys/src/components/general/CalEmbed.tsx index 9dde053f47..a72cbf67b3 100644 --- a/packages/surveys/src/components/general/CalEmbed.tsx +++ b/packages/surveys/src/components/general/CalEmbed.tsx @@ -44,7 +44,10 @@ export const CalEmbed = ({ question, onSuccessfulBooking }: CalEmbedProps) => { useEffect(() => { // remove any existing cal-inline elements document.querySelectorAll("cal-inline").forEach((el) => el.remove()); - cal("inline", { elementOrSelector: "#fb-cal-embed", calLink: question.calUserName }); + cal("inline", { + elementOrSelector: "#fb-cal-embed", + calLink: `https://${question.calHost}/${question.calUserName}`, + }); }, [cal, question.calUserName]); return ( diff --git a/packages/types/LegacySurvey.ts b/packages/types/LegacySurvey.ts index f90b8eb18f..5ed988e497 100644 --- a/packages/types/LegacySurvey.ts +++ b/packages/types/LegacySurvey.ts @@ -136,6 +136,7 @@ export type TLegacySurveyFileUploadQuestion = z.infer