@betterstore/sdk 0.5.23 → 0.5.24

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/dist/index.d.mts CHANGED
@@ -2,19 +2,62 @@ import axios from 'axios';
2
2
 
3
3
  declare const createApiClient: (apiKey: string, proxy?: string) => axios.AxiosInstance;
4
4
 
5
- type ShippingRate = ZasilkovnaRate;
6
- interface BaseRate {
7
- provider: string;
5
+ interface GetShippingRatesResponse {
6
+ [shipmentId: string]: ShippingRate[];
7
+ }
8
+ type ShippingVendorCarrierType = "zasilkovna";
9
+ type ProviderId = "zasilkovna";
10
+ type ShippingRate = FixedRate | PlatformCarrierRate | CustomShippingVendorRate | PrebuiltRate;
11
+ interface FixedRate {
12
+ id: string;
13
+ type: "FIXED";
8
14
  name: string;
15
+ description?: string;
16
+ priceInCents: number;
17
+ }
18
+ interface BasePlatformCarrierRate {
19
+ id: string;
20
+ providerId: ProviderId;
21
+ type: "PLATFORM_CARRIER";
22
+ platformCarrierSlug: string;
9
23
  priceInCents: number;
10
24
  }
11
- interface ZasilkovnaRate extends BaseRate {
12
- provider: "zasilkovna";
25
+ interface ZasilkovnaPlatformCarrierRate extends BasePlatformCarrierRate {
26
+ providerId: "zasilkovna";
27
+ platformCarrierSlug: "bs_platform_zasilkovna";
28
+ service: "z_box";
13
29
  clientSecret: string;
14
30
  }
15
- interface GetShippingRatesResponse {
16
- [shipmentId: string]: ShippingRate[];
31
+ type PlatformCarrierRate = ZasilkovnaPlatformCarrierRate;
32
+ interface BaseCustomShippingVendorRate {
33
+ id: string;
34
+ providerId: ProviderId;
35
+ type: "CUSTOM_SHIPPING_VENDOR";
36
+ shippingVendorCarrierType: ShippingVendorCarrierType;
37
+ priceInCents: number;
17
38
  }
39
+ interface ZasilkovnaCustomShippingVendorRate extends BaseCustomShippingVendorRate {
40
+ providerId: "zasilkovna";
41
+ shippingVendorCarrierType: Extract<ShippingVendorCarrierType, "zasilkovna">;
42
+ service: "z_box";
43
+ clientSecret: string;
44
+ }
45
+ type CustomShippingVendorRate = ZasilkovnaCustomShippingVendorRate;
46
+ type PrebuiltRateType = "PICKUP_IN_STORE" | "LOCAL_DELIVERY";
47
+ interface BasePrebuiltRate {
48
+ id: string;
49
+ type: "PREBUILT";
50
+ prebuiltRateType: PrebuiltRateType;
51
+ priceInCents: number;
52
+ }
53
+ interface PrebuildPickupInStoreRate extends BasePrebuiltRate {
54
+ prebuiltRateType: Extract<PrebuiltRateType, "PICKUP_IN_STORE">;
55
+ expectedPickupDateInHours: number;
56
+ }
57
+ interface PrebuiltLocalDeliveryRate extends BasePrebuiltRate {
58
+ prebuiltRateType: Extract<PrebuiltRateType, "LOCAL_DELIVERY">;
59
+ }
60
+ type PrebuiltRate = PrebuildPickupInStoreRate | PrebuiltLocalDeliveryRate;
18
61
 
19
62
  type ProductData = Pick<Product, "title" | "description" | "images" | "category" | "tags" | "sku" | "barcode" | "vendor" | "isPhysical" | "weightInGrams" | "heightInCm" | "widthInCm" | "lengthInCm" | "priceInCents" | "billingType" | "billingInterval" | "billingIntervalCount"> & {
20
63
  productId: string;
@@ -52,13 +95,12 @@ interface CheckoutUpdateParams {
52
95
  }
53
96
 
54
97
  type ShipmentData = {
55
- provider: string;
56
- name?: string;
57
- service?: string;
98
+ rateId: string;
99
+ providerId?: string;
100
+ priceInCents: number;
58
101
  pickupPointId?: string;
59
102
  trackingId?: string;
60
103
  trackingUrl?: string;
61
- priceInCents: number;
62
104
  };
63
105
  type CheckoutShipment = {
64
106
  id: string;
@@ -157,12 +199,12 @@ interface ProductVariant {
157
199
  title: string;
158
200
  description?: string;
159
201
  images: string[];
160
- trackInventory: boolean;
161
202
  sku?: string;
162
203
  barcode?: string;
163
- stockAvailable: number;
164
- stockCommited: number;
165
- stockUnavailable: number;
204
+ inventoryItem: {
205
+ stockPolicy: "CONTINUE" | "DENY";
206
+ trackInventory: boolean;
207
+ };
166
208
  isPhysical: boolean;
167
209
  weightInGrams?: number;
168
210
  heightInCm?: number;
@@ -200,12 +242,12 @@ interface Product {
200
242
  billingType: ProductBillingType;
201
243
  billingInterval: ProductBillingInterval;
202
244
  billingIntervalCount: number;
203
- trackInventory: boolean;
204
245
  sku?: string;
205
246
  barcode?: string;
206
- stockAvailable: number;
207
- stockCommited: number;
208
- stockUnavailable: number;
247
+ inventoryItem: {
248
+ stockPolicy: "CONTINUE" | "DENY";
249
+ trackInventory: boolean;
250
+ };
209
251
  seoPageTitle?: string;
210
252
  seoDescription?: string;
211
253
  seoHandle?: string;
@@ -226,7 +268,7 @@ type ListProductsQuery = {
226
268
  createdAt?: DateQueryType;
227
269
  updatedAt?: DateQueryType;
228
270
  };
229
- type ListProductsSortBy = "createdAt" | "updatedAt" | "title" | "stockAvailable" | "stockCommited" | "priceInCents";
271
+ type ListProductsSortBy = "createdAt" | "updatedAt" | "title" | "priceInCents";
230
272
  type ListProductsParams = GetListParams<ListProductsSortBy, ListProductsQuery>;
231
273
  type RetrieveProductParams = {
232
274
  seoHandle: string;
package/dist/index.d.ts CHANGED
@@ -2,19 +2,62 @@ import axios from 'axios';
2
2
 
3
3
  declare const createApiClient: (apiKey: string, proxy?: string) => axios.AxiosInstance;
4
4
 
5
- type ShippingRate = ZasilkovnaRate;
6
- interface BaseRate {
7
- provider: string;
5
+ interface GetShippingRatesResponse {
6
+ [shipmentId: string]: ShippingRate[];
7
+ }
8
+ type ShippingVendorCarrierType = "zasilkovna";
9
+ type ProviderId = "zasilkovna";
10
+ type ShippingRate = FixedRate | PlatformCarrierRate | CustomShippingVendorRate | PrebuiltRate;
11
+ interface FixedRate {
12
+ id: string;
13
+ type: "FIXED";
8
14
  name: string;
15
+ description?: string;
16
+ priceInCents: number;
17
+ }
18
+ interface BasePlatformCarrierRate {
19
+ id: string;
20
+ providerId: ProviderId;
21
+ type: "PLATFORM_CARRIER";
22
+ platformCarrierSlug: string;
9
23
  priceInCents: number;
10
24
  }
11
- interface ZasilkovnaRate extends BaseRate {
12
- provider: "zasilkovna";
25
+ interface ZasilkovnaPlatformCarrierRate extends BasePlatformCarrierRate {
26
+ providerId: "zasilkovna";
27
+ platformCarrierSlug: "bs_platform_zasilkovna";
28
+ service: "z_box";
13
29
  clientSecret: string;
14
30
  }
15
- interface GetShippingRatesResponse {
16
- [shipmentId: string]: ShippingRate[];
31
+ type PlatformCarrierRate = ZasilkovnaPlatformCarrierRate;
32
+ interface BaseCustomShippingVendorRate {
33
+ id: string;
34
+ providerId: ProviderId;
35
+ type: "CUSTOM_SHIPPING_VENDOR";
36
+ shippingVendorCarrierType: ShippingVendorCarrierType;
37
+ priceInCents: number;
17
38
  }
39
+ interface ZasilkovnaCustomShippingVendorRate extends BaseCustomShippingVendorRate {
40
+ providerId: "zasilkovna";
41
+ shippingVendorCarrierType: Extract<ShippingVendorCarrierType, "zasilkovna">;
42
+ service: "z_box";
43
+ clientSecret: string;
44
+ }
45
+ type CustomShippingVendorRate = ZasilkovnaCustomShippingVendorRate;
46
+ type PrebuiltRateType = "PICKUP_IN_STORE" | "LOCAL_DELIVERY";
47
+ interface BasePrebuiltRate {
48
+ id: string;
49
+ type: "PREBUILT";
50
+ prebuiltRateType: PrebuiltRateType;
51
+ priceInCents: number;
52
+ }
53
+ interface PrebuildPickupInStoreRate extends BasePrebuiltRate {
54
+ prebuiltRateType: Extract<PrebuiltRateType, "PICKUP_IN_STORE">;
55
+ expectedPickupDateInHours: number;
56
+ }
57
+ interface PrebuiltLocalDeliveryRate extends BasePrebuiltRate {
58
+ prebuiltRateType: Extract<PrebuiltRateType, "LOCAL_DELIVERY">;
59
+ }
60
+ type PrebuiltRate = PrebuildPickupInStoreRate | PrebuiltLocalDeliveryRate;
18
61
 
19
62
  type ProductData = Pick<Product, "title" | "description" | "images" | "category" | "tags" | "sku" | "barcode" | "vendor" | "isPhysical" | "weightInGrams" | "heightInCm" | "widthInCm" | "lengthInCm" | "priceInCents" | "billingType" | "billingInterval" | "billingIntervalCount"> & {
20
63
  productId: string;
@@ -52,13 +95,12 @@ interface CheckoutUpdateParams {
52
95
  }
53
96
 
54
97
  type ShipmentData = {
55
- provider: string;
56
- name?: string;
57
- service?: string;
98
+ rateId: string;
99
+ providerId?: string;
100
+ priceInCents: number;
58
101
  pickupPointId?: string;
59
102
  trackingId?: string;
60
103
  trackingUrl?: string;
61
- priceInCents: number;
62
104
  };
63
105
  type CheckoutShipment = {
64
106
  id: string;
@@ -157,12 +199,12 @@ interface ProductVariant {
157
199
  title: string;
158
200
  description?: string;
159
201
  images: string[];
160
- trackInventory: boolean;
161
202
  sku?: string;
162
203
  barcode?: string;
163
- stockAvailable: number;
164
- stockCommited: number;
165
- stockUnavailable: number;
204
+ inventoryItem: {
205
+ stockPolicy: "CONTINUE" | "DENY";
206
+ trackInventory: boolean;
207
+ };
166
208
  isPhysical: boolean;
167
209
  weightInGrams?: number;
168
210
  heightInCm?: number;
@@ -200,12 +242,12 @@ interface Product {
200
242
  billingType: ProductBillingType;
201
243
  billingInterval: ProductBillingInterval;
202
244
  billingIntervalCount: number;
203
- trackInventory: boolean;
204
245
  sku?: string;
205
246
  barcode?: string;
206
- stockAvailable: number;
207
- stockCommited: number;
208
- stockUnavailable: number;
247
+ inventoryItem: {
248
+ stockPolicy: "CONTINUE" | "DENY";
249
+ trackInventory: boolean;
250
+ };
209
251
  seoPageTitle?: string;
210
252
  seoDescription?: string;
211
253
  seoHandle?: string;
@@ -226,7 +268,7 @@ type ListProductsQuery = {
226
268
  createdAt?: DateQueryType;
227
269
  updatedAt?: DateQueryType;
228
270
  };
229
- type ListProductsSortBy = "createdAt" | "updatedAt" | "title" | "stockAvailable" | "stockCommited" | "priceInCents";
271
+ type ListProductsSortBy = "createdAt" | "updatedAt" | "title" | "priceInCents";
230
272
  type ListProductsParams = GetListParams<ListProductsSortBy, ListProductsQuery>;
231
273
  type RetrieveProductParams = {
232
274
  seoHandle: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstore/sdk",
3
- "version": "0.5.23",
3
+ "version": "0.5.24",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",