@faststore/core 3.0.45 → 3.0.46

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 (61) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +23 -23
  3. package/.next/cache/.tsbuildinfo +1 -1
  4. package/.next/cache/config.json +3 -3
  5. package/.next/cache/eslint/.cache_1gneedd +1 -1
  6. package/.next/cache/webpack/client-production/0.pack +0 -0
  7. package/.next/cache/webpack/client-production/index.pack +0 -0
  8. package/.next/cache/webpack/server-production/0.pack +0 -0
  9. package/.next/cache/webpack/server-production/index.pack +0 -0
  10. package/.next/next-minimal-server.js.nft.json +1 -1
  11. package/.next/next-server.js.nft.json +1 -1
  12. package/.next/prerender-manifest.js +1 -1
  13. package/.next/prerender-manifest.json +1 -1
  14. package/.next/react-loadable-manifest.json +1 -1
  15. package/.next/routes-manifest.json +1 -1
  16. package/.next/server/chunks/242.js +1 -1
  17. package/.next/server/chunks/247.js +1 -1
  18. package/.next/server/chunks/646.js +5 -1
  19. package/.next/server/chunks/693.js +1 -1
  20. package/.next/server/middleware-build-manifest.js +1 -1
  21. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  22. package/.next/server/pages/[slug]/p.js +1 -1
  23. package/.next/server/pages/api/graphql.js +1 -1
  24. package/.next/server/pages/en-US/404.html +2 -2
  25. package/.next/server/pages/en-US/404.json +1 -1
  26. package/.next/server/pages/en-US/500.html +2 -2
  27. package/.next/server/pages/en-US/500.json +1 -1
  28. package/.next/server/pages/en-US/account.html +2 -2
  29. package/.next/server/pages/en-US/account.json +1 -1
  30. package/.next/server/pages/en-US/checkout.html +2 -2
  31. package/.next/server/pages/en-US/checkout.json +1 -1
  32. package/.next/server/pages/en-US/login.html +2 -2
  33. package/.next/server/pages/en-US/login.json +1 -1
  34. package/.next/server/pages/en-US/s.html +2 -2
  35. package/.next/server/pages/en-US/s.json +1 -1
  36. package/.next/server/pages/en-US.html +2 -2
  37. package/.next/server/pages/en-US.json +1 -1
  38. package/.next/server/pages-manifest.json +1 -1
  39. package/.next/static/{4d-dhs4ERxMUlufFbhp1E → J-JEiruC8i9aZksBNyDFc}/_buildManifest.js +1 -1
  40. package/.next/static/chunks/104-d968d92fa4902045.js +1 -0
  41. package/.next/static/chunks/247.6eb0f179401e9e2f.js +1 -0
  42. package/.next/static/chunks/pages/[slug]/p-ad60103a8ec2abb7.js +1 -0
  43. package/.next/static/chunks/{webpack-cb411fb5cc9a0449.js → webpack-d993fa4ea18504cc.js} +1 -1
  44. package/.next/trace +91 -91
  45. package/.turbo/turbo-build.log +3 -3
  46. package/.turbo/turbo-test.log +10 -10
  47. package/@generated/gql.ts +4 -4
  48. package/@generated/graphql.ts +15 -3
  49. package/@generated/persisted-documents.json +3 -3
  50. package/@generated/schema.graphql +2 -0
  51. package/cms/faststore/sections.json +22 -0
  52. package/package.json +5 -5
  53. package/src/components/cart/CartItem/CartItem.tsx +4 -1
  54. package/src/components/cart/CartSidebar/CartSidebar.tsx +10 -1
  55. package/src/components/sections/ProductDetails/ProductDetails.tsx +7 -2
  56. package/src/components/ui/ProductDetails/ProductDetailsSettings.tsx +7 -0
  57. package/src/sdk/cart/index.ts +1 -0
  58. package/.next/static/chunks/104-549e3a03338dbf15.js +0 -1
  59. package/.next/static/chunks/247.6f1391104a867395.js +0 -1
  60. package/.next/static/chunks/pages/[slug]/p-7ac0f128969c3df8.js +0 -1
  61. /package/.next/static/{4d-dhs4ERxMUlufFbhp1E → J-JEiruC8i9aZksBNyDFc}/_ssgManifest.js +0 -0
@@ -1,6 +1,6 @@
1
1
  $ yarn partytown & yarn generate && next build
2
- $ faststore generate-graphql -c
3
2
  $ partytown copylib ./public/~partytown
3
+ $ faststore generate-graphql -c
4
4
  Partytown lib copied to: /home/runner/work/faststore/faststore/packages/core/public/~partytown
5
5
  success - GraphQL schema, types, and optimizations successfully generated 🎉
6
6
  ⚠ No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
@@ -38,7 +38,7 @@ Route (pages) Size First Load JS
38
38
  ├ /_app 0 B 93.4 kB
39
39
  ├ ● /[...slug] 4.47 kB 156 kB
