@use-stall/types 0.0.1 → 0.0.2

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.2",
4
4
  "description": "Type declarations for Stall SDKs",
5
5
  "types": "index.d.ts",
6
6
  "type": "module",
@@ -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;