@faststore/core 3.0.147 → 3.0.149

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 (56) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +11 -11
  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/routes-manifest.json +1 -1
  15. package/.next/server/chunks/1972.js +1 -1
  16. package/.next/server/chunks/3157.js +1 -1
  17. package/.next/server/chunks/350.js +1 -1
  18. package/.next/server/chunks/416.js +1 -1
  19. package/.next/server/chunks/5671.js +1 -1
  20. package/.next/server/chunks/6604.js +2 -2
  21. package/.next/server/chunks/9646.js +3 -3
  22. package/.next/server/chunks/UINavbarSlider.js +1 -1
  23. package/.next/server/middleware-build-manifest.js +1 -1
  24. package/.next/server/pages/404.js +1 -1
  25. package/.next/server/pages/500.js +1 -1
  26. package/.next/server/pages/[...slug].js +1 -1
  27. package/.next/server/pages/[slug]/p.js +1 -1
  28. package/.next/server/pages/account.js +1 -1
  29. package/.next/server/pages/api/graphql.js +1 -1
  30. package/.next/server/pages/checkout.js +1 -1
  31. package/.next/server/pages/en-US/404.html +1 -1
  32. package/.next/server/pages/en-US/500.html +1 -1
  33. package/.next/server/pages/en-US/account.html +1 -1
  34. package/.next/server/pages/en-US/checkout.html +1 -1
  35. package/.next/server/pages/en-US/login.html +1 -1
  36. package/.next/server/pages/en-US/s.html +1 -1
  37. package/.next/server/pages/en-US.html +12 -2
  38. package/.next/server/pages/en-US.json +1 -1
  39. package/.next/server/pages/index.js +1 -1
  40. package/.next/server/pages/login.js +1 -1
  41. package/.next/server/pages/s.js +1 -1
  42. package/.next/server/pages-manifest.json +1 -1
  43. package/.next/static/{reGKblCOqNFVd4TEgr48u → FXY4BMwV9Mh3SmDf0ZXt6}/_buildManifest.js +1 -1
  44. package/.next/static/chunks/{61-85c56c64992419d8.js → 61-50a8f2c9459f6971.js} +1 -1
  45. package/.next/trace +99 -99
  46. package/.turbo/turbo-build.log +1 -1
  47. package/.turbo/turbo-lint.log +1 -1
  48. package/.turbo/turbo-test.log +5 -5
  49. package/@generated/gql.ts +2 -2
  50. package/@generated/graphql.ts +5 -2
  51. package/@generated/persisted-documents.json +1 -1
  52. package/@generated/schema.graphql +3 -1
  53. package/package.json +3 -3
  54. package/src/middleware__DISABLED.ts +65 -0
  55. package/src/sdk/cart/index.ts +2 -0
  56. /package/.next/static/{reGKblCOqNFVd4TEgr48u → FXY4BMwV9Mh3SmDf0ZXt6}/_ssgManifest.js +0 -0
@@ -74,4 +74,4 @@ Route (pages) Size First Load JS
74
74
  ○ (Static) automatically rendered as static HTML (uses no initial props)
75
75
  ● (SSG) automatically generated as static HTML + JSON (uses getStaticProps)
76
76
 
77
- Done in 69.85s.
77
+ Done in 69.09s.
@@ -1,4 +1,4 @@
1
1
  yarn run v1.22.22
2
2
  $ next lint
3
3
  ✔ No ESLint warnings or errors
4
- Done in 5.86s.
4
+ Done in 5.74s.
@@ -1,12 +1,12 @@
1
1
  yarn run v1.22.22
2
2
  $ jest
3
- PASS test/server/cms/index.test.ts (33.741 s)
4
- PASS test/utils/multipleTemplates.test.ts (35.13 s)
5
- PASS test/server/index.test.ts (38.233 s)
3
+ PASS test/utils/multipleTemplates.test.ts (33.856 s)
4
+ PASS test/server/cms/index.test.ts (34.196 s)
5
+ PASS test/server/index.test.ts (37.615 s)
6
6
 
7
7
  Test Suites: 3 passed, 3 total
8
8
  Tests: 19 passed, 19 total
9
9
  Snapshots: 0 total
10
- Time: 39.356 s
10
+ Time: 38.824 s
11
11
  Ran all test suites.
