@ecomiq/core 1.1.0 → 1.2.0

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.
Files changed (50) hide show
  1. package/README.md +16 -2
  2. package/dist/client.cjs +181 -24
  3. package/dist/client.d.cts +8 -2
  4. package/dist/client.d.ts +8 -2
  5. package/dist/client.js +184 -27
  6. package/dist/index.cjs +16 -10
  7. package/dist/index.d.cts +5 -4
  8. package/dist/index.d.ts +5 -4
  9. package/dist/index.js +10 -9
  10. package/dist/libs/{graphql-_6Y8lR_Q.js → graphql-8PZkrq66.js} +12 -8
  11. package/dist/libs/{graphql-wJH7HaQU.cjs → graphql-BICZrYlZ.cjs} +12 -7
  12. package/dist/libs/graphql-batch-AFRui-4Y.js +125 -0
  13. package/dist/libs/graphql-batch-B0xSD6G2.cjs +125 -0
  14. package/dist/libs/graphql-batch.d.cts +2 -0
  15. package/dist/libs/graphql-batch.d.ts +2 -0
  16. package/dist/models/collections.cjs +5 -0
  17. package/dist/models/collections.d.cts +109 -1
  18. package/dist/models/collections.d.ts +109 -1
  19. package/dist/models/collections.js +4 -1
  20. package/dist/models/customer-order.cjs +1 -1
  21. package/dist/models/customer-order.js +1 -1
  22. package/dist/models/{order-draft-C-2WRbjl.cjs → order-draft-DWKoM7Lu.cjs} +1 -1
  23. package/dist/models/{order-draft-CSIWRIV0.js → order-draft-DhEKDqI8.js} +1 -1
  24. package/dist/models/{personalization-BPFmkdJ0.js → personalization-CdwIzzSn.js} +1 -22
  25. package/dist/models/{personalization-CQosKg8O.cjs → personalization-Uh_MWts-.cjs} +0 -25
  26. package/dist/models/personalization-lines-BurVHB4o.cjs +26 -0
  27. package/dist/models/personalization-lines-DigNu6OK.js +23 -0
  28. package/dist/models/personalization-lines.d.cts +15 -0
  29. package/dist/models/personalization-lines.d.ts +15 -0
  30. package/dist/models/personalization.d.cts +1 -15
  31. package/dist/models/personalization.d.ts +1 -15
  32. package/dist/models/products.cjs +1 -1
  33. package/dist/models/products.js +1 -1
  34. package/dist/models/storefront-cart.cjs +1 -1
  35. package/dist/models/storefront-cart.js +1 -1
  36. package/dist/models/storefront-reviews.cjs +9 -2
  37. package/dist/models/storefront-reviews.d.cts +99 -0
  38. package/dist/models/storefront-reviews.d.ts +99 -0
  39. package/dist/models/storefront-reviews.js +7 -3
  40. package/dist/services/layout.service-C6zG6zY7.cjs +65 -0
  41. package/dist/services/layout.service-DufBhrOR.js +65 -0
  42. package/dist/services/layout.service.d.cts +1 -0
  43. package/dist/services/layout.service.d.ts +1 -0
  44. package/dist/services/{order-draft.service-Dlu6eEkV.cjs → order-draft.service-CdJbIUT6.cjs} +1 -1
  45. package/dist/services/{order-draft.service-B0VcmWhn.js → order-draft.service-DHhae1Ct.js} +1 -1
  46. package/dist/services/{review.service-CO2icjpu.cjs → review.service-BgRGfq4t.cjs} +0 -8
  47. package/dist/services/{review.service-De1YkhFp.js → review.service-DMgxbO94.js} +2 -9
  48. package/package.json +1 -1
  49. package/dist/services/layout.service-BkvLzl1g.cjs +0 -50
  50. package/dist/services/layout.service-DmbeMOkK.js +0 -50
