@use-stall/types 0.4.0 → 0.6.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 +1 -0
- package/package.json +1 -1
- package/src/catalog.d.ts +57 -0
- package/src/fulfillment.d.ts +15 -0
- package/src/payments.d.ts +2 -0
package/index.d.ts
CHANGED
package/package.json
CHANGED
package/src/catalog.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {
|
|
2
|
+
UnifiedAttributeType,
|
|
3
|
+
UnifiedVariantsAttributeType,
|
|
4
|
+
} from "./product";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The sellable projection of a product variant — a product/variant/inventory join, already
|
|
8
|
+
* scoped to one location and one sales channel. Computed server-side (stall-database) so
|
|
9
|
+
* every consumer (Terminal, any other channel) gets the same answer for "what can I sell,
|
|
10
|
+
* at what price, and how much is there" without doing any of that joining itself.
|
|
11
|
+
*/
|
|
12
|
+
export interface UnifiedCatalogVariantType {
|
|
13
|
+
id: string; // variant id
|
|
14
|
+
title: string;
|
|
15
|
+
description: string;
|
|
16
|
+
thumbnail: string;
|
|
17
|
+
sku: string;
|
|
18
|
+
barcode: string;
|
|
19
|
+
price: number;
|
|
20
|
+
sale_price: number;
|
|
21
|
+
price_currency: string;
|
|
22
|
+
on_sale: boolean;
|
|
23
|
+
default: boolean;
|
|
24
|
+
attributes: UnifiedVariantsAttributeType[]; // this variant's selected options, e.g. [{ name: "Size", option: "M" }]
|
|
25
|
+
inventory: {
|
|
26
|
+
unavailable: number; // at this location
|
|
27
|
+
committed: number; // at this location
|
|
28
|
+
in_stock: number; // at this location — available for new orders
|
|
29
|
+
on_hand: number; // at this location
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A sellable product — the entity Terminal (and any other selling channel) should fetch
|
|
35
|
+
* instead of raw products. Only published products/variants that are assigned to the
|
|
36
|
+
* requested location and sales channel are ever included; nothing here needs client-side
|
|
37
|
+
* filtering or computation.
|
|
38
|
+
*/
|
|
39
|
+
export interface UnifiedCatalogType {
|
|
40
|
+
id: string; // product id
|
|
41
|
+
title: string;
|
|
42
|
+
handle: string;
|
|
43
|
+
description: string;
|
|
44
|
+
body_html: string;
|
|
45
|
+
thumbnail: string;
|
|
46
|
+
images: string[];
|
|
47
|
+
tax_class: string;
|
|
48
|
+
taxable: boolean;
|
|
49
|
+
categories: string[];
|
|
50
|
+
collections: string[];
|
|
51
|
+
brand: string;
|
|
52
|
+
tags: string[];
|
|
53
|
+
track_inventory: boolean; // from this product's default (or first) sellable variant
|
|
54
|
+
attributes: UnifiedAttributeType[]; // the axes of variation, e.g. [{ name: "Size", options: ["S","M","L"] }]
|
|
55
|
+
variants: CatalogVariantType[]; // already filtered to this location + sales channel
|
|
56
|
+
stock: number; // combined in_stock across variants, at this location
|
|
57
|
+
}
|
package/src/fulfillment.d.ts
CHANGED
|
@@ -36,6 +36,21 @@ export interface UnifiedFulfillmentProviderConfigType {
|
|
|
36
36
|
updated_at: string;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
// The fulfillment-method counterpart to FrontendPaymentMethodType — same shape, minus
|
|
40
|
+
// supported_currencies (fulfillment methods aren't currency-scoped like payment methods are).
|
|
41
|
+
export interface FrontendFulfillmentMethodType {
|
|
42
|
+
id: string;
|
|
43
|
+
// Absent for methods with no fulfillment gateway to resolve, e.g. in-house pickup.
|
|
44
|
+
provider?: {
|
|
45
|
+
id: string; // provider id
|
|
46
|
+
name: string;
|
|
47
|
+
logo: string;
|
|
48
|
+
};
|
|
49
|
+
external_id: string;
|
|
50
|
+
name: string;
|
|
51
|
+
type: UnifiedFulfillmentMethods;
|
|
52
|
+
}
|
|
53
|
+
|
|
39
54
|
export type UnifiedFulfillmentStatus =
|
|
40
55
|
| "pending"
|
|
41
56
|
| "packing"
|
package/src/payments.d.ts
CHANGED
|
@@ -79,6 +79,8 @@ export interface FrontendPaymentMethodType {
|
|
|
79
79
|
name: string;
|
|
80
80
|
type: UnifiedMethodsType;
|
|
81
81
|
supported_currencies: string[];
|
|
82
|
+
offline_support: boolean;
|
|
83
|
+
instant_clear: boolean; // whether the payment is cleared instantly like cash or custom
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
export type UnifiedPaymentCollectionStatus =
|