@use-stall/types 0.2.6 → 0.2.8

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
@@ -24,3 +24,4 @@ export * from "./src/extensions";
24
24
  export * from "./src/connectors";
25
25
  export * from "./src/pin-auth";
26
26
  export * from "./src/integrations";
27
+ export * from "./src/promotions";
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@use-stall/types",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "Type declarations for Stall SDKs",
5
5
  "types": "index.d.ts",
6
6
  "type": "module",
7
7
  "main": "index.js",
8
8
  "module": "index.js",
9
9
  "unpkg": "index.js",
10
- "private":false
10
+ "private": false
11
11
  }
@@ -6,19 +6,16 @@ export type ConnectorModuleKey =
6
6
  | "tags"
7
7
  | "inventory_levels" // For products with stock tracking
8
8
  | "inventory_history" // History of inventory levels at a specific point in time
9
- | "coupons"
10
- | "gift_cards"
9
+ | "promotions"
11
10
  | "orders"
12
11
  | "order_notes" // Activities related to order
13
12
  | "refunds" // Activities related to refunds
14
13
  | "payment_providers"
15
14
  | "payments" // Create, Read, Update, Delete, Webhooks
16
- | "receipts" // These are not tax invoices but rather and indication of a successful payment
17
15
  | "tax_regions" // can be tax class or groups in other data sources
18
16
  | "tax_rates"
19
17
  | "customers"
20
18
  | "locations" // Can be stock locations, warehouses, or any other location-related data
21
- | "sessions_tracking" // This will be used for cash tracking and tracking the POS/Flex user
22
19
  | "fulfillment_types" // Like delivery, pickup, etc.
23
20
  | "fulfillment_providers" // Providers third party or custom like DHL, FedEx, UPS, etc.
24
21
  | "fulfillments"; // Individual fulfillment instances for an order
@@ -10,14 +10,16 @@ export interface UnifiedCustomerType {
10
10
  last_name: string;
11
11
  addresses: UnifiedCustomerAddressType[];
12
12
  phone: string;
13
- metadata: Record<string, any>;
13
+ metadata: {
14
+ stall_offline_id?: string;
15
+ stall_offline_created_at?: string;
16
+ stall_offline_updated_at?: string;
17
+ stall_offline_deleted_at?: string;
18
+ [key: string]: any;
19
+ };
14
20
  created_at: string;
15
21
  updated_at: string;
16
22
  deleted_at: string;
17
- stall_offline_id: string;
18
- stall_offline_created_at: string;
19
- stall_offline_updated_at: string;
20
- stall_offline_deleted_at: string;
21
23
  }
22
24
 
23
25
  export interface UnifiedCustomerAddressType {
@@ -79,5 +79,11 @@ export interface UnifiedFulfillmentType {
79
79
  destination: UnifiedCustomerAddressType;
80
80
  departure: UnifiedCustomerAddressType;
81
81
  };
82
- metadata: Record<string, any>;
82
+ metadata: {
83
+ stall_offline_id?: string;
84
+ stall_offline_created_at?: string;
85
+ stall_offline_updated_at?: string;
86
+ stall_offline_deleted_at?: string;
87
+ [key: string]: any;
88
+ };
83
89
  }
