104 lines
2.6 KiB
TypeScript

import type { IsoDateTimeString } from "../common/types";
export interface CustomerEmailPreferences {
general?: boolean;
invoice?: boolean;
support?: boolean;
product?: boolean;
domain?: boolean;
affiliate?: boolean;
}
export interface CustomerUser {
id: number;
name: string;
email: string;
isOwner: boolean;
}
export interface CustomerAddress {
address1?: string | null;
address2?: string | null;
city?: string | null;
state?: string | null;
postcode?: string | null;
country?: string | null;
countryCode?: string | null;
phoneNumber?: string | null;
phoneCountryCode?: string | null;
}
export type Address = CustomerAddress;
/**
* CustomerProfile - Core profile data following WHMCS client structure
* Used as the base for authenticated users in the portal
*/
export interface CustomerProfile {
id: string;
email: string;
firstname?: string | null;
lastname?: string | null;
fullname?: string | null;
companyname?: string | null;
phonenumber?: string | null;
address?: CustomerAddress;
language?: string | null;
currencyCode?: string | null;
createdAt?: IsoDateTimeString | null;
updatedAt?: IsoDateTimeString | null;
}
export interface CustomerStats {
numDueInvoices?: number;
dueInvoicesBalance?: string;
numOverdueInvoices?: number;
overdueInvoicesBalance?: string;
numUnpaidInvoices?: number;
unpaidInvoicesAmount?: string;
numPaidInvoices?: number;
paidInvoicesAmount?: string;
creditBalance?: string;
inCredit?: boolean;
isAffiliate?: boolean;
productsNumActive?: number;
productsNumTotal?: number;
activeDomains?: number;
raw?: Record<string, unknown>;
}
export interface Customer {
id: number;
clientId?: number;
ownerUserId?: number | null;
userId?: number | null;
uuid?: string | null;
firstname?: string | null;
lastname?: string | null;
fullname?: string | null;
companyName?: string | null;
email: string;
status?: string | null;
language?: string | null;
defaultGateway?: string | null;
defaultPaymentMethodId?: number | null;
currencyId?: number | null;
currencyCode?: string | null;
taxId?: string | null;
phoneNumber?: string | null;
phoneCountryCode?: string | null;
telephoneNumber?: string | null;
allowSingleSignOn?: boolean | null;
emailVerified?: boolean | null;
marketingEmailsOptIn?: boolean | null;
notes?: string | null;
createdAt?: IsoDateTimeString | null;
lastLogin?: string | null;
address?: CustomerAddress;
emailPreferences?: CustomerEmailPreferences;
customFields?: Record<string, string>;
users?: CustomerUser[];
stats?: CustomerStats;
raw?: Record<string, unknown>;
}