All files / src/types customer.types.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112                                                                                                                                                                                                                               
export type PurchaseProductType =
  | "generic"
  | "invoice"
  | "fundraiser"
  | "event"
  | "membership"
  | "sweepstakes"
  | "standard";
 
export type RecurringInterval =
  | "once"
  | "daily"
  | "weekly"
  | "monthly"
  | "quarterly"
  | "yearly";
 
export type CustomerAddress = {
  id: number;
  name: string;
  line1: string;
  line2: string;
  city: string;
  state: string;
  zip: string;
  country: string;
  createdAt: number;
  updatedAt: number;
};
 
export type PurchasesListItem = {
  name: PurchaseProductType;
  total: number;
  totalCount: number;
  customerID: number;
  count: number;
};
 
export type RecurringPurchasesListItem = {
  recurringStatus: "active" | "deactivated" | "error";
  cost: number;
  fees: number;
  charged: number;
  customerID: number;
  processedAt: number;
  productName: string;
  productType: PurchaseProductType;
  variantName: string;
  recurringMax: number | null;
  transactionID: number;
  cardholderName: string;
  recurringCount: number;
  nextTransactionAt?: number;
  recurringInterval: RecurringInterval;
  orderRecurringObjID: string;
  createdAt: number;
  cardNumberLast4: string;
  cardBrandName: string;
  unitPrice: number;
  quantity: number;
  sourceType: string;
};
 
/**
 * PAY-Builder016 — the aggregated "Additional Information" for one payment form
 * the customer purchased. Each field holds the latest non-empty answer across
 * that customer's purchases of the form (AC028/AC029). Matches the BE
 * CustomerView.customFieldAnswers shape.
 */
export interface CustomerCustomFieldAnswer {
  fieldId: number;
  label: string;
  order: number;
  value: string;
}
 
export interface CustomerFormCustomFields {
  productId: number;
  paymentFormName: string;
  sectionTitle: string;
  fields: CustomerCustomFieldAnswer[];
}
 
export type Customer = {
  id: number;
  firstName?: string;
  lastName?: string;
  email: string;
  phoneNumber?: string;
  dateOfBirth?: number | string | null;
  occupation?: string;
  employer?: string;
  notes?: string;
  avatarURL?: string;
  merchAccID: number;
  purchases?: PurchasesListItem[];
  totalPurchased: number;
  totalPurchasedCount: number;
  recurringPurchases?: RecurringPurchasesListItem[];
  recurringCustomer: boolean;
  address?: CustomerAddress;
  createdAt: number;
  updatedAt: number;
  lastKnownLatitude?: number;
  lastKnownLongitude?: number;
  cardHolderName?: string;
  // PAY-Builder016 — aggregated custom-field answers per payment form.
  customFieldAnswers?: CustomerFormCustomFields[];
};
 
export type Address = Pick<Customer, "address">;