@shoppexio/storefront 1.0.85 → 1.0.87
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 +5 -0
- package/README.md +2 -0
- package/dist/index.cjs +9 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +9 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1701,7 +1701,14 @@ declare function validateCoupon(code: string, productOrOptions?: string | Coupon
|
|
|
1701
1701
|
* Note: Shoppex has shop-level feedback, not product-level reviews.
|
|
1702
1702
|
*/
|
|
1703
1703
|
|
|
1704
|
-
|
|
1704
|
+
interface ShopReviewsPageOptions {
|
|
1705
|
+
/**
|
|
1706
|
+
* One product's reviews, by the product's public id (the `id` the catalog
|
|
1707
|
+
* carries). The page's `summary` then counts that product's reviews only.
|
|
1708
|
+
*/
|
|
1709
|
+
product?: string | null;
|
|
1710
|
+
}
|
|
1711
|
+
declare function getShopReviewsPage(cursor?: string | null, options?: ShopReviewsPageOptions): Promise<SDKResponse<ShopReviewsPage>>;
|
|
1705
1712
|
declare function getShopReviews(): Promise<SDKResponse<Feedback[]>>;
|
|
1706
1713
|
|
|
1707
1714
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1701,7 +1701,14 @@ declare function validateCoupon(code: string, productOrOptions?: string | Coupon
|
|
|
1701
1701
|
* Note: Shoppex has shop-level feedback, not product-level reviews.
|
|
1702
1702
|
*/
|
|
1703
1703
|
|
|
1704
|
-
|
|
1704
|
+
interface ShopReviewsPageOptions {
|
|
1705
|
+
/**
|
|
1706
|
+
* One product's reviews, by the product's public id (the `id` the catalog
|
|
1707
|
+
* carries). The page's `summary` then counts that product's reviews only.
|
|
1708
|
+
*/
|
|
1709
|
+
product?: string | null;
|
|
1710
|
+
}
|
|
1711
|
+
declare function getShopReviewsPage(cursor?: string | null, options?: ShopReviewsPageOptions): Promise<SDKResponse<ShopReviewsPage>>;
|
|
1705
1712
|
declare function getShopReviews(): Promise<SDKResponse<Feedback[]>>;
|
|
1706
1713
|
|
|
1707
1714
|
/**
|
package/dist/index.js
CHANGED
|
@@ -5372,13 +5372,17 @@ function normalizeFeedback(raw, index) {
|
|
|
5372
5372
|
created_at
|
|
5373
5373
|
};
|
|
5374
5374
|
}
|
|
5375
|
-
async function getShopReviewsPage(cursor) {
|
|
5375
|
+
async function getShopReviewsPage(cursor, options = {}) {
|
|
5376
5376
|
const config = getConfig();
|
|
5377
5377
|
const query = new URLSearchParams();
|
|
5378
5378
|
query.set("limit", String(REVIEWS_PAGE_LIMIT));
|
|
5379
5379
|
if (typeof cursor === "string" && cursor.trim().length > 0) {
|
|
5380
5380
|
query.set("cursor", cursor);
|
|
5381
5381
|
}
|
|
5382
|
+
const product = typeof options.product === "string" ? options.product.trim() : "";
|
|
5383
|
+
if (product) {
|
|
5384
|
+
query.set("product", product);
|
|
5385
|
+
}
|
|
5382
5386
|
const querySuffix = `?${query.toString()}`;
|
|
5383
5387
|
const response = await get(
|
|
5384
5388
|
`${buildEndpoint("/v1/storefront/feedback/shop/:storeSlug", {
|
|
@@ -5386,7 +5390,7 @@ async function getShopReviewsPage(cursor) {
|
|
|
5386
5390
|
})}${querySuffix}`,
|
|
5387
5391
|
{
|
|
5388
5392
|
cache: {
|
|
5389
|
-
key: `reviews:${config.storeSlug}:${cursor ?? "start"}:${REVIEWS_PAGE_LIMIT}`,
|
|
5393
|
+
key: `reviews:${config.storeSlug}:${product || "all"}:${cursor ?? "start"}:${REVIEWS_PAGE_LIMIT}`,
|
|
5390
5394
|
ttl: REVIEWS_CACHE_TTL,
|
|
5391
5395
|
staleWhileRevalidate: true
|
|
5392
5396
|
}
|
|
@@ -5401,10 +5405,7 @@ async function getShopReviewsPage(cursor) {
|
|
|
5401
5405
|
}
|
|
5402
5406
|
};
|
|
5403
5407
|
}
|
|
5404
|
-
return
|
|
5405
|
-
success: false,
|
|
5406
|
-
message: response.message
|
|
5407
|
-
};
|
|
5408
|
+
return forwardFailure(response);
|
|
5408
5409
|
}
|
|
5409
5410
|
async function getShopReviews() {
|
|
5410
5411
|
const allFeedback = [];
|
|
@@ -5874,10 +5875,7 @@ async function getPages() {
|
|
|
5874
5875
|
data: response.data.pages
|
|
5875
5876
|
};
|
|
5876
5877
|
}
|
|
5877
|
-
return
|
|
5878
|
-
success: false,
|
|
5879
|
-
message: response.message
|
|
5880
|
-
};
|
|
5878
|
+
return forwardFailure(response);
|
|
5881
5879
|
}
|
|
5882
5880
|
async function getPage(slug) {
|
|
5883
5881
|
const config = getConfig();
|
|
@@ -5900,10 +5898,7 @@ async function getPage(slug) {
|
|
|
5900
5898
|
data: response.data.page
|
|
5901
5899
|
};
|
|
5902
5900
|
}
|
|
5903
|
-
return
|
|
5904
|
-
success: false,
|
|
5905
|
-
message: response.message
|
|
5906
|
-
};
|
|
5901
|
+
return forwardFailure(response);
|
|
5907
5902
|
}
|
|
5908
5903
|
|
|
5909
5904
|
// ../sdk/src/modules/navigation.ts
|