mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-10 07:40:54 -06:00
@@ -90,6 +90,15 @@ export const CalQuestionForm = ({
|
||||
onChange={(e) => updateQuestion(questionIdx, { calUserName: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<Label htmlFor="calHost">Your self-hosted Cal.com instance</Label>
|
||||
<div className="mt-2">
|
||||
<Input
|
||||
id="calHost"
|
||||
name="calHost"
|
||||
value={question.calHost}
|
||||
onChange={(e) => updateQuestion(questionIdx, { calHost: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -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<TSurveyCalQuestion>,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -136,6 +136,7 @@ export type TLegacySurveyFileUploadQuestion = z.infer<typeof ZLegacySurveyFileUp
|
||||
export const ZLegacySurveyCalQuestion = ZLegacySurveyQuestionBase.extend({
|
||||
type: z.literal(TSurveyQuestionTypeEnum.Cal),
|
||||
calUserName: z.string(),
|
||||
calHost: z.string().optional(),
|
||||
logic: z.array(ZSurveyCalLogic).optional(),
|
||||
});
|
||||
|
||||
|
||||
@@ -383,6 +383,7 @@ export type TSurveyFileUploadQuestion = z.infer<typeof ZSurveyFileUploadQuestion
|
||||
export const ZSurveyCalQuestion = ZSurveyQuestionBase.extend({
|
||||
type: z.literal(TSurveyQuestionTypeEnum.Cal),
|
||||
calUserName: z.string(),
|
||||
calHost: z.string().optional(),
|
||||
logic: z.array(ZSurveyCalLogic).optional(),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user