@use-stall/types 0.0.1

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/README.md ADDED
@@ -0,0 +1,4 @@
1
+ # Types for Stall SDKs
2
+
3
+ ## Description
4
+ Type declarations for Stall SDKs.
package/index.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ export * from "./src/billing-payments";
2
+ export * from "./src/cloud-connectors";
3
+ export * from "./src/components";
4
+ export * from "./src/customers";
5
+ export * from "./src/device";
6
+ export * from "./src/fulfillment";
7
+ export * from "./src/global";
8
+ export * from "./src/inventory";
9
+ export * from "./src/locations";
10
+ export * from "./src/lookup";
11
+ export * from "./src/media";
12
+ export * from "./src/onboarding";
13
+ export * from "./src/orders";
14
+ export * from "./src/organizations";
15
+ export * from "./src/payments";
16
+ export * from "./src/pos";
17
+ export * from "./src/product";
18
+ export * from "./src/register-sessions";
19
+ export * from "./src/stall-icons";
20
+ export * from "./src/system";
21
+ export * from "./src/taxes";
22
+ export * from "./src/users";
package/index.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = {};
package/package.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "@use-stall/types",
3
+ "version": "0.0.1",
4
+ "description": "Type declarations for Stall SDKs",
5
+ "types": "index.d.ts",
6
+ "type": "module",
7
+ "main": "index.js",
8
+ "module": "index.js",
9
+ "unpkg": "index.js",
10
+ "private": false
11
+ }
@@ -0,0 +1,270 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ export interface PriceType {
3
+ name: string;
4
+ price: string;
5
+ description: string;
6
+ price_id: string;
7
+ }
8
+
9
+ export interface PaymentMethodType {
10
+ id: string; // Unique identifier for the payment method
11
+ external_id?: string; // External identifier for the payment method
12
+ type: "native" | "custom" | "integration" | "manual"; // The type of payment method
13
+ is_external: boolean; // Optional flag for external payment methods
14
+ external_url: string; // Optional URL for external payment methods
15
+ icon: string; // Icon URL for the payment method
16
+ name: string; // The name of the payment method (e.g., "Visa", "Apple Pay", "Bank Transfer")
17
+ description: string; // Description of the payment method
18
+ logo?: string; // Icon URL for the payment method
19
+ requires_customer: boolean; // Flag to indicate if the payment method requires customer details
20
+ has_tendered_amount: boolean; // Flag to indicate if the payment method requires a tendered amount
21
+ active: boolean; // Flag to indicate if the payment method is active
22
+ track_register: boolean; // Flag to indicate if the payment method should be tracked in the register
23
+ mark_as_paid: boolean; // Flag to indicate if the payment method should be marked as paid
24
+ metadata?: { [key: string]: string }; // Additional metadata for the payment method
25
+ locations_enabled?: boolean; // Flag to indicate if the payment method is restricted to specific locations
26
+ locations?: string[]; // List of location IDs for the payment method
27
+ }
28
+
29
+ interface Recurring {
30
+ usage_type: string;
31
+ interval_count: number;
32
+ trial_period_days: number | null;
33
+ aggregate_usage: string | null;
34
+ meter: string | null;
35
+ interval: string;
36
+ }
37
+
38
+ interface Features {
39
+ [key: string]: string;
40
+ }
41
+
42
+ export interface BillingPriceType {
43
+ id: string;
44
+ billing_scheme: string;
45
+ type: string;
46
+ trial_period_days: number | null;
47
+ tax_behavior: string;
48
+ metadata: Record<string, any>;
49
+ transform_quantity: any | null;
50
+ tiers_mode: any | null;
51
+ recurring: Recurring;
52
+ product: string;
53
+ description: string | null;
54
+ tiers: any | null;
55
+ interval_count: number;
56
+ active: boolean;
57
+ currency: string;
58
+ interval: string;
59
+ unit_amount: number;
60
+ price_amount: number;
61
+ title: string;
62
+ price_description: string;
63
+ features: Features;
64
+ saving?: number;
65
+ }
66
+
67
+ // ============== Subscription Types ==============
68
+
69
+ export interface OrganizationSubscriptionType {
70
+ canceled_at: number | null;
71
+ created: Timestamp;
72
+ prices: FirestorePrice[];
73
+ price: FirestorePrice;
74
+ cancel_at_period_end: boolean;
75
+ product: FirestoreProduct;
76
+ stripeLink: string;
77
+ status:
78
+ | "active"
79
+ | "past_due"
80
+ | "canceled"
81
+ | "incomplete"
82
+ | "incomplete_expired"
83
+ | "trialing"
84
+ | "unpaid";
85
+ current_period_end: Timestamp;
86
+ metadata: {
87
+ price: string;
88
+ org_id: string;
89
+ date: string;
90
+ owner: string;
91
+ };
92
+ items: SubscriptionItem[];
93
+ trial_start: Timestamp;
94
+ ended_at: number | null;
95
+ trial_end: Timestamp;
96
+ role: string | null;
97
+ current_period_start: Timestamp;
98
+ quantity: number;
99
+ cancel_at: number | null;
100
+ id: string;
101
+ }
102
+
103
+ interface Timestamp {
104
+ seconds: number;
105
+ nanoseconds: number;
106
+ }
107
+
108
+ interface FirestorePrice {
109
+ converter: null | string;
110
+ _key: FirestoreKey;
111
+ type: string;
112
+ firestore: FirestoreDetails;
113
+ }
114
+
115
+ interface FirestoreProduct {
116
+ converter: null | string;
117
+ _key: FirestoreKey;
118
+ type: string;
119
+ firestore: FirestoreDetails;
120
+ }
121
+
122
+ interface FirestoreKey {
123
+ path: {
124
+ segments: string[];
125
+ offset: number;
126
+ len: number;
127
+ };
128
+ }
129
+
130
+ interface FirestoreDetails {
131
+ app: {
132
+ _isDeleted: boolean;
133
+ _options: {
134
+ apiKey: string;
135
+ authDomain: string;
136
+ projectId: string;
137
+ storageBucket: string;
138
+ messagingSenderId: string;
139
+ appId: string;
140
+ measurementId: string;
141
+ };
142
+ _config: {
143
+ name: string;
144
+ automaticDataCollectionEnabled: boolean;
145
+ };
146
+ _name: string;
147
+ _automaticDataCollectionEnabled: boolean;
148
+ _container: {
149
+ name: string;
150
+ providers: Record<string, unknown>;
151
+ };
152
+ };
153
+ databaseId: {
154
+ projectId: string;
155
+ database: string;
156
+ };
157
+ settings: {
158
+ host: string;
159
+ ssl: boolean;
160
+ ignoreUndefinedProperties: boolean;
161
+ localCache: {
162
+ kind: string;
163
+ };
164
+ cacheSizeBytes: number;
165
+ experimentalForceLongPolling: boolean;
166
+ experimentalAutoDetectLongPolling: boolean;
167
+ experimentalLongPollingOptions: Record<string, unknown>;
168
+ useFetchStreams: boolean;
169
+ };
170
+ }
171
+
172
+ interface SubscriptionItem {
173
+ price: PriceDetails;
174
+ metadata: Record<string, unknown>;
175
+ created: number;
176
+ id: string;
177
+ quantity: number;
178
+ plan: PlanDetails;
179
+ billing_thresholds: null | object;
180
+ subscription: string;
181
+ discounts: unknown[];
182
+ object: string;
183
+ tax_rates: unknown[];
184
+ }
185
+
186
+ interface PriceDetails {
187
+ tax_behavior: string;
188
+ unit_amount: number;
189
+ nickname: string | null;
190
+ recurring: RecurringDetails;
191
+ active: boolean;
192
+ type: string;
193
+ created: number;
194
+ unit_amount_decimal: string;
195
+ currency: string;
196
+ lookup_key: string;
197
+ tiers_mode: string | null;
198
+ billing_scheme: string;
199
+ metadata: Record<string, unknown>;
200
+ object: string;
201
+ product: ProductDetails;
202
+ livemode: boolean;
203
+ custom_unit_amount: null | object;
204
+ id: string;
205
+ transform_quantity: null | object;
206
+ }
207
+
208
+ interface RecurringDetails {
209
+ meter: string | null;
210
+ interval_count: number;
211
+ usage_type: string;
212
+ trial_period_days: number | null;
213
+ aggregate_usage: string | null;
214
+ interval: string;
215
+ }
216
+
217
+ interface PlanDetails {
218
+ amount: number;
219
+ aggregate_usage: string | null;
220
+ tiers_mode: string | null;
221
+ created: number;
222
+ object: string;
223
+ livemode: boolean;
224
+ id: string;
225
+ product: string;
226
+ interval_count: number;
227
+ usage_type: string;
228
+ transform_usage: string | null;
229
+ billing_scheme: string;
230
+ active: boolean;
231
+ metadata: Record<string, unknown>;
232
+ meter: string | null;
233
+ nickname: string | null;
234
+ currency: string;
235
+ interval: string;
236
+ trial_period_days: number | null;
237
+ amount_decimal: string;
238
+ }
239
+
240
+ interface ProductDetails {
241
+ created: number;
242
+ metadata: {
243
+ devices: string;
244
+ users: string;
245
+ staffAccounts: string;
246
+ };
247
+ type: string;
248
+ package_dimensions: string | null;
249
+ livemode: boolean;
250
+ url: string | null;
251
+ name: string;
252
+ unit_label: string | null;
253
+ updated: number;
254
+ object: string;
255
+ marketing_features: FeatureDetails[];
256
+ features: FeatureDetails[];
257
+ images: unknown[];
258
+ attributes: unknown[];
259
+ shippable: boolean | null;
260
+ id: string;
261
+ active: boolean;
262
+ default_price: string;
263
+ statement_descriptor: string | null;
264
+ tax_code: string;
265
+ description: string;
266
+ }
267
+
268
+ interface FeatureDetails {
269
+ name: string;
270
+ }
@@ -0,0 +1,45 @@
1
+ // These are the types for the cloud connectors that will power the users app per location.
2
+ // Each Location will have logs
3
+ //When creating a custom connector user must provider for all actions
4
+
5
+ type ModuleKey =
6
+ | "products"
7
+ | "variants"
8
+ | "orders"
9
+ | "draft-orders"
10
+ | "tags"
11
+ | "collections"
12
+ | "categories"
13
+ | "locations"
14
+ | "discounts"
15
+ | "customers"
16
+ | "fulfillments"
17
+ | "payments";
18
+
19
+ export interface CloudConnectorType {
20
+ id: string;
21
+ name: string;
22
+ logo: string;
23
+ type: "native" | "custom";
24
+ api: {
25
+ base_url: string;
26
+ apiVersion: string;
27
+ auth_type: "basic" | "bearer" | "none";
28
+ auth_config_keys: string[];
29
+ };
30
+ modules: {
31
+ [key in ModuleKey]: {
32
+ supported: boolean;
33
+ actions: {
34
+ create: boolean;
35
+ read: boolean;
36
+ update: boolean;
37
+ delete: boolean;
38
+ };
39
+ };
40
+ };
41
+ active: boolean;
42
+ internal_version: string;
43
+ connect_url: string;
44
+ setup_instructions_url: string;
45
+ }
@@ -0,0 +1,7 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ export export type ComponentRegistryItemType = {
3
+ id: string;
4
+ name: string;
5
+ component: React.ComponentType<any>;
6
+ props?: Record<string, any>;
7
+ };
@@ -0,0 +1,38 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+
3
+ export interface UnifiedCustomerType {
4
+ id: string;
5
+ email: string;
6
+ default_billing_address_id: string;
7
+ default_shipping_address_id: string;
8
+ company_name: string;
9
+ first_name: string;
10
+ last_name: string;
11
+ addresses: UnifiedCustomerAddressType[];
12
+ phone: string;
13
+ metadata: Record<string, any>;
14
+ created_at: string;
15
+ updated_at: string;
16
+ 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
+ }
22
+
23
+ export interface UnifiedCustomerAddressType {
24
+ id: string;
25
+ address_name: string;
26
+ is_default_shipping: boolean;
27
+ is_default_billing: boolean;
28
+ company: string;
29
+ first_name: string;
30
+ last_name: string;
31
+ address_1: string;
32
+ address_2: string;
33
+ city: string;
34
+ country_code: string;
35
+ province: string;
36
+ postal_code: string;
37
+ metadata: Record<string, any>;
38
+ }
package/src/device.ts ADDED
@@ -0,0 +1,80 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+
3
+ export interface DeviceType {
4
+ id: string;
5
+ organization_id: string;
6
+ name: string;
7
+ device: UserAgent;
8
+ token: string;
9
+ type:
10
+ | "retail-pos"
11
+ | "retail-kiosk"
12
+ | "restaurant-pos"
13
+ | "restaurant-kiosk"
14
+ | "hotel";
15
+ last_synced_date: string;
16
+ status?: "online" | "offline";
17
+ connected_at: string;
18
+ connected_by: string;
19
+ }
20
+
21
+ export interface UserAgent {
22
+ browser: {
23
+ name: string;
24
+ version: string;
25
+ };
26
+ os: {
27
+ name: string;
28
+ version: string;
29
+ versionName: string;
30
+ };
31
+ platform: {
32
+ type: string;
33
+ vendor: string;
34
+ };
35
+ engine: {
36
+ name: string;
37
+ };
38
+ memory: string | number;
39
+ connectionType: string | number;
40
+ screenSize: string | number;
41
+ }
42
+
43
+ export enum DeviceKeyboardType {
44
+ STALL_ONSCREEN = "stall_onscreen",
45
+ DEVICE = "device",
46
+ }
47
+
48
+ export interface DeviceConfigType {
49
+ keyboard: {
50
+ type: DeviceKeyboardType;
51
+ };
52
+ payment_methods: string[]; // Ids of avaiable payment methods on this device
53
+ hardware: {
54
+ printer?: NonNullable<unknown>;
55
+ scanner?: NonNullable<unknown>;
56
+ drawer?: NonNullable<unknown>;
57
+ };
58
+ language: "en";
59
+ }
60
+
61
+ export interface VKeyboardStateType {
62
+ input_id: string;
63
+ placeholder: string;
64
+ type: "text" | "textarea" | "number" | "email" | "password";
65
+ layout: string;
66
+ value: any;
67
+ transparent_background?: boolean;
68
+ hide_input?: boolean;
69
+ }
70
+
71
+ export interface LocaleDeviceInfoType {
72
+ brand: string;
73
+ device_name: string;
74
+ device_id: string;
75
+ ip: string;
76
+ ram: number;
77
+ os: string;
78
+ os_version: string;
79
+ mac_address: string;
80
+ }
@@ -0,0 +1,30 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ export interface FulfillmentProviderType {
3
+ id: string; // Unique ID for the provider
4
+ method: "pick-up" | "delivery" | "shipment"; // The fulfillment method type
5
+ name: string; // Name of the fulfillment method
6
+ description: string; // Description of the service
7
+ minOrderAmount?: number; // Minimum order value for eligibility (optional)
8
+ maxOrderAmount?: number; // Maximum order value for eligibility (optional)
9
+ restrictions?: Restriction[]; // Dynamic restrictions based on regions, products, etc.
10
+ fees?: FeeStructure[]; // Flexible fee structure based on conditions
11
+ estimatedFulfillmentTime?: number; // Estimated time for fulfillment in hours
12
+ metadata?:{[key:string]:any} // Additional metadata for the provider
13
+ }
14
+
15
+ export interface Restriction {
16
+ type: "region" | "country" | "state" | "zip_code" | "product" | "order_value";
17
+ value: string | number; // Value that corresponds to the restriction, such as "US" for country or a minimum order value
18
+ operator?: "equals" | "not_equals" | "greater_than" | "less_than"; // Operator for order value or numeric restrictions
19
+ }
20
+
21
+ export interface FeeStructure {
22
+ condition?: FeeCondition; // The condition under which the fee applies (optional)
23
+ amount: number; // Fee amount to be applied
24
+ }
25
+
26
+ export interface FeeCondition {
27
+ orderValue?: { min?: number; max?: number }; // Apply the fee if the order falls within this range
28
+ weight?: { min?: number; max?: number }; // Apply the fee based on order weight (optional)
29
+ regions?: string[]; // Specific regions or countries where this fee applies
30
+ }
@@ -0,0 +1,14 @@
1
+ export {};
2
+
3
+ declare global {
4
+ interface Window {
5
+ api: {
6
+ getDeviceInfo: () => Promise<{
7
+ device_id: string;
8
+ device_name: string;
9
+ device_type: string;
10
+ }>;
11
+ };
12
+ router: import("@remix-run/router").Router;
13
+ }
14
+ }
@@ -0,0 +1,58 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
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
+ }
@@ -0,0 +1,14 @@
1
+ import { UnifiedTaxRegionType } from "./taxes";
2
+
3
+ export interface LocationType {
4
+ name: string;
5
+ address: string;
6
+ city: string;
7
+ country: string;
8
+ org_id: string;
9
+ id: string;
10
+ created_at: string;
11
+ updated_at: string;
12
+ active: boolean;
13
+ region?: UnifiedTaxRegionType;
14
+ }
@@ -0,0 +1,45 @@
1
+ import { ExtensionModule } from "@/extensions/types";
2
+ import React from "react";
3
+
4
+ /* eslint-disable @typescript-eslint/no-explicit-any */
5
+ export interface LookUpStateType {
6
+ active_group: LookupGroupRouteType | undefined;
7
+ routes: LookupGroupRouteType[];
8
+ search_query: string;
9
+ is_shortcut?: boolean;
10
+ }
11
+
12
+ export interface LookupGroupRouteType {
13
+ id: string;
14
+ title: string;
15
+ extension: {
16
+ id: string;
17
+ title: string;
18
+ };
19
+ previous_route_item: Record<string, any>;
20
+ filters?: LookupListFilters[];
21
+ }
22
+
23
+ export type LookupListFilters = {
24
+ key: string;
25
+ type: "string" | "number" | "array";
26
+ query_value: string;
27
+ dynamic: boolean;
28
+ };
29
+
30
+ export type ActionTriggerType = null | {
31
+ global: boolean;
32
+ };
33
+
34
+ export interface LookUpContextType {
35
+ actionsTriggered: ActionTriggerType;
36
+ triggerActions: (state: ActionTriggerType) => void;
37
+ lookUpSearchInputRef: React.RefObject<HTMLInputElement>;
38
+ closeLookUp: (force?: boolean) => void;
39
+ module: ExtensionModule | null;
40
+ loading: boolean;
41
+ error: Error | null;
42
+ look_up: LookUpStateType;
43
+ active_group: LookupGroupRouteType | undefined;
44
+ handleInputsKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;
45
+ }
package/src/media.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ export interface ImageTypes {
3
+ source_url: string;
4
+ id: string;
5
+ alt: string;
6
+ date_created: string;
7
+ }
8
+ export interface UnifiedImageType {
9
+ source_url: string;
10
+ name: string;
11
+ id: string;
12
+ alt: string;
13
+ date_created: string;
14
+ }
@@ -0,0 +1,10 @@
1
+ export interface signupForm {
2
+ business_type: string;
3
+ organization_name: string;
4
+ organization_size: number;
5
+ username: string;
6
+ phone_number: string;
7
+ email: string;
8
+ password: string;
9
+ plan: string;
10
+ }