undo zod changes that give type error

paypal-app-refactor
Alan 2023-09-28 18:55:11 -07:00
parent 50985aba14
commit 3f172e1c33
2 changed files with 2 additions and 6 deletions

View File

@ -14,7 +14,6 @@ import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Alert, Select, TextField } from "@calcom/ui";
import type { appDataSchema } from "../zod";
import { defaultCurrency } from "../zod";
import { PaypalPaymentOptions as paymentOptions } from "../zod";
type Option = { value: string; label: string };
@ -24,7 +23,7 @@ const EventTypeAppCard: EventTypeAppCardComponent = function EventTypeAppCard({
const { getAppData, setAppData } = useAppContextWithSchema<typeof appDataSchema>();
const price = getAppData("price");
const currency = getAppData("currency") || defaultCurrency;
const currency = getAppData("currency");
const [selectedCurrency, setSelectedCurrency] = useState(currencyOptions.find((c) => c.value === currency));
const [currencySymbol, setCurrencySymbol] = useState(
isAcceptedCurrencyCode(currency) ? currencySymbols[currency] : ""

View File

@ -1,7 +1,6 @@
import { z } from "zod";
import { eventTypeAppCardZod } from "@calcom/app-store/eventTypeAppCardZod";
import { currencyOptions } from "@calcom/app-store/paypal/lib/currencyOptions";
const paymentOptionSchema = z.object({
label: z.string(),
@ -29,12 +28,10 @@ const VALUES: [PaymentOption, ...PaymentOption[]] = [
];
export const paymentOptionEnum = z.enum(VALUES);
export const defaultCurrency = currencyOptions[0].value;
export const appDataSchema = eventTypeAppCardZod.merge(
z.object({
price: z.number(),
currency: z.string().default(defaultCurrency),
currency: z.string(),
paymentOption: z.string().optional(),
enabled: z.boolean().optional(),
})