@betterstore/sdk 0.3.87 → 0.3.90
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 +18 -0
- package/dist/index.d.mts +21 -17
- package/dist/index.d.ts +21 -17
- package/dist/index.js +8 -2
- package/dist/index.mjs +8 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -162,10 +162,9 @@ type ListProductsQuery = {
|
|
|
162
162
|
seoHandle: string;
|
|
163
163
|
};
|
|
164
164
|
type ListProductsSortBy = "createdAt" | "updatedAt" | "title" | "stockAvailable";
|
|
165
|
-
type SortOrder = "asc" | "desc";
|
|
166
165
|
type ListProductsParams = {
|
|
167
166
|
sortBy?: ListProductsSortBy;
|
|
168
|
-
sortOrder?:
|
|
167
|
+
sortOrder?: "asc" | "desc";
|
|
169
168
|
query?: ListProductsQuery;
|
|
170
169
|
};
|
|
171
170
|
type RetrieveProductParams = {
|
|
@@ -190,8 +189,8 @@ type ListCollectionsQuery = undefined;
|
|
|
190
189
|
type ListCollectionsSortBy = "createdAt" | "updatedAt" | "title";
|
|
191
190
|
type ListCollectionsParams = {
|
|
192
191
|
sortBy?: ListCollectionsSortBy;
|
|
193
|
-
sortOrder?:
|
|
194
|
-
query?:
|
|
192
|
+
sortOrder?: "asc" | "desc";
|
|
193
|
+
query?: ListCollectionsQuery;
|
|
195
194
|
};
|
|
196
195
|
type RetrieveCollectionParams = {
|
|
197
196
|
seoHandle: string;
|
|
@@ -212,22 +211,16 @@ type Address = {
|
|
|
212
211
|
phone: string;
|
|
213
212
|
};
|
|
214
213
|
interface CustomerCreateParams {
|
|
215
|
-
firstName
|
|
216
|
-
lastName
|
|
214
|
+
firstName?: string;
|
|
215
|
+
lastName?: string;
|
|
217
216
|
email: string;
|
|
218
217
|
phone?: string;
|
|
219
218
|
address?: Address;
|
|
220
219
|
isSubscribedEmail?: boolean;
|
|
221
220
|
isSubscribedSMS?: boolean;
|
|
222
221
|
}
|
|
223
|
-
interface CustomerUpdateParams {
|
|
224
|
-
firstName?: string;
|
|
225
|
-
lastName?: string;
|
|
222
|
+
interface CustomerUpdateParams extends Omit<CustomerCreateParams, "email"> {
|
|
226
223
|
email?: string;
|
|
227
|
-
phone?: string;
|
|
228
|
-
address?: Address;
|
|
229
|
-
isSubscribedEmail?: boolean;
|
|
230
|
-
isSubscribedSMS?: boolean;
|
|
231
224
|
}
|
|
232
225
|
interface Customer$1 extends CustomerCreateParams {
|
|
233
226
|
id: string;
|
|
@@ -270,6 +263,18 @@ interface Discount {
|
|
|
270
263
|
status: "ACTIVE" | "EXPIRED" | "SCHEDULED";
|
|
271
264
|
organizationId: string;
|
|
272
265
|
}
|
|
266
|
+
type ListDiscountsQuery = {
|
|
267
|
+
type?: Discount["type"];
|
|
268
|
+
valueType?: Discount["valueType"];
|
|
269
|
+
method?: Discount["method"];
|
|
270
|
+
status?: Discount["status"];
|
|
271
|
+
};
|
|
272
|
+
type ListDiscountsSortBy = "createdAt" | "updatedAt";
|
|
273
|
+
type ListDiscountsParams = {
|
|
274
|
+
sortBy?: ListDiscountsSortBy;
|
|
275
|
+
sortOrder?: "asc" | "desc";
|
|
276
|
+
query?: ListDiscountsQuery;
|
|
277
|
+
};
|
|
273
278
|
type RetrieveDiscountParams = {
|
|
274
279
|
id: string;
|
|
275
280
|
} | {
|
|
@@ -300,8 +305,7 @@ interface CustomerSession {
|
|
|
300
305
|
interface OTPLoginParams {
|
|
301
306
|
email: string;
|
|
302
307
|
}
|
|
303
|
-
interface OTPSignupParams extends
|
|
304
|
-
email: string;
|
|
308
|
+
interface OTPSignupParams extends CustomerCreateParams {
|
|
305
309
|
}
|
|
306
310
|
interface OTPVerifyParams {
|
|
307
311
|
email: string;
|
|
@@ -472,7 +476,7 @@ declare class Customer {
|
|
|
472
476
|
declare class Discounts {
|
|
473
477
|
private apiClient;
|
|
474
478
|
constructor(apiKey: string, proxy?: string);
|
|
475
|
-
list(): Promise<Discount[]>;
|
|
479
|
+
list(params?: ListDiscountsParams): Promise<Discount[]>;
|
|
476
480
|
retrieve(params: RetrieveDiscountParams): Promise<Discount | null>;
|
|
477
481
|
}
|
|
478
482
|
|
|
@@ -509,4 +513,4 @@ declare function createStoreHelpers(config?: {
|
|
|
509
513
|
proxy?: string;
|
|
510
514
|
}): Helpers;
|
|
511
515
|
|
|
512
|
-
export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Collection, type CollectionWithProducts, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerSession, 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 OTPLoginParams, type OTPLoginResponse, type OTPSignupParams, type OTPSignupResponse, type OTPVerifyParams, type OTPVerifyResponse, type Product, type ProductBillingInterval, type ProductBillingType, type ProductOption, type ProductStatus, type ProductVariant, type ProductWithoutVariants, type RetrieveCollectionParams, type RetrieveDiscountParams, type RetrieveProductParams, type ShippingRate, type
|
|
516
|
+
export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Collection, type CollectionWithProducts, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerSession, type CustomerSubscription, type CustomerSubscriptionUpdateParams, type CustomerUpdateParams, type Discount, type LineItem, type LineItemCreate, type ListCollectionsParams, type ListCollectionsQuery, type ListCollectionsSortBy, type ListDiscountsParams, type ListDiscountsQuery, type ListDiscountsSortBy, type ListProductsParams, type ListProductsQuery, type ListProductsSortBy, type OTPLoginParams, type OTPLoginResponse, type OTPSignupParams, type OTPSignupResponse, type OTPVerifyParams, type OTPVerifyResponse, type Product, type ProductBillingInterval, type ProductBillingType, type ProductOption, type ProductStatus, type ProductVariant, type ProductWithoutVariants, type RetrieveCollectionParams, type RetrieveDiscountParams, type RetrieveProductParams, type ShippingRate, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -162,10 +162,9 @@ type ListProductsQuery = {
|
|
|
162
162
|
seoHandle: string;
|
|
163
163
|
};
|
|
164
164
|
type ListProductsSortBy = "createdAt" | "updatedAt" | "title" | "stockAvailable";
|
|
165
|
-
type SortOrder = "asc" | "desc";
|
|
166
165
|
type ListProductsParams = {
|
|
167
166
|
sortBy?: ListProductsSortBy;
|
|
168
|
-
sortOrder?:
|
|
167
|
+
sortOrder?: "asc" | "desc";
|
|
169
168
|
query?: ListProductsQuery;
|
|
170
169
|
};
|
|
171
170
|
type RetrieveProductParams = {
|
|
@@ -190,8 +189,8 @@ type ListCollectionsQuery = undefined;
|
|
|
190
189
|
type ListCollectionsSortBy = "createdAt" | "updatedAt" | "title";
|
|
191
190
|
type ListCollectionsParams = {
|
|
192
191
|
sortBy?: ListCollectionsSortBy;
|
|
193
|
-
sortOrder?:
|
|
194
|
-
query?:
|
|
192
|
+
sortOrder?: "asc" | "desc";
|
|
193
|
+
query?: ListCollectionsQuery;
|
|
195
194
|
};
|
|
196
195
|
type RetrieveCollectionParams = {
|
|
197
196
|
seoHandle: string;
|
|
@@ -212,22 +211,16 @@ type Address = {
|
|
|
212
211
|
phone: string;
|
|
213
212
|
};
|
|
214
213
|
interface CustomerCreateParams {
|
|
215
|
-
firstName
|
|
216
|
-
lastName
|
|
214
|
+
firstName?: string;
|
|
215
|
+
lastName?: string;
|
|
217
216
|
email: string;
|
|
218
217
|
phone?: string;
|
|
219
218
|
address?: Address;
|
|
220
219
|
isSubscribedEmail?: boolean;
|
|
221
220
|
isSubscribedSMS?: boolean;
|
|
222
221
|
}
|
|
223
|
-
interface CustomerUpdateParams {
|
|
224
|
-
firstName?: string;
|
|
225
|
-
lastName?: string;
|
|
222
|
+
interface CustomerUpdateParams extends Omit<CustomerCreateParams, "email"> {
|
|
226
223
|
email?: string;
|
|
227
|
-
phone?: string;
|
|
228
|
-
address?: Address;
|
|
229
|
-
isSubscribedEmail?: boolean;
|
|
230
|
-
isSubscribedSMS?: boolean;
|
|
231
224
|
}
|
|
232
225
|
interface Customer$1 extends CustomerCreateParams {
|
|
233
226
|
id: string;
|
|
@@ -270,6 +263,18 @@ interface Discount {
|
|
|
270
263
|
status: "ACTIVE" | "EXPIRED" | "SCHEDULED";
|
|
271
264
|
organizationId: string;
|
|
272
265
|
}
|
|
266
|
+
type ListDiscountsQuery = {
|
|
267
|
+
type?: Discount["type"];
|
|
268
|
+
valueType?: Discount["valueType"];
|
|
269
|
+
method?: Discount["method"];
|
|
270
|
+
status?: Discount["status"];
|
|
271
|
+
};
|
|
272
|
+
type ListDiscountsSortBy = "createdAt" | "updatedAt";
|
|
273
|
+
type ListDiscountsParams = {
|
|
274
|
+
sortBy?: ListDiscountsSortBy;
|
|
275
|
+
sortOrder?: "asc" | "desc";
|
|
276
|
+
query?: ListDiscountsQuery;
|
|
277
|
+
};
|
|
273
278
|
type RetrieveDiscountParams = {
|
|
274
279
|
id: string;
|
|
275
280
|
} | {
|
|
@@ -300,8 +305,7 @@ interface CustomerSession {
|
|
|
300
305
|
interface OTPLoginParams {
|
|
301
306
|
email: string;
|
|
302
307
|
}
|
|
303
|
-
interface OTPSignupParams extends
|
|
304
|
-
email: string;
|
|
308
|
+
interface OTPSignupParams extends CustomerCreateParams {
|
|
305
309
|
}
|
|
306
310
|
interface OTPVerifyParams {
|
|
307
311
|
email: string;
|
|
@@ -472,7 +476,7 @@ declare class Customer {
|
|
|
472
476
|
declare class Discounts {
|
|
473
477
|
private apiClient;
|
|
474
478
|
constructor(apiKey: string, proxy?: string);
|
|
475
|
-
list(): Promise<Discount[]>;
|
|
479
|
+
list(params?: ListDiscountsParams): Promise<Discount[]>;
|
|
476
480
|
retrieve(params: RetrieveDiscountParams): Promise<Discount | null>;
|
|
477
481
|
}
|
|
478
482
|
|
|
@@ -509,4 +513,4 @@ declare function createStoreHelpers(config?: {
|
|
|
509
513
|
proxy?: string;
|
|
510
514
|
}): Helpers;
|
|
511
515
|
|
|
512
|
-
export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Collection, type CollectionWithProducts, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerSession, 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 OTPLoginParams, type OTPLoginResponse, type OTPSignupParams, type OTPSignupResponse, type OTPVerifyParams, type OTPVerifyResponse, type Product, type ProductBillingInterval, type ProductBillingType, type ProductOption, type ProductStatus, type ProductVariant, type ProductWithoutVariants, type RetrieveCollectionParams, type RetrieveDiscountParams, type RetrieveProductParams, type ShippingRate, type
|
|
516
|
+
export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Collection, type CollectionWithProducts, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerSession, type CustomerSubscription, type CustomerSubscriptionUpdateParams, type CustomerUpdateParams, type Discount, type LineItem, type LineItemCreate, type ListCollectionsParams, type ListCollectionsQuery, type ListCollectionsSortBy, type ListDiscountsParams, type ListDiscountsQuery, type ListDiscountsSortBy, type ListProductsParams, type ListProductsQuery, type ListProductsSortBy, type OTPLoginParams, type OTPLoginResponse, type OTPSignupParams, type OTPSignupResponse, type OTPVerifyParams, type OTPVerifyResponse, type Product, type ProductBillingInterval, type ProductBillingType, type ProductOption, type ProductStatus, type ProductVariant, type ProductWithoutVariants, type RetrieveCollectionParams, type RetrieveDiscountParams, type RetrieveProductParams, type ShippingRate, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
|
package/dist/index.js
CHANGED
|
@@ -500,9 +500,15 @@ var Discounts = class {
|
|
|
500
500
|
constructor(apiKey, proxy) {
|
|
501
501
|
this.apiClient = createApiClient(apiKey, proxy);
|
|
502
502
|
}
|
|
503
|
-
list() {
|
|
503
|
+
list(params) {
|
|
504
504
|
return __async(this, null, function* () {
|
|
505
|
-
const
|
|
505
|
+
const queryParams = new URLSearchParams();
|
|
506
|
+
if (params) {
|
|
507
|
+
queryParams.set("params", JSON.stringify(params));
|
|
508
|
+
}
|
|
509
|
+
const data = yield this.apiClient.get(
|
|
510
|
+
`/discounts?${queryParams.toString()}`
|
|
511
|
+
);
|
|
506
512
|
return data;
|
|
507
513
|
});
|
|
508
514
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -463,9 +463,15 @@ var Discounts = class {
|
|
|
463
463
|
constructor(apiKey, proxy) {
|
|
464
464
|
this.apiClient = createApiClient(apiKey, proxy);
|
|
465
465
|
}
|
|
466
|
-
list() {
|
|
466
|
+
list(params) {
|
|
467
467
|
return __async(this, null, function* () {
|
|
468
|
-
const
|
|
468
|
+
const queryParams = new URLSearchParams();
|
|
469
|
+
if (params) {
|
|
470
|
+
queryParams.set("params", JSON.stringify(params));
|
|
471
|
+
}
|
|
472
|
+
const data = yield this.apiClient.get(
|
|
473
|
+
`/discounts?${queryParams.toString()}`
|
|
474
|
+
);
|
|
469
475
|
return data;
|
|
470
476
|
});
|
|
471
477
|
}
|