All files / src/features/Events/EventDetail/inventory inventory.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                                                                             
/**
 * PayBuilder — the Inventory tab on the Event Detail view.
 *
 * One card per ticket type. A ticket type is a product variant, so the whole
 * tab reads from the existing variants endpoint; nothing here needs the
 * ticket-stats endpoint, which counts issued tickets by status rather than
 * capacity.
 */
 
/** The subset of the variant view (`GET …/products/{id}/variants`) this tab reads. */
export type EventVariantApiRow = {
  id: number;
  name: string;
  /** Minor units. */
  price: number;
  numSold: number;
  /** Remaining capacity. `null` means the merchant set no cap. */
  inventory: number | null;
  /** Capacity as last set by the merchant. `null` means uncapped. */
  initialInventory: number | null;
};
 
export type EventInventoryRow = {
  id: number;
  name: string;
  /** Preformatted, e.g. "50.00 USD" — the mockup puts the code after the amount. */
  priceLabel: string;
  sold: number;
  total: number;
  available: number;
  isSoldOut: boolean;
  /**
   * The merchant set no cap on this ticket type, so "of N sold" and "N
   * available" have no meaning. No mockup covers it; the card degrades to the
   * sold count alone rather than inventing a total.
   */
  isUnlimited: boolean;
};