12
- Done in 40.97s.
12
+ Done in 40.49s.
package/@generated/gql.ts CHANGED
@@ -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 lowPriceWithTaxes\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 priceWithTaxes\n listPrice\n listPriceWithTaxes\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':
41
+ '\n mutation ValidateCartMutation($cart: IStoreCart!, $session: IStoreSession!) {\n validateCart(cart: $cart, session: $session) {\n order {\n orderNumber\n acceptedOffer {\n ...CartItem\n }\n shouldSplitItem\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 priceWithTaxes\n listPrice\n listPriceWithTaxes\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,
@@ -140,7 +140,7 @@ export function gql(
140
140
  * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
141
141
  */
142
142
  export function gql(
143
- 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 priceWithTaxes\n listPrice\n listPriceWithTaxes\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'
143
+ source: '\n mutation ValidateCartMutation($cart: IStoreCart!, $session: IStoreSession!) {\n validateCart(cart: $cart, session: $session) {\n order {\n orderNumber\n acceptedOffer {\n ...CartItem\n }\n shouldSplitItem\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 priceWithTaxes\n listPrice\n listPriceWithTaxes\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'
144
144
  ): typeof import('./graphql').ValidateCartMutationDocument
145
145
  /**
146
146
  * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
@@ -677,7 +677,7 @@ export type StoreBreadcrumbList = {
677
677
  export type StoreCart = {
678
678
  /** List of shopping cart messages. */
679
679
  messages: Array<StoreCartMessage>
680
- /** Order information, including `orderNumber` and `acceptedOffer`. */
680
+ /** Order information, including `orderNumber`, `acceptedOffer` and `shouldSplitItem`. */
681
681
  order: StoreOrder
682
682
  }
683
683
 
@@ -887,6 +887,8 @@ export type StoreOrder = {
887
887
  acceptedOffer: Array<StoreOffer>
888
888
  /** ID of the order in [VTEX order management](https://help.vtex.com/en/tutorial/license-manager-resources-oms--60QcBsvWeum02cFi3GjBzg#). */
889
889
  orderNumber: Scalars['String']['output']
890
+ /** Indicates whether or not items with attachments should be split. */
891
+ shouldSplitItem: Maybe<Scalars['Boolean']['output']>
890
892
  }
891
893
 
892
894
  /** Organization. */
