@faststore/api 1.9.7 → 1.9.11

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 (37) hide show
  1. package/CHANGELOG.md +525 -1697
  2. package/README.md +5 -2
  3. package/dist/__generated__/schema.d.ts +72 -41
  4. package/dist/api.cjs.development.js +270 -210
  5. package/dist/api.cjs.development.js.map +1 -1
  6. package/dist/api.cjs.production.min.js +1 -1
  7. package/dist/api.cjs.production.min.js.map +1 -1
  8. package/dist/api.esm.js +270 -210
  9. package/dist/api.esm.js.map +1 -1
  10. package/dist/index.d.ts +4 -2
  11. package/dist/platforms/vtex/clients/search/index.d.ts +2 -1
  12. package/dist/platforms/vtex/clients/search/types/FacetSearchResult.d.ts +8 -8
  13. package/dist/platforms/vtex/index.d.ts +7 -3
  14. package/dist/platforms/vtex/resolvers/faceValue.d.ts +3 -0
  15. package/dist/platforms/vtex/resolvers/facet.d.ts +3 -1
  16. package/dist/platforms/vtex/utils/facets.d.ts +1 -0
  17. package/package.json +3 -2
  18. package/src/__generated__/schema.ts +75 -41
  19. package/src/platforms/vtex/clients/search/index.ts +9 -1
  20. package/src/platforms/vtex/clients/search/types/FacetSearchResult.ts +9 -8
  21. package/src/platforms/vtex/index.ts +26 -16
  22. package/src/platforms/vtex/resolvers/faceValue.ts +12 -0
  23. package/src/platforms/vtex/resolvers/facet.ts +66 -5
  24. package/src/platforms/vtex/resolvers/offer.ts +1 -1
  25. package/src/platforms/vtex/resolvers/searchResult.ts +9 -26
  26. package/src/platforms/vtex/utils/facets.ts +18 -0
  27. package/src/typeDefs/cart.graphql +1 -1
  28. package/src/typeDefs/collection.graphql +12 -0
  29. package/src/typeDefs/facet.graphql +28 -6
  30. package/src/typeDefs/mutation.graphql +2 -2
  31. package/src/typeDefs/order.graphql +1 -1
  32. package/src/typeDefs/pageInfo.graphql +5 -5
  33. package/src/typeDefs/query.graphql +59 -23
  34. package/src/typeDefs/session.graphql +4 -4
  35. package/src/typeDefs/status.graphql +1 -1
  36. package/dist/platforms/vtex/resolvers/facetValue.d.ts +0 -5
  37. package/src/platforms/vtex/resolvers/facetValue.ts +0 -12
package/README.md CHANGED
@@ -28,9 +28,11 @@ From the command line in your project directory, run yarn add `@faststore/api`.
28
28
  ```cmd
29
29
  yarn add @faststore/api
30
30
  ```
31
+
31
32
  ## Usage
32
33
 
33
- With servers like express:
34
+ With servers like express:
35
+
34
36
  ```ts
35
37
  import { execute } from 'graphql'
36
38
  import { getSchema } from '@faststore/api'
@@ -45,7 +47,7 @@ app.get('/graphql', async (req, res) => {
45
47
  const result = await execute({
46
48
  schema: await getSchema(),
47
49
  variableValues: variables,
48
- operationName
50
+ operationName,
49
51
  })
50
52
 
51
53
  res.status(200)
@@ -54,4 +56,5 @@ app.get('/graphql', async (req, res) => {
54
56
  ```
55
57
 
56
58
  ## Docs
59
+
57
60
  For more information, please refer to our documentation: https://faststore.dev/reference/api/faststore-api
@@ -25,9 +25,9 @@ export declare type IStoreCart = {
25
25
  order: IStoreOrder;
26
26
  };
27
27
  export declare type IStoreCurrency = {
28
- /** Currency code, e.g: USD */
28
+ /** Currency code (e.g: USD). */
29
29
  code: Scalars['String'];
30
- /** Currency symbol, e.g: $ */
30
+ /** Currency symbol (e.g: $). */
31
31
  symbol: Scalars['String'];
32
32
  };
33
33
  /** Image input. */
