@faststore/api 1.8.1 → 1.8.4

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 (42) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/__generated__/schema.d.ts +155 -0
  3. package/dist/api.cjs.development.js +129 -123
  4. package/dist/api.cjs.development.js.map +1 -1
  5. package/dist/api.cjs.production.min.js +1 -1
  6. package/dist/api.cjs.production.min.js.map +1 -1
  7. package/dist/api.esm.js +129 -123
  8. package/dist/api.esm.js.map +1 -1
  9. package/dist/index.d.ts +4 -17
  10. package/dist/platforms/vtex/clients/search/types/ProductSearchResult.d.ts +1 -1
  11. package/dist/platforms/vtex/index.d.ts +4 -17
  12. package/dist/platforms/vtex/resolvers/aggregateOffer.d.ts +2 -5
  13. package/dist/platforms/vtex/resolvers/product.d.ts +2 -6
  14. package/dist/platforms/vtex/utils/enhanceCommercialOffer.d.ts +11 -0
  15. package/dist/platforms/vtex/utils/productStock.d.ts +7 -6
  16. package/package.json +2 -2
  17. package/src/__generated__/schema.ts +155 -0
  18. package/src/platforms/vtex/clients/search/types/ProductSearchResult.ts +1 -1
  19. package/src/platforms/vtex/resolvers/aggregateOffer.ts +15 -13
  20. package/src/platforms/vtex/resolvers/offer.ts +44 -49
  21. package/src/platforms/vtex/resolvers/product.ts +14 -10
  22. package/src/platforms/vtex/utils/enhanceCommercialOffer.ts +24 -0
  23. package/src/platforms/vtex/utils/productStock.ts +22 -25
  24. package/src/typeDefs/aggregateOffer.graphql +18 -3
  25. package/src/typeDefs/aggregateRating.graphql +9 -0
  26. package/src/typeDefs/author.graphql +6 -0
  27. package/src/typeDefs/brand.graphql +6 -0
  28. package/src/typeDefs/breadcrumb.graphql +21 -0
  29. package/src/typeDefs/cart.graphql +24 -0
  30. package/src/typeDefs/collection.graphql +39 -2
  31. package/src/typeDefs/facet.graphql +30 -1
  32. package/src/typeDefs/image.graphql +18 -0
  33. package/src/typeDefs/mutation.graphql +30 -2
  34. package/src/typeDefs/offer.graphql +51 -1
  35. package/src/typeDefs/order.graphql +18 -0
  36. package/src/typeDefs/organization.graphql +12 -0
  37. package/src/typeDefs/pageInfo.graphql +18 -1
  38. package/src/typeDefs/person.graphql +15 -0
  39. package/src/typeDefs/product.graphql +60 -3
  40. package/src/typeDefs/productGroup.graphql +15 -0
  41. package/src/typeDefs/propertyValue.graphql +9 -0
  42. package/src/typeDefs/query.graphql +66 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,33 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 1.8.4 (2022-05-10)
