@use-stall/types 0.2.6 → 0.2.7
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 +2 -2
- package/src/connectors.d.ts +1 -4
- package/src/locations.d.ts +6 -6
- package/src/orders.d.ts +18 -2
- package/src/payments.d.ts +27 -88
- package/src/promotions.d.ts +76 -0
- package/src/register-sessions.d.ts +0 -73
package/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@use-stall/types",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
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
|
}
|
package/src/connectors.d.ts
CHANGED
|
@@ -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
|
-
| "
|
|
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
|
package/src/locations.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
9
|
-
|
|
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
14
|
}
|
package/src/orders.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { UnifiedCustomerAddressType } from "./customers";
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
UnifiedFulfillmentStatus,
|
|
4
|
+
UnifiedFulfillmentType,
|
|
5
|
+
} from "./fulfillment";
|
|
3
6
|
import type { UnifiedPaymentCollectionType } from "./payments";
|
|
4
7
|
|
|
5
8
|
export type UnifiedOrderStatuses =
|
|
@@ -87,9 +90,10 @@ export interface UnifiedTaxLineType {
|
|
|
87
90
|
}
|
|
88
91
|
|
|
89
92
|
export interface UnifiedDiscountType {
|
|
93
|
+
promotion_id: string;
|
|
90
94
|
code: string;
|
|
91
95
|
amount: number | string; // Discount amount applied
|
|
92
|
-
type: "percentage" | "fixed" | "
|
|
96
|
+
type: "percentage" | "fixed" | "buy_x_get_y";
|
|
93
97
|
name: string;
|
|
94
98
|
metadata: Record<string, any>;
|
|
95
99
|
}
|
|
@@ -145,3 +149,15 @@ export interface UnifiedOrderRefundType {
|
|
|
145
149
|
stall_offline_updated_at: string;
|
|
146
150
|
stall_offline_deleted_at: string;
|
|
147
151
|
}
|
|
152
|
+
|
|
153
|
+
export interface UnifiedOrderNote {
|
|
154
|
+
id: string;
|
|
155
|
+
order_id: string;
|
|
156
|
+
note: string;
|
|
157
|
+
visibility: "internal" | "customer" | "system";
|
|
158
|
+
source: "admin" | "customer" | "system" | "automation";
|
|
159
|
+
created_by: string;
|
|
160
|
+
created_at: string;
|
|
161
|
+
updated_at: string;
|
|
162
|
+
metadata: Record<string, unknown>;
|
|
163
|
+
}
|
package/src/payments.d.ts
CHANGED
|
@@ -74,91 +74,30 @@ export interface UnifiedPaymentCollectionType {
|
|
|
74
74
|
metadata: Record<string, any>;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
export
|
|
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
|
-
"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
|
-
}
|
|
164
|
-
}
|
|
77
|
+
export interface UnifiedFlexSessionType {
|
|
78
|
+
id: string;
|
|
79
|
+
device_id: string;
|
|
80
|
+
staff_id: string;
|
|
81
|
+
location_id: string;
|
|
82
|
+
opening_date: number;
|
|
83
|
+
opening_date_string: string;
|
|
84
|
+
closing_date: number;
|
|
85
|
+
closing_date_string: string;
|
|
86
|
+
last_activity_date: number;
|
|
87
|
+
duration: number; // Duration in miliseconds
|
|
88
|
+
opening_cash_balance: number;
|
|
89
|
+
closing_cash_balance_declared: number;
|
|
90
|
+
closing_cash_balance_system_calculated: number;
|
|
91
|
+
cash_difference: number;
|
|
92
|
+
cash_excess: number;
|
|
93
|
+
running_cash_balance: number;
|
|
94
|
+
paid_in: number; // Total value of cash paid into the register during the session
|
|
95
|
+
paid_out: number; // Total value of cash paid out of the register during the session
|
|
96
|
+
non_cash_tender_total: number; // Total value of non-cash transactions during the session
|
|
97
|
+
total_amount: number; // Total value of all transactions
|
|
98
|
+
number_of_transactions: number;
|
|
99
|
+
status: "open" | "closed" | "pending";
|
|
100
|
+
notes: string;
|
|
101
|
+
closing_remarks: string;
|
|
102
|
+
metadata: Record<string, any>;
|
|
103
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
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: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
export type UnifiedPromotionApplicationType =
|
|
25
|
+
| "percentage"
|
|
26
|
+
| "fixed_amount"
|
|
27
|
+
| "buy_x_get_y"
|
|
28
|
+
| "free_shipping"
|
|
29
|
+
| "gift_card"
|
|
30
|
+
| "store_credit";
|
|
31
|
+
|
|
32
|
+
export interface UnifiedPromotionApplication {
|
|
33
|
+
type: UnifiedPromotionApplicationType;
|
|
34
|
+
/** Percentage or fixed value (minor units) */
|
|
35
|
+
value: number;
|
|
36
|
+
currency: string;
|
|
37
|
+
/** Target of application */
|
|
38
|
+
target_type: "items" | "shipping" | "order";
|
|
39
|
+
/** Allocation strategy */
|
|
40
|
+
allocation: "each" | "total";
|
|
41
|
+
/** Quantity constraints */
|
|
42
|
+
max_quantity: number;
|
|
43
|
+
/** buy_x_get_y specific */
|
|
44
|
+
buy_x_get_y: UnifiedBuyXGetYApplication;
|
|
45
|
+
/** Stored value */
|
|
46
|
+
balance: number;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface UnifiedBuyXGetYApplication {
|
|
50
|
+
buy_quantity: number;
|
|
51
|
+
get_quantity: number;
|
|
52
|
+
/** What qualifies as X */
|
|
53
|
+
buy_rules: UnifiedPromotionRule[];
|
|
54
|
+
/** What qualifies as Y */
|
|
55
|
+
get_rules: UnifiedPromotionRule[];
|
|
56
|
+
/** Percentage applied to Y */
|
|
57
|
+
discount_percentage: number;
|
|
58
|
+
/** Max applications per order */
|
|
59
|
+
max_applications?: number;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export type UnifiedPromotionRuleAttribute =
|
|
63
|
+
| "cart_subtotal"
|
|
64
|
+
| "product_id"
|
|
65
|
+
| "collection_id"
|
|
66
|
+
| "customer_id"
|
|
67
|
+
| "customer_group_id"
|
|
68
|
+
| "shipping_method";
|
|
69
|
+
|
|
70
|
+
export interface UnifiedPromotionRule {
|
|
71
|
+
id: string;
|
|
72
|
+
description: string;
|
|
73
|
+
attribute: UnifiedPromotionRuleAttribute;
|
|
74
|
+
operator: "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "in" | "not_in";
|
|
75
|
+
values: string[];
|
|
76
|
+
}
|
|
@@ -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
|
-
}
|