mirror of
https://github.com/formbricks/formbricks.git
synced 2026-04-20 02:30:18 -05:00
fix: ending card url (#4364)
Co-authored-by: pandeymangg <anshuman.pandey9999@gmail.com> Co-authored-by: Anshuman Pandey <54475686+pandeymangg@users.noreply.github.com>
This commit is contained in:
@@ -44,3 +44,11 @@ export type TAllowedFileExtension = z.infer<typeof ZAllowedFileExtension>;
|
||||
export const ZId = z.string().cuid2();
|
||||
|
||||
export const ZUuid = z.string().uuid();
|
||||
|
||||
export const getZSafeUrl = (message: string): z.ZodEffects<z.ZodString, string, string> =>
|
||||
z
|
||||
.string()
|
||||
.url({ message })
|
||||
.refine((url) => url.startsWith("https://"), {
|
||||
message: "URL must start with https://",
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@ import { type ZodIssue, z } from "zod";
|
||||
import { ZSurveyFollowUp } from "@formbricks/database/types/survey-follow-up";
|
||||
import { ZActionClass, ZActionClassNoCodeConfig } from "../action-classes";
|
||||
import { ZAttributes } from "../attributes";
|
||||
import { ZAllowedFileExtension, ZColor, ZId, ZPlacement } from "../common";
|
||||
import { ZAllowedFileExtension, ZColor, ZId, ZPlacement, getZSafeUrl } from "../common";
|
||||
import { ZInsight } from "../insights";
|
||||
import { ZLanguage } from "../product";
|
||||
import { ZSegment } from "../segment";
|
||||
@@ -31,7 +31,7 @@ export const ZSurveyEndScreenCard = ZSurveyEndingBase.extend({
|
||||
headline: ZI18nString.optional(),
|
||||
subheader: ZI18nString.optional(),
|
||||
buttonLabel: ZI18nString.optional(),
|
||||
buttonLink: z.string().url("Invalid Button Url in Ending card").optional(),
|
||||
buttonLink: getZSafeUrl("Invalid Button Url in Ending card").optional(),
|
||||
imageUrl: z.string().optional(),
|
||||
videoUrl: z.string().optional(),
|
||||
});
|
||||
@@ -40,7 +40,7 @@ export type TSurveyEndScreenCard = z.infer<typeof ZSurveyEndScreenCard>;
|
||||
|
||||
export const ZSurveyRedirectUrlCard = ZSurveyEndingBase.extend({
|
||||
type: z.literal("redirectToUrl"),
|
||||
url: z.string().url("Invalid Redirect Url in Ending card").optional(),
|
||||
url: getZSafeUrl("Invalid Redirect Url").optional(),
|
||||
label: z.string().optional(),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user