@@ -1320,6 +1322,7 @@ export type ValidateCartMutationMutation = {
1320
1322
  validateCart: {
1321
1323
  order: {
1322
1324
  orderNumber: string
1325
+ shouldSplitItem: boolean | null
1323
1326
  acceptedOffer: Array<{
1324
1327
  quantity: number
1325
1328
  price: number
@@ -2069,7 +2072,7 @@ export const ServerProductQueryDocument = {
2069
2072
  export const ValidateCartMutationDocument = {
2070
2073
  __meta__: {
2071
2074
  operationName: 'ValidateCartMutation',
2072
- operationHash: '324471076994dca94a47adcaf1c6b8f7896e1b4f',
2075
+ operationHash: 'c2b3f8bff73ebf6ac79d758c66cabbc21ba9fcc0',
2073
2076
  },
2074
2077
  } as unknown as TypedDocumentString<
2075
2078
  ValidateCartMutationMutation,
@@ -1,7 +1,7 @@
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
3
  "46103bee661405bde706d72126fdbf9b0a0c9e6e": "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 lowPriceWithTaxes offers { availability listPrice listPriceWithTaxes price priceWithTaxes 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 lowPriceWithTaxes offers { availability itemCondition price priceCurrency priceValidUntil seller { identifier } } priceCurrency } id: productID releaseDate seo { canonical description title } sku ...ProductDetailsFragment_product } ...ServerProduct }",
4
- "324471076994dca94a47adcaf1c6b8f7896e1b4f": "fragment CartItem on StoreOffer { itemOffered { ...CartProductItem } listPrice listPriceWithTaxes price priceWithTaxes 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 } } }",
4
+ "c2b3f8bff73ebf6ac79d758c66cabbc21ba9fcc0": "fragment CartItem on StoreOffer { itemOffered { ...CartProductItem } listPrice listPriceWithTaxes price priceWithTaxes 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 shouldSplitItem } } }",
5
5
  "feb7005103a859e2bc8cf2360d568806fd88deba": "mutation SubscribeToNewsletter($data: IPersonNewsletter!) { subscribeToNewsletter(data: $data) { id } }",
6
6
  "ad2eb78cfccb9dbd5a9f2d1e150cc70fea5da99a": "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 } advertisement { adId adResponseId } brand { brandName: name } brand { name } gtin image { alternateName url } isVariantOf { name productGroupID } name offers { lowPrice lowPriceWithTaxes offers { availability listPrice listPriceWithTaxes 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
  "177fe68cb385737b0901fc9e105f0a4813e18a20": "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 { isTermMisspelled logicalOperator } query ClientProductGalleryQuery($after: String!, $first: Int!, $selectedFacets: [IStoreSelectedFacet!]!, $sort: StoreSort!, $term: String!) { redirect(term: $term, selectedFacets: $selectedFacets) { url } search( first: $first after: $after sort: $sort term: $term selectedFacets: $selectedFacets ) { facets { ...Filter_facets } metadata { ...SearchEvent_metadata } products { pageInfo { totalCount } } } ...ClientProductGallery }",
@@ -107,7 +107,7 @@ type StoreCartMessage {
107
107
 
108
108
  """Shopping cart information."""
109
109
  type StoreCart {
110
- """Order information, including `orderNumber` and `acceptedOffer`."""
110
+ """Order information, including `orderNumber`, `acceptedOffer` and `shouldSplitItem`."""
111
111
  order: StoreOrder!
112
112
  """List of shopping cart messages."""
113
113
  messages: [StoreCartMessage!]!
@@ -298,6 +298,8 @@ type StoreOrder {
298
298
  orderNumber: String!
299
299
  """Array with information on each accepted offer."""
300
300
  acceptedOffer: [StoreOffer!]!
301
+ """Indicates whether or not items with attachments should be split."""
302
+ shouldSplitItem: Boolean
301
303
  }
302
304
 
303
305
  """Order input."""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "3.0.147",
3
+ "version": "3.0.149",
4
4
  "license": "MIT",
5
5
  "repository": "vtex/faststore",
6
6
  "browserslist": "supports es6-module and not dead",
@@ -43,7 +43,7 @@
43
43
  "@envelop/graphql-jit": "^8.0.3",
44
44
  "@envelop/parser-cache": "^6.0.2",
45
45
  "@envelop/validation-cache": "^6.0.2",
46
- "@faststore/api": "^3.0.140",
46
+ "@faststore/api": "^3.0.149",
47
47
  "@faststore/components": "^3.0.144",
48
48
  "@faststore/graphql-utils": "^3.0.135",
49
49
  "@faststore/lighthouse": "^3.0.135",
@@ -128,5 +128,5 @@
128
128
  "node": "18.19.0",
129
129
  "yarn": "1.19.1"
130
130
  },
131
- "gitHead": "5d3b33b0e294206f3e85574eb64096691a78fcbf"
131
+ "gitHead": "0f328446c751e79479b7e75b2b4c3d9da35ba57c"
132
132
  }
@@ -0,0 +1,65 @@
1
+ /*
2
+ * This middleware is disabled by default. Only stores that are in
3
+ * homebrew and want this functionality will be able to enable it via
4
+ * a feature flag. When the flag is active, the CLI at build time will
5
+ * check whether the ENABLE_REDIRECTS_MIDDLEWARE flag is set or not,
6
+ * if so, the file name will be changed to middleware.ts and nextjs
7
+ * will know how to automatically deal with it.
8
+ */
9
+
10
+ import { NextResponse } from 'next/server'
11
+ import type { NextRequest } from 'next/server'
12
+ import storeConfig from 'discovery.config'
13
+
14
+ type Redirect = {
15
+ from: string
16
+ to: string
17
+ type: 'permanent' | 'temporary'
18
+ }
19
+ interface RedirectsClient {
20
+ get(from: string): Promise<Redirect | null>
21
+ }
22
+
23
+ class DynamoRedirectsClient implements RedirectsClient {
24
+ async get(from: string): Promise<Redirect | null> {
25
+ // TODO: Implement DynamoDB client. Ensure that the cluster has access to DynamoDB first.
26
+ return null
27
+ }
28
+ }
29
+
30
+ const redirectsClient = new DynamoRedirectsClient()
31
+
32
+ export async function middleware(request: NextRequest) {
33
+ const { pathname } = request.nextUrl
34
+
35
+ const redirect = await redirectsClient.get(pathname)
36
+
37
+ if (redirect) {
38
+ const redirectUrl = new URL(redirect.to, storeConfig.storeUrl)
39
+ const redirectStatusCode = redirect.type === 'permanent' ? 301 : 302
40
+
41
+ const response = NextResponse.redirect(redirectUrl, redirectStatusCode)
42
+
43
+ response.headers.set(
44
+ 'Cache-Control',
45
+ 'public, max-age=300, stale-while-revalidate=31536000'
46
+ )
47
+
48
+ return response
49
+ }
50
+
51
+ return NextResponse.next()
52
+ }
53
+
54
+ export const config = {
55
+ matcher: [
56
+ /*
57
+ * Match all request paths except for the ones starting with:
58
+ * - api (API routes)
59
+ * - _next/static (static files)
60
+ * - _next/image (image optimization files)
61
+ * - favicon.ico (favicon file)
62
+ */
63
+ '/((?!api|_next/static|_next/image|favicon.ico).*)',
64
+ ],
65
+ }
@@ -31,6 +31,7 @@ export const ValidateCartMutation = gql(`
31
31
  acceptedOffer {
32
32
  ...CartItem
33
33
  }
34
+ shouldSplitItem
34
35
  }
35
36
  messages {
36
37
  ...CartMessage
@@ -144,6 +145,7 @@ const validateCart = async (cart: Cart): Promise<Cart | null> => {
144
145
  id: getItemId(item),
145
146
  })),
146
147
  messages: validated.messages,
148
+ shouldSplitItem: validated.order.shouldSplitItem,
147
149
  }
148
150
  )
149
151
  }