"use client"; import { useModuleClient } from "@86d-app/core/client"; import { useEffect, useRef, useState } from "react"; interface LoyaltyBalance { customerId: string; totalEarned: number; totalRedeemed: number; balance: number; transactionCount: number; } interface LoyaltyTransaction { id: string; customerId: string; type: "earn" | "redeem" | "adjust"; points: number; balance: number; reason: string; orderId?: string; createdAt: string; } interface LoyaltyStats { totalCustomersWithPoints: number; totalPointsIssued: number; totalPointsRedeemed: number; totalPointsOutstanding: number; averageBalance: number; topCustomers: { customerId: string; email: string; name: string; balance: number; }[]; } interface Customer { id: string; email: string; firstName?: string | null; lastName?: string | null; } function useLoyaltyApi() { const client = useModuleClient(); return { stats: client.module("customers").admin["/admin/customers/loyalty/stats"], listCustomers: client.module("customers").admin["/admin/customers"], }; } function Skeleton({ className = "" }: { className?: string }) { return (