7
+
8
+ **Note:** Version bump only for package @faststore/api
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.8.3](https://github.com/vtex/faststore/compare/v1.8.2...v1.8.3) (2022-05-10)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * Offer availability ([#1282](https://github.com/vtex/faststore/issues/1282)) ([e91aa26](https://github.com/vtex/faststore/commit/e91aa26241c52c926d505b733f2127a809dd3f24))
20
+
21
+
22
+
23
+
24
+
25
+ ## 1.8.2 (2022-05-09)
26
+
27
+ **Note:** Version bump only for package @faststore/api
28
+
29
+
30
+
31
+
32
+
6
33
  ## 1.8.1 (2022-05-09)
7
34
 
8
35
  **Note:** Version bump only for package @faststore/api
@@ -18,44 +18,71 @@ export declare type Scalars = {
18
18
  Int: number;
19
19
  Float: number;
20
20
  };
21
+ /** Shopping cart identification input. */
21
22
  export declare type IStoreCart = {
23
+ /** Order information, including `orderNumber` and `acceptedOffer`. */
22
24
  order: IStoreOrder;
23
25
  };
26
+ /** Image input. */
24
27
  export declare type IStoreImage = {
28
+ /** Alias for the input image. */
25
29
  alternateName: Scalars['String'];
30
+ /** Image input URL. */
26
31
  url: Scalars['String'];
27
32
  };
33
+ /** Offer input. */
28
34
  export declare type IStoreOffer = {
35
+ /** Information on the item being offered. */
29
36
  itemOffered: IStoreProduct;
37
+ /** This is displayed as the "from" price in the context of promotions' price comparison. This may change before it reaches the shelf. */
30
38
  listPrice: Scalars['Float'];
39
+ /** Also known as spot price. */
31
40
  price: Scalars['Float'];
41
+ /** Number of items offered. */
32
42
  quantity: Scalars['Int'];
43
+ /** Seller responsible for the offer. */
33
44
  seller: IStoreOrganization;
34
45
  };
46
+ /** Offer input. */
35
47
  export declare type IStoreOrder = {
48
+ /** Array with information on each accepted offer. */
36
49
  acceptedOffer: Array<IStoreOffer>;
50
+ /** Order shopping cart ID, also known as `orderFormId`. */
37
51
  orderNumber: Scalars['String'];
38
52
  };
53
+ /** Organization input. */
39
54
  export declare type IStoreOrganization = {
55
+ /** Organization ID. */
40
56
  identifier: Scalars['String'];
41
57
  };
58
+ /** Product input. */
42
59
  export declare type IStoreProduct = {
60
+ /** Array of product images. */
43
61
  image: Array<IStoreImage>;
62
+ /** Product name. */
44
63
  name: Scalars['String'];
64
+ /** Stock Keeping Unit ID. */
45
65
  sku: Scalars['String'];
46
66
  };
67
+ /** Selected facet input. */
47
68
  export declare type IStoreSelectedFacet = {
48
69
  key: Scalars['String'];
49
70
  value: Scalars['String'];
50
71
  };
72
+ /** Session input. */
51
73
  export declare type IStoreSession = {
74
+ /** Session input channel. */
52
75
  channel?: Maybe<Scalars['String']>;
76
+ /** Session input country. */
53
77
  country?: Maybe<Scalars['String']>;
78
+ /** Session input postal code. */
54
79
  postalCode?: Maybe<Scalars['String']>;
55
80
  };
56
81
  export declare type Mutation = {
57
82
  __typename?: 'Mutation';
83
+ /** Update session information. */
58
84
  updateSession: StoreSession;
85
+ /** Returns the order if anything has changed in it, or `null` if the order is valid. */
59
86
  validateCart?: Maybe<StoreCart>;
60
87
  };
61
88
  export declare type MutationUpdateSessionArgs = {
@@ -94,180 +121,296 @@ export declare type QuerySearchArgs = {
94
121
  sort?: Maybe<StoreSort>;
95
122
  term?: Maybe<Scalars['String']>;
96
123
  };
124
+ /** Aggregate offer information, for a given SKU that is available to be fulfilled by multiple sellers. */
97
125
  export declare type StoreAggregateOffer = {
98
126
  __typename?: 'StoreAggregateOffer';
127
+ /** Highest price among all sellers. */
99
128
  highPrice: Scalars['Float'];
129
+ /** Lowest price among all sellers. */
100
130
  lowPrice: Scalars['Float'];
131
+ /** Number of sellers selling this SKU. */
101
132
  offerCount: Scalars['Int'];
133
+ /** Array with information on each available offer. */
102
134
  offers: Array<StoreOffer>;
135
+ /** ISO code of the currency used for the offer prices. */
103
136
  priceCurrency: Scalars['String'];
104
137
  };
138
+ /** Average rating, based on multiple ratings or reviews. */
105
139
  export declare type StoreAggregateRating = {
106
140
  __typename?: 'StoreAggregateRating';
141
+ /** Value of the aggregate rating. */
107
142
  ratingValue: Scalars['Float'];
143
+ /** Total number of ratings. */
108
144
  reviewCount: Scalars['Int'];
109
145
  };
146
+ /** information about the author of a product review or rating. */
110
147
  export declare type StoreAuthor = {
111
148
  __typename?: 'StoreAuthor';
149
+ /** Author name. */
112
150
  name: Scalars['String'];
113
151
  };
152
+ /** Brand of a given product. */
114
153
  export declare type StoreBrand = {
115
154
  __typename?: 'StoreBrand';
155
+ /** Brand name. */
116
156
  name: Scalars['String'];
117
157
  };
158
+ /** List of items consisting of chain linked web pages, ending with the current page. */
118
159
  export declare type StoreBreadcrumbList = {
119
160
  __typename?: 'StoreBreadcrumbList';
161
+ /** Array with breadcrumb elements. */
120
162
  itemListElement: Array<StoreListItem>;
163
+ /** Number of breadcrumbs in the list. */
121
164
  numberOfItems: Scalars['Int'];
122
165
  };
166
+ /** Shopping cart information. */
123
167
  export declare type StoreCart = {
124
168
  __typename?: 'StoreCart';
169
+ /** List of shopping cart messages. */
125
170
  messages: Array<StoreCartMessage>;
171
+ /** Order information, including `orderNumber` and `acceptedOffer`. */
126
172
  order: StoreOrder;
127
173
  };
174
+ /** Shopping cart message. */
128
175
  export declare type StoreCartMessage = {
129
176
  __typename?: 'StoreCartMessage';
177
+ /** Shopping cart message status, which can be `INFO`, `WARNING` OR `ERROR`. */
130
178
  status: StoreStatus;
179
+ /** Shopping cart message text. */
131
180
  text: Scalars['String'];
132
181
  };
182
+ /** Product collection information. */
133
183
  export declare type StoreCollection = {
134
184
  __typename?: 'StoreCollection';
185
+ /** List of items consisting of chain linked web pages, ending with the current page. */
135
186
  breadcrumbList: StoreBreadcrumbList;
187
+ /** Collection ID. */
136
188
  id: Scalars['ID'];
189
+ /** Collection meta information. Used for search. */
137
190
  meta: StoreCollectionMeta;
191
+ /** Meta tag data. */
138
192
  seo: StoreSeo;
193
+ /** Corresponding collection URL slug, with which to retrieve this entity. */
139
194
  slug: Scalars['String'];
195
+ /** Collection type. */
140
196
  type: StoreCollectionType;
141
197
  };
198
+ /** Collection connection pagination information. */
142
199
  export declare type StoreCollectionConnection = {
143
200
  __typename?: 'StoreCollectionConnection';
201
+ /** Array with collection connection page edges. */
144
202
  edges: Array<StoreCollectionEdge>;
203
+ /** Collection connection page information. */
145
204
  pageInfo: StorePageInfo;
146
205
  };
206
+ /** Collection pagination edge. */
147
207
  export declare type StoreCollectionEdge = {
148
208
  __typename?: 'StoreCollectionEdge';
209
+ /** Collection pagination cursor. */
149
210
  cursor: Scalars['String'];
211
+ /** Collection pagination node. */
150
212
  node: StoreCollection;
151
213
  };
214
+ /** Product collection facet, used for search. */
152
215
  export declare type StoreCollectionFacet = {
153
216
  __typename?: 'StoreCollectionFacet';
217
+ /** Facet key. */
154
218
  key: Scalars['String'];
219
+ /** Facet value. */
155
220
  value: Scalars['String'];
156
221
  };
222
+ /** Collection meta information. Used for search. */
157
223
  export declare type StoreCollectionMeta = {
158
224
  __typename?: 'StoreCollectionMeta';
225
+ /** List of selected collection facets. */
159
226
  selectedFacets: Array<StoreCollectionFacet>;
160
227
  };
228
+ /** Product collection type. Possible values are `Department`, `Category`, `Brand` or `Cluster`. */
161
229
  export declare const enum StoreCollectionType {
162
230
  Brand = "Brand",
163
231
  Category = "Category",
164
232
  Cluster = "Cluster",
165
233
  Department = "Department"
166
234
  }
235
+ /** Search facet information. */
167
236
  export declare type StoreFacet = {
168
237
  __typename?: 'StoreFacet';
238
+ /** Facet key. */
169
239
  key: Scalars['String'];
240
+ /** Facet label. */
170
241
  label: Scalars['String'];
242
+ /** Facet type. Possible values are `BOOLEAN` and `RANGE`. */
171
243
  type: StoreFacetType;
244
+ /** Array with information on each facet value. */
172
245
  values: Array<StoreFacetValue>;
173
246
  };
247
+ /** Search facet type. */
174
248
  export declare const enum StoreFacetType {
175
249
  Boolean = "BOOLEAN",
176
250
  Range = "RANGE"
177
251
  }
252
+ /** Information of a specific facet value. */
178
253
  export declare type StoreFacetValue = {
179
254
  __typename?: 'StoreFacetValue';
255
+ /** Facet value label. */
180
256
  label: Scalars['String'];
257
+ /** Number of items with this facet. */
181
258
  quantity: Scalars['Int'];
259
+ /** Indicates whether facet is selected. */
182
260
  selected: Scalars['Boolean'];
261
+ /** Facet value. */
183
262
  value: Scalars['String'];
184
263
  };
264
+ /** Image. */
185
265
  export declare type StoreImage = {
186
266
  __typename?: 'StoreImage';
267
+ /** Alias for the image. */
187
268
  alternateName: Scalars['String'];
269
+ /** Image URL. */
188
270
  url: Scalars['String'];
189
271
  };
272
+ /** Item of a list. */
190
273
  export declare type StoreListItem = {
191
274
  __typename?: 'StoreListItem';
275
+ /** List item value. */
192
276
  item: Scalars['String'];
277
+ /** Name of the list item. */
193
278
  name: Scalars['String'];
279
+ /** Position of the item in the list. */
194
280
  position: Scalars['Int'];
195
281
  };
282
+ /** Offer information. */
196
283
  export declare type StoreOffer = {
197
284
  __typename?: 'StoreOffer';
285
+ /** Offer item availability. */
198
286
  availability: Scalars['String'];
287
+ /** Offer item condition. */
199
288
  itemCondition: Scalars['String'];
289
+ /** Information on the item being offered. */
200
290
  itemOffered: StoreProduct;
291
+ /** This is displayed as the "from" price in the context of promotions' price comparison. This may change before it reaches the shelf. */
201
292
  listPrice: Scalars['Float'];
293
+ /** Also known as spot price. */
202
294
  price: Scalars['Float'];
295
+ /** ISO code of the currency used for the offer prices. */
203
296
  priceCurrency: Scalars['String'];
297
+ /** Next date in which price is scheduled to change. If there is no scheduled change, this will be set a year in the future from current time. */
204
298
  priceValidUntil: Scalars['String'];
299
+ /** Number of items offered. */
205
300
  quantity: Scalars['Int'];
301
+ /** Seller responsible for the offer. */
206
302
  seller: StoreOrganization;
303
+ /** Computed price before applying coupons, taxes or benefits. This may change before it reaches the shelf. */
207
304
  sellingPrice: Scalars['Float'];
208
305
  };
306
+ /** Information of a specific order. */
209
307
  export declare type StoreOrder = {
210
308
  __typename?: 'StoreOrder';
309
+ /** Array with information on each accepted offer. */
211
310
  acceptedOffer: Array<StoreOffer>;
311
+ /** Order shopping cart ID, also known as `orderFormId`. */
212
312
  orderNumber: Scalars['String'];
213
313
  };
314
+ /** Organization. */
214
315
  export declare type StoreOrganization = {
215
316
  __typename?: 'StoreOrganization';
317
+ /** Organization ID. */
216
318
  identifier: Scalars['String'];
217
319
  };
320
+ /** Page information. */
218
321
  export declare type StorePageInfo = {
219
322
  __typename?: 'StorePageInfo';
323
+ /** Page cursor end. */
220
324
  endCursor: Scalars['String'];
325
+ /** Indicates whether next page exists. */
221
326
  hasNextPage: Scalars['Boolean'];
327
+ /** Indicates whether previous page exists. */
222
328
  hasPreviousPage: Scalars['Boolean'];
329
+ /** Page cursor start. */
223
330
  startCursor: Scalars['String'];
331
+ /** Total number of items (products or collections), not pages. */
224
332
  totalCount: Scalars['Int'];
225
333
  };
334
+ /** Client profile data. */
226
335
  export declare type StorePerson = {
227
336
  __typename?: 'StorePerson';
337
+ /** Client email. */
228
338
  email: Scalars['String'];
339
+ /** Client last name. */
229
340
  familyName: Scalars['String'];
341
+ /** Client first name. */
230
342
  givenName: Scalars['String'];
343
+ /** Client ID. */
231
344
  id: Scalars['String'];
232
345
  };
346
+ /** Product information. */
233
347
  export declare type StoreProduct = {
234
348
  __typename?: 'StoreProduct';
349
+ /** Array of additional properties. */
235
350
  additionalProperty: Array<StorePropertyValue>;
351
+ /** Aggregate ratings data. */
236
352
  aggregateRating: StoreAggregateRating;
353
+ /** Product brand. */
237
354
  brand: StoreBrand;
355
+ /** List of items consisting of chain linked web pages, ending with the current page. */
238
356
  breadcrumbList: StoreBreadcrumbList;
357
+ /** Product description. */
239
358
  description: Scalars['String'];
359
+ /** Global Trade Item Number. */
240
360
  gtin: Scalars['String'];
361
+ /** Array of images. */
241
362
  image: Array<StoreImage>;
363
+ /** Indicates product group related to this product. */
242
364
  isVariantOf: StoreProductGroup;
365
+ /** Product name. */
243
366
  name: Scalars['String'];
367
+ /** Aggregate offer information. */
244
368
  offers: StoreAggregateOffer;
369
+ /** Product ID. */
245
370
  productID: Scalars['String'];
371
+ /** Array with review information. */
246
372
  review: Array<StoreReview>;
373
+ /** Meta tag data. */
247
374
  seo: StoreSeo;
375
+ /** Stock Keeping Unit ID. */
248
376
  sku: Scalars['String'];
377
+ /** Corresponding collection URL slug, with which to retrieve this entity. */
249
378
  slug: Scalars['String'];
250
379
  };
380
+ /** Product connection pagination information. */
251
381
  export declare type StoreProductConnection = {
252
382
  __typename?: 'StoreProductConnection';
383
+ /** Array with product connection page edges. */
253
384
  edges: Array<StoreProductEdge>;
385
+ /** Product connection page information. */
254
386
  pageInfo: StorePageInfo;
255
387
  };
388
+ /** Product pagination edge. */
256
389
  export declare type StoreProductEdge = {
257
390
  __typename?: 'StoreProductEdge';
391
+ /** Product pagination cursor. */
258
392
  cursor: Scalars['String'];
393
+ /** Product pagination node. */
259
394
  node: StoreProduct;
260
395
  };
396
+ /** Product group information. */
261
397
  export declare type StoreProductGroup = {
262
398
  __typename?: 'StoreProductGroup';
399
+ /** Array of additional properties. */
263
400
  additionalProperty: Array<StorePropertyValue>;
401
+ /** Array of variants related to product group. */
264
402
  hasVariant: Array<StoreProduct>;
403
+ /** Product group name. */
265
404
  name: Scalars['String'];
405
+ /** Product group ID. */
266
406
  productGroupID: Scalars['String'];
267
407
  };
408
+ /** Properties that can be associated with products and products groups. */
268
409
  export declare type StorePropertyValue = {
269
410
  __typename?: 'StorePropertyValue';
411
+ /** Property name. */
270
412
  name: Scalars['String'];
413
+ /** Property value. */
271
414
  value: Scalars['String'];
272
415
  };
273
416
  export declare type StoreReview = {
@@ -280,10 +423,14 @@ export declare type StoreReviewRating = {
280
423
  bestRating: Scalars['Float'];
281
424
  ratingValue: Scalars['Float'];
282
425
  };
426
+ /** Search result. */
283
427
  export declare type StoreSearchResult = {
284
428
  __typename?: 'StoreSearchResult';
429
+ /** Array of search result facets. */
285
430
  facets: Array<StoreFacet>;
431
+ /** Search result products. */
286
432
  products: StoreProductConnection;
433
+ /** Search result suggestions. */
287
434
  suggestions: StoreSuggestions;
288
435
  };
289
436
  export declare type StoreSeo = {
@@ -293,12 +440,17 @@ export declare type StoreSeo = {
293
440
  title: Scalars['String'];
294
441
  titleTemplate: Scalars['String'];
295
442
  };
443
+ /** Session information. */
296
444
  export declare type StoreSession = {
297
445
  __typename?: 'StoreSession';
446
+ /** Session channel. */
298
447
  channel?: Maybe<Scalars['String']>;
448
+ /** Session country. */
299
449
  country?: Maybe<Scalars['String']>;
450
+ /** Session postal code. */
300
451
  postalCode?: Maybe<Scalars['String']>;
301
452
  };
453
+ /** Product sorting options used in search. */
302
454
  export declare const enum StoreSort {
303
455
  DiscountDesc = "discount_desc",
304
456
  NameAsc = "name_asc",
@@ -314,8 +466,11 @@ export declare const enum StoreStatus {
314
466
  Info = "INFO",
315
467
  Warning = "WARNING"
316
468
  }
469
+ /** Suggestions information. */
317
470
  export declare type StoreSuggestions = {
318
471
  __typename?: 'StoreSuggestions';
472
+ /** Array with suggestion products' information. */
319
473
  products?: Maybe<Array<StoreProduct>>;
474
+ /** Array with suggestion terms. */
320
475
  terms?: Maybe<Array<Scalars['String']>>;
321
476
  };