@@ -1,58 +1,65 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  export interface UnifiedInventoryLevelType {
3
- id: string;
4
- location_id: string;
5
- product_id: string;
6
- variant_id: string;
7
- unavailable: number | string; // Items not available for sale (e.g., damaged, expired)
8
- committed: number | string; // Items reserved for existing orders but not yet shipped
9
- in_stock: number | string; // Items available for new orders (In Stock)
10
- on_hand: number | string; // Total items physically present at the location
11
- low_stock_threshold: number | string; // Low stock threshold specific to the location
12
- last_updatedAt: string;
13
- created_at: string;
14
- metadata: Record<string, any>;
15
- }
16
- export interface ExtendedUnifiedInventoryLevelType
17
- extends UnifiedInventoryLevelType {
18
- title: string;
19
- thumbnail: string;
20
- options: string[];
21
- is_new: boolean;
22
- }
23
-
24
- export interface InventoryAdjustmentRequestType {
25
- id: string;
26
- batch?: string;
27
- items: ExtendedUnifiedInventoryLevelType[];
28
- reason: string;
29
- location_id: string;
30
- organization_id: string;
31
- device_id: string;
32
- staff_id: string;
33
- user_id: string;
34
- stall_offline_id: string;
35
- stall_offline_created_at: string;
36
- stall_offline_updated_at: string;
37
- stall_offline_deleted_at: string;
38
- }
39
-
40
- export interface UnifiedInventoryLevelChangeLogType {
41
- id: string;
42
- date: string;
43
- inventory_item_id: string;
44
- unavailable: number | string;
45
- committed: number | string;
46
- in_stock: number | string;
47
- on_hand: number | string;
48
- reason: string;
49
- batch: string;
50
- device_id: string;
51
- staff_id: string;
52
- location_id: string;
53
- user_id: string;
54
- stall_offline_id: string;
55
- stall_offline_created_at: string;
56
- stall_offline_updated_at: string;
57
- stall_offline_deleted_at: string;
58
- }
3
+ id: string;
4
+ location_id: string;
5
+ product_id: string;
6
+ variant_id: string;
7
+ unavailable: number | string; // Items not available for sale (e.g., damaged, expired)
8
+ committed: number | string; // Items reserved for existing orders but not yet shipped
9
+ in_stock: number | string; // Items available for new orders (In Stock)
10
+ on_hand: number | string; // Total items physically present at the location
11
+ low_stock_threshold: number | string; // Low stock threshold specific to the location
12
+ last_updatedAt: string;
13
+ created_at: string;
14
+ metadata: {
15
+ stall_offline_id?: string;
16
+ stall_offline_created_at?: string;
17
+ stall_offline_updated_at?: string;
18
+ stall_offline_deleted_at?: string;
19
+ [key: string]: any;
20
+ };
21
+ }
22
+
23
+ export interface ExtendedUnifiedInventoryLevelType
24
+ extends UnifiedInventoryLevelType {
25
+ title: string;
26
+ thumbnail: string;
27
+ options: string[];
28
+ is_new: boolean;
29
+ }
30
+
31
+ export interface InventoryAdjustmentRequestType {
32
+ id: string;
33
+ batch?: string;
34
+ items: ExtendedUnifiedInventoryLevelType[];
35
+ reason: string;
36
+ location_id: string;
37
+ organization_id: string;
38
+ device_id: string;
39
+ staff_id: string;
40
+ user_id: string;
41
+ stall_offline_id: string;
42
+ stall_offline_created_at: string;
43
+ stall_offline_updated_at: string;
44
+ stall_offline_deleted_at: string;
45
+ }
46
+
47
+ export interface UnifiedInventoryLevelChangeLogType {
48
+ id: string;
49
+ date: string;
50
+ inventory_item_id: string;
51
+ unavailable: number | string;
52
+ committed: number | string;
53
+ in_stock: number | string;
54
+ on_hand: number | string;
55
+ reason: string;
56
+ batch: string;
57
+ device_id: string;
58
+ staff_id: string;
59
+ location_id: string;
60
+ user_id: string;
61
+ stall_offline_id: string;
62
+ stall_offline_created_at: string;
63
+ stall_offline_updated_at: string;
64
+ stall_offline_deleted_at: string;
65
+ }
@@ -1,14 +1,21 @@
1
- import { UnifiedTaxRegionType } from "./taxes";
2
-
3
- export interface LocationType {
1
+ export interface UnifiedLocationType {
2
+ id: string;
4
3
  name: string;
5
4
  address: string;
6
5
  city: string;
7
6
  country: string;
8
- org_id: string;
9
- id: string;
7
+ region: string;
8
+ base_currency: string;
9
+ timezone: string;
10
+ organization_id: string;
10
11
  created_at: string;
11
12
  updated_at: string;
12
13
  active: boolean;
13
- region?: UnifiedTaxRegionType;
14
+ metadata: {
15
+ stall_offline_id?: string;
16
+ stall_offline_created_at?: string;
17
+ stall_offline_updated_at?: string;
18
+ stall_offline_deleted_at?: string;
19
+ [key: string]: any;
20
+ };
14
21
  }
package/src/orders.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import type { UnifiedCustomerAddressType } from "./customers";
2
- import type { UnifiedFulfillmentStatus, UnifiedFulfillmentType } from "./fulfillment";
2
+ import type {
3
+ UnifiedFulfillmentStatus,
4
+ UnifiedFulfillmentType,
5
+ } from "./fulfillment";
3
6
  import type { UnifiedPaymentCollectionType } from "./payments";
4
7
 
5
8
  export type UnifiedOrderStatuses =
@@ -50,11 +53,13 @@ export interface UnifiedOrderType {
50
53
  amount: string;
51
54
  date: string;
52
55
  }[];
53
- stall_offline_id: string;
54
- stall_offline_created_at: string;
55
- stall_offline_updated_at: string;
56
- stall_offline_deleted_at: string;
57
- metadata: { [key: string]: any }; // Custom metadata
56
+ metadata: {
57
+ stall_offline_id: string;
58
+ stall_offline_created_at: string;
59
+ stall_offline_updated_at: string;
60
+ stall_offline_deleted_at: string;
61
+ [key: string]: any;
62
+ }; // Custom metadata
58
63
  }
