7c3090bc23
* Updating checkbox field to reflect new designs * Include Infobadge option checkbox * Checkbox Field + i18n * Default checked - true * Sync with router * Extracting Types * Update filtering logic * Add UI to booking page * Default address/link * Update hashedlink page * Tidy up * Video icon * Add nullish check * Update to use RHF controller Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
import { Frequency as RRuleFrequency } from "rrule";
|
|
import { z } from "zod";
|
|
|
|
import { LocationType } from "@calcom/core/location";
|
|
import { slugify } from "@calcom/lib/slugify";
|
|
|
|
export const eventTypeLocations = z.array(
|
|
z.object({
|
|
type: z.nativeEnum(LocationType),
|
|
address: z.string().optional(),
|
|
link: z.string().url().optional(),
|
|
displayLocationPublicly: z.boolean().optional(),
|
|
hostPhoneNumber: z.string().optional(),
|
|
})
|
|
);
|
|
|
|
// Matching RRule.Options: rrule/dist/esm/src/types.d.ts
|
|
export const recurringEvent = z.object({
|
|
dtstart: z.date().optional(),
|
|
interval: z.number().optional(),
|
|
count: z.number().optional(),
|
|
freq: z.nativeEnum(RRuleFrequency).optional(),
|
|
until: z.date().optional(),
|
|
tzid: z.string().optional(),
|
|
});
|
|
|
|
export const eventTypeSlug = z.string().transform((val) => slugify(val.trim()));
|
|
export const stringToDate = z.string().transform((a) => new Date(a));
|
|
export const stringOrNumber = z.union([z.string().transform((v) => parseInt(v, 10)), z.number().int()]);
|