@faststore/core 2.0.114-alpha.0 → 2.0.116-alpha.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.
@@ -43,7 +43,7 @@ Route (pages) Size First Load JS
43
43
  + First Load JS shared by all 120 kB
44
44
  ├ chunks/framework-dfd14d7ce6600b03.js 45.3 kB
45
45
  ├ chunks/main-9746772201fe3ac1.js 23.9 kB
46
- ├ chunks/pages/_app-9d067ed89f7a4001.js 25.3 kB
46
+ ├ chunks/pages/_app-1f0f91614f519698.js 25.3 kB
47
47
  ├ chunks/webpack-62b0142505600323.js 2.15 kB
48
48
  └ css/b32231bee7a654b8.css 23.6 kB
49
49
 
@@ -16,69 +16,10 @@ export type Scalars = {
16
16
  Boolean: boolean
17
17
  Int: number
18
18
  Float: number
19
- /**
20
- * Example:
21
- *
22
- * ```json
23
- * {
24
- * Color: 'Red', Size: '42'
25
- * }
26
- * ```
27
- */
28
19
  ActiveVariations: any
29
- /**
30
- * Example:
31
- *
32
- * ```json
33
- * {
34
- * Color: [
35
- * {
36
- * src: "https://storecomponents.vtexassets.com/...",
37
- * alt: "...",
38
- * label: "...",
39
- * value: "..."
40
- * },
41
- * {
42
- * src: "https://storecomponents.vtexassets.com/...",
43
- * alt: "...",
44
- * label: "...",
45
- * value: "..."
46
- * }
47
- * ],
48
- * Size: [
49
- * {
50
- * src: "https://storecomponents.vtexassets.com/...",
51
- * alt: "...",
52
- * label: "...",
53
- * value: "..."
54
- * }
55
- * ]
56
- * }
57
- * ```
58
- */
59
20
  FormattedVariants: any
60
- /** A string or the string representation of an object (a stringified object). */
61
21
  ObjectOrString: any
62
- /**
63
- * Example:
64
- *
65
- * ```json
66
- * {
67
- * 'Color-Red-Size-40': 'classic-shoes-37'
68
- * }
69
- * ```
70
- */
71
22
  SlugsMap: any
72
- /**
73
- * Example:
74
- *
75
- * ```json
76
- * {
77
- * Color: [ "Red", "Blue", "Green" ],
78
- * Size: [ "40", "41" ]
79
- * }
80
- * ```
81
- */
82
23
  VariantsByName: any
83
24
  }
84
25
 