59
64
 
60
65
  export interface UnifiedLineItemType {
@@ -87,9 +92,10 @@ export interface UnifiedTaxLineType {
87
92
  }
88
93
 
89
94
  export interface UnifiedDiscountType {
95
+ promotion_id: string;
90
96
  code: string;
91
97
  amount: number | string; // Discount amount applied
92
- type: "percentage" | "fixed" | "code";
98
+ type: "percentage" | "fixed" | "buy_x_get_y";
93
99
  name: string;
94
100
  metadata: Record<string, any>;
95
101
  }
@@ -145,3 +151,15 @@ export interface UnifiedOrderRefundType {
145
151
  stall_offline_updated_at: string;
146
152
  stall_offline_deleted_at: string;
147
153
  }
154
+
155
+ export interface UnifiedOrderNote {
156
+ id: string;
157
+ order_id: string;
158
+ note: string;
159
+ visibility: "internal" | "customer" | "system";
160
+ source: "admin" | "customer" | "system" | "automation";
161
+ created_by: string;
162
+ created_at: string;
163
+ updated_at: string;
164
+ metadata: Record<string, unknown>;
165
+ }
package/src/payments.d.ts CHANGED
@@ -71,94 +71,39 @@ export interface UnifiedPaymentCollectionType {
71
71
  provider_id: string;
72
72
  payment_method: UnifiedPaymentMethodType;
73
73
  note: string;
74
- metadata: Record<string, any>;
74
+ metadata: {
75
+ stall_offline_id?: string;
76
+ stall_offline_created_at?: string;
77
+ stall_offline_updated_at?: string;
78
+ stall_offline_deleted_at?: string;
79
+ [key: string]: any;
80
+ };
75
81
  }
76
82
 
77
- export const medusa = {
78
- "product": {
79
- "variants": [
80
- {
81
- "prices": [
82
- {
83
- "id": "string",
84
- "title": "string",
85
- "currency_code": "usd",
86
- "amount": 0,
87
- "raw_amount": {},
88
- "min_quantity": 0,
89
- "max_quantity": 0,
90
- "price_set_id": "string",
91
- "created_at": "2019-08-24T14:15:22Z",
92
- "updated_at": "2019-08-24T14:15:22Z",
93
- "deleted_at": "2019-08-24T14:15:22Z"
94
- }
95
- ],
96
- "id": "string",
97
- "title": "string",
98
- "sku": "string",
99
- "barcode": "string",
100
- "ean": "string",
101
- "upc": "string",
102
- "allow_backorder": true,
103
- "manage_inventory": true,
104
- "hs_code": "string",
105
- "origin_country": "string",
106
- "mid_code": "string",
107
- "material": "string",
108
- "weight": 0,
109
- "length": 0,
110
- "height": 0,
111
- "width": 0,
112
- "options": [
113
- {"id": "string", "value": "string"}
114
- ],
115
- "created_at": "2019-08-24T14:15:22Z",
116
- "updated_at": "2019-08-24T14:15:22Z",
117
- "deleted_at": "2019-08-24T14:15:22Z",
118
- "images": [
119
- {
120
- "id": "string",
121
- "url": "string",
122
- "rank": 0
123
- }
124
- ],
125
- "thumbnail": "string"
126
- }
127
- ],
128
- "type": {
129
- "id": "string",
130
- "value": "string",
131
- "created_at": "2019-08-24T14:15:22Z",
132
- "updated_at": "2019-08-24T14:15:22Z"
133
- },
134
- "length": 0,
135
- "title": "string",
136
- "status": "draft",
137
- "options": [
138
- {"id": "string", "title": "string"}
139
- ],
140
- "description": "string",
141
- "id": "string",
142
- "created_at": "2019-08-24T14:15:22Z",
143
- "updated_at": "2019-08-24T14:15:22Z",
144
- "handle": "string",
145
- "subtitle": "string",
146
- "is_giftcard": true,
147
- "thumbnail": "string",
148
- "width": 0,
149
- "weight": 0,
150
- "height": 0,
151
- "origin_country": "string",
152
- "hs_code": "string",
153
- "mid_code": "string",
154
- "material": "string",
155
- "collection_id": "string",
156
- "type_id": "string",
157
- "images": [
158
- {"id": "string", "url": "string", "rank": 0}
159
- ],
160
- "discountable": true,
161
- "external_id": "string",
162
- "deleted_at": "2019-08-24T14:15:22Z"
163
- }
83
+ export interface UnifiedFlexSessionType {
84
+ id: string;
85
+ device_id: string;
86
+ staff_id: string;
87
+ location_id: string;
88
+ opening_date: number;
89
+ opening_date_string: string;
90
+ closing_date: number;
91
+ closing_date_string: string;
92
+ last_activity_date: number;
93
+ duration: number; // Duration in miliseconds
94
+ opening_cash_balance: number;
95
+ closing_cash_balance_declared: number;
96
+ closing_cash_balance_system_calculated: number;
97
+ cash_difference: number;
98
+ cash_excess: number;
99
+ running_cash_balance: number;
100
+ paid_in: number; // Total value of cash paid into the register during the session
101
+ paid_out: number; // Total value of cash paid out of the register during the session
102
+ non_cash_tender_total: number; // Total value of non-cash transactions during the session
103
+ total_amount: number; // Total value of all transactions
104
+ number_of_transactions: number;
105
+ status: "open" | "closed" | "pending";
106
+ notes: string;
107
+ closing_remarks: string;
108
+ metadata: Record<string, any>;
164
109
  }
package/src/product.d.ts CHANGED
@@ -34,7 +34,30 @@ export interface UnifiedProductType {
34
34
  low_stock_threshold: number | string; // Low stock threshold specific to the location'
35
35
  locations: string[];
36
36
  weight: string;
37
- metadata: { [key: string]: string }; // add date in milliseconds
37
+ metadata: {
38
+ stall_offline_id?: string;
39
+ stall_offline_created_at?: string;
40
+ stall_offline_updated_at?: string;
41
+ stall_offline_deleted_at?: string;
42
+ [key: string]: any;
43
+ }; // add date in milliseconds
44
+ }
45
+
46
+ export interface UnifiedTagProductTag {
47
+ id: string;
48
+ name: string;
49
+ slug: string;
50
+ description: string;
51
+ created_at: string;
52
+ updated_at: string;
53
+ deleted_at: string;
54
+ metadata: {
55
+ stall_offline_id?: string;
56
+ stall_offline_created_at?: string;
57
+ stall_offline_updated_at?: string;
58
+ stall_offline_deleted_at?: string;
59
+ [key: string]: any;
60
+ };
38
61
  }
39
62
 
40
63
  export interface UnifiedProductPriceType {
@@ -78,7 +101,13 @@ export interface UnifiedVariantsType {
78
101
  weight: string;
79
102
  thumbnail: string;
80
103
  attributes: UnifiedVariantsAttributeType[];
81
- metadata: { [key: string]: string };
104
+ metadata: {
105
+ stall_offline_id?: string;
106
+ stall_offline_created_at?: string;
107
+ stall_offline_updated_at?: string;
108
+ stall_offline_deleted_at?: string;
109
+ [key: string]: any;
110
+ };
82
111
  }
83
112
 
84
113
  export interface UnifiedVariantsAttributeType {
@@ -106,7 +135,13 @@ export interface UnifiedCategoryType {
106
135
  name: string;
107
136
  description: string;
108
137
  thumbnail: string;
109
- metadata: { [key: string]: string };
138
+ metadata: {
139
+ stall_offline_id?: string;
140
+ stall_offline_created_at?: string;
141
+ stall_offline_updated_at?: string;
142
+ stall_offline_deleted_at?: string;
143
+ [key: string]: any;
144
+ };
110
145
  date: string;
111
146
  count: number;
112
147
  parent_id: string;
@@ -117,7 +152,13 @@ export interface UnifiedCollectionType {
117
152
  name: string;
118
153
  description: string;
119
154
  thumbnail: string;
120
- metadata: { [key: string]: string };
155
+ metadata: {
156
+ stall_offline_id?: string;
157
+ stall_offline_created_at?: string;
158
+ stall_offline_updated_at?: string;
159
+ stall_offline_deleted_at?: string;
160
+ [key: string]: any;
161
+ };
121
162
  linked_products: string[];
122
163
  linked_categories: string[];
123
164
  createAt: string;
@@ -0,0 +1,82 @@
1
+ export interface UnifiedPromotion {
2
+ id: string;
3
+ title: string;
4
+ code: string;
5
+ /** Lifecycle */
6
+ status: "draft" | "active" | "disabled";
7
+ is_automatic: boolean;
8
+ /** Limits & usage */
9
+ usage_limit: number;
10
+ usage_limit_per_customer?: number;
11
+ usage_count: number;
12
+ /** Validity */
13
+ starts_at: string;
14
+ ends_at: string;
15
+ /** Priority & stacking */
16
+ priority: number;
17
+ is_stackable: boolean;
18
+ /** Eligibility */
19
+ eligibility_rules: UnifiedPromotionRule[];
20
+ /** How the promotion applies */
21
+ application: UnifiedPromotionApplication;
22
+ metadata: {
23
+ stall_offline_id?: string;
24
+ stall_offline_created_at?: string;
25
+ stall_offline_updated_at?: string;
26
+ stall_offline_deleted_at?: string;
27
+ [key: string]: unknown;
28
+ };
29
+ }
30
+ export type UnifiedPromotionApplicationType =
31
+ | "percentage"
32
+ | "fixed_amount"
33
+ | "buy_x_get_y"
34
+ | "free_shipping"
35
+ | "gift_card"
36
+ | "store_credit";
37
+
38
+ export interface UnifiedPromotionApplication {
39
+ type: UnifiedPromotionApplicationType;
40
+ /** Percentage or fixed value (minor units) */
41
+ value: number;
42
+ currency: string;
43
+ /** Target of application */
44
+ target_type: "items" | "shipping" | "order";
45
+ /** Allocation strategy */
46
+ allocation: "each" | "total";
47
+ /** Quantity constraints */
48
+ max_quantity: number;
49
+ /** buy_x_get_y specific */
50
+ buy_x_get_y: UnifiedBuyXGetYApplication;
51
+ /** Stored value */
52
+ balance: number;
53
+ }
54
+
55
+ export interface UnifiedBuyXGetYApplication {
56
+ buy_quantity: number;
57
+ get_quantity: number;
58
+ /** What qualifies as X */
59
+ buy_rules: UnifiedPromotionRule[];
60
+ /** What qualifies as Y */
61
+ get_rules: UnifiedPromotionRule[];
62
+ /** Percentage applied to Y */
63
+ discount_percentage: number;
64
+ /** Max applications per order */
65
+ max_applications?: number;
66
+ }
67
+
68
+ export type UnifiedPromotionRuleAttribute =
69
+ | "cart_subtotal"
70
+ | "product_id"
71
+ | "collection_id"
72
+ | "customer_id"
73
+ | "customer_group_id"
74
+ | "shipping_method";
75
+
76
+ export interface UnifiedPromotionRule {
77
+ id: string;
78
+ description: string;
79
+ attribute: UnifiedPromotionRuleAttribute;
80
+ operator: "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "in" | "not_in";
81
+ values: string[];
82
+ }
package/src/taxes.d.ts CHANGED
@@ -9,7 +9,13 @@ export interface UnifiedTaxRegionType {
9
9
  postal_codes: string[]; // Specific ZIP codes if applicable
10
10
  tax_inclusive: boolean; // Whether prices include tax
11
11
  is_default?: boolean; // Whether this is the default region
12
- metadata: { [key: string]: string }; // Additional metadata
12
+ metadata: {
13
+ stall_offline_id?: string;
14
+ stall_offline_created_at?: string;
15
+ stall_offline_updated_at?: string;
16
+ stall_offline_deleted_at?: string;
17
+ [key: string]: string;
18
+ }; // Additional metadata
13
19
  }
14
20
 
15
21
  export interface UnifiedTaxClassType {
@@ -28,5 +34,11 @@ export interface UnifiedTaxRateType {
28
34
  code: string; // Optional description
29
35
  compound: boolean; // Whether this is a compound tax rate
30
36
  priority: number; // Priority order
31
- metadata: { [key: string]: any }; // Additional metadata
32
- }
37
+ metadata: {
38
+ stall_offline_id?: string;
39
+ stall_offline_created_at?: string;
40
+ stall_offline_updated_at?: string;
41
+ stall_offline_deleted_at?: string;
42
+ [key: string]: any;
43
+ }; // Additional metadata
44
+ }
@@ -1,73 +0,0 @@
1
- import { Timestamp } from "firebase/firestore";
2
-
3
- /* eslint-disable @typescript-eslint/no-explicit-any */
4
- export interface UnifiedRegisterSessionType {
5
- id: string;
6
- device_id: string;
7
- staff_id: string;
8
- location_id: string;
9
- opening_date: Timestamp;
10
- opening_date_string: string;
11
- closing_date: Timestamp;
12
- closing_date_string: string;
13
- last_activity_date: Timestamp;
14
- duration: number; // Duration in miliseconds
15
- opening_cash_balance: number;
16
- closing_cash_balance_declared: number;
17
- closing_cash_balance_system_calculated: number;
18
- cash_difference: number;
19
- cash_excess: number;
20
- running_cash_balance: number;
21
- paid_in: number; // Total value of cash paid into the register during the session
22
- paid_out: number; // Total value of cash paid out of the register during the session
23
- non_cash_tender_total: number; // Total value of non-cash transactions during the session
24
- total_amount: number; // Total value of all transactions
25
- number_of_transactions: number;
26
- status: "open" | "closed" | "pending";
27
- notes: string;
28
- closing_remarks: string;
29
- metadata: Record<string, any>;
30
- }
31
-
32
- export interface UnifiedSessionTransactionType {
33
- id: string;
34
- date: Timestamp;
35
- date_string: string;
36
- order_id: string;
37
- session_id: string;
38
- location_id: string;
39
- staff_id: string;
40
- transaction_type:
41
- | "sale"
42
- | "return"
43
- | "refund"
44
- | "void"
45
- | "pay-out"
46
- | "pay-in";
47
- tender_type: string; // e.g., "Cash", "Credit Card", "Gift Card"
48
- total_amount: number;
49
- note: string;
50
- metadata: Record<string, any>;
51
- payment_method: {
52
- name: string;
53
- id: string;
54
- };
55
- }
56
-
57
- export interface UpdateSessionBalanceProps {
58
- amount: number;
59
- note: string;
60
- transaction_type:
61
- | "sale"
62
- | "return"
63
- | "refund"
64
- | "void"
65
- | "pay-out"
66
- | "pay-in";
67
- tender_type: string;
68
- order_id?: string;
69
- payment_method: {
70
- name: string;
71
- id: string;
72
- };
73
- }