40
40
  ├ └ css/4c4d90eb8cb1d2b7.css 7 kB
41
- ├ ● /[slug]/p 11.2 kB 151 kB
41
+ ├ ● /[slug]/p 11.4 kB 151 kB
42
42
  ├ └ css/96e3fddf695d6aa9.css 11.3 kB
43
43
  ├ ○ /404 1.47 kB 127 kB
44
44
  ├ ● /500 1.47 kB 127 kB
@@ -54,7 +54,7 @@ Route (pages) Size First Load JS
54
54
  ├ chunks/framework-8e279965036b6169.js 45.4 kB
55
55
  ├ chunks/main-6f63f6746cc029db.js 33.1 kB
56
56
  ├ chunks/pages/_app-ec0d2e833bd9cea0.js 12.6 kB
57
- ├ chunks/webpack-cb411fb5cc9a0449.js 2.45 kB
57
+ ├ chunks/webpack-d993fa4ea18504cc.js 2.44 kB
58
58
  └ css/5d1f64b61ea581f4.css 3.05 kB
59
59
 
60
60
  λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
@@ -1,23 +1,23 @@
1
1
  $ jest
2
- PASS test/server/index.test.ts (27.363 s)
2
+ PASS test/server/index.test.ts (26.712 s)
3
3
  FastStore GraphQL Layer
4
4
  @faststore/api
5
5
  ✓ should return a valid GraphQL schema (9 ms)
6
- ✓ should return a valid GraphQL schema contain all expected types (6 ms)
7
- ✓ should return a valid GraphQL schema contain all expected queries (1 ms)
8
- ✓ should return a valid GraphQL schema contain all expected mutations (6 ms)
6
+ ✓ should return a valid GraphQL schema contain all expected types (7 ms)
7
+ ✓ should return a valid GraphQL schema contain all expected queries (2 ms)
8
+ ✓ should return a valid GraphQL schema contain all expected mutations
9
9
  VTEX API Extension
10
- ✓ getTypeDefsFromFolder function should return an Array (10 ms)
10
+ ✓ getTypeDefsFromFolder function should return an Array (9 ms)
11
11
  Third Party API Extension
12
- ✓ getTypeDefsFromFolder function should return an Array (8 ms)
12
+ ✓ getTypeDefsFromFolder function should return an Array (9 ms)
13
13
  Final Schema after merging
14
- ✓ should return a valid merged GraphQL schema (34 ms)
14
+ ✓ should return a valid merged GraphQL schema (46 ms)
15
15
  Envelop
16
- ✓ should exist with its plugins (38 ms)
17
- ✓ should handle options and execute (490 ms)
16
+ ✓ should exist with its plugins (50 ms)
17
+ ✓ should handle options and execute (418 ms)
18
18
 
19
19
  Test Suites: 1 passed, 1 total
20
20
  Tests: 9 passed, 9 total
21
21
  Snapshots: 0 total
22
- Time: 27.481 s
22
+ Time: 26.891 s
23
23
  Ran all test suites.
