From 76e80ae902be812e237519520a1b7159f4dab63f Mon Sep 17 00:00:00 2001 From: Eduardo Formiga Date: Wed, 31 Jan 2024 16:03:45 -0300 Subject: [PATCH] Release: 3.x (#2214) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What's the purpose of this pull request? This PR holds the PRs that will be available in 3.x version: - #2184 - #2198 - https://github.com/vtex/faststore/pull/2176 Preview PR - https://github.com/vtex-sites/starter.store/pull/360 --------- Co-authored-by: Fanny Co-authored-by: Ícaro Azevedo Co-authored-by: Mariana Caetano Pereira <67270558+Mariana-Caetano@users.noreply.github.com> --- .gitignore | 4 + .../api-extensions-improvements.mdx | 142 +++ .../extending-queries-using-fragments.mdx | 4 +- package.json | 2 +- packages/api/src/typeDefs/index.ts | 3 +- packages/cli/src/commands/generate-graphql.ts | 12 +- packages/core/.babelrc | 4 - packages/core/.babelrc.js | 12 + packages/core/@generated/gql.ts | 196 +++ .../{graphql/index.ts => graphql.ts} | 970 +++++++++++---- .../core/@generated/graphql/persisted.json | 13 - .../core/@generated/graphql/schema.graphql | 1053 ----------------- packages/core/@generated/index.ts | 1 + packages/core/api/index.ts | 2 +- .../core/cms/faststore/content-types.json | 18 + packages/core/cms/faststore/sections.json | 73 ++ packages/core/codegen.ts | 61 + packages/core/codegen.yml | 23 - packages/core/index.ts | 1 + packages/core/jest.config.js | 10 +- packages/core/next.config.js | 2 + packages/core/package.json | 6 +- .../product/ProductCard/ProductCard.tsx | 8 +- .../src/components/search/Filter/Filter.tsx | 7 +- .../sections/EmptyState/DefaultComponents.ts | 5 + .../sections/EmptyState/EmptyState.tsx | 99 +- .../EmptyState/OverriddenDefaultEmptyState.ts | 15 + .../sections/EmptyState/Overrides.tsx | 14 - .../ProductDetails/ProductDetails.tsx | 12 +- .../core/src/components/ui/Image/Image.tsx | 2 +- .../src/fragments/ClientManyProducts.ts | 6 +- .../src/fragments/ClientProduct.ts | 6 +- .../src/fragments/ClientProductGallery.ts | 6 +- .../src/fragments/ClientSearchSuggestions.ts | 6 +- .../src/fragments/ClientShippingSimulation.ts | 6 +- .../fragments/ClientTopSearchSuggestions.ts | 6 +- .../src/fragments/ServerCollectionPage.ts | 6 +- .../src/fragments/ServerProduct.ts | 6 +- packages/core/src/pages/404.tsx | 62 +- packages/core/src/pages/500.tsx | 66 +- packages/core/src/pages/[...slug].tsx | 8 +- packages/core/src/pages/[slug]/p.tsx | 14 +- packages/core/src/pages/api/graphql.ts | 14 +- packages/core/src/pages/login.tsx | 39 +- packages/core/src/sdk/cart/index.ts | 6 +- .../core/src/sdk/graphql/prefetchQuery.ts | 7 +- packages/core/src/sdk/graphql/request.ts | 75 +- packages/core/src/sdk/graphql/useLazyQuery.ts | 7 +- packages/core/src/sdk/graphql/useQuery.ts | 10 +- .../core/src/sdk/newsletter/useNewsletter.ts | 8 +- .../src/sdk/product/usePageProductsQuery.ts | 6 +- .../src/sdk/product/useProductGalleryQuery.ts | 18 +- .../core/src/sdk/product/useProductQuery.ts | 6 +- .../src/sdk/product/useProductsPrefetch.ts | 8 +- .../core/src/sdk/product/useProductsQuery.ts | 7 +- .../core/src/sdk/search/useSuggestions.ts | 6 +- packages/core/src/sdk/search/useTopSearch.ts | 7 +- packages/core/src/sdk/session/index.ts | 8 +- packages/core/src/sdk/shipping/index.ts | 6 +- packages/core/src/server/generator/schema.ts | 2 +- packages/core/src/server/index.ts | 17 +- packages/core/src/typings/overrides.ts | 5 +- packages/core/test/server/index.test.ts | 7 +- packages/graphql-utils/babel.js | 1 - packages/graphql-utils/codegen.js | 1 - packages/graphql-utils/src/babel.ts | 71 -- packages/graphql-utils/src/codegen.ts | 51 - packages/graphql-utils/src/index.ts | 62 +- yarn.lock | 483 ++++++-- 69 files changed, 2039 insertions(+), 1871 deletions(-) create mode 100644 apps/site/pages/docs/api-extensions/api-extensions-improvements.mdx delete mode 100644 packages/core/.babelrc create mode 100644 packages/core/.babelrc.js create mode 100644 packages/core/@generated/gql.ts rename packages/core/@generated/{graphql/index.ts => graphql.ts} (64%) delete mode 100644 packages/core/@generated/graphql/persisted.json delete mode 100644 packages/core/@generated/graphql/schema.graphql create mode 100644 packages/core/@generated/index.ts create mode 100644 packages/core/codegen.ts delete mode 100644 packages/core/codegen.yml create mode 100644 packages/core/src/components/sections/EmptyState/DefaultComponents.ts create mode 100644 packages/core/src/components/sections/EmptyState/OverriddenDefaultEmptyState.ts delete mode 100644 packages/core/src/components/sections/EmptyState/Overrides.tsx delete mode 100644 packages/graphql-utils/babel.js delete mode 100644 packages/graphql-utils/codegen.js delete mode 100644 packages/graphql-utils/src/babel.ts delete mode 100644 packages/graphql-utils/src/codegen.ts diff --git a/.gitignore b/.gitignore index 9a50a7481d..a5199c5671 100644 --- a/.gitignore +++ b/.gitignore @@ -89,6 +89,10 @@ packages/gatsby-**/**/*.json !packages/gatsby-**/package.json !packages/gatsby-**/tsconfig.json +# autogen graphql files +packages/core/@generated/schema.graphql +packages/core/@generated/persisted-documents.json + # lighthouse CI autogen files .lighthouseci diff --git a/apps/site/pages/docs/api-extensions/api-extensions-improvements.mdx b/apps/site/pages/docs/api-extensions/api-extensions-improvements.mdx new file mode 100644 index 0000000000..f75cf9b0c5 --- /dev/null +++ b/apps/site/pages/docs/api-extensions/api-extensions-improvements.mdx @@ -0,0 +1,142 @@ +# Improvements to API extensions - v3.0.0 + +In this guide, learn how to migrate your store version to v3.0.0 to leverage the latest improvements in the API extension. + +Version 3.0.0 and above, introduces the following enhancements to API extension users: + +- Deprecation of the `@faststore/graphql-utils` package in favor of the [`client-preset`](https://the-guild.dev/graphql/codegen/plugins/presets/preset-client) plugin. + +- Refinement `gql` helper usage for a smoother and more efficient GraphQL query handling. + +- Enhancement security measures to a more secure method for invoking queries and mutations to safeguard your store's data. + +- Optimization call processes for queries or mutations defined within `@faststore/core`. + +import { Callout } from 'nextra/components' + + + For more details about these changes, also refer to the [GitHub + releases](/tbd) related to this version. + + +The `@faststore/graphql-utils` has been replaced by open-source solutions maintained by the community that are now re-exported from `@faststore/core`. There are minor breaking changes on how developers should write GraphQL definitions and invoke queries and mutations, which were introduced in version 3.0.0. + +## Before you begin + +Make sure your store version is updated to v3.0.0 or above. If it’s not updated follow the instructions below: + +1. Open your store code and navigate to the `package.json` file. + +2. In `dependencies` > `@faststore/core`, change the version to the following: + +```json +"@faststore/core": "^3.0.0", +``` + +3. Open the terminal and run `yarn` to update the version. + +## Updating the `gql` helper usage + +The `gql` helper serves as a function to define GraphQL operations such as queries, mutations, or fragments within the store code. Before, the function was imported directly from the `@faststore/graphql-utils` which was not recommended. See the example below: + +```tsx filename="src/fragments/ClientProduct.tsx" +import { gql } from '@faststore/graphql-utils' + +export const fragment = gql` + fragment ClientProduct on Query { + product(locator: $locator) { + id: productID + breadcrumbList { + itemListElement { + item + name + position + } + } + } + } +` +``` + +Now with the v3.0.0, you should import the `gql` helper from `@faststore/core/api`and be called as a function - with the argument between parenthesis. This also applies to query and mutation definitions inside the components. For example: + +```tsx filename="src/fragments/ClientProduct.tsx" {1} +import { gql } from '@faststore/core/api' + +export const fragment = gql(` + fragment ClientProduct on Query { + product(locator: $locator) { + id: productID + breadcrumbList { + itemListElement { + item + name + position + } + } + } + } +`) +``` + +## Using `useQuery` hook to call queries and mutations + +Previously, it was possible to invoke queries and mutations by using their names - such as `MyCustomQuery` by providing it to the `useQuery` hook. For example: + +```tsx +import { useQuery_unstable as useQuery } from '@faststore/core/experimental' + +const query = gql(` + query MyCustomQuery { + customQuery() { + data + } + } +`) + +// The useQuery call will now throw an error +function CustomComponent() { + // ... + const result = useQuery(`MyCustomQuery`, variables) + // ... +} +``` + +With v3.0.0, queries and mutations are now only invoked using more secure hashes, which are randomly generated and do to that you must pass the query or mutation object - result of the `gql` call - to `useQuery` directly. For example: + +```tsx +import { gql } from '@faststore/core/api' +import { useQuery_unstable as useQuery } from '@faststore/core/experimental' + +const query = gql(` + query MyCustomQuery { + customQuery() { + data + } + } +`) + +// useQuery apropriately calls MyCustomQuery +function CustomComponent() { + // ... + const result = useQuery(query, variables) + // ... +} +``` + +### Calling queries or mutations defined by `@faststore/core` + +A custom component can call a query or mutation defined by `@faststore/core`, such as `ClientManyProductsQuery`. In these cases, you replace the `useQuery` hook call with a call to the specific hook for that query. + + + The availability of such hooks is limited. + +```tsx +import { useClientManyProducts_unstable as useClientManyProducts } from '@faststore/core/experimental' + +// ClientManyProductsQuery will be called with the variables passed by CustomComponent +function CustomComponent() { +// ... +const result = useClientManyProducts(variables) +// ... +} diff --git a/apps/site/pages/docs/api-extensions/extending-queries-using-fragments.mdx b/apps/site/pages/docs/api-extensions/extending-queries-using-fragments.mdx index 3184b87c2e..92a7004cc1 100644 --- a/apps/site/pages/docs/api-extensions/extending-queries-using-fragments.mdx +++ b/apps/site/pages/docs/api-extensions/extending-queries-using-fragments.mdx @@ -62,13 +62,13 @@ In the `ServerProduct.ts` file, define the GraphQL fragment corresponding to the import { gql } from '@faststore/core/api' -export const fragment = gql` +export const fragment = gql(` fragment ServerProduct on Query { product(locator: $locator) { customData } } -` +`) ``` Now, you can consume `customData` by following the [Consuming FastStore API extension with custom components](/docs/api-extensions/consuming-api-extensions) guide. diff --git a/package.json b/package.json index 8517b3c793..f81e1057e8 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "lint": "turbo run lint", "test": "turbo run test", "size": "turbo run size", - "release": "lerna version patch --yes && lerna publish from-git --yes", + "release": "lerna version major --yes && lerna publish from-git --yes", "clean": "turbo run clean && rm -rf node_modules", "format": "prettier --ignore-path .gitignore --write \"**/*.{js,jsx,ts,tsx,md}\"" }, diff --git a/packages/api/src/typeDefs/index.ts b/packages/api/src/typeDefs/index.ts index df688d4b09..e39deecb03 100644 --- a/packages/api/src/typeDefs/index.ts +++ b/packages/api/src/typeDefs/index.ts @@ -2,7 +2,6 @@ import { print } from 'graphql' import { loadFilesSync } from '@graphql-tools/load-files' -// Empty string ('') is interpreted as the current dir. Referencing it as './' won't work. -export const typeDefs = loadFilesSync('', { extensions: ['.graphql'] }) +export const typeDefs = loadFilesSync(__dirname, { extensions: ['.graphql'] }) .map(print) .join('\n') diff --git a/packages/cli/src/commands/generate-graphql.ts b/packages/cli/src/commands/generate-graphql.ts index dd38a99854..4bc0dc1f66 100644 --- a/packages/cli/src/commands/generate-graphql.ts +++ b/packages/cli/src/commands/generate-graphql.ts @@ -2,7 +2,7 @@ import { Command, Flags } from '@oclif/core' import { existsSync } from 'fs-extra' import chalk from 'chalk' -import { tmpDir } from '../utils/directory' +import { coreDir, tmpDir } from '../utils/directory' import { runCommandSync } from '../utils/runCommandSync' export default class GenerateGraphql extends Command { @@ -54,6 +54,16 @@ export default class GenerateGraphql extends Command { cwd: isCore ? undefined : tmpDir, }) + // yarn generate:copy-back expects the DESTINATION var to be present so it can copy the files to the correct directory + runCommandSync({ + cmd: `DESTINATION=${coreDir} yarn generate:copy-back`, + errorMessage: + "Failed to copy back typings files. 'yarn generate:copy-back' thrown errors", + throws: 'warning', + debug, + cwd: isCore ? undefined : tmpDir, + }) + console.log( `${chalk.green( 'success' diff --git a/packages/core/.babelrc b/packages/core/.babelrc deleted file mode 100644 index e41f28154f..0000000000 --- a/packages/core/.babelrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "presets": ["next/babel"], - "plugins": ["@faststore/graphql-utils/babel"] -} diff --git a/packages/core/.babelrc.js b/packages/core/.babelrc.js new file mode 100644 index 0000000000..e371e2bac4 --- /dev/null +++ b/packages/core/.babelrc.js @@ -0,0 +1,12 @@ +const { babelOptimizerPlugin } = require('@graphql-codegen/client-preset') + +module.exports = { + presets: ['next/babel'], + /** Replaces gql function calls for imports to the document data */ + plugins: [ + [ + babelOptimizerPlugin, + { artifactDirectory: './@generated', gqlTagName: 'gql' }, + ], + ], +} diff --git a/packages/core/@generated/gql.ts b/packages/core/@generated/gql.ts new file mode 100644 index 0000000000..21a1bdc583 --- /dev/null +++ b/packages/core/@generated/gql.ts @@ -0,0 +1,196 @@ +/* eslint-disable */ +import * as types from './graphql' + +/** + * Map of all GraphQL operations in the project. + * + * This map has several performance disadvantages: + * 1. It is not tree-shakeable, so it will include all operations in the project. + * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle. + * 3. It does not support dead code elimination, so it will add unused operations. + * + * Therefore it is highly recommended to use the babel or swc plugin for production. + */ +const documents = { + '\n fragment ProductSummary_product on StoreProduct {\n id: productID\n slug\n sku\n brand {\n brandName: name\n }\n name\n gtin\n\n isVariantOf {\n productGroupID\n name\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 quantity\n seller {\n identifier\n }\n }\n }\n }\n': + types.ProductSummary_ProductFragmentDoc, + '\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': + types.Filter_FacetsFragmentDoc, + '\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 # Contains necessary info to add this item to cart\n ...CartProductItem\n }\n': + types.ProductDetailsFragment_ProductFragmentDoc, + '\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': + types.ClientManyProductsFragmentDoc, + '\n fragment ClientProduct on Query {\n product(locator: $locator) {\n id: productID\n }\n }\n': + types.ClientProductFragmentDoc, + '\n fragment ClientProductGallery 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': + types.ClientProductGalleryFragmentDoc, + '\n fragment ClientSearchSuggestions on Query {\n search(first: 5, term: $term, selectedFacets: $selectedFacets) {\n suggestions {\n terms {\n value\n }\n }\n }\n }\n': + types.ClientSearchSuggestionsFragmentDoc, + '\n fragment ClientShippingSimulation on Query {\n shipping(items: $items, postalCode: $postalCode, country: $country) {\n address {\n city\n }\n }\n }\n': + types.ClientShippingSimulationFragmentDoc, + '\n fragment ClientTopSearchSuggestions on Query {\n search(first: 5, term: $term, selectedFacets: $selectedFacets) {\n suggestions {\n terms {\n value\n }\n }\n }\n }\n': + types.ClientTopSearchSuggestionsFragmentDoc, + '\n fragment ServerCollectionPage on Query {\n collection(slug: $slug) {\n id\n }\n }\n': + types.ServerCollectionPageFragmentDoc, + '\n fragment ServerProduct on Query {\n product(locator: $locator) {\n id: productID\n }\n }\n': + types.ServerProductFragmentDoc, + '\n query ServerCollectionPageQuery($slug: String!) {\n ...ServerCollectionPage\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': + types.ServerCollectionPageQueryDocument, + '\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': + types.ServerProductQueryDocument, + '\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': + types.ValidateCartMutationDocument, + '\n mutation SubscribeToNewsletter($data: IPersonNewsletter!) {\n subscribeToNewsletter(data: $data) {\n id\n }\n }\n': + types.SubscribeToNewsletterDocument, + '\n query ClientManyProductsQuery(\n $first: Int!\n $after: String\n $sort: StoreSort!\n $term: String!\n $selectedFacets: [IStoreSelectedFacet!]!\n ) {\n ...ClientManyProducts\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 ...ProductSummary_product\n }\n }\n }\n }\n }\n': + types.ClientManyProductsQueryDocument, + '\n query ClientProductGalleryQuery(\n $first: Int!\n $after: String!\n $sort: StoreSort!\n $term: String!\n $selectedFacets: [IStoreSelectedFacet!]!\n ) {\n ...ClientProductGallery\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 ...Filter_facets\n }\n metadata {\n ...SearchEvent_metadata\n }\n }\n }\n\n fragment SearchEvent_metadata on SearchMetadata {\n isTermMisspelled\n logicalOperator\n }\n': + types.ClientProductGalleryQueryDocument, + '\n query ClientProductQuery($locator: [IStoreSelectedFacet!]!) {\n ...ClientProduct\n product(locator: $locator) {\n ...ProductDetailsFragment_product\n }\n }\n': + types.ClientProductQueryDocument, + '\n query ClientSearchSuggestionsQuery(\n $term: String!\n $selectedFacets: [IStoreSelectedFacet!]\n ) {\n ...ClientSearchSuggestions\n search(first: 5, term: $term, selectedFacets: $selectedFacets) {\n suggestions {\n terms {\n value\n }\n products {\n ...ProductSummary_product\n }\n }\n products {\n pageInfo {\n totalCount\n }\n }\n metadata {\n ...SearchEvent_metadata\n }\n }\n }\n': + types.ClientSearchSuggestionsQueryDocument, + '\n query ClientTopSearchSuggestionsQuery(\n $term: String!\n $selectedFacets: [IStoreSelectedFacet!]\n ) {\n ...ClientTopSearchSuggestions\n search(first: 5, term: $term, selectedFacets: $selectedFacets) {\n suggestions {\n terms {\n value\n }\n }\n }\n }\n': + types.ClientTopSearchSuggestionsQueryDocument, + '\n mutation ValidateSession($session: IStoreSession!, $search: String!) {\n validateSession(session: $session, search: $search) {\n locale\n channel\n country\n addressType\n postalCode\n deliveryMode {\n deliveryChannel\n deliveryMethod\n deliveryWindow {\n startDate\n endDate\n }\n }\n geoCoordinates {\n latitude\n longitude\n }\n currency {\n code\n symbol\n }\n person {\n id\n email\n givenName\n familyName\n }\n }\n }\n': + types.ValidateSessionDocument, + '\n query ClientShippingSimulationQuery(\n $postalCode: String!\n $country: String!\n $items: [IShippingItem!]!\n ) {\n ...ClientShippingSimulation\n shipping(items: $items, postalCode: $postalCode, country: $country) {\n logisticsInfo {\n slas {\n carrier\n price\n availableDeliveryWindows {\n startDateUtc\n endDateUtc\n price\n listPrice\n }\n shippingEstimate\n localizedEstimates\n }\n }\n address {\n city\n neighborhood\n state\n }\n }\n }\n': + types.ClientShippingSimulationQueryDocument, +} + +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql( + source: '\n fragment ProductSummary_product on StoreProduct {\n id: productID\n slug\n sku\n brand {\n brandName: name\n }\n name\n gtin\n\n isVariantOf {\n productGroupID\n name\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 quantity\n seller {\n identifier\n }\n }\n }\n }\n' +): typeof import('./graphql').ProductSummary_ProductFragmentDoc +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql( + source: '\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' +): typeof import('./graphql').Filter_FacetsFragmentDoc +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql( + 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 # Contains necessary info to add this item to cart\n ...CartProductItem\n }\n' +): typeof import('./graphql').ProductDetailsFragment_ProductFragmentDoc +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql( + source: '\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' +): typeof import('./graphql').ClientManyProductsFragmentDoc +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql( + source: '\n fragment ClientProduct on Query {\n product(locator: $locator) {\n id: productID\n }\n }\n' +): typeof import('./graphql').ClientProductFragmentDoc +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql( + source: '\n fragment ClientProductGallery 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' +): typeof import('./graphql').ClientProductGalleryFragmentDoc +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql( + source: '\n fragment ClientSearchSuggestions on Query {\n search(first: 5, term: $term, selectedFacets: $selectedFacets) {\n suggestions {\n terms {\n value\n }\n }\n }\n }\n' +): typeof import('./graphql').ClientSearchSuggestionsFragmentDoc +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql( + source: '\n fragment ClientShippingSimulation on Query {\n shipping(items: $items, postalCode: $postalCode, country: $country) {\n address {\n city\n }\n }\n }\n' +): typeof import('./graphql').ClientShippingSimulationFragmentDoc +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql( + source: '\n fragment ClientTopSearchSuggestions on Query {\n search(first: 5, term: $term, selectedFacets: $selectedFacets) {\n suggestions {\n terms {\n value\n }\n }\n }\n }\n' +): typeof import('./graphql').ClientTopSearchSuggestionsFragmentDoc +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql( + source: '\n fragment ServerCollectionPage on Query {\n collection(slug: $slug) {\n id\n }\n }\n' +): typeof import('./graphql').ServerCollectionPageFragmentDoc +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql( + source: '\n fragment ServerProduct on Query {\n product(locator: $locator) {\n id: productID\n }\n }\n' +): typeof import('./graphql').ServerProductFragmentDoc +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql( + source: '\n query ServerCollectionPageQuery($slug: String!) {\n ...ServerCollectionPage\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' +): typeof import('./graphql').ServerCollectionPageQueryDocument +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql( + source: '\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' +): typeof import('./graphql').ServerProductQueryDocument +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql( + 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' +): typeof import('./graphql').ValidateCartMutationDocument +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql( + source: '\n mutation SubscribeToNewsletter($data: IPersonNewsletter!) {\n subscribeToNewsletter(data: $data) {\n id\n }\n }\n' +): typeof import('./graphql').SubscribeToNewsletterDocument +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql( + source: '\n query ClientManyProductsQuery(\n $first: Int!\n $after: String\n $sort: StoreSort!\n $term: String!\n $selectedFacets: [IStoreSelectedFacet!]!\n ) {\n ...ClientManyProducts\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 ...ProductSummary_product\n }\n }\n }\n }\n }\n' +): typeof import('./graphql').ClientManyProductsQueryDocument +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql( + source: '\n query ClientProductGalleryQuery(\n $first: Int!\n $after: String!\n $sort: StoreSort!\n $term: String!\n $selectedFacets: [IStoreSelectedFacet!]!\n ) {\n ...ClientProductGallery\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 ...Filter_facets\n }\n metadata {\n ...SearchEvent_metadata\n }\n }\n }\n\n fragment SearchEvent_metadata on SearchMetadata {\n isTermMisspelled\n logicalOperator\n }\n' +): typeof import('./graphql').ClientProductGalleryQueryDocument +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql( + source: '\n query ClientProductQuery($locator: [IStoreSelectedFacet!]!) {\n ...ClientProduct\n product(locator: $locator) {\n ...ProductDetailsFragment_product\n }\n }\n' +): typeof import('./graphql').ClientProductQueryDocument +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql( + source: '\n query ClientSearchSuggestionsQuery(\n $term: String!\n $selectedFacets: [IStoreSelectedFacet!]\n ) {\n ...ClientSearchSuggestions\n search(first: 5, term: $term, selectedFacets: $selectedFacets) {\n suggestions {\n terms {\n value\n }\n products {\n ...ProductSummary_product\n }\n }\n products {\n pageInfo {\n totalCount\n }\n }\n metadata {\n ...SearchEvent_metadata\n }\n }\n }\n' +): typeof import('./graphql').ClientSearchSuggestionsQueryDocument +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql( + source: '\n query ClientTopSearchSuggestionsQuery(\n $term: String!\n $selectedFacets: [IStoreSelectedFacet!]\n ) {\n ...ClientTopSearchSuggestions\n search(first: 5, term: $term, selectedFacets: $selectedFacets) {\n suggestions {\n terms {\n value\n }\n }\n }\n }\n' +): typeof import('./graphql').ClientTopSearchSuggestionsQueryDocument +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql( + source: '\n mutation ValidateSession($session: IStoreSession!, $search: String!) {\n validateSession(session: $session, search: $search) {\n locale\n channel\n country\n addressType\n postalCode\n deliveryMode {\n deliveryChannel\n deliveryMethod\n deliveryWindow {\n startDate\n endDate\n }\n }\n geoCoordinates {\n latitude\n longitude\n }\n currency {\n code\n symbol\n }\n person {\n id\n email\n givenName\n familyName\n }\n }\n }\n' +): typeof import('./graphql').ValidateSessionDocument +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql( + source: '\n query ClientShippingSimulationQuery(\n $postalCode: String!\n $country: String!\n $items: [IShippingItem!]!\n ) {\n ...ClientShippingSimulation\n shipping(items: $items, postalCode: $postalCode, country: $country) {\n logisticsInfo {\n slas {\n carrier\n price\n availableDeliveryWindows {\n startDateUtc\n endDateUtc\n price\n listPrice\n }\n shippingEstimate\n localizedEstimates\n }\n }\n address {\n city\n neighborhood\n state\n }\n }\n }\n' +): typeof import('./graphql').ClientShippingSimulationQueryDocument + +export function gql(source: string) { + return (documents as any)[source] ?? {} +} diff --git a/packages/core/@generated/graphql/index.ts b/packages/core/@generated/graphql.ts similarity index 64% rename from packages/core/@generated/graphql/index.ts rename to packages/core/@generated/graphql.ts index 61a5e939d8..25e981a44a 100644 --- a/packages/core/@generated/graphql/index.ts +++ b/packages/core/@generated/graphql.ts @@ -1,3 +1,5 @@ +/* eslint-disable */ +import { DocumentTypeDecoration } from '@graphql-typed-document-node/core' export type Maybe = T | null export type InputMaybe = Maybe export type Exact = { @@ -9,13 +11,22 @@ export type MakeOptional = Omit & { export type MakeMaybe = Omit & { [SubKey in K]: Maybe } +export type MakeEmpty< + T extends { [key: string]: unknown }, + K extends keyof T +> = { [_ in K]?: never } +export type Incremental = + | T + | { + [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never + } /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { - ID: string - String: string - Boolean: boolean - Int: number - Float: number + ID: { input: string; output: string } + String: { input: string; output: string } + Boolean: { input: boolean; output: boolean } + Int: { input: number; output: number } + Float: { input: number; output: number } /** * Example: * @@ -25,7 +36,7 @@ export type Scalars = { * } * ``` */ - ActiveVariations: any + ActiveVariations: { input: any; output: any } /** * Example: * @@ -56,8 +67,8 @@ export type Scalars = { * } * ``` */ - FormattedVariants: any - ObjectOrString: any + FormattedVariants: { input: any; output: any } + ObjectOrString: { input: any; output: any } /** * Example: * @@ -67,7 +78,7 @@ export type Scalars = { * } * ``` */ - SlugsMap: any + SlugsMap: { input: any; output: any } /** * Example: * @@ -78,82 +89,82 @@ export type Scalars = { * } * ``` */ - VariantsByName: any + VariantsByName: { input: any; output: any } } /** Address information. */ export type Address = { /** Address city */ - city: Maybe + city: Maybe /** Address complement */ - complement: Maybe + complement: Maybe /** Address country */ - country: Maybe + country: Maybe /** Address geoCoordinates */ - geoCoordinates: Maybe>> + geoCoordinates: Maybe>> /** Address neighborhood */ - neighborhood: Maybe + neighborhood: Maybe /** Address number */ - number: Maybe + number: Maybe /** Address postal code */ - postalCode: Maybe + postalCode: Maybe /** Address reference */ - reference: Maybe + reference: Maybe /** Address state */ - state: Maybe + state: Maybe /** Address street */ - street: Maybe + street: Maybe } export type AvailableDeliveryWindows = { /** Available delivery window end date in UTC */ - endDateUtc: Maybe + endDateUtc: Maybe /** Available delivery window list price */ - listPrice: Maybe + listPrice: Maybe /** Available delivery window price */ - price: Maybe + price: Maybe /** Available delivery window start date in UTC */ - startDateUtc: Maybe + startDateUtc: Maybe /** Available delivery window tax */ - tax: Maybe + tax: Maybe } export type DeliveryIds = { /** DeliveryIds courier id */ - courierId: Maybe + courierId: Maybe /** DeliveryIds courier name */ - courierName: Maybe + courierName: Maybe /** DeliveryIds dock id */ - dockId: Maybe + dockId: Maybe /** DeliveryIds quantity */ - quantity: Maybe + quantity: Maybe /** DeliveryIds warehouse id */ - warehouseId: Maybe + warehouseId: Maybe } export type IGeoCoordinates = { /** The latitude of the geographic coordinates. */ - latitude: Scalars['Float'] + latitude: Scalars['Float']['input'] /** The longitude of the geographic coordinates. */ - longitude: Scalars['Float'] + longitude: Scalars['Float']['input'] } /** Person data input to the newsletter. */ export type IPersonNewsletter = { /** Person's email. */ - email: Scalars['String'] + email: Scalars['String']['input'] /** Person's name. */ - name: Scalars['String'] + name: Scalars['String']['input'] } /** Shipping Simulation item input. */ export type IShippingItem = { /** ShippingItem ID / Sku. */ - id: Scalars['String'] + id: Scalars['String']['input'] /** Number of items. */ - quantity: Scalars['Int'] + quantity: Scalars['Int']['input'] /** Seller responsible for the ShippingItem. */ - seller: Scalars['String'] + seller: Scalars['String']['input'] } /** Shopping cart input. */ @@ -164,16 +175,16 @@ export type IStoreCart = { export type IStoreCurrency = { /** Currency code (e.g: USD). */ - code: Scalars['String'] + code: Scalars['String']['input'] /** Currency symbol (e.g: $). */ - symbol: Scalars['String'] + symbol: Scalars['String']['input'] } export type IStoreDeliveryMode = { /** The delivery channel information of the session. */ - deliveryChannel: Scalars['String'] + deliveryChannel: Scalars['String']['input'] /** The delivery method information of the session. */ - deliveryMethod: Scalars['String'] + deliveryMethod: Scalars['String']['input'] /** The delivery window information of the session. */ deliveryWindow: InputMaybe } @@ -181,24 +192,24 @@ export type IStoreDeliveryMode = { /** Delivery window information. */ export type IStoreDeliveryWindow = { /** The delivery window end date information. */ - endDate: Scalars['String'] + endDate: Scalars['String']['input'] /** The delivery window start date information. */ - startDate: Scalars['String'] + startDate: Scalars['String']['input'] } export type IStoreGeoCoordinates = { /** The latitude of the geographic coordinates. */ - latitude: Scalars['Float'] + latitude: Scalars['Float']['input'] /** The longitude of the geographic coordinates. */ - longitude: Scalars['Float'] + longitude: Scalars['Float']['input'] } /** Image input. */ export type IStoreImage = { /** Alias for the input image. */ - alternateName: Scalars['String'] + alternateName: Scalars['String']['input'] /** Image input URL. */ - url: Scalars['String'] + url: Scalars['String']['input'] } /** Offer input. */ @@ -206,11 +217,11 @@ export type IStoreOffer = { /** Information on the item being offered. */ itemOffered: IStoreProduct /** This is displayed as the "from" price in the context of promotions' price comparison. This may change before it reaches the shelf. */ - listPrice: Scalars['Float'] + listPrice: Scalars['Float']['input'] /** Also known as spot price. */ - price: Scalars['Float'] + price: Scalars['Float']['input'] /** Number of items offered. */ - quantity: Scalars['Int'] + quantity: Scalars['Int']['input'] /** Seller responsible for the offer. */ seller: IStoreOrganization } @@ -220,27 +231,27 @@ export type IStoreOrder = { /** Array with information on each accepted offer. */ acceptedOffer: Array /** ID of the order in [VTEX order management](https://help.vtex.com/en/tutorial/license-manager-resources-oms--60QcBsvWeum02cFi3GjBzg#). */ - orderNumber: Scalars['String'] + orderNumber: Scalars['String']['input'] /** Indicates whether or not items with attachments should be split. */ - shouldSplitItem: InputMaybe + shouldSplitItem: InputMaybe } /** Organization input. */ export type IStoreOrganization = { /** Organization ID. */ - identifier: Scalars['String'] + identifier: Scalars['String']['input'] } /** Client profile data. */ export type IStorePerson = { /** Client email. */ - email: Scalars['String'] + email: Scalars['String']['input'] /** Client last name. */ - familyName: Scalars['String'] + familyName: Scalars['String']['input'] /** Client first name. */ - givenName: Scalars['String'] + givenName: Scalars['String']['input'] /** Client ID. */ - id: Scalars['String'] + id: Scalars['String']['input'] } /** 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. */ @@ -250,38 +261,38 @@ export type IStoreProduct = { /** Array of product images. */ image: Array /** Product name. */ - name: Scalars['String'] + name: Scalars['String']['input'] /** Stock Keeping Unit. Merchant-specific ID for the product. */ - sku: Scalars['String'] + sku: Scalars['String']['input'] } export type IStorePropertyValue = { /** Property name. */ - name: Scalars['String'] + name: Scalars['String']['input'] /** Property id. This propert changes according to the content of the object. */ - propertyID: InputMaybe + propertyID: InputMaybe /** Property value. May hold a string or the string representation of an object. */ - value: Scalars['ObjectOrString'] + value: Scalars['ObjectOrString']['input'] /** Specifies the nature of the value */ - valueReference: Scalars['String'] + valueReference: Scalars['String']['input'] } /** Selected search facet input. */ export type IStoreSelectedFacet = { /** Selected search facet key. */ - key: Scalars['String'] + key: Scalars['String']['input'] /** Selected search facet value. */ - value: Scalars['String'] + value: Scalars['String']['input'] } /** Session input. */ export type IStoreSession = { /** Session input address type. */ - addressType: InputMaybe + addressType: InputMaybe /** Session input channel. */ - channel: InputMaybe + channel: InputMaybe /** Session input country. */ - country: Scalars['String'] + country: Scalars['String']['input'] /** Session input currency. */ currency: IStoreCurrency /** Session input delivery mode. */ @@ -289,18 +300,18 @@ export type IStoreSession = { /** Session input geoCoordinates. */ geoCoordinates: InputMaybe /** Session input locale. */ - locale: Scalars['String'] + locale: Scalars['String']['input'] /** Session input person. */ person: InputMaybe /** Session input postal code. */ - postalCode: InputMaybe + postalCode: InputMaybe } export type LogisticsInfo = { /** LogisticsInfo itemIndex. */ - itemIndex: Maybe + itemIndex: Maybe /** LogisticsInfo selectedSla. */ - selectedSla: Maybe + selectedSla: Maybe /** List of LogisticsInfo ShippingSLA. */ slas: Maybe>> } @@ -308,52 +319,52 @@ export type LogisticsInfo = { /** Shipping Simulation Logistic Item. */ export type LogisticsItem = { /** LogisticsItem availability. */ - availability: Maybe + availability: Maybe /** LogisticsItem ID / Sku. */ - id: Maybe + id: Maybe /** LogisticsItem listPrice. */ - listPrice: Maybe + listPrice: Maybe /** LogisticsItem measurementUnit. */ - measurementUnit: Maybe + measurementUnit: Maybe /** LogisticsItem price. */ - price: Maybe + price: Maybe /** 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. */ - priceValidUntil: Maybe + priceValidUntil: Maybe /** Number of items. */ - quantity: Maybe - requestIndex: Maybe + quantity: Maybe + requestIndex: Maybe /** LogisticsItem rewardValue. */ - rewardValue: Maybe + rewardValue: Maybe /** Seller responsible for the ShippingItem. */ - seller: Maybe + seller: Maybe /** List of Sellers. */ - sellerChain: Maybe>> + sellerChain: Maybe>> /** LogisticsItem sellingPrice. */ - sellingPrice: Maybe + sellingPrice: Maybe /** LogisticsItem tax. */ - tax: Maybe + tax: Maybe /** LogisticsItem unitMultiplier. */ - unitMultiplier: Maybe + unitMultiplier: Maybe } export type MessageFields = { /** MessageFields ean. */ - ean: Maybe + ean: Maybe /** MessageFields item index. */ - itemIndex: Maybe + itemIndex: Maybe /** MessageFields sku name. */ - skuName: Maybe + skuName: Maybe } export type MessageInfo = { /** MessageInfo code. */ - code: Maybe + code: Maybe /** MessageInfo fields. */ fields: Maybe /** MessageInfo status. */ - status: Maybe + status: Maybe /** MessageInfo text. */ - text: Maybe + text: Maybe } export type Mutation = { @@ -375,56 +386,56 @@ export type MutationValidateCartArgs = { } export type MutationValidateSessionArgs = { - search: Scalars['String'] + search: Scalars['String']['input'] session: IStoreSession } /** Newsletter information. */ export type PersonNewsletter = { /** Person's ID in the newsletter list. */ - id: Scalars['String'] + id: Scalars['String']['output'] } export type PickupAddress = { /** PickupAddress address id. */ - addressId: Maybe + addressId: Maybe /** PickupAddress address type. */ - addressType: Maybe + addressType: Maybe /** PickupAddress city. */ - city: Maybe + city: Maybe /** PickupAddress complement. */ - complement: Maybe + complement: Maybe /** PickupAddress country. */ - country: Maybe + country: Maybe /** PickupAddress geo coordinates. */ - geoCoordinates: Maybe>> + geoCoordinates: Maybe>> /** PickupAddress neighborhood. */ - neighborhood: Maybe + neighborhood: Maybe /** PickupAddress number. */ - number: Maybe + number: Maybe /** PickupAddress postal code. */ - postalCode: Maybe + postalCode: Maybe /** PickupAddress receiver name. */ - receiverName: Maybe + receiverName: Maybe /** PickupAddress reference. */ - reference: Maybe + reference: Maybe /** PickupAddress state. */ - state: Maybe + state: Maybe /** PickupAddress street. */ - street: Maybe + street: Maybe } export type PickupStoreInfo = { /** PickupStoreInfo additional information. */ - additionalInfo: Maybe + additionalInfo: Maybe /** PickupStoreInfo address. */ address: Maybe /** PickupStoreInfo dock id. */ - dockId: Maybe + dockId: Maybe /** PickupStoreInfo friendly name. */ - friendlyName: Maybe + friendlyName: Maybe /** Information if the store has pickup enable. */ - isPickupStore: Maybe + isPickupStore: Maybe } export type Query = { @@ -447,17 +458,17 @@ export type Query = { } export type QueryAllCollectionsArgs = { - after: InputMaybe - first: Scalars['Int'] + after: InputMaybe + first: Scalars['Int']['input'] } export type QueryAllProductsArgs = { - after: InputMaybe - first: Scalars['Int'] + after: InputMaybe + first: Scalars['Int']['input'] } export type QueryCollectionArgs = { - slug: Scalars['String'] + slug: Scalars['String']['input'] } export type QueryProductArgs = { @@ -466,52 +477,52 @@ export type QueryProductArgs = { export type QueryRedirectArgs = { selectedFacets: InputMaybe> - term: InputMaybe + term: InputMaybe } export type QuerySearchArgs = { - after: InputMaybe - first: Scalars['Int'] + after: InputMaybe + first: Scalars['Int']['input'] selectedFacets: InputMaybe> sort?: InputMaybe - term?: InputMaybe + term?: InputMaybe } export type QuerySellersArgs = { - country: Scalars['String'] + country: Scalars['String']['input'] geoCoordinates: InputMaybe - postalCode: InputMaybe - salesChannel: InputMaybe + postalCode: InputMaybe + salesChannel: InputMaybe } export type QueryShippingArgs = { - country: Scalars['String'] + country: Scalars['String']['input'] items: Array - postalCode: Scalars['String'] + postalCode: Scalars['String']['input'] } /** Search result. */ export type SearchMetadata = { /** Indicates if the search term was misspelled. */ - isTermMisspelled: Scalars['Boolean'] + isTermMisspelled: Scalars['Boolean']['output'] /** Logical operator used to run the search. */ - logicalOperator: Scalars['String'] + logicalOperator: Scalars['String']['output'] } /** Information of sellers. */ export type SellerInfo = { /** Identification of the seller */ - id: Maybe + id: Maybe /** Logo of the seller */ - logo: Maybe + logo: Maybe /** Name of the seller */ - name: Maybe + name: Maybe } /** Regionalization with sellers information. */ export type SellersData = { /** Identification of region. */ - id: Maybe + id: Maybe /** List of sellers. */ sellers: Maybe>> } @@ -532,41 +543,41 @@ export type ShippingSla = { /** ShippingSLA available delivery windows. */ availableDeliveryWindows: Maybe>> /** ShippingSLA carrier. */ - carrier: Maybe + carrier: Maybe /** ShippingSLA delivery channel. */ - deliveryChannel: Maybe + deliveryChannel: Maybe /** List of ShippingSLA delivery ids. */ deliveryIds: Maybe>> /** ShippingSLA friendly name. */ - friendlyName: Maybe + friendlyName: Maybe /** ShippingSLA id. */ - id: Maybe + id: Maybe /** * ShippingSLA localized shipping estimate. * Note: this will always return a localized string for locale `en-US`. */ - localizedEstimates: Maybe + localizedEstimates: Maybe /** ShippingSLA name. */ - name: Maybe + name: Maybe /** ShippingSLA pickup distance. */ - pickupDistance: Maybe + pickupDistance: Maybe /** ShippingSLA pickup point id. */ - pickupPointId: Maybe + pickupPointId: Maybe /** ShippingSLA pickup store info. */ pickupStoreInfo: Maybe /** ShippingSLA price. */ - price: Maybe + price: Maybe /** ShippingSLA shipping estimate. */ - shippingEstimate: Maybe + shippingEstimate: Maybe /** ShippingSLA shipping estimate date. */ - shippingEstimateDate: Maybe + shippingEstimateDate: Maybe } export type SkuVariants = { /** SKU property values for the current SKU. */ - activeVariations: Maybe + activeVariations: Maybe /** All available options for each SKU variant property, indexed by their name. */ - allVariantsByName: Maybe + allVariantsByName: Maybe /** * Available options for each varying SKU property, taking into account the * `dominantVariantName` property. Returns all available options for the @@ -575,7 +586,7 @@ export type SkuVariants = { * If `dominantVariantName` is not present, the first variant will be * considered the dominant one. */ - availableVariations: Maybe + availableVariations: Maybe /** * Maps property value combinations to their respective SKU's slug. Enables * us to retrieve the slug for the SKU that matches the currently selected @@ -583,49 +594,49 @@ export type SkuVariants = { * If `dominantVariantName` is not present, the first variant will be * considered the dominant one. */ - slugsMap: Maybe + slugsMap: Maybe } export type SkuVariantsAvailableVariationsArgs = { - dominantVariantName: InputMaybe + dominantVariantName: InputMaybe } export type SkuVariantsSlugsMapArgs = { - dominantVariantName: InputMaybe + dominantVariantName: InputMaybe } /** Aggregate offer information, for a given SKU that is available to be fulfilled by multiple sellers. */ export type StoreAggregateOffer = { /** Highest price among all sellers. */ - highPrice: Scalars['Float'] + highPrice: Scalars['Float']['output'] /** Lowest price among all sellers. */ - lowPrice: Scalars['Float'] + lowPrice: Scalars['Float']['output'] /** Number of sellers selling this SKU. */ - offerCount: Scalars['Int'] + offerCount: Scalars['Int']['output'] /** Array with information on each available offer. */ offers: Array /** ISO code of the currency used for the offer prices. */ - priceCurrency: Scalars['String'] + priceCurrency: Scalars['String']['output'] } /** Average rating, based on multiple ratings or reviews. */ export type StoreAggregateRating = { /** Value of the aggregate rating. */ - ratingValue: Scalars['Float'] + ratingValue: Scalars['Float']['output'] /** Total number of ratings. */ - reviewCount: Scalars['Int'] + reviewCount: Scalars['Int']['output'] } /** information about the author of a product review or rating. */ export type StoreAuthor = { /** Author name. */ - name: Scalars['String'] + name: Scalars['String']['output'] } /** Brand of a given product. */ export type StoreBrand = { /** Brand name. */ - name: Scalars['String'] + name: Scalars['String']['output'] } /** List of items consisting of chain linked web pages, ending with the current page. */ @@ -633,7 +644,7 @@ export type StoreBreadcrumbList = { /** Array with breadcrumb elements. */ itemListElement: Array /** Number of breadcrumbs in the list. */ - numberOfItems: Scalars['Int'] + numberOfItems: Scalars['Int']['output'] } /** Shopping cart information. */ @@ -649,7 +660,7 @@ export type StoreCartMessage = { /** Shopping cart message status, which can be `INFO`, `WARNING` or `ERROR`. */ status: StoreStatus /** Shopping cart message text. */ - text: Scalars['String'] + text: Scalars['String']['output'] } /** Product collection information. */ @@ -657,13 +668,13 @@ export type StoreCollection = { /** List of items consisting of chain linked web pages, ending with the current page. */ breadcrumbList: StoreBreadcrumbList /** Collection ID. */ - id: Scalars['ID'] + id: Scalars['ID']['output'] /** Collection meta information. Used for search. */ meta: StoreCollectionMeta /** Meta tag data. */ seo: StoreSeo /** Corresponding collection URL slug, with which to retrieve this entity. */ - slug: Scalars['String'] + slug: Scalars['String']['output'] /** Collection type. */ type: StoreCollectionType } @@ -679,7 +690,7 @@ export type StoreCollectionConnection = { /** Each collection edge contains a `node`, with product collection information, and a `cursor`, that can be used as a reference for pagination. */ export type StoreCollectionEdge = { /** Collection cursor. Used as pagination reference. */ - cursor: Scalars['String'] + cursor: Scalars['String']['output'] /** Each collection node contains the information of a product collection returned by the query. */ node: StoreCollection } @@ -687,9 +698,9 @@ export type StoreCollectionEdge = { /** Product collection facet, used for search. */ export type StoreCollectionFacet = { /** Facet key. */ - key: Scalars['String'] + key: Scalars['String']['output'] /** Facet value. */ - value: Scalars['String'] + value: Scalars['String']['output'] } /** Collection meta information. Used for search. */ @@ -716,17 +727,17 @@ export type StoreCollectionType = /** Currency information. */ export type StoreCurrency = { /** Currency code (e.g: USD). */ - code: Scalars['String'] + code: Scalars['String']['output'] /** Currency symbol (e.g: $). */ - symbol: Scalars['String'] + symbol: Scalars['String']['output'] } /** Delivery mode information. */ export type StoreDeliveryMode = { /** The delivery channel information of the session. */ - deliveryChannel: Scalars['String'] + deliveryChannel: Scalars['String']['output'] /** The delivery method information of the session. */ - deliveryMethod: Scalars['String'] + deliveryMethod: Scalars['String']['output'] /** The delivery window information of the session. */ deliveryWindow: Maybe } @@ -734,9 +745,9 @@ export type StoreDeliveryMode = { /** Delivery window information. */ export type StoreDeliveryWindow = { /** The delivery window end date information. */ - endDate: Scalars['String'] + endDate: Scalars['String']['output'] /** The delivery window start date information. */ - startDate: Scalars['String'] + startDate: Scalars['String']['output'] } export type StoreFacet = StoreFacetBoolean | StoreFacetRange @@ -744,9 +755,9 @@ export type StoreFacet = StoreFacetBoolean | StoreFacetRange /** Search facet boolean information. */ export type StoreFacetBoolean = { /** Facet key. */ - key: Scalars['String'] + key: Scalars['String']['output'] /** Facet label. */ - label: Scalars['String'] + label: Scalars['String']['output'] /** Array with information on each facet value. */ values: Array } @@ -754,9 +765,9 @@ export type StoreFacetBoolean = { /** Search facet range information. */ export type StoreFacetRange = { /** Facet key. */ - key: Scalars['String'] + key: Scalars['String']['output'] /** Facet label. */ - label: Scalars['String'] + label: Scalars['String']['output'] /** Maximum facet range value. */ max: StoreFacetValueRange /** Minimum facet range value. */ @@ -773,71 +784,71 @@ export type StoreFacetType = /** Information of a specific facet value. */ export type StoreFacetValueBoolean = { /** Facet value label. */ - label: Scalars['String'] + label: Scalars['String']['output'] /** Number of items with this facet. */ - quantity: Scalars['Int'] + quantity: Scalars['Int']['output'] /** Indicates whether facet is selected. */ - selected: Scalars['Boolean'] + selected: Scalars['Boolean']['output'] /** Facet value. */ - value: Scalars['String'] + value: Scalars['String']['output'] } /** Search facet range value information. Used for minimum and maximum range values. */ export type StoreFacetValueRange = { /** Search facet range absolute value. */ - absolute: Scalars['Float'] + absolute: Scalars['Float']['output'] /** Search facet range selected value. */ - selected: Scalars['Float'] + selected: Scalars['Float']['output'] } /** Geographic coordinates information. */ export type StoreGeoCoordinates = { /** The latitude of the geographic coordinates. */ - latitude: Scalars['Float'] + latitude: Scalars['Float']['output'] /** The longitude of the geographic coordinates. */ - longitude: Scalars['Float'] + longitude: Scalars['Float']['output'] } /** Image. */ export type StoreImage = { /** Alias for the image. */ - alternateName: Scalars['String'] + alternateName: Scalars['String']['output'] /** Image URL. */ - url: Scalars['String'] + url: Scalars['String']['output'] } /** Item of a list. */ export type StoreListItem = { /** List item value. */ - item: Scalars['String'] + item: Scalars['String']['output'] /** Name of the list item. */ - name: Scalars['String'] + name: Scalars['String']['output'] /** Position of the item in the list. */ - position: Scalars['Int'] + position: Scalars['Int']['output'] } /** Offer information. */ export type StoreOffer = { /** Offer item availability. */ - availability: Scalars['String'] + availability: Scalars['String']['output'] /** Offer item condition. */ - itemCondition: Scalars['String'] + itemCondition: Scalars['String']['output'] /** Information on the item being offered. */ itemOffered: StoreProduct /** This is displayed as the "from" price in the context of promotions' price comparison. This may change before it reaches the shelf. */ - listPrice: Scalars['Float'] + listPrice: Scalars['Float']['output'] /** Also known as spot price. */ - price: Scalars['Float'] + price: Scalars['Float']['output'] /** ISO code of the currency used for the offer prices. */ - priceCurrency: Scalars['String'] + priceCurrency: Scalars['String']['output'] /** 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. */ - priceValidUntil: Scalars['String'] + priceValidUntil: Scalars['String']['output'] /** Number of items offered. */ - quantity: Scalars['Int'] + quantity: Scalars['Int']['output'] /** Seller responsible for the offer. */ seller: StoreOrganization /** Computed price before applying coupons, taxes or benefits. This may change before it reaches the shelf. */ - sellingPrice: Scalars['Float'] + sellingPrice: Scalars['Float']['output'] } /** Information of a specific order. */ @@ -845,39 +856,39 @@ export type StoreOrder = { /** Array with information on each accepted offer. */ acceptedOffer: Array /** ID of the order in [VTEX order management](https://help.vtex.com/en/tutorial/license-manager-resources-oms--60QcBsvWeum02cFi3GjBzg#). */ - orderNumber: Scalars['String'] + orderNumber: Scalars['String']['output'] } /** Organization. */ export type StoreOrganization = { /** Organization ID. */ - identifier: Scalars['String'] + identifier: Scalars['String']['output'] } /** Whenever you make a query that allows for pagination, such as `allProducts` or `allCollections`, you can check `StorePageInfo` to learn more about the complete set of items and use it to paginate your queries. */ export type StorePageInfo = { /** Cursor corresponding to the last possible item. */ - endCursor: Scalars['String'] + endCursor: Scalars['String']['output'] /** Indicates whether there is at least one more page with items after the ones returned in the current query. */ - hasNextPage: Scalars['Boolean'] + hasNextPage: Scalars['Boolean']['output'] /** Indicates whether there is at least one more page with items before the ones returned in the current query. */ - hasPreviousPage: Scalars['Boolean'] + hasPreviousPage: Scalars['Boolean']['output'] /** Cursor corresponding to the first possible item. */ - startCursor: Scalars['String'] + startCursor: Scalars['String']['output'] /** Total number of items (products or collections), not pages. */ - totalCount: Scalars['Int'] + totalCount: Scalars['Int']['output'] } /** Client profile data. */ export type StorePerson = { /** Client email. */ - email: Scalars['String'] + email: Scalars['String']['output'] /** Client last name. */ - familyName: Scalars['String'] + familyName: Scalars['String']['output'] /** Client first name. */ - givenName: Scalars['String'] + givenName: Scalars['String']['output'] /** Client ID. */ - id: Scalars['String'] + id: Scalars['String']['output'] } /** 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. */ @@ -891,29 +902,29 @@ export type StoreProduct = { /** List of items consisting of chain linked web pages, ending with the current page. */ breadcrumbList: StoreBreadcrumbList /** Product description. */ - description: Scalars['String'] + description: Scalars['String']['output'] /** Global Trade Item Number. */ - gtin: Scalars['String'] + gtin: Scalars['String']['output'] /** Array of images. */ image: Array /** Indicates product group related to this product. */ isVariantOf: StoreProductGroup /** Product name. */ - name: Scalars['String'] + name: Scalars['String']['output'] /** Aggregate offer information. */ offers: StoreAggregateOffer /** Product ID, such as [ISBN](https://www.isbn-international.org/content/what-isbn) or similar global IDs. */ - productID: Scalars['String'] + productID: Scalars['String']['output'] /** The product's release date. Formatted using https://en.wikipedia.org/wiki/ISO_8601 */ - releaseDate: Scalars['String'] + releaseDate: Scalars['String']['output'] /** Array with review information. */ review: Array /** Meta tag data. */ seo: StoreSeo /** Stock Keeping Unit. Merchant-specific ID for the product. */ - sku: Scalars['String'] + sku: Scalars['String']['output'] /** Corresponding collection URL slug, with which to retrieve this entity. */ - slug: Scalars['String'] + slug: Scalars['String']['output'] } /** Product connections, including pagination information and products returned by the query. */ @@ -927,7 +938,7 @@ export type StoreProductConnection = { /** Each product edge contains a `node`, with product information, and a `cursor`, that can be used as a reference for pagination. */ export type StoreProductEdge = { /** Product cursor. Used as pagination reference. */ - cursor: Scalars['String'] + cursor: Scalars['String']['output'] /** Each product node contains the information of a product returned by the query. */ node: StoreProduct } @@ -939,9 +950,9 @@ export type StoreProductGroup = { /** Array of variants related to product group. Variants are equivalent to VTEX [SKUs](https://help.vtex.com/en/tutorial/what-is-an-sku--1K75s4RXAQyOuGUYKMM68u#). */ hasVariant: Array /** Product group name. */ - name: Scalars['String'] + name: Scalars['String']['output'] /** Product group ID. */ - productGroupID: Scalars['String'] + productGroupID: Scalars['String']['output'] /** * Object containing data structures to facilitate handling different SKU * variant properties. Specially useful for implementing SKU selection @@ -953,13 +964,13 @@ export type StoreProductGroup = { /** Properties that can be associated with products and products groups. */ export type StorePropertyValue = { /** Property name. */ - name: Scalars['String'] + name: Scalars['String']['output'] /** Property id. This propert changes according to the content of the object. */ - propertyID: Scalars['String'] + propertyID: Scalars['String']['output'] /** Property value. May hold a string or the string representation of an object. */ - value: Scalars['ObjectOrString'] + value: Scalars['ObjectOrString']['output'] /** Specifies the nature of the value */ - valueReference: Scalars['String'] + valueReference: Scalars['String']['output'] } /** @@ -968,7 +979,7 @@ export type StorePropertyValue = { */ export type StoreRedirect = { /** URL to redirect */ - url: Maybe + url: Maybe } /** Information of a given review. */ @@ -982,9 +993,9 @@ export type StoreReview = { /** Information of a given review rating. */ export type StoreReviewRating = { /** Best rating value. */ - bestRating: Scalars['Float'] + bestRating: Scalars['Float']['output'] /** Rating value. */ - ratingValue: Scalars['Float'] + ratingValue: Scalars['Float']['output'] } /** Search result. */ @@ -1002,23 +1013,23 @@ export type StoreSearchResult = { /** Search Engine Optimization (SEO) tags data. */ export type StoreSeo = { /** Canonical tag. */ - canonical: Scalars['String'] + canonical: Scalars['String']['output'] /** Description tag. */ - description: Scalars['String'] + description: Scalars['String']['output'] /** Title tag. */ - title: Scalars['String'] + title: Scalars['String']['output'] /** Title template tag. */ - titleTemplate: Scalars['String'] + titleTemplate: Scalars['String']['output'] } /** Session information. */ export type StoreSession = { /** Session address type. */ - addressType: Maybe + addressType: Maybe /** Session channel. */ - channel: Maybe + channel: Maybe /** Session country. */ - country: Scalars['String'] + country: Scalars['String']['output'] /** Session currency. */ currency: StoreCurrency /** Session delivery mode. */ @@ -1026,11 +1037,11 @@ export type StoreSession = { /** Session input geoCoordinates. */ geoCoordinates: Maybe /** Session locale. */ - locale: Scalars['String'] + locale: Scalars['String']['output'] /** Session input person. */ person: Maybe /** Session postal code. */ - postalCode: Maybe + postalCode: Maybe } /** Product search results sorting options. */ @@ -1058,9 +1069,9 @@ export type StoreStatus = 'ERROR' | 'INFO' | 'WARNING' /** Suggestion term. */ export type StoreSuggestionTerm = { /** Its occurrences count. */ - count: Scalars['Int'] + count: Scalars['Int']['output'] /** The term. */ - value: Scalars['String'] + value: Scalars['String']['output'] } /** Suggestions information. */ @@ -1092,7 +1103,7 @@ export type ProductSummary_ProductFragment = { } } -export type Filter_Facets_StoreFacetBoolean_Fragment = { +type Filter_Facets_StoreFacetBoolean_Fragment = { __typename: 'StoreFacetBoolean' key: string label: string @@ -1104,7 +1115,7 @@ export type Filter_Facets_StoreFacetBoolean_Fragment = { }> } -export type Filter_Facets_StoreFacetRange_Fragment = { +type Filter_Facets_StoreFacetRange_Fragment = { __typename: 'StoreFacetRange' key: string label: string @@ -1177,7 +1188,7 @@ export type ServerCollectionPageFragment = { collection: { id: string } } export type ServerProductFragment = { product: { id: string } } export type ServerCollectionPageQueryQueryVariables = Exact<{ - slug: Scalars['String'] + slug: Scalars['String']['input'] }> export type ServerCollectionPageQueryQuery = { @@ -1346,10 +1357,10 @@ export type SubscribeToNewsletterMutation = { } export type ClientManyProductsQueryQueryVariables = Exact<{ - first: Scalars['Int'] - after: InputMaybe + first: Scalars['Int']['input'] + after: InputMaybe sort: StoreSort - term: Scalars['String'] + term: Scalars['String']['input'] selectedFacets: Array | IStoreSelectedFacet }> @@ -1383,16 +1394,11 @@ export type ClientManyProductsQueryQuery = { } } -export type SearchEvent_MetadataFragment = { - isTermMisspelled: boolean - logicalOperator: string -} - export type ClientProductGalleryQueryQueryVariables = Exact<{ - first: Scalars['Int'] - after: Scalars['String'] + first: Scalars['Int']['input'] + after: Scalars['String']['input'] sort: StoreSort - term: Scalars['String'] + term: Scalars['String']['input'] selectedFacets: Array | IStoreSelectedFacet }> @@ -1423,6 +1429,11 @@ export type ClientProductGalleryQueryQuery = { } } +export type SearchEvent_MetadataFragment = { + isTermMisspelled: boolean + logicalOperator: string +} + export type ClientProductQueryQueryVariables = Exact<{ locator: Array | IStoreSelectedFacet }> @@ -1464,7 +1475,7 @@ export type ClientProductQueryQuery = { } export type ClientSearchSuggestionsQueryQueryVariables = Exact<{ - term: Scalars['String'] + term: Scalars['String']['input'] selectedFacets: InputMaybe | IStoreSelectedFacet> }> @@ -1499,7 +1510,7 @@ export type ClientSearchSuggestionsQueryQuery = { } export type ClientTopSearchSuggestionsQueryQueryVariables = Exact<{ - term: Scalars['String'] + term: Scalars['String']['input'] selectedFacets: InputMaybe | IStoreSelectedFacet> }> @@ -1509,7 +1520,7 @@ export type ClientTopSearchSuggestionsQueryQuery = { export type ValidateSessionMutationVariables = Exact<{ session: IStoreSession - search: Scalars['String'] + search: Scalars['String']['input'] }> export type ValidateSessionMutation = { @@ -1536,8 +1547,8 @@ export type ValidateSessionMutation = { } export type ClientShippingSimulationQueryQueryVariables = Exact<{ - postalCode: Scalars['String'] - country: Scalars['String'] + postalCode: Scalars['String']['input'] + country: Scalars['String']['input'] items: Array | IShippingItem }> @@ -1564,3 +1575,458 @@ export type ClientShippingSimulationQueryQuery = { } | null } | null } + +export class TypedDocumentString + extends String + implements DocumentTypeDecoration +{ + __apiType?: DocumentTypeDecoration['__apiType'] + + constructor(private value: string, public __meta__?: Record) { + super(value) + } + + toString(): string & DocumentTypeDecoration { + return this.value + } +} +export const ProductSummary_ProductFragmentDoc = new TypedDocumentString( + ` + fragment ProductSummary_product on StoreProduct { + id: productID + slug + sku + brand { + brandName: name + } + name + gtin + isVariantOf { + productGroupID + name + } + image { + url + alternateName + } + brand { + name + } + offers { + lowPrice + offers { + availability + price + listPrice + quantity + seller { + identifier + } + } + } +} + `, + { fragmentName: 'ProductSummary_product' } +) as unknown as TypedDocumentString +export const Filter_FacetsFragmentDoc = new TypedDocumentString( + ` + fragment Filter_facets on StoreFacet { + ... on StoreFacetRange { + key + label + min { + selected + absolute + } + max { + selected + absolute + } + __typename + } + ... on StoreFacetBoolean { + key + label + values { + label + value + selected + quantity + } + __typename + } +} + `, + { fragmentName: 'Filter_facets' } +) as unknown as TypedDocumentString +export const CartProductItemFragmentDoc = new TypedDocumentString( + ` + fragment CartProductItem on StoreProduct { + sku + name + image { + url + alternateName + } + brand { + name + } + isVariantOf { + productGroupID + name + skuVariants { + activeVariations + slugsMap + availableVariations + } + } + gtin + additionalProperty { + propertyID + name + value + valueReference + } +} + `, + { fragmentName: 'CartProductItem' } +) as unknown as TypedDocumentString +export const ProductDetailsFragment_ProductFragmentDoc = + new TypedDocumentString( + ` + fragment ProductDetailsFragment_product on StoreProduct { + id: productID + sku + name + gtin + description + isVariantOf { + name + productGroupID + skuVariants { + activeVariations + slugsMap + availableVariations + } + } + image { + url + alternateName + } + brand { + name + } + offers { + lowPrice + offers { + availability + price + listPrice + seller { + identifier + } + } + } + ...CartProductItem +} + fragment CartProductItem on StoreProduct { + sku + name + image { + url + alternateName + } + brand { + name + } + isVariantOf { + productGroupID + name + skuVariants { + activeVariations + slugsMap + availableVariations + } + } + gtin + additionalProperty { + propertyID + name + value + valueReference + } +}`, + { fragmentName: 'ProductDetailsFragment_product' } + ) as unknown as TypedDocumentString< + ProductDetailsFragment_ProductFragment, + unknown + > +export const ClientManyProductsFragmentDoc = new TypedDocumentString( + ` + fragment ClientManyProducts on Query { + search( + first: $first + after: $after + sort: $sort + term: $term + selectedFacets: $selectedFacets + ) { + products { + pageInfo { + totalCount + } + } + } +} + `, + { fragmentName: 'ClientManyProducts' } +) as unknown as TypedDocumentString +export const ClientProductFragmentDoc = new TypedDocumentString( + ` + fragment ClientProduct on Query { + product(locator: $locator) { + id: productID + } +} + `, + { fragmentName: 'ClientProduct' } +) as unknown as TypedDocumentString +export const ClientProductGalleryFragmentDoc = new TypedDocumentString( + ` + fragment ClientProductGallery on Query { + search( + first: $first + after: $after + sort: $sort + term: $term + selectedFacets: $selectedFacets + ) { + products { + pageInfo { + totalCount + } + } + } +} + `, + { fragmentName: 'ClientProductGallery' } +) as unknown as TypedDocumentString +export const ClientSearchSuggestionsFragmentDoc = new TypedDocumentString( + ` + fragment ClientSearchSuggestions on Query { + search(first: 5, term: $term, selectedFacets: $selectedFacets) { + suggestions { + terms { + value + } + } + } +} + `, + { fragmentName: 'ClientSearchSuggestions' } +) as unknown as TypedDocumentString +export const ClientShippingSimulationFragmentDoc = new TypedDocumentString( + ` + fragment ClientShippingSimulation on Query { + shipping(items: $items, postalCode: $postalCode, country: $country) { + address { + city + } + } +} + `, + { fragmentName: 'ClientShippingSimulation' } +) as unknown as TypedDocumentString +export const ClientTopSearchSuggestionsFragmentDoc = new TypedDocumentString( + ` + fragment ClientTopSearchSuggestions on Query { + search(first: 5, term: $term, selectedFacets: $selectedFacets) { + suggestions { + terms { + value + } + } + } +} + `, + { fragmentName: 'ClientTopSearchSuggestions' } +) as unknown as TypedDocumentString +export const ServerCollectionPageFragmentDoc = new TypedDocumentString( + ` + fragment ServerCollectionPage on Query { + collection(slug: $slug) { + id + } +} + `, + { fragmentName: 'ServerCollectionPage' } +) as unknown as TypedDocumentString +export const ServerProductFragmentDoc = new TypedDocumentString( + ` + fragment ServerProduct on Query { + product(locator: $locator) { + id: productID + } +} + `, + { fragmentName: 'ServerProduct' } +) as unknown as TypedDocumentString +export const CartMessageFragmentDoc = new TypedDocumentString( + ` + fragment CartMessage on StoreCartMessage { + text + status +} + `, + { fragmentName: 'CartMessage' } +) as unknown as TypedDocumentString +export const CartItemFragmentDoc = new TypedDocumentString( + ` + fragment CartItem on StoreOffer { + seller { + identifier + } + quantity + price + listPrice + itemOffered { + ...CartProductItem + } +} + fragment CartProductItem on StoreProduct { + sku + name + image { + url + alternateName + } + brand { + name + } + isVariantOf { + productGroupID + name + skuVariants { + activeVariations + slugsMap + availableVariations + } + } + gtin + additionalProperty { + propertyID + name + value + valueReference + } +}`, + { fragmentName: 'CartItem' } +) as unknown as TypedDocumentString +export const SearchEvent_MetadataFragmentDoc = new TypedDocumentString( + ` + fragment SearchEvent_metadata on SearchMetadata { + isTermMisspelled + logicalOperator +} + `, + { fragmentName: 'SearchEvent_metadata' } +) as unknown as TypedDocumentString +export const ServerCollectionPageQueryDocument = { + __meta__: { + operationName: 'ServerCollectionPageQuery', + operationHash: '4b33c5c07f440dc7489e55619dc2211a13786e72', + }, +} as unknown as TypedDocumentString< + ServerCollectionPageQueryQuery, + ServerCollectionPageQueryQueryVariables +> +export const ServerProductQueryDocument = { + __meta__: { + operationName: 'ServerProductQuery', + operationHash: 'bf778aa3411fa194094d24f73250124d60496121', + }, +} as unknown as TypedDocumentString< + ServerProductQueryQuery, + ServerProductQueryQueryVariables +> +export const ValidateCartMutationDocument = { + __meta__: { + operationName: 'ValidateCartMutation', + operationHash: '87e1ba227013cb087bcbb35584c1b0b7cdf612ef', + }, +} as unknown as TypedDocumentString< + ValidateCartMutationMutation, + ValidateCartMutationMutationVariables +> +export const SubscribeToNewsletterDocument = { + __meta__: { + operationName: 'SubscribeToNewsletter', + operationHash: 'feb7005103a859e2bc8cf2360d568806fd88deba', + }, +} as unknown as TypedDocumentString< + SubscribeToNewsletterMutation, + SubscribeToNewsletterMutationVariables +> +export const ClientManyProductsQueryDocument = { + __meta__: { + operationName: 'ClientManyProductsQuery', + operationHash: 'b854e384d076dc482f0afe016b604d527f2562a3', + }, +} as unknown as TypedDocumentString< + ClientManyProductsQueryQuery, + ClientManyProductsQueryQueryVariables +> +export const ClientProductGalleryQueryDocument = { + __meta__: { + operationName: 'ClientProductGalleryQuery', + operationHash: '6d9e14e3ac08a539b7df06ad644b7f34527d9493', + }, +} as unknown as TypedDocumentString< + ClientProductGalleryQueryQuery, + ClientProductGalleryQueryQueryVariables +> +export const ClientProductQueryDocument = { + __meta__: { + operationName: 'ClientProductQuery', + operationHash: 'e535e4897bf98968b8ce0a59af64212c4a746e6f', + }, +} as unknown as TypedDocumentString< + ClientProductQueryQuery, + ClientProductQueryQueryVariables +> +export const ClientSearchSuggestionsQueryDocument = { + __meta__: { + operationName: 'ClientSearchSuggestionsQuery', + operationHash: '31f2520a6ab19cf0773667e14b382c27abf5e485', + }, +} as unknown as TypedDocumentString< + ClientSearchSuggestionsQueryQuery, + ClientSearchSuggestionsQueryQueryVariables +> +export const ClientTopSearchSuggestionsQueryDocument = { + __meta__: { + operationName: 'ClientTopSearchSuggestionsQuery', + operationHash: 'e2385b0f11726d0068f96548f57a8dd441c064e3', + }, +} as unknown as TypedDocumentString< + ClientTopSearchSuggestionsQueryQuery, + ClientTopSearchSuggestionsQueryQueryVariables +> +export const ValidateSessionDocument = { + __meta__: { + operationName: 'ValidateSession', + operationHash: '5696202828f9275216a445e316ebf516f168c506', + }, +} as unknown as TypedDocumentString< + ValidateSessionMutation, + ValidateSessionMutationVariables +> +export const ClientShippingSimulationQueryDocument = { + __meta__: { + operationName: 'ClientShippingSimulationQuery', + operationHash: 'd6667f1de2a26b94b9b55f4b25d7d823f82635a0', + }, +} as unknown as TypedDocumentString< + ClientShippingSimulationQueryQuery, + ClientShippingSimulationQueryQueryVariables +> diff --git a/packages/core/@generated/graphql/persisted.json b/packages/core/@generated/graphql/persisted.json deleted file mode 100644 index 5025c4c1f7..0000000000 --- a/packages/core/@generated/graphql/persisted.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "ServerCollectionPageQuery": "query ServerCollectionPageQuery($slug: String!) {\n collection(slug: $slug) {\n id\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", - "ServerProductQuery": "query ServerProductQuery($locator: [IStoreSelectedFacet!]!) {\n product(locator: $locator) {\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", - "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", - "SubscribeToNewsletter": "mutation SubscribeToNewsletter($data: IPersonNewsletter!) {\n subscribeToNewsletter(data: $data) {\n id\n }\n}\n", - "ClientManyProductsQuery": "query ClientManyProductsQuery($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", - "ClientProductGalleryQuery": "query ClientProductGalleryQuery($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 metadata {\n isTermMisspelled\n logicalOperator\n }\n }\n}\n", - "ClientProductQuery": "query ClientProductQuery($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 additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n }\n}\n", - "ClientSearchSuggestionsQuery": "query ClientSearchSuggestionsQuery($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 products {\n pageInfo {\n totalCount\n }\n }\n metadata {\n isTermMisspelled\n logicalOperator\n }\n }\n}\n", - "ClientTopSearchSuggestionsQuery": "query ClientTopSearchSuggestionsQuery($term: String!, $selectedFacets: [IStoreSelectedFacet!]) {\n search(first: 5, term: $term, selectedFacets: $selectedFacets) {\n suggestions {\n terms {\n value\n }\n }\n }\n}\n", - "ValidateSession": "mutation ValidateSession($session: IStoreSession!, $search: String!) {\n validateSession(session: $session, search: $search) {\n locale\n channel\n country\n addressType\n postalCode\n deliveryMode {\n deliveryChannel\n deliveryMethod\n deliveryWindow {\n startDate\n endDate\n }\n }\n geoCoordinates {\n latitude\n longitude\n }\n currency {\n code\n symbol\n }\n person {\n id\n email\n givenName\n familyName\n }\n }\n}\n", - "ClientShippingSimulationQuery": "query ClientShippingSimulationQuery($postalCode: String!, $country: String!, $items: [IShippingItem!]!) {\n shipping(items: $items, postalCode: $postalCode, country: $country) {\n address {\n city\n neighborhood\n state\n }\n logisticsInfo {\n slas {\n carrier\n price\n availableDeliveryWindows {\n startDateUtc\n endDateUtc\n price\n listPrice\n }\n shippingEstimate\n localizedEstimates\n }\n }\n }\n}\n" -} diff --git a/packages/core/@generated/graphql/schema.graphql b/packages/core/@generated/graphql/schema.graphql deleted file mode 100644 index 804f07b93c..0000000000 --- a/packages/core/@generated/graphql/schema.graphql +++ /dev/null @@ -1,1053 +0,0 @@ -schema { - query: Query - mutation: Mutation -} - -directive @cacheControl(sMaxAge: Int, staleWhileRevalidate: Int, scope: String) on FIELD_DEFINITION - -"""Each product edge contains a `node`, with product information, and a `cursor`, that can be used as a reference for pagination.""" -type StoreProductEdge { - """Each product node contains the information of a product returned by the query.""" - node: StoreProduct! - """Product cursor. Used as pagination reference.""" - cursor: String! -} - -"""Product connections, including pagination information and products returned by the query.""" -type StoreProductConnection { - """Product pagination information.""" - pageInfo: StorePageInfo! - """Array with product connection edges, each containing a product and a corresponding cursor.""" - edges: [StoreProductEdge!]! -} - -"""Each collection edge contains a `node`, with product collection information, and a `cursor`, that can be used as a reference for pagination.""" -type StoreCollectionEdge { - """Each collection node contains the information of a product collection returned by the query.""" - node: StoreCollection! - """Collection cursor. Used as pagination reference.""" - cursor: String! -} - -"""Collection connections, including pagination information and collections returned by the query.""" -type StoreCollectionConnection { - """Collection pagination information.""" - pageInfo: StorePageInfo! - """Array with collection connection page edges, each containing a collection and a corresponding cursor..""" - edges: [StoreCollectionEdge!]! -} - -"""Product search results sorting options.""" -enum StoreSort { - """Sort by price, from highest to lowest.""" - price_desc - """Sort by price, from lowest to highest.""" - price_asc - """Sort by orders, from highest to lowest.""" - orders_desc - """Sort by name, in reverse alphabetical order.""" - name_desc - """Sort by name, in alphabetical order.""" - name_asc - """Sort by release date, from highest to lowest.""" - release_desc - """Sort by discount value, from highest to lowest.""" - discount_desc - """Sort by product score, from highest to lowest.""" - score_desc -} - -"""Selected search facet input.""" -input IStoreSelectedFacet { - """Selected search facet key.""" - key: String! - """Selected search facet value.""" - value: String! -} - -"""Search facet type.""" -enum StoreFacetType { - """Indicates boolean search facet.""" - BOOLEAN - """Indicates range type search facet.""" - RANGE -} - -"""Suggestion term.""" -type StoreSuggestionTerm { - """The term.""" - value: String! - """Its occurrences count.""" - count: Int! -} - -"""Suggestions information.""" -type StoreSuggestions { - """Array with suggestion terms.""" - terms: [StoreSuggestionTerm!]! - """Array with suggestion products' information.""" - products: [StoreProduct!]! -} - -"""Search result.""" -type SearchMetadata { - """Indicates if the search term was misspelled.""" - isTermMisspelled: Boolean! - """Logical operator used to run the search.""" - logicalOperator: String! -} - -"""Search result.""" -type StoreSearchResult { - """Search result products.""" - products: StoreProductConnection! - """Array of search result facets.""" - facets: [StoreFacet!]! - """Search result suggestions.""" - suggestions: StoreSuggestions! - """Search result metadata. Additional data can be used to send analytics events.""" - metadata: SearchMetadata -} - -input IGeoCoordinates { - """The latitude of the geographic coordinates.""" - latitude: Float! - """The longitude of the geographic coordinates.""" - longitude: Float! -} - -type Query { - """Returns the details of a product based on the specified locator.""" - product( - """An array of selected search facets.""" - locator: [IStoreSelectedFacet!]! - ): StoreProduct! @cacheControl(scope: "public", sMaxAge: 120, staleWhileRevalidate: 3600) - """Returns the details of a collection based on the collection slug.""" - collection( - """Collection slug.""" - slug: String! - ): StoreCollection! @cacheControl(scope: "public", sMaxAge: 120, staleWhileRevalidate: 3600) - """Returns the result of a product, facet, or suggestion search.""" - search( - """Search pagination argument, indicating how many results should be returned from the complete result list.""" - first: Int! - """Search pagination argument, indicating the cursor corresponding with the item after which the results should be fetched.""" - after: String - """Search results sorting mode.""" - sort: StoreSort = score_desc - """Search term.""" - term: String = "" - """Array of selected search facets.""" - selectedFacets: [IStoreSelectedFacet!] - ): StoreSearchResult! @cacheControl(scope: "public", sMaxAge: 120, staleWhileRevalidate: 3600) - """Returns information about all products.""" - allProducts( - """Product pagination argument, indicating how many items should be returned from the complete result list.""" - first: Int! - """Product pagination argument, indicating the cursor corresponding with the item after which the items should be fetched.""" - after: String - ): StoreProductConnection! @cacheControl(scope: "public", sMaxAge: 120, staleWhileRevalidate: 3600) - """Returns information about all collections.""" - allCollections( - """Collection pagination argument, indicating how many items should be returned from the complete result list.""" - first: Int! - """Collection pagination argument, indicating the cursor corresponding with the item after which the items should be fetched.""" - after: String - ): StoreCollectionConnection! @cacheControl(scope: "public", sMaxAge: 120, staleWhileRevalidate: 3600) - """Returns information about shipping simulation.""" - shipping( - """List of SKU products""" - items: [IShippingItem!]! - """Postal code to freight calculator""" - postalCode: String! - """Country of postal code""" - country: String! - ): ShippingData @cacheControl(scope: "public", sMaxAge: 120, staleWhileRevalidate: 3600) - """Returns if there's a redirect for a search.""" - redirect( - """Search term.""" - term: String - """Array of selected search facets.""" - selectedFacets: [IStoreSelectedFacet!] - ): StoreRedirect - """Returns a list of sellers available for a specific localization.""" - sellers( - """Postal code input to calculate sellers""" - postalCode: String - """Geocoordinates input to calculate sellers""" - geoCoordinates: IGeoCoordinates - """Country of localization""" - country: String! - """Sales channel of the navigation""" - salesChannel: String - ): SellersData @cacheControl(scope: "public", sMaxAge: 120, staleWhileRevalidate: 3600) -} - -""" -Redirect informations, including url returned by the query. -https://schema.org/Thing -""" -type StoreRedirect { - """URL to redirect""" - url: String -} - -"""Regionalization with sellers information.""" -type SellersData { - """Identification of region.""" - id: String - """List of sellers.""" - sellers: [SellerInfo] -} - -"""Information of sellers.""" -type SellerInfo { - """Identification of the seller""" - id: String - """Name of the seller""" - name: String - """Logo of the seller""" - logo: String -} - -type Mutation { - """Checks for changes between the cart presented in the UI and the cart stored in the ecommerce platform. If changes are detected, it returns the cart stored on the platform. Otherwise, it returns `null`.""" - validateCart(cart: IStoreCart!, session: IStoreSession): StoreCart - """Updates a web session with the specified values.""" - validateSession(session: IStoreSession!, search: String!): StoreSession - """Subscribes a new person to the newsletter list.""" - subscribeToNewsletter(data: IPersonNewsletter!): PersonNewsletter -} - -"""Address information.""" -type Address { - """Address postal code""" - postalCode: String - """Address city""" - city: String - """Address state""" - state: String - """Address country""" - country: String - """Address street""" - street: String - """Address number""" - number: String - """Address neighborhood""" - neighborhood: String - """Address complement""" - complement: String - """Address reference""" - reference: String - """Address geoCoordinates""" - geoCoordinates: [Float] -} - -"""Brand of a given product.""" -type StoreBrand { - """Brand name.""" - name: String! -} - -"""Item of a list.""" -type StoreListItem { - """List item value.""" - item: String! - """Name of the list item.""" - name: String! - """Position of the item in the list.""" - position: Int! -} - -"""List of items consisting of chain linked web pages, ending with the current page.""" -type StoreBreadcrumbList { - """Array with breadcrumb elements.""" - itemListElement: [StoreListItem!]! - """Number of breadcrumbs in the list.""" - numberOfItems: Int! -} - -"""Product collection type. Possible values are `Department`, `Category`, `Brand`, `Cluster`, `SubCategory` or `Collection`.""" -enum StoreCollectionType { - """First level of product categorization.""" - Department - """Second level of product categorization.""" - Category - """Third level of product categorization.""" - SubCategory - """Product brand.""" - Brand - """Product cluster.""" - Cluster - """Product collection.""" - Collection -} - -"""Product collection facet, used for search.""" -type StoreCollectionFacet { - """Facet key.""" - key: String! - """Facet value.""" - value: String! -} - -"""Collection meta information. Used for search.""" -type StoreCollectionMeta { - """List of selected collection facets.""" - selectedFacets: [StoreCollectionFacet!]! -} - -"""Product collection information.""" -type StoreCollection { - """Meta tag data.""" - seo: StoreSeo! - """List of items consisting of chain linked web pages, ending with the current page.""" - breadcrumbList: StoreBreadcrumbList! - """Collection meta information. Used for search.""" - meta: StoreCollectionMeta! - """Collection ID.""" - id: ID! - """Corresponding collection URL slug, with which to retrieve this entity.""" - slug: String! - """Collection type.""" - type: StoreCollectionType! -} - -union StoreFacet = StoreFacetRange | StoreFacetBoolean - -"""Search facet range information.""" -type StoreFacetRange { - """Facet key.""" - key: String! - """Facet label.""" - label: String! - """Minimum facet range value.""" - min: StoreFacetValueRange! - """Maximum facet range value.""" - max: StoreFacetValueRange! -} - -"""Search facet boolean information.""" -type StoreFacetBoolean { - """Facet key.""" - key: String! - """Facet label.""" - label: String! - """Array with information on each facet value.""" - values: [StoreFacetValueBoolean!]! -} - -"""Search facet range value information. Used for minimum and maximum range values.""" -type StoreFacetValueRange { - """Search facet range absolute value.""" - absolute: Float! - """Search facet range selected value.""" - selected: Float! -} - -"""Information of a specific facet value.""" -type StoreFacetValueBoolean { - """Facet value.""" - value: String! - """Facet value label.""" - label: String! - """Indicates whether facet is selected.""" - selected: Boolean! - """Number of items with this facet.""" - quantity: Int! -} - -"""Image.""" -type StoreImage { - """Image URL.""" - url: String! - """Alias for the image.""" - alternateName: String! -} - -"""Image input.""" -input IStoreImage { - """Image input URL.""" - url: String! - """Alias for the input image.""" - alternateName: String! -} - -"""Whenever you make a query that allows for pagination, such as `allProducts` or `allCollections`, you can check `StorePageInfo` to learn more about the complete set of items and use it to paginate your queries.""" -type StorePageInfo { - """Indicates whether there is at least one more page with items after the ones returned in the current query.""" - hasNextPage: Boolean! - """Indicates whether there is at least one more page with items before the ones returned in the current query.""" - hasPreviousPage: Boolean! - """Cursor corresponding to the first possible item.""" - startCursor: String! - """Cursor corresponding to the last possible item.""" - endCursor: String! - """Total number of items (products or collections), not pages.""" - totalCount: Int! -} - -"""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.""" -type StoreProduct { - """Meta tag data.""" - seo: StoreSeo! - """List of items consisting of chain linked web pages, ending with the current page.""" - breadcrumbList: StoreBreadcrumbList! - """Corresponding collection URL slug, with which to retrieve this entity.""" - slug: String! - """Product name.""" - name: String! - """Product ID, such as [ISBN](https://www.isbn-international.org/content/what-isbn) or similar global IDs.""" - productID: String! - """Product brand.""" - brand: StoreBrand! - """Product description.""" - description: String! - """Array of images.""" - image: [StoreImage!]! - """Aggregate offer information.""" - offers: StoreAggregateOffer! - """Stock Keeping Unit. Merchant-specific ID for the product.""" - sku: String! - """Global Trade Item Number.""" - gtin: String! - """Array with review information.""" - review: [StoreReview!]! - """Aggregate ratings data.""" - aggregateRating: StoreAggregateRating! - """Indicates product group related to this product.""" - isVariantOf: StoreProductGroup! - """Array of additional properties.""" - additionalProperty: [StorePropertyValue!]! - """The product's release date. Formatted using https://en.wikipedia.org/wiki/ISO_8601""" - releaseDate: String! -} - -"""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.""" -input IStoreProduct { - """Stock Keeping Unit. Merchant-specific ID for the product.""" - sku: String! - """Product name.""" - name: String! - """Array of product images.""" - image: [IStoreImage!]! - """Custom Product Additional Properties.""" - additionalProperty: [IStorePropertyValue!] -} - -"""Search Engine Optimization (SEO) tags data.""" -type StoreSeo { - """Title tag.""" - title: String! - """Title template tag.""" - titleTemplate: String! - """Description tag.""" - description: String! - """Canonical tag.""" - canonical: String! -} - -"""Offer information.""" -type StoreOffer { - """This is displayed as the "from" price in the context of promotions' price comparison. This may change before it reaches the shelf.""" - listPrice: Float! - """Computed price before applying coupons, taxes or benefits. This may change before it reaches the shelf.""" - sellingPrice: Float! - """ISO code of the currency used for the offer prices.""" - priceCurrency: String! - """Also known as spot price.""" - price: Float! - """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.""" - priceValidUntil: String! - """Offer item condition.""" - itemCondition: String! - """Offer item availability.""" - availability: String! - """Seller responsible for the offer.""" - seller: StoreOrganization! - """Information on the item being offered.""" - itemOffered: StoreProduct! - """Number of items offered.""" - quantity: Int! -} - -"""Offer input.""" -input IStoreOffer { - """Also known as spot price.""" - price: Float! - """This is displayed as the "from" price in the context of promotions' price comparison. This may change before it reaches the shelf.""" - listPrice: Float! - """Seller responsible for the offer.""" - seller: IStoreOrganization! - """Information on the item being offered.""" - itemOffered: IStoreProduct! - """Number of items offered.""" - quantity: Int! -} - -"""Average rating, based on multiple ratings or reviews.""" -type StoreAggregateRating { - """Value of the aggregate rating.""" - ratingValue: Float! - """Total number of ratings.""" - reviewCount: Int! -} - -"""Information of a given review rating.""" -type StoreReviewRating { - """Rating value.""" - ratingValue: Float! - """Best rating value.""" - bestRating: Float! -} - -"""Information of a given review.""" -type StoreReview { - """Review rating information.""" - reviewRating: StoreReviewRating! - """Review author.""" - author: StoreAuthor! -} - -"""information about the author of a product review or rating.""" -type StoreAuthor { - """Author name.""" - name: String! -} - -"""Product group information. Product groups are catalog entities that may contain variants. They are equivalent to VTEX [Products](https://help.vtex.com/en/tutorial/what-is-a-product--2zrB2gFCHyQokCKKE8kuAw#), whereas each variant is equivalent to a VTEX [SKU](https://help.vtex.com/en/tutorial/what-is-an-sku--1K75s4RXAQyOuGUYKMM68u#). For example, you may have a **Shirt** product group with associated products such as **Blue shirt size L**, **Green shirt size XL** and so on.""" -type StoreProductGroup { - """Array of variants related to product group. Variants are equivalent to VTEX [SKUs](https://help.vtex.com/en/tutorial/what-is-an-sku--1K75s4RXAQyOuGUYKMM68u#).""" - hasVariant: [StoreProduct!]! - """Product group ID.""" - productGroupID: String! - """Product group name.""" - name: String! - """Array of additional properties.""" - additionalProperty: [StorePropertyValue!]! - """ - Object containing data structures to facilitate handling different SKU - variant properties. Specially useful for implementing SKU selection - components. - """ - skuVariants: SkuVariants -} - -"""Organization.""" -type StoreOrganization { - """Organization ID.""" - identifier: String! -} - -"""Organization input.""" -input IStoreOrganization { - """Organization ID.""" - identifier: String! -} - -"""Aggregate offer information, for a given SKU that is available to be fulfilled by multiple sellers.""" -type StoreAggregateOffer { - """Highest price among all sellers.""" - highPrice: Float! - """Lowest price among all sellers.""" - lowPrice: Float! - """Number of sellers selling this SKU.""" - offerCount: Int! - """ISO code of the currency used for the offer prices.""" - priceCurrency: String! - """Array with information on each available offer.""" - offers: [StoreOffer!]! -} - -"""Information of a specific order.""" -type StoreOrder { - """ID of the order in [VTEX order management](https://help.vtex.com/en/tutorial/license-manager-resources-oms--60QcBsvWeum02cFi3GjBzg#).""" - orderNumber: String! - """Array with information on each accepted offer.""" - acceptedOffer: [StoreOffer!]! -} - -"""Order input.""" -input IStoreOrder { - """ID of the order in [VTEX order management](https://help.vtex.com/en/tutorial/license-manager-resources-oms--60QcBsvWeum02cFi3GjBzg#).""" - orderNumber: String! - """Array with information on each accepted offer.""" - acceptedOffer: [IStoreOffer!]! - """Indicates whether or not items with attachments should be split.""" - shouldSplitItem: Boolean -} - -"""Shopping cart message.""" -type StoreCartMessage { - """Shopping cart message text.""" - text: String! - """Shopping cart message status, which can be `INFO`, `WARNING` or `ERROR`.""" - status: StoreStatus! -} - -"""Shopping cart information.""" -type StoreCart { - """Order information, including `orderNumber` and `acceptedOffer`.""" - order: StoreOrder! - """List of shopping cart messages.""" - messages: [StoreCartMessage!]! -} - -"""Shopping cart input.""" -input IStoreCart { - """Order information, including `orderNumber`, `acceptedOffer` and `shouldSplitItem`.""" - order: IStoreOrder! -} - -"""Status used to indicate a message type. For instance, a shopping cart informative or error message.""" -enum StoreStatus { - INFO - WARNING - ERROR -} - -"""Properties that can be associated with products and products groups.""" -type StorePropertyValue { - """Property id. This propert changes according to the content of the object.""" - propertyID: String! - """Property value. May hold a string or the string representation of an object.""" - value: ObjectOrString! - """Property name.""" - name: String! - """Specifies the nature of the value""" - valueReference: String! -} - -input IStorePropertyValue { - """Property id. This propert changes according to the content of the object.""" - propertyID: String - """Property value. May hold a string or the string representation of an object.""" - value: ObjectOrString! - """Property name.""" - name: String! - """Specifies the nature of the value""" - valueReference: String! -} - -"""Client profile data.""" -type StorePerson { - """Client ID.""" - id: String! - """Client email.""" - email: String! - """Client first name.""" - givenName: String! - """Client last name.""" - familyName: String! -} - -"""Client profile data.""" -input IStorePerson { - """Client ID.""" - id: String! - """Client email.""" - email: String! - """Client first name.""" - givenName: String! - """Client last name.""" - familyName: String! -} - -scalar ObjectOrString - -"""Currency information.""" -type StoreCurrency { - """Currency code (e.g: USD).""" - code: String! - """Currency symbol (e.g: $).""" - symbol: String! -} - -input IStoreCurrency { - """Currency code (e.g: USD).""" - code: String! - """Currency symbol (e.g: $).""" - symbol: String! -} - -"""Geographic coordinates information.""" -type StoreGeoCoordinates { - """The latitude of the geographic coordinates.""" - latitude: Float! - """The longitude of the geographic coordinates.""" - longitude: Float! -} - -input IStoreGeoCoordinates { - """The latitude of the geographic coordinates.""" - latitude: Float! - """The longitude of the geographic coordinates.""" - longitude: Float! -} - -"""Delivery window information.""" -type StoreDeliveryWindow { - """The delivery window start date information.""" - startDate: String! - """The delivery window end date information.""" - endDate: String! -} - -"""Delivery window information.""" -input IStoreDeliveryWindow { - """The delivery window start date information.""" - startDate: String! - """The delivery window end date information.""" - endDate: String! -} - -"""Delivery mode information.""" -type StoreDeliveryMode { - """The delivery channel information of the session.""" - deliveryChannel: String! - """The delivery method information of the session.""" - deliveryMethod: String! - """The delivery window information of the session.""" - deliveryWindow: StoreDeliveryWindow -} - -input IStoreDeliveryMode { - """The delivery channel information of the session.""" - deliveryChannel: String! - """The delivery method information of the session.""" - deliveryMethod: String! - """The delivery window information of the session.""" - deliveryWindow: IStoreDeliveryWindow -} - -"""Session information.""" -type StoreSession { - """Session locale.""" - locale: String! - """Session currency.""" - currency: StoreCurrency! - """Session country.""" - country: String! - """Session channel.""" - channel: String - """Session delivery mode.""" - deliveryMode: StoreDeliveryMode - """Session address type.""" - addressType: String - """Session postal code.""" - postalCode: String - """Session input geoCoordinates.""" - geoCoordinates: StoreGeoCoordinates - """Session input person.""" - person: StorePerson -} - -"""Session input.""" -input IStoreSession { - """Session input locale.""" - locale: String! - """Session input currency.""" - currency: IStoreCurrency! - """Session input country.""" - country: String! - """Session input channel.""" - channel: String - """Session input delivery mode.""" - deliveryMode: IStoreDeliveryMode - """Session input address type.""" - addressType: String - """Session input postal code.""" - postalCode: String - """Session input geoCoordinates.""" - geoCoordinates: IStoreGeoCoordinates - """Session input person.""" - person: IStorePerson -} - -"""Newsletter information.""" -type PersonNewsletter { - """Person's ID in the newsletter list.""" - id: String! -} - -"""Person data input to the newsletter.""" -input IPersonNewsletter { - """Person's name.""" - name: String! - """Person's email.""" - email: String! -} - -type SkuVariants { - """SKU property values for the current SKU.""" - activeVariations: ActiveVariations - """All available options for each SKU variant property, indexed by their name.""" - allVariantsByName: VariantsByName - """ - Maps property value combinations to their respective SKU's slug. Enables - us to retrieve the slug for the SKU that matches the currently selected - variations in O(1) time. - If `dominantVariantName` is not present, the first variant will be - considered the dominant one. - """ - slugsMap(dominantVariantName: String): SlugsMap - """ - Available options for each varying SKU property, taking into account the - `dominantVariantName` property. Returns all available options for the - dominant property, and only options that can be combined with its current - value for other properties. - If `dominantVariantName` is not present, the first variant will be - considered the dominant one. - """ - availableVariations(dominantVariantName: String): FormattedVariants -} - -""" -Example: - -```json -{ - 'Color-Red-Size-40': 'classic-shoes-37' -} -``` -""" -scalar SlugsMap - -""" -Example: - -```json -{ - Color: 'Red', Size: '42' -} -``` -""" -scalar ActiveVariations - -""" -Example: - -```json -{ - Color: [ "Red", "Blue", "Green" ], - Size: [ "40", "41" ] -} -``` -""" -scalar VariantsByName - -""" -Example: - -```json -{ - Color: [ - { - src: "https://storecomponents.vtexassets.com/...", - alt: "...", - label: "...", - value: "..." - }, - { - src: "https://storecomponents.vtexassets.com/...", - alt: "...", - label: "...", - value: "..." - } - ], - Size: [ - { - src: "https://storecomponents.vtexassets.com/...", - alt: "...", - label: "...", - value: "..." - } - ] -} -``` -""" -scalar FormattedVariants - -"""Shipping Simulation item input.""" -input IShippingItem { - """ShippingItem ID / Sku.""" - id: String! - """Number of items.""" - quantity: Int! - """Seller responsible for the ShippingItem.""" - seller: String! -} - -"""Shipping Simulation information.""" -type ShippingData { - """List of LogisticsItem.""" - items: [LogisticsItem] - """List of LogisticsInfo.""" - logisticsInfo: [LogisticsInfo] - """List of MessageInfo.""" - messages: [MessageInfo] - """Address information.""" - address: Address -} - -"""Shipping Simulation Logistic Item.""" -type LogisticsItem { - """LogisticsItem ID / Sku.""" - id: String - requestIndex: Int - """Number of items.""" - quantity: Int - """Seller responsible for the ShippingItem.""" - seller: String - """List of Sellers.""" - sellerChain: [String] - """LogisticsItem tax.""" - tax: Int - """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.""" - priceValidUntil: String - """LogisticsItem price.""" - price: Int - """LogisticsItem listPrice.""" - listPrice: Int - """LogisticsItem rewardValue.""" - rewardValue: Int - """LogisticsItem sellingPrice.""" - sellingPrice: Int - """LogisticsItem measurementUnit.""" - measurementUnit: String - """LogisticsItem unitMultiplier.""" - unitMultiplier: Int - """LogisticsItem availability.""" - availability: String -} - -type LogisticsInfo { - """LogisticsInfo itemIndex.""" - itemIndex: String - """LogisticsInfo selectedSla.""" - selectedSla: String - """List of LogisticsInfo ShippingSLA.""" - slas: [ShippingSLA] -} - -type ShippingSLA { - """ShippingSLA id.""" - id: String - """ShippingSLA name.""" - name: String - """ShippingSLA price.""" - price: Float - """ShippingSLA shipping estimate.""" - shippingEstimate: String - """ - ShippingSLA localized shipping estimate. - Note: this will always return a localized string for locale `en-US`. - """ - localizedEstimates: String - """ShippingSLA available delivery windows.""" - availableDeliveryWindows: [AvailableDeliveryWindows] - """ShippingSLA shipping estimate date.""" - shippingEstimateDate: String - """List of ShippingSLA delivery ids.""" - deliveryIds: [DeliveryIds] - """ShippingSLA delivery channel.""" - deliveryChannel: String - """ShippingSLA friendly name.""" - friendlyName: String - """ShippingSLA carrier.""" - carrier: String - """ShippingSLA pickup point id.""" - pickupPointId: String - """ShippingSLA pickup store info.""" - pickupStoreInfo: PickupStoreInfo - """ShippingSLA pickup distance.""" - pickupDistance: Float -} - -type AvailableDeliveryWindows { - """Available delivery window start date in UTC""" - startDateUtc: String - """Available delivery window end date in UTC""" - endDateUtc: String - """Available delivery window price""" - price: Int - """Available delivery window list price""" - listPrice: Int - """Available delivery window tax""" - tax: Int -} - -type DeliveryIds { - """DeliveryIds courier id""" - courierId: String - """DeliveryIds warehouse id""" - warehouseId: String - """DeliveryIds dock id""" - dockId: String - """DeliveryIds courier name""" - courierName: String - """DeliveryIds quantity""" - quantity: Int -} - -type PickupStoreInfo { - """PickupStoreInfo friendly name.""" - friendlyName: String - """PickupStoreInfo address.""" - address: PickupAddress - """PickupStoreInfo additional information.""" - additionalInfo: String - """PickupStoreInfo dock id.""" - dockId: String - """Information if the store has pickup enable.""" - isPickupStore: Boolean -} - -type PickupAddress { - """PickupAddress address type.""" - addressType: String - """PickupAddress receiver name.""" - receiverName: String - """PickupAddress address id.""" - addressId: String - """PickupAddress postal code.""" - postalCode: String - """PickupAddress city.""" - city: String - """PickupAddress state.""" - state: String - """PickupAddress country.""" - country: String - """PickupAddress street.""" - street: String - """PickupAddress number.""" - number: String - """PickupAddress neighborhood.""" - neighborhood: String - """PickupAddress complement.""" - complement: String - """PickupAddress reference.""" - reference: String - """PickupAddress geo coordinates.""" - geoCoordinates: [Float] -} - -type MessageInfo { - """MessageInfo code.""" - code: String - """MessageInfo text.""" - text: String - """MessageInfo status.""" - status: String - """MessageInfo fields.""" - fields: MessageFields -} - -type MessageFields { - """MessageFields item index.""" - itemIndex: String - """MessageFields ean.""" - ean: String - """MessageFields sku name.""" - skuName: String -} diff --git a/packages/core/@generated/index.ts b/packages/core/@generated/index.ts new file mode 100644 index 0000000000..83a238245e --- /dev/null +++ b/packages/core/@generated/index.ts @@ -0,0 +1 @@ +export * from './gql' diff --git a/packages/core/api/index.ts b/packages/core/api/index.ts index f205c3b1e3..5639b74bf5 100644 --- a/packages/core/api/index.ts +++ b/packages/core/api/index.ts @@ -1,4 +1,4 @@ -export { gql } from '@faststore/graphql-utils' +export { gql } from '../@generated' export type { StoreAggregateOfferRoot, StorePropertyValueRoot, diff --git a/packages/core/cms/faststore/content-types.json b/packages/core/cms/faststore/content-types.json index 28f56ac2a2..64a1ab632e 100644 --- a/packages/core/cms/faststore/content-types.json +++ b/packages/core/cms/faststore/content-types.json @@ -207,5 +207,23 @@ ] } ] + }, + { + "id": "login", + "name": "Login", + "configurationSchemaSets": [], + "isSingleton": true + }, + { + "id": "500", + "name": "Error 500", + "configurationSchemaSets": [], + "isSingleton": true + }, + { + "id": "404", + "name": "Error 404", + "configurationSchemaSets": [], + "isSingleton": true } ] diff --git a/packages/core/cms/faststore/sections.json b/packages/core/cms/faststore/sections.json index 8dcbeaa29c..b60c291cac 100644 --- a/packages/core/cms/faststore/sections.json +++ b/packages/core/cms/faststore/sections.json @@ -1949,5 +1949,78 @@ } } } + }, + { + "name": "EmptyState", + "schema": { + "title": "Empty State", + "type": "object", + "description": "Empty State configuration", + "properties": { + "title": { + "title": "Title", + "type": "string" + }, + "titleIcon": { + "title": "Title Icon", + "type": "object", + "properties": { + "icon": { + "title": "Icon", + "type": "string", + "enumNames": ["CircleWavy Warning"], + "enum": ["CircleWavyWarning"] + }, + "alt": { + "title": "Alternative Label", + "type": "string" + } + } + }, + "subtitle": { + "title": "Subtitle", + "type": "string" + }, + "showLoader": { + "type": "boolean", + "title": "Show loader?", + "default": false + }, + "errorState": { + "title": "Error state used for shown errorId and fromUrl properties in 500 and 404 pages", + "type": "object", + "properties": { + "errorId": { + "title": "errorId used in 500 and 404 pages", + "type": "object", + "properties": { + "show": { + "type": "boolean", + "title": "Show errorId in the end of message?" + }, + "description": { + "type": "string", + "title": "Description shown before the errorId" + } + } + }, + "fromUrl": { + "title": "fromUrl used in 500 and 404 pages", + "type": "object", + "properties": { + "show": { + "type": "boolean", + "title": "Show fromUrl in the end of message?" + }, + "description": { + "type": "string", + "title": "Description shown before the fromUrl" + } + } + } + } + } + } + } } ] diff --git a/packages/core/codegen.ts b/packages/core/codegen.ts new file mode 100644 index 0000000000..09ecf271b7 --- /dev/null +++ b/packages/core/codegen.ts @@ -0,0 +1,61 @@ +import { type CodegenConfig } from '@graphql-codegen/cli' +import { Kind, type DocumentNode } from 'graphql' + +/* Extracts operationName from queries. Example: ServerProductQuery */ +const getOperationName = (document: DocumentNode) => { + for (const definition of document.definitions) { + if ( + definition.kind === Kind.OPERATION_DEFINITION && + typeof definition.name?.value === 'string' + ) { + return definition.name.value + } + } + + return 'UnknownOperation' +} + +const config: CodegenConfig = { + overwrite: true, + errorsOnly: true, + schema: './@generated/schema.graphql', + documents: ['./src/**/*.{ts,tsx}'], + generates: { + './@generated/': { + preset: 'client', + config: { + /** Not all of these properties are supported by the preset, but it reflects our previous config when we used typescript plugins directly */ + preResolveTypes: true, + avoidOptionals: true, + enumsAsTypes: true, + skipTypeNameForRoot: true, + skipTypename: true, + allowEnumStringTypes: false, + flattenGeneratedTypes: true, + namingConvention: 'change-case-all#pascalCase', + exportFragmentSpreadSubTypes: true, + /** Removes useless AST definitions from documents */ + documentMode: 'string', + }, + presetConfig: { + // Disabled fragment masking - it wasn't being used by us. This can be reviewed in the future + fragmentMasking: false, + // Recognizes the gql(`query { ... }`) calls and generates the types for them + gqlTagName: 'gql', + onExecutableDocumentNode: (document: DocumentNode) => ({ + // This makes sure that the operation name is always present in the __meta__ field of each query + // This helps us to identify the query in the persisted documents and to debug errors in the client + operationName: getOperationName(document), + }), + persistedDocuments: { + // Keeps document simple, including only necessary properties as '__meta__' and its properties + mode: 'replaceDocumentWithHash', + // replaces operation['__meta__']['hash'] with operation['__meta__']['operationHash'] + hashPropertyName: 'operationHash', + }, + }, + }, + }, +} + +export default config diff --git a/packages/core/codegen.yml b/packages/core/codegen.yml deleted file mode 100644 index 21d1efef89..0000000000 --- a/packages/core/codegen.yml +++ /dev/null @@ -1,23 +0,0 @@ -overwrite: true -errorsOnly: true -schema: ./@generated/graphql/schema.graphql -documents: - - ./src/**/*.{ts,tsx} -config: -generates: - ./@generated/graphql/index.ts: - config: - preResolveTypes: true - avoidOptionals: true - enumsAsTypes: true - skipTypeNameForRoot: true - skipTypename: true - allowEnumStringTypes: false - namingConvention: 'change-case-all#pascalCase' - exportFragmentSpreadSubTypes: true - plugins: - - typescript - - typescript-operations - ./@generated/graphql/persisted.json: - plugins: - - '@faststore/graphql-utils/codegen' diff --git a/packages/core/index.ts b/packages/core/index.ts index 33b1e00c30..7a8e9e71d1 100644 --- a/packages/core/index.ts +++ b/packages/core/index.ts @@ -24,6 +24,7 @@ export { default as AlertSection } from './src/components/sections/Alert' export { default as BannerTextSection } from './src/components/sections/BannerText' export { default as BreadcrumbSection } from './src/components/sections/Breadcrumb' export { default as CrossSellingShelfSection } from './src/components/sections/CrossSellingShelf' +export { default as EmptyState } from './src/components/sections/EmptyState' export { default as HeroSection } from './src/components/sections/Hero' export { default as NavbarSection } from './src/components/sections/Navbar' export { default as NewsletterSection } from './src/components/sections/Newsletter' diff --git a/packages/core/jest.config.js b/packages/core/jest.config.js index 808464eb8e..fbe216f6d6 100644 --- a/packages/core/jest.config.js +++ b/packages/core/jest.config.js @@ -1,6 +1,14 @@ +const { pathsToModuleNameMapper } = require('ts-jest') +const { compilerOptions } = require('./tsconfig') + /** @type {import('ts-jest').JestConfigWithTsJest} */ module.exports = { preset: 'ts-jest', testPathIgnorePatterns: ['/node_modules/', 'cypress/'], - modulePaths: ['/test'], + + /** Support importing from src/ or @generated/ folders (TS path imports) */ + modulePaths: [compilerOptions.baseUrl], // <-- This will be set to 'baseUrl' value + moduleNameMapper: pathsToModuleNameMapper( + compilerOptions.paths /*, { prefix: '/' } */ + ), } diff --git a/packages/core/next.config.js b/packages/core/next.config.js index 808a0f0ace..fa041b2953 100644 --- a/packages/core/next.config.js +++ b/packages/core/next.config.js @@ -7,6 +7,8 @@ const storeConfig = require('./faststore.config') * */ const nextConfig = { /* config options here */ + /* Replaces terser by swc for minifying. It's the default in NextJS 13 */ + swcMinify: true, images: { domains: [`${storeConfig.api.storeId}.vtexassets.com`], deviceSizes: [360, 540, 768, 1280, 1440], diff --git a/packages/core/package.json b/packages/core/package.json index 9081389612..e8cd9feea2 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -11,6 +11,7 @@ "scripts": { "generate:schema": "tsx src/server/generator/generateGraphQLSchemaFile.ts", "generate:codegen": "graphql-codegen", + "generate:copy-back": "copyfiles \"@generated/**/*\" $DESTINATION", "generate": "faststore generate-graphql -c", "build": "yarn partytown & yarn generate && next build", "dev": "yarn partytown & yarn generate && next dev", @@ -43,23 +44,26 @@ "@faststore/sdk": "^2.2.78", "@faststore/ui": "^2.2.78", "@graphql-codegen/cli": "^3.3.1", + "@graphql-codegen/client-preset": "^4.1.0", "@graphql-codegen/typescript": "^3.0.4", "@graphql-codegen/typescript-operations": "^3.0.4", "@graphql-tools/load-files": "^7.0.0", "@graphql-tools/merge": "^9.0.0", "@graphql-tools/utils": "^9.2.1", + "@graphql-typed-document-node/core": "^3.2.0", "@types/react": "^18.2.42", "@vtex/client-cms": "^0.2.12", "@vtex/prettier-config": "1.0.0", "autoprefixer": "^10.4.0", "chalk": "^5.2.0", + "copyfiles": "^2.4.1", "css-loader": "^6.7.1", "deepmerge": "^4.3.1", "draftjs-to-html": "^0.9.1", "graphql": "^15.0.0", "include-media": "^1.4.10", "msw": "^0.43.1", - "next": "^12.3.1", + "next": "^13.5.6", "next-seo": "^6.4.0", "nextjs-progressbar": "^0.0.14", "postcss": "^8.4.4", diff --git a/packages/core/src/components/product/ProductCard/ProductCard.tsx b/packages/core/src/components/product/ProductCard/ProductCard.tsx index b3847cd202..01eda90522 100644 --- a/packages/core/src/components/product/ProductCard/ProductCard.tsx +++ b/packages/core/src/components/product/ProductCard/ProductCard.tsx @@ -1,4 +1,3 @@ -import { gql } from '@faststore/graphql-utils' import { ProductCard as UIProductCard, ProductCardContent as UIProductCardContent, @@ -6,8 +5,9 @@ import { } from '@faststore/ui' import { memo, useMemo } from 'react' +import { gql } from '@generated' import type { ProductSummary_ProductFragment } from '@generated/graphql' -import { ImageProps } from 'next/future/image' +import { ImageProps } from 'next/image' import NextLink from 'next/link' import { Image } from 'src/components/ui/Image' import { useFormattedPrice } from 'src/sdk/product/useFormattedPrice' @@ -125,7 +125,7 @@ function ProductCard({ ) } -export const fragment = gql` +export const fragment = gql(` fragment ProductSummary_product on StoreProduct { id: productID slug @@ -163,6 +163,6 @@ export const fragment = gql` } } } -` +`) export default memo(ProductCard) diff --git a/packages/core/src/components/search/Filter/Filter.tsx b/packages/core/src/components/search/Filter/Filter.tsx index 9fc77610dc..89d8668aa7 100644 --- a/packages/core/src/components/search/Filter/Filter.tsx +++ b/packages/core/src/components/search/Filter/Filter.tsx @@ -1,7 +1,8 @@ -import { gql } from '@faststore/graphql-utils' import { useUI } from '@faststore/ui' import type { Filter_FacetsFragment } from '@generated/graphql' import { Suspense } from 'react' + +import { gql } from '@generated' import { ProductGalleryProps } from 'src/components/ui/ProductGallery/ProductGallery' import { useOverrideComponents } from 'src/sdk/overrides/OverrideContext' import { useFilter } from 'src/sdk/search/useFilter' @@ -62,7 +63,7 @@ function Filter({ ) } -export const fragment = gql` +export const fragment = gql(` fragment Filter_facets on StoreFacet { ... on StoreFacetRange { key @@ -93,6 +94,6 @@ export const fragment = gql` __typename } } -` +`) export default Filter diff --git a/packages/core/src/components/sections/EmptyState/DefaultComponents.ts b/packages/core/src/components/sections/EmptyState/DefaultComponents.ts new file mode 100644 index 0000000000..abd5d6643d --- /dev/null +++ b/packages/core/src/components/sections/EmptyState/DefaultComponents.ts @@ -0,0 +1,5 @@ +import { EmptyState as UIEmptyState } from '@faststore/ui' + +export const EmptyStateDefaultComponents = { + EmptyState: UIEmptyState, +} as const diff --git a/packages/core/src/components/sections/EmptyState/EmptyState.tsx b/packages/core/src/components/sections/EmptyState/EmptyState.tsx index e2f6af5b4a..11ab8e7f7f 100644 --- a/packages/core/src/components/sections/EmptyState/EmptyState.tsx +++ b/packages/core/src/components/sections/EmptyState/EmptyState.tsx @@ -1,33 +1,116 @@ -import { ReactNode } from 'react' import type { PropsWithChildren } from 'react' +import { useRouter } from 'next/router' + +import { Icon as UIIcon, Loader as UILoader } from '@faststore/ui' + +import { useOverrideComponents } from '../../../sdk/overrides/OverrideContext' import Section from '../Section' + import styles from './section.module.scss' -import { EmptyState as EmptyStateWrapper } from 'src/components/sections/EmptyState/Overrides' +import { EmptyStateDefaultComponents } from './DefaultComponents' +import { getOverridableSection } from '../../../sdk/overrides/getOverriddenSection' export interface EmptyStateProps { + /** + * Title for the `EmptyState` component. + */ title: string - titleIcon?: ReactNode + /** + * A React component that will be rendered as an icon. + */ + titleIcon?: { + icon: string + alt: string + } + /** + * Subtitle for the `EmptyState` component. + */ + subtitle?: string + /** + * Boolean that makes the loader be shown. + */ + showLoader?: boolean + /** + * Object that manages the error state descriptions. + */ + errorState?: { + errorId?: { + show?: boolean + description?: string + } + fromUrl?: { + show?: boolean + description?: string + } + } +} + +const useErrorState = () => { + const router = useRouter() + const { + query: { errorId, fromUrl }, + pathname, + asPath, + } = router + + return { + errorId, + fromUrl: fromUrl ?? asPath ?? pathname, + } } function EmptyState({ - title = EmptyStateWrapper.props.title, - titleIcon = EmptyStateWrapper.props.titleIcon, + title, + titleIcon, children, + subtitle, + errorState, + showLoader = false, }: PropsWithChildren) { + const { EmptyState: EmptyStateWrapper } = + useOverrideComponents<'EmptyState'>() + const { errorId, fromUrl } = useErrorState() + + const icon = !!titleIcon?.icon ? ( + + ) : ( + EmptyStateWrapper.props.titleIcon + ) + return (
+ {!!subtitle &&

{subtitle}

} + {!!errorState?.errorId?.show && ( +

{`${errorState?.errorId?.description} ${errorId}`}

+ )} + {!!errorState?.fromUrl?.show && ( +

{`${errorState?.fromUrl?.description} ${fromUrl}`}

+ )} + {showLoader && } {children}
) } -export default EmptyState +const OverridableEmptyState = getOverridableSection( + 'EmptyState', + EmptyState, + EmptyStateDefaultComponents +) + +export default OverridableEmptyState diff --git a/packages/core/src/components/sections/EmptyState/OverriddenDefaultEmptyState.ts b/packages/core/src/components/sections/EmptyState/OverriddenDefaultEmptyState.ts new file mode 100644 index 0000000000..cc43f67ff9 --- /dev/null +++ b/packages/core/src/components/sections/EmptyState/OverriddenDefaultEmptyState.ts @@ -0,0 +1,15 @@ +import { override } from 'src/customizations/src/components/overrides/EmptyState' +import { getOverriddenSection } from 'src/sdk/overrides/getOverriddenSection' + +import type { SectionOverrideDefinitionV1 } from 'src/typings/overridesDefinition' +import EmptyState from './EmptyState' + +/** + * This component exists to support overrides 1.0 + * + * This allows users to override the default EmptyState section present in the Headless CMS + */ +export const OverriddenDefaultEmptyState = getOverriddenSection({ + ...(override as SectionOverrideDefinitionV1<'EmptyState'>), + Section: EmptyState, +}) diff --git a/packages/core/src/components/sections/EmptyState/Overrides.tsx b/packages/core/src/components/sections/EmptyState/Overrides.tsx deleted file mode 100644 index 203f9b69e7..0000000000 --- a/packages/core/src/components/sections/EmptyState/Overrides.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { EmptyState as UIEmptyState } from '@faststore/ui' - -import { getSectionOverrides } from 'src/sdk/overrides/overrides' -import { override } from 'src/customizations/src/components/overrides/EmptyState' -import type { SectionOverrideDefinitionV1 } from 'src/typings/overridesDefinition' - -const { EmptyState } = getSectionOverrides( - { - EmptyState: UIEmptyState, - }, - override as SectionOverrideDefinitionV1<'EmptyState'> -) - -export { EmptyState } diff --git a/packages/core/src/components/sections/ProductDetails/ProductDetails.tsx b/packages/core/src/components/sections/ProductDetails/ProductDetails.tsx index dc17c8c235..89ef215ab4 100644 --- a/packages/core/src/components/sections/ProductDetails/ProductDetails.tsx +++ b/packages/core/src/components/sections/ProductDetails/ProductDetails.tsx @@ -1,12 +1,12 @@ import { useEffect, useState, useMemo } from 'react' -import { gql } from '@faststore/graphql-utils' import type { CurrencyCode, ViewItemEvent } from '@faststore/sdk' import { sendAnalyticsEvent } from '@faststore/sdk' -import type { AnalyticsItem } from '../../../sdk/analytics/types' -import { useFormattedPrice } from '../../../sdk/product/useFormattedPrice' -import { useSession } from '../../../sdk/session' +import { gql } from '@generated' +import type { AnalyticsItem } from 'src/sdk/analytics/types' +import { useFormattedPrice } from 'src/sdk/product/useFormattedPrice' +import { useSession } from 'src/sdk/session' import Section from '../Section' import ProductDescription from '../../../components/ui/ProductDescription' @@ -238,7 +238,7 @@ function ProductDetails({ ) } -export const fragment = gql` +export const fragment = gql(` fragment ProductDetailsFragment_product on StoreProduct { id: productID sku @@ -280,7 +280,7 @@ export const fragment = gql` # Contains necessary info to add this item to cart ...CartProductItem } -` +`) const OverridableProductDetails = getOverridableSection( 'ProductDetails', diff --git a/packages/core/src/components/ui/Image/Image.tsx b/packages/core/src/components/ui/Image/Image.tsx index 82a4f22b98..a899600bb6 100644 --- a/packages/core/src/components/ui/Image/Image.tsx +++ b/packages/core/src/components/ui/Image/Image.tsx @@ -1,6 +1,6 @@ import { memo } from 'react' -import NextImage, { ImageProps as NextImageProps } from 'next/future/image' +import NextImage, { ImageProps as NextImageProps } from 'next/image' import loader from './loader' export type ImageProps = NextImageProps diff --git a/packages/core/src/customizations/src/fragments/ClientManyProducts.ts b/packages/core/src/customizations/src/fragments/ClientManyProducts.ts index c75a3977a1..ff32a03b47 100644 --- a/packages/core/src/customizations/src/fragments/ClientManyProducts.ts +++ b/packages/core/src/customizations/src/fragments/ClientManyProducts.ts @@ -1,6 +1,6 @@ -import { gql } from '@faststore/graphql-utils' +import { gql } from '@generated' -export const fragment = gql` +export const fragment = gql(` fragment ClientManyProducts on Query { search( first: $first @@ -16,4 +16,4 @@ export const fragment = gql` } } } -` +`) diff --git a/packages/core/src/customizations/src/fragments/ClientProduct.ts b/packages/core/src/customizations/src/fragments/ClientProduct.ts index 70773b1534..af55c10bbe 100644 --- a/packages/core/src/customizations/src/fragments/ClientProduct.ts +++ b/packages/core/src/customizations/src/fragments/ClientProduct.ts @@ -1,9 +1,9 @@ -import { gql } from '@faststore/graphql-utils' +import { gql } from '@generated' -export const fragment = gql` +export const fragment = gql(` fragment ClientProduct on Query { product(locator: $locator) { id: productID } } -` +`) diff --git a/packages/core/src/customizations/src/fragments/ClientProductGallery.ts b/packages/core/src/customizations/src/fragments/ClientProductGallery.ts index 7d510fad43..9f06484290 100644 --- a/packages/core/src/customizations/src/fragments/ClientProductGallery.ts +++ b/packages/core/src/customizations/src/fragments/ClientProductGallery.ts @@ -1,6 +1,6 @@ -import { gql } from '@faststore/graphql-utils' +import { gql } from '@generated' -export const fragment = gql` +export const fragment = gql(` fragment ClientProductGallery on Query { search( first: $first @@ -16,4 +16,4 @@ export const fragment = gql` } } } -` +`) diff --git a/packages/core/src/customizations/src/fragments/ClientSearchSuggestions.ts b/packages/core/src/customizations/src/fragments/ClientSearchSuggestions.ts index 3903c3b3a5..4da98bce5f 100644 --- a/packages/core/src/customizations/src/fragments/ClientSearchSuggestions.ts +++ b/packages/core/src/customizations/src/fragments/ClientSearchSuggestions.ts @@ -1,6 +1,6 @@ -import { gql } from '@faststore/graphql-utils' +import { gql } from '@generated' -export const fragment = gql` +export const fragment = gql(` fragment ClientSearchSuggestions on Query { search(first: 5, term: $term, selectedFacets: $selectedFacets) { suggestions { @@ -10,4 +10,4 @@ export const fragment = gql` } } } -` +`) diff --git a/packages/core/src/customizations/src/fragments/ClientShippingSimulation.ts b/packages/core/src/customizations/src/fragments/ClientShippingSimulation.ts index 751ae6aa4f..e3fc8442a8 100644 --- a/packages/core/src/customizations/src/fragments/ClientShippingSimulation.ts +++ b/packages/core/src/customizations/src/fragments/ClientShippingSimulation.ts @@ -1,6 +1,6 @@ -import { gql } from '@faststore/graphql-utils' +import { gql } from '@generated' -export const fragment = gql` +export const fragment = gql(` fragment ClientShippingSimulation on Query { shipping(items: $items, postalCode: $postalCode, country: $country) { address { @@ -8,4 +8,4 @@ export const fragment = gql` } } } -` +`) diff --git a/packages/core/src/customizations/src/fragments/ClientTopSearchSuggestions.ts b/packages/core/src/customizations/src/fragments/ClientTopSearchSuggestions.ts index 89e9c7c45b..7ef8ba5208 100644 --- a/packages/core/src/customizations/src/fragments/ClientTopSearchSuggestions.ts +++ b/packages/core/src/customizations/src/fragments/ClientTopSearchSuggestions.ts @@ -1,6 +1,6 @@ -import { gql } from '@faststore/graphql-utils' +import { gql } from '@generated' -export const fragment = gql` +export const fragment = gql(` fragment ClientTopSearchSuggestions on Query { search(first: 5, term: $term, selectedFacets: $selectedFacets) { suggestions { @@ -10,4 +10,4 @@ export const fragment = gql` } } } -` +`) diff --git a/packages/core/src/customizations/src/fragments/ServerCollectionPage.ts b/packages/core/src/customizations/src/fragments/ServerCollectionPage.ts index 36588c4c16..9a85e92be1 100644 --- a/packages/core/src/customizations/src/fragments/ServerCollectionPage.ts +++ b/packages/core/src/customizations/src/fragments/ServerCollectionPage.ts @@ -1,9 +1,9 @@ -import { gql } from '@faststore/graphql-utils' +import { gql } from '@generated' -export const fragment = gql` +export const fragment = gql(` fragment ServerCollectionPage on Query { collection(slug: $slug) { id } } -` +`) diff --git a/packages/core/src/customizations/src/fragments/ServerProduct.ts b/packages/core/src/customizations/src/fragments/ServerProduct.ts index 29f33bca7d..3735fcb00a 100644 --- a/packages/core/src/customizations/src/fragments/ServerProduct.ts +++ b/packages/core/src/customizations/src/fragments/ServerProduct.ts @@ -1,9 +1,9 @@ -import { gql } from '@faststore/graphql-utils' +import { gql } from '@generated' -export const fragment = gql` +export const fragment = gql(` fragment ServerProduct on Query { product(locator: $locator) { id: productID } } -` +`) diff --git a/packages/core/src/pages/404.tsx b/packages/core/src/pages/404.tsx index 7f8e0da750..35e2236eb8 100644 --- a/packages/core/src/pages/404.tsx +++ b/packages/core/src/pages/404.tsx @@ -1,48 +1,44 @@ +import { Locator } from '@vtex/client-cms' +import { GetStaticProps } from 'next' import { NextSeo } from 'next-seo' -import { useRouter } from 'next/router' import GlobalSections, { GlobalSectionsData, getGlobalSectionsData, } from 'src/components/cms/GlobalSections' -import { GetStaticProps } from 'next' -import { Locator } from '@vtex/client-cms' - -import { Icon as UIIcon } from '@faststore/ui' -import EmptyState from 'src/components/sections/EmptyState' +import type { ComponentType } from 'react' -const useErrorState = () => { - const router = useRouter() - const { pathname, asPath } = router +import RenderSections from 'src/components/cms/RenderSections' +import { OverriddenDefaultEmptyState as EmptyState } from 'src/components/sections/EmptyState/OverriddenDefaultEmptyState' +import CUSTOM_COMPONENTS from 'src/customizations/src/components' +import { PageContentType, getPage } from 'src/server/cms' - return { - fromUrl: asPath ?? pathname, - } +/* A list of components that can be used in the CMS. */ +const COMPONENTS: Record> = { + EmptyState, + ...CUSTOM_COMPONENTS, } type Props = { + page: PageContentType globalSections: GlobalSectionsData } -function Page({ globalSections }: Props) { - const { fromUrl } = useErrorState() - +function Page({ page: { sections }, globalSections }: Props) { return ( + {/* + WARNING: Do not import or render components from any + other folder than '../components/sections' in here. + + This is necessary to keep the integration with the CMS + easy and consistent, enabling the change and reorder + of elements on this page. - - } - > -

This app could not find url {fromUrl}

-
+ If needed, wrap your component in a
component + (not the HTML tag) before rendering it here. + */} + ) } @@ -52,10 +48,16 @@ export const getStaticProps: GetStaticProps< Record, Locator > = async ({ previewData }) => { - const globalSections = await getGlobalSectionsData(previewData) + const [page, globalSections] = await Promise.all([ + getPage({ + ...(previewData?.contentType === '404' && previewData), + contentType: '404', + }), + getGlobalSectionsData(previewData), + ]) return { - props: { globalSections }, + props: { page, globalSections }, } } diff --git a/packages/core/src/pages/500.tsx b/packages/core/src/pages/500.tsx index 4a0c0ceaca..859bf01dd2 100644 --- a/packages/core/src/pages/500.tsx +++ b/packages/core/src/pages/500.tsx @@ -1,53 +1,45 @@ import { Locator } from '@vtex/client-cms' import { GetStaticProps } from 'next' import { NextSeo } from 'next-seo' -import { useRouter } from 'next/router' import GlobalSections, { GlobalSectionsData, getGlobalSectionsData, } from 'src/components/cms/GlobalSections' +import type { ComponentType } from 'react' -import { Icon as UIIcon } from '@faststore/ui' -import EmptyState from 'src/components/sections/EmptyState' +import RenderSections from 'src/components/cms/RenderSections' +import { OverriddenDefaultEmptyState as EmptyState } from 'src/components/sections/EmptyState/OverriddenDefaultEmptyState' +import CUSTOM_COMPONENTS from 'src/customizations/src/components' +import { PageContentType, getPage } from 'src/server/cms' -type Props = { - globalSections: GlobalSectionsData +/* A list of components that can be used in the CMS. */ +const COMPONENTS: Record> = { + EmptyState, + ...CUSTOM_COMPONENTS, } -const useErrorState = () => { - const router = useRouter() - const { errorId, fromUrl } = router.query - - return { - errorId, - fromUrl, - } +type Props = { + page: PageContentType + globalSections: GlobalSectionsData } -function Page({ globalSections }: Props) { - const { errorId, fromUrl } = useErrorState() - +function Page({ page: { sections }, globalSections }: Props) { return ( - - } - > -

Internal Server Error

+ {/* + WARNING: Do not import or render components from any + other folder than '../components/sections' in here. + + This is necessary to keep the integration with the CMS + easy and consistent, enabling the change and reorder + of elements on this page. -
- The server errored with id {errorId} when visiting page {fromUrl} -
-
+ If needed, wrap your component in a
component + (not the HTML tag) before rendering it here. + */} + ) } @@ -57,10 +49,16 @@ export const getStaticProps: GetStaticProps< Record, Locator > = async ({ previewData }) => { - const globalSections = await getGlobalSectionsData(previewData) + const [page, globalSections] = await Promise.all([ + getPage({ + ...(previewData?.contentType === '500' && previewData), + contentType: '500', + }), + getGlobalSectionsData(previewData), + ]) return { - props: { globalSections }, + props: { page, globalSections }, } } diff --git a/packages/core/src/pages/[...slug].tsx b/packages/core/src/pages/[...slug].tsx index 8aed31c027..7a00be54d9 100644 --- a/packages/core/src/pages/[...slug].tsx +++ b/packages/core/src/pages/[...slug].tsx @@ -1,7 +1,7 @@ import { isNotFoundError } from '@faststore/api' -import { gql } from '@faststore/graphql-utils' import type { GetStaticPaths, GetStaticProps } from 'next' +import { gql } from '@generated' import type { ServerCollectionPageQueryQuery, ServerCollectionPageQueryQueryVariables, @@ -52,7 +52,7 @@ function Page({ globalSections, type, ...otherProps }: Props) { ) } -const query = gql` +const query = gql(` query ServerCollectionPageQuery($slug: String!) { ...ServerCollectionPage collection(slug: $slug) { @@ -75,7 +75,7 @@ const query = gql` } } } -` +`) export const getStaticProps: GetStaticProps< Props, @@ -106,7 +106,7 @@ export const getStaticProps: GetStaticProps< ServerCollectionPageQueryQuery >({ variables: { slug }, - operationName: query, + operation: query, }), getPage({ ...(previewData?.contentType === 'plp' ? previewData : null), diff --git a/packages/core/src/pages/[slug]/p.tsx b/packages/core/src/pages/[slug]/p.tsx index 4c6701dabe..89692f1389 100644 --- a/packages/core/src/pages/[slug]/p.tsx +++ b/packages/core/src/pages/[slug]/p.tsx @@ -1,14 +1,14 @@ import { isNotFoundError } from '@faststore/api' -import { gql } from '@faststore/graphql-utils' import type { Locator } from '@vtex/client-cms' import type { GetStaticPaths, GetStaticProps } from 'next' import { BreadcrumbJsonLd, NextSeo, ProductJsonLd } from 'next-seo' import type { ComponentType } from 'react' import deepmerge from 'deepmerge' -import type { - ServerProductQueryQuery, - ServerProductQueryQueryVariables, +import { gql } from '@generated' +import { + type ServerProductQueryQuery, + type ServerProductQueryQueryVariables, } from '@generated/graphql' import RenderSections from 'src/components/cms/RenderSections' import BannerNewsletter from 'src/components/sections/BannerNewsletter/BannerNewsletter' @@ -134,7 +134,7 @@ function Page({ data: server, sections, globalSections, offers, meta }: Props) { ) } -const query = gql` +const query = gql(` query ServerProductQuery($locator: [IStoreSelectedFacet!]!) { ...ServerProduct product(locator: $locator) { @@ -192,7 +192,7 @@ const query = gql` ...ProductDetailsFragment_product } } -` +`) export const getStaticProps: GetStaticProps< Props, @@ -203,7 +203,7 @@ export const getStaticProps: GetStaticProps< const [searchResult, cmsPage, globalSections] = await Promise.all([ execute({ variables: { locator: [{ key: 'slug', value: slug }] }, - operationName: query, + operation: query, }), getPage({ ...(previewData?.contentType === 'pdp' ? previewData : null), diff --git a/packages/core/src/pages/api/graphql.ts b/packages/core/src/pages/api/graphql.ts index 783a739eac..fe70f4d619 100644 --- a/packages/core/src/pages/api/graphql.ts +++ b/packages/core/src/pages/api/graphql.ts @@ -23,11 +23,12 @@ const replaceSetCookieDomain = (request: NextApiRequest, setCookie: string) => { } const parseRequest = (request: NextApiRequest) => { - const { operationName, variables, query } = + const { operationName, operationHash, variables, query } = request.method === 'POST' ? request.body : { operationName: request.query.operationName, + operationHash: request.query.operationHash, variables: JSON.parse( typeof request.query.variables === 'string' ? request.query.variables @@ -37,7 +38,12 @@ const parseRequest = (request: NextApiRequest) => { } return { - operationName, + operation: { + __meta__: { + operationName, + operationHash, + }, + }, variables, // Do not allow queries in production, only for devMode so we can use graphql tools // like introspection etc. In production, we only accept known queries for better @@ -53,12 +59,12 @@ const handler: NextApiHandler = async (request, response) => { return } - const { operationName, variables, query } = parseRequest(request) + const { operation, variables, query } = parseRequest(request) try { const { data, errors, extensions } = await execute( { - operationName, + operation, variables, query, }, diff --git a/packages/core/src/pages/login.tsx b/packages/core/src/pages/login.tsx index ab3abcd5e2..663b085966 100644 --- a/packages/core/src/pages/login.tsx +++ b/packages/core/src/pages/login.tsx @@ -1,5 +1,6 @@ import { useEffect } from 'react' import { NextSeo } from 'next-seo' +import type { ComponentType } from 'react' import storeConfig from '../../faststore.config' import GlobalSections, { @@ -8,15 +9,23 @@ import GlobalSections, { } from 'src/components/cms/GlobalSections' import { GetStaticProps } from 'next' import { Locator } from '@vtex/client-cms' +import RenderSections from 'src/components/cms/RenderSections' +import { OverriddenDefaultEmptyState as EmptyState } from 'src/components/sections/EmptyState/OverriddenDefaultEmptyState' +import CUSTOM_COMPONENTS from 'src/customizations/src/components' +import { PageContentType, getPage } from 'src/server/cms' -import { Loader as UILoader } from '@faststore/ui' -import EmptyState from 'src/components/sections/EmptyState' +/* A list of components that can be used in the CMS. */ +const COMPONENTS: Record> = { + EmptyState, + ...CUSTOM_COMPONENTS, +} type Props = { + page: PageContentType globalSections: GlobalSectionsData } -function Page({ globalSections }: Props) { +function Page({ page: { sections }, globalSections }: Props) { useEffect(() => { const loginUrl = new URL(storeConfig.loginUrl) const incomingParams = new URLSearchParams(window.location.search) @@ -31,10 +40,18 @@ function Page({ globalSections }: Props) { return ( + {/* + WARNING: Do not import or render components from any + other folder than '../components/sections' in here. + + This is necessary to keep the integration with the CMS + easy and consistent, enabling the change and reorder + of elements on this page. - - - + If needed, wrap your component in a
component + (not the HTML tag) before rendering it here. + */} + ) } @@ -44,10 +61,16 @@ export const getStaticProps: GetStaticProps< Record, Locator > = async ({ previewData }) => { - const globalSections = await getGlobalSectionsData(previewData) + const [page, globalSections] = await Promise.all([ + getPage({ + ...(previewData?.contentType === 'login' && previewData), + contentType: 'login', + }), + getGlobalSectionsData(previewData), + ]) return { - props: { globalSections }, + props: { page, globalSections }, } } diff --git a/packages/core/src/sdk/cart/index.ts b/packages/core/src/sdk/cart/index.ts index e718bdf477..efe69209f6 100644 --- a/packages/core/src/sdk/cart/index.ts +++ b/packages/core/src/sdk/cart/index.ts @@ -1,8 +1,8 @@ -import { gql } from '@faststore/graphql-utils' import type { Cart as SDKCart, CartItem as SDKCartItem } from '@faststore/sdk' import { createCartStore } from '@faststore/sdk' import { useMemo } from 'react' +import { gql } from '@generated' import type { CartItemFragment, CartMessageFragment, @@ -23,7 +23,7 @@ export interface Cart extends SDKCart { shouldSplitItem?: boolean } -export const ValidateCartMutation = gql` +export const ValidateCartMutation = gql(` mutation ValidateCartMutation($cart: IStoreCart!, $session: IStoreSession!) { validateCart(cart: $cart, session: $session) { order { @@ -82,7 +82,7 @@ export const ValidateCartMutation = gql` valueReference } } -` +`) const isGift = (item: CartItem) => item.price === 0 diff --git a/packages/core/src/sdk/graphql/prefetchQuery.ts b/packages/core/src/sdk/graphql/prefetchQuery.ts index cf0ec9fce3..6ed50510fd 100644 --- a/packages/core/src/sdk/graphql/prefetchQuery.ts +++ b/packages/core/src/sdk/graphql/prefetchQuery.ts @@ -4,17 +4,18 @@ import type { Cache } from 'swr' import { request } from './request' import { getKey } from './useQuery' import type { RequestOptions } from './request' +import { TypedDocumentString } from '@generated/graphql' export const prefetchQuery = >( - operationName: string, + operation: TypedDocumentString, variables: Variables, { cache, ...options }: Partial & { cache: Cache } ) => { - const key = getKey(operationName, variables) + const key = getKey(operation['__meta__']['operationName'], variables) if (cache.get(key)) { return } - mutate(key, request(operationName, variables, options)) + mutate(key, request(operation, variables, options)) } diff --git a/packages/core/src/sdk/graphql/request.ts b/packages/core/src/sdk/graphql/request.ts index 04db6369aa..be78b3114e 100644 --- a/packages/core/src/sdk/graphql/request.ts +++ b/packages/core/src/sdk/graphql/request.ts @@ -1,20 +1,33 @@ -import { request as baseRequest } from '@faststore/graphql-utils' -import type { RequestOptions as GraphQLRequestOptions } from '@faststore/graphql-utils' +import { TypedDocumentString } from '@generated/graphql' -export type RequestOptions = Omit< - GraphQLRequestOptions, - 'operationName' | 'variables' -> +export type RequestOptions = Omit + +export interface GraphQLResponse { + data: D + errors: any[] +} + +export interface BaseRequestOptions { + operation: TypedDocumentString + variables: V + fetchOptions?: RequestInit +} + +const DEFAULT_HEADERS_BY_VERB: Record> = { + POST: { + 'Content-Type': 'application/json', + }, +} export const request = async ( - operationName: string, + operation: TypedDocumentString, variables: Variables, options?: RequestOptions ) => { const { data, errors } = await baseRequest('/api/graphql', { ...options, variables, - operationName, + operation, }) if (errors?.length) { @@ -23,3 +36,49 @@ export const request = async ( return data } + +/* This piece of code was taken out of @faststore/graphql-utils */ +const baseRequest = async ( + endpoint: string, + { operation, variables, fetchOptions }: BaseRequestOptions +): Promise> => { + const { operationName, operationHash } = operation['__meta__'] + + // Uses method from fetchOptions. + // If no one is passed, figure out with via heuristic + const method = + fetchOptions?.method !== undefined + ? fetchOptions.method.toUpperCase() + : operationName.endsWith('Query') + ? 'GET' + : 'POST' + + const params = new URLSearchParams({ + operationName, + operationHash, + ...(method === 'GET' && { variables: JSON.stringify(variables) }), + }) + + const body = + method === 'POST' + ? JSON.stringify({ + operationName, + operationHash, + variables, + }) + : undefined + + const url = `${endpoint}?${params.toString()}` + + const response = await fetch(url, { + method, + body, + ...fetchOptions, + headers: { + ...DEFAULT_HEADERS_BY_VERB[method], + ...fetchOptions?.headers, + }, + }) + + return response.json() +} diff --git a/packages/core/src/sdk/graphql/useLazyQuery.ts b/packages/core/src/sdk/graphql/useLazyQuery.ts index fe5eac287a..2aac6574c9 100644 --- a/packages/core/src/sdk/graphql/useLazyQuery.ts +++ b/packages/core/src/sdk/graphql/useLazyQuery.ts @@ -3,21 +3,22 @@ import useSWR from 'swr' import { request } from './request' import { DEFAULT_OPTIONS, getKey } from './useQuery' import type { QueryOptions } from './useQuery' +import { TypedDocumentString } from '@generated/graphql' export const useLazyQuery = >( - operationName: string, + operation: TypedDocumentString, variables: Variables, options?: QueryOptions ) => { const response = useSWR( - getKey(operationName, variables), + getKey(operation['__meta__']['operationName'], variables), () => null, DEFAULT_OPTIONS ) const execute = async (queryVariables: Variables) => { const data = await request( - operationName, + operation, queryVariables, options ) diff --git a/packages/core/src/sdk/graphql/useQuery.ts b/packages/core/src/sdk/graphql/useQuery.ts index dfbf32e1e0..e9471fe21c 100644 --- a/packages/core/src/sdk/graphql/useQuery.ts +++ b/packages/core/src/sdk/graphql/useQuery.ts @@ -3,6 +3,7 @@ import type { SWRConfiguration } from 'swr' import { request } from './request' import type { RequestOptions } from './request' +import { TypedDocumentString } from '@generated/graphql' export type QueryOptions = SWRConfiguration & RequestOptions & { doNotRun?: boolean } @@ -22,18 +23,21 @@ export const DEFAULT_OPTIONS = { } export const useQuery = >( - operationName: string, + operation: TypedDocumentString, variables: Variables, options?: QueryOptions ) => useSWR( - () => (options?.doNotRun ? null : getKey(operationName, variables)), + () => + options?.doNotRun + ? null + : getKey(operation['__meta__']['operationName'], variables), { fetcher: () => { return new Promise((resolve) => { setTimeout(async () => { resolve( - await request(operationName, variables, options) + await request(operation, variables, options) ) }) }) diff --git a/packages/core/src/sdk/newsletter/useNewsletter.ts b/packages/core/src/sdk/newsletter/useNewsletter.ts index 5d9c4961e9..8ed86e17f2 100644 --- a/packages/core/src/sdk/newsletter/useNewsletter.ts +++ b/packages/core/src/sdk/newsletter/useNewsletter.ts @@ -1,18 +1,18 @@ -import { gql } from '@faststore/graphql-utils' +import { gql } from '@generated' import type { SubscribeToNewsletterMutation as Mutation, SubscribeToNewsletterMutationVariables as Variables, -} from '../../../@generated/graphql/index' +} from '../../../@generated/graphql' import { useLazyQuery } from '../graphql/useLazyQuery' -export const mutation = gql` +export const mutation = gql(` mutation SubscribeToNewsletter($data: IPersonNewsletter!) { subscribeToNewsletter(data: $data) { id } } -` +`) export const useNewsletter = () => { const [subscribeUser, { data, error, isValidating: loading }] = useLazyQuery< diff --git a/packages/core/src/sdk/product/usePageProductsQuery.ts b/packages/core/src/sdk/product/usePageProductsQuery.ts index 614c70e476..f17870ef72 100644 --- a/packages/core/src/sdk/product/usePageProductsQuery.ts +++ b/packages/core/src/sdk/product/usePageProductsQuery.ts @@ -1,5 +1,5 @@ -import { gql } from '@faststore/graphql-utils' import { useSearch } from '@faststore/sdk' +import { gql } from '@generated' import { ClientManyProductsQueryQuery, ClientManyProductsQueryQueryVariables, @@ -30,7 +30,7 @@ export const useGalleryPage = (page: number) => { return useGalleryPageCallback(page) } -export const query = gql` +export const query = gql(` query ClientManyProductsQuery( $first: Int! $after: String @@ -58,7 +58,7 @@ export const query = gql` } } } -` +`) const getKey = (object: any) => JSON.stringify(object) diff --git a/packages/core/src/sdk/product/useProductGalleryQuery.ts b/packages/core/src/sdk/product/useProductGalleryQuery.ts index 38b4efcb05..51c4bdca64 100644 --- a/packages/core/src/sdk/product/useProductGalleryQuery.ts +++ b/packages/core/src/sdk/product/useProductGalleryQuery.ts @@ -1,6 +1,6 @@ import { sendAnalyticsEvent } from '@faststore/sdk' -import { gql } from '@faststore/graphql-utils' +import { gql } from '@generated' import { useQuery } from 'src/sdk/graphql/useQuery' import { useLocalizedVariables } from './useLocalizedVariables' import { useSession } from 'src/sdk/session' @@ -14,13 +14,10 @@ import type { IntelligentSearchQueryEvent } from 'src/sdk/analytics/types' /** * This query is run on the browser and contains * the current search state of the user + * + * The query definition has to stay on top, or else it fails */ -export const query = gql` - fragment SearchEvent_metadata on SearchMetadata { - isTermMisspelled - logicalOperator - } - +export const query = gql(` query ClientProductGalleryQuery( $first: Int! $after: String! @@ -49,7 +46,12 @@ export const query = gql` } } } -` + + fragment SearchEvent_metadata on SearchMetadata { + isTermMisspelled + logicalOperator + } +`) export const useProductGalleryQuery = ({ term, diff --git a/packages/core/src/sdk/product/useProductQuery.ts b/packages/core/src/sdk/product/useProductQuery.ts index d6b8036d84..e71f0b5657 100644 --- a/packages/core/src/sdk/product/useProductQuery.ts +++ b/packages/core/src/sdk/product/useProductQuery.ts @@ -1,6 +1,6 @@ -import { gql } from '@faststore/graphql-utils' import { useMemo } from 'react' +import { gql } from '@generated' import type { ClientProductQueryQuery, ClientProductQueryQueryVariables, @@ -9,14 +9,14 @@ import type { import { useQuery } from '../graphql/useQuery' import { useSession } from '../session' -const query = gql` +const query = gql(` query ClientProductQuery($locator: [IStoreSelectedFacet!]!) { ...ClientProduct product(locator: $locator) { ...ProductDetailsFragment_product } } -` +`) export const useProductQuery = ( productID: string, diff --git a/packages/core/src/sdk/product/useProductsPrefetch.ts b/packages/core/src/sdk/product/useProductsPrefetch.ts index 767999b370..f848d0ab6d 100644 --- a/packages/core/src/sdk/product/useProductsPrefetch.ts +++ b/packages/core/src/sdk/product/useProductsPrefetch.ts @@ -1,13 +1,15 @@ -import { gql } from '@faststore/graphql-utils' import { useSearch } from '@faststore/sdk' + +import { gql } from '@generated' import { ClientManyProductsQueryQueryVariables } from '@generated/graphql' import { useEffect, useCallback } from 'react' + import type { QueryOptions } from '../graphql/useQuery' import { useSWRConfig } from 'swr' import { prefetchQuery } from '../graphql/prefetchQuery' import { useLocalizedVariables } from './useLocalizedVariables' -export const query = gql` +export const query = gql(` query ClientManyProductsQuery( $first: Int! $after: String @@ -35,7 +37,7 @@ export const query = gql` } } } -` +`) export const useProductsQueryPrefetch = ( variables: ClientManyProductsQueryQueryVariables, diff --git a/packages/core/src/sdk/product/useProductsQuery.ts b/packages/core/src/sdk/product/useProductsQuery.ts index 1abd97b674..1c8a219d84 100644 --- a/packages/core/src/sdk/product/useProductsQuery.ts +++ b/packages/core/src/sdk/product/useProductsQuery.ts @@ -1,5 +1,4 @@ -import { gql } from '@faststore/graphql-utils' - +import { gql } from '@generated' import type { ClientManyProductsQueryQuery, ClientManyProductsQueryQueryVariables, @@ -9,7 +8,7 @@ import type { QueryOptions } from '../graphql/useQuery' import { useQuery } from '../graphql/useQuery' import { useLocalizedVariables } from './useLocalizedVariables' -export const query = gql` +export const query = gql(` query ClientManyProductsQuery( $first: Int! $after: String @@ -37,7 +36,7 @@ export const query = gql` } } } -` +`) /** * Use this hook for fetching a list of products, like shelves and tiles diff --git a/packages/core/src/sdk/search/useSuggestions.ts b/packages/core/src/sdk/search/useSuggestions.ts index ee71346972..54e88fbb84 100644 --- a/packages/core/src/sdk/search/useSuggestions.ts +++ b/packages/core/src/sdk/search/useSuggestions.ts @@ -1,9 +1,9 @@ import { useMemo } from 'react' import { sendAnalyticsEvent } from '@faststore/sdk' -import { gql } from '@faststore/graphql-utils' import { useQuery } from 'src/sdk/graphql/useQuery' +import { gql } from '@generated' import type { ClientSearchSuggestionsQueryQuery as Query, ClientSearchSuggestionsQueryQueryVariables as Variables, @@ -12,7 +12,7 @@ import type { IntelligentSearchQueryEvent } from '../analytics/types' import { useSession } from '../session' -const query = gql` +const query = gql(` query ClientSearchSuggestionsQuery( $term: String! $selectedFacets: [IStoreSelectedFacet!] @@ -37,7 +37,7 @@ const query = gql` } } } -` +`) function useSuggestions(term: string) { const { channel, locale } = useSession() diff --git a/packages/core/src/sdk/search/useTopSearch.ts b/packages/core/src/sdk/search/useTopSearch.ts index f8ce64272e..6507351f7e 100644 --- a/packages/core/src/sdk/search/useTopSearch.ts +++ b/packages/core/src/sdk/search/useTopSearch.ts @@ -1,6 +1,5 @@ -import { gql } from '@faststore/graphql-utils' - import { useQuery } from 'src/sdk/graphql/useQuery' +import { gql } from '@generated' import type { ClientSearchSuggestionsQueryQuery as Query, ClientSearchSuggestionsQueryQueryVariables as Variables, @@ -8,7 +7,7 @@ import type { import { useSession } from '../session' -const query = gql` +const query = gql(` query ClientTopSearchSuggestionsQuery( $term: String! $selectedFacets: [IStoreSelectedFacet!] @@ -22,7 +21,7 @@ const query = gql` } } } -` +`) function useTopSearch() { const { channel, locale } = useSession() diff --git a/packages/core/src/sdk/session/index.ts b/packages/core/src/sdk/session/index.ts index dfd46e33de..aa7c22e22a 100644 --- a/packages/core/src/sdk/session/index.ts +++ b/packages/core/src/sdk/session/index.ts @@ -1,18 +1,18 @@ -import { gql } from '@faststore/graphql-utils' import type { Session } from '@faststore/sdk' import { createSessionStore } from '@faststore/sdk' import { useMemo } from 'react' +import { gql } from '@generated' import type { ValidateSessionMutation, ValidateSessionMutationVariables, -} from '../../../@generated/graphql/index' +} from '@generated/graphql' import storeConfig from '../../../faststore.config' import { cartStore } from '../cart' import { request } from '../graphql/request' import { createValidationStore, useStore } from '../useStore' -export const mutation = gql` +export const mutation = gql(` mutation ValidateSession($session: IStoreSession!, $search: String!) { validateSession(session: $session, search: $search) { locale @@ -44,7 +44,7 @@ export const mutation = gql` } } } -` +`) export const validateSession = async (session: Session) => { const data = await request< diff --git a/packages/core/src/sdk/shipping/index.ts b/packages/core/src/sdk/shipping/index.ts index 66737f18c6..07efcd9115 100644 --- a/packages/core/src/sdk/shipping/index.ts +++ b/packages/core/src/sdk/shipping/index.ts @@ -1,6 +1,6 @@ import type { IShippingItem } from '@faststore/api' -import { gql } from '@faststore/graphql-utils' +import { gql } from '@generated' import type { ClientShippingSimulationQueryQuery as Query, ClientShippingSimulationQueryQueryVariables as Variables, @@ -8,7 +8,7 @@ import type { import { request } from '../graphql/request' -const query = gql` +const query = gql(` query ClientShippingSimulationQuery( $postalCode: String! $country: String! @@ -37,7 +37,7 @@ const query = gql` } } } -` +`) export type ShippingQueryData = { items: IShippingItem[] diff --git a/packages/core/src/server/generator/schema.ts b/packages/core/src/server/generator/schema.ts index fe0d074b92..50db0d7aa2 100644 --- a/packages/core/src/server/generator/schema.ts +++ b/packages/core/src/server/generator/schema.ts @@ -70,7 +70,7 @@ export const getMergedSchema = (): GraphQLSchema => export function writeGraphqlSchemaFile(apiSchema: GraphQLSchema) { try { writeFileSync( - path.join(process.cwd(), '@generated', 'graphql', 'schema.graphql'), + path.join(process.cwd(), '@generated', 'schema.graphql'), printSchemaWithDirectives(apiSchema) ) diff --git a/packages/core/src/server/index.ts b/packages/core/src/server/index.ts index 9d1e5f4895..4762b87f62 100644 --- a/packages/core/src/server/index.ts +++ b/packages/core/src/server/index.ts @@ -21,15 +21,16 @@ import { makeExecutableSchema } from '@graphql-tools/schema' import { loadFilesSync } from '@graphql-tools/load-files' import type { TypeSource } from '@graphql-tools/utils' -import persisted from '../../@generated/graphql/persisted.json' +import persisted from '@generated/persisted-documents.json' import vtexExtensionsResolvers from '../customizations/src/graphql/vtex/resolvers' import thirdPartyResolvers from '../customizations/src/graphql/thirdParty/resolvers' import { apiOptions } from './options' +import { TypedDocumentString } from '@generated/graphql' interface ExecuteOptions> { - operationName: string + operation: Pick, '__meta__'> variables: V query?: string | null } @@ -49,7 +50,7 @@ const formatError: FormatErrorHandler = (err) => { } function loadGeneratedSchema(): TypeSource { - return loadFilesSync(path.join(process.cwd(), '@generated', 'graphql'), { + return loadFilesSync(path.join(process.cwd(), '@generated'), { extensions: ['graphql'], }) } @@ -89,11 +90,15 @@ export const execute = async , D>( cookies: Map> | null } }> => { - const { operationName, variables, query: maybeQuery } = options - const query = maybeQuery ?? persistedQueries.get(operationName) + const { operation, variables, query: maybeQuery } = options + const { operationHash, operationName } = operation['__meta__'] + + const query = maybeQuery ?? persistedQueries.get(operationHash) if (query == null) { - throw new Error(`No query found for operationName: ${operationName}`) + throw new Error( + `No query found for operationName ${operationName} and operationHash ${operationHash}` + ) } const enveloped = await envelopPromise diff --git a/packages/core/src/typings/overrides.ts b/packages/core/src/typings/overrides.ts index 387c25838b..3aa5bb8bdd 100644 --- a/packages/core/src/typings/overrides.ts +++ b/packages/core/src/typings/overrides.ts @@ -49,6 +49,7 @@ import Alert from '../components/sections/Alert' import Breadcrumb from '../components/sections/Breadcrumb' import BannerText from '../components/sections/BannerText' import CrossSellingShelf from '../components/sections/CrossSellingShelf' +import EmptyState from '../components/sections/EmptyState' import Hero from '../components/sections/Hero' import ProductShelf from '../components/sections/ProductShelf' import ProductDetails from '../components/sections/ProductDetails' @@ -137,7 +138,7 @@ export type SectionsOverrides = { } } EmptyState: { - Section: never + Section: typeof EmptyState components: { EmptyState: ComponentOverrideDefinition< PropsWithChildren, @@ -154,7 +155,7 @@ export type SectionsOverrides = { } } Navbar: { - Section: typeof Navbar, + Section: typeof Navbar components: { Navbar: ComponentOverrideDefinition NavbarLinks: ComponentOverrideDefinition< diff --git a/packages/core/test/server/index.test.ts b/packages/core/test/server/index.test.ts index 0ca0ce21ae..10c0b7ea3c 100644 --- a/packages/core/test/server/index.test.ts +++ b/packages/core/test/server/index.test.ts @@ -138,7 +138,12 @@ describe('FastStore GraphQL Layer', () => { it('should handle options and execute', async () => { const result = await execute({ variables: { slug: storeConfig.cypress.pages.collection.slice(1) }, - operationName: 'ServerCollectionPageQuery', + operation: { + __meta__: { + operationName: 'ServerCollectionPageQuery', + operationHash: '4b33c5c07f440dc7489e55619dc2211a13786e72', + }, + }, }) expect(result.data).toBeDefined() }) diff --git a/packages/graphql-utils/babel.js b/packages/graphql-utils/babel.js deleted file mode 100644 index df097313ec..0000000000 --- a/packages/graphql-utils/babel.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./dist/babel') diff --git a/packages/graphql-utils/codegen.js b/packages/graphql-utils/codegen.js deleted file mode 100644 index ee85d8367f..0000000000 --- a/packages/graphql-utils/codegen.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./dist/codegen') diff --git a/packages/graphql-utils/src/babel.ts b/packages/graphql-utils/src/babel.ts deleted file mode 100644 index ec64e3f4d9..0000000000 --- a/packages/graphql-utils/src/babel.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { BREAK, parse, visit } from 'graphql' -import type { Visitor } from '@babel/traverse' -import type BabelTypes from '@babel/types' - -const GQL_TAGS = new Set(['gql']) - -interface Babel { - types: typeof BabelTypes -} - -interface BabelPlugin { - visitor: Visitor -} - -const getOperationName = (query: string) => { - let operationName = 'unknown' - - visit(parse(query), { - OperationDefinition: (node) => { - const operation = node.name?.value - - if (typeof operation === 'string') { - operationName = operation - } - - return BREAK - }, - }) - - return operationName -} - -export default function babelGQLPlugin(babel: Babel): BabelPlugin { - const { types } = babel - - return { - visitor: { - Program: (program) => { - program.traverse({ - TaggedTemplateExpression: (path) => { - if (!path.node.loc) { - return - } - - const { tag } = path.node - - if (!types.isIdentifier(tag) || !GQL_TAGS.has(tag.name)) { - return - } - - try { - // Get query from path - const query = path.node.quasi.quasis - .map((q) => q.value.cooked) - .join('') - .trim() - - const operationName = getOperationName(query) - - path.replaceWithSourceString(`"${operationName}"`) - } catch (error: any) { - throw path.buildCodeFrameError( - `GraphQL: ${error.message}` ?? 'Unknown graphql parsing error' - ) - } - }, - }) - }, - }, - } -} diff --git a/packages/graphql-utils/src/codegen.ts b/packages/graphql-utils/src/codegen.ts deleted file mode 100644 index 8f0caf29a9..0000000000 --- a/packages/graphql-utils/src/codegen.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { optimizeDocuments } from '@graphql-tools/relay-operation-optimizer' -import { Kind, print } from 'graphql' -import type { Types, PluginFunction } from '@graphql-codegen/plugin-helpers' -import type { DocumentNode, GraphQLSchema } from 'graphql' - -type Config = Record - -const getOperationName = (document: DocumentNode) => { - for (const definition of document.definitions) { - if ( - definition.kind === Kind.OPERATION_DEFINITION && - typeof definition.name?.value === 'string' - ) { - return definition.name.value - } - } - - return null -} - -export const plugin: PluginFunction = async ( - schema: GraphQLSchema, - files: Types.DocumentFile[], - _: Config -) => { - const documents = files - .map(({ document }) => document) - .filter((d): d is DocumentNode => typeof d !== 'undefined') - - const optimizedDocuments = optimizeDocuments(schema, documents, { - includeFragments: false, - }) - - const operationToDocument = optimizedDocuments.reduce((acc, doc) => { - const operationName = getOperationName(doc) - - if (typeof operationName === 'string') { - if (acc[operationName]) { - throw new Error( - `Duplicated operation definition. Please rename one of the ${operationName} queries` - ) - } - - acc[operationName] = print(doc) - } - - return acc - }, {} as Record) - - return JSON.stringify(operationToDocument) -} diff --git a/packages/graphql-utils/src/index.ts b/packages/graphql-utils/src/index.ts index 4e8e8c1117..821a8372a5 100644 --- a/packages/graphql-utils/src/index.ts +++ b/packages/graphql-utils/src/index.ts @@ -1,63 +1,5 @@ export const gql = (_: TemplateStringsArray) => { throw new Error( - `[graphql-utils]: This should have been removed by the babel plugin. Please make sure the babel plugin is configured correctly` + `[graphql-utils]: Depreciation notice: the gql function should be imported from @faststore/core. Follow this migration guide: faststore.dev/docs/migration/graphql-utils` ) -} - -export interface GraphQLResponse { - data: D - errors: any[] -} - -export interface RequestOptions { - operationName: string - variables: V - fetchOptions?: RequestInit -} - -const DEFAULT_HEADERS_BY_VERB: Record> = { - POST: { - 'Content-Type': 'application/json', - }, -} - -export const request = async ( - endpoint: string, - { operationName, variables, fetchOptions }: RequestOptions -): Promise> => { - // Uses method from fetchOptions. - // If no one is passed, figure out with via heuristic - const method = - fetchOptions?.method !== undefined - ? fetchOptions.method.toUpperCase() - : operationName.endsWith('Query') - ? 'GET' - : 'POST' - - const params = new URLSearchParams({ - operationName, - ...(method === 'GET' && { variables: JSON.stringify(variables) }), - }) - - const body = - method === 'POST' - ? JSON.stringify({ - operationName, - variables, - }) - : undefined - - const url = `${endpoint}?${params.toString()}` - - const response = await fetch(url, { - method, - body, - ...fetchOptions, - headers: { - ...DEFAULT_HEADERS_BY_VERB[method], - ...fetchOptions?.headers, - }, - }) - - return response.json() -} +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index bde54ab3c7..2ae3bd385d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -63,6 +63,14 @@ "@babel/highlight" "^7.22.13" chalk "^2.4.2" +"@babel/code-frame@^7.23.5": + version "7.23.5" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.23.5.tgz#9009b69a8c602293476ad598ff53e4562e15c244" + integrity sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA== + dependencies: + "@babel/highlight" "^7.23.4" + chalk "^2.4.2" + "@babel/compat-data@^7.20.5": version "7.20.10" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.20.10.tgz#9d92fa81b87542fff50e848ed585b4212c1d34ec" @@ -125,6 +133,16 @@ "@jridgewell/trace-mapping" "^0.3.17" jsesc "^2.5.1" +"@babel/generator@^7.23.6": + version "7.23.6" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.6.tgz#9e1fca4811c77a10580d17d26b57b036133f3c2e" + integrity sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw== + dependencies: + "@babel/types" "^7.23.6" + "@jridgewell/gen-mapping" "^0.3.2" + "@jridgewell/trace-mapping" "^0.3.17" + jsesc "^2.5.1" + "@babel/helper-annotate-as-pure@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.18.6.tgz#eaa49f6f80d5a33f9a5dd2276e6d6e451be0a6bb" @@ -296,6 +314,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz#533f36457a25814cf1df6488523ad547d784a99f" integrity sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw== +"@babel/helper-string-parser@^7.23.4": + version "7.23.4" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz#9478c707febcbbe1ddb38a3d91a2e054ae622d83" + integrity sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ== + "@babel/helper-validator-identifier@^7.18.6", "@babel/helper-validator-identifier@^7.19.1": version "7.19.1" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2" @@ -357,11 +380,25 @@ chalk "^2.4.2" js-tokens "^4.0.0" +"@babel/highlight@^7.23.4": + version "7.23.4" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.23.4.tgz#edaadf4d8232e1a961432db785091207ead0621b" + integrity sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A== + dependencies: + "@babel/helper-validator-identifier" "^7.22.20" + chalk "^2.4.2" + js-tokens "^4.0.0" + "@babel/parser@^7.1.0", "@babel/parser@^7.13.0", "@babel/parser@^7.14.0", "@babel/parser@^7.14.7", "@babel/parser@^7.16.8", "@babel/parser@^7.20.7", "@babel/parser@^7.22.15", "@babel/parser@^7.22.5", "@babel/parser@^7.22.7", "@babel/parser@^7.23.0": version "7.23.3" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.3.tgz#0ce0be31a4ca4f1884b5786057cadcb6c3be58f9" integrity sha512-uVsWNvlVsIninV2prNz/3lHCb+5CJ+e+IUBfbjToAHODtfGYLfCFuY4AU7TskI+dAKk+njsPiBjq1gKTvZOBaw== +"@babel/parser@^7.23.6": + version "7.23.6" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.6.tgz#ba1c9e512bda72a47e285ae42aff9d2a635a9e3b" + integrity sha512-Z2uID7YJ7oNvAI20O9X0bblw7Qqs8Q2hFy0R9tAfnfLkp5MW0UH9eUvnDSnFwKZ0AvgS1ucqR4KzvVHgnke1VQ== + "@babel/plugin-proposal-class-properties@^7.0.0": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.18.6.tgz#b110f59741895f7ec21a6fff696ec46265c446a3" @@ -709,7 +746,7 @@ "@babel/parser" "^7.22.5" "@babel/types" "^7.22.5" -"@babel/traverse@^7.14.0", "@babel/traverse@^7.15.4", "@babel/traverse@^7.16.8", "@babel/traverse@^7.17.9", "@babel/traverse@^7.20.10", "@babel/traverse@^7.20.12", "@babel/traverse@^7.20.7", "@babel/traverse@^7.22.6", "@babel/traverse@^7.22.8": +"@babel/traverse@^7.14.0", "@babel/traverse@^7.16.8", "@babel/traverse@^7.17.9", "@babel/traverse@^7.20.10", "@babel/traverse@^7.20.12", "@babel/traverse@^7.20.7", "@babel/traverse@^7.22.6", "@babel/traverse@^7.22.8": version "7.23.2" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.2.tgz#329c7a06735e144a506bdb2cad0268b7f46f4ad8" integrity sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw== @@ -725,7 +762,23 @@ debug "^4.1.0" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.15.6", "@babel/types@^7.16.8", "@babel/types@^7.18.13", "@babel/types@^7.18.6", "@babel/types@^7.20.0", "@babel/types@^7.20.2", "@babel/types@^7.20.7", "@babel/types@^7.22.15", "@babel/types@^7.22.5", "@babel/types@^7.23.0", "@babel/types@^7.23.3", "@babel/types@^7.3.0", "@babel/types@^7.3.3": +"@babel/traverse@^7.15.4": + version "7.23.6" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.6.tgz#b53526a2367a0dd6edc423637f3d2d0f2521abc5" + integrity sha512-czastdK1e8YByZqezMPFiZ8ahwVMh/ESl9vPgvgdB9AmFMGP5jfpFax74AQgl5zj4XHzqeYAg2l8PuUeRS1MgQ== + dependencies: + "@babel/code-frame" "^7.23.5" + "@babel/generator" "^7.23.6" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-function-name" "^7.23.0" + "@babel/helper-hoist-variables" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + "@babel/parser" "^7.23.6" + "@babel/types" "^7.23.6" + debug "^4.3.1" + globals "^11.1.0" + +"@babel/types@^7.0.0", "@babel/types@^7.16.8", "@babel/types@^7.18.13", "@babel/types@^7.18.6", "@babel/types@^7.20.0", "@babel/types@^7.20.2", "@babel/types@^7.20.7", "@babel/types@^7.22.15", "@babel/types@^7.22.5", "@babel/types@^7.23.0", "@babel/types@^7.23.3", "@babel/types@^7.3.0", "@babel/types@^7.3.3": version "7.23.3" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.3.tgz#d5ea892c07f2ec371ac704420f4dcdb07b5f9598" integrity sha512-OZnvoH2l8PK5eUvEcUyCt/sXgr/h+UWpVuBbOljwcrAgUl6lpchoQ++PHGyQy1AtYnVA6CEq3y5xeEI10brpXw== @@ -734,6 +787,15 @@ "@babel/helper-validator-identifier" "^7.22.20" to-fast-properties "^2.0.0" +"@babel/types@^7.15.6", "@babel/types@^7.23.6": + version "7.23.6" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.6.tgz#be33fdb151e1f5a56877d704492c240fc71c7ccd" + integrity sha512-+uarb83brBzPKN38NX1MkB6vb6+mwvR6amUulqAE7ccQw1pEl+bCia9TbdG1lsnFP7lZySvUn37CHyXQdfTwzg== + dependencies: + "@babel/helper-string-parser" "^7.23.4" + "@babel/helper-validator-identifier" "^7.22.20" + to-fast-properties "^2.0.0" + "@bcoe/v8-coverage@^0.2.3": version "0.2.3" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" @@ -1057,6 +1119,14 @@ resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6" integrity sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw== +"@graphql-codegen/add@^5.0.0": + version "5.0.0" + resolved "https://registry.yarnpkg.com/@graphql-codegen/add/-/add-5.0.0.tgz#578ebaf4fa87c1e934c381cd679bcedcf79feaba" + integrity sha512-ynWDOsK2yxtFHwcJTB9shoSkUd7YXd6ZE57f0nk7W5cu/nAgxZZpEsnTPEpZB/Mjf14YRGe2uJHQ7AfElHjqUQ== + dependencies: + "@graphql-codegen/plugin-helpers" "^5.0.0" + tslib "~2.5.0" + "@graphql-codegen/cli@2.2.0": version "2.2.0" resolved "https://registry.yarnpkg.com/@graphql-codegen/cli/-/cli-2.2.0.tgz#84a909cb46f009cafc59aa719b816494b0ca222b" @@ -1144,6 +1214,25 @@ yaml "^1.10.0" yargs "^17.0.0" +"@graphql-codegen/client-preset@^4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@graphql-codegen/client-preset/-/client-preset-4.1.0.tgz#81becd32b78b207b0e966876900537ec172d8df1" + integrity sha512-/3Ymb/fjxIF1+HGmaI1YwSZbWsrZAWMSQjh3dU425eBjctjsVQ6gzGRr+l/gE5F1mtmCf+vlbTAT03heAc/QIw== + dependencies: + "@babel/helper-plugin-utils" "^7.20.2" + "@babel/template" "^7.20.7" + "@graphql-codegen/add" "^5.0.0" + "@graphql-codegen/gql-tag-operations" "4.0.1" + "@graphql-codegen/plugin-helpers" "^5.0.1" + "@graphql-codegen/typed-document-node" "^5.0.1" + "@graphql-codegen/typescript" "^4.0.1" + "@graphql-codegen/typescript-operations" "^4.0.1" + "@graphql-codegen/visitor-plugin-common" "^4.0.1" + "@graphql-tools/documents" "^1.0.0" + "@graphql-tools/utils" "^10.0.0" + "@graphql-typed-document-node/core" "3.2.0" + tslib "~2.5.0" + "@graphql-codegen/core@2.1.0": version "2.1.0" resolved "https://registry.yarnpkg.com/@graphql-codegen/core/-/core-2.1.0.tgz#c0b2d63ad3e77b794b6a84485c4a8ac72c291c6b" @@ -1164,6 +1253,17 @@ "@graphql-tools/utils" "^9.1.1" tslib "~2.5.0" +"@graphql-codegen/gql-tag-operations@4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@graphql-codegen/gql-tag-operations/-/gql-tag-operations-4.0.1.tgz#36c7d40a135b9889d7f225166be323c3d48cee87" + integrity sha512-qF6wIbBzW8BNT+wiVsBxrYOs2oYcsxQ7mRvCpfEI3HnNZMAST/uX76W8MqFEJvj4mw7NIDv7xYJAcAZIWM5LWw== + dependencies: + "@graphql-codegen/plugin-helpers" "^5.0.0" + "@graphql-codegen/visitor-plugin-common" "4.0.1" + "@graphql-tools/utils" "^10.0.0" + auto-bind "~4.0.0" + tslib "~2.5.0" + "@graphql-codegen/plugin-helpers@^2.1.0", "@graphql-codegen/plugin-helpers@^2.1.1", "@graphql-codegen/plugin-helpers@^2.2.0": version "2.7.2" resolved "https://registry.yarnpkg.com/@graphql-codegen/plugin-helpers/-/plugin-helpers-2.7.2.tgz#6544f739d725441c826a8af6a49519f588ff9bed" @@ -1188,6 +1288,18 @@ lodash "~4.17.0" tslib "~2.5.0" +"@graphql-codegen/plugin-helpers@^5.0.0", "@graphql-codegen/plugin-helpers@^5.0.1": + version "5.0.1" + resolved "https://registry.yarnpkg.com/@graphql-codegen/plugin-helpers/-/plugin-helpers-5.0.1.tgz#e2429fcfba3f078d5aa18aa062d46c922bbb0d55" + integrity sha512-6L5sb9D8wptZhnhLLBcheSPU7Tg//DGWgc5tQBWX46KYTOTQHGqDpv50FxAJJOyFVJrveN9otWk9UT9/yfY4ww== + dependencies: + "@graphql-tools/utils" "^10.0.0" + change-case-all "1.0.15" + common-tags "1.8.2" + import-from "4.0.0" + lodash "~4.17.0" + tslib "~2.5.0" + "@graphql-codegen/schema-ast@^3.0.1": version "3.0.1" resolved "https://registry.yarnpkg.com/@graphql-codegen/schema-ast/-/schema-ast-3.0.1.tgz#37b458bb57b95715a9eb4259341c856dae2a461d" @@ -1197,6 +1309,26 @@ "@graphql-tools/utils" "^9.0.0" tslib "~2.5.0" +"@graphql-codegen/schema-ast@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@graphql-codegen/schema-ast/-/schema-ast-4.0.0.tgz#5d60996c87b64f81847da8fcb2d8ef50ede89755" + integrity sha512-WIzkJFa9Gz28FITAPILbt+7A8+yzOyd1NxgwFh7ie+EmO9a5zQK6UQ3U/BviirguXCYnn+AR4dXsoDrSrtRA1g== + dependencies: + "@graphql-codegen/plugin-helpers" "^5.0.0" + "@graphql-tools/utils" "^10.0.0" + tslib "~2.5.0" + +"@graphql-codegen/typed-document-node@^5.0.1": + version "5.0.1" + resolved "https://registry.yarnpkg.com/@graphql-codegen/typed-document-node/-/typed-document-node-5.0.1.tgz#ac90cf67c61554f63ec100d6076b47c9f0b18b27" + integrity sha512-VFkhCuJnkgtbbgzoCAwTdJe2G1H6sd3LfCrDqWUrQe53y2ukfSb5Ov1PhAIkCBStKCMQBUY9YgGz9GKR40qQ8g== + dependencies: + "@graphql-codegen/plugin-helpers" "^5.0.0" + "@graphql-codegen/visitor-plugin-common" "4.0.1" + auto-bind "~4.0.0" + change-case-all "1.0.15" + tslib "~2.5.0" + "@graphql-codegen/typescript-operations@^3.0.4": version "3.0.4" resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript-operations/-/typescript-operations-3.0.4.tgz#60163c07f0ef73655779ece450d02c1172c44027" @@ -1208,6 +1340,17 @@ auto-bind "~4.0.0" tslib "~2.5.0" +"@graphql-codegen/typescript-operations@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript-operations/-/typescript-operations-4.0.1.tgz#930af3e2d2ae8ff06de696291be28fe7046a2fef" + integrity sha512-GpUWWdBVUec/Zqo23aFLBMrXYxN2irypHqDcKjN78JclDPdreasAEPcIpMfqf4MClvpmvDLy4ql+djVAwmkjbw== + dependencies: + "@graphql-codegen/plugin-helpers" "^5.0.0" + "@graphql-codegen/typescript" "^4.0.1" + "@graphql-codegen/visitor-plugin-common" "4.0.1" + auto-bind "~4.0.0" + tslib "~2.5.0" + "@graphql-codegen/typescript@2.2.2": version "2.2.2" resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript/-/typescript-2.2.2.tgz#8ea14c0a7853f6b73cca0ed10ff43b6dbd3731c6" @@ -1229,6 +1372,17 @@ auto-bind "~4.0.0" tslib "~2.5.0" +"@graphql-codegen/typescript@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript/-/typescript-4.0.1.tgz#7481d68f59bea802dd10e278dce73c8a1552b2a4" + integrity sha512-3YziQ21dCVdnHb+Us1uDb3pA6eG5Chjv0uTK+bt9dXeMlwYBU8MbtzvQTo4qvzWVC1AxSOKj0rgfNu1xCXqJyA== + dependencies: + "@graphql-codegen/plugin-helpers" "^5.0.0" + "@graphql-codegen/schema-ast" "^4.0.0" + "@graphql-codegen/visitor-plugin-common" "4.0.1" + auto-bind "~4.0.0" + tslib "~2.5.0" + "@graphql-codegen/visitor-plugin-common@2.2.1": version "2.2.1" resolved "https://registry.yarnpkg.com/@graphql-codegen/visitor-plugin-common/-/visitor-plugin-common-2.2.1.tgz#721b646d3d19ec0fcf9509f516e788b7151be003" @@ -1261,6 +1415,22 @@ parse-filepath "^1.0.2" tslib "~2.5.0" +"@graphql-codegen/visitor-plugin-common@4.0.1", "@graphql-codegen/visitor-plugin-common@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@graphql-codegen/visitor-plugin-common/-/visitor-plugin-common-4.0.1.tgz#64e293728b3c186f6767141e41fcdb310e50d367" + integrity sha512-Bi/1z0nHg4QMsAqAJhds+ForyLtk7A3HQOlkrZNm3xEkY7lcBzPtiOTLBtvziwopBsXUxqeSwVjOOFPLS5Yw1Q== + dependencies: + "@graphql-codegen/plugin-helpers" "^5.0.0" + "@graphql-tools/optimize" "^2.0.0" + "@graphql-tools/relay-operation-optimizer" "^7.0.0" + "@graphql-tools/utils" "^10.0.0" + auto-bind "~4.0.0" + change-case-all "1.0.15" + dependency-graph "^0.11.0" + graphql-tag "^2.11.0" + parse-filepath "^1.0.2" + tslib "~2.5.0" + "@graphql-tools/apollo-engine-loader@^7.0.5", "@graphql-tools/apollo-engine-loader@^7.3.6": version "7.3.26" resolved "https://registry.yarnpkg.com/@graphql-tools/apollo-engine-loader/-/apollo-engine-loader-7.3.26.tgz#91e54460d5579933e42a2010b8688c3459c245d8" @@ -1305,6 +1475,14 @@ tslib "^2.5.0" value-or-promise "^1.0.12" +"@graphql-tools/documents@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@graphql-tools/documents/-/documents-1.0.0.tgz#e3ed97197cc22ec830ca227fd7d17e86d8424bdf" + integrity sha512-rHGjX1vg/nZ2DKqRGfDPNC55CWZBMldEVcH+91BThRa6JeT80NqXknffLLEZLRUxyikCfkwMsk6xR3UNMqG0Rg== + dependencies: + lodash.sortby "^4.7.0" + tslib "^2.4.0" + "@graphql-tools/executor-graphql-ws@^0.0.14": version "0.0.14" resolved "https://registry.yarnpkg.com/@graphql-tools/executor-graphql-ws/-/executor-graphql-ws-0.0.14.tgz#e0f53fc4cfc8a06cc461b2bc1edb4bb9a8e837ed" @@ -1479,6 +1657,13 @@ dependencies: tslib "^2.4.0" +"@graphql-tools/optimize@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@graphql-tools/optimize/-/optimize-2.0.0.tgz#7a9779d180824511248a50c5a241eff6e7a2d906" + integrity sha512-nhdT+CRGDZ+bk68ic+Jw1OZ99YCDIKYA5AlVAnBHJvMawSx9YQqQAIj4refNc1/LRieGiuWvhbG3jvPVYho0Dg== + dependencies: + tslib "^2.4.0" + "@graphql-tools/prisma-loader@^7.0.6", "@graphql-tools/prisma-loader@^7.2.49": version "7.2.72" resolved "https://registry.yarnpkg.com/@graphql-tools/prisma-loader/-/prisma-loader-7.2.72.tgz#6304fc23600458396f3ede713d8e2371df7850e3" @@ -1503,7 +1688,7 @@ tslib "^2.4.0" yaml-ast-parser "^0.0.43" -"@graphql-tools/relay-operation-optimizer@^6.3.7", "@graphql-tools/relay-operation-optimizer@^6.5.0": +"@graphql-tools/relay-operation-optimizer@^6.3.7", "@graphql-tools/relay-operation-optimizer@^6.4.0", "@graphql-tools/relay-operation-optimizer@^6.5.0": version "6.5.18" resolved "https://registry.yarnpkg.com/@graphql-tools/relay-operation-optimizer/-/relay-operation-optimizer-6.5.18.tgz#a1b74a8e0a5d0c795b8a4d19629b654cf66aa5ab" integrity sha512-mc5VPyTeV+LwiM+DNvoDQfPqwQYhPV/cl5jOBjTgSniyaq8/86aODfMkrE2OduhQ5E00hqrkuL2Fdrgk0w1QJg== @@ -1512,13 +1697,13 @@ "@graphql-tools/utils" "^9.2.1" tslib "^2.4.0" -"@graphql-tools/relay-operation-optimizer@^6.4.0": - version "6.5.14" - resolved "https://registry.yarnpkg.com/@graphql-tools/relay-operation-optimizer/-/relay-operation-optimizer-6.5.14.tgz#e3d61892910c982c13ea8c2d9780a0cf95e7dd12" - integrity sha512-RAy1fMfXig9X3gIkYnfEmv0mh20vZuAgWDq+zf1MrrsCAP364B+DKrBjLwn3D+4e0PMTlqwmqR0JB5t1VtZn2w== +"@graphql-tools/relay-operation-optimizer@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@graphql-tools/relay-operation-optimizer/-/relay-operation-optimizer-7.0.0.tgz#24367666af87bc5a81748de5e8e9b3c523fd4207" + integrity sha512-UNlJi5y3JylhVWU4MBpL0Hun4Q7IoJwv9xYtmAz+CgRa066szzY7dcuPfxrA7cIGgG/Q6TVsKsYaiF4OHPs1Fw== dependencies: "@ardatan/relay-compiler" "12.0.0" - "@graphql-tools/utils" "9.1.3" + "@graphql-tools/utils" "^10.0.0" tslib "^2.4.0" "@graphql-tools/schema@^8.1.2": @@ -1584,13 +1769,6 @@ dependencies: tslib "^2.4.0" -"@graphql-tools/utils@9.1.3": - version "9.1.3" - resolved "https://registry.yarnpkg.com/@graphql-tools/utils/-/utils-9.1.3.tgz#861f87057b313726136fa6ddfbd2380eae906599" - integrity sha512-bbJyKhs6awp1/OmP+WKA1GOyu9UbgZGkhIj5srmiMGLHohEOKMjW784Sk0BZil1w2x95UPu0WHw6/d/HVCACCg== - dependencies: - tslib "^2.4.0" - "@graphql-tools/utils@9.2.1", "@graphql-tools/utils@^9.0.0", "@graphql-tools/utils@^9.1.1", "@graphql-tools/utils@^9.2.1": version "9.2.1" resolved "https://registry.yarnpkg.com/@graphql-tools/utils/-/utils-9.2.1.tgz#1b3df0ef166cfa3eae706e3518b17d5922721c57" @@ -2213,16 +2391,21 @@ "@napi-rs/simple-git-win32-arm64-msvc" "0.1.8" "@napi-rs/simple-git-win32-x64-msvc" "0.1.8" -"@next/env@12.3.4": - version "12.3.4" - resolved "https://registry.yarnpkg.com/@next/env/-/env-12.3.4.tgz#c787837d36fcad75d72ff8df6b57482027d64a47" - integrity sha512-H/69Lc5Q02dq3o+dxxy5O/oNxFsZpdL6WREtOOtOM1B/weonIwDXkekr1KV5DPVPr12IHFPrMrcJQ6bgPMfn7A== - "@next/env@13.0.7": version "13.0.7" resolved "https://registry.yarnpkg.com/@next/env/-/env-13.0.7.tgz#7b6ccd9006d3fb57c369e3fb62b28e15324141e9" integrity sha512-ZBclBRB7DbkSswXgbJ+muF5RxfgmAuQKAWL8tcm86aZmoiL1ZainxQK0hMcMYdh+IYG8UObAKV2wKB5O+6P4ng== +"@next/env@13.5.1": + version "13.5.1" + resolved "https://registry.yarnpkg.com/@next/env/-/env-13.5.1.tgz#337f5f3d325250f91ed23d783cbf8297800ee7d3" + integrity sha512-CIMWiOTyflFn/GFx33iYXkgLSQsMQZV4jB91qaj/TfxGaGOXxn8C1j72TaUSPIyN7ziS/AYG46kGmnvuk1oOpg== + +"@next/env@13.5.6": + version "13.5.6" + resolved "https://registry.yarnpkg.com/@next/env/-/env-13.5.6.tgz#c1148e2e1aa166614f05161ee8f77ded467062bc" + integrity sha512-Yac/bV5sBGkkEXmAX5FWPS9Mmo2rthrOPRQQNfycJPkjUAUclomCPH7QFVCDQ4Mp2k2K1SSM6m0zrxYrOwtFQw== + "@next/eslint-plugin-next@13.0.0": version "13.0.0" resolved "https://registry.yarnpkg.com/@next/eslint-plugin-next/-/eslint-plugin-next-13.0.0.tgz#cf3d799b21671554c1f5889c01d2513afb9973cd" @@ -2230,136 +2413,161 @@ dependencies: glob "7.1.7" -"@next/swc-android-arm-eabi@12.3.4": - version "12.3.4" - resolved "https://registry.yarnpkg.com/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-12.3.4.tgz#fd1c2dafe92066c6120761c6a39d19e666dc5dd0" - integrity sha512-cM42Cw6V4Bz/2+j/xIzO8nK/Q3Ly+VSlZJTa1vHzsocJRYz8KT6MrreXaci2++SIZCF1rVRCDgAg5PpqRibdIA== - "@next/swc-android-arm-eabi@13.0.7": version "13.0.7" resolved "https://registry.yarnpkg.com/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-13.0.7.tgz#ddbf3d092d22f17238aa34072f5dcb8129d8b23e" integrity sha512-QTEamOK/LCwBf05GZ261rULMbZEpE3TYdjHlXfznV+nXwTztzkBNFXwP67gv2wW44BROzgi/vrR9H8oP+J5jxg== -"@next/swc-android-arm64@12.3.4": - version "12.3.4" - resolved "https://registry.yarnpkg.com/@next/swc-android-arm64/-/swc-android-arm64-12.3.4.tgz#11a146dae7b8bca007239b21c616e83f77b19ed4" - integrity sha512-5jf0dTBjL+rabWjGj3eghpLUxCukRhBcEJgwLedewEA/LJk2HyqCvGIwj5rH+iwmq1llCWbOky2dO3pVljrapg== - "@next/swc-android-arm64@13.0.7": version "13.0.7" resolved "https://registry.yarnpkg.com/@next/swc-android-arm64/-/swc-android-arm64-13.0.7.tgz#96f150232eb66da377226f21a371d30389371ed5" integrity sha512-wcy2H0Tl9ME8vKy2GnJZ7Mybwys+43F/Eh2Pvph7mSDpMbYBJ6iA0zeY62iYYXxlZhnAID3+h79FUqUEakkClw== -"@next/swc-darwin-arm64@12.3.4": - version "12.3.4" - resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-12.3.4.tgz#14ac8357010c95e67327f47082af9c9d75d5be79" - integrity sha512-DqsSTd3FRjQUR6ao0E1e2OlOcrF5br+uegcEGPVonKYJpcr0MJrtYmPxd4v5T6UCJZ+XzydF7eQo5wdGvSZAyA== - "@next/swc-darwin-arm64@13.0.7": version "13.0.7" resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.0.7.tgz#34e80a22573b5321ade8417dfb814cf6e1fd9997" integrity sha512-F/mU7csN1/J2cqXJPMgTQ6MwAbc1pJ6sp6W+X0z5JEY4IFDzxKd3wRc3pCiNF7j8xW381JlNpWxhjCctnNmfaw== -"@next/swc-darwin-x64@12.3.4": - version "12.3.4" - resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-12.3.4.tgz#e7dc63cd2ac26d15fb84d4d2997207fb9ba7da0f" - integrity sha512-PPF7tbWD4k0dJ2EcUSnOsaOJ5rhT3rlEt/3LhZUGiYNL8KvoqczFrETlUx0cUYaXe11dRA3F80Hpt727QIwByQ== +"@next/swc-darwin-arm64@13.5.1": + version "13.5.1" + resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.5.1.tgz#dc21234afce27910a8d141e6a7ab5e821725dc94" + integrity sha512-Bcd0VFrLHZnMmJy6LqV1CydZ7lYaBao8YBEdQUVzV8Ypn/l5s//j5ffjfvMzpEQ4mzlAj3fIY+Bmd9NxpWhACw== + +"@next/swc-darwin-arm64@13.5.6": + version "13.5.6" + resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.5.6.tgz#b15d139d8971360fca29be3bdd703c108c9a45fb" + integrity sha512-5nvXMzKtZfvcu4BhtV0KH1oGv4XEW+B+jOfmBdpFI3C7FrB/MfujRpWYSBBO64+qbW8pkZiSyQv9eiwnn5VIQA== "@next/swc-darwin-x64@13.0.7": version "13.0.7" resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-13.0.7.tgz#ecec57211bf54a15872bb44e5ea70c99c2efe785" integrity sha512-636AuRQynCPnIPRVzcCk5B7OMq9XjaYam2T0HeWUCE6y7EqEO3kxiuZ4QmN81T7A6Ydb+JnivYrLelHXmgdj6A== -"@next/swc-freebsd-x64@12.3.4": - version "12.3.4" - resolved "https://registry.yarnpkg.com/@next/swc-freebsd-x64/-/swc-freebsd-x64-12.3.4.tgz#fe7ceec58746fdf03f1fcb37ec1331c28e76af93" - integrity sha512-KM9JXRXi/U2PUM928z7l4tnfQ9u8bTco/jb939pdFUHqc28V43Ohd31MmZD1QzEK4aFlMRaIBQOWQZh4D/E5lQ== +"@next/swc-darwin-x64@13.5.1": + version "13.5.1" + resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-13.5.1.tgz#29591ac96cc839903918621cf2d8f79c40cba3ca" + integrity sha512-uvTZrZa4D0bdWa1jJ7X1tBGIxzpqSnw/ATxWvoRO9CVBvXSx87JyuISY+BWsfLFF59IRodESdeZwkWM2l6+Kjg== + +"@next/swc-darwin-x64@13.5.6": + version "13.5.6" + resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-13.5.6.tgz#9c72ee31cc356cb65ce6860b658d807ff39f1578" + integrity sha512-6cgBfxg98oOCSr4BckWjLLgiVwlL3vlLj8hXg2b+nDgm4bC/qVXXLfpLB9FHdoDu4057hzywbxKvmYGmi7yUzA== "@next/swc-freebsd-x64@13.0.7": version "13.0.7" resolved "https://registry.yarnpkg.com/@next/swc-freebsd-x64/-/swc-freebsd-x64-13.0.7.tgz#b4a8a49c3c3d200c9d6c43193b82ee39c6eb1d59" integrity sha512-92XAMzNgQazowZ9t7uZmHRA5VdBl/SwEdrf5UybdfRovsxB4r3+yJWEvFaqYpSEp0gwndbwLokJdpz7OwFdL3Q== -"@next/swc-linux-arm-gnueabihf@12.3.4": - version "12.3.4" - resolved "https://registry.yarnpkg.com/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-12.3.4.tgz#d7016934d02bfc8bd69818ffb0ae364b77b17af7" - integrity sha512-3zqD3pO+z5CZyxtKDTnOJ2XgFFRUBciOox6EWkoZvJfc9zcidNAQxuwonUeNts6Xbm8Wtm5YGIRC0x+12YH7kw== - "@next/swc-linux-arm-gnueabihf@13.0.7": version "13.0.7" resolved "https://registry.yarnpkg.com/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-13.0.7.tgz#6f550d348c6ece2b25426a53c5be49a3a8fc54a3" integrity sha512-3r1CWl5P6I5n5Yxip8EXv/Rfu2Cp6wVmIOpvmczyUR82j+bcMkwPAcUjNkG/vMCagS4xV7NElrcdGb39iFmfLg== -"@next/swc-linux-arm64-gnu@12.3.4": - version "12.3.4" - resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-12.3.4.tgz#43a7bc409b03487bff5beb99479cacdc7bd29af5" - integrity sha512-kiX0vgJGMZVv+oo1QuObaYulXNvdH/IINmvdZnVzMO/jic/B8EEIGlZ8Bgvw8LCjH3zNVPO3mGrdMvnEEPEhKA== - "@next/swc-linux-arm64-gnu@13.0.7": version "13.0.7" resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.0.7.tgz#20bd7f25a3af0edb4d3506c005f54212eb9a855b" integrity sha512-RXo8tt6ppiwyS6hpDw3JdAjKcdVewsefxnxk9xOH4mRhMyq9V2lQx0e24X/dRiZqkx3jnWReR2WRrUlgN1UkSQ== -"@next/swc-linux-arm64-musl@12.3.4": - version "12.3.4" - resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-12.3.4.tgz#4d1db6de6dc982b974cd1c52937111e3e4a34bd3" - integrity sha512-EETZPa1juczrKLWk5okoW2hv7D7WvonU+Cf2CgsSoxgsYbUCZ1voOpL4JZTOb6IbKMDo6ja+SbY0vzXZBUMvkQ== +"@next/swc-linux-arm64-gnu@13.5.1": + version "13.5.1" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.5.1.tgz#349ce2714dc87d1db6911758652f3b2b0810dd6f" + integrity sha512-/52ThlqdORPQt3+AlMoO+omicdYyUEDeRDGPAj86ULpV4dg+/GCFCKAmFWT0Q4zChFwsAoZUECLcKbRdcc0SNg== + +"@next/swc-linux-arm64-gnu@13.5.6": + version "13.5.6" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.5.6.tgz#59f5f66155e85380ffa26ee3d95b687a770cfeab" + integrity sha512-txagBbj1e1w47YQjcKgSU4rRVQ7uF29YpnlHV5xuVUsgCUf2FmyfJ3CPjZUvpIeXCJAoMCFAoGnbtX86BK7+sg== "@next/swc-linux-arm64-musl@13.0.7": version "13.0.7" resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.0.7.tgz#f421bedcf2e1ad1ad7c90af1102df83634e92b6a" integrity sha512-RWpnW+bmfXyxyY7iARbueYDGuIF+BEp3etLeYh/RUNHb9PhOHLDgJOG8haGSykud3a6CcyBI8hEjqOhoObaDpw== -"@next/swc-linux-x64-gnu@12.3.4": - version "12.3.4" - resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-12.3.4.tgz#c3b414d77bab08b35f7dd8943d5586f0adb15e38" - integrity sha512-4csPbRbfZbuWOk3ATyWcvVFdD9/Rsdq5YHKvRuEni68OCLkfy4f+4I9OBpyK1SKJ00Cih16NJbHE+k+ljPPpag== +"@next/swc-linux-arm64-musl@13.5.1": + version "13.5.1" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.5.1.tgz#3f8bc223db9100887ffda998ad963820f39d944b" + integrity sha512-L4qNXSOHeu1hEAeeNsBgIYVnvm0gg9fj2O2Yx/qawgQEGuFBfcKqlmIE/Vp8z6gwlppxz5d7v6pmHs1NB6R37w== + +"@next/swc-linux-arm64-musl@13.5.6": + version "13.5.6" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.5.6.tgz#f012518228017052736a87d69bae73e587c76ce2" + integrity sha512-cGd+H8amifT86ZldVJtAKDxUqeFyLWW+v2NlBULnLAdWsiuuN8TuhVBt8ZNpCqcAuoruoSWynvMWixTFcroq+Q== "@next/swc-linux-x64-gnu@13.0.7": version "13.0.7" resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.0.7.tgz#76cb25d3c00041dabc02e0b3ddd10f9325eb3f60" integrity sha512-/ygUIiMMTYnbKlFs5Ba9J5k/tNxFWy8eI1bBF8UuMTvV8QJHl/aLDiA5dwsei2kk99/cu3eay62JnJXkSk3RSQ== -"@next/swc-linux-x64-musl@12.3.4": - version "12.3.4" - resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-12.3.4.tgz#187a883ec09eb2442a5ebf126826e19037313c61" - integrity sha512-YeBmI+63Ro75SUiL/QXEVXQ19T++58aI/IINOyhpsRL1LKdyfK/35iilraZEFz9bLQrwy1LYAR5lK200A9Gjbg== +"@next/swc-linux-x64-gnu@13.5.1": + version "13.5.1" + resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.5.1.tgz#4503d43d27aa178efb4a5c9efe229faae37d67a8" + integrity sha512-QVvMrlrFFYvLtABk092kcZ5Mzlmsk2+SV3xYuAu8sbTuIoh0U2+HGNhVklmuYCuM3DAAxdiMQTNlRQmNH11udw== + +"@next/swc-linux-x64-gnu@13.5.6": + version "13.5.6" + resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.5.6.tgz#339b867a7e9e7ee727a700b496b269033d820df4" + integrity sha512-Mc2b4xiIWKXIhBy2NBTwOxGD3nHLmq4keFk+d4/WL5fMsB8XdJRdtUlL87SqVCTSaf1BRuQQf1HvXZcy+rq3Nw== "@next/swc-linux-x64-musl@13.0.7": version "13.0.7" resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.0.7.tgz#4e49b54b3578f7c4753dd7ac9c5e683914427884" integrity sha512-dLzr6AL77USJN0ejgx5AS8O8SbFlbYTzs0XwAWag4oQpUG2p3ARvxwQgYQ0Z+6EP0zIRZ/XfLkN/mhsyi3m4PA== -"@next/swc-win32-arm64-msvc@12.3.4": - version "12.3.4" - resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-12.3.4.tgz#89befa84e453ed2ef9a888f375eba565a0fde80b" - integrity sha512-Sd0qFUJv8Tj0PukAYbCCDbmXcMkbIuhnTeHm9m4ZGjCf6kt7E/RMs55Pd3R5ePjOkN7dJEuxYBehawTR/aPDSQ== +"@next/swc-linux-x64-musl@13.5.1": + version "13.5.1" + resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.5.1.tgz#a6e81f0df0be2fac78392705f487036695cf7b10" + integrity sha512-bBnr+XuWc28r9e8gQ35XBtyi5KLHLhTbEvrSgcWna8atI48sNggjIK8IyiEBO3KIrcUVXYkldAzGXPEYMnKt1g== + +"@next/swc-linux-x64-musl@13.5.6": + version "13.5.6" + resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.5.6.tgz#ae0ae84d058df758675830bcf70ca1846f1028f2" + integrity sha512-CFHvP9Qz98NruJiUnCe61O6GveKKHpJLloXbDSWRhqhkJdZD2zU5hG+gtVJR//tyW897izuHpM6Gtf6+sNgJPQ== "@next/swc-win32-arm64-msvc@13.0.7": version "13.0.7" resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.0.7.tgz#98f622f9d0e34746e1ec7f25ce436a809a42313d" integrity sha512-+vFIVa82AwqFkpFClKT+n73fGxrhAZ2u1u3mDYEBdxO6c9U4Pj3S5tZFsGFK9kLT/bFvf/eeVOICSLCC7MSgJQ== -"@next/swc-win32-ia32-msvc@12.3.4": - version "12.3.4" - resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-12.3.4.tgz#cb50c08f0e40ead63642a7f269f0c8254261f17c" - integrity sha512-rt/vv/vg/ZGGkrkKcuJ0LyliRdbskQU+91bje+PgoYmxTZf/tYs6IfbmgudBJk6gH3QnjHWbkphDdRQrseRefQ== +"@next/swc-win32-arm64-msvc@13.5.1": + version "13.5.1" + resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.5.1.tgz#9d8517fe1dd6aa348c7be36b933ad8195f961294" + integrity sha512-EQGeE4S5c9v06jje9gr4UlxqUEA+zrsgPi6kg9VwR+dQHirzbnVJISF69UfKVkmLntknZJJI9XpWPB6q0Z7mTg== + +"@next/swc-win32-arm64-msvc@13.5.6": + version "13.5.6" + resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.5.6.tgz#a5cc0c16920485a929a17495064671374fdbc661" + integrity sha512-aFv1ejfkbS7PUa1qVPwzDHjQWQtknzAZWGTKYIAaS4NMtBlk3VyA6AYn593pqNanlicewqyl2jUhQAaFV/qXsg== "@next/swc-win32-ia32-msvc@13.0.7": version "13.0.7" resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.0.7.tgz#f27f99aeec4207be7688a417f5934ea4868dadfc" integrity sha512-RNLXIhp+assD39dQY9oHhDxw+/qSJRARKhOFsHfOtf8yEfCHqcKkn3X/L+ih60ntaEqK294y1WkMk6ylotsxwA== -"@next/swc-win32-x64-msvc@12.3.4": - version "12.3.4" - resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-12.3.4.tgz#d28ea15a72cdcf96201c60a43e9630cd7fda168f" - integrity sha512-DQ20JEfTBZAgF8QCjYfJhv2/279M6onxFjdG/+5B0Cyj00/EdBxiWb2eGGFgQhrBbNv/lsvzFbbi0Ptf8Vw/bg== +"@next/swc-win32-ia32-msvc@13.5.1": + version "13.5.1" + resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.5.1.tgz#42e711d00642f538edaabf9535545697d093b2f7" + integrity sha512-1y31Q6awzofVjmbTLtRl92OX3s+W0ZfO8AP8fTnITcIo9a6ATDc/eqa08fd6tSpFu6IFpxOBbdevOjwYTGx/AQ== + +"@next/swc-win32-ia32-msvc@13.5.6": + version "13.5.6" + resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.5.6.tgz#6a2409b84a2cbf34bf92fe714896455efb4191e4" + integrity sha512-XqqpHgEIlBHvzwG8sp/JXMFkLAfGLqkbVsyN+/Ih1mR8INb6YCc2x/Mbwi6hsAgUnqQztz8cvEbHJUbSl7RHDg== "@next/swc-win32-x64-msvc@13.0.7": version "13.0.7" resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.0.7.tgz#7aaa6cee723cde844e891e895e5561a60d9fa7f3" integrity sha512-kvdnlLcrnEq72ZP0lqe2Z5NqvB9N5uSCvtXJ0PhKvNncWWd0fEG9Ec9erXgwCmVlM2ytw41k9/uuQ+SVw4Pihw== +"@next/swc-win32-x64-msvc@13.5.1": + version "13.5.1" + resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.5.1.tgz#34bc139cf37704d595fe84eb803b1578a539e35e" + integrity sha512-+9XBQizy7X/GuwNegq+5QkkxAPV7SBsIwapVRQd9WSvvU20YO23B3bZUpevdabi4fsd25y9RJDDncljy/V54ww== + +"@next/swc-win32-x64-msvc@13.5.6": + version "13.5.6" + resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.5.6.tgz#4a3e2a206251abc729339ba85f60bc0433c2865d" + integrity sha512-Cqfe1YmOS7k+5mGu92nl5ULkzpKuxJrP3+4AEuPmrpFZ3BHxTY3TnHmU1On3bFmFFs6FbTcdF58CCUProGpIGQ== + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -3370,13 +3578,6 @@ "@size-limit/esbuild" "7.0.8" "@size-limit/file" "7.0.8" -"@swc/helpers@0.4.11": - version "0.4.11" - resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.4.11.tgz#db23a376761b3d31c26502122f349a21b592c8de" - integrity sha512-rEUrBSGIoSFuYxwBYtlUFMlE2CwGhmW+w9355/5oduSw8e5h2+Tj4UrAGNNgP9915++wj5vkQo0UuOBqOAq4nw== - dependencies: - tslib "^2.4.0" - "@swc/helpers@0.4.14": version "0.4.14" resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.4.14.tgz#1352ac6d95e3617ccb7c1498ff019654f1e12a74" @@ -3384,6 +3585,13 @@ dependencies: tslib "^2.4.0" +"@swc/helpers@0.5.2": + version "0.5.2" + resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.5.2.tgz#85ea0c76450b61ad7d10a37050289eded783c27d" + integrity sha512-E4KcWTpoLHqwPHLxidpOqQbcrZVgi0rsmmZXUle1jXmJfuIf/UWpczUJ7MZZ5tlxytgJXyp0w4PGkkeLiuIdZw== + dependencies: + tslib "^2.4.0" + "@szmarczak/http-timer@^1.1.2": version "1.1.2" resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-1.1.2.tgz#b1665e2c461a2cd92f4c1bbf50d5454de0d4b421" @@ -4888,7 +5096,7 @@ builtins@^5.0.0: dependencies: semver "^7.0.0" -busboy@^1.6.0: +busboy@1.6.0, busboy@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/busboy/-/busboy-1.6.0.tgz#966ea36a9502e43cdb9146962523b92f531f6893" integrity sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA== @@ -8653,6 +8861,11 @@ glob-parent@5.1.2, glob-parent@^5.1.2, glob-parent@~5.1.2: dependencies: is-glob "^4.0.1" +glob-to-regexp@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" + integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== + glob@7.1.4: version "7.1.4" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" @@ -11485,6 +11698,11 @@ lodash.set@^4.3.2: resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23" integrity sha512-4hNPN5jlm/N/HLMCO43v8BXKq9Z7QdAGc/VGrRD61w8gN9g/6jF9A4L1pbUgBLCffi0w9VsXfTOij5x8iTyFvg== +lodash.sortby@^4.7.0: + version "4.7.0" + resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" + integrity sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA== + lodash.truncate@^4.4.2: version "4.4.2" resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" @@ -12917,31 +13135,52 @@ next@13.0.7: "@next/swc-win32-ia32-msvc" "13.0.7" "@next/swc-win32-x64-msvc" "13.0.7" -next@^12.3.1: - version "12.3.4" - resolved "https://registry.yarnpkg.com/next/-/next-12.3.4.tgz#f2780a6ebbf367e071ce67e24bd8a6e05de2fcb1" - integrity sha512-VcyMJUtLZBGzLKo3oMxrEF0stxh8HwuW976pAzlHhI3t8qJ4SROjCrSh1T24bhrbjw55wfZXAbXPGwPt5FLRfQ== +next@13.5.1: + version "13.5.1" + resolved "https://registry.yarnpkg.com/next/-/next-13.5.1.tgz#cf51e950017121f5404eedbde7d59d9ed310839b" + integrity sha512-GIudNR7ggGUZoIL79mSZcxbXK9f5pwAIPZxEM8+j2yLqv5RODg4TkmUlaKSYVqE1bPQueamXSqdC3j7axiTSEg== dependencies: - "@next/env" "12.3.4" - "@swc/helpers" "0.4.11" + "@next/env" "13.5.1" + "@swc/helpers" "0.5.2" + busboy "1.6.0" caniuse-lite "^1.0.30001406" postcss "8.4.14" - styled-jsx "5.0.7" - use-sync-external-store "1.2.0" + styled-jsx "5.1.1" + watchpack "2.4.0" + zod "3.21.4" + optionalDependencies: + "@next/swc-darwin-arm64" "13.5.1" + "@next/swc-darwin-x64" "13.5.1" + "@next/swc-linux-arm64-gnu" "13.5.1" + "@next/swc-linux-arm64-musl" "13.5.1" + "@next/swc-linux-x64-gnu" "13.5.1" + "@next/swc-linux-x64-musl" "13.5.1" + "@next/swc-win32-arm64-msvc" "13.5.1" + "@next/swc-win32-ia32-msvc" "13.5.1" + "@next/swc-win32-x64-msvc" "13.5.1" + +next@^13.5.6: + version "13.5.6" + resolved "https://registry.yarnpkg.com/next/-/next-13.5.6.tgz#e964b5853272236c37ce0dd2c68302973cf010b1" + integrity sha512-Y2wTcTbO4WwEsVb4A8VSnOsG1I9ok+h74q0ZdxkwM3EODqrs4pasq7O0iUxbcS9VtWMicG7f3+HAj0r1+NtKSw== + dependencies: + "@next/env" "13.5.6" + "@swc/helpers" "0.5.2" + busboy "1.6.0" + caniuse-lite "^1.0.30001406" + postcss "8.4.31" + styled-jsx "5.1.1" + watchpack "2.4.0" optionalDependencies: - "@next/swc-android-arm-eabi" "12.3.4" - "@next/swc-android-arm64" "12.3.4" - "@next/swc-darwin-arm64" "12.3.4" - "@next/swc-darwin-x64" "12.3.4" - "@next/swc-freebsd-x64" "12.3.4" - "@next/swc-linux-arm-gnueabihf" "12.3.4" - "@next/swc-linux-arm64-gnu" "12.3.4" - "@next/swc-linux-arm64-musl" "12.3.4" - "@next/swc-linux-x64-gnu" "12.3.4" - "@next/swc-linux-x64-musl" "12.3.4" - "@next/swc-win32-arm64-msvc" "12.3.4" - "@next/swc-win32-ia32-msvc" "12.3.4" - "@next/swc-win32-x64-msvc" "12.3.4" + "@next/swc-darwin-arm64" "13.5.6" + "@next/swc-darwin-x64" "13.5.6" + "@next/swc-linux-arm64-gnu" "13.5.6" + "@next/swc-linux-arm64-musl" "13.5.6" + "@next/swc-linux-x64-gnu" "13.5.6" + "@next/swc-linux-x64-musl" "13.5.6" + "@next/swc-win32-arm64-msvc" "13.5.6" + "@next/swc-win32-ia32-msvc" "13.5.6" + "@next/swc-win32-x64-msvc" "13.5.6" nextjs-progressbar@^0.0.14: version "0.0.14" @@ -14256,7 +14495,7 @@ postcss@8.4.14: picocolors "^1.0.0" source-map-js "^1.0.2" -postcss@^8.3.11, postcss@^8.4.19, postcss@^8.4.4: +postcss@8.4.31, postcss@^8.3.11, postcss@^8.4.19, postcss@^8.4.4: version "8.4.31" resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.31.tgz#92b451050a9f914da6755af352bdc0192508656d" integrity sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ== @@ -16130,11 +16369,6 @@ style-to-object@^0.3.0: dependencies: inline-style-parser "0.1.1" -styled-jsx@5.0.7: - version "5.0.7" - resolved "https://registry.yarnpkg.com/styled-jsx/-/styled-jsx-5.0.7.tgz#be44afc53771b983769ac654d355ca8d019dff48" - integrity sha512-b3sUzamS086YLRuvnaDigdAewz1/EFYlHpYBP5mZovKEdQQOIIYq8lApylub3HHZ6xFjV051kkGU7cudJmrXEA== - styled-jsx@5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/styled-jsx/-/styled-jsx-5.1.0.tgz#4a5622ab9714bd3fcfaeec292aa555871f057563" @@ -16142,6 +16376,13 @@ styled-jsx@5.1.0: dependencies: client-only "0.0.1" +styled-jsx@5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/styled-jsx/-/styled-jsx-5.1.1.tgz#839a1c3aaacc4e735fed0781b8619ea5d0009d1f" + integrity sha512-pW7uC1l4mBZ8ugbiZrcIsiIvVx1UmTfw7UkC3Um2tmfUq9Bhk8IiyEIPl6F8agHgjzku6j0xQEZbfA5uSgSaCw== + dependencies: + client-only "0.0.1" + stylelint-config-recess-order@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/stylelint-config-recess-order/-/stylelint-config-recess-order-3.1.0.tgz#aeeddd658f726c1252d95efe54e79d246667ae1f" @@ -17246,11 +17487,6 @@ urlpattern-polyfill@^8.0.0: resolved "https://registry.yarnpkg.com/urlpattern-polyfill/-/urlpattern-polyfill-8.0.2.tgz#99f096e35eff8bf4b5a2aa7d58a1523d6ebc7ce5" integrity sha512-Qp95D4TPJl1kC9SKigDcqgyM2VDVO4RiJc2d4qe5GrYm+zbIQCWWKAFaJNQ4BhdFeDGwBmAxqJBwWSJDb9T3BQ== -use-sync-external-store@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a" - integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA== - util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" @@ -17476,6 +17712,14 @@ walker@^1.0.8: dependencies: makeerror "1.0.12" +watchpack@2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.0.tgz#fa33032374962c78113f93c7f2fb4c54c9862a5d" + integrity sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg== + dependencies: + glob-to-regexp "^0.4.1" + graceful-fs "^4.1.2" + wcwidth@^1.0.0, wcwidth@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" @@ -18061,6 +18305,11 @@ yosay@^2.0.2: taketalk "^1.0.0" wrap-ansi "^2.0.0" +zod@3.21.4: + version "3.21.4" + resolved "https://registry.yarnpkg.com/zod/-/zod-3.21.4.tgz#10882231d992519f0a10b5dd58a38c9dabbb64db" + integrity sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw== + zod@^3.20.2: version "3.22.3" resolved "https://registry.yarnpkg.com/zod/-/zod-3.22.3.tgz#2fbc96118b174290d94e8896371c95629e87a060"