@use-stall/types 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./src/billing-payments";
2
+ export * from "./src/catalog";
2
3
  export * from "./src/components";
3
4
  export * from "./src/customers";
4
5
  export * from "./src/device";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@use-stall/types",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Type declarations for Stall SDKs",
5
5
  "types": "index.d.ts",
6
6
  "type": "module",
@@ -0,0 +1,58 @@
1
+ import {
2
+ UnifiedAttributeType,
3
+ UnifiedVariantsAttributeType,
4
+ UnifiedProductImagesType,
5
+ } from "./product";
6
+
7
+ /**
8
+ * The sellable projection of a product variant — a product/variant/inventory join, already
9
+ * scoped to one location and one sales channel. Computed server-side (stall-database) so
10
+ * every consumer (Terminal, any other channel) gets the same answer for "what can I sell,
11
+ * at what price, and how much is there" without doing any of that joining itself.
12
+ */
13
+ export interface UnifiedCatalogVariantType {
14
+ id: string; // variant id
15
+ title: string;
16
+ description: string;
17
+ thumbnail: string;
18
+ sku: string;
19
+ barcode: string;
20
+ price: number;
21
+ sale_price: number;
22
+ price_currency: string;
23
+ on_sale: boolean;
24
+ default: boolean;
25
+ attributes: UnifiedVariantsAttributeType[]; // this variant's selected options, e.g. [{ name: "Size", option: "M" }]
26
+ inventory: {
27
+ unavailable: number; // at this location
28
+ committed: number; // at this location
29
+ in_stock: number; // at this location — available for new orders
30
+ on_hand: number; // at this location
31
+ };
32
+ }
33
+
34
+ /**
35
+ * A sellable product — the entity Terminal (and any other selling channel) should fetch
36
+ * instead of raw products. Only published products/variants that are assigned to the
37
+ * requested location and sales channel are ever included; nothing here needs client-side
38
+ * filtering or computation.
39
+ */
40
+ export interface UnifiedCatalogType {
41
+ id: string; // product id
42
+ title: string;
43
+ handle: string;
44
+ description: string;
45
+ body_html: string;
46
+ thumbnail: string;
47
+ images: UnifiedProductImagesType[];
48
+ tax_class: string;
49
+ taxable: boolean;
50
+ categories: string[];
51
+ collections: string[];
52
+ brand: string;
53
+ tags: string[];
54
+ track_inventory: boolean; // from this product's default (or first) sellable variant
55
+ attributes: UnifiedAttributeType[]; // the axes of variation, e.g. [{ name: "Size", options: ["S","M","L"] }]
56
+ variants: CatalogVariantType[]; // already filtered to this location + sales channel
57
+ stock: number; // combined in_stock across variants, at this location
58
+ }