package/README.md CHANGED
@@ -56,8 +56,22 @@ const data = await api.graphql(
56
56
  El cliente hace `POST /graphql`, envía `x-Store-Domain` y lanza
57
57
  `GraphQLResponseError` cuando la respuesta contiene `errors`. El schema disponible
58
58
  ofrece `store`, `products`, `product`, `relatedProducts`, `collections`,
59
- `collection`, `sellers`, `seller` y `productReviews`. Las demás lecturas siguen
60
- disponibles por REST.
59
+ `collection`, `sellers`, `seller`, `productReviews`, `paymentMethods`,
60
+ `storeReviews` y `articles`. Las demás lecturas siguen disponibles por REST.
61
+
62
+ ### Lecturas agrupadas
63
+
64
+ `getProducts`, `getSellers`, `getPaymentMethods`, `listStoreReviews`,
65
+ `listArticles` y los métodos de colecciones de abajo van por GraphQL. Las que se
66
+ piden a la vez viajan en una sola consulta con alias. Un error en un campo solo
67
+ rechaza esa lectura.
68
+
69
+ - `getCollectionCovers({ limit, candidates })`: colecciones con
70
+ `imageCandidates`, las fotos de sus primeros productos para usar de portada.
71
+ - `getCollectionsWithProducts({ limit, products, sort })`: colecciones con sus
72
+ primeros productos, en el orden de cada colección o en `sort`.
73
+ - `getProductsWithReviews(params, { limit, sortBy, sortDirection })`: los mismos
74
+ productos que `getProducts(params)`, cada uno con sus primeras reseñas.
61
75
 
62
76
  Subpaths (opcional):
63
77
 
package/dist/client.cjs CHANGED
@@ -1,21 +1,28 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_api = require("./api.cjs");
3
- const require_graphql = require("./libs/graphql-wJH7HaQU.cjs");
4
- const require_catalog_link_key = require("./libs/catalog-link-key-CZTHJBGD.cjs");
3
+ const require_graphql = require("./libs/graphql-BICZrYlZ.cjs");
4
+ const require_graphql_batch = require("./libs/graphql-batch-B0xSD6G2.cjs");
5
+ const require_graphql_selection = require("./libs/graphql-selection-Cj51WkJn.cjs");
6
+ const require_payment_methods = require("./models/payment-methods-CmK08zBM.cjs");
7
+ const require_models_collections = require("./models/collections.cjs");
5
8
  const require_catalog_links = require("./models/catalog-links-c4LADGf_.cjs");
9
+ const require_catalog_link_key = require("./libs/catalog-link-key-CZTHJBGD.cjs");
6
10
  const require_catalog_link_service = require("./services/catalog-link.service-DiB-OVjn.cjs");
7
- const require_layout_service = require("./services/layout.service-BkvLzl1g.cjs");
11
+ const require_layout_service = require("./services/layout.service-C6zG6zY7.cjs");
12
+ const require_articles = require("./models/articles-xHCXLKDK.cjs");
8
13
  const require_models_products = require("./models/products.cjs");
9
14
  const require_bounded_read_cache = require("./libs/bounded-read-cache-D4644LJo.cjs");
15
+ const require_models_storefront_reviews = require("./models/storefront-reviews.cjs");
16
+ const require_models_sellers = require("./models/sellers.cjs");
10
17
  const require_customer_registration_service = require("./services/customer-registration.service-C3BNyCHP.cjs");
11
18
  const require_customer_session_service = require("./services/customer-session.service-Bd8pLC2v.cjs");
12
19
  const require_order_status_service = require("./services/order-status.service-Cn7dsaJo.cjs");
13
- const require_order_draft_service = require("./services/order-draft.service-Dlu6eEkV.cjs");
20
+ const require_order_draft_service = require("./services/order-draft.service-CdJbIUT6.cjs");
14
21
  const require_complaint_book_service = require("./services/complaint-book.service-C7TxltQe.cjs");
15
22
  const require_models_settings = require("./models/settings.cjs");
16
23
  const require_product_service = require("./services/product.service-B7OFZWB1.cjs");
17
24
  const require_search_service = require("./services/search.service-Bx1zbTHJ.cjs");
18
- const require_review_service = require("./services/review.service-CO2icjpu.cjs");
25
+ const require_review_service = require("./services/review.service-BgRGfq4t.cjs");
19
26
  const require_cart_service = require("./services/cart.service-B0D8s6jI.cjs");
20
27
  const require_collection_service = require("./services/collection.service-DHGN3rhs.cjs");
21
28
  const require_page_service = require("./services/page.service-DmCSeMiR.cjs");
@@ -28,9 +35,36 @@ const require_customer_address_service = require("./services/customer-address.se
28
35
  const require_customer_service = require("./services/customer.service-BM0NrOxP.cjs");
29
36
  const require_customer_order_service = require("./services/customer-order.service-DLGgT0xa.cjs");
30
37
  const require_seller_service = require("./services/seller.service-D11WHhbC.cjs");
31
- const require_payment_method_service = require("./services/payment-method.service-CEt_nB4R.cjs");
38
+ let zod = require("zod");
32
39
  // src/client.ts
33
40
  const DEFAULT_SETTINGS_CACHE_TTL_MS = 3e4;
41
+ const PRODUCTS_SELECTION = require_graphql_selection.graphQLSelection(require_models_products.ProductsResponseSchema);
42
+ const PAYMENT_METHOD_SELECTION = require_graphql_selection.graphQLSelection(require_payment_methods.StorefrontPaymentMethodSchema);
43
+ const ARTICLE_SELECTION = require_graphql_selection.graphQLSelection(require_articles.ArticleSummarySchema);
44
+ const STORE_REVIEW_SELECTION = require_graphql_selection.graphQLSelection(require_models_storefront_reviews.StorefrontStoreReviewSchema);
45
+ const SELLER_SELECTION = require_graphql_selection.graphQLSelection(require_models_sellers.SellerSummarySchema);
46
+ const REVIEW_SELECTION = require_graphql_selection.graphQLSelection(require_models_storefront_reviews.StorefrontReviewSchema);
47
+ const ProductsWithReviewsSchema = zod.z.object({ products: zod.z.array(require_models_storefront_reviews.ProductWithReviewsSchema) });
48
+ const MAX_PRODUCT_REVIEWS = 10;
49
+ const COLLECTION_SELECTION = require_graphql_selection.graphQLSelection(require_models_collections.CollectionSchema);
50
+ const PRODUCT_SUMMARY_SELECTION = require_graphql_selection.graphQLSelection(require_models_products.ProductSummarySchema);
51
+ const CollectionCoverRowsSchema = zod.z.array(require_models_collections.CollectionSchema.extend({ products: zod.z.array(require_models_products.ProductSummarySchema.pick({ imageUrl: true })) })).nullable();
52
+ const CollectionProductRowsSchema = zod.z.array(require_models_collections.CollectionWithProductsSchema).nullable();
53
+ const MAX_COLLECTIONS = 100;
54
+ const MAX_COLLECTION_PRODUCTS = 24;
55
+ function boundedCount(value, fallback, max) {
56
+ if (!Number.isFinite(value)) return fallback;
57
+ return Math.min(max, Math.max(1, Math.trunc(value)));
58
+ }
59
+ function graphQLProductsInput(input) {
60
+ const { categoryId: _categoryId, sellers, sort, productTypes, ...rest } = input;
61
+ return {
62
+ ...rest,
63
+ sellerSlugs: sellers,
64
+ sort: sort?.toUpperCase(),
65
+ productTypes: productTypes?.map((type) => type.toUpperCase())
66
+ };
67
+ }
34
68
  const PRODUCT_READ_CACHE_TTL_MS = 3e4;
35
69
  const COLLECTION_READ_CACHE_TTL_MS = 6e4;
36
70
  const CATEGORY_READ_CACHE_TTL_MS = 3e4;
@@ -57,6 +91,7 @@ function createClient(options) {
57
91
  function graphql(document, dataSchema, variables, requestOptions = {}) {
58
92
  return require_graphql.executeGraphQL(graphQLApi, domain, document, dataSchema, variables, requestOptions);
59
93
  }
94
+ const batcher = require_graphql_batch.createGraphQLBatcher((document, variables, options) => require_graphql.sendGraphQL(graphQLApi, domain, document, variables, options));
60
95
  const apiClient = async () => {
61
96
  const storeId = await getStoreId();
62
97
  return require_api.createApi({
@@ -73,6 +108,9 @@ function createClient(options) {
73
108
  const productsCache = new require_bounded_read_cache.BoundedReadCache(32);
74
109
  const productCache = new require_bounded_read_cache.BoundedReadCache(100);
75
110
  const collectionsCache = new require_bounded_read_cache.BoundedReadCache(1);
111
+ const collectionCoversCache = new require_bounded_read_cache.BoundedReadCache(8);
112
+ const collectionProductsCache = new require_bounded_read_cache.BoundedReadCache(8);
113
+ const productReviewsCache = new require_bounded_read_cache.BoundedReadCache(16);
76
114
  const collectionCache = new require_bounded_read_cache.BoundedReadCache(50);
77
115
  const categoryCache = new require_bounded_read_cache.BoundedReadCache(50);
78
116
  const urlCache = new require_bounded_read_cache.BoundedReadCache(200);
@@ -85,6 +123,9 @@ function createClient(options) {
85
123
  productsCache.clear();
86
124
  productCache.clear();
87
125
  collectionsCache.clear();
126
+ collectionCoversCache.clear();
127
+ collectionProductsCache.clear();
128
+ productReviewsCache.clear();
88
129
  collectionCache.clear();
89
130
  categoryCache.clear();
90
131
  urlCache.clear();
@@ -115,6 +156,7 @@ function createClient(options) {
115
156
  const key = JSON.stringify(links);
116
157
  if (layoutRead?.key === key && layoutRead.expiresAt > Date.now()) return layoutRead.data;
117
158
  const read = require_layout_service.getLayout({
159
+ batcher,
118
160
  graphql,
119
161
  links
120
162
  }).catch(async (error) => {
@@ -156,9 +198,47 @@ function createClient(options) {
156
198
  return require_collection_service.getCollections(client);
157
199
  });
158
200
  }
159
- async function getPaymentMethods$1() {
160
- const client = await apiClient();
161
- return require_payment_method_service.getPaymentMethods(client);
201
+ function collectionLimitArgument(limit) {
202
+ return {
203
+ name: "limit",
204
+ type: "Int",
205
+ value: limit === void 0 ? void 0 : boundedCount(limit, MAX_COLLECTIONS, MAX_COLLECTIONS)
206
+ };
207
+ }
208
+ async function getCollectionCovers(options = {}) {
209
+ const limit = collectionLimitArgument(options.limit);
210
+ const candidates = boundedCount(options.candidates ?? 8, 8, MAX_COLLECTION_PRODUCTS);
211
+ return collectionCoversCache.read(`${cacheDomain}\u0000${limit.value ?? ""}\u0000${candidates}`, COLLECTION_READ_CACHE_TTL_MS, async () => {
212
+ return (await batcher.request({
213
+ field: "collections",
214
+ arguments: [limit],
215
+ selection: `${COLLECTION_SELECTION} products(limit: ${candidates}) { imageUrl }`,
216
+ schema: CollectionCoverRowsSchema
217
+ }) ?? []).map(({ products, ...collection }) => ({
218
+ ...collection,
219
+ imageCandidates: products.map((product) => product.imageUrl).filter((image) => image !== "")
220
+ }));
221
+ });
222
+ }
223
+ async function getCollectionsWithProducts(options) {
224
+ const limit = collectionLimitArgument(options.limit);
225
+ const products = boundedCount(options.products, 8, MAX_COLLECTION_PRODUCTS);
226
+ const sort = options.sort === void 0 ? "" : `, sort: ${require_models_products.ProductSortSchema.parse(options.sort).toUpperCase()}`;
227
+ return collectionProductsCache.read(`${cacheDomain}\u0000${limit.value ?? ""}\u0000${products}\u0000${sort}`, PRODUCT_READ_CACHE_TTL_MS, async () => {
228
+ return await batcher.request({
229
+ field: "collections",
230
+ arguments: [limit],
231
+ selection: `${COLLECTION_SELECTION} products(limit: ${products}${sort}) { ${PRODUCT_SUMMARY_SELECTION} }`,
232
+ schema: CollectionProductRowsSchema
233
+ }) ?? [];
234
+ });
235
+ }
236
+ async function getPaymentMethods() {
237
+ return batcher.request({
238
+ field: "paymentMethods",
239
+ selection: PAYMENT_METHOD_SELECTION,
240
+ schema: require_payment_methods.StorefrontPaymentMethodsSchema
241
+ }, { allowStale: false });
162
242
  }
163
243
  async function getCollectionBySlug$1(collectionSlug) {
164
244
  return collectionCache.read(`${cacheDomain}\u0000${collectionSlug}`, COLLECTION_READ_CACHE_TTL_MS, async () => {
@@ -209,17 +289,46 @@ function createClient(options) {
209
289
  await Promise.all(batches);
210
290
  return input.map((link) => resolved.get(require_catalog_link_key.catalogLinkKey(link)) ?? link);
211
291
  }
212
- async function listArticles$1(params = {}) {
213
- const client = await apiClient();
214
- return require_article_service.listArticles(client, params);
292
+ async function listArticles(params = {}) {
293
+ const input = require_articles.ListArticlesParamsSchema.parse(params);
294
+ return batcher.request({
295
+ field: "articles",
296
+ arguments: [
297
+ {
298
+ name: "search",
299
+ type: "String",
300
+ value: input.search
301
+ },
302
+ {
303
+ name: "folder",
304
+ type: "String",
305
+ value: input.folder
306
+ },
307
+ {
308
+ name: "tag",
309
+ type: "String",
310
+ value: input.tag
311
+ },
312
+ {
313
+ name: "limit",
314
+ type: "Int",
315
+ value: input.limit
316
+ }
317
+ ],
318
+ selection: ARTICLE_SELECTION,
319
+ schema: require_articles.ArticlesSchema
320
+ });
215
321
  }
216
322
  async function getArticleBySlug$1(articleSlug) {
217
323
  const client = await apiClient();
218
324
  return require_article_service.getArticleBySlug(client, articleSlug);
219
325
  }
220
- async function getSellers$1() {
221
- const client = await apiClient();
222
- return require_seller_service.getSellers(client);
326
+ async function getSellers() {
327
+ return batcher.request({
328
+ field: "sellers",
329
+ selection: SELLER_SELECTION,
330
+ schema: require_models_sellers.SellersSchema
331
+ });
223
332
  }
224
333
  async function getSellerBySlug$1(sellerSlug) {
225
334
  const client = await apiClient();
@@ -228,8 +337,40 @@ function createClient(options) {
228
337
  async function getProducts$1(params = {}) {
229
338
  const input = require_models_products.ProductsParamsSchema.parse(params);
230
339
  return productsCache.read(`${cacheDomain}\u0000${JSON.stringify(input)}`, PRODUCT_READ_CACHE_TTL_MS, async () => {
231
- const client = await apiClient();
232
- return require_product_service.getProducts(client, input);
340
+ if (input.categoryId !== void 0) {
341
+ const client = await apiClient();
342
+ return require_product_service.getProducts(client, input);
343
+ }
344
+ return batcher.request({
345
+ field: "products",
346
+ arguments: [{
347
+ name: "input",
348
+ type: "StorefrontProductsInput",
349
+ value: graphQLProductsInput(input)
350
+ }],
351
+ selection: PRODUCTS_SELECTION,
352
+ schema: require_models_products.ProductsResponseSchema
353
+ });
354
+ });
355
+ }
356
+ async function getProductsWithReviews(params, reviews = {}) {
357
+ const input = require_models_products.ProductsParamsSchema.parse(params);
358
+ if (input.categoryId !== void 0) throw new Error("getProductsWithReviews filtra por categories, no por categoryId");
359
+ const limit = boundedCount(reviews.limit ?? 3, 3, MAX_PRODUCT_REVIEWS);
360
+ const sortBy = reviews.sortBy === void 0 ? "" : `, sortBy: ${JSON.stringify(require_models_storefront_reviews.ProductReviewSortSchema.parse(reviews.sortBy))}`;
361
+ const sortDirection = reviews.sortDirection === void 0 ? "" : `, sortDirection: ${require_models_storefront_reviews.ProductReviewDirectionSchema.parse(reviews.sortDirection).toUpperCase()}`;
362
+ const selection = `products { ${PRODUCT_SUMMARY_SELECTION} reviews(limit: ${limit}${sortBy}${sortDirection}) { ${REVIEW_SELECTION} } }`;
363
+ return productReviewsCache.read(`${cacheDomain}\u0000${JSON.stringify(input)}\u0000${selection}`, PRODUCT_READ_CACHE_TTL_MS, async () => {
364
+ return (await batcher.request({
365
+ field: "products",
366
+ arguments: [{
367
+ name: "input",
368
+ type: "StorefrontProductsInput",
369
+ value: graphQLProductsInput(input)
370
+ }],
371
+ selection,
372
+ schema: ProductsWithReviewsSchema
373
+ })).products;
233
374
  });
234
375
  }
235
376
  async function getProductBySlug$1(productSlug, options = {}) {
@@ -254,9 +395,22 @@ function createClient(options) {
254
395
  const client = await apiClient();
255
396
  return require_review_service.listProductReviews(client, params);
256
397
  }
257
- async function listStoreReviews$1(params) {
258
- const client = await apiClient();
259
- return require_review_service.listStoreReviews(client, params);
398
+ async function listStoreReviews(params = {}) {
399
+ const input = require_models_storefront_reviews.ListStoreReviewsParamsSchema.parse(params);
400
+ return batcher.request({
401
+ field: "storeReviews",
402
+ arguments: [{
403
+ name: "limit",
404
+ type: "Int",
405
+ value: input.limit
406
+ }, {
407
+ name: "minRating",
408
+ type: "Int",
409
+ value: input.minRating
410
+ }],
411
+ selection: STORE_REVIEW_SELECTION,
412
+ schema: require_models_storefront_reviews.StorefrontStoreReviewSchema.array()
413
+ });
260
414
  }
261
415
  async function createProductReview$1(params) {
262
416
  const client = await apiClient();
@@ -435,24 +589,27 @@ function createClient(options) {
435
589
  getLayout: getLayout$1,
436
590
  getStoreId,
437
591
  getCollections: getCollections$1,
438
- getPaymentMethods: getPaymentMethods$1,
592
+ getCollectionCovers,
593
+ getCollectionsWithProducts,
594
+ getPaymentMethods,
439
595
  getCollectionBySlug: getCollectionBySlug$1,
440
596
  getPageBySlug: getPageBySlug$1,
441
597
  getCategoryBySlug: getCategoryBySlug$1,
442
598
  resolveUrl: resolveUrl$1,
443
599
  getLinks: getLinks$1,
444
600
  getSitemap: getSitemap$1,
445
- listArticles: listArticles$1,
601
+ listArticles,
446
602
  getArticleBySlug: getArticleBySlug$1,
447
603
  clearCache,
448
- getSellers: getSellers$1,
604
+ getSellers,
449
605
  getSellerBySlug: getSellerBySlug$1,
450
606
  getProducts: getProducts$1,
607
+ getProductsWithReviews,
451
608
  getProductBySlug: getProductBySlug$1,
452
609
  getRelatedProducts: getRelatedProducts$1,
453
610
  autocompleteProducts: autocompleteProducts$1,
454
611
  listProductReviews: listProductReviews$1,
455
- listStoreReviews: listStoreReviews$1,
612
+ listStoreReviews,
456
613
  createProductReview: createProductReview$1,
457
614
  createCustomerProductReview: createCustomerProductReview$1,
458
615
  createCart: createCart$1,
package/dist/client.d.cts CHANGED
@@ -2,7 +2,7 @@ import { AuthenticateOrderPaymentInput, OrderPaymentStart, OrderStatusView } fro
2
2
  import { Api, CreateApiOptions } from "./api.cjs";
3
3
  import { GraphQLRequestOptions, GraphQLVariables } from "./libs/graphql.cjs";
4
4
  import { StorefrontPaymentMethods } from "./models/payment-methods.cjs";
5
- import { Collection, Collections } from "./models/collections.cjs";
5
+ import { Collection, CollectionCoversOptions, CollectionWithCovers, CollectionWithProducts, Collections, CollectionsWithProductsOptions } from "./models/collections.cjs";
6
6
  import { CategoryDetail } from "./models/categories.cjs";
7
7
  import { SitemapPage, UrlResolution, UrlResolutionOptions } from "./models/urls.cjs";
8
8
  import { CatalogLink } from "./models/catalog-links.cjs";
@@ -10,7 +10,7 @@ import { StorefrontLayout } from "./services/layout.service.cjs";
10
10
  import { Article, ArticleSummary, ListArticlesParams } from "./models/articles.cjs";
11
11
  import { ProductBySlugOptions, ProductDetail, ProductSummary, ProductsParamsInput, ProductsResponse, RelatedProductsParams } from "./models/products.cjs";
12
12
  import { ProductAutocompleteParams, ProductSuggestion } from "./models/search.cjs";
13
- import { CreateCustomerProductReviewParams, CreateProductReviewParams, ListProductReviewsParams, ListStoreReviewsParams, StorefrontReview, StorefrontReviews, StorefrontStoreReview } from "./models/storefront-reviews.cjs";
13
+ import { CreateCustomerProductReviewParams, CreateProductReviewParams, ListProductReviewsParams, ListStoreReviewsParams, ProductReviewsOptions, ProductWithReviews, StorefrontReview, StorefrontReviews, StorefrontStoreReview } from "./models/storefront-reviews.cjs";
14
14
  import { AddCartItemParams, CreateCartParams, GetCartParams, RemoveCartItemParams, StorefrontCart, UpdateCartItemQuantityParams } from "./models/storefront-cart.cjs";
15
15
  import { CartAddressesParams, CartBuyerParams, CartCheckoutParams, CartCheckoutReadParams, CartCheckoutReadResponse, CartCheckoutResponse, CartPaymentReceiptResponse, CartPromotionCodeParams, GetShippingOptionsParams, PutCartPaymentMethodParams, PutShippingMethodParams, ShippingOptionsResponse, UploadPaymentReceiptParams } from "./models/storefront-checkout.cjs";
16
16
  import { Countries, Departments, Districts, GetDepartmentsParams, GetDistrictsParams, GetProvincesParams, Provinces } from "./models/geo.cjs";
@@ -48,6 +48,10 @@ export interface StorefrontClient extends Api {
48
48
  getStoreId(): Promise<string>;
49
49
  /** GET /v1/collections */
50
50
  getCollections(): Promise<Collections>;
51
+ /** Colecciones con fotos de sus productos para usar de portada, en la misma consulta. */
52
+ getCollectionCovers(options?: CollectionCoversOptions): Promise<CollectionWithCovers[]>;
53
+ /** Colecciones con sus primeros productos, en la misma consulta. */
54
+ getCollectionsWithProducts(options: CollectionsWithProductsOptions): Promise<CollectionWithProducts[]>;
51
55
  /** GET /v1/payments/methods */
52
56
  getPaymentMethods(): Promise<StorefrontPaymentMethods>;
53
57
  /** GET /v1/collections/by-slug/:slug */
@@ -65,6 +69,8 @@ export interface StorefrontClient extends Api {
65
69
  getSellers(): Promise<Sellers>;
66
70
  getSellerBySlug(slug: string): Promise<SellerProfile>;
67
71
  getProducts(params?: ProductsParamsInput): Promise<ProductsResponse>;
72
+ /** Productos con sus primeras reseñas, en la misma consulta. */
73
+ getProductsWithReviews(params: ProductsParamsInput, reviews?: ProductReviewsOptions): Promise<ProductWithReviews[]>;
68
74
  /** GET product by slug con x-Store-Id. */
69
75
  getProductBySlug(slug: string, options?: ProductBySlugOptions): Promise<ProductDetail>;
70
76
  getRelatedProducts(params: RelatedProductsParams): Promise<ProductSummary[]>;
package/dist/client.d.ts CHANGED
@@ -2,7 +2,7 @@ import { AuthenticateOrderPaymentInput, OrderPaymentStart, OrderStatusView } fro
2
2
  import { Api, CreateApiOptions } from "./api.js";
3
3
  import { GraphQLRequestOptions, GraphQLVariables } from "./libs/graphql.js";
4
4
  import { StorefrontPaymentMethods } from "./models/payment-methods.js";
5
- import { Collection, Collections } from "./models/collections.js";
5
+ import { Collection, CollectionCoversOptions, CollectionWithCovers, CollectionWithProducts, Collections, CollectionsWithProductsOptions } from "./models/collections.js";
6
6
  import { CategoryDetail } from "./models/categories.js";
7
7
  import { SitemapPage, UrlResolution, UrlResolutionOptions } from "./models/urls.js";
8
8
  import { CatalogLink } from "./models/catalog-links.js";
@@ -10,7 +10,7 @@ import { StorefrontLayout } from "./services/layout.service.js";
10
10
  import { Article, ArticleSummary, ListArticlesParams } from "./models/articles.js";
11
11
  import { ProductBySlugOptions, ProductDetail, ProductSummary, ProductsParamsInput, ProductsResponse, RelatedProductsParams } from "./models/products.js";
12
12
  import { ProductAutocompleteParams, ProductSuggestion } from "./models/search.js";
13
- import { CreateCustomerProductReviewParams, CreateProductReviewParams, ListProductReviewsParams, ListStoreReviewsParams, StorefrontReview, StorefrontReviews, StorefrontStoreReview } from "./models/storefront-reviews.js";
13
+ import { CreateCustomerProductReviewParams, CreateProductReviewParams, ListProductReviewsParams, ListStoreReviewsParams, ProductReviewsOptions, ProductWithReviews, StorefrontReview, StorefrontReviews, StorefrontStoreReview } from "./models/storefront-reviews.js";
14
14
  import { AddCartItemParams, CreateCartParams, GetCartParams, RemoveCartItemParams, StorefrontCart, UpdateCartItemQuantityParams } from "./models/storefront-cart.js";
15
15
  import { CartAddressesParams, CartBuyerParams, CartCheckoutParams, CartCheckoutReadParams, CartCheckoutReadResponse, CartCheckoutResponse, CartPaymentReceiptResponse, CartPromotionCodeParams, GetShippingOptionsParams, PutCartPaymentMethodParams, PutShippingMethodParams, ShippingOptionsResponse, UploadPaymentReceiptParams } from "./models/storefront-checkout.js";
16
16
  import { Countries, Departments, Districts, GetDepartmentsParams, GetDistrictsParams, GetProvincesParams, Provinces } from "./models/geo.js";
@@ -48,6 +48,10 @@ export interface StorefrontClient extends Api {
48
48
  getStoreId(): Promise<string>;
49
49
  /** GET /v1/collections */
50
50
  getCollections(): Promise<Collections>;
51
+ /** Colecciones con fotos de sus productos para usar de portada, en la misma consulta. */
52
+ getCollectionCovers(options?: CollectionCoversOptions): Promise<CollectionWithCovers[]>;
53
+ /** Colecciones con sus primeros productos, en la misma consulta. */
54
+ getCollectionsWithProducts(options: CollectionsWithProductsOptions): Promise<CollectionWithProducts[]>;
51
55
  /** GET /v1/payments/methods */
52
56
  getPaymentMethods(): Promise<StorefrontPaymentMethods>;
53
57
  /** GET /v1/collections/by-slug/:slug */
@@ -65,6 +69,8 @@ export interface StorefrontClient extends Api {
65
69
  getSellers(): Promise<Sellers>;
66
70
  getSellerBySlug(slug: string): Promise<SellerProfile>;
67
71
  getProducts(params?: ProductsParamsInput): Promise<ProductsResponse>;
72
+ /** Productos con sus primeras reseñas, en la misma consulta. */
73
+ getProductsWithReviews(params: ProductsParamsInput, reviews?: ProductReviewsOptions): Promise<ProductWithReviews[]>;
68
74
  /** GET product by slug con x-Store-Id. */
69
75
  getProductBySlug(slug: string, options?: ProductBySlugOptions): Promise<ProductDetail>;
70
76
  getRelatedProducts(params: RelatedProductsParams): Promise<ProductSummary[]>;