fix: react-doctor unused-export 141→~80 (remove dead exports, enums/marketing unused, inline campaignStatusEnum)

This commit is contained in:
Nora
2026-06-26 05:25:36 -06:00
parent 0ea11e4db6
commit 13d15883b1
34 changed files with 106 additions and 174 deletions
+23 -23
View File
@@ -33,7 +33,7 @@ export const stripe = {
};
// Plan tier configurations
export const PLANS = {
const PLANS = {
starter: {
id: "starter",
name: "Starter",
@@ -99,7 +99,7 @@ export const PLANS = {
} as const;
// Add-ons configuration
export const ADDONS = {
const ADDONS = {
wholesale_portal: {
id: "wholesale_portal",
name: "Wholesale Portal",
@@ -168,7 +168,7 @@ export interface CreateSubscriptionOptions {
metadata?: Record<string, string>;
}
export async function createSubscription(options: CreateSubscriptionOptions) {
async function createSubscription(options: CreateSubscriptionOptions) {
const { brandId, brandName, email, plan, interval, successUrl, cancelUrl, metadata } = options;
// Get or create Stripe customer
@@ -212,7 +212,7 @@ export async function createSubscription(options: CreateSubscriptionOptions) {
return session;
}
export async function createAddonSubscription(options: {
async function createAddonSubscription(options: {
customerId: string;
addon: keyof typeof ADDONS;
brandId: string;
@@ -256,7 +256,7 @@ export async function createAddonSubscription(options: {
// CUSTOMER PORTAL
// ============================================
export async function createCustomerPortalSession(options: {
async function createCustomerPortalSession(options: {
customerId: string;
returnUrl: string;
}) {
@@ -274,7 +274,7 @@ export async function createCustomerPortalSession(options: {
// SUBSCRIPTION UPDATES
// ============================================
export async function cancelSubscription(subscriptionId: string, immediate: boolean = false) {
async function cancelSubscription(subscriptionId: string, immediate: boolean = false) {
if (immediate) {
return await stripe.subscriptions.cancel(subscriptionId);
}
@@ -284,13 +284,13 @@ export async function cancelSubscription(subscriptionId: string, immediate: bool
});
}
export async function reactivateSubscription(subscriptionId: string) {
async function reactivateSubscription(subscriptionId: string) {
return await stripe.subscriptions.update(subscriptionId, {
cancel_at_period_end: false,
});
}
export async function changePlan(subscriptionId: string, newPlan: keyof typeof PLANS, interval: "monthly" | "annual") {
async function changePlan(subscriptionId: string, newPlan: keyof typeof PLANS, interval: "monthly" | "annual") {
const subscription = await stripe.subscriptions.retrieve(subscriptionId);
// Get new price ID
@@ -314,7 +314,7 @@ export async function changePlan(subscriptionId: string, newPlan: keyof typeof P
// CUSTOMER MANAGEMENT
// ============================================
export async function getOrCreateCustomer(brandId: string, name: string, email: string) {
async function getOrCreateCustomer(brandId: string, name: string, email: string) {
// Check if customer exists for this brand
const existingCustomers = await stripe.customers.list({
email,
@@ -337,11 +337,11 @@ export async function getOrCreateCustomer(brandId: string, name: string, email:
return customer.id;
}
export async function getCustomer(customerId: string) {
async function getCustomer(customerId: string) {
return await stripe.customers.retrieve(customerId);
}
export async function updateCustomer(customerId: string, data: Partial<Stripe.CustomerUpdateParams>) {
async function updateCustomer(customerId: string, data: Partial<Stripe.CustomerUpdateParams>) {
return await stripe.customers.update(customerId, data);
}
@@ -349,20 +349,20 @@ export async function updateCustomer(customerId: string, data: Partial<Stripe.Cu
// PAYMENT METHODS
// ============================================
export async function listPaymentMethods(customerId: string) {
async function listPaymentMethods(customerId: string) {
return await stripe.paymentMethods.list({
customer: customerId,
type: "card",
});
}
export async function attachPaymentMethod(paymentMethodId: string, customerId: string) {
async function attachPaymentMethod(paymentMethodId: string, customerId: string) {
return await stripe.paymentMethods.attach(paymentMethodId, {
customer: customerId,
});
}
export async function setDefaultPaymentMethod(customerId: string, paymentMethodId: string) {
async function setDefaultPaymentMethod(customerId: string, paymentMethodId: string) {
return await stripe.customers.update(customerId, {
invoice_settings: {
default_payment_method: paymentMethodId,
@@ -374,18 +374,18 @@ export async function setDefaultPaymentMethod(customerId: string, paymentMethodI
// INVOICES
// ============================================
export async function listInvoices(customerId: string, limit: number = 24) {
async function listInvoices(customerId: string, limit: number = 24) {
return await stripe.invoices.list({
customer: customerId,
limit,
});
}
export async function getInvoice(invoiceId: string) {
async function getInvoice(invoiceId: string) {
return await stripe.invoices.retrieve(invoiceId);
}
export async function getUpcomingInvoice(customerId: string) {
async function getUpcomingInvoice(customerId: string) {
// Use Stripe's upcoming invoice preview endpoint
return await stripe.invoices.createPreview({
customer: customerId,
@@ -396,7 +396,7 @@ export async function getUpcomingInvoice(customerId: string) {
// PAYMENTS & REFUNDS
// ============================================
export async function createPaymentIntent(options: {
async function createPaymentIntent(options: {
amount: number;
currency?: string;
customerId?: string;
@@ -413,7 +413,7 @@ export async function createPaymentIntent(options: {
});
}
export async function createRefund(paymentIntentId: string, amount?: number, reason?: string) {
async function createRefund(paymentIntentId: string, amount?: number, reason?: string) {
return await stripe.refunds.create({
payment_intent: paymentIntentId,
amount,
@@ -613,7 +613,7 @@ async function disableAddonFeature(brandId: string | undefined, addonKey: string
// USAGE BILLING
// ============================================
export async function createUsageRecord(options: {
async function createUsageRecord(options: {
subscriptionItemId: string;
quantity: number;
timestamp?: number;
@@ -640,7 +640,7 @@ export async function createUsageRecord(options: {
);
}
export async function getUsageSummary(subscriptionItemId: string) {
async function getUsageSummary(subscriptionItemId: string) {
// List subscription items with usage summaries
const subscription = await stripe.subscriptions.retrieve(
subscriptionItemId.split("_")[0]
@@ -653,11 +653,11 @@ export async function getUsageSummary(subscriptionItemId: string) {
// EXPORT STRIPE INSTANCE AND HELPERS
// ============================================
export async function getSubscription(subscriptionId: string) {
async function getSubscription(subscriptionId: string) {
return await stripe.subscriptions.retrieve(subscriptionId);
}
export async function listSubscriptions(customerId: string) {
async function listSubscriptions(customerId: string) {
return await stripe.subscriptions.list({
customer: customerId,
status: "all",