package/@generated/gql.ts CHANGED
@@ -16,7 +16,7 @@ const documents = {
16
16
  types.ProductSummary_ProductFragmentDoc,
17
17
  '\n fragment Filter_facets on StoreFacet {\n ... on StoreFacetRange {\n key\n label\n\n min {\n selected\n absolute\n }\n\n max {\n selected\n absolute\n }\n\n __typename\n }\n ... on StoreFacetBoolean {\n key\n label\n values {\n label\n value\n selected\n quantity\n }\n\n __typename\n }\n }\n':
18
18
  types.Filter_FacetsFragmentDoc,
19
- '\n fragment ProductDetailsFragment_product on StoreProduct {\n id: productID\n sku\n name\n gtin\n description\n\n isVariantOf {\n name\n productGroupID\n skuVariants {\n activeVariations\n slugsMap\n availableVariations\n }\n }\n\n image {\n url\n alternateName\n }\n\n brand {\n name\n }\n\n offers {\n lowPrice\n offers {\n availability\n price\n listPrice\n seller {\n identifier\n }\n }\n }\n\n additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n\n # Contains necessary info to add this item to cart\n ...CartProductItem\n }\n':
19
+ '\n fragment ProductDetailsFragment_product on StoreProduct {\n id: productID\n sku\n name\n gtin\n description\n unitMultiplier\n isVariantOf {\n name\n productGroupID\n skuVariants {\n activeVariations\n slugsMap\n availableVariations\n }\n }\n\n image {\n url\n alternateName\n }\n\n brand {\n name\n }\n\n offers {\n lowPrice\n offers {\n availability\n price\n listPrice\n seller {\n identifier\n }\n }\n }\n\n additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n\n # Contains necessary info to add this item to cart\n ...CartProductItem\n }\n':
20
20
  types.ProductDetailsFragment_ProductFragmentDoc,
21
21
  '\n fragment ClientManyProducts on Query {\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 }\n }\n':
22
22
  types.ClientManyProductsFragmentDoc,
@@ -38,7 +38,7 @@ const documents = {
38
38
  types.ServerCollectionPageQueryDocument,
39
39
  '\n query ServerProductQuery($locator: [IStoreSelectedFacet!]!) {\n ...ServerProduct\n product(locator: $locator) {\n id: productID\n\n seo {\n title\n description\n canonical\n }\n\n brand {\n name\n }\n\n sku\n gtin\n name\n description\n releaseDate\n\n breadcrumbList {\n itemListElement {\n item\n name\n position\n }\n }\n\n image {\n url\n alternateName\n }\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 }\n }\n\n isVariantOf {\n productGroupID\n }\n\n ...ProductDetailsFragment_product\n }\n }\n':
40
40
  types.ServerProductQueryDocument,
41
- '\n mutation ValidateCartMutation($cart: IStoreCart!, $session: IStoreSession!) {\n validateCart(cart: $cart, session: $session) {\n order {\n orderNumber\n acceptedOffer {\n ...CartItem\n }\n }\n messages {\n ...CartMessage\n }\n }\n }\n\n fragment CartMessage on StoreCartMessage {\n text\n status\n }\n\n fragment CartItem on StoreOffer {\n seller {\n identifier\n }\n quantity\n price\n listPrice\n itemOffered {\n ...CartProductItem\n }\n }\n\n fragment CartProductItem on StoreProduct {\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':
41
+ '\n mutation ValidateCartMutation($cart: IStoreCart!, $session: IStoreSession!) {\n validateCart(cart: $cart, session: $session) {\n order {\n orderNumber\n acceptedOffer {\n ...CartItem\n }\n }\n messages {\n ...CartMessage\n }\n }\n }\n\n fragment CartMessage on StoreCartMessage {\n text\n status\n }\n\n fragment CartItem on StoreOffer {\n seller {\n identifier\n }\n quantity\n price\n listPrice\n itemOffered {\n ...CartProductItem\n }\n }\n\n fragment CartProductItem on StoreProduct {\n sku\n name\n unitMultiplier\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':
42
42
  types.ValidateCartMutationDocument,
43
43
  '\n mutation SubscribeToNewsletter($data: IPersonNewsletter!) {\n subscribeToNewsletter(data: $data) {\n id\n }\n }\n':
44
44
  types.SubscribeToNewsletterDocument,
@@ -76,7 +76,7 @@ export function gql(
76
76
  * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
77
77
  */
78
78
  export function gql(
79
- source: '\n fragment ProductDetailsFragment_product on StoreProduct {\n id: productID\n sku\n name\n gtin\n description\n\n isVariantOf {\n name\n productGroupID\n skuVariants {\n activeVariations\n slugsMap\n availableVariations\n }\n }\n\n image {\n url\n alternateName\n }\n\n brand {\n name\n }\n\n offers {\n lowPrice\n offers {\n availability\n price\n listPrice\n seller {\n identifier\n }\n }\n }\n\n additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n\n # Contains necessary info to add this item to cart\n ...CartProductItem\n }\n'
79
+ source: '\n fragment ProductDetailsFragment_product on StoreProduct {\n id: productID\n sku\n name\n gtin\n description\n unitMultiplier\n isVariantOf {\n name\n productGroupID\n skuVariants {\n activeVariations\n slugsMap\n availableVariations\n }\n }\n\n image {\n url\n alternateName\n }\n\n brand {\n name\n }\n\n offers {\n lowPrice\n offers {\n availability\n price\n listPrice\n seller {\n identifier\n }\n }\n }\n\n additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n\n # Contains necessary info to add this item to cart\n ...CartProductItem\n }\n'
80
80
  ): typeof import('./graphql').ProductDetailsFragment_ProductFragmentDoc
81
81
  /**
82
82
  * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
@@ -142,7 +142,7 @@ export function gql(
142
142
  * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
143
143
  */
144
144
  export function gql(
145
- source: '\n mutation ValidateCartMutation($cart: IStoreCart!, $session: IStoreSession!) {\n validateCart(cart: $cart, session: $session) {\n order {\n orderNumber\n acceptedOffer {\n ...CartItem\n }\n }\n messages {\n ...CartMessage\n }\n }\n }\n\n fragment CartMessage on StoreCartMessage {\n text\n status\n }\n\n fragment CartItem on StoreOffer {\n seller {\n identifier\n }\n quantity\n price\n listPrice\n itemOffered {\n ...CartProductItem\n }\n }\n\n fragment CartProductItem on StoreProduct {\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'
145
+ source: '\n mutation ValidateCartMutation($cart: IStoreCart!, $session: IStoreSession!) {\n validateCart(cart: $cart, session: $session) {\n order {\n orderNumber\n acceptedOffer {\n ...CartItem\n }\n }\n messages {\n ...CartMessage\n }\n }\n }\n\n fragment CartMessage on StoreCartMessage {\n text\n status\n }\n\n fragment CartItem on StoreOffer {\n seller {\n identifier\n }\n quantity\n price\n listPrice\n itemOffered {\n ...CartProductItem\n }\n }\n\n fragment CartProductItem on StoreProduct {\n sku\n name\n unitMultiplier\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'
146
146
  ): typeof import('./graphql').ValidateCartMutationDocument
147
147
  /**
148
148
  * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
@@ -927,6 +927,8 @@ export type StoreProduct = {
927
927
  sku: Scalars['String']['output']
928
928
  /** Corresponding collection URL slug, with which to retrieve this entity. */
929
929
  slug: Scalars['String']['output']
930
+ /** Sku Unit Multiplier */
931
+ unitMultiplier: Maybe<Scalars['Float']['output']>
930
932
  }
931
933
 
932
934
  /** Product information. Products are variants within product groups, equivalent to VTEX [SKUs](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. */
@@ -1146,6 +1148,7 @@ export type ProductDetailsFragment_ProductFragment = {
1146
1148
  name: string
1147
1149
  gtin: string
1148
1150
  description: string
1151
+ unitMultiplier: number | null
1149
1152
  id: string
1150
1153
  isVariantOf: {
1151
1154
  name: string
@@ -1227,6 +1230,7 @@ export type ServerProductQueryQuery = {
1227
1230
  name: string
1228
1231
  description: string
1229
1232
  releaseDate: string
1233
+ unitMultiplier: number | null
1230
1234
  id: string
1231
1235
  seo: { title: string; description: string; canonical: string }
1232
1236
  brand: { name: string }
@@ -1283,6 +1287,7 @@ export type ValidateCartMutationMutation = {
1283
1287
  itemOffered: {
1284
1288
  sku: string
1285
1289
  name: string
1290
+ unitMultiplier: number | null
1286
1291
  gtin: string
1287
1292
  image: Array<{ url: string; alternateName: string }>
1288
1293
  brand: { name: string }
@@ -1318,6 +1323,7 @@ export type CartItemFragment = {
1318
1323
  itemOffered: {
1319
1324
  sku: string
1320
1325
  name: string
1326
+ unitMultiplier: number | null
1321
1327
  gtin: string
1322
1328
  image: Array<{ url: string; alternateName: string }>
1323
1329
  brand: { name: string }
@@ -1342,6 +1348,7 @@ export type CartItemFragment = {
1342
1348
  export type CartProductItemFragment = {
1343
1349
  sku: string
1344
1350
  name: string
1351
+ unitMultiplier: number | null
1345
1352
  gtin: string
1346
1353
  image: Array<{ url: string; alternateName: string }>
1347
1354
  brand: { name: string }
@@ -1469,6 +1476,7 @@ export type ClientProductQueryQuery = {
1469
1476
  name: string
1470
1477
  gtin: string
1471
1478
  description: string
1479
+ unitMultiplier: number | null
1472
1480
  id: string
1473
1481
  isVariantOf: {
1474
1482
  name: string
@@ -1705,6 +1713,7 @@ export const CartProductItemFragmentDoc = new TypedDocumentString(
1705
1713
  fragment CartProductItem on StoreProduct {
1706
1714
  sku
1707
1715
  name
1716
+ unitMultiplier
1708
1717
  image {
1709
1718
  url
1710
1719
  alternateName
@@ -1741,6 +1750,7 @@ export const ProductDetailsFragment_ProductFragmentDoc =
1741
1750
  name
1742
1751
  gtin
1743
1752
  description
1753
+ unitMultiplier
1744
1754
  isVariantOf {
1745
1755
  name
1746
1756
  productGroupID
@@ -1779,6 +1789,7 @@ export const ProductDetailsFragment_ProductFragmentDoc =
1779
1789
  fragment CartProductItem on StoreProduct {
1780
1790
  sku
1781
1791
  name
1792
+ unitMultiplier
1782
1793
  image {
1783
1794
  url
1784
1795
  alternateName
@@ -1943,6 +1954,7 @@ export const CartItemFragmentDoc = new TypedDocumentString(
1943
1954
  fragment CartProductItem on StoreProduct {
1944
1955
  sku
1945
1956
  name
1957
+ unitMultiplier
1946
1958
  image {
1947
1959
  url
1948
1960
  alternateName
@@ -1991,7 +2003,7 @@ export const ServerCollectionPageQueryDocument = {
1991
2003
  export const ServerProductQueryDocument = {
1992
2004
  __meta__: {
1993
2005
  operationName: 'ServerProductQuery',
1994
- operationHash: '50155d908ff90781e8c56134ded29b70d7494aa7',
2006
+ operationHash: '3ce56e42296689b601347fedc380c89519355ab7',
1995
2007
  },
1996
2008
  } as unknown as TypedDocumentString<
1997
2009
  ServerProductQueryQuery,
@@ -2000,7 +2012,7 @@ export const ServerProductQueryDocument = {
2000
2012
  export const ValidateCartMutationDocument = {
2001
2013
  __meta__: {
2002
2014
  operationName: 'ValidateCartMutation',
2003
- operationHash: '87e1ba227013cb087bcbb35584c1b0b7cdf612ef',
2015
+ operationHash: '534fae829675533052d75fd4aa509b9cf85b4d40',
2004
2016
  },
2005
2017
  } as unknown as TypedDocumentString<
2006
2018
  ValidateCartMutationMutation,
@@ -2036,7 +2048,7 @@ export const ClientProductGalleryQueryDocument = {
2036
2048
  export const ClientProductQueryDocument = {
2037
2049
  __meta__: {
2038
2050
  operationName: 'ClientProductQuery',
2039
- operationHash: 'a35530c2f55c1c85bd2b4fe4964356ab27e32622',
2051
+ operationHash: 'cedeb0c3e7ec1678400fe2ae930f5a79382fba1e',
2040
2052
  },
2041
2053
  } as unknown as TypedDocumentString<
2042
2054
  ClientProductQueryQuery,
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "4b33c5c07f440dc7489e55619dc2211a13786e72": "fragment ServerCollectionPage on Query { collection(slug: $slug) { id } } query ServerCollectionPageQuery($slug: String!) { collection(slug: $slug) { breadcrumbList { itemListElement { item name position } } meta { selectedFacets { key value } } seo { description title } } ...ServerCollectionPage }",
3
- "50155d908ff90781e8c56134ded29b70d7494aa7": "fragment CartProductItem on StoreProduct { additionalProperty { name propertyID value valueReference } brand { name } gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations availableVariations slugsMap } } name sku } fragment ProductDetailsFragment_product on StoreProduct { additionalProperty { name propertyID value valueReference } brand { name } description gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations availableVariations slugsMap } } name offers { lowPrice offers { availability listPrice price seller { identifier } } } id: productID sku ...CartProductItem } fragment ServerProduct on Query { product(locator: $locator) { id: productID } } query ServerProductQuery($locator: [IStoreSelectedFacet!]!) { product(locator: $locator) { brand { name } breadcrumbList { itemListElement { item name position } } description gtin image { alternateName url } isVariantOf { productGroupID } name offers { highPrice lowPrice offers { availability itemCondition price priceCurrency priceValidUntil seller { identifier } } priceCurrency } id: productID releaseDate seo { canonical description title } sku ...ProductDetailsFragment_product } ...ServerProduct }",
4
- "87e1ba227013cb087bcbb35584c1b0b7cdf612ef": "fragment CartItem on StoreOffer { itemOffered { ...CartProductItem } listPrice price quantity seller { identifier } } fragment CartMessage on StoreCartMessage { status text } fragment CartProductItem on StoreProduct { additionalProperty { name propertyID value valueReference } brand { name } gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations availableVariations slugsMap } } name sku } mutation ValidateCartMutation($cart: IStoreCart!, $session: IStoreSession!) { validateCart(cart: $cart, session: $session) { messages { ...CartMessage } order { acceptedOffer { ...CartItem } orderNumber } } }",
3
+ "3ce56e42296689b601347fedc380c89519355ab7": "fragment CartProductItem on StoreProduct { additionalProperty { name propertyID value valueReference } brand { name } gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations availableVariations slugsMap } } name sku unitMultiplier } fragment ProductDetailsFragment_product on StoreProduct { additionalProperty { name propertyID value valueReference } brand { name } description gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations availableVariations slugsMap } } name offers { lowPrice offers { availability listPrice price seller { identifier } } } id: productID sku unitMultiplier ...CartProductItem } fragment ServerProduct on Query { product(locator: $locator) { id: productID } } query ServerProductQuery($locator: [IStoreSelectedFacet!]!) { product(locator: $locator) { brand { name } breadcrumbList { itemListElement { item name position } } description gtin image { alternateName url } isVariantOf { productGroupID } name offers { highPrice lowPrice offers { availability itemCondition price priceCurrency priceValidUntil seller { identifier } } priceCurrency } id: productID releaseDate seo { canonical description title } sku ...ProductDetailsFragment_product } ...ServerProduct }",
4
+ "534fae829675533052d75fd4aa509b9cf85b4d40": "fragment CartItem on StoreOffer { itemOffered { ...CartProductItem } listPrice price quantity seller { identifier } } fragment CartMessage on StoreCartMessage { status text } fragment CartProductItem on StoreProduct { additionalProperty { name propertyID value valueReference } brand { name } gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations availableVariations slugsMap } } name sku unitMultiplier } mutation ValidateCartMutation($cart: IStoreCart!, $session: IStoreSession!) { validateCart(cart: $cart, session: $session) { messages { ...CartMessage } order { acceptedOffer { ...CartItem } orderNumber } } }",
5
5
  "feb7005103a859e2bc8cf2360d568806fd88deba": "mutation SubscribeToNewsletter($data: IPersonNewsletter!) { subscribeToNewsletter(data: $data) { id } }",
6
6
  "c0d7d2ae1d5aaae5d50eea683b389377c36fb57d": "fragment ClientManyProducts on Query { search( first: $first after: $after sort: $sort term: $term selectedFacets: $selectedFacets ) { products { pageInfo { totalCount } } } } fragment ProductSummary_product on StoreProduct { additionalProperty { name propertyID value valueReference } brand { brandName: name } brand { name } gtin image { alternateName url } isVariantOf { name productGroupID } name offers { lowPrice offers { availability listPrice price quantity seller { identifier } } } id: productID sku slug } query ClientManyProductsQuery($after: String, $first: Int!, $selectedFacets: [IStoreSelectedFacet!]!, $sort: StoreSort!, $term: String!) { search( first: $first after: $after sort: $sort term: $term selectedFacets: $selectedFacets ) { products { edges { node { ...ProductSummary_product } } pageInfo { totalCount } } } ...ClientManyProducts }",
7
7
  "054742a6e1a39f1e09237dcec956879d964f3f20": "fragment ClientProductGallery on Query { search( first: $first after: $after sort: $sort term: $term selectedFacets: $selectedFacets ) { products { pageInfo { totalCount } } } } fragment Filter_facets on StoreFacet { ... on StoreFacetBoolean { __typename key label values { label quantity selected value } } ... on StoreFacetRange { __typename key label max { absolute selected } min { absolute selected } } } fragment SearchEvent_metadata on SearchMetadata { fuzzy isTermMisspelled logicalOperator } query ClientProductGalleryQuery($after: String!, $first: Int!, $selectedFacets: [IStoreSelectedFacet!]!, $sort: StoreSort!, $term: String!) { search( first: $first after: $after sort: $sort term: $term selectedFacets: $selectedFacets ) { facets { ...Filter_facets } metadata { ...SearchEvent_metadata } products { pageInfo { totalCount } } } ...ClientProductGallery }",
8
- "a35530c2f55c1c85bd2b4fe4964356ab27e32622": "fragment CartProductItem on StoreProduct { additionalProperty { name propertyID value valueReference } brand { name } gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations availableVariations slugsMap } } name sku } fragment ClientProduct on Query { product(locator: $locator) { id: productID } } fragment ProductDetailsFragment_product on StoreProduct { additionalProperty { name propertyID value valueReference } brand { name } description gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations availableVariations slugsMap } } name offers { lowPrice offers { availability listPrice price seller { identifier } } } id: productID sku ...CartProductItem } query ClientProductQuery($locator: [IStoreSelectedFacet!]!) { product(locator: $locator) { ...ProductDetailsFragment_product } ...ClientProduct }",
8
+ "cedeb0c3e7ec1678400fe2ae930f5a79382fba1e": "fragment CartProductItem on StoreProduct { additionalProperty { name propertyID value valueReference } brand { name } gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations availableVariations slugsMap } } name sku unitMultiplier } fragment ClientProduct on Query { product(locator: $locator) { id: productID } } fragment ProductDetailsFragment_product on StoreProduct { additionalProperty { name propertyID value valueReference } brand { name } description gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations availableVariations slugsMap } } name offers { lowPrice offers { availability listPrice price seller { identifier } } } id: productID sku unitMultiplier ...CartProductItem } query ClientProductQuery($locator: [IStoreSelectedFacet!]!) { product(locator: $locator) { ...ProductDetailsFragment_product } ...ClientProduct }",
9
9
  "a8a27661f6a032e086c047339e0d0f180f0e0161": "fragment ClientSearchSuggestions on Query { search(first: 5, term: $term, selectedFacets: $selectedFacets) { suggestions { terms { value } } } } fragment ProductSummary_product on StoreProduct { additionalProperty { name propertyID value valueReference } brand { brandName: name } brand { name } gtin image { alternateName url } isVariantOf { name productGroupID } name offers { lowPrice offers { availability listPrice price quantity seller { identifier } } } id: productID sku slug } fragment SearchEvent_metadata on SearchMetadata { fuzzy isTermMisspelled logicalOperator } query ClientSearchSuggestionsQuery($selectedFacets: [IStoreSelectedFacet!], $term: String!) { search(first: 5, term: $term, selectedFacets: $selectedFacets) { metadata { ...SearchEvent_metadata } products { pageInfo { totalCount } } suggestions { products { ...ProductSummary_product } terms { value } } } ...ClientSearchSuggestions }",
10
10
  "e2385b0f11726d0068f96548f57a8dd441c064e3": "fragment ClientTopSearchSuggestions on Query { search(first: 5, term: $term, selectedFacets: $selectedFacets) { suggestions { terms { value } } } } query ClientTopSearchSuggestionsQuery($selectedFacets: [IStoreSelectedFacet!], $term: String!) { search(first: 5, term: $term, selectedFacets: $selectedFacets) { suggestions { terms { value } } } ...ClientTopSearchSuggestions }",
11
11
  "5696202828f9275216a445e316ebf516f168c506": "mutation ValidateSession($search: String!, $session: IStoreSession!) { validateSession(session: $session, search: $search) { addressType channel country currency { code symbol } deliveryMode { deliveryChannel deliveryMethod deliveryWindow { endDate startDate } } geoCoordinates { latitude longitude } locale person { email familyName givenName id } postalCode } }",
@@ -374,6 +374,8 @@ type StoreProduct {
374
374
  additionalProperty: [StorePropertyValue!]!
375
375
  """The product's release date. Formatted using https://en.wikipedia.org/wiki/ISO_8601"""
376
376
  releaseDate: String!
377
+ """Sku Unit Multiplier"""
378
+ unitMultiplier: Float
377
379
  }
378
380
 
379
381
  """Product input. Products are variants within product groups, equivalent to VTEX [SKUs](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."""
@@ -1538,6 +1538,17 @@
1538
1538
  "default": "Description"
1539
1539
  }
1540
1540
  }
1541
+ },
1542
+ "quantitySelector": {
1543
+ "title": "Quantity Selector",
1544
+ "type": "object",
1545
+ "properties": {
1546
+ "useUnitMultiplier": {
1547
+ "title": "Should use unit multiplier?",
1548
+ "type": "boolean",
1549
+ "default": false
1550
+ }
1551
+ }
1541
1552
  }
1542
1553
  }
1543
1554
  }
@@ -1831,6 +1842,17 @@
1831
1842
  }
1832
1843
  }
1833
1844
  }
1845
+ },
1846
+ "quantitySelector": {
1847
+ "title": "Quantity Selector",
1848
+ "type": "object",
1849
+ "properties": {
1850
+ "useUnitMultiplier": {
1851
+ "title": "Should use unit multiplier?",
1852
+ "type": "boolean",
1853
+ "default": false
1854
+ }
1855
+ }
1834
1856
  }
1835
1857
  }
1836
1858
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "3.0.45",
3
+ "version": "3.0.46",
4
4
  "license": "MIT",
5
5
  "repository": "vtex/faststore",
6
6
  "browserslist": "supports es6-module and not dead",
@@ -39,11 +39,11 @@
39
39
  "@envelop/graphql-jit": "^1.1.1",
40
40
  "@envelop/parser-cache": "^2.2.0",
41
41
  "@envelop/validation-cache": "^2.2.0",
42
- "@faststore/api": "^3.0.44",
43
- "@faststore/components": "^3.0.44",
42
+ "@faststore/api": "^3.0.46",
43
+ "@faststore/components": "^3.0.46",
44
44
  "@faststore/graphql-utils": "^3.0.43",
45
45
  "@faststore/sdk": "^3.0.43",
46
- "@faststore/ui": "^3.0.45",
46
+ "@faststore/ui": "^3.0.46",
47
47
  "@graphql-codegen/cli": "^3.3.1",
48
48
  "@graphql-codegen/client-preset": "^4.1.0",
49
49
  "@graphql-codegen/typescript": "^3.0.4",
@@ -124,5 +124,5 @@
124
124
  "node": "18.19.0",
125
125
  "yarn": "1.19.1"
126
126
  },
127
- "gitHead": "1e25e0e810fa378c888e3f16508b94c6e9c0805a"
127
+ "gitHead": "5fdfe48f8a4115b3ff83bd70272d83857ce74c4f"
128
128
  }
@@ -62,9 +62,10 @@ function useCartItemEvent() {
62
62
 
63
63
  interface Props {
64
64
  item: ICartItem
65
+ useUnitMultiplier: boolean
65
66
  }
66
67
 
67
- function CartItem({ item }: Props) {
68
+ function CartItem({ item, useUnitMultiplier = false }: Props) {
68
69
  const btnProps = useRemoveButton(item)
69
70
 
70
71
  const { sendCartItemEvent } = useCartItemEvent()
@@ -97,6 +98,8 @@ function CartItem({ item }: Props) {
97
98
  removeBtnProps={btnProps}
98
99
  data-sku={item.itemOffered.sku}
99
100
  data-seller={item.seller.identifier}
101
+ unitMultiplier={item.itemOffered.unitMultiplier}
102
+ useUnitMultiplier={useUnitMultiplier}
100
103
  >
101
104
  <UICartItemImage>
102
105
  <Image
@@ -69,6 +69,9 @@ export interface CartSidebarProps {
69
69
  alt: string
70
70
  }
71
71
  }
72
+ quantitySelector: {
73
+ useUnitMultiplier?: boolean
74
+ }
72
75
  }
73
76
 
74
77
  function CartSidebar({
@@ -82,6 +85,7 @@ function CartSidebar({
82
85
  loadingLabel: checkoutLoadingLabel,
83
86
  icon: { icon: checkoutButtonIcon, alt: checkoutButtonIconAlt },
84
87
  },
88
+ quantitySelector,
85
89
  }: CartSidebarProps) {
86
90
  const btnProps = useCheckoutButton()
87
91
  const { items, gifts, totalItems, isValidating, subTotal, total } = useCart()
@@ -120,7 +124,12 @@ function CartSidebar({
120
124
  <UICartSidebarList>
121
125
  {items.map((item) => (
122
126
  <li key={item.id}>
123
- <CartItem item={item} />
127
+ <CartItem
128
+ item={item}
129
+ useUnitMultiplier={
130
+ quantitySelector?.useUnitMultiplier ?? false
131
+ }
132
+ />
124
133
  </li>
125
134
  ))}
126
135
  {gifts.length > 0 && (
@@ -51,6 +51,9 @@ export interface ProductDetailsProps {
51
51
  notAvailableButton: {
52
52
  title: string
53
53
  }
54
+ quantitySelector: {
55
+ useUnitMultiplier?: boolean
56
+ }
54
57
  }
55
58
 
56
59
  function ProductDetails({
@@ -71,6 +74,7 @@ function ProductDetails({
71
74
  displayDescription: shouldDisplayProductDescription,
72
75
  },
73
76
  notAvailableButton: { title: notAvailableButtonTitle },
77
+ quantitySelector,
74
78
  }: ProductDetailsProps) {
75
79
  const {
76
80
  DiscountBadge,
@@ -80,9 +84,9 @@ function ProductDetails({
80
84
  __experimentalNotAvailableButton: NotAvailableButton,
81
85
  } = useOverrideComponents<'ProductDetails'>()
82
86
  const { currency } = useSession()
83
- const [quantity, setQuantity] = useState(1)
84
87
  const context = usePDP()
85
88
  const { product, isValidating } = context?.data
89
+ const [quantity, setQuantity] = useState(1)
86
90
 
87
91
  if (!product) {
88
92
  throw new Error('NotFound')
@@ -188,6 +192,7 @@ function ProductDetails({
188
192
  notAvailableButtonTitle={
189
193
  notAvailableButtonTitle ?? NotAvailableButton.props.title
190
194
  }
195
+ useUnitMultiplier={quantitySelector?.useUnitMultiplier ?? false}
191
196
  />
192
197
  </section>
193
198
 
@@ -245,7 +250,7 @@ export const fragment = gql(`
245
250
  name
246
251
  gtin
247
252
  description
248
-
253
+ unitMultiplier
249
254
  isVariantOf {
250
255
  name
251
256
  productGroupID
@@ -5,6 +5,7 @@ import type { ProductDetailsFragment_ProductFragment } from '@generated/graphql'
5
5
 
6
6
  import { useBuyButton } from 'src/sdk/cart/useBuyButton'
7
7
  import { useFormattedPrice } from 'src/sdk/product/useFormattedPrice'
8
+ import config from '../../../../faststore.config'
8
9
 
9
10
  import Selectors from 'src/components/ui/SkuSelector'
10
11
  import AddToCartLoadingSkeleton from './AddToCartLoadingSkeleton'
@@ -22,6 +23,7 @@ interface ProductDetailsSettingsProps {
22
23
  quantity: number
23
24
  setQuantity: Dispatch<SetStateAction<number>>
24
25
  notAvailableButtonTitle: string
26
+ useUnitMultiplier: boolean
25
27
  }
26
28
 
27
29
  function ProductDetailsSettings({
@@ -32,6 +34,7 @@ function ProductDetailsSettings({
32
34
  setQuantity,
33
35
  buyButtonIcon: { icon: buyButtonIconName, alt: buyButtonIconAlt },
34
36
  notAvailableButtonTitle,
37
+ useUnitMultiplier,
35
38
  }: ProductDetailsSettingsProps) {
36
39
  const {
37
40
  BuyButton,
@@ -45,6 +48,7 @@ function ProductDetailsSettings({
45
48
  id,
46
49
  sku,
47
50
  gtin,
51
+ unitMultiplier,
48
52
  name: variantName,
49
53
  brand,
50
54
  isVariantOf,
@@ -70,6 +74,7 @@ function ProductDetailsSettings({
70
74
  brand,
71
75
  isVariantOf,
72
76
  additionalProperty,
77
+ unitMultiplier,
73
78
  },
74
79
  })
75
80
 
@@ -115,6 +120,8 @@ function ProductDetailsSettings({
115
120
  <QuantitySelector.Component
116
121
  min={1}
117
122
  max={10}
123
+ unitMultiplier={useUnitMultiplier ? unitMultiplier : 1}
124
+ useUnitMultiplier={useUnitMultiplier}
118
125
  {...QuantitySelector.props}
119
126
  // Dynamic props shouldn't be overridable
120
127
  // This decision can be reviewed later if needed
@@ -58,6 +58,7 @@ export const ValidateCartMutation = gql(`
58
58
  fragment CartProductItem on StoreProduct {
59
59
  sku
60
60
  name
61
+ unitMultiplier
61
62
  image {
62
63
  url
63
64
  alternateName