@use-stall/types 0.0.1 → 0.0.3

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 CHANGED
@@ -2,3 +2,9 @@
2
2
 
3
3
  ## Description
4
4
  Type declarations for Stall SDKs.
5
+
6
+ ## Installation
7
+ Install the types using npm:
8
+ ```bash
9
+ bun install @stall/types
10
+ ```
package/index.d.ts CHANGED
@@ -20,3 +20,5 @@ export * from "./src/stall-icons";
20
20
  export * from "./src/system";
21
21
  export * from "./src/taxes";
22
22
  export * from "./src/users";
23
+ export * from "./src/fulfillment";
24
+ export * from "./src/extensions";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@use-stall/types",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Type declarations for Stall SDKs",
5
5
  "types": "index.d.ts",
6
6
  "type": "module",
@@ -5,41 +5,64 @@
5
5
  type ModuleKey =
6
6
  | "products"
7
7
  | "variants"
8
- | "orders"
9
- | "draft-orders"
10
- | "tags"
11
8
  | "collections"
12
9
  | "categories"
13
- | "locations"
14
- | "discounts"
10
+ | "tags"
11
+ | "inventory_levels" // For products with stock tracking
12
+ | "inventory_history" // History of inventory levels at a specific point in time
13
+ | "coupons"
14
+ | "gift_cards"
15
+ | "orders"
16
+ | "order_notes" // Activities related to order
17
+ | "refunds" // Activities related to refunds
18
+ | "payment_providers"
19
+ | "payments" // Create, Read, Update, Delete, Webhooks
20
+ | "receipts" // These are not tax invoices but rather and indication of a successful payment
21
+ | "tax_regions" // can be tax class or groups in other data sources
22
+ | "tax_rates"
15
23
  | "customers"
16
- | "fulfillments"
17
- | "payments";
24
+ | "locations" // Can be stock locations, warehouses, or any other location-related data
25
+ | "sessions_tracking" // This will be used for cash tracking and tracking the POS/Flex user
26
+ | "fulfillment_types" // Like delivery, pickup, etc.
27
+ | "fulfillment_providers" // Providers third party or custom like DHL, FedEx, UPS, etc.
28
+ | "fulfillments"; // Individual fulfillment instances for an order
29
+
30
+ export interface ConnectorModulesType {
31
+ [key in ModuleKey]: {
32
+ supported: boolean;
33
+ actions: {
34
+ create: boolean;
35
+ read: boolean;
36
+ update: boolean;
37
+ delete: boolean;
38
+ };
39
+ };
40
+ }
18
41
 
19
- export interface CloudConnectorType {
42
+ export interface ConnectorType {
20
43
  id: string;
44
+ version: string;
21
45
  name: string;
46
+ description: string;
22
47
  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
- };
48
+ modules: ConnectorModulesType;
49
+ authentication: {
50
+ type: "basic" | "bearer" | "api_key" | "none";
51
+ ttl_type: "permanent" | "session";
52
+ ttl_value: number; // TTL value in minutes
40
53
  };
54
+ integration_url: string; // Where to redirect the users to connect their account
55
+ integration_docs: string; // Where to redirect the users to learn how to connect their account
41
56
  active: boolean;
42
- internal_version: string;
43
- connect_url: string;
44
- setup_instructions_url: string;
45
57
  }
58
+
59
+ export interface ConnectorConfigurationType {
60
+ connector_id: string;
61
+ configuration: {
62
+ username: string; // For basic authentication
63
+ password: string; // For basic authentication
64
+ token: string; // For bearer authentication
65
+ api_key_header: string; // For API key authentication or Custom header
66
+ api_key_value: string; // For API key authentication or Custom header
67
+ };
68
+ }
@@ -1,43 +1,51 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import type { InstalledExtensionType } from "./extensions";
2
3
 
3
4
  export interface DeviceType {
4
5
  id: string;
5
- organization_id: string;
6
+ organization: string;
7
+ location: string;
6
8
  name: string;
7
- device: UserAgent;
9
+ description: string;
10
+ code: string;
11
+ paired: boolean;
8
12
  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";
13
+ device_profile: string;
14
+ created_at: string;
15
+ created_by: string;
16
+ last_seen: string;
17
17
  connected_at: string;
18
18
  connected_by: string;
19
+ device_details: DeviceDetails;
19
20
  }