@@ -139,7 +80,7 @@ export type IShippingItem = {
139
80
 
140
81
  /** Shopping cart input. */
141
82
  export type IStoreCart = {
142
- /** Order information, including `orderNumber` and `acceptedOffer`. */
83
+ /** Order information, including `orderNumber`, `acceptedOffer` and `shouldSplitItem`. */
143
84
  order: IStoreOrder
144
85
  }
145
86
 
@@ -178,6 +119,8 @@ export type IStoreOrder = {
178
119
  acceptedOffer: Array<IStoreOffer>
179
120
  /** ID of the order in [VTEX order management](https://help.vtex.com/en/tutorial/license-manager-resources-oms--60QcBsvWeum02cFi3GjBzg#). */
180
121
  orderNumber: Scalars['String']
122
+ /** Indicates whether or not items with attachments should be split. */
123
+ shouldSplitItem: InputMaybe<Scalars['Boolean']>
181
124
  }
182
125
 
183
126
  /** Organization input. */
@@ -423,6 +366,14 @@ export type QueryShippingArgs = {
423
366
  postalCode: Scalars['String']
424
367
  }
425
368
 
369
+ /** Search result. */
370
+ export type SearchMetadata = {
371
+ /** Indicates if the search term was misspelled. */
372
+ isTermMisspelled: Scalars['Boolean']
373
+ /** Logical operator used to run the search. */
374
+ logicalOperator: Scalars['String']
375
+ }
376
+
426
377
  /** Shipping Simulation information. */
427
378
  export type ShippingData = {
428
379
  /** Address information. */
@@ -477,22 +428,26 @@ export type SkuVariants = {
477
428
  * `dominantVariantName` property. Returns all available options for the
478
429
  * dominant property, and only options that can be combined with its current
479
430
  * value for other properties.
431
+ * If `dominantVariantName` is not present, the first variant will be
432
+ * considered the dominant one.
480
433
  */
481
434
  availableVariations: Maybe<Scalars['FormattedVariants']>
482
435
  /**
483
436
  * Maps property value combinations to their respective SKU's slug. Enables
484
437
  * us to retrieve the slug for the SKU that matches the currently selected
485
438
  * variations in O(1) time.
439
+ * If `dominantVariantName` is not present, the first variant will be
440
+ * considered the dominant one.
486
441
  */
487
442
  slugsMap: Maybe<Scalars['SlugsMap']>
488
443
  }
489
444
 
490
445
  export type SkuVariantsAvailableVariationsArgs = {
491
- dominantVariantName: Scalars['String']
446
+ dominantVariantName: InputMaybe<Scalars['String']>
492
447
  }
493
448
 
494
449
  export type SkuVariantsSlugsMapArgs = {
495
- dominantVariantName: Scalars['String']
450
+ dominantVariantName: InputMaybe<Scalars['String']>
496
451
  }
497
452
 
498
453
  /** Aggregate offer information, for a given SKU that is available to be fulfilled by multiple sellers. */
@@ -857,6 +812,8 @@ export type StoreReviewRating = {
857
812
  export type StoreSearchResult = {
858
813
  /** Array of search result facets. */
859
814
  facets: Array<StoreFacet>
815
+ /** Search result metadata. Additional data can be used to send analytics events. */
816
+ metadata: Maybe<SearchMetadata>
860
817
  /** Search result products. */
861
818
  products: StoreProductConnection
862
819
  /** Search result suggestions. */
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "ProductGalleryQuery": "query ProductGalleryQuery($first: Int!, $after: String!, $sort: StoreSort!, $term: String!, $selectedFacets: [IStoreSelectedFacet!]!) {\n search(\n first: $first\n after: $after\n sort: $sort\n term: $term\n selectedFacets: $selectedFacets\n ) {\n products {\n pageInfo {\n totalCount\n }\n }\n facets {\n ... on StoreFacetRange {\n key\n label\n min {\n selected\n absolute\n }\n max {\n selected\n absolute\n }\n __typename\n }\n ... on StoreFacetBoolean {\n key\n label\n values {\n label\n value\n selected\n quantity\n }\n __typename\n }\n }\n }\n}\n",
3
3
  "ServerCollectionPageQuery": "query ServerCollectionPageQuery($slug: String!) {\n collection(slug: $slug) {\n seo {\n title\n description\n }\n breadcrumbList {\n itemListElement {\n item\n name\n position\n }\n }\n meta {\n selectedFacets {\n key\n value\n }\n }\n }\n}\n",
4
- "ServerProductPageQuery": "query ServerProductPageQuery($slug: String!) {\n product(locator: [{key: \"slug\", value: $slug}]) {\n id: productID\n seo {\n title\n description\n canonical\n }\n brand {\n name\n }\n sku\n gtin\n name\n description\n releaseDate\n breadcrumbList {\n itemListElement {\n item\n name\n position\n }\n }\n image {\n url\n alternateName\n }\n offers {\n lowPrice\n highPrice\n priceCurrency\n offers {\n availability\n price\n priceValidUntil\n priceCurrency\n itemCondition\n seller {\n identifier\n }\n listPrice\n }\n }\n isVariantOf {\n productGroupID\n name\n skuVariants {\n activeVariations\n slugsMap(dominantVariantName: \"Color\")\n availableVariations(dominantVariantName: \"Color\")\n }\n }\n additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n }\n}\n",
5
- "ValidateCartMutation": "mutation ValidateCartMutation($cart: IStoreCart!, $session: IStoreSession!) {\n validateCart(cart: $cart, session: $session) {\n order {\n orderNumber\n acceptedOffer {\n seller {\n identifier\n }\n quantity\n price\n listPrice\n itemOffered {\n sku\n name\n image {\n url\n alternateName\n }\n brand {\n name\n }\n isVariantOf {\n productGroupID\n name\n skuVariants {\n activeVariations\n slugsMap(dominantVariantName: \"Color\")\n availableVariations(dominantVariantName: \"Color\")\n }\n }\n gtin\n additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n }\n }\n }\n messages {\n text\n status\n }\n }\n}\n",
4
+ "ServerProductPageQuery": "query ServerProductPageQuery($slug: String!) {\n product(locator: [{key: \"slug\", value: $slug}]) {\n id: productID\n seo {\n title\n description\n canonical\n }\n brand {\n name\n }\n sku\n gtin\n name\n description\n releaseDate\n breadcrumbList {\n itemListElement {\n item\n name\n position\n }\n }\n image {\n url\n alternateName\n }\n offers {\n lowPrice\n highPrice\n priceCurrency\n offers {\n availability\n price\n priceValidUntil\n priceCurrency\n itemCondition\n seller {\n identifier\n }\n listPrice\n }\n }\n isVariantOf {\n productGroupID\n name\n skuVariants {\n activeVariations\n slugsMap\n availableVariations\n }\n }\n additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n }\n}\n",
5
+ "ValidateCartMutation": "mutation ValidateCartMutation($cart: IStoreCart!, $session: IStoreSession!) {\n validateCart(cart: $cart, session: $session) {\n order {\n orderNumber\n acceptedOffer {\n seller {\n identifier\n }\n quantity\n price\n listPrice\n itemOffered {\n sku\n name\n image {\n url\n alternateName\n }\n brand {\n name\n }\n isVariantOf {\n productGroupID\n name\n skuVariants {\n activeVariations\n slugsMap\n availableVariations\n }\n }\n gtin\n additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n }\n }\n }\n messages {\n text\n status\n }\n }\n}\n",
6
6
  "SubscribeToNewsletter": "mutation SubscribeToNewsletter($data: IPersonNewsletter!) {\n subscribeToNewsletter(data: $data) {\n id\n }\n}\n",
7
- "BrowserProductQuery": "query BrowserProductQuery($locator: [IStoreSelectedFacet!]!) {\n product(locator: $locator) {\n id: productID\n sku\n name\n gtin\n description\n isVariantOf {\n name\n productGroupID\n skuVariants {\n activeVariations\n slugsMap(dominantVariantName: \"Color\")\n availableVariations(dominantVariantName: \"Color\")\n }\n }\n image {\n url\n alternateName\n }\n brand {\n name\n }\n offers {\n lowPrice\n offers {\n availability\n price\n listPrice\n seller {\n identifier\n }\n }\n }\n breadcrumbList {\n itemListElement {\n item\n name\n position\n }\n }\n additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n }\n}\n",
7
+ "BrowserProductQuery": "query BrowserProductQuery($locator: [IStoreSelectedFacet!]!) {\n product(locator: $locator) {\n id: productID\n sku\n name\n gtin\n description\n isVariantOf {\n name\n productGroupID\n skuVariants {\n activeVariations\n slugsMap\n availableVariations\n }\n }\n image {\n url\n alternateName\n }\n brand {\n name\n }\n offers {\n lowPrice\n offers {\n availability\n price\n listPrice\n seller {\n identifier\n }\n }\n }\n breadcrumbList {\n itemListElement {\n item\n name\n position\n }\n }\n additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n }\n}\n",
8
8
  "ProductsQuery": "query ProductsQuery($first: Int!, $after: String, $sort: StoreSort!, $term: String!, $selectedFacets: [IStoreSelectedFacet!]!) {\n search(\n first: $first\n after: $after\n sort: $sort\n term: $term\n selectedFacets: $selectedFacets\n ) {\n products {\n pageInfo {\n totalCount\n }\n edges {\n node {\n id: productID\n slug\n sku\n brand {\n brandName: name\n name\n }\n name\n gtin\n isVariantOf {\n productGroupID\n name\n }\n image {\n url\n alternateName\n }\n offers {\n lowPrice\n offers {\n availability\n price\n listPrice\n quantity\n seller {\n identifier\n }\n }\n }\n }\n }\n }\n }\n}\n",
9
9
  "SearchSuggestionsQuery": "query SearchSuggestionsQuery($term: String!, $selectedFacets: [IStoreSelectedFacet!]) {\n search(first: 5, term: $term, selectedFacets: $selectedFacets) {\n suggestions {\n terms {\n value\n }\n products {\n id: productID\n slug\n sku\n brand {\n brandName: name\n name\n }\n name\n gtin\n isVariantOf {\n productGroupID\n name\n }\n image {\n url\n alternateName\n }\n offers {\n lowPrice\n offers {\n availability\n price\n listPrice\n quantity\n seller {\n identifier\n }\n }\n }\n }\n }\n }\n}\n",
10
10
  "TopSearchSuggestionsQuery": "query TopSearchSuggestionsQuery($term: String!, $selectedFacets: [IStoreSelectedFacet!]) {\n search(first: 5, term: $term, selectedFacets: $selectedFacets) {\n suggestions {\n terms {\n value\n }\n }\n }\n}\n",
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
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
+ ## [2.0.116-alpha.0](https://github.com/vtex/faststore/compare/v2.0.115-alpha.0...v2.0.116-alpha.0) (2023-04-26)
7
+
8
+ ### Bug Fixes
9
+
10
+ - Send missing `colorVariant` attribute to `BannerText` ([#1733](https://github.com/vtex/faststore/issues/1733)) ([ddaaaf1](https://github.com/vtex/faststore/commit/ddaaaf1c3e8daa51ea07f4e419f5d2549bf73c12))
11
+
12
+ ## [2.0.115-alpha.0](https://github.com/vtex/faststore/compare/v2.0.114-alpha.0...v2.0.115-alpha.0) (2023-04-25)
13
+
14
+ ### Chores
15
+
16
+ - adds shouldSplitItem as true by default ([#1725](https://github.com/vtex/faststore/issues/1725)) ([c796d72](https://github.com/vtex/faststore/commit/c796d72ab49c5eb79d305b5e4b1946b6645be0de))
17
+
6
18
  ## [2.0.114-alpha.0](https://github.com/vtex/faststore/compare/v2.0.113-alpha.0...v2.0.114-alpha.0) (2023-04-24)
7
19
 
8
20
  **Note:** Version bump only for package @faststore/core
@@ -33,6 +33,14 @@ module.exports = {
33
33
  person: null,
34
34
  },
35
35
 
36
+ // Default cart
37
+ cart: {
38
+ id: '',
39
+ items: [],
40
+ messages: [],
41
+ shouldSplitItem: true,
42
+ },
43
+
36
44
  // Production URLs
37
45
  storeUrl: 'https://vtexfaststore.com',
38
46
  secureSubdomain: 'https://secure.vtexfaststore.com',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "2.0.114-alpha.0",
3
+ "version": "2.0.116-alpha.0",
4
4
  "license": "MIT",
5
5
  "browserslist": "supports es6-module and not dead",
6
6
  "scripts": {
@@ -108,5 +108,5 @@
108
108
  "msw": {
109
109
  "workerDirectory": "public"
110
110
  },
111
- "gitHead": "3d49923a96682db78955fcf81e6f134161de0d40"
111
+ "gitHead": "78ef54af9c9564af42e7bd1730a7ffe893ce9ca7"
112
112
  }
@@ -30,6 +30,7 @@ function BannerText({
30
30
  caption={caption}
31
31
  actionPath={link?.url}
32
32
  actionLabel={link?.text}
33
+ colorVariant={colorVariant}
33
34
  />
34
35
  </Section>
35
36
  )
@@ -1,7 +1,7 @@
1
1
  import { gql } from '@faststore/graphql-utils'
2
+ import type { Cart as SDKCart, CartItem as SDKCartItem } from '@faststore/sdk'
2
3
  import { createCartStore } from '@faststore/sdk'
3
4
  import { useMemo } from 'react'
4
- import type { Cart as SDKCart, CartItem as SDKCartItem } from '@faststore/sdk'
5
5
 
6
6
  import type {
7
7
  CartItemFragment,
@@ -11,6 +11,7 @@ import type {
11
11
  ValidateCartMutationMutationVariables,
12
12
  } from '@generated/graphql'
13
13
 
14
+ import storeConfig from '../../../faststore.config'
14
15
  import { request } from '../graphql/request'
15
16
  import { sessionStore } from '../session'
16
17
  import { createValidationStore, useStore } from '../useStore'
@@ -19,6 +20,7 @@ export interface CartItem extends SDKCartItem, CartItemFragment {}
19
20
 
20
21
  export interface Cart extends SDKCart<CartItem> {
21
22
  messages?: CartMessageFragment[]
23
+ shouldSplitItem?: boolean
22
24
  }
23
25
 
24
26
  export const ValidateCartMutation = gql`
@@ -104,6 +106,7 @@ const validateCart = async (cart: Cart): Promise<Cart | null> => {
104
106
  cart: {
105
107
  order: {
106
108
  orderNumber: cart.id,
109
+ shouldSplitItem: cart.shouldSplitItem,
107
110
  acceptedOffer: cart.items.map(
108
111
  ({
109
112
  price,
@@ -141,14 +144,7 @@ const validateCart = async (cart: Cart): Promise<Cart | null> => {
141
144
  }
142
145
 
143
146
  const [validationStore, onValidate] = createValidationStore(validateCart)
144
- const defaultCartStore = createCartStore<Cart>(
145
- {
146
- id: '',
147
- items: [],
148
- messages: [],
149
- },
150
- onValidate
151
- )
147
+ const defaultCartStore = createCartStore<Cart>(storeConfig.cart, onValidate)
152
148
 
153
149
  export const cartStore = {
154
150
  ...defaultCartStore,