@use-stall/types 0.2.11 → 0.2.13

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/taxes.d.ts +33 -28
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@use-stall/types",
3
- "version": "0.2.11",
3
+ "version": "0.2.13",
4
4
  "description": "Type declarations for Stall SDKs",
5
5
  "types": "index.d.ts",
6
6
  "type": "module",
package/src/taxes.d.ts CHANGED
@@ -1,14 +1,20 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- export interface UnifiedTaxRegionType {
3
- id: string; // Unique identifier
4
- name: string; // Display name (e.g., "California", "EU VAT Zone")
5
- country: string; // Country
6
- alpha3: string; // ISO 3166-1 alpha-3 code (e.g., "USA", "GBR")
7
- alpha2: string; // ISO 3166-1 alpha-2 code (e.g., "US", "GB")
8
- states: string[]; // Optional state/province (e.g., "CA")
9
- postal_codes: string[]; // Specific ZIP codes if applicable
10
- tax_inclusive: boolean; // Whether prices include tax
11
- is_default?: boolean; // Whether this is the default region
1
+ export interface UnifiedTaxRate {
2
+ id: string;
3
+ name: string; // VAT
4
+ class: string; // tax class id
5
+ jurisdiction: {
6
+ country: string; // ZA, US
7
+ states: string[]; // States or provinces -> Empty array applies to all
8
+ postcode: string[]; // An array of postal codes -> Empty array applies to all
9
+ locations: string[]; // Useful for in-person sales -> Empty array applies to all
10
+ };
11
+ rate: number;
12
+ type: "fixed" | "percentage";
13
+ calculation_base: "net" | "gross";
14
+ application: "per_item" | "per_order";
15
+ priority: number; // application order
16
+ compound: boolean;
17
+ rules: UnifiedTaxRateRule[];
12
18
  metadata: {
13
19
  stall_offline_id: string;
14
20
  stall_offline_created_at: string;
@@ -18,17 +24,21 @@ export interface UnifiedTaxRegionType {
18
24
  }; // Additional metadata
19
25
  }
20
26
 
21
- export interface UnifiedTaxRateType {
22
- id: string; // Unique identifier
23
- name: string; // Name (e.g., "Standard", "Reduced", "Exempt","VAT")
24
- region_id: string; // Links to TaxRegion
25
- state: string; // Optional state/province (e.g., "CA")
26
- rate: number; // Tax rate (e.g., 0.2 for 20%)
27
- type: "percentage" | "fixed"; // Type of tax
28
- code: string; // Optional description
29
- compound: boolean; // Whether this is a compound tax rate
30
- priority: number; // Priority order
31
- roles: UnifiedTaxRateRule[]; // Optionally apply/override to x without including the entire region
27
+ export interface UnifiedTaxRateRule {
28
+ type: "exemption" | "reduction";
29
+ conditions: UnifiedTaxRateRuleCondition[];
30
+ }
31
+
32
+ export interface UnifiedTaxRateRuleCondition {
33
+ type: "item_price" | "item_quantity" | "total_price";
34
+ operator: "eq" | "gt" | "gte" | "lt" | "lte";
35
+ amount: number;
36
+ }
37
+
38
+ export interface UnifiedTaxClass {
39
+ id: string;
40
+ name: string; // Standard
41
+ tax_calculation: "inclusive" | "additive";
32
42
  metadata: {
33
43
  stall_offline_id: string;
34
44
  stall_offline_created_at: string;
@@ -36,9 +46,4 @@ export interface UnifiedTaxRateType {
36
46
  stall_offline_deleted_at: string;
37
47
  [key: string]: any;
38
48
  }; // Additional metadata
39
- }
40
-
41
- export interface UnifiedTaxRateRule {
42
- type: "collection" | "product" | "category" | "product_type";
43
- value: string;
44
- }
49
+ }