@betterstore/sdk 0.3.69 → 0.3.70
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 +6 -0
- package/dist/index.d.mts +16 -3
- package/dist/index.d.ts +16 -3
- package/dist/index.js +21 -3
- package/dist/index.mjs +21 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -113,6 +113,18 @@ interface Collection {
|
|
|
113
113
|
interface CollectionWithProducts extends Collection {
|
|
114
114
|
products: ProductWithoutVariants[];
|
|
115
115
|
}
|
|
116
|
+
type ListProductsQuery = {
|
|
117
|
+
collectionId: string;
|
|
118
|
+
} | {
|
|
119
|
+
collectionSeoHandle: string;
|
|
120
|
+
};
|
|
121
|
+
type SortBy = "createdAt" | "updatedAt" | "bestSelling";
|
|
122
|
+
type SortOrder = "asc" | "desc";
|
|
123
|
+
type ListProductsParams = {
|
|
124
|
+
sortBy?: SortBy;
|
|
125
|
+
sortOrder?: SortOrder;
|
|
126
|
+
query?: string;
|
|
127
|
+
};
|
|
116
128
|
|
|
117
129
|
type ShippingRate = ZasilkovnaRate;
|
|
118
130
|
interface BaseRate {
|
|
@@ -362,11 +374,12 @@ declare class Helpers {
|
|
|
362
374
|
declare class Products {
|
|
363
375
|
private apiClient;
|
|
364
376
|
constructor(apiKey: string, proxy?: string);
|
|
365
|
-
list(): Promise<ProductWithoutVariants[]>;
|
|
377
|
+
list(params?: ListProductsParams): Promise<ProductWithoutVariants[]>;
|
|
366
378
|
retrieve(productId: string): Promise<Product | null>;
|
|
379
|
+
retrieveBySeoHandle(seoHandle: string): Promise<Product | null>;
|
|
367
380
|
listCollections(): Promise<Collection[]>;
|
|
368
381
|
retrieveCollectionBySeoHandle(collectionSeoHandle: string): Promise<CollectionWithProducts>;
|
|
369
|
-
|
|
382
|
+
retrieveCollection(collectionId: string): Promise<CollectionWithProducts>;
|
|
370
383
|
}
|
|
371
384
|
|
|
372
385
|
declare function createBetterStore(config: {
|
|
@@ -384,4 +397,4 @@ declare function createStoreHelpers(config?: {
|
|
|
384
397
|
proxy?: string;
|
|
385
398
|
}): Helpers;
|
|
386
399
|
|
|
387
|
-
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 LineItem, type LineItemCreate, type Product, type ProductBillingInterval, type ProductBillingType, type ProductOption, type ProductStatus, type ProductVariant, type ProductWithoutVariants, type ShippingRate, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
|
|
400
|
+
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 LineItem, type LineItemCreate, type ListProductsParams, type ListProductsQuery, type Product, type ProductBillingInterval, type ProductBillingType, type ProductOption, type ProductStatus, type ProductVariant, type ProductWithoutVariants, type ShippingRate, type SortBy, type SortOrder, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -113,6 +113,18 @@ interface Collection {
|
|
|
113
113
|
interface CollectionWithProducts extends Collection {
|
|
114
114
|
products: ProductWithoutVariants[];
|
|
115
115
|
}
|
|
116
|
+
type ListProductsQuery = {
|
|
117
|
+
collectionId: string;
|
|
118
|
+
} | {
|
|
119
|
+
collectionSeoHandle: string;
|
|
120
|
+
};
|
|
121
|
+
type SortBy = "createdAt" | "updatedAt" | "bestSelling";
|
|
122
|
+
type SortOrder = "asc" | "desc";
|
|
123
|
+
type ListProductsParams = {
|
|
124
|
+
sortBy?: SortBy;
|
|
125
|
+
sortOrder?: SortOrder;
|
|
126
|
+
query?: string;
|
|
127
|
+
};
|
|
116
128
|
|
|
117
129
|
type ShippingRate = ZasilkovnaRate;
|
|
118
130
|
interface BaseRate {
|
|
@@ -362,11 +374,12 @@ declare class Helpers {
|
|
|
362
374
|
declare class Products {
|
|
363
375
|
private apiClient;
|
|
364
376
|
constructor(apiKey: string, proxy?: string);
|
|
365
|
-
list(): Promise<ProductWithoutVariants[]>;
|
|
377
|
+
list(params?: ListProductsParams): Promise<ProductWithoutVariants[]>;
|
|
366
378
|
retrieve(productId: string): Promise<Product | null>;
|
|
379
|
+
retrieveBySeoHandle(seoHandle: string): Promise<Product | null>;
|
|
367
380
|
listCollections(): Promise<Collection[]>;
|
|
368
381
|
retrieveCollectionBySeoHandle(collectionSeoHandle: string): Promise<CollectionWithProducts>;
|
|
369
|
-
|
|
382
|
+
retrieveCollection(collectionId: string): Promise<CollectionWithProducts>;
|
|
370
383
|
}
|
|
371
384
|
|
|
372
385
|
declare function createBetterStore(config: {
|
|
@@ -384,4 +397,4 @@ declare function createStoreHelpers(config?: {
|
|
|
384
397
|
proxy?: string;
|
|
385
398
|
}): Helpers;
|
|
386
399
|
|
|
387
|
-
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 LineItem, type LineItemCreate, type Product, type ProductBillingInterval, type ProductBillingType, type ProductOption, type ProductStatus, type ProductVariant, type ProductWithoutVariants, type ShippingRate, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
|
|
400
|
+
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 LineItem, type LineItemCreate, type ListProductsParams, type ListProductsQuery, type Product, type ProductBillingInterval, type ProductBillingType, type ProductOption, type ProductStatus, type ProductVariant, type ProductWithoutVariants, type ShippingRate, type SortBy, type SortOrder, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
|
package/dist/index.js
CHANGED
|
@@ -509,9 +509,15 @@ var Products = class {
|
|
|
509
509
|
constructor(apiKey, proxy) {
|
|
510
510
|
this.apiClient = createApiClient(apiKey, proxy);
|
|
511
511
|
}
|
|
512
|
-
list() {
|
|
512
|
+
list(params) {
|
|
513
513
|
return __async(this, null, function* () {
|
|
514
|
-
const
|
|
514
|
+
const queryParams = new URLSearchParams();
|
|
515
|
+
if (params) {
|
|
516
|
+
queryParams.set("params", JSON.stringify(params));
|
|
517
|
+
}
|
|
518
|
+
const data = yield this.apiClient.get(
|
|
519
|
+
`/products?${queryParams.toString()}`
|
|
520
|
+
);
|
|
515
521
|
return data;
|
|
516
522
|
});
|
|
517
523
|
}
|
|
@@ -525,6 +531,18 @@ var Products = class {
|
|
|
525
531
|
return data;
|
|
526
532
|
});
|
|
527
533
|
}
|
|
534
|
+
retrieveBySeoHandle(seoHandle) {
|
|
535
|
+
return __async(this, null, function* () {
|
|
536
|
+
const data = yield this.apiClient.get(
|
|
537
|
+
`/products/seoHandle/${seoHandle}`
|
|
538
|
+
);
|
|
539
|
+
if (!data) {
|
|
540
|
+
console.error(`Product with seoHandle ${seoHandle} not found`);
|
|
541
|
+
return null;
|
|
542
|
+
}
|
|
543
|
+
return data;
|
|
544
|
+
});
|
|
545
|
+
}
|
|
528
546
|
listCollections() {
|
|
529
547
|
return __async(this, null, function* () {
|
|
530
548
|
const data = yield this.apiClient.get("/collections");
|
|
@@ -539,7 +557,7 @@ var Products = class {
|
|
|
539
557
|
return data;
|
|
540
558
|
});
|
|
541
559
|
}
|
|
542
|
-
|
|
560
|
+
retrieveCollection(collectionId) {
|
|
543
561
|
return __async(this, null, function* () {
|
|
544
562
|
const data = yield this.apiClient.get(
|
|
545
563
|
`/collections/id/${collectionId}`
|
package/dist/index.mjs
CHANGED
|
@@ -472,9 +472,15 @@ var Products = class {
|
|
|
472
472
|
constructor(apiKey, proxy) {
|
|
473
473
|
this.apiClient = createApiClient(apiKey, proxy);
|
|
474
474
|
}
|
|
475
|
-
list() {
|
|
475
|
+
list(params) {
|
|
476
476
|
return __async(this, null, function* () {
|
|
477
|
-
const
|
|
477
|
+
const queryParams = new URLSearchParams();
|
|
478
|
+
if (params) {
|
|
479
|
+
queryParams.set("params", JSON.stringify(params));
|
|
480
|
+
}
|
|
481
|
+
const data = yield this.apiClient.get(
|
|
482
|
+
`/products?${queryParams.toString()}`
|
|
483
|
+
);
|
|
478
484
|
return data;
|
|
479
485
|
});
|
|
480
486
|
}
|
|
@@ -488,6 +494,18 @@ var Products = class {
|
|
|
488
494
|
return data;
|
|
489
495
|
});
|
|
490
496
|
}
|
|
497
|
+
retrieveBySeoHandle(seoHandle) {
|
|
498
|
+
return __async(this, null, function* () {
|
|
499
|
+
const data = yield this.apiClient.get(
|
|
500
|
+
`/products/seoHandle/${seoHandle}`
|
|
501
|
+
);
|
|
502
|
+
if (!data) {
|
|
503
|
+
console.error(`Product with seoHandle ${seoHandle} not found`);
|
|
504
|
+
return null;
|
|
505
|
+
}
|
|
506
|
+
return data;
|
|
507
|
+
});
|
|
508
|
+
}
|
|
491
509
|
listCollections() {
|
|
492
510
|
return __async(this, null, function* () {
|
|
493
511
|
const data = yield this.apiClient.get("/collections");
|
|
@@ -502,7 +520,7 @@ var Products = class {
|
|
|
502
520
|
return data;
|
|
503
521
|
});
|
|
504
522
|
}
|
|
505
|
-
|
|
523
|
+
retrieveCollection(collectionId) {
|
|
506
524
|
return __async(this, null, function* () {
|
|
507
525
|
const data = yield this.apiClient.get(
|
|
508
526
|
`/collections/id/${collectionId}`
|