@betterstore/sdk 0.3.9 → 0.3.12

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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @betterstore/sdk
2
2
 
3
+ ## 0.3.12
4
+
5
+ ### Patch Changes
6
+
7
+ - shippo bug fix
8
+
9
+ ## 0.3.11
10
+
11
+ ### Patch Changes
12
+
13
+ - types
14
+
15
+ ## 0.3.10
16
+
17
+ ### Patch Changes
18
+
19
+ - shipping rate type fix metadata added
20
+
3
21
  ## 0.3.9
4
22
 
5
23
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,3 +1,6 @@
1
+ import { Rate } from 'shippo';
2
+ export { Rate as ShippingRate } from 'shippo';
3
+
1
4
  type Address = {
2
5
  name: string;
3
6
  company?: string;
@@ -79,12 +82,13 @@ interface Product {
79
82
 
80
83
  interface LineItem {
81
84
  quantity: number;
82
- productId?: string;
85
+ productId: string;
83
86
  variantOptions: {
84
87
  name: string;
85
88
  value: string;
86
89
  }[];
87
90
  discountId?: string;
91
+ metadata?: string;
88
92
  }
89
93
  interface CheckoutCreateParams {
90
94
  type: "hosted" | "embed";
@@ -95,35 +99,13 @@ interface CheckoutUpdateParams {
95
99
  lineItems?: LineItem[];
96
100
  customerId?: string;
97
101
  }
98
- interface ShippingRate {
99
- id: string;
100
- rate: number;
101
- provider: string;
102
- service: string;
103
- estimatedDays: number;
104
- }
102
+
105
103
  interface CheckoutSession {
106
104
  id: string;
107
105
  createdAt: Date;
108
106
  updatedAt: Date;
109
107
  clientSecret: string;
110
- lineItems: {
111
- quantity: number;
112
- discount?: any;
113
- variantOptions: {
114
- name: string;
115
- value: string;
116
- }[];
117
- product?: {
118
- id: string;
119
- title: string;
120
- description?: string;
121
- images: string[];
122
- category: string;
123
- tags: string[];
124
- priceInCents: number;
125
- };
126
- }[];
108
+ lineItems: LineItem[];
127
109
  total?: number;
128
110
  subtotal?: number;
129
111
  tax?: number;
@@ -154,7 +136,7 @@ declare class Checkout {
154
136
  /**
155
137
  * Get shipping rates for a checkout session
156
138
  */
157
- getShippingRates(checkoutId: string): Promise<ShippingRate[]>;
139
+ getShippingRates(checkoutId: string): Promise<Rate[]>;
158
140
  /**
159
141
  * Generate payment secret for a checkout session
160
142
  */
@@ -175,7 +157,7 @@ declare class Client {
175
157
  /**
176
158
  * Get shipping rates for a checkout session
177
159
  */
178
- getCheckoutShippingRates(clientSecret: string, checkoutId: string): Promise<ShippingRate[]>;
160
+ getCheckoutShippingRates(clientSecret: string, checkoutId: string): Promise<Rate[]>;
179
161
  /**
180
162
  * Generate payment secret for a checkout session
181
163
  */
@@ -234,4 +216,4 @@ declare function createStoreClient(config: {
234
216
  proxy?: string;
235
217
  }): Client;
236
218
 
237
- export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Customer$1 as Customer, type CustomerCreateParams, type CustomerUpdateParams, type LineItem, type Product, type ProductOption, ProductStatus, type ProductVariant, type ShippingRate, type VariantOption, createStoreClient, betterStore as default };
219
+ export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Customer$1 as Customer, type CustomerCreateParams, type CustomerUpdateParams, type LineItem, type Product, type ProductOption, ProductStatus, type ProductVariant, type VariantOption, createStoreClient, betterStore as default };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ import { Rate } from 'shippo';
2
+ export { Rate as ShippingRate } from 'shippo';
3
+
1
4
  type Address = {
2
5
  name: string;
3
6
  company?: string;
@@ -79,12 +82,13 @@ interface Product {
79
82
 
80
83
  interface LineItem {
81
84
  quantity: number;
82
- productId?: string;
85
+ productId: string;
83
86
  variantOptions: {
84
87
  name: string;
85
88
  value: string;
86
89
  }[];
87
90
  discountId?: string;
91
+ metadata?: string;
88
92
  }
89
93
  interface CheckoutCreateParams {
90
94
  type: "hosted" | "embed";
@@ -95,35 +99,13 @@ interface CheckoutUpdateParams {
95
99
  lineItems?: LineItem[];
96
100
  customerId?: string;
97
101
  }
98
- interface ShippingRate {
99
- id: string;
100
- rate: number;
101
- provider: string;
102
- service: string;
103
- estimatedDays: number;
104
- }
102
+
105
103
  interface CheckoutSession {
106
104
  id: string;
107
105
  createdAt: Date;
108
106
  updatedAt: Date;
109
107
  clientSecret: string;
110
- lineItems: {
111
- quantity: number;
112
- discount?: any;
113
- variantOptions: {
114
- name: string;
115
- value: string;
116
- }[];
117
- product?: {
118
- id: string;
119
- title: string;
120
- description?: string;
121
- images: string[];
122
- category: string;
123
- tags: string[];
124
- priceInCents: number;
125
- };
126
- }[];
108
+ lineItems: LineItem[];
127
109
  total?: number;
128
110
  subtotal?: number;
129
111
  tax?: number;
@@ -154,7 +136,7 @@ declare class Checkout {
154
136
  /**
155
137
  * Get shipping rates for a checkout session
156
138
  */
157
- getShippingRates(checkoutId: string): Promise<ShippingRate[]>;
139
+ getShippingRates(checkoutId: string): Promise<Rate[]>;
158
140
  /**
159
141
  * Generate payment secret for a checkout session
160
142
  */
@@ -175,7 +157,7 @@ declare class Client {
175
157
  /**
176
158
  * Get shipping rates for a checkout session
177
159
  */
178
- getCheckoutShippingRates(clientSecret: string, checkoutId: string): Promise<ShippingRate[]>;
160
+ getCheckoutShippingRates(clientSecret: string, checkoutId: string): Promise<Rate[]>;
179
161
  /**
180
162
  * Generate payment secret for a checkout session
181
163
  */
@@ -234,4 +216,4 @@ declare function createStoreClient(config: {
234
216
  proxy?: string;
235
217
  }): Client;
236
218
 
237
- export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Customer$1 as Customer, type CustomerCreateParams, type CustomerUpdateParams, type LineItem, type Product, type ProductOption, ProductStatus, type ProductVariant, type ShippingRate, type VariantOption, createStoreClient, betterStore as default };
219
+ export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Customer$1 as Customer, type CustomerCreateParams, type CustomerUpdateParams, type LineItem, type Product, type ProductOption, ProductStatus, type ProductVariant, type VariantOption, createStoreClient, betterStore as default };
package/dist/index.js CHANGED
@@ -51,6 +51,7 @@ var __async = (__this, __arguments, generator) => {
51
51
  var index_exports = {};
52
52
  __export(index_exports, {
53
53
  ProductStatus: () => ProductStatus,
54
+ ShippingRate: () => import_shippo.Rate,
54
55
  createStoreClient: () => createStoreClient,
55
56
  default: () => betterStore
56
57
  });
@@ -332,6 +333,9 @@ var Products = class {
332
333
  };
333
334
  var products_default = Products;
334
335
 
336
+ // src/checkout/types.ts
337
+ var import_shippo = require("shippo");
338
+
335
339
  // src/products/types.ts
336
340
  var ProductStatus = /* @__PURE__ */ ((ProductStatus2) => {
337
341
  ProductStatus2["DRAFT"] = "DRAFT";
@@ -357,5 +361,6 @@ function createStoreClient(config) {
357
361
  // Annotate the CommonJS export names for ESM import in node:
358
362
  0 && (module.exports = {
359
363
  ProductStatus,
364
+ ShippingRate,
360
365
  createStoreClient
361
366
  });
package/dist/index.mjs CHANGED
@@ -295,6 +295,9 @@ var Products = class {
295
295
  };
296
296
  var products_default = Products;
297
297
 
298
+ // src/checkout/types.ts
299
+ import { Rate } from "shippo";
300
+
298
301
  // src/products/types.ts
299
302
  var ProductStatus = /* @__PURE__ */ ((ProductStatus2) => {
300
303
  ProductStatus2["DRAFT"] = "DRAFT";
@@ -319,6 +322,7 @@ function createStoreClient(config) {
319
322
  }
320
323
  export {
321
324
  ProductStatus,
325
+ Rate as ShippingRate,
322
326
  createStoreClient,
323
327
  betterStore as default
324
328
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstore/sdk",
3
- "version": "0.3.9",
3
+ "version": "0.3.12",
4
4
  "description": "E-commerce for Developers",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -26,7 +26,9 @@
26
26
  "typescript": "^5.8.2"
27
27
  },
28
28
  "dependencies": {
29
- "axios": "^1.8.2"
29
+ "axios": "^1.8.2",
30
+ "shippo": "^2.15.0",
31
+ "zod": "^3.24.2"
30
32
  },
31
33
  "scripts": {
32
34
  "prep": "changeset && changeset version && git add .",