fix build
This commit is contained in:
@@ -22,11 +22,8 @@ import { isLocalhost } from "~/utils/client";
|
||||
const FormSchema = z.object({
|
||||
region: z.string(),
|
||||
unsendUrl: z.string().url(),
|
||||
sendRate: z.preprocess((val) => Number(val), z.number()),
|
||||
transactionalQuota: z.preprocess(
|
||||
(val) => Number(val),
|
||||
z.number().min(0).max(100)
|
||||
),
|
||||
sendRate: z.coerce.number(),
|
||||
transactionalQuota: z.coerce.number().min(0).max(100),
|
||||
});
|
||||
|
||||
type SesSettingsProps = {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { useEffect, useRef } from "react";
|
||||
|
||||
export function useInterval(callback: () => void, delay: number | null) {
|
||||
const savedCallback = useRef<() => void>();
|
||||
const savedCallback = useRef<(() => void) | null>(null);
|
||||
|
||||
// Remember the latest callback.
|
||||
useEffect(() => {
|
||||
|
@@ -125,13 +125,21 @@ export async function syncStripeData(customerId: string) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!subscription.items.data[0]) {
|
||||
return;
|
||||
}
|
||||
|
||||
await db.subscription.upsert({
|
||||
where: { id: subscription.id },
|
||||
update: {
|
||||
status: subscription.status,
|
||||
priceId: subscription.items.data[0]?.price?.id || "",
|
||||
currentPeriodEnd: new Date(subscription.current_period_end * 1000),
|
||||
currentPeriodStart: new Date(subscription.current_period_start * 1000),
|
||||
currentPeriodEnd: new Date(
|
||||
subscription.items.data[0]?.current_period_end * 1000
|
||||
),
|
||||
currentPeriodStart: new Date(
|
||||
subscription.items.data[0]?.current_period_start * 1000
|
||||
),
|
||||
cancelAtPeriodEnd: subscription.cancel_at
|
||||
? new Date(subscription.cancel_at * 1000)
|
||||
: null,
|
||||
@@ -142,8 +150,12 @@ export async function syncStripeData(customerId: string) {
|
||||
id: subscription.id,
|
||||
status: subscription.status,
|
||||
priceId: subscription.items.data[0]?.price?.id || "",
|
||||
currentPeriodEnd: new Date(subscription.current_period_end * 1000),
|
||||
currentPeriodStart: new Date(subscription.current_period_start * 1000),
|
||||
currentPeriodEnd: new Date(
|
||||
subscription.items.data[0]?.current_period_end * 1000
|
||||
),
|
||||
currentPeriodStart: new Date(
|
||||
subscription.items.data[0]?.current_period_start * 1000
|
||||
),
|
||||
cancelAtPeriodEnd: subscription.cancel_at
|
||||
? new Date(subscription.cancel_at * 1000)
|
||||
: null,
|
||||
|
@@ -6,7 +6,7 @@ const METER_EVENT_NAME = "unsend_usage";
|
||||
|
||||
export async function sendUsageToStripe(customerId: string, usage: number) {
|
||||
const stripe = new Stripe(env.STRIPE_SECRET_KEY!, {
|
||||
apiVersion: "2025-01-27.acacia",
|
||||
apiVersion: "2025-03-31.basil",
|
||||
});
|
||||
|
||||
const meterEvent = await stripe.billing.meterEvents.create({
|
||||
|
Reference in New Issue
Block a user