20
21
 
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;
22
+ export interface DeviceDetails {
23
+ device_id: string;
24
+ ip: string;
25
+ mac_address: string;
26
+ brand: string;
27
+ model: string;
28
+ os: string;
29
+ os_version: string;
30
+ ram: number;
31
+ network_type: string;
32
+ screen_size: string;
33
+ origin: "web" | "app";
34
+ }
35
+
36
+ export interface DeviceProfile {
37
+ id: string;
38
+ name: string;
39
+ description: string;
40
+ extensions: {
41
+ extensions: InstalledExtensionType[];
42
+ groups: string[]; // When configure they will take precedence over the individual extensions where duplicates exist
43
+ auto_update: boolean;
34
44
  };
35
- engine: {
36
- name: string;
45
+ restrictions: {
46
+ roles: string[]; // If empty, no roles restrictions will be applied
47
+ users: string[]; // If empty, no users restrictions will be applied
37
48
  };
38
- memory: string | number;
39
- connectionType: string | number;
40
- screenSize: string | number;
41
49
  }
42
50
 
43
51
  export enum DeviceKeyboardType {
@@ -0,0 +1,17 @@
1
+ export interface ExtensionType {
2
+ id: string;
3
+ version: string;
4
+ created_at: string;
5
+ updated_at: string;
6
+ name: string;
7
+ description: string;
8
+ icon: string;
9
+ keywords: string[];
10
+ authors: string[];
11
+ }
12
+
13
+
14
+ export interface InstalledExtensionType {
15
+ id: string;
16
+ version: string;
17
+ }
@@ -1,30 +1,63 @@
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
- }
1
+ import type { UnifiedCustomerAddressType } from "./customers";
14
2
 
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
3
+ export interface FulfillmentProvider {
4
+ id: string;
5
+ name: string;
6
+ description: string;
7
+ logo: string;
19
8
  }
20
9
 
21
- export interface FeeStructure {
22
- condition?: FeeCondition; // The condition under which the fee applies (optional)
23
- amount: number; // Fee amount to be applied
10
+ export interface FulfillmentType {
11
+ id: string;
12
+ name: string;
13
+ description: string;
14
+ configurations: {
15
+ customer: boolean;
16
+ address: boolean;
17
+ };
24
18
  }
25
19
 
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
20
+ export type FulFillmentStatus =
21
+ | "pending"
22
+ | "packing"
23
+ | "dispatched"
24
+ | "en-route"
25
+ | "delivered"
26
+ | "cancelled"
27
+ | "returned";
28
+
29
+ export interface FulFillmentLineItem {
30
+ id: string;
31
+ sku: string;
32
+ name: string;
33
+ dimensions: {
34
+ length: string; // e.g. "10cm"
35
+ width: string; // e.g. "5cm"
36
+ height: string; // e.g. "3m"
37
+ weight: string; // e.g. "1kg"
38
+ };
39
+ quantity: number;
40
+ amount: number;
30
41
  }
42
+
43
+ export interface OrderFulfillment {
44
+ id: string;
45
+ order_id: string;
46
+ tracking_number: string;
47
+ type_id: string;
48
+ provider_id: string;
49
+ status: FulFillmentStatus;
50
+ created_at: string;
51
+ updated_at: string;
52
+ delivered_at: string;
53
+ line_items: FulFillmentLineItem[];
54
+ fees: {
55
+ subtotal: number;
56
+ total: number;
57
+ currency: string;
58
+ };
59
+ address: {
60
+ destination: UnifiedCustomerAddressType;
61
+ departure: UnifiedCustomerAddressType;
62
+ };
63
+ }
package/src/orders.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { UnifiedCustomerAddressType } from "./customers";
2
+
1
3
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
4
  export interface UnifiedOrderType {
3
5
  id: string;
@@ -22,8 +24,8 @@ export interface UnifiedOrderType {
22
24
  checkout_token: string;
23
25
  customer_id: string;
24
26
  customer_note: string;
25
- billing: UnifiedAddressType;
26
- shipping_address: UnifiedAddressType;
27
+ billing: UnifiedCustomerAddressType;
28
+ shipping_address: UnifiedCustomerAddressType;
27
29
  line_items: UnifiedLineItemType[]; // Array of purchased items (products/variants)
28
30
  currency: string; // Currency of the order
29
31
  payment: UnifiedOrderPaymentDetailsType;
@@ -69,20 +71,6 @@ export interface UnifiedLineItemType {
69
71
  metadata: Record<string, any>; // Optional custom fields
70
72
  }
71
73
 
72
- export interface UnifiedAddressType {
73
- first_name: string;
74
- last_name: string;
75
- company: string;
76
- address_1: string;
77
- address_2: string;
78
- city: string;
79
- state: string;
80
- postcode: string;
81
- country: string;
82
- email: string;
83
- phone: string;
84
- }
85
-
86
74
  export interface UnifiedTaxLineType {
87
75
  id: string;
88
76
  name: string;