@betterstore/sdk 0.3.71 → 0.3.73

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,17 @@
1
1
  # @betterstore/sdk
2
2
 
3
+ ## 0.3.73
4
+
5
+ ### Patch Changes
6
+
7
+ - bug fixes
8
+
9
+ ## 0.3.72
10
+
11
+ ### Patch Changes
12
+
13
+ - bug fixes
14
+
3
15
  ## 0.3.71
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -66,10 +66,10 @@ type ListProductsQuery = {
66
66
  } | {
67
67
  collectionSeoHandle: string;
68
68
  };
69
- type SortBy = "createdAt" | "updatedAt";
69
+ type ListProductsSortBy = "createdAt" | "updatedAt" | "title";
70
70
  type SortOrder = "asc" | "desc";
71
71
  type ListProductsParams = {
72
- sortBy?: SortBy;
72
+ sortBy?: ListProductsSortBy;
73
73
  sortOrder?: SortOrder;
74
74
  query?: string;
75
75
  };
@@ -91,6 +91,13 @@ interface Collection {
91
91
  interface CollectionWithProducts extends Collection {
92
92
  products: ProductWithoutVariants[];
93
93
  }
94
+ type ListCollectionsQuery = undefined;
95
+ type ListCollectionsSortBy = "createdAt" | "updatedAt" | "title";
96
+ type ListCollectionsParams = {
97
+ sortBy?: ListCollectionsSortBy;
98
+ sortOrder?: SortOrder;
99
+ query?: string;
100
+ };
94
101
  type RetrieveCollectionParams = {
95
102
  seoHandle: string;
96
103
  } | {
@@ -137,14 +144,36 @@ interface CustomerSubscription {
137
144
  }
138
145
  type CustomerSubscriptionUpdateParams = Partial<Pick<CustomerSubscription, "cancelAtPeriodEnd">>;
139
146
 
140
- interface Discount$1 {
147
+ interface Discount {
141
148
  id: string;
142
- title: string;
143
- description?: string;
144
- images: string[];
145
- seoPageTitle?: string;
146
- seoDescription?: string;
147
- seoHandle?: string;
149
+ createdAt: Date;
150
+ updatedAt: Date;
151
+ type: "AMOUNT_OFF_PRODUCTS" | "BUY_X_GET_Y" | "AMOUNT_OFF_ORDER" | "FREE_SHIPPING";
152
+ method: "CODE" | "AUTOMATIC";
153
+ code?: string | null;
154
+ title?: string | null;
155
+ value: number;
156
+ valueType: "PERCENTAGE" | "FIXED_AMOUNT" | "FREE";
157
+ discountScope: "PRODUCTS" | "COLLECTIONS";
158
+ allowedProductIDs: string[];
159
+ allowedCollectionIDs: string[];
160
+ allowedCombinations: ("ORDER" | "PRODUCT" | "SHIPPING")[];
161
+ minimumRequirementsType: "NONE" | "MINIMUM_ORDER_AMOUNT" | "MINIMUM_PRODUCT_QUANTITY";
162
+ minimumRequirementsValue?: number | null;
163
+ requiredProductIDs: string[];
164
+ requiredCollectionIDs: string[];
165
+ minimumRequirementsScope: "PRODUCTS" | "COLLECTIONS";
166
+ maxUses?: number | null;
167
+ maxUsesPerCustomer?: number | null;
168
+ maxAllowedProductQuantity?: number | null;
169
+ uses: number;
170
+ subscriptionDiscountDurationType: "ONE_TIME" | "RECURRING" | "FOREVER";
171
+ subscriptionDiscountDurationValue: number;
172
+ stripeDiscountId?: string | null;
173
+ startsAt: Date;
174
+ expiresAt?: Date | null;
175
+ status: "ACTIVE" | "EXPIRED" | "SCHEDULED";
176
+ organizationId: string;
148
177
  }
149
178
  type RetrieveDiscountParams = {
150
179
  id: string;
@@ -212,37 +241,6 @@ type ShipmentData = {
212
241
  trackingId?: string;
213
242
  trackingUrl?: string;
214
243
  };
215
- type Discount = {
216
- id: string;
217
- createdAt: Date;
218
- updatedAt: Date;
219
- type: "AMOUNT_OFF_PRODUCTS" | "BUY_X_GET_Y" | "AMOUNT_OFF_ORDER" | "FREE_SHIPPING";
220
- method: "CODE" | "AUTOMATIC";
221
- code?: string | null;
222
- title?: string | null;
223
- value: number;
224
- valueType: "PERCENTAGE" | "FIXED_AMOUNT" | "FREE";
225
- discountScope: "PRODUCTS" | "COLLECTIONS";
226
- allowedProductIDs: string[];
227
- allowedCollectionIDs: string[];
228
- allowedCombinations: ("ORDER" | "PRODUCT" | "SHIPPING")[];
229
- minimumRequirementsType: "NONE" | "MINIMUM_ORDER_AMOUNT" | "MINIMUM_PRODUCT_QUANTITY";
230
- minimumRequirementsValue?: number | null;
231
- requiredProductIDs: string[];
232
- requiredCollectionIDs: string[];
233
- minimumRequirementsScope: "PRODUCTS" | "COLLECTIONS";
234
- maxUses?: number | null;
235
- maxUsesPerCustomer?: number | null;
236
- maxAllowedProductQuantity?: number | null;
237
- uses: number;
238
- subscriptionDiscountDurationType: "ONE_TIME" | "RECURRING" | "FOREVER";
239
- subscriptionDiscountDurationValue: number;
240
- stripeDiscountId?: string | null;
241
- startsAt: Date;
242
- expiresAt?: Date | null;
243
- status: "ACTIVE" | "EXPIRED" | "SCHEDULED";
244
- organizationId: string;
245
- };
246
244
  interface CheckoutSession {
247
245
  id: string;
248
246
  testmode: boolean;
@@ -367,7 +365,7 @@ declare class Client {
367
365
  declare class Collections {
368
366
  private apiClient;
369
367
  constructor(apiKey: string, proxy?: string);
370
- list(): Promise<Collection[]>;
368
+ list(params?: ListCollectionsParams): Promise<Collection[]>;
371
369
  retrieve(params: RetrieveCollectionParams): Promise<CollectionWithProducts | null>;
372
370
  }
373
371
 
@@ -399,8 +397,8 @@ declare class Customer {
399
397
  declare class Discounts {
400
398
  private apiClient;
401
399
  constructor(apiKey: string, proxy?: string);
402
- list(): Promise<Discount$1[]>;
403
- retrieve(params: RetrieveDiscountParams): Promise<Discount$1 | null>;
400
+ list(): Promise<Discount[]>;
401
+ retrieve(params: RetrieveDiscountParams): Promise<Discount | null>;
404
402
  }
405
403
 
406
404
  declare class Helpers {
@@ -435,4 +433,4 @@ declare function createStoreHelpers(config?: {
435
433
  proxy?: string;
436
434
  }): Helpers;
437
435
 
438
- export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Collection, type CollectionWithProducts, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerSubscription, type CustomerSubscriptionUpdateParams, type CustomerUpdateParams, type Discount$1 as Discount, type LineItem, type LineItemCreate, type ListProductsParams, type ListProductsQuery, type Product, type ProductBillingInterval, type ProductBillingType, type ProductOption, type ProductStatus, type ProductVariant, type ProductWithoutVariants, type RetrieveCollectionParams, type RetrieveDiscountParams, type RetrieveProductParams, type ShippingRate, type SortBy, type SortOrder, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
436
+ export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Collection, type CollectionWithProducts, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerSubscription, type CustomerSubscriptionUpdateParams, type CustomerUpdateParams, type Discount, type LineItem, type LineItemCreate, type ListCollectionsParams, type ListCollectionsQuery, type ListCollectionsSortBy, type ListProductsParams, type ListProductsQuery, type ListProductsSortBy, type Product, type ProductBillingInterval, type ProductBillingType, type ProductOption, type ProductStatus, type ProductVariant, type ProductWithoutVariants, type RetrieveCollectionParams, type RetrieveDiscountParams, type RetrieveProductParams, type ShippingRate, type SortOrder, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
package/dist/index.d.ts CHANGED
@@ -66,10 +66,10 @@ type ListProductsQuery = {
66
66
  } | {
67
67
  collectionSeoHandle: string;
68
68
  };
69
- type SortBy = "createdAt" | "updatedAt";
69
+ type ListProductsSortBy = "createdAt" | "updatedAt" | "title";
70
70
  type SortOrder = "asc" | "desc";
71
71
  type ListProductsParams = {
72
- sortBy?: SortBy;
72
+ sortBy?: ListProductsSortBy;
73
73
  sortOrder?: SortOrder;
74
74
  query?: string;
75
75
  };
@@ -91,6 +91,13 @@ interface Collection {
91
91
  interface CollectionWithProducts extends Collection {
92
92
  products: ProductWithoutVariants[];
93
93
  }
94
+ type ListCollectionsQuery = undefined;
95
+ type ListCollectionsSortBy = "createdAt" | "updatedAt" | "title";
96
+ type ListCollectionsParams = {
97
+ sortBy?: ListCollectionsSortBy;
98
+ sortOrder?: SortOrder;
99
+ query?: string;
100
+ };
94
101
  type RetrieveCollectionParams = {
95
102
  seoHandle: string;
96
103
  } | {
@@ -137,14 +144,36 @@ interface CustomerSubscription {
137
144
  }
138
145
  type CustomerSubscriptionUpdateParams = Partial<Pick<CustomerSubscription, "cancelAtPeriodEnd">>;
139
146
 
140
- interface Discount$1 {
147
+ interface Discount {
141
148
  id: string;
142
- title: string;
143
- description?: string;
144
- images: string[];
145
- seoPageTitle?: string;
146
- seoDescription?: string;
147
- seoHandle?: string;
149
+ createdAt: Date;
150
+ updatedAt: Date;
151
+ type: "AMOUNT_OFF_PRODUCTS" | "BUY_X_GET_Y" | "AMOUNT_OFF_ORDER" | "FREE_SHIPPING";
152
+ method: "CODE" | "AUTOMATIC";
153
+ code?: string | null;
154
+ title?: string | null;
155
+ value: number;
156
+ valueType: "PERCENTAGE" | "FIXED_AMOUNT" | "FREE";
157
+ discountScope: "PRODUCTS" | "COLLECTIONS";
158
+ allowedProductIDs: string[];
159
+ allowedCollectionIDs: string[];
160
+ allowedCombinations: ("ORDER" | "PRODUCT" | "SHIPPING")[];
161
+ minimumRequirementsType: "NONE" | "MINIMUM_ORDER_AMOUNT" | "MINIMUM_PRODUCT_QUANTITY";
162
+ minimumRequirementsValue?: number | null;
163
+ requiredProductIDs: string[];
164
+ requiredCollectionIDs: string[];
165
+ minimumRequirementsScope: "PRODUCTS" | "COLLECTIONS";
166
+ maxUses?: number | null;
167
+ maxUsesPerCustomer?: number | null;
168
+ maxAllowedProductQuantity?: number | null;
169
+ uses: number;
170
+ subscriptionDiscountDurationType: "ONE_TIME" | "RECURRING" | "FOREVER";
171
+ subscriptionDiscountDurationValue: number;
172
+ stripeDiscountId?: string | null;
173
+ startsAt: Date;
174
+ expiresAt?: Date | null;
175
+ status: "ACTIVE" | "EXPIRED" | "SCHEDULED";
176
+ organizationId: string;
148
177
  }
149
178
  type RetrieveDiscountParams = {
150
179
  id: string;
@@ -212,37 +241,6 @@ type ShipmentData = {
212
241
  trackingId?: string;
213
242
  trackingUrl?: string;
214
243
  };
215
- type Discount = {
216
- id: string;
217
- createdAt: Date;
218
- updatedAt: Date;
219
- type: "AMOUNT_OFF_PRODUCTS" | "BUY_X_GET_Y" | "AMOUNT_OFF_ORDER" | "FREE_SHIPPING";
220
- method: "CODE" | "AUTOMATIC";
221
- code?: string | null;
222
- title?: string | null;
223
- value: number;
224
- valueType: "PERCENTAGE" | "FIXED_AMOUNT" | "FREE";
225
- discountScope: "PRODUCTS" | "COLLECTIONS";
226
- allowedProductIDs: string[];
227
- allowedCollectionIDs: string[];
228
- allowedCombinations: ("ORDER" | "PRODUCT" | "SHIPPING")[];
229
- minimumRequirementsType: "NONE" | "MINIMUM_ORDER_AMOUNT" | "MINIMUM_PRODUCT_QUANTITY";
230
- minimumRequirementsValue?: number | null;
231
- requiredProductIDs: string[];
232
- requiredCollectionIDs: string[];
233
- minimumRequirementsScope: "PRODUCTS" | "COLLECTIONS";
234
- maxUses?: number | null;
235
- maxUsesPerCustomer?: number | null;
236
- maxAllowedProductQuantity?: number | null;
237
- uses: number;
238
- subscriptionDiscountDurationType: "ONE_TIME" | "RECURRING" | "FOREVER";
239
- subscriptionDiscountDurationValue: number;
240
- stripeDiscountId?: string | null;
241
- startsAt: Date;
242
- expiresAt?: Date | null;
243
- status: "ACTIVE" | "EXPIRED" | "SCHEDULED";
244
- organizationId: string;
245
- };
246
244
  interface CheckoutSession {
247
245
  id: string;
248
246
  testmode: boolean;
@@ -367,7 +365,7 @@ declare class Client {
367
365
  declare class Collections {
368
366
  private apiClient;
369
367
  constructor(apiKey: string, proxy?: string);
370
- list(): Promise<Collection[]>;
368
+ list(params?: ListCollectionsParams): Promise<Collection[]>;
371
369
  retrieve(params: RetrieveCollectionParams): Promise<CollectionWithProducts | null>;
372
370
  }
373
371
 
@@ -399,8 +397,8 @@ declare class Customer {
399
397
  declare class Discounts {
400
398
  private apiClient;
401
399
  constructor(apiKey: string, proxy?: string);
402
- list(): Promise<Discount$1[]>;
403
- retrieve(params: RetrieveDiscountParams): Promise<Discount$1 | null>;
400
+ list(): Promise<Discount[]>;
401
+ retrieve(params: RetrieveDiscountParams): Promise<Discount | null>;
404
402
  }
405
403
 
406
404
  declare class Helpers {
@@ -435,4 +433,4 @@ declare function createStoreHelpers(config?: {
435
433
  proxy?: string;
436
434
  }): Helpers;
437
435
 
438
- export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Collection, type CollectionWithProducts, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerSubscription, type CustomerSubscriptionUpdateParams, type CustomerUpdateParams, type Discount$1 as Discount, type LineItem, type LineItemCreate, type ListProductsParams, type ListProductsQuery, type Product, type ProductBillingInterval, type ProductBillingType, type ProductOption, type ProductStatus, type ProductVariant, type ProductWithoutVariants, type RetrieveCollectionParams, type RetrieveDiscountParams, type RetrieveProductParams, type ShippingRate, type SortBy, type SortOrder, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
436
+ export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Collection, type CollectionWithProducts, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerSubscription, type CustomerSubscriptionUpdateParams, type CustomerUpdateParams, type Discount, type LineItem, type LineItemCreate, type ListCollectionsParams, type ListCollectionsQuery, type ListCollectionsSortBy, type ListProductsParams, type ListProductsQuery, type ListProductsSortBy, type Product, type ProductBillingInterval, type ProductBillingType, type ProductOption, type ProductStatus, type ProductVariant, type ProductWithoutVariants, type RetrieveCollectionParams, type RetrieveDiscountParams, type RetrieveProductParams, type ShippingRate, type SortOrder, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
package/dist/index.js CHANGED
@@ -339,9 +339,15 @@ var Collections = class {
339
339
  constructor(apiKey, proxy) {
340
340
  this.apiClient = createApiClient(apiKey, proxy);
341
341
  }
342
- list() {
342
+ list(params) {
343
343
  return __async(this, null, function* () {
344
- const data = yield this.apiClient.get("/collections");
344
+ const queryParams = new URLSearchParams();
345
+ if (params) {
346
+ queryParams.set("params", JSON.stringify(params));
347
+ }
348
+ const data = yield this.apiClient.get(
349
+ `/collections?${queryParams.toString()}`
350
+ );
345
351
  return data;
346
352
  });
347
353
  }
package/dist/index.mjs CHANGED
@@ -302,9 +302,15 @@ var Collections = class {
302
302
  constructor(apiKey, proxy) {
303
303
  this.apiClient = createApiClient(apiKey, proxy);
304
304
  }
305
- list() {
305
+ list(params) {
306
306
  return __async(this, null, function* () {
307
- const data = yield this.apiClient.get("/collections");
307
+ const queryParams = new URLSearchParams();
308
+ if (params) {
309
+ queryParams.set("params", JSON.stringify(params));
310
+ }
311
+ const data = yield this.apiClient.get(
312
+ `/collections?${queryParams.toString()}`
313
+ );
308
314
  return data;
309
315
  });
310
316
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstore/sdk",
3
- "version": "0.3.71",
3
+ "version": "0.3.73",
4
4
  "description": "E-commerce for Developers",
5
5
  "private": false,
6
6
  "publishConfig": {