diff --git a/apps/dashboard/src/components/settings/Account/Billing/SubscriptionCoupons/CouponsUI.tsx b/apps/dashboard/src/components/settings/Account/Billing/SubscriptionCoupons/CouponsUI.tsx
index 990fd5e0124..e5bdf1f0aa9 100644
--- a/apps/dashboard/src/components/settings/Account/Billing/SubscriptionCoupons/CouponsUI.tsx
+++ b/apps/dashboard/src/components/settings/Account/Billing/SubscriptionCoupons/CouponsUI.tsx
@@ -1,24 +1,7 @@
"use client";
import { Spinner } from "@/components/ui/Spinner/Spinner";
-import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
-import {
- Dialog,
- DialogContent,
- DialogDescription,
- DialogHeader,
- DialogTitle,
- DialogTrigger,
-} from "@/components/ui/dialog";
-import {
- Form,
- FormControl,
- FormField,
- FormItem,
- FormLabel,
-} from "@/components/ui/form";
-import { Input } from "@/components/ui/input";
import {
Table,
TableBody,
@@ -29,22 +12,16 @@ import {
TableRow,
} from "@/components/ui/table";
import { ToolTipLabel } from "@/components/ui/tooltip";
-import { zodResolver } from "@hookform/resolvers/zod";
import { useMutation } from "@tanstack/react-query";
import { format, fromUnixTime } from "date-fns";
import {
- AlertCircleIcon,
CalendarIcon,
CalendarX2Icon,
ClockIcon,
InfinityIcon,
- PlusIcon,
- TicketCheckIcon,
Trash2Icon,
} from "lucide-react";
-import { useForm } from "react-hook-form";
import { toast } from "sonner";
-import { z } from "zod";
type Coupon = {
id: string;
@@ -119,21 +96,21 @@ export function CouponsUI(props: CouponsUIProps) {
Coupons
-
+ {/*
*/}
{props.status === "success" && props.activeCoupons.length > 0 ? (
@@ -255,137 +232,140 @@ function DeleteCouponButton(props: {
);
}
-const applyCouponFormSchema = z.object({
- promoCode: z.string().min(1, "Coupon code is required"),
-});
+// UI to add coupon is disable for now
+// this will be enabled later in future with some changes
-function ApplyCouponModalContent(props: {
- isPaymentSetup: boolean;
- applyCoupon: ApplyCouponFn;
- accountCoupon: CouponData | undefined;
-}) {
- const applyCoupon = useMutation({
- mutationFn: props.applyCoupon,
- });
+// const applyCouponFormSchema = z.object({
+// promoCode: z.string().min(1, "Coupon code is required"),
+// });
- const form = useForm>({
- resolver: zodResolver(applyCouponFormSchema),
- defaultValues: {
- promoCode: "",
- },
- });
+// function ApplyCouponModalContent(props: {
+// isPaymentSetup: boolean;
+// applyCoupon: ApplyCouponFn;
+// accountCoupon: CouponData | undefined;
+// }) {
+// const applyCoupon = useMutation({
+// mutationFn: props.applyCoupon,
+// });
- async function onSubmit(values: z.infer) {
- try {
- const res = await applyCoupon.mutateAsync(values.promoCode);
- switch (res.status) {
- case 200: {
- toast.success("Coupon applied successfully");
+// const form = useForm>({
+// resolver: zodResolver(applyCouponFormSchema),
+// defaultValues: {
+// promoCode: "",
+// },
+// });
- break;
- }
- case 400: {
- toast.error("Coupon code is invalid");
- break;
- }
- case 401: {
- toast.error("You are not authorized to apply coupons", {
- description: "Login to dashboard and try again",
- });
- break;
- }
- case 409: {
- toast.error("Coupon already applied");
- break;
- }
- case 429: {
- toast.error("Too many coupons applied in a short period", {
- description: "Please try again after some time",
- });
- break;
- }
- default: {
- toast.error("Failed to apply coupon");
- }
- }
- } catch {
- toast.error("Failed to apply coupon");
- }
- }
+// async function onSubmit(values: z.infer) {
+// try {
+// const res = await applyCoupon.mutateAsync(values.promoCode);
+// switch (res.status) {
+// case 200: {
+// toast.success("Coupon applied successfully");
- const couponEnabled = props.isPaymentSetup && !props.accountCoupon;
+// break;
+// }
+// case 400: {
+// toast.error("Coupon code is invalid");
+// break;
+// }
+// case 401: {
+// toast.error("You are not authorized to apply coupons", {
+// description: "Login to dashboard and try again",
+// });
+// break;
+// }
+// case 409: {
+// toast.error("Coupon already applied");
+// break;
+// }
+// case 429: {
+// toast.error("Too many coupons applied in a short period", {
+// description: "Please try again after some time",
+// });
+// break;
+// }
+// default: {
+// toast.error("Failed to apply coupon");
+// }
+// }
+// } catch {
+// toast.error("Failed to apply coupon");
+// }
+// }
- return (
-
+//
+// );
+// }