@@ -50,7 +50,7 @@ export declare type IStoreOffer = {
50
50
  /** Seller responsible for the offer. */
51
51
  seller: IStoreOrganization;
52
52
  };
53
- /** Offer input. */
53
+ /** Order input. */
54
54
  export declare type IStoreOrder = {
55
55
  /** Array with information on each accepted offer. */
56
56
  acceptedOffer: Array<IStoreOffer>;
@@ -94,9 +94,11 @@ export declare type IStorePropertyValue = {
94
94
  /** Specifies the nature of the value */
95
95
  valueReference: Scalars['String'];
96
96
  };
97
- /** Selected facet input. */
97
+ /** Selected search facet input. */
98
98
  export declare type IStoreSelectedFacet = {
99
+ /** Selected search facet key. */
99
100
  key: Scalars['String'];
101
+ /** Selected search facet value. */
100
102
  value: Scalars['String'];
101
103
  };
102
104
  /** Session input. */
@@ -116,9 +118,9 @@ export declare type IStoreSession = {
116
118
  };
117
119
  export declare type Mutation = {
118
120
  __typename?: 'Mutation';
119
- /** Returns the order if anything has changed in it, or `null` if the order is valid. */
121
+ /** Checks for changes between the cart presented in the UI and the cart stored in the ecommerce platform. If changes are detected, it returns the cart stored on the platform. Otherwise, it returns `null`. */
120
122
  validateCart?: Maybe<StoreCart>;
121
- /** Validate session information. */
123
+ /** Updates a web session with the specified values. */
122
124
  validateSession?: Maybe<StoreSession>;
123
125
  };
124
126
  export declare type MutationValidateCartArgs = {
@@ -130,15 +132,15 @@ export declare type MutationValidateSessionArgs = {
130
132
  };
131
133
  export declare type Query = {
132
134
  __typename?: 'Query';
133
- /** All collections query. */
135
+ /** Returns information about all collections. */
134
136
  allCollections: StoreCollectionConnection;
135
- /** All products query. */
137
+ /** Returns information about all products. */
136
138
  allProducts: StoreProductConnection;
137
- /** Collection query. */
139
+ /** Returns the details of a collection based on the collection slug. */
138
140
  collection: StoreCollection;
139
- /** Product query. */
141
+ /** Returns the details of a product based on the specified locator. */
140
142
  product: StoreProduct;
141
- /** Search query. */
143
+ /** Returns the result of a product, facet, or suggestion search. */
142
144
  search: StoreSearchResult;
143
145
  };
144
146
  export declare type QueryAllCollectionsArgs = {
@@ -215,7 +217,7 @@ export declare type StoreCart = {
215
217
  /** Shopping cart message. */
216
218
  export declare type StoreCartMessage = {
217
219
  __typename?: 'StoreCartMessage';
218
- /** Shopping cart message status, which can be `INFO`, `WARNING` OR `ERROR`. */
220
+ /** Shopping cart message status, which can be `INFO`, `WARNING` or `ERROR`. */
219
221
  status: StoreStatus;
220
222
  /** Shopping cart message text. */
221
223
  text: Scalars['String'];
@@ -236,20 +238,20 @@ export declare type StoreCollection = {
236
238
  /** Collection type. */
237
239
  type: StoreCollectionType;
238
240
  };
239
- /** Collection connection pagination information. */
241
+ /** Collection connections, including pagination information and collections returned by the query. */
240
242
  export declare type StoreCollectionConnection = {
241
243
  __typename?: 'StoreCollectionConnection';
242
- /** Array with collection connection page edges. */
244
+ /** Array with collection connection page edges, each containing a collection and a corresponding cursor.. */
243
245
  edges: Array<StoreCollectionEdge>;
244
- /** Collection connection page information. */
246
+ /** Collection pagination information. */
245
247
  pageInfo: StorePageInfo;
246
248
  };
247
- /** Collection pagination edge. */
249
+ /** Each collection edge contains a `node`, with product collection information, and a `cursor`, that can be used as a reference for pagination. */
248
250
  export declare type StoreCollectionEdge = {
249
251
  __typename?: 'StoreCollectionEdge';
250
- /** Collection pagination cursor. */
252
+ /** Collection cursor. Used as pagination reference. */
251
253
  cursor: Scalars['String'];
252
- /** Collection pagination node. */
254
+ /** Each collection node contains the information of a product collection returned by the query. */
253
255
  node: StoreCollection;
254
256
  };
255
257
  /** Product collection facet, used for search. */
@@ -268,39 +270,55 @@ export declare type StoreCollectionMeta = {
268
270
  };
269
271
  /** Product collection type. Possible values are `Department`, `Category`, `Brand` or `Cluster`. */
270
272
  export declare const enum StoreCollectionType {
273
+ /** Product brand. */
271
274
  Brand = "Brand",
275
+ /** Second level of product categorization. */
272
276
  Category = "Category",
277
+ /** Product cluster. */
273
278
  Cluster = "Cluster",
279
+ /** First level of product categorization. */
274
280
  Department = "Department"
275
281
  }
276
282
  /** Currency information. */
277
283
  export declare type StoreCurrency = {
278
284
  __typename?: 'StoreCurrency';
279
- /** Currency code, e.g: USD */
285
+ /** Currency code (e.g: USD). */
280
286
  code: Scalars['String'];
281
- /** Currency symbol, e.g: $ */
287
+ /** Currency symbol (e.g: $). */
282
288
  symbol: Scalars['String'];
283
289
  };
284
- /** Search facet information. */
285
- export declare type StoreFacet = {
286
- __typename?: 'StoreFacet';
290
+ export declare type StoreFacet = StoreFacetBoolean | StoreFacetRange;
291
+ /** Search facet boolean information. */
292
+ export declare type StoreFacetBoolean = {
293
+ __typename?: 'StoreFacetBoolean';
287
294
  /** Facet key. */
288
295
  key: Scalars['String'];
289
296
  /** Facet label. */
290
297
  label: Scalars['String'];
291
- /** Facet type. Possible values are `BOOLEAN` and `RANGE`. */
292
- type: StoreFacetType;
293
298
  /** Array with information on each facet value. */
294
- values: Array<StoreFacetValue>;
299
+ values: Array<StoreFacetValueBoolean>;
300
+ };
301
+ /** Search facet range information. */
302
+ export declare type StoreFacetRange = {
303
+ __typename?: 'StoreFacetRange';
304
+ /** Facet key. */
305
+ key: Scalars['String'];
306
+ /** Facet label. */
307
+ label: Scalars['String'];
308
+ max: StoreFacetValueRange;
309
+ /** Array with information on each facet value. */
310
+ min: StoreFacetValueRange;
295
311
  };
296
312
  /** Search facet type. */
297
313
  export declare const enum StoreFacetType {
314
+ /** Indicates boolean search facet. */
298
315
  Boolean = "BOOLEAN",
316
+ /** Indicates range type search facet. */
299
317
  Range = "RANGE"
300
318
  }
301
319
  /** Information of a specific facet value. */
302
- export declare type StoreFacetValue = {
303
- __typename?: 'StoreFacetValue';
320
+ export declare type StoreFacetValueBoolean = {
321
+ __typename?: 'StoreFacetValueBoolean';
304
322
  /** Facet value label. */
305
323
  label: Scalars['String'];
306
324
  /** Number of items with this facet. */
@@ -310,6 +328,11 @@ export declare type StoreFacetValue = {
310
328
  /** Facet value. */
311
329
  value: Scalars['String'];
312
330
  };
331
+ export declare type StoreFacetValueRange = {
332
+ __typename?: 'StoreFacetValueRange';
333
+ absolute: Scalars['Float'];
334
+ selected: Scalars['Float'];
335
+ };
313
336
  /** Image. */
314
337
  export declare type StoreImage = {
315
338
  __typename?: 'StoreImage';
@@ -366,16 +389,16 @@ export declare type StoreOrganization = {
366
389
  /** Organization ID. */
367
390
  identifier: Scalars['String'];
368
391
  };
369
- /** Page information. */
392
+ /** Whenever you make a query that allows for pagination, such as `allProducts` or `allCollections`, you can check `StorePageInfo` to learn more about the complete set of items and use it to paginate your queries. */
370
393
  export declare type StorePageInfo = {
371
394
  __typename?: 'StorePageInfo';
372
- /** Page cursor end. */
395
+ /** Cursor corresponding to the last possible item. */
373
396
  endCursor: Scalars['String'];
374
- /** Indicates whether next page exists. */
397
+ /** Indicates whether there is at least one more page with items after the ones returned in the current query. */
375
398
  hasNextPage: Scalars['Boolean'];
376
- /** Indicates whether previous page exists. */
399
+ /** Indicates whether there is at least one more page with items before the ones returned in the current query. */
377
400
  hasPreviousPage: Scalars['Boolean'];
378
- /** Page cursor start. */
401
+ /** Cursor corresponding to the first possible item. */
379
402
  startCursor: Scalars['String'];
380
403
  /** Total number of items (products or collections), not pages. */
381
404
  totalCount: Scalars['Int'];
@@ -426,20 +449,20 @@ export declare type StoreProduct = {
426
449
  /** Corresponding collection URL slug, with which to retrieve this entity. */
427
450
  slug: Scalars['String'];
428
451
  };
429
- /** Product connection pagination information. */
452
+ /** Product connections, including pagination information and products returned by the query. */
430
453
  export declare type StoreProductConnection = {
431
454
  __typename?: 'StoreProductConnection';
432
- /** Array with product connection page edges. */
455
+ /** Array with product connection edges, each containing a product and a corresponding cursor. */
433
456
  edges: Array<StoreProductEdge>;
434
- /** Product connection page information. */
457
+ /** Product pagination information. */
435
458
  pageInfo: StorePageInfo;
436
459
  };
437
- /** Product pagination edge. */
460
+ /** Each product edge contains a `node`, with product information, and a `cursor`, that can be used as a reference for pagination. */
438
461
  export declare type StoreProductEdge = {
439
462
  __typename?: 'StoreProductEdge';
440
- /** Product pagination cursor. */
463
+ /** Product cursor. Used as pagination reference. */
441
464
  cursor: Scalars['String'];
442
- /** Product pagination node. */
465
+ /** Each product node contains the information of a product returned by the query. */
443
466
  node: StoreProduct;
444
467
  };
445
468
  /** Product group information. Product groups are catalog entities that may contain variants. They are equivalent to VTEX [Products](https://help.vtex.com/en/tutorial/what-is-a-product--2zrB2gFCHyQokCKKE8kuAw#), whereas each variant is equivalent to a VTEX [SKU](https://help.vtex.com/en/tutorial/what-is-an-sku--1K75s4RXAQyOuGUYKMM68u#). For example, you may have a **Shirt** product group with associated products such as **Blue shirt size L**, **Green shirt size XL** and so on. */
@@ -520,18 +543,26 @@ export declare type StoreSession = {
520
543
  /** Session postal code. */
521
544
  postalCode?: Maybe<Scalars['String']>;
522
545
  };
523
- /** Product sorting options used in search. */
546
+ /** Product search results sorting options. */
524
547
  export declare const enum StoreSort {
548
+ /** Sort by discount value, from highest to lowest. */
525
549
  DiscountDesc = "discount_desc",
550
+ /** Sort by name, in alphabetical order. */
526
551
  NameAsc = "name_asc",
552
+ /** Sort by name, in reverse alphabetical order. */
527
553
  NameDesc = "name_desc",
554
+ /** Sort by orders, from highest to lowest. */
528
555
  OrdersDesc = "orders_desc",
556
+ /** Sort by price, from lowest to highest. */
529
557
  PriceAsc = "price_asc",
558
+ /** Sort by price, from highest to lowest. */
530
559
  PriceDesc = "price_desc",
560
+ /** Sort by release date, from highest to lowest. */
531
561
  ReleaseDesc = "release_desc",
562
+ /** Sort by product score, from highest to lowest. */
532
563
  ScoreDesc = "score_desc"
533
564
  }
534
- /** Status used to indicate type of message. For instance, in shopping cart messages. */
565
+ /** Status used to indicate a message type. For instance, a shopping cart informative or error message. */
535
566
  export declare const enum StoreStatus {
536
567
  Error = "ERROR",
537
568
  Info = "INFO",